/* Config the DMA peripheral according to the specified parameters in the dmaConfig.  */
void DMA_Config(DMA_CHANNEL_T *channel, DMA_Config_T *dmaConfig)
/* Config the DMA peripheral according to the specified parameters in the dmaConfig.  */
void DMA_Config(DMA_CHANNEL_T *channel, DMA_Config_T *dmaConfig)
{
    channel->CHCFG_B.DIRCFG   = dmaConfig->direction;
    channel->CHCFG_B.CIRMODE  = dmaConfig->circular;
    channel->CHCFG_B.M2MMODE  = dmaConfig->memoryTomemory;
    channel->CHCFG_B.CHPL     = dmaConfig->priority;
    channel->CHCFG_B.MIMODE   = dmaConfig->memoryInc;
    channel->CHCFG_B.PERIMODE = dmaConfig->peripheralInc;
    channel->CHCFG_B.MSIZE    = dmaConfig->memoryDataSize;
    channel->CHCFG_B.PERSIZE  = dmaConfig->peripheralDataSize;
    channel->CHNDATA = dmaConfig->bufferSize;
    channel->CHMADDR = dmaConfig->memoryAddress;
    channel->CHPADDR = dmaConfig->peripheralAddress;
}