The MAC module contains the driver software for the RTL8019AS NIC chip. It provides functions for reading and writing data from and to it. The RTL8019AS is a NE2000 compatible NIC, that implements both the Ethernet physical (PHY) and MAC layers. If a different NIC is to be used, users will need to modify or create a new "mac.c" file to implement access. As long as services provided by "mac.c" are not changed, all other modules will remain unchanged.
The stack utilizes the on-chip SRAM available on the NIC as a holding buffer, until a higher level module reads it. It also performs the necessary IP checksum calculations in the NICís SRAM buffer. In addition to the receive FIFO buffer managed by the NIC itself, the MAC layer manages its own transmit queue. Using this queue, the caller can transmit a message and request the MAC to reserve it so that the same message can be retransmitted, if required. The user can specify sizes for the transmit buffer, transmit queue and receive queue using ĎCí defines - see projdefs.h for details.
The NIC has 8kbytes of RAM, devided into 256byte pages. At initialization, a group of these pages will be configured to be the RX buffer. The remaining pages are used for user RAM and for the TX buffer.
During reception, the NIC will transfer the received packet via Local DMA to the RX buffer. The user has to check if the RX buffer contains any packets, and if so, remove them via Remote DMA access (MACGetRxbuf and MACGetArray functions). One of two RTL8019AS commands can be used to retrieve received packets from the RX buffer:
- Remote read command. The user has to set the "Remote Start Registers" and the lenght. The User also has to remove the packet from the RX buffer once read.
- Send Packet command. The Remote SMA registers are automatically configured to read the next packet from the RX buffer. After it has been read, it ia automatically removed too.
Transmission is done via writing the TX packet to a location in RAM via Remote DMA, and than setting registers in the NIC to start transmission.
The MAC makes all received packets available to the user via the MACGetRxbuf() and MACGetArray() functions. These functions will read the given amount of bytes from the current RX Buffer. The current receive buffer is the one we are currently reading from. The MACDiscardRx() function will free the current receive buffer.
For details on configuring this module, see Configuration section of mac.h file.
| ||MAC Module for Modtronix TCP/IP Stack. |
Generated on Mon Oct 9 13:22:09 2006 for SBC65EC Web Server by