MCUXpresso SDK API Reference Manual  Rev. 0
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
DMA Manager

Overview

DMA Manager provides a series of functions to manage the DMAMUX instances and 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 allocattion

uint8_t channel;
dmamanager_handle_t dmamanager_handle;
/* Initialize DMAMGR */
DMAMGR_Init(&dmamanager_handle, EXAMPLE_DMA_BASEADDR, DMA_CHANNEL_NUMBER, startChannel);
/* Request a DMAMUX channel by static allocate mechanism */
channel = kDMAMGR_STATIC_ALLOCATE;
DMAMGR_RequestChannel(&dmamanager_handle, kDmaRequestMux0AlwaysOn63, channel, &handle);

DMAMGR dynamic channel allocation

uint8_t channel;
dmamanager_handle_t dmamanager_handle;
/* Initialize DMAMGR */
DMAMGR_Init(&dmamanager_handle, EXAMPLE_DMA_BASEADDR, DMA_CHANNEL_NUMBER, startChannel);
/* Request a DMAMUX channel by Dynamic allocate mechanism */
DMAMGR_RequestChannel(&dmamanager_handle, kDmaRequestMux0AlwaysOn63, channel, &handle);

Data Structures

struct  dmamanager_handle_t
 dmamanager handle typedef. More...
 

Macros

#define DMAMGR_DYNAMIC_ALLOCATE   0xFFU
 Dynamic channel allocation mechanism. More...
 

Enumerations

enum  _dma_manager_status {
  kStatus_DMAMGR_ChannelOccupied = MAKE_STATUS(kStatusGroup_DMAMGR, 0),
  kStatus_DMAMGR_ChannelNotUsed = MAKE_STATUS(kStatusGroup_DMAMGR, 1),
  kStatus_DMAMGR_NoFreeChannel = MAKE_STATUS(kStatusGroup_DMAMGR, 2)
}
 DMA manager status. More...
 

DMAMGR Initialization and De-initialization

void DMAMGR_Init (dmamanager_handle_t *dmamanager_handle, DMA_Type *dma_base, uint32_t channelNum, uint32_t startChannel)
 Initializes the DMA manager. More...
 
void DMAMGR_Deinit (dmamanager_handle_t *dmamanager_handle)
 Deinitializes the DMA manager. More...
 

DMAMGR Operation

status_t DMAMGR_RequestChannel (dmamanager_handle_t *dmamanager_handle, uint32_t requestSource, uint32_t channel, void *handle)
 Requests a DMA channel. More...
 
status_t DMAMGR_ReleaseChannel (dmamanager_handle_t *dmamanager_handle, void *handle)
 Releases a DMA channel. More...
 
bool DMAMGR_IsChannelOccupied (dmamanager_handle_t *dmamanager_handle, uint32_t channel)
 Get a DMA channel status. More...
 

Data Structure Documentation

struct dmamanager_handle_t
Note
The contents of this structure are private and subject to change.

This dma manager handle structure is used to store the parameters transfered by users.And users shall not free the memory before calling DMAMGR_Deinit, also shall not modify the contents of the memory.

Data Fields

void * dma_base
 Peripheral DMA instance. More...
 
uint32_t channelNum
 Channel numbers for the DMA instance which need to be managed by dma manager. More...
 
uint32_t startChannel
 The start channel that can be managed by dma manager,users need to transfer it with a certain number or NULL. More...
 
bool s_DMAMGR_Channels [64]
 The s_DMAMGR_Channels is used to store dma manager state. More...
 
uint32_t DmamuxInstanceStart
 The DmamuxInstance is used to calculate the DMAMUX Instance according to the DMA Instance. More...
 
uint32_t multiple
 The multiple is used to calculate the multiple between DMAMUX count and DMA count. More...
 

Field Documentation

void* dmamanager_handle_t::dma_base
uint32_t dmamanager_handle_t::channelNum
uint32_t dmamanager_handle_t::startChannel
bool dmamanager_handle_t::s_DMAMGR_Channels[64]
uint32_t dmamanager_handle_t::DmamuxInstanceStart
uint32_t dmamanager_handle_t::multiple

Macro Definition Documentation

