diff --git a/src/main/drivers/dma_stm32f7xx.c b/src/main/drivers/dma_stm32f7xx.c index 38a0b653d..9220cdbc2 100644 --- a/src/main/drivers/dma_stm32f7xx.c +++ b/src/main/drivers/dma_stm32f7xx.c @@ -28,7 +28,8 @@ #include "drivers/nvic.h" #include "drivers/dma.h" -#include "resource.h" +#include "drivers/rcc.h" +#include "drivers/resource.h" /* * DMA descriptors. @@ -76,14 +77,7 @@ DEFINE_DMA_IRQ_HANDLER(2, 7, DMA2_ST7_HANDLER) static void enableDmaClock(int index) { - const uint32_t rcc = dmaDescriptors[index].dma == DMA1 ? RCC_AHB1ENR_DMA1EN : RCC_AHB1ENR_DMA2EN; - do { - __IO uint32_t tmpreg; - SET_BIT(RCC->AHB1ENR, rcc); - /* Delay after an RCC peripheral clock enabling */ - tmpreg = READ_BIT(RCC->AHB1ENR, rcc); - UNUSED(tmpreg); - } while (0); + RCC_ClockCmd(dmaDescriptors[index].dma == DMA1 ? RCC_AHB1(DMA1) : RCC_AHB1(DMA2), ENABLE); } void dmaInit(dmaIdentifier_e identifier, resourceOwner_e owner, uint8_t resourceIndex)