Nxp Semiconductors UM10237 用户手册

下载
页码 792
UM10237_2
© NXP B.V. 2008. All rights reserved.
User manual
Rev. 02 — 19 December 2008 
249 of 792
NXP Semiconductors
UM10237
Chapter 11: LPC24XX Ethernet
Ethernet block has finished reading/writing the last descriptor/status of the array (with the 
highest memory address), the next descriptor/status it reads/writes is the first 
descriptor/status of the array at the base address of the array.
Full and Empty state of descriptor arrays
The descriptor arrays can be empty, partially full or full. A descriptor array is empty when 
all descriptors are owned by the producer. A descriptor array is partially full if both 
producer and consumer own part of the descriptors and both are busy processing those 
descriptors. A descriptor array is full when all descriptors (except one) are owned by the 
consumer, so that the producer has no more room to process frames. Ownership of 
descriptors is indicated with the use of a consume index and a produce index. The 
produce index is the first element of the array owned by the producer. It is also the index 
of the array element that is next going to be used by the producer of frames (it may 
already be busy using it and subsequent elements). The consume index is the first 
element of the array that is owned by the consumer. It is also the number of the array 
element next to be consumed by the consumer of frames (it and subsequent elements 
may already be in the process of being consumed). If the consume index and the produce 
index are equal, the descriptor array is empty and all array elements are owned by the 
producer. If the consume index equals the produce index plus one, then the array is full 
and all array elements (except the one at the produce index) are owned by the consumer. 
With a full descriptor array, still one array element is kept empty, to be able to easily 
distinguish the full or empty state by looking at the value of the produce index and 
consume index. An array must have at least 2 elements to be able to indicate a full 
descriptor array with a produce index of value 0 and a consume index of value 1. The 
wrap around of the arrays is taken into account when determining if a descriptor array is 
full, so a produce index that indicates the last element in the array and a consume index 
that indicates the first element in the array, also means the descriptor array is full. When 
the produce index and the consume index are unequal and the consume index is not the 
produce index plus one (with wrap around taken into account), then the descriptor array is 
partially full and both the consumer and producer own enough descriptors to be able to 
operate actively on the descriptor array.
Interrupt bit
The descriptors have an Interrupt bit, which is programmed by software. When the 
Ethernet block is processing a descriptor and finds this bit set, it will allow triggering an 
interrupt (after committing status to memory) by passing the RxDoneInt or TxDoneInt bits 
in the IntStatus register to the interrupt output pin. If the Interrupt bit is not set in the 
descriptor, then the RxDoneInt or TxDoneInt are not set and no interrupt is triggered (note 
that the corresponding bits in IntEnable must also be set to trigger interrupts). This offers 
flexible ways of managing the descriptor arrays. For instance, the device driver could add 
10 frames to the Tx descriptor array, and set the Interrupt bit in descriptor number 5 in the 
descriptor array. This would invoke the interrupt service routine before the transmit 
descriptor array is completely exhausted. The device driver could add another batch of 
frames to the descriptor array, without interrupting continuous transmission of frames.
Frame fragments
For maximum flexibility in frame storage, frames can be split up into multiple frame 
fragments with fragments located in different places in memory. In this case one 
descriptor is used for each frame fragment. So, a descriptor can point to a single frame or