This project runs on the Atmel ATMega32 microprocessors. Hosts connect to routers, and routers to one another, via two-wire cables. Routers and hosts connect to their Atmel AT45D021a Memory units via the Serial Peripheral Interface.
Each microcontroller is configured as either a host or a router. In true IP, routers have IP addresses for each interface. However, for the sake of simplicity, the routers are treated as switches, even though they use the IP layer, so that they do not receive IP messages nor do they create IP messages, eliminating the need for addressable interfaces on routers.
ElementsA dynamic allocator and interface to the dataflash is called by the IP layer. Packets are dealt with 33 bytes at a time, as this is 1/4 of a 264-byte physical dataflash page. Blocks are allocated 4 pages at a time, which is enough space for the 1006-byte standard Maximum Transfer Unit for SLIP.
The link layer in the host uses hardware-driven UART interrupts to drive the physical layer. A state machine decodes SLIP packets and sends and receives messages from the IP layer (inappropriately named link.c). In the "router", the host uses a timer interrupts to drive a state machine that simultaneously decodes RS232 and SLIP. Packet end notifications are sent and received from the IP layer, as well as byte receive notifications and byte string transmit messages.
The IP layer consists of a receiver and receiver handler functions, transmitter and transmitter driver functions. The receiver and transmitter in the router are called repeatedly in a loop from the main function. In the host, they are called from a timer interrupt routine. They interact with the data layer through function calls, and the upper-layer protocols (and each other in the router) through handler/driver functions.
The transmitter driver functions consist of start, send, and finish routines. The start obtains the method of transmittal: to be cached or sent directly (depending on whether the transmitter is presently in use), and the block number in the dataflash the sender is allowed to write to. The send either puts a byte string on the link layer or caches it to the appropriate page. The finish either aborts the send, or notifies the link layer of packet competion, or enqueues the memory block if it was being cached. The transmitter always checks the queue for cached pages before allowing direct send access.
The receiver handler functions consist of a start function, called at the beginning of a packet, an error function, called when an error is detected, a receive function, called when 33 bytes or the end of a packet have been received, with the received byte string as a parameter, and a finish function, called when a receive needs to be aborted or when a packet was successfully received.
In the router, the IP layer also includes a lookup function that translates IP addresses to interface numbers, and calls the error handler if the returned interface is not valid.
The transport layer is not yet designed.
The application layer is not yet designed.