Hello guys,
I am using the enet_uip example recently, but I'm not very clear about the concept of EMAC descriptor. I know it's a data structure describe the operation of uDMA of EMAC, and feed this struct to EMACRxDMADescriptorListSet fucntion to initialize EMAC hardware. but as the comment states:
//*****************************************************************************
//
// Initialize the transmit and receive DMA descriptors. We apparently need
// a minimum of 3 descriptors in each chain. This is overkill since uIP uses
// a single, common transmit and receive buffer so we tag each descriptor
// with the same buffer and will make sure we only hand the DMA one descriptor
// at a time.
//
//*****************************************************************************
void
InitDescriptors(uint32_t ui32Base)
{
uint32_t ui32Loop;
//
// Initialize each of the transmit descriptors. Note that we leave the OWN
// bit clear here since we have not set up any transmissions yet.
//
for(ui32Loop = 0; ui32Loop < NUM_TX_DESCRIPTORS; ui32Loop++)
{
g_psTxDescriptor[ui32Loop].ui32Count =
(DES1_TX_CTRL_SADDR_INSERT |
(TX_BUFFER_SIZE << DES1_TX_CTRL_BUFF1_SIZE_S));
g_psTxDescriptor[ui32Loop].pvBuffer1 = g_pui8TxBuffer;
g_psTxDescriptor[ui32Loop].DES3.pLink =
(ui32Loop == (NUM_TX_DESCRIPTORS - 1)) ?
g_psTxDescriptor : &g_psTxDescriptor[ui32Loop + 1];
g_psTxDescriptor[ui32Loop].ui32CtrlStatus =
(DES0_TX_CTRL_LAST_SEG | DES0_TX_CTRL_FIRST_SEG |
DES0_TX_CTRL_INTERRUPT | DES0_TX_CTRL_CHAINED |
DES0_TX_CTRL_IP_ALL_CKHSUMS);
}.......
why we "need a minimum of 3 descriptors in each chain" ? I try to find answer in datasheet but it's quit difficult to get a clue, so could any one teach me how does the descriptor works? or just give me a link or document, thank you!!