Question when setting up the ETH Receive Descriptor Tail pointer
Hello there!
I'm reading the STM32H5 documentation on how to setup the ETH descriptors correctly. At the same time I'm following the HAL for the same H5 series.
When the RX descriptors are initialized, I can see the HAL assumes there are 4 descriptors.
/* Set Receive Descriptor Ring Length */
WRITE_REG(heth->Instance->DMACRDRLR, ((uint32_t)(ETH_RX_DESC_CNT - 1U)));
/* Set Receive Descriptor List Address */
WRITE_REG(heth->Instance->DMACRDLAR, (uint32_t) heth->Init.RxDesc);
/* Set Receive Descriptor Tail pointer Address */
WRITE_REG(heth->Instance->DMACRDTPR, ((uint32_t) &heth->Init.RxDesc[ETH_RX_DESC_CNT - 1]));
static ETH_DMADescTypeDef dma_rx_dscr_tab[ETH_RX_DESC_CNT];
/* Provides the address of the first DMA Rx descriptor in the list */
heth.Init.RxDesc = dma_rx_dscr_tab;
My question is regarding the address of the tail pointer.
WRITE_REG(heth->Instance->DMACRDTPR, ((uint32_t)(heth->Init.RxDesc + (uint32_t)(ETH_RX_DESC_CNT - 1U))));
WRITE_REG(heth->Instance->DMACRDTPR, ((uint32_t) &heth->Init.RxDesc[ETH_RX_DESC_CNT - 1]));
