MCUXpresso SDK API Reference Manual
Rev 2.16.000
NXP Semiconductors
|
The MCUXpresso SDK provides a peripheral driver for the enhanced Direct Memory Access (eDMA) of MCUXpresso SDK devices.
Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/edma
Modules | |
eDMA core Driver | |
eDMA soc Driver | |
Data Structures | |
struct | edma_config_t |
eDMA global configuration structure. More... | |
struct | edma_transfer_config_t |
eDMA transfer configuration More... | |
struct | edma_channel_Preemption_config_t |
eDMA channel priority configuration More... | |
struct | edma_minor_offset_config_t |
eDMA minor offset configuration More... | |
struct | edma_tcd_t |
eDMA TCD. More... | |
struct | edma_handle_t |
eDMA transfer handle structure More... | |
struct | edma_channel_config_t |
eDMA4 channel configuration More... | |
Macros | |
#define | DMA_DCHPRI_INDEX(channel) (((channel) & ~0x03U) | (3U - ((channel)&0x03U))) |
Compute the offset unit from DCHPRI3. | |
#define | FSL_EDMA_DRIVER_EDMA4 (1) |
eDMA driver name | |
#define | EDMA_ALLOCATE_TCD(name, number) AT_NONCACHEABLE_SECTION_ALIGN(edma_tcd_t name[number], EDMA_TCD_ALIGN_SIZE) |
Macro used for allocate edma TCD. | |
#define | DMA_DCHPRI_INDEX(channel) (((channel) & ~0x03U) | (3U - ((channel)&0x03U))) |
Compute the offset unit from DCHPRI3. | |
Typedefs | |
typedef void(* | edma_callback )(struct _edma_handle *handle, void *userData, bool transferDone, uint32_t tcds) |
Define callback function for eDMA. More... | |
typedef edma_core_tcd_t | edma_tcd_t |
eDMA TCD. More... | |
typedef void(* | edma_callback )(struct _edma_handle *handle, void *userData, bool transferDone, uint32_t tcds) |
Define callback function for eDMA. More... | |
Driver version | |
#define | FSL_EDMA_DRIVER_VERSION (MAKE_VERSION(2, 4, 4)) |
eDMA driver version More... | |
eDMA initialization and de-initialization | |
void | EDMA_Init (DMA_Type *base, const edma_config_t *config) |
Initializes the eDMA peripheral. More... | |
void | EDMA_Deinit (DMA_Type *base) |
Deinitializes the eDMA peripheral. More... | |
void | EDMA_InstallTCD (DMA_Type *base, uint32_t channel, edma_tcd_t *tcd) |
Push content of TCD structure into hardware TCD register. More... | |
void | EDMA_GetDefaultConfig (edma_config_t *config) |
Gets the eDMA default configuration structure. More... | |
static void | EDMA_EnableContinuousChannelLinkMode (DMA_Type *base, bool enable) |
Enable/Disable continuous channel link mode. More... | |
static void | EDMA_EnableMinorLoopMapping (DMA_Type *base, bool enable) |
Enable/Disable minor loop mapping. More... | |
eDMA Channel Operation | |
void | EDMA_ResetChannel (DMA_Type *base, uint32_t channel) |
Sets all TCD registers to default values. More... | |
void | EDMA_SetTransferConfig (DMA_Type *base, uint32_t channel, const edma_transfer_config_t *config, edma_tcd_t *nextTcd) |
Configures the eDMA transfer attribute. More... | |
void | EDMA_SetMinorOffsetConfig (DMA_Type *base, uint32_t channel, const edma_minor_offset_config_t *config) |
Configures the eDMA minor offset feature. More... | |
void | EDMA_SetChannelPreemptionConfig (DMA_Type *base, uint32_t channel, const edma_channel_Preemption_config_t *config) |
Configures the eDMA channel preemption feature. More... | |
void | EDMA_SetChannelLink (DMA_Type *base, uint32_t channel, edma_channel_link_type_t linkType, uint32_t linkedChannel) |
Sets the channel link for the eDMA transfer. More... | |
void | EDMA_SetBandWidth (DMA_Type *base, uint32_t channel, edma_bandwidth_t bandWidth) |
Sets the bandwidth for the eDMA transfer. More... | |
void | EDMA_SetModulo (DMA_Type *base, uint32_t channel, edma_modulo_t srcModulo, edma_modulo_t destModulo) |
Sets the source modulo and the destination modulo for the eDMA transfer. More... | |
static void | EDMA_EnableAutoStopRequest (DMA_Type *base, uint32_t channel, bool enable) |
Enables an auto stop request for the eDMA transfer. More... | |
void | EDMA_EnableChannelInterrupts (DMA_Type *base, uint32_t channel, uint32_t mask) |
Enables the interrupt source for the eDMA transfer. More... | |
void | EDMA_DisableChannelInterrupts (DMA_Type *base, uint32_t channel, uint32_t mask) |
Disables the interrupt source for the eDMA transfer. More... | |
void | EDMA_SetMajorOffsetConfig (DMA_Type *base, uint32_t channel, int32_t sourceOffset, int32_t destOffset) |
Configures the eDMA channel TCD major offset feature. More... | |
eDMA TCD Operation | |
void | EDMA_TcdReset (edma_tcd_t *tcd) |
Sets all fields to default values for the TCD structure. More... | |
void | EDMA_TcdSetTransferConfig (edma_tcd_t *tcd, const edma_transfer_config_t *config, edma_tcd_t *nextTcd) |
Configures the eDMA TCD transfer attribute. More... | |
void | EDMA_TcdSetMinorOffsetConfig (edma_tcd_t *tcd, const edma_minor_offset_config_t *config) |
Configures the eDMA TCD minor offset feature. More... | |
void | EDMA_TcdSetChannelLink (edma_tcd_t *tcd, edma_channel_link_type_t linkType, uint32_t linkedChannel) |
Sets the channel link for the eDMA TCD. More... | |
static void | EDMA_TcdSetBandWidth (edma_tcd_t *tcd, edma_bandwidth_t bandWidth) |
Sets the bandwidth for the eDMA TCD. More... | |
void | EDMA_TcdSetModulo (edma_tcd_t *tcd, edma_modulo_t srcModulo, edma_modulo_t destModulo) |
Sets the source modulo and the destination modulo for the eDMA TCD. More... | |
static void | EDMA_TcdEnableAutoStopRequest (edma_tcd_t *tcd, bool enable) |
Sets the auto stop request for the eDMA TCD. More... | |
void | EDMA_TcdEnableInterrupts (edma_tcd_t *tcd, uint32_t mask) |
Enables the interrupt source for the eDMA TCD. More... | |
void | EDMA_TcdDisableInterrupts (edma_tcd_t *tcd, uint32_t mask) |
Disables the interrupt source for the eDMA TCD. More... | |
void | EDMA_TcdSetMajorOffsetConfig (edma_tcd_t *tcd, int32_t sourceOffset, int32_t destOffset) |
Configures the eDMA TCD major offset feature. More... | |
eDMA Channel Transfer Operation | |
static void | EDMA_EnableChannelRequest (DMA_Type *base, uint32_t channel) |
Enables the eDMA hardware channel request. More... | |
static void | EDMA_DisableChannelRequest (DMA_Type *base, uint32_t channel) |
Disables the eDMA hardware channel request. More... | |
static void | EDMA_TriggerChannelStart (DMA_Type *base, uint32_t channel) |
Starts the eDMA transfer by using the software trigger. More... | |
eDMA Channel Status Operation | |
uint32_t | EDMA_GetRemainingMajorLoopCount (DMA_Type *base, uint32_t channel) |
Gets the remaining major loop count from the eDMA current channel TCD. More... | |
static uint32_t | EDMA_GetErrorStatusFlags (DMA_Type *base) |
Gets the eDMA channel error status flags. More... | |
uint32_t | EDMA_GetChannelStatusFlags (DMA_Type *base, uint32_t channel) |
Gets the eDMA channel status flags. More... | |
void | EDMA_ClearChannelStatusFlags (DMA_Type *base, uint32_t channel, uint32_t mask) |
Clears the eDMA channel status flags. More... | |
eDMA Transactional Operation | |
void | EDMA_CreateHandle (edma_handle_t *handle, DMA_Type *base, uint32_t channel) |
Creates the eDMA handle. More... | |
void | EDMA_InstallTCDMemory (edma_handle_t *handle, edma_tcd_t *tcdPool, uint32_t tcdSize) |
Installs the TCDs memory pool into the eDMA handle. More... | |
void | EDMA_SetCallback (edma_handle_t *handle, edma_callback callback, void *userData) |
Installs a callback function for the eDMA transfer. More... | |
void | EDMA_PrepareTransferConfig (edma_transfer_config_t *config, void *srcAddr, uint32_t srcWidth, int16_t srcOffset, void *destAddr, uint32_t destWidth, int16_t destOffset, uint32_t bytesEachRequest, uint32_t transferBytes) |
Prepares the eDMA transfer structure configurations. More... | |
void | EDMA_PrepareTransfer (edma_transfer_config_t *config, void *srcAddr, uint32_t srcWidth, void *destAddr, uint32_t destWidth, uint32_t bytesEachRequest, uint32_t transferBytes, edma_transfer_type_t transferType) |
Prepares the eDMA transfer structure. More... | |
status_t | EDMA_SubmitTransfer (edma_handle_t *handle, const edma_transfer_config_t *config) |
Submits the eDMA transfer request. More... | |
void | EDMA_StartTransfer (edma_handle_t *handle) |
eDMA starts transfer. More... | |
void | EDMA_StopTransfer (edma_handle_t *handle) |
eDMA stops transfer. More... | |
void | EDMA_AbortTransfer (edma_handle_t *handle) |
eDMA aborts transfer. More... | |
static uint32_t | EDMA_GetUnusedTCDNumber (edma_handle_t *handle) |
Get unused TCD slot number. More... | |
static uint32_t | EDMA_GetNextTCDAddress (edma_handle_t *handle) |
Get the next tcd address. More... | |
void | EDMA_HandleIRQ (edma_handle_t *handle) |
eDMA IRQ handler for the current major loop transfer completion. More... | |
Driver version | |
#define | FSL_EDMA_DRIVER_VERSION (MAKE_VERSION(2, 10, 1)) |
eDMA driver version More... | |
eDMA initialization and de-initialization | |
void | EDMA_Init (EDMA_Type *base, const edma_config_t *config) |
Initializes the eDMA peripheral. More... | |
void | EDMA_Deinit (EDMA_Type *base) |
Deinitializes the eDMA peripheral. More... | |
void | EDMA_InstallTCD (EDMA_Type *base, uint32_t channel, edma_tcd_t *tcd) |
Push content of TCD structure into hardware TCD register. More... | |
eDMA Channel Operation | |
void | EDMA_InitChannel (EDMA_Type *base, uint32_t channel, edma_channel_config_t *channelConfig) |
EDMA Channel initialization. More... | |
static void | EDMA_SetChannelMemoryAttribute (EDMA_Type *base, uint32_t channel, edma_channel_memory_attribute_t writeAttribute, edma_channel_memory_attribute_t readAttribute) |
Set channel memory attribute. More... | |
static void | EDMA_SetChannelSignExtension (EDMA_Type *base, uint32_t channel, uint8_t position) |
Set channel sign extension. More... | |
static void | EDMA_SetChannelSwapSize (EDMA_Type *base, uint32_t channel, edma_channel_swap_size_t swapSize) |
Set channel swap size. More... | |
static void | EDMA_SetChannelAccessType (EDMA_Type *base, uint32_t channel, edma_channel_access_type_t channelAccessType) |
Set channel access type. More... | |
static void | EDMA_SetChannelMux (EDMA_Type *base, uint32_t channel, int32_t channelRequestSource) |
Set channel request source. More... | |
static uint32_t | EDMA_GetChannelSystemBusInformation (EDMA_Type *base, uint32_t channel) |
Gets the channel identification and attribute information on the system bus interface. More... | |
static void | EDMA_EnableChannelMasterIDReplication (EDMA_Type *base, uint32_t channel, bool enable) |
Set channel master ID replication. More... | |
static void | EDMA_SetChannelSecurityLevel (EDMA_Type *base, uint32_t channel, edma_channel_security_level_t level) |
Set channel security level. More... | |
static void | EDMA_SetChannelProtectionLevel (EDMA_Type *base, uint32_t channel, edma_channel_protection_level_t level) |
Set channel security level. More... | |
void | EDMA_ResetChannel (EDMA_Type *base, uint32_t channel) |
Sets all TCD registers to default values. More... | |
void | EDMA_SetTransferConfig (EDMA_Type *base, uint32_t channel, const edma_transfer_config_t *config, edma_tcd_t *nextTcd) |
Configures the eDMA transfer attribute. More... | |
void | EDMA_SetMinorOffsetConfig (EDMA_Type *base, uint32_t channel, const edma_minor_offset_config_t *config) |
Configures the eDMA minor offset feature. More... | |
void | EDMA_SetChannelPreemptionConfig (EDMA_Type *base, uint32_t channel, const edma_channel_Preemption_config_t *config) |
Configures the eDMA channel preemption feature. More... | |
void | EDMA_SetChannelLink (EDMA_Type *base, uint32_t channel, edma_channel_link_type_t type, uint32_t linkedChannel) |
Sets the channel link for the eDMA transfer. More... | |
void | EDMA_SetBandWidth (EDMA_Type *base, uint32_t channel, edma_bandwidth_t bandWidth) |
Sets the bandwidth for the eDMA transfer. More... | |
void | EDMA_SetModulo (EDMA_Type *base, uint32_t channel, edma_modulo_t srcModulo, edma_modulo_t destModulo) |
Sets the source modulo and the destination modulo for the eDMA transfer. More... | |
static void | EDMA_EnableAutoStopRequest (EDMA_Type *base, uint32_t channel, bool enable) |
Enables an auto stop request for the eDMA transfer. More... | |
void | EDMA_EnableChannelInterrupts (EDMA_Type *base, uint32_t channel, uint32_t mask) |
Enables the interrupt source for the eDMA transfer. More... | |
void | EDMA_DisableChannelInterrupts (EDMA_Type *base, uint32_t channel, uint32_t mask) |
Disables the interrupt source for the eDMA transfer. More... | |
void | EDMA_SetMajorOffsetConfig (EDMA_Type *base, uint32_t channel, int32_t sourceOffset, int32_t destOffset) |
Configures the eDMA channel TCD major offset feature. More... | |
eDMA TCD Operation | |
void | EDMA_ConfigChannelSoftwareTCD (edma_tcd_t *tcd, const edma_transfer_config_t *transfer) |
Sets TCD fields according to the user's channel transfer configuration structure, edma_transfer_config_t. More... | |
void | EDMA_ConfigChannelSoftwareTCDExt (EDMA_Type *base, edma_tcd_t *tcd, const edma_transfer_config_t *transfer) |
Sets TCD fields according to the user's channel transfer configuration structure, edma_transfer_config_t. More... | |
void | EDMA_TcdResetExt (EDMA_Type *base, edma_tcd_t *tcd) |
Sets all fields to default values for the TCD structure. More... | |
void | EDMA_TcdSetTransferConfigExt (EDMA_Type *base, edma_tcd_t *tcd, const edma_transfer_config_t *config, edma_tcd_t *nextTcd) |
Configures the eDMA TCD transfer attribute. More... | |
void | EDMA_TcdSetMinorOffsetConfigExt (EDMA_Type *base, edma_tcd_t *tcd, const edma_minor_offset_config_t *config) |
Configures the eDMA TCD minor offset feature. More... | |
void | EDMA_TcdSetChannelLinkExt (EDMA_Type *base, edma_tcd_t *tcd, edma_channel_link_type_t type, uint32_t linkedChannel) |
Sets the channel link for the eDMA TCD. More... | |
static void | EDMA_TcdSetBandWidthExt (EDMA_Type *base, edma_tcd_t *tcd, edma_bandwidth_t bandWidth) |
Sets the bandwidth for the eDMA TCD. More... | |
void | EDMA_TcdSetModuloExt (EDMA_Type *base, edma_tcd_t *tcd, edma_modulo_t srcModulo, edma_modulo_t destModulo) |
Sets the source modulo and the destination modulo for the eDMA TCD. More... | |
static void | EDMA_TcdEnableAutoStopRequestExt (EDMA_Type *base, edma_tcd_t *tcd, bool enable) |
Sets the auto stop request for the eDMA TCD. More... | |
void | EDMA_TcdEnableInterruptsExt (EDMA_Type *base, edma_tcd_t *tcd, uint32_t mask) |
Enables the interrupt source for the eDMA TCD. More... | |
void | EDMA_TcdDisableInterruptsExt (EDMA_Type *base, edma_tcd_t *tcd, uint32_t mask) |
Disables the interrupt source for the eDMA TCD. More... | |
void | EDMA_TcdSetMajorOffsetConfigExt (EDMA_Type *base, edma_tcd_t *tcd, int32_t sourceOffset, int32_t destOffset) |
Configures the eDMA TCD major offset feature. More... | |
eDMA Channel Transfer Operation | |
static void | EDMA_EnableChannelRequest (EDMA_Type *base, uint32_t channel) |
Enables the eDMA hardware channel request. More... | |
static void | EDMA_DisableChannelRequest (EDMA_Type *base, uint32_t channel) |
Disables the eDMA hardware channel request. More... | |
static void | EDMA_TriggerChannelStart (EDMA_Type *base, uint32_t channel) |
Starts the eDMA transfer by using the software trigger. More... | |
eDMA Channel Status Operation | |
uint32_t | EDMA_GetRemainingMajorLoopCount (EDMA_Type *base, uint32_t channel) |
Gets the remaining major loop count from the eDMA current channel TCD. More... | |
static uint32_t | EDMA_GetErrorStatusFlags (EDMA_Type *base) |
Gets the eDMA channel error status flags. More... | |
uint32_t | EDMA_GetChannelStatusFlags (EDMA_Type *base, uint32_t channel) |
Gets the eDMA channel status flags. More... | |
void | EDMA_ClearChannelStatusFlags (EDMA_Type *base, uint32_t channel, uint32_t mask) |
Clears the eDMA channel status flags. More... | |
eDMA Transactional Operation | |
void | EDMA_CreateHandle (edma_handle_t *handle, EDMA_Type *base, uint32_t channel) |
Creates the eDMA handle. More... | |
void | EDMA_PrepareTransferTCD (edma_handle_t *handle, edma_tcd_t *tcd, void *srcAddr, uint32_t srcWidth, int16_t srcOffset, void *destAddr, uint32_t destWidth, int16_t destOffset, uint32_t bytesEachRequest, uint32_t transferBytes, edma_tcd_t *nextTcd) |
Prepares the eDMA transfer content descriptor. More... | |
status_t | EDMA_SubmitTransferTCD (edma_handle_t *handle, edma_tcd_t *tcd) |
Submits the eDMA transfer content descriptor. More... | |
status_t | EDMA_SubmitLoopTransfer (edma_handle_t *handle, edma_transfer_config_t *transfer, uint32_t transferLoopCount) |
Submits the eDMA scatter gather transfer configurations. More... | |
struct edma_config_t |
Data Fields | |
bool | enableContinuousLinkMode |
Enable (true) continuous link mode. More... | |
bool | enableHaltOnError |
Enable (true) transfer halt on error. More... | |
bool | enableRoundRobinArbitration |
Enable (true) round robin channel arbitration method or fixed priority arbitration is used for channel selection. More... | |
bool | enableDebugMode |
Enable(true) eDMA debug mode. More... | |
bool | enableMasterIdReplication |
Enable (true) master ID replication. More... | |
bool | enableGlobalChannelLink |
Enable(true) channel linking is available and controlled by each channel's link settings. More... | |
edma_channel_config_t * | channelConfig [FSL_FEATURE_EDMA_MODULE_CHANNEL] |
channel preemption configuration | |
bool edma_config_t::enableContinuousLinkMode |
Upon minor loop completion, the channel activates again if that channel has a minor loop channel link enabled and the link channel is itself.
bool edma_config_t::enableHaltOnError |
Any error causes the HALT bit to set. Subsequently, all service requests are ignored until the HALT bit is cleared.
bool edma_config_t::enableRoundRobinArbitration |
Enable(true) channel linking is available and controlled by each channel's
link settings.
bool edma_config_t::enableDebugMode |
Enable(true) eDMA4 debug mode.
When in debug mode, the eDMA stalls the start of a new channel. Executing channels are allowed to complete.
When in debug mode, the eDMA4 stalls the start of a new channel. Executing channels are allowed to complete.
bool edma_config_t::enableMasterIdReplication |
If Master ID replication is disabled, the privileged protection level (supervisor mode) for eDMA4 transfers is used.
bool edma_config_t::enableGlobalChannelLink |
struct edma_transfer_config_t |
edma4 channel transfer configuration
This structure configures the source/destination transfer attribute.
The transfer configuration structure support full feature configuration of the transfer control descriptor.
1.To perform a simple transfer, below members should be initialized at least .srcAddr - source address .dstAddr - destination address .srcWidthOfEachTransfer - data width of source address .dstWidthOfEachTransfer - data width of destination address, normally it should be as same as srcWidthOfEachTransfer .bytesEachRequest - bytes to be transferred in each DMA request .totalBytes - total bytes to be transferred .srcOffsetOfEachTransfer - offset value in bytes unit to be applied to source address as each source read is completed .dstOffsetOfEachTransfer - offset value in bytes unit to be applied to destination address as each destination write is completed enablchannelRequest - channel request can be enabled together with transfer configure submission
2.The transfer configuration structure also support advance feature: Programmable source/destination address range(MODULO) Programmable minor loop offset Programmable major loop offset Programmable channel chain feature Programmable channel transfer control descriptor link feature
Data Fields | |
uint32_t | srcAddr |
Source data address. More... | |
uint32_t | destAddr |
Destination data address. More... | |
edma_transfer_size_t | srcTransferSize |
Source data transfer size. More... | |
edma_transfer_size_t | destTransferSize |
Destination data transfer size. More... | |
int16_t | srcOffset |
Sign-extended offset applied to the current source address to form the next-state value as each source read is completed. More... | |
int16_t | destOffset |
Sign-extended offset applied to the current destination address to form the next-state value as each destination write is completed. More... | |
uint32_t | minorLoopBytes |
Bytes to transfer in a minor loop. More... | |
uint32_t | majorLoopCounts |
Major loop iteration count. More... | |
uint16_t | enabledInterruptMask |
channel interrupt to enable, can be OR'ed value of _edma_interrupt_enable | |
edma_modulo_t | srcAddrModulo |
source circular data queue range | |
int32_t | srcMajorLoopOffset |
source major loop offset | |
edma_modulo_t | dstAddrModulo |
destination circular data queue range | |
int32_t | dstMajorLoopOffset |
destination major loop offset | |
bool | enableSrcMinorLoopOffset |
enable source minor loop offset | |
bool | enableDstMinorLoopOffset |
enable dest minor loop offset | |
int32_t | minorLoopOffset |
burst offset, the offset will be applied after minor loop update | |
bool | enableChannelMajorLoopLink |
channel link when major loop complete | |
uint32_t | majorLoopLinkChannel |
major loop link channel number | |
bool | enableChannelMinorLoopLink |
channel link when minor loop complete | |
uint32_t | minorLoopLinkChannel |
minor loop link channel number | |
edma_tcd_t * | linkTCD |
pointer to the link transfer control descriptor | |
uint32_t edma_transfer_config_t::srcAddr |
uint32_t edma_transfer_config_t::destAddr |
edma_transfer_size_t edma_transfer_config_t::srcTransferSize |
edma_transfer_size_t edma_transfer_config_t::destTransferSize |
int16_t edma_transfer_config_t::srcOffset |
Sign-extended offset value in byte unit applied to the current source address to form the next-state value as each source read is completed.
int16_t edma_transfer_config_t::destOffset |
Sign-extended offset value in byte unit applied to the current destination
address to form the next-state value as each destination write is completed.
uint32_t edma_transfer_config_t::minorLoopBytes |
bytes in each minor loop or each request range: 1 - (2^30 -1) when minor loop mapping is enabled range: 1 - (2^10 - 1) when minor loop mapping is enabled and source or dest minor loop offset is enabled range: 1 - (2^32 - 1) when minor loop mapping is disabled
uint32_t edma_transfer_config_t::majorLoopCounts |
minor loop counts in each major loop, should be 1 at least for each transfer range: (0 - (2^15 - 1)) when minor loop channel link is disabled range: (0 - (2^9 - 1)) when minor loop channel link is enabled total bytes in a transfer = minorLoopCountsEachMajorLoop * bytesEachMinorLoop
struct edma_channel_Preemption_config_t |
Data Fields | |
bool | enableChannelPreemption |
If true: a channel can be suspended by other channel with higher priority. | |
bool | enablePreemptAbility |
If true: a channel can suspend other channel with low priority. | |
uint8_t | channelPriority |
Channel priority. | |
struct edma_minor_offset_config_t |
Data Fields | |
bool | enableSrcMinorOffset |
Enable(true) or Disable(false) source minor loop offset. More... | |
bool | enableDestMinorOffset |
Enable(true) or Disable(false) destination minor loop offset. More... | |
uint32_t | minorOffset |
Offset for a minor loop mapping. More... | |
bool edma_minor_offset_config_t::enableSrcMinorOffset |
bool edma_minor_offset_config_t::enableDestMinorOffset |
uint32_t edma_minor_offset_config_t::minorOffset |
struct edma_tcd_t |
This structure is same as TCD register which is described in reference manual, and is used to configure the scatter/gather feature as a next hardware TCD.
Data Fields | |
__IO uint32_t | SADDR |
SADDR register, used to save source address. | |
__IO uint16_t | SOFF |
SOFF register, save offset bytes every transfer. | |
__IO uint16_t | ATTR |
ATTR register, source/destination transfer size and modulo. | |
__IO uint32_t | NBYTES |
Nbytes register, minor loop length in bytes. | |
__IO uint32_t | SLAST |
SLAST register. | |
__IO uint32_t | DADDR |
DADDR register, used for destination address. | |
__IO uint16_t | DOFF |
DOFF register, used for destination offset. | |
__IO uint16_t | CITER |
CITER register, current minor loop numbers, for unfinished minor loop. More... | |
__IO uint32_t | DLAST_SGA |
DLASTSGA register, next tcd address used in scatter-gather mode. | |
__IO uint16_t | CSR |
CSR register, for TCD control status. | |
__IO uint16_t | BITER |
BITER register, begin minor loop count. More... | |
__IO uint16_t edma_tcd_t::CITER |
__IO uint16_t edma_tcd_t::BITER |
struct edma_handle_t |
Data Fields | |
edma_callback | callback |
Callback function for major count exhausted. More... | |
void * | userData |
Callback function parameter. More... | |
DMA_Type * | base |
eDMA peripheral base address. More... | |
edma_tcd_t * | tcdPool |
Pointer to memory stored TCDs. More... | |
uint8_t | channel |
eDMA channel number. More... | |
volatile int8_t | header |
The first TCD index. More... | |
volatile int8_t | tail |
The last TCD index. More... | |
volatile int8_t | tcdUsed |
The number of used TCD slots. More... | |
volatile int8_t | tcdSize |
The total number of TCD slots in the queue. More... | |
uint8_t | flags |
The status of the current channel. More... | |
EDMA_ChannelType * | channelBase |
eDMA peripheral channel base address. More... | |
EDMA_Type * | base |
eDMA peripheral base address | |
EDMA_TCDType * | tcdBase |
eDMA peripheral tcd base address. More... | |
uint32_t | channel |
eDMA channel number. More... | |
edma_callback edma_handle_t::callback |
void * edma_handle_t::userData |
DMA_Type* edma_handle_t::base |
edma_tcd_t * edma_handle_t::tcdPool |
uint8_t edma_handle_t::channel |
volatile int8_t edma_handle_t::header |
Should point to the next TCD to be loaded into the eDMA engine.
volatile int8_t edma_handle_t::tail |
Should point to the next TCD to be stored into the memory pool.
volatile int8_t edma_handle_t::tcdUsed |
Should reflect the number of TCDs can be used/loaded in the memory.
volatile int8_t edma_handle_t::tcdSize |
uint8_t edma_handle_t::flags |
EDMA_ChannelType* edma_handle_t::channelBase |
EDMA_TCDType* edma_handle_t::tcdBase |
uint32_t edma_handle_t::channel |
struct edma_channel_config_t |
Data Fields | |
edma_channel_Preemption_config_t | channelPreemptionConfig |
channel preemption configuration | |
edma_channel_memory_attribute_t | channelReadMemoryAttribute |
channel memory read attribute configuration | |
edma_channel_memory_attribute_t | channelWriteMemoryAttribute |
channel memory write attribute configuration | |
edma_channel_swap_size_t | channelSwapSize |
channel swap size configuration | |
edma_channel_access_type_t | channelAccessType |
channel access type configuration | |
uint8_t | channelDataSignExtensionBitPosition |
channel data sign extension bit psition configuration | |
int | channelRequestSource |
hardware service request source for the channel | |
bool | enableMasterIDReplication |
enable master ID replication | |
edma_channel_security_level_t | securityLevel |
security level | |
edma_channel_protection_level_t | protectionLevel |
protection level | |
#define FSL_EDMA_DRIVER_VERSION (MAKE_VERSION(2, 4, 4)) |
Version 2.4.4.
#define FSL_EDMA_DRIVER_VERSION (MAKE_VERSION(2, 10, 1)) |
Version 2.10.1.
typedef void(* edma_callback)(struct _edma_handle *handle, void *userData, bool transferDone, uint32_t tcds) |
This callback function is called in the EDMA interrupt handle. In normal mode, run into callback function means the transfer users need is done. In scatter gather mode, run into callback function means a transfer control block (tcd) is finished. Not all transfer finished, users can get the finished tcd numbers using interface EDMA_GetUnusedTCDNumber.
handle | EDMA 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 EDMA callback function. |
transferDone | 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 EDMA register is done. As the load of core is different, it will be different if the new tcd loaded into EDMA registers while this callback called. If true, it always means new tcd still not loaded into registers, while false means new tcd already loaded into registers. |
tcds | How many tcds are done from the last callback. This parameter only used in scatter gather mode. It tells user how many tcds are finished between the last callback and this. |
typedef edma_core_tcd_t edma_tcd_t |
This structure is same as TCD register which is described in reference manual, and is used to configure the scatter/gather feature as a next hardware TCD.
typedef void(* edma_callback)(struct _edma_handle *handle, void *userData, bool transferDone, uint32_t tcds) |
This callback function is called in the EDMA interrupt handle. In normal mode, run into callback function means the transfer users need is done. In scatter gather mode, run into callback function means a transfer control block (tcd) is finished. Not all transfer finished, users can get the finished tcd numbers using interface EDMA_GetUnusedTCDNumber.
handle | EDMA 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 EDMA callback function. |
transferDone | 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 EDMA register is done. As the load of core is different, it will be different if the new tcd loaded into EDMA registers while this callback called. If true, it always means new tcd still not loaded into registers, while false means new tcd already loaded into registers. |
tcds | How many tcds are done from the last callback. This parameter only used in scatter gather mode. It tells user how many tcds are finished between the last callback and this. |
enum edma_transfer_size_t |
enum edma_modulo_t |
enum edma_bandwidth_t |
anonymous enum |
anonymous enum |
enum edma_transfer_type_t |
anonymous enum |
anonymous enum |
enum edma_transfer_size_t |
enum edma_modulo_t |
enum edma_bandwidth_t |
anonymous enum |
anonymous enum |
anonymous enum |
enum edma_transfer_type_t |
anonymous enum |
void EDMA_Init | ( | DMA_Type * | base, |
const edma_config_t * | config | ||
) |
This function ungates the eDMA clock and configures the eDMA peripheral according to the configuration structure.
base | eDMA peripheral base address. |
config | A pointer to the configuration structure, see "edma_config_t". |
void EDMA_Deinit | ( | DMA_Type * | base | ) |
This function gates the eDMA clock.
base | eDMA peripheral base address. |
void EDMA_InstallTCD | ( | DMA_Type * | base, |
uint32_t | channel, | ||
edma_tcd_t * | tcd | ||
) |
base | EDMA peripheral base address. |
channel | EDMA channel number. |
tcd | Point to TCD structure. |
void EDMA_GetDefaultConfig | ( | edma_config_t * | config | ) |
This function sets the configuration structure to default values. The default configuration is set to the following values.
config | A pointer to the eDMA configuration structure. |
|
inlinestatic |
base | EDMA peripheral base address. |
enable | true is enable, false is disable. |
|
inlinestatic |
The TCDn.word2 is redefined to include individual enable fields, an offset field, and the NBYTES field.
base | EDMA peripheral base address. |
enable | true is enable, false is disable. |
void EDMA_ResetChannel | ( | DMA_Type * | base, |
uint32_t | channel | ||
) |
This function sets TCD registers for this channel to default values.
base | eDMA peripheral base address. |
channel | eDMA channel number. |
void EDMA_SetTransferConfig | ( | DMA_Type * | base, |
uint32_t | channel, | ||
const edma_transfer_config_t * | config, | ||
edma_tcd_t * | nextTcd | ||
) |
This function configures the transfer attribute, including source address, destination address, transfer size, address offset, and so on. It also configures the scatter gather feature if the user supplies the TCD address. Example:
base | eDMA peripheral base address. |
channel | eDMA channel number. |
config | Pointer to eDMA transfer configuration structure. |
nextTcd | Point to TCD structure. It can be NULL if users do not want to enable scatter/gather feature. |
void EDMA_SetMinorOffsetConfig | ( | DMA_Type * | base, |
uint32_t | channel, | ||
const edma_minor_offset_config_t * | config | ||
) |
The minor offset means that the signed-extended value is added to the source address or destination address after each minor loop.
base | eDMA peripheral base address. |
channel | eDMA channel number. |
config | A pointer to the minor offset configuration structure. |
void EDMA_SetChannelPreemptionConfig | ( | DMA_Type * | base, |
uint32_t | channel, | ||
const edma_channel_Preemption_config_t * | config | ||
) |
This function configures the channel preemption attribute and the priority of the channel.
base | eDMA peripheral base address. |
channel | eDMA channel number |
config | A pointer to the channel preemption configuration structure. |
void EDMA_SetChannelLink | ( | DMA_Type * | base, |
uint32_t | channel, | ||
edma_channel_link_type_t | linkType, | ||
uint32_t | linkedChannel | ||
) |
This function configures either the minor link or the major link mode. The minor link means that the channel link is triggered every time CITER decreases by 1. The major link means that the channel link is triggered when the CITER is exhausted.
base | eDMA peripheral base address. |
channel | eDMA channel number. |
linkType | A channel link type, which can be one of the following:
|
linkedChannel | The linked channel number. |
void EDMA_SetBandWidth | ( | DMA_Type * | base, |
uint32_t | channel, | ||
edma_bandwidth_t | bandWidth | ||
) |
Because the eDMA processes the minor loop, it continuously generates read/write sequences until the minor count is exhausted. The bandwidth forces the eDMA to stall after the completion of each read/write access to control the bus request bandwidth seen by the crossbar switch.
base | eDMA peripheral base address. |
channel | eDMA channel number. |
bandWidth | A bandwidth setting, which can be one of the following:
|
void EDMA_SetModulo | ( | DMA_Type * | base, |
uint32_t | channel, | ||
edma_modulo_t | srcModulo, | ||
edma_modulo_t | destModulo | ||
) |
This function defines a specific address range specified to be the value after (SADDR + SOFF)/(DADDR + DOFF) calculation is performed or the original register value. It provides the ability to implement a circular data queue easily.
base | eDMA peripheral base address. |
channel | eDMA channel number. |
srcModulo | A source modulo value. |
destModulo | A destination modulo value. |
|
inlinestatic |
If enabling the auto stop request, the eDMA hardware automatically disables the hardware channel request.
base | eDMA peripheral base address. |
channel | eDMA channel number. |
enable | The command to enable (true) or disable (false). |
void EDMA_EnableChannelInterrupts | ( | DMA_Type * | base, |
uint32_t | channel, | ||
uint32_t | mask | ||
) |
base | eDMA peripheral base address. |
channel | eDMA channel number. |
mask | The mask of interrupt source to be set. Users need to use the defined edma_interrupt_enable_t type. |
void EDMA_DisableChannelInterrupts | ( | DMA_Type * | base, |
uint32_t | channel, | ||
uint32_t | mask | ||
) |
base | eDMA peripheral base address. |
channel | eDMA channel number. |
mask | The mask of the interrupt source to be set. Use the defined edma_interrupt_enable_t type. |
void EDMA_SetMajorOffsetConfig | ( | DMA_Type * | base, |
uint32_t | channel, | ||
int32_t | sourceOffset, | ||
int32_t | destOffset | ||
) |
Adjustment value added to the source address at the completion of the major iteration count
base | eDMA peripheral base address. |
channel | edma channel number. |
sourceOffset | source address offset will be applied to source address after major loop done. |
destOffset | destination address offset will be applied to source address after major loop done. |
void EDMA_TcdReset | ( | edma_tcd_t * | tcd | ) |
This function sets all fields for this TCD structure to default value.
tcd | Pointer to the TCD structure. |
This API only supports EDMA4 TCD type. It can be used to support all types with extension API EDMA_TcdResetExt
This function sets all fields for this TCD structure to default value.
tcd | Pointer to the TCD structure. |
void EDMA_TcdSetTransferConfig | ( | edma_tcd_t * | tcd, |
const edma_transfer_config_t * | config, | ||
edma_tcd_t * | nextTcd | ||
) |
The TCD is a transfer control descriptor. The content of the TCD is the same as the hardware TCD registers. The TCD is used in the scatter-gather mode. This function configures the TCD transfer attribute, including source address, destination address, transfer size, address offset, and so on. It also configures the scatter gather feature if the user supplies the next TCD address. Example:
tcd | Pointer to the TCD structure. |
config | Pointer to eDMA transfer configuration structure. |
nextTcd | Pointer to the next TCD structure. It can be NULL if users do not want to enable scatter/gather feature. |
This API only supports EDMA4 TCD type. It can be used to support all types with extension API EDMA_TcdSetTransferConfigExt
The TCD is a transfer control descriptor. The content of the TCD is the same as the hardware TCD registers. The TCD is used in the scatter-gather mode. This function configures the TCD transfer attribute, including source address, destination address, transfer size, address offset, and so on. It also configures the scatter gather feature if the user supplies the next TCD address. Example:
tcd | Pointer to the TCD structure. |
config | Pointer to eDMA transfer configuration structure. |
nextTcd | Pointer to the next TCD structure. It can be NULL if users do not want to enable scatter/gather feature. |
void EDMA_TcdSetMinorOffsetConfig | ( | edma_tcd_t * | tcd, |
const edma_minor_offset_config_t * | config | ||
) |
A minor offset is a signed-extended value added to the source address or a destination address after each minor loop.
tcd | A point to the TCD structure. |
config | A pointer to the minor offset configuration structure. |
This API only supports EDMA4 TCD type. It can be used to support all types with extension API EDMA_TcdSetMinorOffsetConfigExt
A minor offset is a signed-extended value added to the source address or a destination address after each minor loop.
tcd | A point to the TCD structure. |
config | A pointer to the minor offset configuration structure. |
void EDMA_TcdSetChannelLink | ( | edma_tcd_t * | tcd, |
edma_channel_link_type_t | linkType, | ||
uint32_t | linkedChannel | ||
) |
This function configures either a minor link or a major link. The minor link means the channel link is triggered every time CITER decreases by 1. The major link means that the channel link is triggered when the CITER is exhausted.
tcd | Point to the TCD structure. |
linkType | Channel link type, it can be one of:
|
linkedChannel | The linked channel number. |
This API only supports EDMA4 TCD type. It can be used to support all types with extension API EDMA_TcdSetChannelLinkExt
This function configures either a minor link or a major link. The minor link means the channel link is triggered every time CITER decreases by 1. The major link means that the channel link is triggered when the CITER is exhausted.
tcd | Point to the TCD structure. |
type | Channel link type, it can be one of:
|
linkedChannel | The linked channel number. |
|
inlinestatic |
Because the eDMA processes the minor loop, it continuously generates read/write sequences until the minor count is exhausted. The bandwidth forces the eDMA to stall after the completion of each read/write access to control the bus request bandwidth seen by the crossbar switch.
tcd | A pointer to the TCD structure. |
bandWidth | A bandwidth setting, which can be one of the following:
|
void EDMA_TcdSetModulo | ( | edma_tcd_t * | tcd, |
edma_modulo_t | srcModulo, | ||
edma_modulo_t | destModulo | ||
) |
This function defines a specific address range specified to be the value after (SADDR + SOFF)/(DADDR + DOFF) calculation is performed or the original register value. It provides the ability to implement a circular data queue easily.
tcd | A pointer to the TCD structure. |
srcModulo | A source modulo value. |
destModulo | A destination modulo value. |
This API only supports EDMA4 TCD type. It can be used to support all types with extension API EDMA_TcdSetModuloExt
This function defines a specific address range specified to be the value after (SADDR + SOFF)/(DADDR + DOFF) calculation is performed or the original register value. It provides the ability to implement a circular data queue easily.
tcd | A pointer to the TCD structure. |
srcModulo | A source modulo value. |
destModulo | A destination modulo value. |
|
inlinestatic |
If enabling the auto stop request, the eDMA hardware automatically disables the hardware channel request.
tcd | A pointer to the TCD structure. |
enable | The command to enable (true) or disable (false). |
void EDMA_TcdEnableInterrupts | ( | edma_tcd_t * | tcd, |
uint32_t | mask | ||
) |
tcd | Point to the TCD structure. |
mask | The mask of interrupt source to be set. Users need to use the defined edma_interrupt_enable_t type. |
This API only supports EDMA4 TCD type. It can be used to support all types with extension API EDMA_TcdEnableInterruptsExt
tcd | Point to the TCD structure. |
mask | The mask of interrupt source to be set. Users need to use the defined edma_interrupt_enable_t type. |
void EDMA_TcdDisableInterrupts | ( | edma_tcd_t * | tcd, |
uint32_t | mask | ||
) |
tcd | Point to the TCD structure. |
mask | The mask of interrupt source to be set. Users need to use the defined edma_interrupt_enable_t type. |
This API only supports EDMA4 TCD type. It can be used to support all types with extension API EDMA_TcdDisableInterruptsExt
tcd | Point to the TCD structure. |
mask | The mask of interrupt source to be set. Users need to use the defined edma_interrupt_enable_t type. |
void EDMA_TcdSetMajorOffsetConfig | ( | edma_tcd_t * | tcd, |
int32_t | sourceOffset, | ||
int32_t | destOffset | ||
) |
Adjustment value added to the source address at the completion of the major iteration count
tcd | A point to the TCD structure. |
sourceOffset | source address offset wiil be applied to source address after major loop done. |
destOffset | destination address offset will be applied to source address after major loop done. |
This API only supports EDMA4 TCD type. It can be used to support all types with extension API EDMA_TcdSetMajorOffsetConfigExt
Adjustment value added to the source address at the completion of the major iteration count
tcd | A point to the TCD structure. |
sourceOffset | source address offset wiil be applied to source address after major loop done. |
destOffset | destination address offset will be applied to source address after major loop done. |
|
inlinestatic |
This function enables the hardware channel request.
base | eDMA peripheral base address. |
channel | eDMA channel number. |
|
inlinestatic |
This function disables the hardware channel request.
base | eDMA peripheral base address. |
channel | eDMA channel number. |
|
inlinestatic |
This function starts a minor loop transfer.
base | eDMA peripheral base address. |
channel | eDMA channel number. |
uint32_t EDMA_GetRemainingMajorLoopCount | ( | DMA_Type * | base, |
uint32_t | channel | ||
) |
This function checks the TCD (Task Control Descriptor) status for a specified eDMA channel and returns the number of major loop count that has not finished.
base | eDMA peripheral base address. |
channel | eDMA channel number. |
|
inlinestatic |
base | eDMA peripheral base address. |
uint32_t EDMA_GetChannelStatusFlags | ( | DMA_Type * | base, |
uint32_t | channel | ||
) |
base | eDMA peripheral base address. |
channel | eDMA channel number. |
void EDMA_ClearChannelStatusFlags | ( | DMA_Type * | base, |
uint32_t | channel, | ||
uint32_t | mask | ||
) |
base | eDMA peripheral base address. |
channel | eDMA channel number. |
mask | The mask of channel status to be cleared. Users need to use the defined _edma_channel_status_flags type. |
void EDMA_CreateHandle | ( | edma_handle_t * | handle, |
DMA_Type * | base, | ||
uint32_t | channel | ||
) |
This function is called if using the transactional API for eDMA. This function initializes the internal state of the eDMA handle.
handle | eDMA handle pointer. The eDMA handle stores callback function and parameters. |
base | eDMA peripheral base address. |
channel | eDMA channel number. |
void EDMA_InstallTCDMemory | ( | edma_handle_t * | handle, |
edma_tcd_t * | tcdPool, | ||
uint32_t | tcdSize | ||
) |
This function is called after the EDMA_CreateHandle to use scatter/gather feature. This function shall only be used while users need to use scatter gather mode. Scatter gather mode enables EDMA to load a new transfer control block (tcd) in hardware, and automatically reconfigure that DMA channel for a new transfer. Users need to prepare tcd memory and also configure tcds using interface EDMA_SubmitTransfer.
handle | eDMA handle pointer. |
tcdPool | A memory pool to store TCDs. It must be 32 bytes aligned. |
tcdSize | The number of TCD slots. |
void EDMA_SetCallback | ( | edma_handle_t * | handle, |
edma_callback | callback, | ||
void * | userData | ||
) |
This callback is called in the eDMA IRQ handler. Use the callback to do something after the current major loop transfer completes. This function will be called every time one tcd finished transfer.
handle | eDMA handle pointer. |
callback | eDMA callback function pointer. |
userData | A parameter for the callback function. |
void EDMA_PrepareTransferConfig | ( | edma_transfer_config_t * | config, |
void * | srcAddr, | ||
uint32_t | srcWidth, | ||
int16_t | srcOffset, | ||
void * | destAddr, | ||
uint32_t | destWidth, | ||
int16_t | destOffset, | ||
uint32_t | bytesEachRequest, | ||
uint32_t | transferBytes | ||
) |
This function prepares the transfer configuration structure according to the user input.
config | The user configuration structure of type edma_transfer_t. |
srcAddr | eDMA transfer source address. |
srcWidth | eDMA transfer source address width(bytes). |
srcOffset | source address offset. |
destAddr | eDMA transfer destination address. |
destWidth | eDMA transfer destination address width(bytes). |
destOffset | destination address offset. |
bytesEachRequest | eDMA transfer bytes per channel request. |
transferBytes | eDMA transfer bytes to be transferred. |
This function prepares the transfer configuration structure according to the user input.
config | The user configuration structure of type edma_transfer_t. |
srcAddr | eDMA transfer source address. |
srcWidth | eDMA transfer source address width(bytes). |
srcOffset | source address offset. |
destAddr | eDMA transfer destination address. |
destWidth | eDMA transfer destination address width(bytes). |
destOffset | destination address offset. |
bytesEachRequest | eDMA transfer bytes per channel request. |
transferBytes | eDMA transfer bytes to be transferred. |
void EDMA_PrepareTransfer | ( | edma_transfer_config_t * | config, |
void * | srcAddr, | ||
uint32_t | srcWidth, | ||
void * | destAddr, | ||
uint32_t | destWidth, | ||
uint32_t | bytesEachRequest, | ||
uint32_t | transferBytes, | ||
edma_transfer_type_t | transferType | ||
) |
This function prepares the transfer configuration structure according to the user input.
config | The user configuration structure of type edma_transfer_t. |
srcAddr | eDMA transfer source address. |
srcWidth | eDMA transfer source address width(bytes). |
destAddr | eDMA transfer destination address. |
destWidth | eDMA transfer destination address width(bytes). |
bytesEachRequest | eDMA transfer bytes per channel request. |
transferBytes | eDMA transfer bytes to be transferred. |
transferType | eDMA transfer type. |
This function prepares the transfer configuration structure according to the user input.
config | The user configuration structure of type edma_transfer_t. |
srcAddr | eDMA transfer source address. |
srcWidth | eDMA transfer source address width(bytes). |
destAddr | eDMA transfer destination address. |
destWidth | eDMA transfer destination address width(bytes). |
bytesEachRequest | eDMA transfer bytes per channel request. |
transferBytes | eDMA transfer bytes to be transferred. |
type | eDMA transfer type. |
status_t EDMA_SubmitTransfer | ( | edma_handle_t * | handle, |
const edma_transfer_config_t * | config | ||
) |
This function submits the eDMA transfer request according to the transfer configuration structure. In scatter gather mode, call this function will add a configured tcd to the circular list of tcd pool. The tcd pools is setup by call function EDMA_InstallTCDMemory before.
handle | eDMA handle pointer. |
config | Pointer to eDMA transfer configuration structure. |
kStatus_EDMA_Success | It means submit transfer request succeed. |
kStatus_EDMA_QueueFull | It means TCD queue is full. Submit transfer request is not allowed. |
kStatus_EDMA_Busy | It means the given channel is busy, need to submit request later. |
void EDMA_StartTransfer | ( | edma_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 | eDMA handle pointer. |
void EDMA_StopTransfer | ( | edma_handle_t * | handle | ) |
This function disables the channel request to pause the transfer. Users can call EDMA_StartTransfer() again to resume the transfer.
handle | eDMA handle pointer. |
void EDMA_AbortTransfer | ( | edma_handle_t * | handle | ) |
This function disables the channel request and clear transfer status bits. Users can submit another transfer after calling this API.
handle | DMA handle pointer. |
|
inlinestatic |
This function gets current tcd index which is run. If the TCD pool pointer is NULL, it will return 0.
handle | DMA handle pointer. |
|
inlinestatic |
This function gets the next tcd address. If this is last TCD, return 0.
handle | DMA handle pointer. |
void EDMA_HandleIRQ | ( | edma_handle_t * | handle | ) |
This function clears the channel major interrupt flag and calls the callback function if it is not NULL.
Note: For the case using TCD queue, when the major iteration count is exhausted, additional operations are performed. These include the final address adjustments and reloading of the BITER field into the CITER. Assertion of an optional interrupt request also occurs at this time, as does a possible fetch of a new TCD from memory using the scatter/gather address pointer included in the descriptor (if scatter/gather is enabled).
For instance, when the time interrupt of TCD[0] happens, the TCD[1] has already been loaded into the eDMA engine. As sga and sga_index are calculated based on the DLAST_SGA bitfield lies in the TCD_CSR register, the sga_index in this case should be 2 (DLAST_SGA of TCD[1] stores the address of TCD[2]). Thus, the "tcdUsed" updated should be (tcdUsed - 2U) which indicates the number of TCDs can be loaded in the memory pool (because TCD[0] and TCD[1] have been loaded into the eDMA engine at this point already.).
For the last two continuous ISRs in a scatter/gather process, they both load the last TCD (The last ISR does not load a new TCD) from the memory pool to the eDMA engine when major loop completes. Therefore, ensure that the header and tcdUsed updated are identical for them. tcdUsed are both 0 in this case as no TCD to be loaded.
See the "eDMA basic data flow" in the eDMA Functional description section of the Reference Manual for further details.
handle | eDMA handle pointer. |
void EDMA_Init | ( | EDMA_Type * | base, |
const edma_config_t * | config | ||
) |
This function ungates the eDMA clock and configures the eDMA peripheral according to the configuration structure.
base | eDMA peripheral base address. |
config | A pointer to the configuration structure, see "edma_config_t". |
void EDMA_Deinit | ( | EDMA_Type * | base | ) |
This function gates the eDMA clock.
base | eDMA peripheral base address. |
void EDMA_InstallTCD | ( | EDMA_Type * | base, |
uint32_t | channel, | ||
edma_tcd_t * | tcd | ||
) |
base | EDMA peripheral base address. |
channel | EDMA channel number. |
tcd | Point to TCD structure. |
void EDMA_InitChannel | ( | EDMA_Type * | base, |
uint32_t | channel, | ||
edma_channel_config_t * | channelConfig | ||
) |
base | eDMA4 peripheral base address. |
channel | eDMA4 channel number. |
channelConfig | pointer to user's eDMA4 channel config structure, see edma_channel_config_t for detail. |
|
inlinestatic |
base | eDMA4 peripheral base address. |
channel | eDMA4 channel number. |
writeAttribute | Attributes associated with a write transaction. |
readAttribute | Attributes associated with a read transaction. |
|
inlinestatic |
base | eDMA4 peripheral base address. |
channel | eDMA4 channel number. |
position | A non-zero value specifing the sign extend bit position. If 0, sign extension is disabled. |
|
inlinestatic |
base | eDMA4 peripheral base address. |
channel | eDMA4 channel number. |
swapSize | Swap occurs with respect to the specified transfer size. If 0, swap is disabled. |
|
inlinestatic |
base | eDMA4 peripheral base address. |
channel | eDMA4 channel number. |
channelAccessType | eDMA4's transactions type on the system bus when the channel is active. |
|
inlinestatic |
base | eDMA peripheral base address. |
channel | eDMA channel number. |
channelRequestSource | eDMA hardware service request source for the channel. User need to use the dma_request_source_t type as the input parameter. Note that devices may use other enum type to express dma request source and User can fined it in SOC header or fsl_edma_soc.h. |
|
inlinestatic |
base | eDMA peripheral base address. |
channel | eDMA channel number. |
|
inlinestatic |
base | eDMA peripheral base address. |
channel | eDMA channel number. |
enable | true is enable, false is disable. |
|
inlinestatic |
base | eDMA peripheral base address. |
channel | eDMA channel number. |
level | security level. |
|
inlinestatic |
base | eDMA peripheral base address. |
channel | eDMA channel number. |
level | security level. |
void EDMA_ResetChannel | ( | EDMA_Type * | base, |
uint32_t | channel | ||
) |
This function sets TCD registers for this channel to default values.
base | eDMA peripheral base address. |
channel | eDMA channel number. |
void EDMA_SetTransferConfig | ( | EDMA_Type * | base, |
uint32_t | channel, | ||
const edma_transfer_config_t * | config, | ||
edma_tcd_t * | nextTcd | ||
) |
This function configures the transfer attribute, including source address, destination address, transfer size, address offset, and so on. It also configures the scatter gather feature if the user supplies the TCD address. Example:
base | eDMA peripheral base address. |
channel | eDMA channel number. |
config | Pointer to eDMA transfer configuration structure. |
nextTcd | Point to TCD structure. It can be NULL if users do not want to enable scatter/gather feature. |
void EDMA_SetMinorOffsetConfig | ( | EDMA_Type * | base, |
uint32_t | channel, | ||
const edma_minor_offset_config_t * | config | ||
) |
The minor offset means that the signed-extended value is added to the source address or destination address after each minor loop.
base | eDMA peripheral base address. |
channel | eDMA channel number. |
config | A pointer to the minor offset configuration structure. |
void EDMA_SetChannelPreemptionConfig | ( | EDMA_Type * | base, |
uint32_t | channel, | ||
const edma_channel_Preemption_config_t * | config | ||
) |
This function configures the channel preemption attribute and the priority of the channel.
base | eDMA peripheral base address. |
channel | eDMA channel number |
config | A pointer to the channel preemption configuration structure. |
void EDMA_SetChannelLink | ( | EDMA_Type * | base, |
uint32_t | channel, | ||
edma_channel_link_type_t | type, | ||
uint32_t | linkedChannel | ||
) |
This function configures either the minor link or the major link mode. The minor link means that the channel link is triggered every time CITER decreases by 1. The major link means that the channel link is triggered when the CITER is exhausted.
base | eDMA peripheral base address. |
channel | eDMA channel number. |
type | A channel link type, which can be one of the following:
|
linkedChannel | The linked channel number. |
void EDMA_SetBandWidth | ( | EDMA_Type * | base, |
uint32_t | channel, | ||
edma_bandwidth_t | bandWidth | ||
) |
Because the eDMA processes the minor loop, it continuously generates read/write sequences until the minor count is exhausted. The bandwidth forces the eDMA to stall after the completion of each read/write access to control the bus request bandwidth seen by the crossbar switch.
base | eDMA peripheral base address. |
channel | eDMA channel number. |
bandWidth | A bandwidth setting, which can be one of the following:
|
void EDMA_SetModulo | ( | EDMA_Type * | base, |
uint32_t | channel, | ||
edma_modulo_t | srcModulo, | ||
edma_modulo_t | destModulo | ||
) |
This function defines a specific address range specified to be the value after (SADDR + SOFF)/(DADDR + DOFF) calculation is performed or the original register value. It provides the ability to implement a circular data queue easily.
base | eDMA peripheral base address. |
channel | eDMA channel number. |
srcModulo | A source modulo value. |
destModulo | A destination modulo value. |
|
inlinestatic |
If enabling the auto stop request, the eDMA hardware automatically disables the hardware channel request.
base | eDMA peripheral base address. |
channel | eDMA channel number. |
enable | The command to enable (true) or disable (false). |
void EDMA_EnableChannelInterrupts | ( | EDMA_Type * | base, |
uint32_t | channel, | ||
uint32_t | mask | ||
) |
base | eDMA peripheral base address. |
channel | eDMA channel number. |
mask | The mask of interrupt source to be set. Users need to use the defined edma_interrupt_enable_t type. |
void EDMA_DisableChannelInterrupts | ( | EDMA_Type * | base, |
uint32_t | channel, | ||
uint32_t | mask | ||
) |
base | eDMA peripheral base address. |
channel | eDMA channel number. |
mask | The mask of the interrupt source to be set. Use the defined edma_interrupt_enable_t type. |
void EDMA_SetMajorOffsetConfig | ( | EDMA_Type * | base, |
uint32_t | channel, | ||
int32_t | sourceOffset, | ||
int32_t | destOffset | ||
) |
Adjustment value added to the source address at the completion of the major iteration count
base | eDMA peripheral base address. |
channel | edma channel number. |
sourceOffset | source address offset will be applied to source address after major loop done. |
destOffset | destination address offset will be applied to source address after major loop done. |
void EDMA_ConfigChannelSoftwareTCD | ( | edma_tcd_t * | tcd, |
const edma_transfer_config_t * | transfer | ||
) |
This API only supports EDMA4 TCD type. It can be used to support all types with extension API EDMA_ConfigChannelSoftwareTCDExt
Application should be careful about the TCD pool buffer storage class,
tcd | Pointer to the TCD structure. |
transfer | channel transfer configuration pointer. |
void EDMA_ConfigChannelSoftwareTCDExt | ( | EDMA_Type * | base, |
edma_tcd_t * | tcd, | ||
const edma_transfer_config_t * | transfer | ||
) |
Application should be careful about the TCD pool buffer storage class,
base | eDMA peripheral base address. |
tcd | Pointer to the TCD structure. |
transfer | channel transfer configuration pointer. |
void EDMA_TcdResetExt | ( | EDMA_Type * | base, |
edma_tcd_t * | tcd | ||
) |
This function sets all fields for this TCD structure to default value.
base | eDMA peripheral base address. |
tcd | Pointer to the TCD structure. |
void EDMA_TcdSetTransferConfigExt | ( | EDMA_Type * | base, |
edma_tcd_t * | tcd, | ||
const edma_transfer_config_t * | config, | ||
edma_tcd_t * | nextTcd | ||
) |
The TCD is a transfer control descriptor. The content of the TCD is the same as the hardware TCD registers. The TCD is used in the scatter-gather mode. This function configures the TCD transfer attribute, including source address, destination address, transfer size, address offset, and so on. It also configures the scatter gather feature if the user supplies the next TCD address. Example:
base | eDMA peripheral base address. |
tcd | Pointer to the TCD structure. |
config | Pointer to eDMA transfer configuration structure. |
nextTcd | Pointer to the next TCD structure. It can be NULL if users do not want to enable scatter/gather feature. |
void EDMA_TcdSetMinorOffsetConfigExt | ( | EDMA_Type * | base, |
edma_tcd_t * | tcd, | ||
const edma_minor_offset_config_t * | config | ||
) |
A minor offset is a signed-extended value added to the source address or a destination address after each minor loop.
base | eDMA peripheral base address. |
tcd | A point to the TCD structure. |
config | A pointer to the minor offset configuration structure. |
void EDMA_TcdSetChannelLinkExt | ( | EDMA_Type * | base, |
edma_tcd_t * | tcd, | ||
edma_channel_link_type_t | type, | ||
uint32_t | linkedChannel | ||
) |
This function configures either a minor link or a major link. The minor link means the channel link is triggered every time CITER decreases by 1. The major link means that the channel link is triggered when the CITER is exhausted.
base | eDMA peripheral base address. |
tcd | Point to the TCD structure. |
type | Channel link type, it can be one of:
|
linkedChannel | The linked channel number. |
|
inlinestatic |
Because the eDMA processes the minor loop, it continuously generates read/write sequences until the minor count is exhausted. The bandwidth forces the eDMA to stall after the completion of each read/write access to control the bus request bandwidth seen by the crossbar switch.
base | eDMA peripheral base address. |
tcd | A pointer to the TCD structure. |
bandWidth | A bandwidth setting, which can be one of the following:
|
void EDMA_TcdSetModuloExt | ( | EDMA_Type * | base, |
edma_tcd_t * | tcd, | ||
edma_modulo_t | srcModulo, | ||
edma_modulo_t | destModulo | ||
) |
This function defines a specific address range specified to be the value after (SADDR + SOFF)/(DADDR + DOFF) calculation is performed or the original register value. It provides the ability to implement a circular data queue easily.
base | eDMA peripheral base address. |
tcd | A pointer to the TCD structure. |
srcModulo | A source modulo value. |
destModulo | A destination modulo value. |
|
inlinestatic |
If enabling the auto stop request, the eDMA hardware automatically disables the hardware channel request.
base | eDMA peripheral base address. |
tcd | A pointer to the TCD structure. |
enable | The command to enable (true) or disable (false). |
void EDMA_TcdEnableInterruptsExt | ( | EDMA_Type * | base, |
edma_tcd_t * | tcd, | ||
uint32_t | mask | ||
) |
base | eDMA peripheral base address. |
tcd | Point to the TCD structure. |
mask | The mask of interrupt source to be set. Users need to use the defined edma_interrupt_enable_t type. |
void EDMA_TcdDisableInterruptsExt | ( | EDMA_Type * | base, |
edma_tcd_t * | tcd, | ||
uint32_t | mask | ||
) |
base | eDMA peripheral base address. |
tcd | Point to the TCD structure. |
mask | The mask of interrupt source to be set. Users need to use the defined edma_interrupt_enable_t type. |
void EDMA_TcdSetMajorOffsetConfigExt | ( | EDMA_Type * | base, |
edma_tcd_t * | tcd, | ||
int32_t | sourceOffset, | ||
int32_t | destOffset | ||
) |
Adjustment value added to the source address at the completion of the major iteration count
base | eDMA peripheral base address. |
tcd | A point to the TCD structure. |
sourceOffset | source address offset wiil be applied to source address after major loop done. |
destOffset | destination address offset will be applied to source address after major loop done. |
|
inlinestatic |
This function enables the hardware channel request.
base | eDMA peripheral base address. |
channel | eDMA channel number. |
|
inlinestatic |
This function disables the hardware channel request.
base | eDMA peripheral base address. |
channel | eDMA channel number. |
|
inlinestatic |
This function starts a minor loop transfer.
base | eDMA peripheral base address. |
channel | eDMA channel number. |
uint32_t EDMA_GetRemainingMajorLoopCount | ( | EDMA_Type * | base, |
uint32_t | channel | ||
) |
This function checks the TCD (Task Control Descriptor) status for a specified eDMA channel and returns the number of major loop count that has not finished.
base | eDMA peripheral base address. |
channel | eDMA channel number. |
|
inlinestatic |
base | eDMA peripheral base address. |
uint32_t EDMA_GetChannelStatusFlags | ( | EDMA_Type * | base, |
uint32_t | channel | ||
) |
base | eDMA peripheral base address. |
channel | eDMA channel number. |
void EDMA_ClearChannelStatusFlags | ( | EDMA_Type * | base, |
uint32_t | channel, | ||
uint32_t | mask | ||
) |
base | eDMA peripheral base address. |
channel | eDMA channel number. |
mask | The mask of channel status to be cleared. Users need to use the defined _edma_channel_status_flags type. |
void EDMA_CreateHandle | ( | edma_handle_t * | handle, |
EDMA_Type * | base, | ||
uint32_t | channel | ||
) |
This function is called if using the transactional API for eDMA. This function initializes the internal state of the eDMA handle.
handle | eDMA handle pointer. The eDMA handle stores callback function and parameters. |
base | eDMA peripheral base address. |
channel | eDMA channel number. |
void EDMA_PrepareTransferTCD | ( | edma_handle_t * | handle, |
edma_tcd_t * | tcd, | ||
void * | srcAddr, | ||
uint32_t | srcWidth, | ||
int16_t | srcOffset, | ||
void * | destAddr, | ||
uint32_t | destWidth, | ||
int16_t | destOffset, | ||
uint32_t | bytesEachRequest, | ||
uint32_t | transferBytes, | ||
edma_tcd_t * | nextTcd | ||
) |
This function prepares the transfer content descriptor structure according to the user input.
handle | eDMA handle pointer. |
tcd | Pointer to eDMA transfer content descriptor structure. |
srcAddr | eDMA transfer source address. |
srcWidth | eDMA transfer source address width(bytes). |
srcOffset | source address offset. |
destAddr | eDMA transfer destination address. |
destWidth | eDMA transfer destination address width(bytes). |
destOffset | destination address offset. |
bytesEachRequest | eDMA transfer bytes per channel request. |
transferBytes | eDMA transfer bytes to be transferred. |
nextTcd | eDMA transfer linked TCD address. |
status_t EDMA_SubmitTransferTCD | ( | edma_handle_t * | handle, |
edma_tcd_t * | tcd | ||
) |
This function submits the eDMA transfer request according to the transfer content descriptor. In scatter gather mode, call this function will add a configured tcd to the circular list of tcd pool. The tcd pools is setup by call function EDMA_InstallTCDMemory before.
Typical user case:
handle | eDMA handle pointer. |
tcd | Pointer to eDMA transfer content descriptor structure. |
kStatus_EDMA_Success | It means submit transfer request succeed. |
kStatus_EDMA_QueueFull | It means TCD queue is full. Submit transfer request is not allowed. |
kStatus_EDMA_Busy | It means the given channel is busy, need to submit request later. |
status_t EDMA_SubmitLoopTransfer | ( | edma_handle_t * | handle, |
edma_transfer_config_t * | transfer, | ||
uint32_t | transferLoopCount | ||
) |
The function is target for submit loop transfer request, the ring transfer request means that the transfer request TAIL is link to HEAD, such as, A->B->C->D->A, or A->A
To use the ring transfer feature, the application should allocate several transfer object, such as
Then eDMA driver will link transfer[0] and transfer[1] to each other
handle | eDMA handle pointer |
transfer | pointer to user's eDMA channel configure structure, see edma_channel_transfer_config_t for detail |
transferLoopCount | the count of the transfer ring, if loop count is 1, that means that the one will link to itself. |
kStatus_Success | It means submit transfer request succeed |
kStatus_EDMA_Busy | channel is in busy status |
kStatus_InvalidArgument | Invalid Argument |