#define DMAMGR_DYNAMIC_ALLOCATE   0xFFU

Enumeration Type Documentation

Enumerator
kStatus_DMAMGR_ChannelOccupied 

Channel has been occupied.

kStatus_DMAMGR_ChannelNotUsed 

Channel has not been used.

kStatus_DMAMGR_NoFreeChannel 

All channels have been occupied.

Function Documentation

void DMAMGR_Init ( dmamanager_handle_t dmamanager_handle,
DMA_Type *  dma_base,
uint32_t  channelNum,
uint32_t  startChannel 
)

This function initializes the DMA manager, ungates the DMAMUX clocks, and initializes the eDMA or DMA peripherals.

Parameters
dmamanager_handleDMA manager handle pointer, this structure is maintained by dma manager internal,users only need to transfer the structure to the function. And users shall not free the memory before calling DMAMGR_Deinit, also shall not modify the contents of the memory.
dma_basePeripheral DMA instance base pointer.
dmamux_basePeripheral DMAMUX instance base pointer.
channelNumChannel numbers for the DMA instance which need to be managed by dma manager.
startChannelThe start channel that can be managed by dma manager.
void DMAMGR_Deinit ( dmamanager_handle_t dmamanager_handle)

This function deinitializes the DMA manager, disables the DMAMUX channels, gates the DMAMUX clocks, and deinitializes the eDMA or DMA peripherals.

Parameters
dmamanager_handleDMA manager handle pointer, this structure is maintained by dma manager internal,users only need to transfer the structure to the function. And users shall not free the memory before calling DMAMGR_Deinit, also shall not modify the contents of the memory.
status_t DMAMGR_RequestChannel ( dmamanager_handle_t dmamanager_handle,
uint32_t  requestSource,
uint32_t  channel,
void *  handle 
)

This function requests a DMA channel which is not occupied. The two channels to allocate the mechanism are dynamic and static channels. For the dynamic allocation mechanism (channe = DMAMGR_DYNAMIC_ALLOCATE), DMAMGR allocates a DMA channel according to the given request source and startChannel and then configures it. For static allocation mechanism, DMAMGR configures the given channel according to the given request source and channel number.

Parameters
dmamanager_handleDMA manager handle pointer, this structure is maintained by dma manager internal,users only need to transfer the structure to the function. And users shall not free the memory before calling DMAMGR_Deinit, also shall not modify the contents of the memory.
requestSourceDMA channel request source number. See the soc.h, see the enum dma_request_source_t
channelThe channel number users want to occupy. If using the dynamic channel allocate mechanism, set the channel equal to DMAMGR_DYNAMIC_ALLOCATE.
handleDMA or eDMA handle pointer.
Return values
kStatus_SuccessIn a dynamic/static channel allocation mechanism, allocate the DMAMUX channel successfully.
kStatus_DMAMGR_NoFreeChannelIn a dynamic channel allocation mechanism, all DMAMUX channels are occupied.
kStatus_DMAMGR_ChannelOccupiedIn a static channel allocation mechanism, the given channel is occupied.
status_t DMAMGR_ReleaseChannel ( dmamanager_handle_t dmamanager_handle,
void *  handle 
)

This function releases an occupied DMA channel.

Parameters
dmamanager_handleDMA manager handle pointer, this structure is maintained by dma manager internal,users only need to transfer the structure to the function. And users shall not free the memory before calling DMAMGR_Deinit, also shall not modify the contents of the memory.
handleDMA or eDMA handle pointer.
Return values
kStatus_SuccessReleases the given channel successfully.
kStatus_DMAMGR_ChannelNotUsedThe given channel to be released had not been used before.
bool DMAMGR_IsChannelOccupied ( dmamanager_handle_t dmamanager_handle,
uint32_t  channel 
)

This function get a DMA channel status. Return 0 indicates the channel has not been used, return 1 indicates the channel has been occupied.

Parameters
dmamanager_handleDMA manager handle pointer, this structure is maintained by dma manager internal,users only need to transfer the structure to the function. And users shall not free the memory before calling DMAMGR_Deinit, also shall not modify the contents of the memory.
channelThe channel number that users want get its status.