DMA Manager provides a series of functions to manage the DMAMUX channels.
Function groups
DMAMGR Initialization and De-initialization
This function group initializes and deinitializes the DMA Manager.
DMAMGR Operation
This function group requests/releases the DMAMUX channel and configures the channel request source.
Typical use case
DMAMGR static channel allocate
DMAMUX_Type *dmamux_base;
uint8_t channel;
dmamux_base = DMAMUX0;
channel = 0;
DMAMGR dynamic channel allocate
DMAMUX_Type *dmamux_base;
uint8_t channel;
dmamux_base = DMAMUX0;
channel = 0;
| #define DMAMGR_DYNAMIC_ALLOCATE 0xFFU |
| Enumerator |
|---|
| kStatus_DMAMGR_ChannelOccupied |
Channel has been occupied.
|
| kStatus_DMAMGR_ChannelNotUsed |
Channel has not been used.
|
| kStatus_DMAMGR_NoFreeChannel |
All channel has been occupied.
|
| kStatus_DMAMGR_ChannelNotMatchSource |
Channel do not match the request source.
|
| void DMAMGR_Init |
( |
void |
| ) |
|
This function initializes the DMA manager, ungates all DMAMUX clocks, and initializes the eDMA or DMA peripheral.
| void DMAMGR_Deinit |
( |
void |
| ) |
|
This function deinitializes the DMA manager, disables all DMAMUX channel, gates all DMAMUX clock, and deinitializes the eDMA or DMA peripheral.
| status_t DMAMGR_RequestChannel |
( |
dma_request_source_t |
requestSource, |
|
|
uint8_t |
virtualChannel, |
|
|
void * |
handle |
|
) |
| |
This function request a DMA channel which is not occupied. There are two channels to allocate the mechanism dynamic and static. For the dynamic allocation mechanism (virtualChannel = DMAMGR_DYNAMIC_ALLOCATE), DMAMGR allocates a DMA channel according to the given request source and then configure it. For static allocation mechanism, DMAMGR configures the given channel according to the given request source and channel number.
- Parameters
-
| requestSource | DMA channel request source number. See the soc.h. |
| virtualChannel | The channel number user wants to occupy. If using the dynamic channel allocate mechanism, set the virtualChannel equal to DMAMGR_DYNAMIC_ALLOCATE. |
| handle | DMA or eDMA handle pointer. |
- Return values
-
| kStatus_Success | In dynamic/static channel allocate mechanism, allocate DMAMUX channel successfully. |
| kStatus_DMAMGR_NoFreeChannel | In dynamic channel allocate mechanism, all DMAMUX channels has been occupied. |
| kStatus_DMAMGR_ChannelNotMatchSource | In static channel allocate mechanism, the given channel do not match the given request. |
| kStatus_DMAMGR_ChannelOccupied | In static channel allocate mechanism, the given channel has been occupied. |
| status_t DMAMGR_ReleaseChannel |
( |
void * |
handle | ) |
|
This function releases an occupied DMA channel.
- Parameters
-
| handle | DMA or eDMA handle pointer. |
- Return values
-
| kStatus_Success | Release the given channel successfully. |
| kStatus_DMAMGR_ChannelNotUsed | The given channel which to be released is not been used before. |