@@ -265,9 +265,9 @@ static void dma_stm32_irq_handler(const struct device *dev, uint32_t id)
265
265
dma_stm32_clear_stream_irq (dev , id );
266
266
return ;
267
267
}
268
- callback_arg = id + STM32_DMA_STREAM_OFFSET ;
268
+ callback_arg = id ;
269
269
270
- /* The dma stream id is in range from STM32_DMA_STREAM_OFFSET ..<dma-requests> */
270
+ /* The dma stream id is in range from 0 ..<dma-requests> */
271
271
if (stm32_dma_is_ht_irq_active (dma , id )) {
272
272
/* Let HAL DMA handle flags on its own */
273
273
if (!stream -> hal_override ) {
@@ -349,16 +349,12 @@ static int dma_stm32_configure(const struct device *dev,
349
349
struct dma_config * config )
350
350
{
351
351
const struct dma_stm32_config * dev_config = dev -> config ;
352
- struct dma_stm32_stream * stream =
353
- & dev_config -> streams [id - STM32_DMA_STREAM_OFFSET ];
352
+ struct dma_stm32_stream * stream = & dev_config -> streams [id ];
354
353
DMA_TypeDef * dma = (DMA_TypeDef * )dev_config -> base ;
355
354
uint32_t ll_priority ;
356
355
uint32_t ll_direction ;
357
356
int ret ;
358
357
359
- /* Give channel from index 0 */
360
- id = id - STM32_DMA_STREAM_OFFSET ;
361
-
362
358
if (id >= dev_config -> max_streams ) {
363
359
LOG_ERR ("cannot configure the dma stream %d." , id );
364
360
return - EINVAL ;
@@ -553,9 +549,6 @@ static int dma_stm32_reload(const struct device *dev, uint32_t id,
553
549
DMA_TypeDef * dma = (DMA_TypeDef * )(config -> base );
554
550
struct dma_stm32_stream * stream ;
555
551
556
- /* Give channel from index 0 */
557
- id = id - STM32_DMA_STREAM_OFFSET ;
558
-
559
552
if (id >= config -> max_streams ) {
560
553
return - EINVAL ;
561
554
}
@@ -590,9 +583,6 @@ static int dma_stm32_start(const struct device *dev, uint32_t id)
590
583
DMA_TypeDef * dma = (DMA_TypeDef * )(config -> base );
591
584
struct dma_stm32_stream * stream ;
592
585
593
- /* Give channel from index 0 */
594
- id = id - STM32_DMA_STREAM_OFFSET ;
595
-
596
586
/* Only M2P or M2M mode can be started manually. */
597
587
if (id >= config -> max_streams ) {
598
588
return - EINVAL ;
@@ -619,9 +609,6 @@ static int dma_stm32_suspend(const struct device *dev, uint32_t id)
619
609
const struct dma_stm32_config * config = dev -> config ;
620
610
DMA_TypeDef * dma = (DMA_TypeDef * )(config -> base );
621
611
622
- /* Give channel from index 0 */
623
- id = id - STM32_DMA_STREAM_OFFSET ;
624
-
625
612
if (id >= config -> max_streams ) {
626
613
return - EINVAL ;
627
614
}
@@ -642,9 +629,6 @@ static int dma_stm32_resume(const struct device *dev, uint32_t id)
642
629
const struct dma_stm32_config * config = dev -> config ;
643
630
DMA_TypeDef * dma = (DMA_TypeDef * )(config -> base );
644
631
645
- /* Give channel from index 0 */
646
- id = id - STM32_DMA_STREAM_OFFSET ;
647
-
648
632
if (id >= config -> max_streams ) {
649
633
return - EINVAL ;
650
634
}
@@ -658,12 +642,9 @@ static int dma_stm32_resume(const struct device *dev, uint32_t id)
658
642
static int dma_stm32_stop (const struct device * dev , uint32_t id )
659
643
{
660
644
const struct dma_stm32_config * config = dev -> config ;
661
- struct dma_stm32_stream * stream = & config -> streams [id - STM32_DMA_STREAM_OFFSET ];
645
+ struct dma_stm32_stream * stream = & config -> streams [id ];
662
646
DMA_TypeDef * dma = (DMA_TypeDef * )(config -> base );
663
647
664
- /* Give channel from index 0 */
665
- id = id - STM32_DMA_STREAM_OFFSET ;
666
-
667
648
if (id >= config -> max_streams ) {
668
649
return - EINVAL ;
669
650
}
@@ -723,8 +704,6 @@ static int dma_stm32_get_status(const struct device *dev,
723
704
DMA_TypeDef * dma = (DMA_TypeDef * )(config -> base );
724
705
struct dma_stm32_stream * stream ;
725
706
726
- /* Give channel from index 0 */
727
- id = id - STM32_DMA_STREAM_OFFSET ;
728
707
if (id >= config -> max_streams ) {
729
708
return - EINVAL ;
730
709
}
0 commit comments