Skip to content

Commit a94a16c

Browse files
decsnydanieldegrasse
authored andcommitted
dma_mcux_edma: Abort transfer before clear status
The transfer must be aborted before clearing the status flags otherwise they will be set again before the transfer is aborted and stay set causing infinite interrupt. Also, elevate the log message to error level and give it actual useful information. The "flag" being logged before literally just is a bit that says if there is an error or not, which we already know by virtue of handling an error. The channel error status has actual details about what was the reason of the error. Also this status should be reported before the transfer is aborted to get the right status. Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
1 parent d590d27 commit a94a16c

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

drivers/dma/dma_mcux_edma.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -264,17 +264,16 @@ static void dma_mcux_edma_irq_handler(const struct device *dev, uint32_t channel
264264
static void dma_mcux_edma_error_irq_handler(const struct device *dev)
265265
{
266266
int i = 0;
267-
uint32_t flag = 0;
268267
uint32_t hw_channel;
269268

270269
for (i = 0; i < DEV_CFG(dev)->dma_channels; i++) {
271270
if (DEV_CHANNEL_DATA(dev, i)->busy) {
272271
hw_channel = dma_mcux_edma_add_channel_gap(dev, i);
273-
flag = EDMA_GetChannelStatusFlags(DEV_BASE(dev), hw_channel);
274-
EDMA_ClearChannelStatusFlags(DEV_BASE(dev), hw_channel, 0xFFFFFFFF);
272+
LOG_ERR("channel %d error status is 0x%x", hw_channel,
273+
EDMA_GetErrorStatusFlags(DEV_BASE(dev)));
275274
EDMA_AbortTransfer(DEV_EDMA_HANDLE(dev, i));
275+
EDMA_ClearChannelStatusFlags(DEV_BASE(dev), hw_channel, 0xFFFFFFFF);
276276
DEV_CHANNEL_DATA(dev, i)->busy = false;
277-
LOG_INF("channel %d error status is 0x%x", hw_channel, flag);
278277
}
279278
}
280279

0 commit comments

Comments
 (0)