Nxp Semiconductors UM10237 用户手册

下载
页码 792
UM10237_2
© NXP B.V. 2008. All rights reserved.
User manual
Rev. 02 — 19 December 2008 
248 of 792
NXP Semiconductors
UM10237
Chapter 11: LPC24XX Ethernet
The DMA managers work with arrays of frame descriptors and statuses that are stored in 
memory. The descriptors and statuses act as an interface between the Ethernet hardware 
and the device driver software. There is one descriptor array for receive frames and one 
descriptor array for transmit frames. Using buffering for frame descriptors, the memory 
traffic and memory bandwidth utilization of descriptors can be kept small.
Each frame descriptor contains two 32 bit fields: the first field is a pointer to a data buffer 
containing a frame or a fragment, whereas the second field is a control word related to 
that frame or fragment.
The software driver must write the base addresses of the descriptor and status arrays in 
the TxDescriptor/RxDescriptor and TxStatus/RxStatus registers. The number of 
descriptors/statuses in each array must be written in the 
TxDescriptorNumber/RxDescriptorNumber registers. The number of descriptors in an 
array corresponds to the number of statuses in the associated status array.
Transmit descriptor arrays, receive descriptor arrays and transmit status arrays must be 
aligned on a 4 byte (32bit)address boundary, while the receive status array must be 
aligned on a 8 byte (64bit) address boundary.
Ownership of descriptors
Both device driver software and Ethernet hardware can read and write the descriptor 
arrays at the same time in order to produce and consume descriptors. Arbitration on the 
AHB bus gives priority to the DMA hardware in the case of simultaneous requests. A 
descriptor is "owned" either by the device driver or by the Ethernet hardware. Only the 
owner of a descriptor reads or writes its value. Typically, the sequence of use and 
ownership of descriptors and statuses is as follows: a descriptor is owned and set up by 
the device driver; ownership of the descriptor/status is passed by the device driver to the 
Ethernet block, which reads the descriptor and writes information to the status field; the 
Ethernet block passes ownership of the descriptor back to the device driver, which uses 
the status information and then recycles the descriptor to be used for another frame. 
Software must pre-allocate the memory used to hold the descriptor arrays.
Software can hand over ownership of descriptors and statuses to the hardware by 
incrementing (and wrapping if on the array boundary) the 
TxProduceIndex/RxConsumeIndex registers. Hardware hands over descriptors and 
status to software by updating the TxConsumeIndex/ RxProduceIndex registers.
After handing over a descriptor to the receive and transmit DMA hardware, device driver 
software should not modify the descriptor or reclaim the descriptor by decrementing the 
TxProduceIndex/ RxConsumeIndex registers because descriptors may have been 
prefetched by the hardware. In this case the device driver software will have to wait until 
the frame has been transmitted or the device driver has to soft-reset the transmit and/or 
receive datapaths which will also reset the descriptor arrays.
Sequential order with wrap-around
When descriptors are read from and statuses are written to the arrays, this is done in 
sequential order with wrap-around. Sequential order means that when the Ethernet block 
has finished reading/writing a descriptor/status, the next descriptor/status it reads/writes is 
the one at the next higher, adjacent memory address. Wrap around means that when the