Skip to content

Commit 424ac45

Browse files
idekinepillo79
authored andcommitted
drivers: video: video_stm32_dcmi: Add GPDMA support to STM32 DCMI
The STM32 DCMI driver currently supports devices with DMA, but does not support devices that have GPDMA instead (e.g. STM32H5 line of SoCs). For all practical purposes, this makes these devices unable to use the DCMI driver. Adding GPDMA support enables additional devices to use the DCMI driver, while not restricting the ability of DMA devices to do so as well. Signed-off-by: Isaac Dekine <[email protected]>
1 parent bc87603 commit 424ac45

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

drivers/video/video_stm32_dcmi.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,21 @@ static int stm32_dma_init(const struct device *dev)
147147

148148
/*** Configure the DMA ***/
149149
/* Set the parameters to be configured */
150+
#if defined(GPDMA1) // GPDMA
151+
hdma.Init.Request = GPDMA1_REQUEST_DCMI;
152+
hdma.Init.BlkHWRequest = DMA_BREQ_SINGLE_BURST;
153+
hdma.Init.Direction = DMA_PERIPH_TO_MEMORY;
154+
hdma.Init.SrcInc = DMA_SINC_FIXED;
155+
hdma.Init.DestInc = DMA_DINC_INCREMENTED;
156+
hdma.Init.SrcDataWidth = DMA_SRC_DATAWIDTH_WORD;
157+
hdma.Init.DestDataWidth = DMA_DEST_DATAWIDTH_WORD;
158+
hdma.Init.Priority = DMA_HIGH_PRIORITY;
159+
hdma.Init.SrcBurstLength = 1;
160+
hdma.Init.DestBurstLength = 1;
161+
hdma.Init.TransferAllocatedPort = DMA_SRC_ALLOCATED_PORT0 | DMA_DEST_ALLOCATED_PORT0;
162+
hdma.Init.TransferEventMode = DMA_TCEM_BLOCK_TRANSFER;
163+
hdma.Init.Mode = DMA_NORMAL;
164+
#else // standard DMA
150165
hdma.Init.Request = DMA_REQUEST_DCMI;
151166
hdma.Init.Direction = DMA_PERIPH_TO_MEMORY;
152167
hdma.Init.PeriphInc = DMA_PINC_DISABLE;
@@ -158,6 +173,7 @@ static int stm32_dma_init(const struct device *dev)
158173
#if defined(CONFIG_SOC_SERIES_STM32F7X) || defined(CONFIG_SOC_SERIES_STM32H7X)
159174
hdma.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
160175
#endif
176+
#endif
161177

162178
#if defined(CONFIG_SOC_SERIES_STM32F7X) || defined(CONFIG_SOC_SERIES_STM32H7X)
163179
hdma.Instance = __LL_DMA_GET_STREAM_INSTANCE(config->dma.reg,

0 commit comments

Comments
 (0)