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 <reto.schneider@husqvarnagroup.com>
This commit is contained in:
Reto Schneider 2024-10-16 23:43:58 +02:00 committed by Carles Cufí
parent 4d3f6a3145
commit 67cb174241
1 changed files with 8 additions and 0 deletions

View File

@ -141,6 +141,14 @@ static int dma_si32_config(const struct device *dev, uint32_t channel, struct dm
return -EINVAL;
}
/* Prevent messing up (potentially) ongoing DMA operations and their settings. This behavior
* is required by the Zephyr DMA API.
*/
if (SI32_DMACTRL_A_is_channel_enabled(SI32_DMACTRL_0, channel)) {
LOG_ERR("DMA channel is currently in use");
return -EBUSY;
}
channel_descriptor = &channel_descriptors[channel];
if (cfg == NULL) {