Page 4 of 4

Posted: Wed Apr 18, 2007 12:54 am
by pcmattman
Is this better?

Code: Select all

	struct ne2000_t* ne = neDevs[0];
	uint8_t status;
	packet_t *p;
	
	// main loop
	while( 1 )
	{
		// check ISR bit
		unsigned char isr = inportb( ne->ioAddress + INTERRUPTSTATUS );
		
		// is it set for receive?
		if( status & 0x01 )
		{
			// clear the bit
			outportb( ne->ioAddress + INTERRUPTSTATUS, isr & 0xFE );
			
			// received
			p = readPacket( ne );
			handleEthernet( ne->eth, p );
		}
		else
		{
			// nope
			break;
		}
	}
Edit: the above doesn't work...

Posted: Wed Apr 18, 2007 1:05 am
by mystran
Like I said, you must read "CURRENT" pointer from page1, and deal with that. Otherwise you'll end up reading at most one packet per interrupt, and that won't work, because any interrupt might indicate any amount of packets.

You could look into the driver code I posted. :)

Posted: Wed Apr 18, 2007 1:07 am
by pcmattman
I see. Well, for now I'll keep my driver for testing (it works for now) but later I'll factor in your code.