void dma_channel_reset(uint32_t dma, uint8_t channel) { /* Disable channel and reset config bits. */ DMA_CCR(dma, channel) = 0; /* Reset data transfer number. */ DMA_CNDTR(dma, channel) = 0; /* Reset peripheral address. */ DMA_CPAR(dma, channel) = 0; /* Reset memory address. */ DMA_CMAR(dma, channel) = 0; /* Reset interrupt flags. */ DMA_IFCR(dma) |= DMA_IFCR_CIF(channel); }
void dma_set_memory_address(uint32_t dma, uint8_t channel, uint32_t address) { if (!(DMA_CCR(dma, channel) & DMA_CCR_EN)) { DMA_CMAR(dma, channel) = (uint32_t) address; } }
void dma_set_memory_address(u32 dma, u8 channel, u32 address) { if (!(DMA_CCR(dma, channel) & DMA_CCR_EN)) DMA_CMAR(dma, channel) = (u32) address; }