receive config register of rtl8139 card is reseting to 0

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
rajnesh
Posts: 3
Joined: Fri Jul 22, 2011 11:31 am

receive config register of rtl8139 card is reseting to 0

Post by rajnesh »

I am writing a rtl8139 network driver.
However I am not able to receive packets. On debugging I found that the receive config register (0x44) is reseting its value to 0.

Code: Select all

outl((BaseAddress + 0x44), 0x000002FF);  // For receiving all type of packets.
 uint32 reg2 = inl(BaseAddress + 0x44);   // reading if changes get reflected
  reg2 is 0.   // no change.

I am testing it in qemu.

Code: Select all

#  qemu script to run kernel
brctl addbr br0
tunctl -t tap0 -u root2
brctl addif br0 eth0
brctl addif br0 tap0
ifconfig eth0 up
ifconfig tap0 up
ifconfig br0 10.0.2.21/24
ifconfig eth0 0.0.0.0 promisc
[b]qemu -m 1G -kernel kernel -net nic,macaddr=05:aa:10:60:21:01,model=rtl8139 -net tap,ifname=tap0,script=no[/b]
ifconfig br0 down
brctl delbr br0
--thanks
kosmisk
Posts: 11
Joined: Sat Jul 17, 2010 12:34 pm

Re: receive config register of rtl8139 card is reseting to 0

Post by kosmisk »

Hi, i dont see all of your code but,
have you reset the interrupts by writing 1 to the bits of offset 003Eh register?
have you set the CAPR read pointer which keeps the address of data that driver had read?
if not, i think you must.
rajnesh
Posts: 3
Joined: Fri Jul 22, 2011 11:31 am

Re: receive config register of rtl8139 card is reseting to 0

Post by rajnesh »

Code: Select all

uint32 rtl8139_rx_buffer = imalloc(1000);
    //power on 
    outb( (uint16) (BaseAddress + 0x52), 0x00);
   //reset 
   outb( (uint16) (BaseAddress + RTL8139_COMMAND), 0x10);
    while ( (inb( (uint16) (BaseAddress + RTL8139_COMMAND)) & 0x10) != 0 ) {
      printf("In Reset\n");
    }
    // Setup receive buffer location
    outl( (uint16) (BaseAddress + 0x30), (uint32)rtl8139_rx_buffer );
    // IRQ
    outw( (uint16) (BaseAddress + 0x3c), 0xe1ff);    
    // Enable receive
    outb( (uint16) (BaseAddress + RTL8139_COMMAND), 0x0C );

   // revision id
   uint32 reg = inb(BaseAddress + 0x05E);
   printf("Reg is %x\n", reg);

   outw((BaseAddress + 0x03e), 0xe1ff);    // setting as what you said
   outw((BaseAddress + 0x0038), rtl8139_rx_buffer);

      outl((BaseAddress + 0x44), 0x2FF);
      uint32 reg2 = inl(BaseAddress + 0x44);

   printf("Reg2r  is %x\n", reg2);  //this is still coming 0
jammmie999
Posts: 13
Joined: Sun Feb 06, 2011 4:54 am

Re: receive config register of rtl8139 card is reseting to 0

Post by jammmie999 »

Hey, I've got a similar problem, did you ever come up with a solution?

Thanks
Post Reply