From e7449cf97aaecab716158ca9ec4f9da3dbc4940e Mon Sep 17 00:00:00 2001 From: Peter van der Perk Date: Mon, 5 Dec 2022 10:07:28 +0100 Subject: [PATCH] S32K3XX EDMA Set Backdoor for DTCM memory map --- arch/arm/src/s32k3xx/s32k3xx_edma.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/arch/arm/src/s32k3xx/s32k3xx_edma.c b/arch/arm/src/s32k3xx/s32k3xx_edma.c index 02e0067ff5..ba70e4624c 100644 --- a/arch/arm/src/s32k3xx/s32k3xx_edma.c +++ b/arch/arm/src/s32k3xx/s32k3xx_edma.c @@ -154,6 +154,12 @@ struct s32k3xx_edma_s struct s32k3xx_dmach_s dmach[S32K3XX_EDMA_NCHANNELS]; }; +#ifdef CONFIG_S32K3XX_DTCM_HEAP +extern uint8_t DTCM_BASE_ADDR[]; +extern uint8_t DTCM_END_ADDR[]; +#define DTCM_BACKDOOR_OFFSET 0x1000000 +#endif + /**************************************************************************** * Private Data ****************************************************************************/ @@ -614,6 +620,22 @@ static inline void s32k3xx_tcd_configure(struct s32k3xx_edmatcd_s *tcd, EDMA_TCD_CSR_INTHALF : 0; tcd->dlastsga = config->flags & EDMA_CONFIG_LOOPDEST ? -config->iter : 0; +#ifdef CONFIG_S32K3XX_DTCM_HEAP + /* Remap address to backdoor address for eDMA */ + + if (tcd->saddr >= (uint32_t)DTCM_BASE_ADDR + && tcd->saddr < (uint32_t)DTCM_END_ADDR) + { + tcd->saddr += DTCM_BACKDOOR_OFFSET; + } + + if (tcd->daddr >= (uint32_t)DTCM_BASE_ADDR + && tcd->daddr < (uint32_t)DTCM_END_ADDR) + { + tcd->daddr += DTCM_BACKDOOR_OFFSET; + } +#endif + /* And special case flags */ #ifdef CONFIG_S32K3XX_EDMA_ELINK