When I finally thought that my rtl8139 driver was working perfectly another and hopefully the last problem occurred. I decided to look at the issue a couple times before posting here because I had already posted a issue with this driver a couple weeks back, unfortunately I can not figure this one out. So the situation is as followed. The driver now receives properly on my real pc but it has a weird behavior when sending data. When I send for example a dhcp packet over the network there are 2 bytes added to the packet I send, let me explain.
This is what I suspect to be send:
But instead I capture this with wireshark:FF FF FF FF FF FF
45 00 01 48 00 01
40 00 FF FF FF FF...
I have no idea why this is happening, I have already tried to zero out the memory and tried a lot of different configurations for the device but that did not fix it. In the attachment you can see the received packets, the bottom 5 should have been dhcp, you can ignore the first 2 packets. I really hope that anyone can help me with this problem since I have had way to much issues with this so called "simple device".00 00 FF FF FF FF FF FF
45 00 01 48 00 01 40 00
FF FF FF FF...
My code for sending:
Code: Select all
void RTL8139::SendData(uint8_t* data, uint32_t len)
{
if(len > 1536)
{
printf("Packet to big to send!\n");
while(1);
}
void* transfer_data = MemoryManager::activeMemoryManager->malloc(len);
MemoryOperations::memset(transfer_data, 0, len);
MemoryOperations::memcpy(transfer_data, data, len);
// Second, fill in physical address of data, and length
outportl(device->portBase + TSAD_array[tx_cur], (uint32_t)transfer_data);
outportl(device->portBase + TSD_array[tx_cur++], len);
if(tx_cur > 3)
tx_cur = 0;
}
And the repo: https://github.com/Remco123/CactusOS
Thank you in advance