aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/ports/STM32/STM32F1xx
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2019-01-02 11:43:13 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2019-01-02 11:43:13 +0000
commitd5635adecc959228fefce27610f211087fefd87f (patch)
treeda768fca6a17255b1d9b82fab19cc87e992340e3 /os/hal/ports/STM32/STM32F1xx
parent60c04d66ec3c383febd9c9324e166aec2adb6e38 (diff)
downloadChibiOS-d5635adecc959228fefce27610f211087fefd87f.tar.gz
ChibiOS-d5635adecc959228fefce27610f211087fefd87f.tar.bz2
ChibiOS-d5635adecc959228fefce27610f211087fefd87f.zip
Mass update of all drivers to use the new DMA API. What could possibly go wrong?
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12521 110e8d01-0319-4d1e-a829-52ad28d1bb01
Diffstat (limited to 'os/hal/ports/STM32/STM32F1xx')
-rw-r--r--os/hal/ports/STM32/STM32F1xx/hal_adc_lld.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/os/hal/ports/STM32/STM32F1xx/hal_adc_lld.c b/os/hal/ports/STM32/STM32F1xx/hal_adc_lld.c
index 07d2fec89..9f29a911c 100644
--- a/os/hal/ports/STM32/STM32F1xx/hal_adc_lld.c
+++ b/os/hal/ports/STM32/STM32F1xx/hal_adc_lld.c
@@ -92,7 +92,7 @@ void adc_lld_init(void) {
/* Driver initialization.*/
adcObjectInit(&ADCD1);
ADCD1.adc = ADC1;
- ADCD1.dmastp = STM32_DMA1_STREAM1;
+ ADCD1.dmastp = NULL;
ADCD1.dmamode = STM32_DMA_CR_PL(STM32_ADC_ADC1_DMA_PRIORITY) |
STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_PSIZE_HWORD |
STM32_DMA_CR_MINC | STM32_DMA_CR_TCIE |
@@ -132,12 +132,11 @@ void adc_lld_start(ADCDriver *adcp) {
if (adcp->state == ADC_STOP) {
#if STM32_ADC_USE_ADC1
if (&ADCD1 == adcp) {
- bool b;
- b = dmaStreamAllocate(adcp->dmastp,
- STM32_ADC_ADC1_IRQ_PRIORITY,
- (stm32_dmaisr_t)adc_lld_serve_rx_interrupt,
- (void *)adcp);
- osalDbgAssert(!b, "stream already allocated");
+ adcp->dmastp = dmaStreamAllocI(STM32_DMA_STREAM_ID(1, 1),
+ STM32_ADC_ADC1_IRQ_PRIORITY,
+ (stm32_dmaisr_t)adc_lld_serve_rx_interrupt,
+ (void *)adcp);
+ osalDbgAssert(adcp->dmastp != NULL, "unable to allocate stream");
dmaStreamSetPeripheral(adcp->dmastp, &ADC1->DR);
rccEnableADC1(true);
}
@@ -165,7 +164,10 @@ void adc_lld_stop(ADCDriver *adcp) {
if (&ADCD1 == adcp) {
ADC1->CR1 = 0;
ADC1->CR2 = 0;
- dmaStreamRelease(adcp->dmastp);
+
+ dmaStreamFreeI(adcp->dmastp);
+ adcp->dmastp = NULL;
+
rccDisableADC1();
}
#endif