From 06d1b02014b37664b5b9ecd3841bb48841c7c44c Mon Sep 17 00:00:00 2001 From: robert-hh Date: Sun, 3 Oct 2021 20:54:18 +0200 Subject: [PATCH] mimxrt/dma_channel: Fix the DMA channel management. The MIMXRT1011 has only 16 channels, so size the channel list accordingly. --- ports/mimxrt/dma_channel.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/ports/mimxrt/dma_channel.c b/ports/mimxrt/dma_channel.c index 3dd043a66b..c6cae9da9c 100644 --- a/ports/mimxrt/dma_channel.c +++ b/ports/mimxrt/dma_channel.c @@ -27,10 +27,17 @@ #include "dma_channel.h" // List of channel flags: true: channel used, false: channel available -static bool channel_list[32] = { true, true, true, true, false, false, false, false, - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false }; +static bool channel_list[FSL_FEATURE_DMAMUX_MODULE_CHANNEL] = { + true, true, true, true, false, false, false, false, + false, false, false, false, false, false, false, false, + + #if FSL_FEATURE_DMAMUX_MODULE_CHANNEL > 16 + + false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false + + #endif +}; // allocate_channel(): retrieve an available channel. Return the number or -1 int allocate_dma_channel(void) {