/* Initializes the DMA Tx descriptors in chain mode.  */
void ETH_ConfigDmaTxDescInChainMode(ETH_DMADescType *DMATxDescTab, uint8_t *TxBuff, uint32_t BuffSize, uint32_t TxBuffCount)
/* Initializes the DMA Tx descriptors in chain mode.  */
void ETH_ConfigDmaTxDescInChainMode(ETH_DMADescType *DMATxDescTab, uint8_t *TxBuff, uint32_t BuffSize, uint32_t TxBuffCount)
{
    uint32_t i = 0;
    ETH_DMADescType* DMATxDesc;
    DMATxDescToSet = DMATxDescTab;
    for (i = 0; i < TxBuffCount; i++)
    {
        DMATxDesc = DMATxDescTab + i;
        DMATxDesc->Status        = 0;
        DMATxDesc->CtrlOrBufSize = ETH_DMA_TX_DESC_TCH;
        DMATxDesc->Buf1Addr = (uint32_t)(&TxBuff[i * BuffSize]);
        if (i < (TxBuffCount - 1))
        {
            DMATxDesc->Buf2OrNextDescAddr = (uint32_t)(DMATxDescTab + i + 1);
        }
        else
        {
            DMATxDesc->Buf2OrNextDescAddr = (uint32_t)DMATxDescTab;
        }
    }
    ETH->DMATXDLADDR = (uint32_t)DMATxDescTab;
}