MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / DMA_CfgChannel

Function DMA_CfgChannel

bsp/efm32/Libraries/emlib/src/em_dma.c:691–725  ·  view source on GitHub ↗

/ * @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

Source from the content-addressed store, hash-verified

689 * Configuration to use.
690 ******************************************************************************/
691void 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/***************************************************************************//**

Callers 3

drv_usart.cFile · 0.85
rt_hw_leuart_unit_initFunction · 0.85
efm32_adc_cfg_dmaFunction · 0.85

Calls 1

BITBAND_PeripheralFunction · 0.85

Tested by

no test coverage detected