AnsweredAssumed Answered

KSDK 1.0.0: Bug report in fsl_edma_driver.c - TCD's index

Question asked by Maurice LAUZE on Jan 7, 2015
Latest reply on Jan 14, 2015 by Maurice LAUZE



In function : edma_status_t EDMA_DRV_ConfigLoopTransfer(

                              edma_chn_state_t *chn, edma_software_tcd_t *stcd,


                              uint32_t srcAddr, uint32_t destAddr, uint32_t size, uint32_t bytesOnEachRequest, uint32_t totalLength, uint8_t number)


there is a bug reading the address of the TCD passed in function parameter  *stcd.


This is caused by the macro:


#define STCD_ADDR(address)          (edma_software_tcd_t *)(((uint32_t)address + 32) & ~0x1FU)


this macro should be:


#define STCD_ADDR(address)          (edma_software_tcd_t *)(((uint32_t)address) & ~0x1FU)


This leads to an offset of one TCD in the TCD's list defined by the user.


I fixed this issue by not using that macro, provided the address is well aligned (modulo 32 bytes)


//edma_software_tcd_t *stcdAddr = (edma_software_tcd_t)STCD_ADDR(stcd);

edma_software_tcd_t *stcdAddr = (edma_software_tcd_t *)(stcd);


Hope this helps,