diff options
Diffstat (limited to 'os/hal/ports/STM32/LLD/ADCv4')
-rw-r--r-- | os/hal/ports/STM32/LLD/ADCv4/hal_adc_lld.c | 8 | ||||
-rw-r--r-- | os/hal/ports/STM32/LLD/ADCv4/hal_adc_lld.h | 27 |
2 files changed, 15 insertions, 20 deletions
diff --git a/os/hal/ports/STM32/LLD/ADCv4/hal_adc_lld.c b/os/hal/ports/STM32/LLD/ADCv4/hal_adc_lld.c index c96dcf3f2..69ffa7eca 100644 --- a/os/hal/ports/STM32/LLD/ADCv4/hal_adc_lld.c +++ b/os/hal/ports/STM32/LLD/ADCv4/hal_adc_lld.c @@ -410,7 +410,7 @@ void adc_lld_start(ADCDriver *adcp) { if (adcp->state == ADC_STOP) {
#if STM32_ADC_USE_ADC12 == TRUE
if (&ADCD1 == adcp) {
- adcp->data.dma = dmaStreamAllocI(STM32_ADC_ADC12_DMA_CHANNEL,
+ adcp->data.dma = dmaStreamAllocI(STM32_ADC_ADC12_DMA_STREAM,
STM32_ADC_ADC12_IRQ_PRIORITY,
(stm32_dmaisr_t)adc_lld_serve_dma_interrupt,
(void *)adcp);
@@ -422,7 +422,7 @@ void adc_lld_start(ADCDriver *adcp) { #if STM32_ADC_USE_ADC3 == TRUE
if (&ADCD3 == adcp) {
- adcp->data.bdma = bdmaStreamAllocI(STM32_ADC_ADC3_BDMA_CHANNEL,
+ adcp->data.bdma = bdmaStreamAllocI(STM32_ADC_ADC3_BDMA_STREAM,
STM32_ADC_ADC3_IRQ_PRIORITY,
(stm32_dmaisr_t)adc_lld_serve_bdma_interrupt,
(void *)adcp);
@@ -479,7 +479,7 @@ void adc_lld_stop(ADCDriver *adcp) { if (&ADCD1 == adcp) {
/* Releasing the associated DMA channel.*/
- dmaStreamRelease(adcp->data.dma);
+ dmaStreamFreeI(adcp->data.dma);
adcp->data.dma = NULL;
/* Resetting CCR options except default ones.*/
@@ -492,7 +492,7 @@ void adc_lld_stop(ADCDriver *adcp) { if (&ADCD3 == adcp) {
/* Releasing the associated BDMA channel.*/
- bdmaStreamRelease(adcp->data.bdma);
+ bdmaStreamFreeI(adcp->data.bdma);
adcp->data.bdma = NULL;
/* Resetting CCR options except default ones.*/
diff --git a/os/hal/ports/STM32/LLD/ADCv4/hal_adc_lld.h b/os/hal/ports/STM32/LLD/ADCv4/hal_adc_lld.h index ce5460f62..4a34ee5ec 100644 --- a/os/hal/ports/STM32/LLD/ADCv4/hal_adc_lld.h +++ b/os/hal/ports/STM32/LLD/ADCv4/hal_adc_lld.h @@ -193,20 +193,6 @@ #endif
/**
- * @brief ADC1/ADC2 DMA channel.
- */
-#if !defined(STM32_ADC_ADC12_DMA_CHANNEL) || defined(__DOXYGEN__)
-#define STM32_ADC_ADC12_DMA_CHANNEL 0
-#endif
-
-/**
- * @brief ADC3 DMA channel.
- */
-#if !defined(STM32_ADC_ADC3_BDMA_CHANNEL) || defined(__DOXYGEN__)
-#define STM32_ADC_ADC3_BDMA_CHANNEL 1
-#endif
-
-/**
* @brief ADC1/ADC2 DMA priority (0..3|lowest..highest).
*/
#if !defined(STM32_ADC_ADC12_DMA_PRIORITY) || defined(__DOXYGEN__)
@@ -313,14 +299,23 @@ #error "ADC driver activated but no ADC peripheral assigned"
#endif
+/* Check on the presence of the DMA streams settings in mcuconf.h.*/
+#if STM32_ADC_USE_ADC12 && !defined(STM32_ADC_ADC12_DMA_STREAM)
+#error "STM32_ADC_ADC12_DMA_STREAM not defined"
+#endif
+
+#if STM32_ADC_USE_ADC3 && !defined(STM32_ADC_ADC3_BDMA_STREAM)
+#error "STM32_ADC_ADC3_BDMA_STREAM not defined"
+#endif
+
/* DMA channel range tests.*/
#if STM32_ADC_USE_ADC12 && \
- !STM32_DMA_IS_VALID_CHANNEL(STM32_ADC_ADC12_DMA_CHANNEL)
+ !STM32_DMA_IS_VALID_STREAM(STM32_ADC_ADC12_DMA_STREAM)
#error "Invalid DMA channel assigned to ADC12"
#endif
#if STM32_ADC_USE_ADC3 && \
- !STM32_BDMA_IS_VALID_CHANNEL(STM32_ADC_ADC3_BDMA_CHANNEL)
+ !STM32_BDMA_IS_VALID_STREAM(STM32_ADC_ADC3_BDMA_STREAM)
#error "Invalid DMA channel assigned to ADC3"
#endif
|