Communication with NE2000 is done through reading and writing its memory space. This is done through ISA (Industry Standard Architectur) bus, by addressing the memory location of NE2000 with 5 of 20 address lines available on the bus, and reading/writing data on 8 data lines. Controller chip on my card is RTL8019AS. Registers description and operating instructions are described in RTL8019AS datasheet.
I have interfaced an old NE2000 compatible ISA ethernet network card to the ATmega8 MCU and made a simple web server. Since NE2000 operates on a link layer level, to make a working web server, I had to write a simple TCP/IP stack implementation.
TCP/IP stack implementation is a receive-process-return model. When a packet is received it is passed to ethernet processing function. This function reads ethernet header and extracts payload which is passed to an ARP or an IP packet processing function. If passed to IP processing function, this function reads IP header, extracts it's payload and passes it to UDP or TCP processing function. TCP processing function passes the payload to HTTP processing function, which processes HTTP request, generates HTTP response and returns it to IP processing function. I IP processing function TCP header is added and everything is returned to IP processing function where IP header is added, and so on until packet is sent to NE2000 to be sent to a network.
Project source code is available on https://github.com/matijaspanic/NE2000
Tags: AVR network