@@ -45,14 +45,14 @@ struct video_stm32_dcmi_data {
4545 struct k_fifo fifo_in ;
4646 struct k_fifo fifo_out ;
4747 struct video_buffer * vbuf ;
48+ struct stream dma ;
4849};
4950
5051struct video_stm32_dcmi_config {
5152 struct stm32_pclken pclken ;
5253 irq_config_func_t irq_config ;
5354 const struct pinctrl_dev_config * pctrl ;
5455 const struct device * sensor_dev ;
55- const struct stream dma ;
5656};
5757
5858static void stm32_dcmi_process_dma_error (DCMI_HandleTypeDef * hdcmi )
@@ -130,12 +130,12 @@ static void dcmi_dma_callback(const struct device *dev, void *arg, uint32_t chan
130130static int stm32_dma_init (const struct device * dev )
131131{
132132 struct video_stm32_dcmi_data * data = dev -> data ;
133- const struct video_stm32_dcmi_config * config = dev -> config ;
133+ struct stream * dma = & data -> dma ;
134134 int ret ;
135135
136136 /* Check if the DMA device is ready */
137- if (!device_is_ready (config -> dma . dma_dev )) {
138- LOG_ERR ("%s DMA device not ready" , config -> dma . dma_dev -> name );
137+ if (!device_is_ready (dma -> dma_dev )) {
138+ LOG_ERR ("%s DMA device not ready" , dma -> dma_dev -> name );
139139 return - ENODEV ;
140140 }
141141
@@ -147,16 +147,16 @@ static int stm32_dma_init(const struct device *dev)
147147 * the minimum information to inform the DMA slot will be in used and
148148 * how to route callbacks.
149149 */
150- struct dma_config dma_cfg = config -> dma . cfg ;
150+ struct dma_config * dma_cfg = & dma -> cfg ;
151151 static DMA_HandleTypeDef hdma ;
152152
153153 /* Proceed to the minimum Zephyr DMA driver init */
154- dma_cfg . user_data = & hdma ;
154+ dma_cfg -> user_data = & hdma ;
155155 /* HACK: This field is used to inform driver that it is overridden */
156- dma_cfg . linked_channel = STM32_DMA_HAL_OVERRIDE ;
157- ret = dma_config (config -> dma . dma_dev , config -> dma . channel , & dma_cfg );
156+ dma_cfg -> linked_channel = STM32_DMA_HAL_OVERRIDE ;
157+ ret = dma_config (dma -> dma_dev , dma -> channel , dma_cfg );
158158 if (ret != 0 ) {
159- LOG_ERR ("Failed to configure DMA channel %d" , config -> dma . channel );
159+ LOG_ERR ("Failed to configure DMA channel %d" , dma -> channel );
160160 return ret ;
161161 }
162162
@@ -170,8 +170,7 @@ static int stm32_dma_init(const struct device *dev)
170170 hdma .Init .MemDataAlignment = DMA_MDATAALIGN_WORD ;
171171 hdma .Init .Mode = DMA_CIRCULAR ;
172172 hdma .Init .Priority = DMA_PRIORITY_HIGH ;
173- hdma .Instance = STM32_DMA_GET_INSTANCE (config -> dma .reg ,
174- config -> dma .channel );
173+ hdma .Instance = STM32_DMA_GET_INSTANCE (dma -> reg , dma -> channel );
175174#if defined(CONFIG_SOC_SERIES_STM32F7X ) || defined(CONFIG_SOC_SERIES_STM32H7X )
176175 hdma .Init .FIFOMode = DMA_FIFOMODE_DISABLE ;
177176#endif
@@ -533,6 +532,7 @@ static struct video_stm32_dcmi_data video_stm32_dcmi_data_0 = {
533532 .LineSelectStart = DCMI_OELS_ODD ,
534533 },
535534 },
535+ DCMI_DMA_CHANNEL (0 , PERIPHERAL , MEMORY )
536536};
537537
538538#define SOURCE_DEV (n ) DEVICE_DT_GET(DT_NODE_REMOTE_DEVICE(DT_INST_ENDPOINT_BY_ID(n, 0, 0)))
@@ -542,7 +542,6 @@ static const struct video_stm32_dcmi_config video_stm32_dcmi_config_0 = {
542542 .irq_config = video_stm32_dcmi_irq_config_func ,
543543 .pctrl = PINCTRL_DT_INST_DEV_CONFIG_GET (0 ),
544544 .sensor_dev = SOURCE_DEV (0 ),
545- DCMI_DMA_CHANNEL (0 , PERIPHERAL , MEMORY )
546545};
547546
548547static int video_stm32_dcmi_init (const struct device * dev )
0 commit comments