![]() |
MCUXpresso SDK API Reference Manual
Rev. 0
NXP Semiconductors
|
The MCUXpresso SDK provides a peripheral driver for the Direct Memory Access (DMA) of MCUXpresso SDK devices.
Data Structures | |
| struct | dma_transfer_config_t |
| DMA transfer configuration structure. More... | |
| struct | dma_channel_link_config_t |
| DMA transfer configuration structure. More... | |
| struct | dma_handle_t |
| DMA DMA handle structure. More... | |
Typedefs | |
| typedef void(* | dma_callback )(struct _dma_handle *handle, void *userData) |
| Callback function prototype for the DMA driver. More... | |
Driver version | |
| #define | FSL_DMA_DRIVER_VERSION (MAKE_VERSION(2, 0, 1)) |
| DMA driver version 2.0.1. More... | |
DMA Initialization and De-initialization | |
| void | DMA_Init (DMA_Type *base) |
| Initializes the DMA peripheral. More... | |
| void | DMA_Deinit (DMA_Type *base) |
| Deinitializes the DMA peripheral. More... | |
DMA Channel Operation | |
| void | DMA_ResetChannel (DMA_Type *base, uint32_t channel) |
| Resets the DMA channel. More... | |
| void | DMA_SetTransferConfig (DMA_Type *base, uint32_t channel, const dma_transfer_config_t *config) |
| Configures the DMA transfer attribute. More... | |
| void | DMA_SetChannelLinkConfig (DMA_Type *base, uint32_t channel, const dma_channel_link_config_t *config) |
| Configures the DMA channel link feature. More... | |
| static void | DMA_SetSourceAddress (DMA_Type *base, uint32_t channel, uint32_t srcAddr) |
| Sets the DMA source address for the DMA transfer. More... | |
| static void | DMA_SetDestinationAddress (DMA_Type *base, uint32_t channel, uint32_t destAddr) |
| Sets the DMA destination address for the DMA transfer. More... | |
| static void | DMA_SetTransferSize (DMA_Type *base, uint32_t channel, uint32_t size) |
| Sets the DMA transfer size for the DMA transfer. More... | |
| void | DMA_SetModulo (DMA_Type *base, uint32_t channel, dma_modulo_t srcModulo, dma_modulo_t destModulo) |
| Sets the DMA modulo for the DMA transfer. More... | |
| static void | DMA_EnableCycleSteal (DMA_Type *base, uint32_t channel, bool enable) |
| Enables the DMA cycle steal for the DMA transfer. More... | |
| static void | DMA_EnableAutoAlign (DMA_Type *base, uint32_t channel, bool enable) |
| Enables the DMA auto align for the DMA transfer. More... | |
| static void | DMA_EnableAsyncRequest (DMA_Type *base, uint32_t channel, bool enable) |
| Enables the DMA async request for the DMA transfer. More... | |
| static void | DMA_EnableInterrupts (DMA_Type *base, uint32_t channel) |
| Enables an interrupt for the DMA transfer. More... | |
| static void | DMA_DisableInterrupts (DMA_Type *base, uint32_t channel) |
| Disables an interrupt for the DMA transfer. More... | |
DMA Channel Transfer Operation | |
| static void | DMA_EnableChannelRequest (DMA_Type *base, uint32_t channel) |
| Enables the DMA hardware channel request. More... | |
| static void | DMA_DisableChannelRequest (DMA_Type *base, uint32_t channel) |
| Disables the DMA hardware channel request. More... | |
| static void | DMA_TriggerChannelStart (DMA_Type *base, uint32_t channel) |
| Starts the DMA transfer with a software trigger. More... | |
DMA Channel Status Operation | |
| static uint32_t | DMA_GetRemainingBytes (DMA_Type *base, uint32_t channel) |
| Gets the remaining bytes of the current DMA transfer. More... | |
| static uint32_t | DMA_GetChannelStatusFlags (DMA_Type *base, uint32_t channel) |
| Gets the DMA channel status flags. More... | |
| static void | DMA_ClearChannelStatusFlags (DMA_Type *base, uint32_t channel, uint32_t mask) |
| Clears the DMA channel status flags. More... | |
DMA Channel Transactional Operation | |
| void | DMA_CreateHandle (dma_handle_t *handle, DMA_Type *base, uint32_t channel) |
| Creates the DMA handle. More... | |
| void | DMA_SetCallback (dma_handle_t *handle, dma_callback callback, void *userData) |
| Sets the DMA callback function. More... | |
| void | DMA_PrepareTransfer (dma_transfer_config_t *config, void *srcAddr, uint32_t srcWidth, void *destAddr, uint32_t destWidth, uint32_t transferBytes, dma_transfer_type_t type) |
| Prepares the DMA transfer configuration structure. More... | |
| status_t | DMA_SubmitTransfer (dma_handle_t *handle, const dma_transfer_config_t *config, uint32_t options) |
| Submits the DMA transfer request. More... | |
| static void | DMA_StartTransfer (dma_handle_t *handle) |
| DMA starts a transfer. More... | |
| static void | DMA_StopTransfer (dma_handle_t *handle) |
| DMA stops a transfer. More... | |
| void | DMA_AbortTransfer (dma_handle_t *handle) |
| DMA aborts a transfer. More... | |
| void | DMA_HandleIRQ (dma_handle_t *handle) |
| DMA IRQ handler for current transfer complete. More... | |
| struct dma_transfer_config_t |
Data Fields | |
| uint32_t | srcAddr |
| DMA transfer source address. More... | |
| uint32_t | destAddr |
| DMA destination address. More... | |
| bool | enableSrcIncrement |
| Source address increase after each transfer. More... | |
| dma_transfer_size_t | srcSize |
| Source transfer size unit. More... | |
| bool | enableDestIncrement |
| Destination address increase after each transfer. More... | |
| dma_transfer_size_t | destSize |
| Destination transfer unit. More... | |
| uint32_t | transferSize |
| The number of bytes to be transferred. More... | |
| uint32_t dma_transfer_config_t::srcAddr |
| uint32_t dma_transfer_config_t::destAddr |
| bool dma_transfer_config_t::enableSrcIncrement |
| dma_transfer_size_t dma_transfer_config_t::srcSize |
| bool dma_transfer_config_t::enableDestIncrement |
| dma_transfer_size_t dma_transfer_config_t::destSize |
| uint32_t dma_transfer_config_t::transferSize |
| struct dma_channel_link_config_t |
Data Fields | |
| dma_channel_link_type_t | linkType |
| Channel link type. More... | |
| uint32_t | channel1 |
| The index of channel 1. More... | |
| uint32_t | channel2 |
| The index of channel 2. More... | |
| dma_channel_link_type_t dma_channel_link_config_t::linkType |
| uint32_t dma_channel_link_config_t::channel1 |
| uint32_t dma_channel_link_config_t::channel2 |
| struct dma_handle_t |
Data Fields | |
| DMA_Type * | base |
| DMA peripheral address. More... | |
| uint8_t | channel |
| DMA channel used. More... | |
| dma_callback | callback |
| DMA callback function. More... | |
| void * | userData |
| Callback parameter. More... | |
| DMA_Type* dma_handle_t::base |
| uint8_t dma_handle_t::channel |
| dma_callback dma_handle_t::callback |
| void* dma_handle_t::userData |
| #define FSL_DMA_DRIVER_VERSION (MAKE_VERSION(2, 0, 1)) |
| typedef void(* dma_callback)(struct _dma_handle *handle, void *userData) |
| enum dma_transfer_size_t |
| enum dma_modulo_t |
| enum dma_transfer_type_t |
| void DMA_Init | ( | DMA_Type * | base | ) |
This function ungates the DMA clock.
| base | DMA peripheral base address. |
| void DMA_Deinit | ( | DMA_Type * | base | ) |
This function gates the DMA clock.
| base | DMA peripheral base address. |
| void DMA_ResetChannel | ( | DMA_Type * | base, |
| uint32_t | channel | ||
| ) |
Sets all register values to reset values and enables the cycle steal and auto stop channel request features.
| base | DMA peripheral base address. |
| channel | DMA channel number. |
| void DMA_SetTransferConfig | ( | DMA_Type * | base, |
| uint32_t | channel, | ||
| const dma_transfer_config_t * | config | ||
| ) |
This function configures the transfer attribute including the source address, destination address, transfer size, and so on. This example shows how to set up the the dma_transfer_config_t parameters and how to call the DMA_ConfigBasicTransfer function.
| base | DMA peripheral base address. |
| channel | DMA channel number. |
| config | Pointer to the DMA transfer configuration structure. |
| void DMA_SetChannelLinkConfig | ( | DMA_Type * | base, |
| uint32_t | channel, | ||
| const dma_channel_link_config_t * | config | ||
| ) |
This function allows DMA channels to have their transfers linked. The current DMA channel triggers a DMA request to the linked channels (LCH1 or LCH2) depending on the channel link type. Perform a link to channel LCH1 after each cycle-steal transfer followed by a link to LCH2 after the BCR decrements to 0 if the type is kDMA_ChannelLinkChannel1AndChannel2. Perform a link to LCH1 after each cycle-steal transfer if the type is kDMA_ChannelLinkChannel1. Perform a link to LCH1 after the BCR decrements to 0 if the type is kDMA_ChannelLinkChannel1AfterBCR0.
| base | DMA peripheral base address. |
| channel | DMA channel number. |
| config | Pointer to the channel link configuration structure. |
|
inlinestatic |
| base | DMA peripheral base address. |
| channel | DMA channel number. |
| srcAddr | DMA source address. |
|
inlinestatic |
| base | DMA peripheral base address. |
| channel | DMA channel number. |
| destAddr | DMA destination address. |
|
inlinestatic |
| base | DMA peripheral base address. |
| channel | DMA channel number. |
| size | The number of bytes to be transferred. |
| void DMA_SetModulo | ( | DMA_Type * | base, |
| uint32_t | channel, | ||
| dma_modulo_t | srcModulo, | ||
| dma_modulo_t | destModulo | ||
| ) |
This function defines a specific address range specified to be the value after (SAR + SSIZE)/(DAR + DSIZE) calculation is performed or the original register value. It provides the ability to implement a circular data queue easily.
| base | DMA peripheral base address. |
| channel | DMA channel number. |
| srcModulo | source address modulo. |
| destModulo | destination address modulo. |
|
inlinestatic |
If the cycle steal feature is enabled (true), the DMA controller forces a single read/write transfer per request, or it continuously makes read/write transfers until the BCR decrements to 0.
| base | DMA peripheral base address. |
| channel | DMA channel number. |
| enable | The command for enable (true) or disable (false). |
|
inlinestatic |
If the auto align feature is enabled (true), the appropriate address register increments regardless of DINC or SINC.
| base | DMA peripheral base address. |
| channel | DMA channel number. |
| enable | The command for enable (true) or disable (false). |
|
inlinestatic |
If the async request feature is enabled (true), the DMA supports asynchronous DREQs while the MCU is in stop mode.
| base | DMA peripheral base address. |
| channel | DMA channel number. |
| enable | The command for enable (true) or disable (false). |
|
inlinestatic |
| base | DMA peripheral base address. |
| channel | DMA channel number. |
|
inlinestatic |
| base | DMA peripheral base address. |
| channel | DMA channel number. |
|
inlinestatic |
| base | DMA peripheral base address. |
| channel | The DMA channel number. |
|
inlinestatic |
| base | DMA peripheral base address. |
| channel | DMA channel number. |
|
inlinestatic |
This function starts only one read/write iteration.
| base | DMA peripheral base address. |
| channel | The DMA channel number. |
|
inlinestatic |
| base | DMA peripheral base address. |
| channel | DMA channel number. |
|
inlinestatic |
| base | DMA peripheral base address. |
| channel | DMA channel number. |
|
inlinestatic |
| base | DMA peripheral base address. |
| channel | DMA channel number. |
| mask | The mask of the channel status to be cleared. Use the defined _dma_channel_status_flags type. |
| void DMA_CreateHandle | ( | dma_handle_t * | handle, |
| DMA_Type * | base, | ||
| uint32_t | channel | ||
| ) |
This function is called first if using the transactional API for the DMA. This function initializes the internal state of the DMA handle.
| handle | DMA handle pointer. The DMA handle stores callback function and parameters. |
| base | DMA peripheral base address. |
| channel | DMA channel number. |
| void DMA_SetCallback | ( | dma_handle_t * | handle, |
| dma_callback | callback, | ||
| void * | userData | ||
| ) |
This callback is called in the DMA IRQ handler. Use the callback to do something after the current transfer complete.
| handle | DMA handle pointer. |
| callback | DMA callback function pointer. |
| userData | Parameter for callback function. If it is not needed, just set to NULL. |
| void DMA_PrepareTransfer | ( | dma_transfer_config_t * | config, |
| void * | srcAddr, | ||
| uint32_t | srcWidth, | ||
| void * | destAddr, | ||
| uint32_t | destWidth, | ||
| uint32_t | transferBytes, | ||
| dma_transfer_type_t | type | ||
| ) |
This function prepares the transfer configuration structure according to the user input.
| config | Pointer to the user configuration structure of type dma_transfer_config_t. |
| srcAddr | DMA transfer source address. |
| srcWidth | DMA transfer source address width (byte). |
| destAddr | DMA transfer destination address. |
| destWidth | DMA transfer destination address width (byte). |
| transferBytes | DMA transfer bytes to be transferred. |
| type | DMA transfer type. |
| status_t DMA_SubmitTransfer | ( | dma_handle_t * | handle, |
| const dma_transfer_config_t * | config, | ||
| uint32_t | options | ||
| ) |
This function submits the DMA transfer request according to the transfer configuration structure.
| handle | DMA handle pointer. |
| config | Pointer to DMA transfer configuration structure. |
| options | Additional configurations for transfer. Use the defined dma_transfer_options_t type. |
| kStatus_DMA_Success | It indicates that the DMA submit transfer request succeeded. |
| kStatus_DMA_Busy | It indicates that the DMA is busy. Submit transfer request is not allowed. |
|
inlinestatic |
This function enables the channel request. Call this function after submitting a transfer request.
| handle | DMA handle pointer. |
| kStatus_DMA_Success | It indicates that the DMA start transfer succeed. |
| kStatus_DMA_Busy | It indicates that the DMA has started a transfer. |
|
inlinestatic |
This function disables the channel request to stop a DMA transfer. The transfer can be resumed by calling the DMA_StartTransfer.
| handle | DMA handle pointer. |
| void DMA_AbortTransfer | ( | dma_handle_t * | handle | ) |
This function disables the channel request and clears all status bits. Submit another transfer after calling this API.
| handle | DMA handle pointer. |
| void DMA_HandleIRQ | ( | dma_handle_t * | handle | ) |
This function clears the channel interrupt flag and calls the callback function if it is not NULL.
| handle | DMA handle pointer. |