EFM32 Wonder Gecko Software Documentation
efm32wg-doc-5.1.2
|
Direct Memory Access (DMA) Peripheral API.
These DMA access functions provide basic support for the following types of DMA cycles:
A basic understanding of the DMA controller is assumed. Please refer to the reference manual for further details.
The term 'descriptor' is used as a synonym to the 'channel control data structure' term.
In order to use the DMA controller, the initialization function must have been executed once (normally during system init):
* DMA_Init(); *
Then, normally a user of a DMA channel configures the channel:
* DMA_CfgChannel(); *
The channel configuration only has to be done once, if reusing the channel for the same purpose later.
In order to set up a DMA cycle, the primary and/or alternate descriptor has to be set up as indicated below.
For basic or auto-request cycles, use once on either primary or alternate descriptor:
* DMA_CfgDescr(); *
For ping-pong cycles, configure both primary or alternate descriptors:
* DMA_CfgDescr(); // Primary descriptor config * DMA_CfgDescr(); // Alternate descriptor config *
For scatter-gather cycles, the alternate descriptor array must be programmed:
* // 'n' is the number of scattered buffers * // 'descr' points to the start of the alternate descriptor array * * // Fill in 'cfg' * DMA_CfgDescrScatterGather(descr, 0, cfg); * // Fill in 'cfg' * DMA_CfgDescrScatterGather(descr, 1, cfg); * : * // Fill in 'cfg' * DMA_CfgDescrScatterGather(descr, n - 1, cfg); *
In many cases, the descriptor configuration only has to be done once, if re-using the channel for the same type of DMA cycles later.
In order to activate the DMA cycle, use the respective DMA_Activate...() function.
For ping-pong DMA cycles, use DMA_RefreshPingPong() from the callback to prepare the completed descriptor for reuse. Notice that the refresh must be done prior to the other active descriptor completes, otherwise the ping-pong DMA cycle will halt.
Data Structures | |
struct | DMA_CB_TypeDef |
Callback structure that can be used to define DMA complete actions. More... | |
struct | DMA_CfgChannel_TypeDef |
struct | DMA_CfgDescr_TypeDef |
struct | DMA_CfgDescrSGAlt_TypeDef |
struct | DMA_CfgLoop_TypeDef |
struct | DMA_CfgRect_TypeDef |
struct | DMA_Init_TypeDef |
Typedefs | |
typedef void(* | DMA_FuncPtr_TypeDef) (unsigned int channel, bool primary, void *user) |
DMA interrupt callback function pointer. More... | |
Enumerations | |
enum | DMA_ArbiterConfig_TypeDef { dmaArbitrate1 = _DMA_CTRL_R_POWER_1, dmaArbitrate2 = _DMA_CTRL_R_POWER_2, dmaArbitrate4 = _DMA_CTRL_R_POWER_4, dmaArbitrate8 = _DMA_CTRL_R_POWER_8, dmaArbitrate16 = _DMA_CTRL_R_POWER_16, dmaArbitrate32 = _DMA_CTRL_R_POWER_32, dmaArbitrate64 = _DMA_CTRL_R_POWER_64, dmaArbitrate128 = _DMA_CTRL_R_POWER_128, dmaArbitrate256 = _DMA_CTRL_R_POWER_256, dmaArbitrate512 = _DMA_CTRL_R_POWER_512, dmaArbitrate1024 = _DMA_CTRL_R_POWER_1024 } |
enum | DMA_CycleCtrl_TypeDef { dmaCycleCtrlBasic = _DMA_CTRL_CYCLE_CTRL_BASIC, dmaCycleCtrlAuto = _DMA_CTRL_CYCLE_CTRL_AUTO, dmaCycleCtrlPingPong = _DMA_CTRL_CYCLE_CTRL_PINGPONG, dmaCycleCtrlMemScatterGather = _DMA_CTRL_CYCLE_CTRL_MEM_SCATTER_GATHER, dmaCycleCtrlPerScatterGather = _DMA_CTRL_CYCLE_CTRL_PER_SCATTER_GATHER } |
enum | DMA_DataInc_TypeDef { dmaDataInc1 = _DMA_CTRL_SRC_INC_BYTE, dmaDataInc2 = _DMA_CTRL_SRC_INC_HALFWORD, dmaDataInc4 = _DMA_CTRL_SRC_INC_WORD, dmaDataIncNone = _DMA_CTRL_SRC_INC_NONE } |
enum | DMA_DataSize_TypeDef { dmaDataSize1 = _DMA_CTRL_SRC_SIZE_BYTE, dmaDataSize2 = _DMA_CTRL_SRC_SIZE_HALFWORD, dmaDataSize4 = _DMA_CTRL_SRC_SIZE_WORD } |
Functions | |
void | DMA_ActivateAuto (unsigned int channel, bool primary, void *dst, const void *src, unsigned int nMinus1) |
Activate DMA auto-request cycle (used for memory-memory transfers). More... | |
void | DMA_ActivateBasic (unsigned int channel, bool primary, bool useBurst, void *dst, const void *src, unsigned int nMinus1) |
Activate DMA basic cycle (used for memory-peripheral transfers). More... | |
void | DMA_ActivatePingPong (unsigned int channel, bool useBurst, void *primDst, const void *primSrc, unsigned int primNMinus1, void *altDst, const void *altSrc, unsigned int altNMinus1) |
Activate DMA ping-pong cycle (used for memory-peripheral transfers). More... | |
void | DMA_ActivateScatterGather (unsigned int channel, bool useBurst, DMA_DESCRIPTOR_TypeDef *altDescr, unsigned int count) |
Activate DMA scatter-gather cycle (used for either memory-peripheral or memory-memory transfers). More... | |
void | DMA_CfgChannel (unsigned int channel, DMA_CfgChannel_TypeDef *cfg) |
Configure a DMA channel. More... | |
void | DMA_CfgDescr (unsigned int channel, bool primary, DMA_CfgDescr_TypeDef *cfg) |
Configure DMA descriptor for auto-request, basic or ping-pong DMA cycles. More... | |
void | DMA_CfgDescrScatterGather (DMA_DESCRIPTOR_TypeDef *descr, unsigned int indx, DMA_CfgDescrSGAlt_TypeDef *cfg) |
Configure an alternate DMA descriptor for use with scatter-gather DMA cycles. More... | |
void | DMA_CfgLoop (unsigned int channel, DMA_CfgLoop_TypeDef *cfg) |
Configure DMA channel for Loop mode or 2D transfer. More... | |
void | DMA_CfgRect (unsigned int channel, DMA_CfgRect_TypeDef *cfg) |
Configure DMA channel 2D transfer properties. More... | |
void | DMA_ChannelEnable (unsigned int channel, bool enable) |
Enable or disable a DMA channel. More... | |
bool | DMA_ChannelEnabled (unsigned int channel) |
Check if DMA channel is enabled. More... | |
void | DMA_ChannelRequestEnable (unsigned int channel, bool enable) |
Enable or disable a DMA channel request. More... | |
void | DMA_Init (DMA_Init_TypeDef *init) |
Initializes DMA controller. More... | |
__STATIC_INLINE void | DMA_IntClear (uint32_t flags) |
Clear one or more pending DMA interrupts. More... | |
__STATIC_INLINE void | DMA_IntDisable (uint32_t flags) |
Disable one or more DMA interrupts. More... | |
__STATIC_INLINE void | DMA_IntEnable (uint32_t flags) |
Enable one or more DMA interrupts. More... | |
__STATIC_INLINE uint32_t | DMA_IntGet (void) |
Get pending DMA interrupt flags. More... | |
__STATIC_INLINE uint32_t | DMA_IntGetEnabled (void) |
Get enabled and pending DMA interrupt flags. Useful for handling more interrupt sources in the same interrupt handler. More... | |
__STATIC_INLINE void | DMA_IntSet (uint32_t flags) |
Set one or more pending DMA interrupts. More... | |
void | DMA_IRQHandler (void) |
Interrupt handler for DMA cycle completion handling. More... | |
void | DMA_RefreshPingPong (unsigned int channel, bool primary, bool useBurst, void *dst, const void *src, unsigned int nMinus1, bool stop) |
Refresh a descriptor used in a DMA ping-pong cycle. More... | |
void | DMA_Reset (void) |
Reset the DMA controller. More... | |
__STATIC_INLINE void | DMA_ResetLoop (unsigned int channel) |
Clear Loop configuration for channel. More... | |
__STATIC_INLINE void | DMA_ResetRect (unsigned int channel) |
Clear Rect/2D DMA configuration for channel. More... | |
typedef void(* DMA_FuncPtr_TypeDef) (unsigned int channel, bool primary, void *user) |
DMA interrupt callback function pointer.
Parameters:
Number of transfers before controller does new arbitration.
enum DMA_DataInc_TypeDef |
enum DMA_DataSize_TypeDef |
void DMA_ActivateAuto | ( | unsigned int | channel, |
bool | primary, | ||
void * | dst, | ||
const void * | src, | ||
unsigned int | nMinus1 | ||
) |
Activate DMA auto-request cycle (used for memory-memory transfers).
Prior to activating the DMA cycle, the channel and descriptor to be used must have been properly configured.
[in] | channel | DMA channel to activate DMA cycle for. |
[in] | primary |
|
[in] | dst | Address to start location to transfer data to. If NULL, leave setting in descriptor as is from a previous activation. |
[in] | src | Address to start location to transfer data from. If NULL, leave setting in descriptor as is from a previous activation. |
[in] | nMinus1 | Number of DMA transfer elements (minus 1) to transfer (<= 1023). The size of the DMA transfer element (1, 2 or 4 bytes) is configured with DMA_CfgDescr(). |
Definition at line 386 of file em_dma.c.
References _DMA_CTRL_N_MINUS_1_MASK, _DMA_CTRL_N_MINUS_1_SHIFT, DMA, DMA_CHAN_COUNT, and dmaCycleCtrlAuto.
void DMA_ActivateBasic | ( | unsigned int | channel, |
bool | primary, | ||
bool | useBurst, | ||
void * | dst, | ||
const void * | src, | ||
unsigned int | nMinus1 | ||
) |
Activate DMA basic cycle (used for memory-peripheral transfers).
Prior to activating the DMA cycle, the channel and descriptor to be used must have been properly configured.
[in] | channel | DMA channel to activate DMA cycle for. |
[in] | primary |
|
[in] | useBurst | The burst feature is only used on peripherals supporting DMA bursts. Bursts must not be used if the total length (as given by nMinus1) is less than the arbitration rate configured for the descriptor. Please refer to the reference manual for further details on burst usage. |
[in] | dst | Address to start location to transfer data to. If NULL, leave setting in descriptor as is from a previous activation. |
[in] | src | Address to start location to transfer data from. If NULL, leave setting in descriptor as is from a previous activation. |
[in] | nMinus1 | Number of DMA transfer elements (minus 1) to transfer (<= 1023). The size of the DMA transfer element (1, 2 or 4 bytes) is configured with DMA_CfgDescr(). |
Definition at line 449 of file em_dma.c.
References _DMA_CTRL_N_MINUS_1_MASK, _DMA_CTRL_N_MINUS_1_SHIFT, DMA, DMA_CHAN_COUNT, and dmaCycleCtrlBasic.
Referenced by CDC_StateChangeEvent().
void DMA_ActivatePingPong | ( | unsigned int | channel, |
bool | useBurst, | ||
void * | primDst, | ||
const void * | primSrc, | ||
unsigned int | primNMinus1, | ||
void * | altDst, | ||
const void * | altSrc, | ||
unsigned int | altNMinus1 | ||
) |
Activate DMA ping-pong cycle (used for memory-peripheral transfers).
Prior to activating the DMA cycle, the channel and both descriptors must have been properly configured. The primary descriptor is always the first descriptor to be used by the DMA controller.
[in] | channel | DMA channel to activate DMA cycle for. |
[in] | useBurst | The burst feature is only used on peripherals supporting DMA bursts. Bursts must not be used if the total length (as given by nMinus1) is less than the arbitration rate configured for the descriptors. Please refer to the reference manual for further details on burst usage. Notice that this setting is used for both the primary and alternate descriptors. |
[in] | primDst | Address to start location to transfer data to, for primary descriptor. If NULL, leave setting in descriptor as is from a previous activation. |
[in] | primSrc | Address to start location to transfer data from, for primary descriptor. If NULL, leave setting in descriptor as is from a previous activation. |
[in] | primNMinus1 | Number of DMA transfer elements (minus 1) to transfer (<= 1023), for primary descriptor. The size of the DMA transfer element (1, 2 or 4 bytes) is configured with DMA_CfgDescr(). |
[in] | altDst | Address to start location to transfer data to, for alternate descriptor. If NULL, leave setting in descriptor as is from a previous activation. |
[in] | altSrc | Address to start location to transfer data from, for alternate descriptor. If NULL, leave setting in descriptor as is from a previous activation. |
[in] | altNMinus1 | Number of DMA transfer elements (minus 1) to transfer (<= 1023), for alternate descriptor. The size of the DMA transfer element (1, 2 or 4 bytes) is configured with DMA_CfgDescr(). |
Definition at line 521 of file em_dma.c.
References _DMA_CTRL_N_MINUS_1_MASK, _DMA_CTRL_N_MINUS_1_SHIFT, DMA, DMA_CHAN_COUNT, and dmaCycleCtrlPingPong.
void DMA_ActivateScatterGather | ( | unsigned int | channel, |
bool | useBurst, | ||
DMA_DESCRIPTOR_TypeDef * | altDescr, | ||
unsigned int | count | ||
) |
Activate DMA scatter-gather cycle (used for either memory-peripheral or memory-memory transfers).
Prior to activating the DMA cycle, the array with alternate descriptors must have been properly configured. This function can be reused without reconfiguring the alternate descriptors, as long as count
is the same.
[in] | channel | DMA channel to activate DMA cycle for. |
[in] | useBurst | The burst feature is only used on peripherals supporting DMA bursts (and thus this parameter is ignored for memory scatter-gather cycles). This parameter determines if bursts should be enabled during DMA transfers using the alternate descriptors. Bursts must not be used if the total length (as given by nMinus1 for the alternate descriptor) is less than the arbitration rate configured for the descriptor. Please refer to the reference manual for further details on burst usage. |
[in,out] | altDescr | Pointer to start of array with prepared alternate descriptors. The last descriptor will have its cycle control type reprogrammed to basic type. |
[in] | count | Number of alternate descriptors in altDescr array. Maximum number of alternate descriptors is 256. |
Definition at line 591 of file em_dma.c.
References _DMA_CTRL_CYCLE_CTRL_MASK, _DMA_CTRL_CYCLE_CTRL_SHIFT, _DMA_CTRL_DST_INC_SHIFT, _DMA_CTRL_DST_SIZE_SHIFT, _DMA_CTRL_N_MINUS_1_SHIFT, _DMA_CTRL_NEXT_USEBURST_SHIFT, _DMA_CTRL_R_POWER_SHIFT, _DMA_CTRL_SRC_INC_SHIFT, _DMA_CTRL_SRC_PROT_CTRL_MASK, _DMA_CTRL_SRC_SIZE_SHIFT, DMA_DESCRIPTOR_TypeDef::CTRL, DMA, DMA_CHAN_COUNT, dmaArbitrate4, dmaCycleCtrlAuto, dmaCycleCtrlBasic, dmaCycleCtrlMemScatterGather, dmaCycleCtrlPerScatterGather, dmaDataInc4, dmaDataSize4, DMA_DESCRIPTOR_TypeDef::DSTEND, DMA_CB_TypeDef::primary, DMA_DESCRIPTOR_TypeDef::SRCEND, and DMA_DESCRIPTOR_TypeDef::USER.
void DMA_CfgChannel | ( | unsigned int | channel, |
DMA_CfgChannel_TypeDef * | cfg | ||
) |
Configure a DMA channel.
Configure miscellaneous issues for a DMA channel. This function is typically used once to setup a channel for a certain type of use.
[in] | channel | DMA channel to configure. |
[in] | cfg | Configuration to use. |
Definition at line 701 of file em_dma.c.
References BUS_RegBitWrite(), DMA_CfgChannel_TypeDef::cb, DMA, DMA_CHAN_COUNT, DMA_CfgChannel_TypeDef::enableInt, DMA_CfgChannel_TypeDef::highPri, DMA_CfgChannel_TypeDef::select, and DMA_DESCRIPTOR_TypeDef::USER.
Referenced by NANDFLASH_Init().
void DMA_CfgDescr | ( | unsigned int | channel, |
bool | primary, | ||
DMA_CfgDescr_TypeDef * | cfg | ||
) |
Configure DMA descriptor for auto-request, basic or ping-pong DMA cycles.
This function is used for configuration of a descriptor for the following DMA cycle types:
The DMA cycle is not activated, please see DMA_ActivateAuto(), DMA_ActivateBasic() or DMA_ActivatePingPong() to activate the DMA cycle. In many cases, the configuration only has to be done once, and all subsequent cycles may be activated with the activate function.
For ping-pong DMA cycles, this function must be used both on the primary and the alternate descriptor prior to activating the DMA cycle.
Notice that the DMA channel must also be configured, see DMA_CfgChannel().
[in] | channel | DMA channel to configure for. |
[in] | primary |
|
[in] | cfg | Configuration to use. |
Definition at line 776 of file em_dma.c.
References _DMA_CTRL_DST_INC_SHIFT, _DMA_CTRL_DST_SIZE_SHIFT, _DMA_CTRL_N_MINUS_1_SHIFT, _DMA_CTRL_NEXT_USEBURST_SHIFT, _DMA_CTRL_R_POWER_SHIFT, _DMA_CTRL_SRC_INC_SHIFT, _DMA_CTRL_SRC_PROT_CTRL_SHIFT, _DMA_CTRL_SRC_SIZE_SHIFT, DMA_CfgDescr_TypeDef::arbRate, DMA_DESCRIPTOR_TypeDef::CTRL, DMA, DMA_CHAN_COUNT, DMA_CTRL_CYCLE_CTRL_INVALID, DMA_CfgDescr_TypeDef::dstInc, DMA_CfgDescr_TypeDef::hprot, DMA_CfgDescr_TypeDef::size, and DMA_CfgDescr_TypeDef::srcInc.
void DMA_CfgDescrScatterGather | ( | DMA_DESCRIPTOR_TypeDef * | descr, |
unsigned int | indx, | ||
DMA_CfgDescrSGAlt_TypeDef * | cfg | ||
) |
Configure an alternate DMA descriptor for use with scatter-gather DMA cycles.
In scatter-gather mode, the alternate descriptors are located in one contiguous memory area. Each of the alternate descriptor must be fully configured prior to starting the scatter-gather DMA cycle.
The DMA cycle is not activated by this function, please see DMA_ActivateScatterGather() to activate the DMA cycle. In some cases, the alternate configuration only has to be done once, and all subsequent transfers may be activated with the activate function.
Notice that the DMA channel must also be configured, see DMA_CfgChannel().
[in] | descr | Points to start of memory area holding the alternate descriptors. |
[in] | indx | Alternate descriptor index number to configure (numbered from 0). |
[in] | cfg | Configuration to use. |
Definition at line 898 of file em_dma.c.
References _DMA_CTRL_CYCLE_CTRL_SHIFT, _DMA_CTRL_DST_INC_SHIFT, _DMA_CTRL_DST_SIZE_SHIFT, _DMA_CTRL_N_MINUS_1_SHIFT, _DMA_CTRL_NEXT_USEBURST_SHIFT, _DMA_CTRL_R_POWER_SHIFT, _DMA_CTRL_SRC_INC_SHIFT, _DMA_CTRL_SRC_PROT_CTRL_SHIFT, _DMA_CTRL_SRC_SIZE_SHIFT, DMA_CfgDescrSGAlt_TypeDef::arbRate, DMA_DESCRIPTOR_TypeDef::CTRL, dmaCycleCtrlMemScatterGather, dmaCycleCtrlPerScatterGather, dmaDataIncNone, DMA_CfgDescrSGAlt_TypeDef::dst, DMA_DESCRIPTOR_TypeDef::DSTEND, DMA_CfgDescrSGAlt_TypeDef::dstInc, DMA_CfgDescrSGAlt_TypeDef::hprot, DMA_CfgDescrSGAlt_TypeDef::nMinus1, DMA_CfgDescrSGAlt_TypeDef::peripheral, DMA_CfgDescrSGAlt_TypeDef::size, DMA_CfgDescrSGAlt_TypeDef::src, DMA_DESCRIPTOR_TypeDef::SRCEND, DMA_CfgDescrSGAlt_TypeDef::srcInc, and DMA_DESCRIPTOR_TypeDef::USER.
void DMA_CfgLoop | ( | unsigned int | channel, |
DMA_CfgLoop_TypeDef * | cfg | ||
) |
Configure DMA channel for Loop mode or 2D transfer.
For 2D transfer, set cfg->enable to "false", and only configure nMinus1 to same width as channel descriptor.
[in] | channel | DMA channel to configure for. |
[in] | cfg | Configuration to use. |
Definition at line 824 of file em_dma.c.
References _DMA_LOOP0_EN_SHIFT, _DMA_LOOP0_WIDTH_SHIFT, _DMA_LOOP1_EN_SHIFT, _DMA_LOOP1_WIDTH_SHIFT, DMA, DMA_CfgLoop_TypeDef::enable, and DMA_CfgLoop_TypeDef::nMinus1.
void DMA_CfgRect | ( | unsigned int | channel, |
DMA_CfgRect_TypeDef * | cfg | ||
) |
Configure DMA channel 2D transfer properties.
[in] | channel | DMA channel to configure for. |
[in] | cfg | Configuration to use. |
Definition at line 855 of file em_dma.c.
References _DMA_RECT0_DSTSTRIDE_SHIFT, _DMA_RECT0_HEIGHT_SHIFT, _DMA_RECT0_SRCSTRIDE_SHIFT, DMA, DMA_CfgRect_TypeDef::dstStride, DMA_CfgRect_TypeDef::height, and DMA_CfgRect_TypeDef::srcStride.
void DMA_ChannelEnable | ( | unsigned int | channel, |
bool | enable | ||
) |
Enable or disable a DMA channel.
Use this function to explicitly enable or disable a DMA channel. A DMA channel is automatically disabled when the DMA controller has finished a transaction.
[in] | channel | DMA channel to enable or disable. |
[in] | enable | If 'true' the channel will be enabled. If 'false' the channel will be disabled. |
Definition at line 974 of file em_dma.c.
References DMA, and DMA_CHAN_COUNT.
Referenced by DMADRV_StopTransfer().
bool DMA_ChannelEnabled | ( | unsigned int | channel | ) |
Check if DMA channel is enabled.
The DMA channel is disabled when the DMA controller has finished a DMA cycle.
[in] | channel | DMA channel to check. |
Definition at line 1003 of file em_dma.c.
References DMA, and DMA_CHAN_COUNT.
Referenced by DMADRV_TransferActive().
void DMA_ChannelRequestEnable | ( | unsigned int | channel, |
bool | enable | ||
) |
Enable or disable a DMA channel request.
Use this function to enable or disable a DMA channel request. This will prevent the DMA from proceeding after its current transaction if disabled.
[in] | channel | DMA channel to enable or disable request on. |
[in] | enable | If 'true' request will be enabled. If 'false' request will be disabled. |
Definition at line 1025 of file em_dma.c.
References BUS_RegBitWrite(), DMA, and DMA_CHAN_COUNT.
Referenced by DMADRV_PauseTransfer(), and DMADRV_ResumeTransfer().
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.
[in] | init | Pointer to a structure containing DMA init information. |
Definition at line 1057 of file em_dma.c.
References _DMA_CONFIG_CHPROT_SHIFT, CMU_ClockEnable(), cmuClock_DMA, DMA_Init_TypeDef::controlBlock, DMA, DMA_CONFIG_EN, DMA_IEN_ERR, DMA_IRQn, DMA_Reset(), and DMA_Init_TypeDef::hprot.
Referenced by DMADRV_Init(), and NANDFLASH_Init().
__STATIC_INLINE void DMA_IntClear | ( | uint32_t | flags | ) |
__STATIC_INLINE void DMA_IntDisable | ( | uint32_t | flags | ) |
__STATIC_INLINE void DMA_IntEnable | ( | uint32_t | flags | ) |
Enable one or more DMA interrupts.
[in] | flags | DMA interrupt sources to enable. Use one or more valid interrupt flags for the DMA module (DMA_IEN_nnn). |
Definition at line 495 of file em_dma.h.
References DMA.
__STATIC_INLINE uint32_t DMA_IntGet | ( | void | ) |
__STATIC_INLINE uint32_t DMA_IntGetEnabled | ( | void | ) |
Get enabled and pending DMA interrupt flags. Useful for handling more interrupt sources in the same interrupt handler.
Definition at line 532 of file em_dma.h.
References DMA.
__STATIC_INLINE void DMA_IntSet | ( | uint32_t | flags | ) |
void DMA_IRQHandler | ( | void | ) |
Interrupt handler for DMA cycle completion handling.
Clears any pending flags and calls registered callback (if any).
If using the default interrupt vector table setup provided, this function is automatically placed in the IRQ table due to weak linking. If taking control over the interrupt vector table in some other way, this interrupt handler must be installed in order to be able to support callback actions.
In order for the user to implement a custom IRQ handler or run without a DMA IRQ handler, the user can define EXCLUDE_DEFAULT_DMA_IRQ_HANDLER with a #define statement or with the compiler option -D.
Definition at line 284 of file em_dma.c.
References DMA_CB_TypeDef::cbFunc, DMA, DMA_IF_ERR, DMA_CB_TypeDef::primary, and DMA_CB_TypeDef::userPtr.
void DMA_RefreshPingPong | ( | unsigned int | channel, |
bool | primary, | ||
bool | useBurst, | ||
void * | dst, | ||
const void * | src, | ||
unsigned int | nMinus1, | ||
bool | stop | ||
) |
Refresh a descriptor used in a DMA ping-pong cycle.
During a ping-pong DMA cycle, the DMA controller automatically alternates between primary and alternate descriptors, when completing use of a descriptor. While the other descriptor is in use by the DMA controller, the SW should refresh the completed descriptor. This is typically done from the callback defined for the ping-pong cycle.
[in] | channel | DMA channel to refresh ping-pong descriptor for. |
[in] | primary |
|
[in] | useBurst | The burst feature is only used on peripherals supporting DMA bursts. Bursts must not be used if the total length (as given by nMinus1) is less than the arbitration rate configured for the descriptor. Please refer to the reference manual for further details on burst usage. |
[in] | dst | Address to start location to transfer data to. If NULL, leave setting in descriptor as is. |
[in] | src | Address to start location to transfer data from. If NULL, leave setting in descriptor as is. |
[in] | nMinus1 | Number of DMA transfer elements (minus 1) to transfer (<= 1023). The size of the DMA transfer element (1, 2 or 4 bytes) is configured with DMA_CfgDescr(). |
[in] | stop | Indicate that the DMA ping-pong cycle shall stop after completing use of this descriptor. |
Definition at line 1135 of file em_dma.c.
References _DMA_CTRL_CYCLE_CTRL_MASK, _DMA_CTRL_CYCLE_CTRL_SHIFT, _DMA_CTRL_DST_INC_MASK, _DMA_CTRL_DST_INC_NONE, _DMA_CTRL_DST_INC_SHIFT, _DMA_CTRL_N_MINUS_1_MASK, _DMA_CTRL_N_MINUS_1_SHIFT, _DMA_CTRL_SRC_INC_MASK, _DMA_CTRL_SRC_INC_NONE, _DMA_CTRL_SRC_INC_SHIFT, DMA_DESCRIPTOR_TypeDef::CTRL, DMA, DMA_CHAN_COUNT, dmaCycleCtrlBasic, dmaCycleCtrlPingPong, DMA_DESCRIPTOR_TypeDef::DSTEND, and DMA_DESCRIPTOR_TypeDef::SRCEND.
void DMA_Reset | ( | void | ) |
Reset the DMA controller.
This functions will disable the DMA controller and set it to a reset state.
Definition at line 1227 of file em_dma.c.
References _DMA_CH_CTRL_RESETVALUE, _DMA_CHALTC_MASK, _DMA_CHENC_MASK, _DMA_CHPRIC_MASK, _DMA_CHREQMASKC_MASK, _DMA_CHUSEBURSTC_MASK, _DMA_CONFIG_RESETVALUE, _DMA_IEN_RESETVALUE, _DMA_IFC_MASK, DMA, DMA_CHAN_COUNT, DMA_ERRORC_ERRORC, and DMA_IRQn.
Referenced by DMA_Init().
__STATIC_INLINE void DMA_ResetLoop | ( | unsigned int | channel | ) |
Clear Loop configuration for channel.
[in] | channel | Channel to reset loop configuration for |
Definition at line 403 of file em_dma.h.
References _DMA_LOOP0_RESETVALUE, _DMA_LOOP1_RESETVALUE, and DMA.
__STATIC_INLINE void DMA_ResetRect | ( | unsigned int | channel | ) |
Clear Rect/2D DMA configuration for channel.
[in] | channel | Channel to reset loop configuration for |
Definition at line 429 of file em_dma.h.
References _DMA_RECT0_RESETVALUE, and DMA.