Realtek Driver Problem
Posted: Mon Mar 24, 2014 9:20 am
Hi,
I am having a problem with my realtek driver.
I was able to probe the PCI configuration and detect it, and read the mac address correctly.
Here is my code
I call the above code like this
The problem is that the card does not fire any interrupts. I have both the keyboard and the pic timer working and firing interrupts.
The card is detected at interupt line 11 and interrupt_pin 1, and to force an interrupt to happen and execute the interrupt handler (which prints a string on the screen), I send an ethernet frame to the associated mac address and I can see the ethernet packet on the network using tcpdump from another machine.
I also added a print string inside the interrupt handler hub function printing the interrupt number before routing to the irq specific handler but this does not work except for the pic and the keyboard.
Any ideas what could be my problem and how can I enforce the interrupt to occur, especially that I did not implement the TCP layer in my OS yet.
Thanks
I am having a problem with my realtek driver.
I was able to probe the PCI configuration and detect it, and read the mac address correctly.
Here is my code
Code: Select all
io_base = pciConfigHeader->getPCIBar(PCI_BAR_IO) & ~1;
mem_base = (uint8_t *)(pciConfigHeader->getPCIBar( PCI_BAR_MEM) & ~3);
rx_buffer = (uint8_t *) kmalloc_ptr->kmalloc_a((uint64_t)20*FOURKILO);
tx_buffers = (uint8_t *) kmalloc_ptr->kmalloc_a((uint64_t)32*FOURKILO);
outb(Config1, 0x0);
outb(ChipCmd, CmdReset);
while((inb(ChipCmd) & CmdReset) != 0);
video.putString("Realtek reset completed\n" ,COLOR_LIGHT_BROWN,COLOR_BLACK);
Utils::memset(rx_buffer, 0, 20*FOURKILO);
outl(RxBuf,(uint64_t)rx_buffer);
outb(ChipCmd, 0xc);
video.putString("Realtek set rx_buffer\n" ,COLOR_LIGHT_BROWN,COLOR_BLACK);
for(int i=0; i < 4; i++)
outl(TxAddr0 + i*4, ((uint64_t)tx_buffers) + i*(8192 +16+1500));
video.putString("Realtek set tx_buffer\n" ,COLOR_LIGHT_BROWN,COLOR_BLACK);
getMac();
outw(IntrMask, 0x0005);
outl(RxConfig, AcceptBroadcast | AcceptMyPhys | AcceptAllPhys);
register_interrupt_handler(IRQ0+pciConfigHeader->getIntLine(),&handler);
Code: Select all
PCIConfigHeaderManager * pciConfigHeaderManager = new PCIConfigHeaderManager();
PCIConfigHeader * pciConfigHeader = pciConfigHeaderManager->getPCIDevice(0x10ec,0x8139);
if ( pciConfigHeader != NULL )
{
RTL8139 * rtl8139 = new RTL8139(pciConfigHeader);
rtl8139->start(); // This is the method that contains the above code.
}
The problem is that the card does not fire any interrupts. I have both the keyboard and the pic timer working and firing interrupts.
The card is detected at interupt line 11 and interrupt_pin 1, and to force an interrupt to happen and execute the interrupt handler (which prints a string on the screen), I send an ethernet frame to the associated mac address and I can see the ethernet packet on the network using tcpdump from another machine.
I also added a print string inside the interrupt handler hub function printing the interrupt number before routing to the irq specific handler but this does not work except for the pic and the keyboard.
Any ideas what could be my problem and how can I enforce the interrupt to occur, especially that I did not implement the TCP layer in my OS yet.
Thanks