/* Returns pointer to DMA channel registers by channel number (0..7 for DMA1 controller, 8..15 for DMA2 controller).  */
static volatile struct stm32_dma_ch_regs* dma_ch_regs(int ch)
/* Returns pointer to DMA channel registers by channel number (0..7 for DMA1 controller, 8..15 for DMA2 controller).  */
static volatile struct stm32_dma_ch_regs* dma_ch_regs(int ch)
{
	volatile struct stm32_dma_regs *dma_regs =
		ch < STM32F2_DMA_CH_NUM_DMA1 ? STM32_DMA1 : STM32_DMA2;
	return &dma_regs->s[ch % STM32F2_DMA_CH_NUM_DMA1];
}