Skip to content

Commit 67cb174

Browse files
rettichschnidicarlescufi
authored andcommitted
drivers: dma: si32: Prevent configuration of in-use DMA channel
As per Zephyr DMA documentation, dma_config() must not be done on a running channel. Signed-off-by: Reto Schneider <[email protected]>
1 parent 4d3f6a3 commit 67cb174

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

drivers/dma/dma_si32.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,14 @@ static int dma_si32_config(const struct device *dev, uint32_t channel, struct dm
141141
return -EINVAL;
142142
}
143143

144+
/* Prevent messing up (potentially) ongoing DMA operations and their settings. This behavior
145+
* is required by the Zephyr DMA API.
146+
*/
147+
if (SI32_DMACTRL_A_is_channel_enabled(SI32_DMACTRL_0, channel)) {
148+
LOG_ERR("DMA channel is currently in use");
149+
return -EBUSY;
150+
}
151+
144152
channel_descriptor = &channel_descriptors[channel];
145153

146154
if (cfg == NULL) {

0 commit comments

Comments
 (0)