The problem about ne2k driver

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
Cobbage
Posts: 4
Joined: Thu Jan 02, 2014 12:10 am

The problem about ne2k driver

Post 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
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: The problem about ne2k driver

Post 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.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Cobbage
Posts: 4
Joined: Thu Jan 02, 2014 12:10 am

Re: The problem about ne2k driver

Post 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
Post Reply