1. Introduction
Due to the particularity of the BootLoader and the dedicatedity compared to the operating system, there is no need to comply with any drive model relatively, and there is no need to consider the factors such as mutual exclusion, synchronization, and re-enter.
Here LAN91C113I drives three functions: NIC initialization, packaging, receipts, mainly providing fast downloads of the file system during debugging.
2. the term
LAN91C113i: 16-bit 10/100 Adaptive non-PCI single-chip Ethernet card.
Auto-Negotiation: Automatic negotiation mode while trying to establish a connection with the remote device.
Bootp: Boot protocol, based on UDP / IP, used to get IP from the server from the server.
TFTP: Simple File Transfer Protocol.
3. Drive implementation
1. initialization
Set the NIC access method, the usual network card is directly connected to the CPU chip selection signal line with asynchronous storage devices, which can work in the RAM mode and the VLIO. Here we choose to work in the VLIO method, this step changes with different system structures.
Mac / PHY settings, this step is completely referred to the hardware design manual, and the difference between different hardware is large, but the method is substantially the same.
2. Preteit
Access the network card storage area with the query I / O, which is determined by the work characteristics of the bootloader, and there is no interrupt mechanism.
4. Pay attention
1. Setting the access method directly determines whether it is possible to read and write the device normally. In the development process, we encounter this problem, and read the device ID correctly without the access mode setting error.
2. Auto-Negotiation use issues, need to be stringent according to the requirements of the document, waiting for 1.5 seconds.
3. Phycial Register needs to use the Management Interface register to follow documentation requirements, serial settings, and specific access methods can be refer to DataSheet.
4. NIC usually has MMU to perform its internal storage management, generally work in automatic mode and manual mode, note that the auto / manual here only indicates that the store is successfully released, and any other case requires a program request MMU allocation / release storage .
5. Little-Endian / Big-Endian, if the IO facility in the kernel can be used without consideration, but if you take the value directly to the multi-byte address, you need to consider Little-Endian / Big-Endian. Refer to DataSheet for details.
6. Problems related to the agreement, mainly in delay. Due to no interrupt mechanism, if the network is busy, the packet loss occurs, and it is necessary to shorten the delay. On the other hand, it will cause frequent retransmission packages, and the appropriate delay is only obtained by repeated testing.
7. The debugging means can only be completed by the serial port, and any auxiliary facility cannot be used with the operating system.
8. The problem that other specific hardware needs to be aware of DataSheet will be introduced. For driver development, DataSheet is equivalent to MSDN.