/* Initializes DMA controller. 
This function will reset and prepare the DMA controller for use. Although it may be used several times, it is normally only used during system init. If reused during normal operation, notice that any ongoing DMA transfers will be aborted. When completed, the DMA controller is in an enabled state. */
void DMA_Init(DMA_Init_TypeDef *init)
/* Initializes DMA controller. 
This function will reset and prepare the DMA controller for use. Although it may be used several times, it is normally only used during system init. If reused during normal operation, notice that any ongoing DMA transfers will be aborted. When completed, the DMA controller is in an enabled state. */
void DMA_Init(DMA_Init_TypeDef *init)
{
  EFM_ASSERT(init);
  EFM_ASSERT(!((uint32_t)(init->controlBlock) & (256 - 1)));
  CMU_ClockEnable(cmuClock_DMA, true);
  DMA_Reset();
  NVIC_ClearPendingIRQ(DMA_IRQn);
  NVIC_EnableIRQ(DMA_IRQn);
  DMA->IEN = DMA_IEN_ERR;
  DMA->CTRLBASE = (uint32_t)(init->controlBlock);
  DMA->CONFIG = ((uint32_t)(init->hprot) << _DMA_CONFIG_CHPROT_SHIFT) | DMA_CONFIG_EN;
}