![]() |
MCUXpresso SDK API Reference Manual
Rev. 0
NXP Semiconductors
|
The MCUXpresso SDK provides a peripheral driver for the Direct Memory Access (DMAC) of MCUXpresso SDK devices.
Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/dmac
Data Structures | |
struct | dmac_channel_transfer_config_t |
dmac channel transfer configuration More... | |
struct | dmac_config_t |
dmac configuration structure More... | |
struct | dmac_handle_t |
DMAC transfer handle structure. More... | |
Typedefs | |
typedef void(* | dmac_transfer_callback_t )(dmac_handle_t *handle, void *userData, uint32_t status) |
Define Callback function for DMAC. More... | |
DMAC Initialization and De-initialization interfaces | |
void | DMAC_GetDefaultConfig (dmac_config_t *config) |
Get default dmac configuration. More... | |
void | DMAC_Init (DMAC_Type *base, dmac_config_t *config) |
DMAC initialization. More... | |
void | DMAC_Deinit (DMAC_Type *base) |
DMAC De-initialization. More... | |
DMAC channel functional interfaces | |
void | DMAC_GetChannelDefaultTransferConfig (dmac_channel_transfer_config_t *transfer, void *srcAddr, void *destAddr, dmac_channel_transfer_width_t transferWidth, dmac_channel_burst_length_t burstLength, uint32_t transferTotalBytes, dmac_channel_transfer_type_t transferType) |
Get channel default transfer configuration. More... | |
void | DMAC_SetChannelTransferConfig (DMAC_Type *base, dmac_channel_t channel, dmac_channel_transfer_config_t *transfer) |
DMAC set channel transfer configurations. More... | |
static void | DMAC_StartChannel (DMAC_Type *base, dmac_channel_t channel) |
start the dmac channel More... | |
static void | DMAC_StopChannel (DMAC_Type *base, dmac_channel_t channel) |
stop the dmac channel More... | |
void | DMAC_SetAckDelayCycle (DMAC_Type *base, uint32_t m2pAckDelayCycle) |
DMAC ack delay cycle for single transfer in M2P transfer type.Only called when the transfer type is M2P. More... | |
void | DMAC_SetPeripheralNumber (DMAC_Type *base, dmac_channel_t channel, dmac_peripheral_number_t peripheralNumber) |
DMAC set peripheral number. More... | |
DMAC channel interrupt Interfaces | |
void | DMAC_EnableChannelInterrupts (DMAC_Type *base, dmac_channel_t channel, uint32_t interruptsMask) |
enables the dmac channel interrupts More... | |
void | DMAC_DisableChannelInterrupts (DMAC_Type *base, dmac_channel_t channel, uint32_t interruptsMask) |
disables the dmac channel interrupts More... | |
DMAC channel Status Interfaces | |
uint32_t | DMAC_GetChannelInterruptStatus (DMAC_Type *base, dmac_channel_t channel) |
Gets the DMAC channel status. More... | |
void | DMAC_ClearChannelInterruptStatus (DMAC_Type *base, dmac_channel_t channel, uint32_t status) |
Clears the DMAC channel status. More... | |
DMAC Transactional Interfaces | |
void | DMAC_TransferCreateHandle (DMAC_Type *base, dmac_handle_t *handle, dmac_channel_t channel) |
Creates the DMAC channel handle. More... | |
void | DMAC_TransferSetCallback (dmac_handle_t *handle, dmac_transfer_callback_t callback, void *userData) |
Sets the DMAC Callback function. More... | |
status_t | DMAC_TransferSubmit (dmac_handle_t *handle, dmac_channel_transfer_config_t *transfer) |
Submits the DMAC transfer configurations. More... | |
void | DMAC_TransferStart (dmac_handle_t *handle) |
DMAC starts transfer. More... | |
void | DMAC_TransferStop (dmac_handle_t *handle) |
DMAC stops transfer. More... | |
void | DMAC_TransferHandleIRQ (DMAC_Type *base) |
DMAC IRQ handler for the transfer completion. More... | |
struct dmac_channel_transfer_config_t |
The transfer configuration structure support full feature configuration of the transfer control descriptor.
Data Fields | |
void * | srcAddr |
source address | |
void * | destAddr |
destination address | |
dmac_channel_address_increment_type_t | srcAddrIncrementType |
Source address increment kDMAC_ChannelAddressFix: No change kDMAC_ChannelAddressIncrement: Increment | |
dmac_channel_address_increment_type_t | destAddrIncrementType |
Destination address increment kDMAC_ChannelAddressFix: No change kDMAC_ChannelAddressIncrement: Increment | |
dmac_channel_transfer_type_t | transferType |
Transfer type and flow control kDMAC_ChannelTransferMemoryToMemory: Memory to Memory kDMAC_ChannelTransferPeripheralToMemory: Memory to peripheral kDMAC_ChannelTransferMemoryToPeripheral: Peripheral to memory. | |
dmac_channel_burst_length_t | burstLength |
Burst transaction length kDMAC_ChannelBurstLength1DataWidth: 1 Data Width kDMAC_ChannelBurstLength4DataWidth: 4 Data Width kDMAC_ChannelBurstLength8DataWidth: 8 Data Width kDMAC_ChannelBurstLength16DataWidth: 16 Data Width | |
dmac_channel_transfer_width_t | transferWidth |
Transfer width kDMAC_ChannelTransferWidth8Bits: 8 bits kDMAC_ChannelTransferWidth16Bits: 16 bits kDMAC_ChannelTransferWidth32Bits: 32 bits. | |
uint32_t | transferTotalBytes |
Transfer totalbytes 0~8191bytes maximum transfer length (8k-1) bytes. | |
uint32_t | interruptMask |
Interrupt Mask. | |
struct dmac_config_t |
Data Fields | |
uint32_t | m2pAckDelayCycle |
m2pAckDelayCycle for single write transaction to peripheral. More... | |
dmac_channel_transfer_config_t * | channelTransferConfig [FSL_FEATURE_MW_DMAC_MODULE_CHANNEL] |
channel transfer configuration pointer | |
dmac_peripheral_number_t | peripheralNumber [FSL_FEATURE_MW_DMAC_MODULE_CHANNEL] |
Peripheral Number Indicates the valid peripheral request number.The default value kDMAC_PeriphNum_None. More... | |
uint32_t dmac_config_t::m2pAckDelayCycle |
The value should be less than 1023, default value 12.
dmac_peripheral_number_t dmac_config_t::peripheralNumber[FSL_FEATURE_MW_DMAC_MODULE_CHANNEL] |
struct _dmac_handle |
handler for DMAC
Data Fields | |
volatile uint32_t | state |
channel transfer state | |
dmac_transfer_callback_t | callback |
callback function | |
void * | userData |
Callback function parameter. More... | |
DMAC_Type * | base |
DMAC peripheral base address. More... | |
dmac_channel_t | channel |
DMAC channel number. More... | |
void* dmac_handle_t::userData |
DMAC_Type* dmac_handle_t::base |
dmac_channel_t dmac_handle_t::channel |
typedef void(* dmac_transfer_callback_t)(dmac_handle_t *handle, void *userData, uint32_t status) |
handle | DMAC handle pointer, users shall not touch the values inside. |
userData | The callback user parameter pointer. Users can use this parameter to involve things users need to change in DMAC Callback function. |
status | The mask of channel status . Users need to use the _dmac_channel_interrupt_status type. If the current loaded transfer done. In normal mode it means if all transfer done. In scatter gather mode, this parameter shows is the current transfer block in DMAC register is done. |
enum dmac_channel_t |
void DMAC_GetDefaultConfig | ( | dmac_config_t * | config | ) |
config | pointer to user's DMAC configure structure, see dmac_config_t for detail. |
void DMAC_Init | ( | DMAC_Type * | base, |
dmac_config_t * | config | ||
) |
base | DMAC peripheral base address. |
config | pointer to user's DMAC config structure, see dmac_config_t for detail. |
void DMAC_Deinit | ( | DMAC_Type * | base | ) |
base | DMAC peripheral base address. |
void DMAC_GetChannelDefaultTransferConfig | ( | dmac_channel_transfer_config_t * | transfer, |
void * | srcAddr, | ||
void * | destAddr, | ||
dmac_channel_transfer_width_t | transferWidth, | ||
dmac_channel_burst_length_t | burstLength, | ||
uint32_t | transferTotalBytes, | ||
dmac_channel_transfer_type_t | transferType | ||
) |
transfer | pointer to user's DMAC channel configure structure, see dmac_channel_transfer_config_t for detail. |
srcAddr | source address, must be byte address. |
destAddr | destination address, must be byte address. |
transferWidth | the number of bits are transferred in each read/write. |
burstLength | burst transaction length. |
transferTotalBytes | transfer totalbytes 0~8191bytes maximum transfer length (8k-1) bytes. |
transferType | DMAC channel transfer type. |
void DMAC_SetChannelTransferConfig | ( | DMAC_Type * | base, |
dmac_channel_t | channel, | ||
dmac_channel_transfer_config_t * | transfer | ||
) |
base | DMAC peripheral base address. |
channel | DMAC channel number. |
transfer | pointer to user's DMAC channel configure structure,see dmac_channel_transfer_config_t for detail. |
|
inlinestatic |
base | DMAC peripheral base address. |
channel | DMAC channel number. |
|
inlinestatic |
base | DMAC peripheral base address. |
channel | DMAC channel number. |
void DMAC_SetAckDelayCycle | ( | DMAC_Type * | base, |
uint32_t | m2pAckDelayCycle | ||
) |
base | DMAC peripheral base address. |
m2pAckDelayCycle | for single write transaction to peripheral. The value should be less than 1023, default value 12. |
void DMAC_SetPeripheralNumber | ( | DMAC_Type * | base, |
dmac_channel_t | channel, | ||
dmac_peripheral_number_t | peripheralNumber | ||
) |
base | DMAC peripheral base address. |
channel | DMAC channel number. |
peripheralNumber | Indicates the valid peripheral request number, default value kDMAC_PeriphNum_None, see dmac_peripheral_number_t for detail. |
void DMAC_EnableChannelInterrupts | ( | DMAC_Type * | base, |
dmac_channel_t | channel, | ||
uint32_t | interruptsMask | ||
) |
base | DMAC peripheral base address. |
channel | DMAC channel number. |
interruptsMask | the mask is a logical OR of enumerator members see _dmac_channel_interrupt_flag. |
void DMAC_DisableChannelInterrupts | ( | DMAC_Type * | base, |
dmac_channel_t | channel, | ||
uint32_t | interruptsMask | ||
) |
base | DMAC peripheral base address. |
channel | DMAC channel number. |
interruptsMask | the mask is a logical OR of enumerator members see _dmac_channel_interrupt_flag. |
uint32_t DMAC_GetChannelInterruptStatus | ( | DMAC_Type * | base, |
dmac_channel_t | channel | ||
) |
base | DMAC peripheral base address. |
channel | DMAC channel number. |
The | mask of channel status. Users need to use the _dmac_channel_interrupt_flag type to decode the return variables. |
void DMAC_ClearChannelInterruptStatus | ( | DMAC_Type * | base, |
dmac_channel_t | channel, | ||
uint32_t | status | ||
) |
base | DMAC peripheral base address. |
channel | DMAC channel number. |
status | The mask of channel status to be cleared. Users need to use the defined _dmac_channel_interrupt_flag type. |
void DMAC_TransferCreateHandle | ( | DMAC_Type * | base, |
dmac_handle_t * | handle, | ||
dmac_channel_t | channel | ||
) |
This function is called if using the transactional API for DMAC. This function initializes the internal state of the DMAC handle.
base | DMAC peripheral base address. |
handle | DMAC handle pointer. The DMAC handle stores Callback function and parameters. |
channel | DMAC channel number. |
void DMAC_TransferSetCallback | ( | dmac_handle_t * | handle, |
dmac_transfer_callback_t | callback, | ||
void * | userData | ||
) |
This callback is called in the DMAC IRQ handler. Use the callback to do something after the current transfer complete.
handle | DMAC handle pointer. |
callback | DMAC callback function pointer. |
userData | Parameter for callback function. If it is not needed, just set to NULL. |
status_t DMAC_TransferSubmit | ( | dmac_handle_t * | handle, |
dmac_channel_transfer_config_t * | transfer | ||
) |
handle | DMAC handle pointer |
transfer | pointer to user's DMAC channel configure structure,see dmac_channel_transfer_config_t for detail. |
kStatus_Success | It means submit transfer request succeed |
kStatus_Fail | It means submit transfer request failed |
void DMAC_TransferStart | ( | dmac_handle_t * | handle | ) |
This function enables the channel request. Users can call this function after submitting the transfer request or before submitting the transfer request.
handle | DMAC handle pointer. |
void DMAC_TransferStop | ( | dmac_handle_t * | handle | ) |
This function disables the channel request to pause the transfer. Users can call DMAC_StartTransfer() again to resume the transfer.
handle | DMAC handle pointer. |
void DMAC_TransferHandleIRQ | ( | DMAC_Type * | base | ) |
base | DMAC peripheral base address. |