Skip to content

Commit

Permalink
Add DMA channel number conversion
Browse files Browse the repository at this point in the history
Add a DMA channel conversion function to convert chanel numbers between
Zephyr and MSDK. For example, if an SoC has two DMA instances named DMA0
and DMA1, with 4 channels each, DMA1 channel numbers should be offset by
4 before passing to MSDK.

Signed-off-by: Tahsin Mutlugun <[email protected]>
  • Loading branch information
ttmut committed Dec 19, 2024
1 parent bdf3bd9 commit 60f7bb6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Libraries/zephyr/MAX/Include/wrap_max32_dma.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,16 @@ static inline int Wrap_MXC_DMA_AcquireChannel(mxc_dma_regs_t *dma)
#endif
}

static inline int Wrap_MXC_DMA_GetChannelIndex(mxc_dma_regs_t *dma, uint8_t ch)
{
#if defined(CONFIG_SOC_MAX32657)
(void)dma;
return ch;
#else
return (ch + MXC_DMA_GET_IDX(dma) * (MXC_DMA_CHANNELS / MXC_DMA_INSTANCES));
#endif
}

static inline void Wrap_MXC_DMA_Handler(mxc_dma_regs_t *dma)
{
#if defined(CONFIG_SOC_MAX32657) || defined(CONFIG_SOC_MAX32665) || defined(CONFIG_SOC_MAX32666)
Expand Down

0 comments on commit 60f7bb6

Please sign in to comment.