/ * @brief * Configure a DMA channel. * * @details * Configure miscellaneous issues for a DMA channel. This function is typically * used once to setup a channel for a certain type of use. * * @note * If using this function on a channel already in use by the DMA controller, * the behaviour is undefined. * * @param[in] channel * DMA channel to configure. * * @param[in] cfg
| 689 | * Configuration to use. |
| 690 | ******************************************************************************/ |
| 691 | void DMA_CfgChannel(unsigned int channel, DMA_CfgChannel_TypeDef *cfg) |
| 692 | { |
| 693 | DMA_DESCRIPTOR_TypeDef *descr; |
| 694 | |
| 695 | EFM_ASSERT(channel < DMA_CHAN_COUNT); |
| 696 | EFM_ASSERT(cfg); |
| 697 | |
| 698 | /* Always keep callback configuration reference in primary descriptor */ |
| 699 | descr = (DMA_DESCRIPTOR_TypeDef *)(DMA->CTRLBASE); |
| 700 | descr[channel].USER = (uint32_t)(cfg->cb); |
| 701 | |
| 702 | /* Set to specified priority for channel */ |
| 703 | if (cfg->highPri) |
| 704 | { |
| 705 | DMA->CHPRIS = 1 << channel; |
| 706 | } |
| 707 | else |
| 708 | { |
| 709 | DMA->CHPRIC = 1 << channel; |
| 710 | } |
| 711 | |
| 712 | /* Set DMA signal source select */ |
| 713 | DMA->CH[channel].CTRL = cfg->select; |
| 714 | |
| 715 | /* Enable/disable interrupt as specified */ |
| 716 | if (cfg->enableInt) |
| 717 | { |
| 718 | DMA->IFC = (1 << channel); |
| 719 | BITBAND_Peripheral(&(DMA->IEN), channel, 1); |
| 720 | } |
| 721 | else |
| 722 | { |
| 723 | BITBAND_Peripheral(&(DMA->IEN), channel, 0); |
| 724 | } |
| 725 | } |
| 726 | |
| 727 | |
| 728 | /***************************************************************************//** |
no test coverage detected