/* Initializes the DMA Tx descriptors in ring mode.  */
void ETH_ConfigDmaTxDescInRingMode(ETH_DMADescType *DMATxDescTab, uint8_t *TxBuff1, uint8_t *TxBuff2, uint32_t BuffSize, uint32_t TxBuffCount)
/* Initializes the DMA Tx descriptors in ring mode.  */
void ETH_ConfigDmaTxDescInRingMode(ETH_DMADescType *DMATxDescTab, uint8_t *TxBuff1, uint8_t *TxBuff2, uint32_t BuffSize, uint32_t TxBuffCount)
{
    uint32_t i = 0;
    ETH_DMADescType* DMATxDesc;
    uint32_t dsl = (ETH->DMABUSMOD & ETH_DMABUSMOD_DSL) >> 2;
    DMATxDescToSet = DMATxDescTab;
    for (i = 0; i < TxBuffCount; i++)
    {
        DMATxDesc = (ETH_DMADescType*)((uint32_t)DMATxDescTab + i * (16 + 4 * dsl));
        DMATxDesc->Buf1Addr = (uint32_t)(&TxBuff1[i * BuffSize]);
        DMATxDesc->Buf2OrNextDescAddr = (uint32_t)(&TxBuff2[i * BuffSize]);
        if (i == (TxBuffCount - 1))
        {
            DMATxDesc->CtrlOrBufSize = ETH_DMA_TX_DESC_TER;
        }
    }
    ETH->DMATXDLADDR = (uint32_t)DMATxDescTab;
}