1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-24 08:45:36 +03:00

Merge pull request #9522 from jflyper/bfdev-g4-dma-update-for-rcc

[G4] DMA update for RCC_ClockCmd
This commit is contained in:
Michael Keller 2020-02-29 10:08:31 +13:00 committed by GitHub
commit fde012c368
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -28,6 +28,7 @@
#include "drivers/nvic.h"
#include "drivers/dma.h"
#include "drivers/rcc.h"
#include "resource.h"
/*
@ -75,18 +76,9 @@ DEFINE_DMA_IRQ_HANDLER(2, 8, DMA2_CH8_HANDLER)
static void enableDmaClock(int index)
{
// This is essentially copies of __HAL_RCC_DMA{1,2}_CLK_ENABLE macros
// squashed into one.
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);
// G4 has an independent enable bit for DMAMUX
RCC_ClockCmd(RCC_AHB1(DMAMUX1), ENABLE);
}
void dmaInit(dmaIdentifier_e identifier, resourceOwner_e owner, uint8_t resourceIndex)