Skip to content

Commit d64b51b

Browse files
committed
drivers/dma: stm32: Modify treatment in irq handler
Bring two changes in dma_stm32_irq_handler handling: -Treat Half Transfer interrupt prior to Transfer Complete for the cases were both IRQ are both raised at the time IRQ handler is called -Clear IRQ flasg after callback is called. This is required in case callback is being treated in DMA HAL level, in which case flags information need to be known. Signed-off-by: Erwan Gouriou <[email protected]>
1 parent deb6762 commit d64b51b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

drivers/dma/dma_stm32.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,15 @@ static void dma_stm32_irq_handler(const struct device *dev, uint32_t id)
9797
}
9898

9999
/* the dma stream id is in range from STREAM_OFFSET..<dma-requests> */
100-
if (dma_stm32_is_tc_active(dma, id)) {
101-
dma_stm32_clear_tc(dma, id);
100+
if (dma_stm32_is_ht_active(dma, id)) {
101+
stream->dma_callback(dev, stream->user_data, callback_arg, 0);
102+
dma_stm32_clear_ht(dma, id);
103+
} else if (dma_stm32_is_tc_active(dma, id)) {
102104
#ifdef CONFIG_DMAMUX_STM32
103105
stream->busy = false;
104106
#endif
105107
stream->dma_callback(dev, stream->user_data, callback_arg, 0);
106-
} else if (dma_stm32_is_ht_active(dma, id)) {
107-
dma_stm32_clear_ht(dma, id);
108+
dma_stm32_clear_tc(dma, id);
108109
} else if (stm32_dma_is_unexpected_irq_happened(dma, id)) {
109110
LOG_ERR("Unexpected irq happened.");
110111
stream->dma_callback(dev, stream->user_data,

0 commit comments

Comments
 (0)