diff options
Diffstat (limited to 'os')
-rw-r--r-- | os/io/platforms/STM32/stm32_dma.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/os/io/platforms/STM32/stm32_dma.c b/os/io/platforms/STM32/stm32_dma.c index 7368f1bb9..9593a5f51 100644 --- a/os/io/platforms/STM32/stm32_dma.c +++ b/os/io/platforms/STM32/stm32_dma.c @@ -45,11 +45,8 @@ static cnt_t dmacnt2; void dmaInit(void) {
dmacnt1 = 0;
- DMA1->IFCR = 0x0FFFFFFF;
-
#if defined(STM32F10X_HD) || defined (STM32F10X_CL)
dmacnt2 = 0;
- DMA2->IFCR = 0x0FFFFFFF;
#endif
}
@@ -62,13 +59,17 @@ void dmaEnable(uint32_t dma) { switch (dma) {
case DMA1_ID:
- if (dmacnt1++ == 0)
+ if (dmacnt1++ == 0) {
RCC->AHBENR |= RCC_AHBENR_DMA1EN;
+ DMA1->IFCR = 0x0FFFFFFF;
+ }
break;
#if defined(STM32F10X_HD) || defined (STM32F10X_CL)
case DMA2_ID:
- if (dmacnt2++ == 0)
+ if (dmacnt2++ == 0) {
RCC->AHBENR |= RCC_AHBENR_DMA2EN;
+ DMA2->IFCR = 0x0FFFFFFF;
+ }
break;
#endif
}
|