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); }
uint16_t dma_get_number_of_data(uint32_t dma, uint8_t channel) { return DMA_CNDTR(dma, channel); }
void dma_set_number_of_data(uint32_t dma, uint8_t channel, uint16_t number) { DMA_CNDTR(dma, channel) = number; }
void dma_set_number_of_data(u32 dma, u8 channel, u16 number) { DMA_CNDTR(dma, channel) = number; }