From ae7164e400519c69e3d79ad9cc39040265cab187 Mon Sep 17 00:00:00 2001 From: graham sanderson Date: Tue, 19 Nov 2024 15:27:04 -0600 Subject: [PATCH] disable all IRQs in dma_chanel_cleanup - fixes for RP2350 --- src/rp2_common/hardware_dma/dma.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/rp2_common/hardware_dma/dma.c b/src/rp2_common/hardware_dma/dma.c index 5c405959f..1455869fd 100644 --- a/src/rp2_common/hardware_dma/dma.c +++ b/src/rp2_common/hardware_dma/dma.c @@ -75,8 +75,9 @@ void dma_channel_cleanup(uint channel) { // Disable CHAIN_TO, and disable channel, so that it ignores any further triggers hw_write_masked( &dma_hw->ch[channel].al1_ctrl, (channel << DMA_CH0_CTRL_TRIG_CHAIN_TO_LSB) | (0u << DMA_CH0_CTRL_TRIG_EN_LSB), DMA_CH0_CTRL_TRIG_CHAIN_TO_BITS | DMA_CH0_CTRL_TRIG_EN_BITS ); // disable IRQs first as abort can cause spurious IRQs - dma_channel_set_irq0_enabled(channel, false); - dma_channel_set_irq1_enabled(channel, false); + for(int i=0; i < NUM_DMA_IRQS; i++) { + dma_irqn_set_channel_enabled(i, channel, false); + } dma_channel_abort(channel); // finally clear the IRQ status, which may have been set during abort dma_hw->intr = 1u << channel;