分类: LINUX
2011-01-03 05:18:51
1. Reset
DMA registers的值设为0;
2. Initialization
- Allocate the descriptor and status array in memory;
- Write the base address of the descriptor array to TxDescriptor register;
- Write the base address of the status array to TxStatus register;
- Write the number of descriptors and statuses minus 1 to the TxDescriptor number register (一个descriptor对应一个status);
- The descriptors and statuses in the arrays need not be initialized yet;
3. Enable the transmit datapath
Setting the TxEnable bit in the command register;
4. Setting up the descriptor
- 根据payload大小,并加上TCP/IP header, 看需要分配几个descriptor。将descriptor指向数据;
- 如果frame分为几个fragment,由此需要用多个descriptor。 设置每个descriptor control field的Last bit;
- 设置每个descriptor control field的Interrupt bit;
- 设置每个descriptor control field的Size域;
5. Increase the TxProduceIndex
- TxProduceIndex = TxProduceIndex + # of descriptors(上一步中分配的);
- If the datapath is not enabled during initialization, enable the datapath now;
6. Transmission
- The Ethernet block will start transmitting the frames as soon as it detects TxProduceIndex not equal to TxConsumeIndex
- Tx DMA starts reading descriptors from memory;
- The Ethernet block will try to start transmission on the Ethernet connection via the (R)MII interface;
7. Write back the status of transmission
- The Tx DMA writes the status of the fragment’s transmission
- Status for all but the last fragment: written as soon as they have been accepted by the Tx DMA manager
- Status for the last fragment: written after the transmission has completed on the Ethernet connection
8. The Ethernet block trigger a TxDoneInt interrupt
This interrupt triggers the device driver to inspect the status information.