Page 1 of 1

The problem about ne2k driver

Posted: Thu Apr 03, 2014 8:37 am
by Cobbage
i want to write a ne2k driver

I get the driver information through niclist.exe
configuration information:
pci: enabled=1, chipset=i440fx, slot1=pcivga, slot2=ne2k
ne2k: ioaddr=0x300, irq=3, mac=b0:c4:20:00:00:00, ethmod=win32, ethdev=\Device\NPF_{424E41E2-E188-444D-B744-831E97F263BA}

but the after run the log have some error information:[NE2K ] device not ready to receive data
[PIT81] Undefined behavior when loading a half loaded count

at the moment i just want to get the mac through prom(0x00 - 0x0c)

first i reset it through :

Code: Select all

int ne2k_reset(){
     int tmp=0;
	 
	 //reset the net card     0x300+0x1f
	 port_write_byte(NE2K_IOADDR + NIC_RESET,0x00);
	 
	 tmp=0xFFF;
	 while(tmp--);
	 //                       0x300           + 0x07 =ISR
     tmp=port_read_byte(NE2K_IOADDR + NIC_INTR_STATUS);
	if(tmp&0x80){
      put_strln("Ne2k reset is success!");	
	  return 1;
	}else{
	  put_strln("Ne2k reset is error!");
	  return 0;
	}
}
second get the mac: set the address 0,length 0x0c

why at the end i get the result all is FF,what i should do? please help me

Re: The problem about ne2k driver

Posted: Thu Apr 03, 2014 9:01 am
by Combuster
You configured your NIC as a PCI device. A PCI device generally doesn't have fixed addresses, but gets them assigned wherever there's space.

Re: The problem about ne2k driver

Posted: Thu Apr 03, 2014 9:49 am
by Cobbage
Combuster wrote:You configured your NIC as a PCI device. A PCI device generally doesn't have fixed addresses, but gets them assigned wherever there's space.
you mean the address is error?

the address set the RSAR0(0x08) 0x00
RSAR1(0x09) 0x00

length is RBCR0(0x0a) 0x0c
RBCR1(0x0b) 0x00

i understand set the address is net card private,not is memory,if i'm wrong how i get the current address ? through analysis the pci configuration