12#include "fsl_common.h"
26#define FSL_EDMA_DRIVER_VERSION (MAKE_VERSION(2, 4, 3))
30#define DMA_DCHPRI_INDEX(channel) (((channel) & ~0x03U) | (3U - ((channel)&0x03U)))
118#if defined(FSL_FEATURE_EDMA_CHANNEL_GROUP_COUNT) && (FSL_FEATURE_EDMA_CHANNEL_GROUP_COUNT > 1)
119 kEDMA_GroupPriorityErrorFlag = DMA_ES_GPE_MASK,
261#if defined(__cplusplus)
327static inline void EDMA_EnableContinuousChannelLinkMode(
DMA_Type *base,
bool enable)
331 base->CR |= DMA_CR_CLM_MASK;
335 base->CR &= ~DMA_CR_CLM_MASK;
348static inline void EDMA_EnableMinorLoopMapping(
DMA_Type *base,
bool enable)
352 base->CR |= DMA_CR_EMLM_MASK;
356 base->CR &= ~DMA_CR_EMLM_MASK;
480#if defined(FSL_FEATURE_EDMA_ASYNCHRO_REQUEST_CHANNEL_COUNT) && FSL_FEATURE_EDMA_ASYNCHRO_REQUEST_CHANNEL_COUNT
488static inline void EDMA_EnableAsyncRequest(
DMA_Type *base, uint32_t channel,
bool enable)
490 assert(channel < (uint32_t)FSL_FEATURE_DMAMUX_MODULE_CHANNEL);
492 base->EARS &= ~((uint32_t)1U << channel);
493 base->EARS |= ((uint32_t)(
true == enable ? 1U : 0U) << channel);
506static inline void EDMA_EnableAutoStopRequest(
DMA_Type *base, uint32_t channel,
bool enable)
508 assert(channel < (uint32_t)FSL_FEATURE_DMAMUX_MODULE_CHANNEL);
510 base->TCD[channel].CSR =
511 (uint16_t)((base->TCD[channel].CSR & (~DMA_CSR_DREQ_MASK)) |
DMA_CSR_DREQ((
true == enable ? 1U : 0U)));
634 assert(((uint32_t)tcd & 0x1FU) == 0U);
636 tcd->
CSR = (uint16_t)((tcd->
CSR & (~DMA_CSR_BWC_MASK)) |
DMA_CSR_BWC(bandWidth));
660static inline void EDMA_TcdEnableAutoStopRequest(
edma_tcd_t *tcd,
bool enable)
663 assert(((uint32_t)tcd & 0x1FU) == 0U);
665 tcd->
CSR = (uint16_t)((tcd->
CSR & (~DMA_CSR_DREQ_MASK)) |
DMA_CSR_DREQ((
true == enable ? 1U : 0U)));
711static inline void EDMA_EnableChannelRequest(
DMA_Type *base, uint32_t channel)
713 assert(channel < (uint32_t)FSL_FEATURE_DMAMUX_MODULE_CHANNEL);
726static inline void EDMA_DisableChannelRequest(
DMA_Type *base, uint32_t channel)
728 assert(channel < (uint32_t)FSL_FEATURE_DMAMUX_MODULE_CHANNEL);
741static inline void EDMA_TriggerChannelStart(
DMA_Type *base, uint32_t channel)
743 assert(channel < (uint32_t)FSL_FEATURE_DMAMUX_MODULE_CHANNEL);
784static inline uint32_t EDMA_GetErrorStatusFlags(
DMA_Type *base)
878 uint32_t bytesEachRequest,
879 uint32_t transferBytes);
903 uint32_t bytesEachRequest,
904 uint32_t transferBytes,
960static inline uint32_t EDMA_GetUnusedTCDNumber(
edma_handle_t *handle)
962 int8_t tmpTcdSize = handle->
tcdSize;
963 int8_t tmpTcdUsed = handle->
tcdUsed;
964 return ((uint32_t)tmpTcdSize - (uint32_t)tmpTcdUsed);
975static inline uint32_t EDMA_GetNextTCDAddress(
edma_handle_t *handle)
1012#if defined(__cplusplus)
#define __IO
Definition: core_cm4.h:239
#define DMA_CERQ_CERQ(x)
Definition: MIMXRT1052.h:15241
#define DMA_SERQ_SERQ(x)
Definition: MIMXRT1052.h:15267
#define DMA_SSRT_SSRT(x)
Definition: MIMXRT1052.h:15319
#define DMA_CSR_BWC(x)
Definition: MIMXRT1052.h:17776
#define DMA_CSR_DREQ(x)
Definition: MIMXRT1052.h:17732
void EDMA_TcdSetChannelLink(edma_tcd_t *tcd, edma_channel_link_type_t linkType, uint32_t linkedChannel)
Sets the channel link for the eDMA TCD.
Definition: fsl_edma.c:601
uint32_t EDMA_GetRemainingMajorLoopCount(DMA_Type *base, uint32_t channel)
Gets the remaining major loop count from the eDMA current channel TCD.
Definition: fsl_edma.c:731
edma_transfer_size_t destTransferSize
Definition: fsl_edma.h:173
void EDMA_SetChannelPreemptionConfig(DMA_Type *base, uint32_t channel, const edma_channel_Preemption_config_t *config)
Configures the eDMA channel preemption feature.
Definition: fsl_edma.c:293
uint8_t channelPriority
Definition: fsl_edma.h:187
void EDMA_EnableChannelInterrupts(DMA_Type *base, uint32_t channel, uint32_t mask)
Enables the interrupt source for the eDMA transfer.
Definition: fsl_edma.c:383
int16_t destOffset
Definition: fsl_edma.h:176
_edma_modulo
eDMA modulo configuration
Definition: fsl_edma.h:45
struct _edma_tcd edma_tcd_t
eDMA TCD.
void EDMA_TcdDisableInterrupts(edma_tcd_t *tcd, uint32_t mask)
Disables the interrupt source for the eDMA TCD.
Definition: fsl_edma.c:693
void EDMA_TcdSetMajorOffsetConfig(edma_tcd_t *tcd, int32_t sourceOffset, int32_t destOffset)
Configures the eDMA TCD major offset feature.
Definition: fsl_edma.c:577
void EDMA_AbortTransfer(edma_handle_t *handle)
eDMA aborts transfer.
Definition: fsl_edma.c:1345
DMA_Type * base
Definition: fsl_edma.h:247
volatile int8_t header
Definition: fsl_edma.h:250
void EDMA_InstallTCD(DMA_Type *base, uint32_t channel, edma_tcd_t *tcd)
Push content of TCD structure into hardware TCD register.
Definition: fsl_edma.c:88
void EDMA_DisableChannelInterrupts(DMA_Type *base, uint32_t channel, uint32_t mask)
Disables the interrupt source for the eDMA transfer.
Definition: fsl_edma.c:414
void EDMA_StopTransfer(edma_handle_t *handle)
eDMA stops transfer.
Definition: fsl_edma.c:1329
_edma_bandwidth
Bandwidth control.
Definition: fsl_edma.h:82
void EDMA_Deinit(DMA_Type *base)
Deinitializes the eDMA peripheral.
Definition: fsl_edma.c:150
struct _edma_handle edma_handle_t
eDMA transfer handle structure
bool enableContinuousLinkMode
Definition: fsl_edma.h:152
_edma_transfer_type
eDMA transfer type
Definition: fsl_edma.h:134
uint32_t majorLoopCounts
Definition: fsl_edma.h:179
struct _edma_transfer_config edma_transfer_config_t
eDMA transfer configuration
int16_t srcOffset
Definition: fsl_edma.h:174
__IO uint32_t DADDR
Definition: fsl_edma.h:211
_edma_channel_link_type
Channel link type.
Definition: fsl_edma.h:90
void EDMA_TcdReset(edma_tcd_t *tcd)
Sets all fields to default values for the TCD structure.
Definition: fsl_edma.c:445
enum _edma_interrupt_enable edma_interrupt_enable_t
eDMA interrupt source
void EDMA_SetMajorOffsetConfig(DMA_Type *base, uint32_t channel, int32_t sourceOffset, int32_t destOffset)
Configures the eDMA channel TCD major offset feature.
Definition: fsl_edma.c:276
void EDMA_ClearChannelStatusFlags(DMA_Type *base, uint32_t channel, uint32_t mask)
Clears the eDMA channel status flags.
Definition: fsl_edma.c:791
edma_callback callback
Definition: fsl_edma.h:245
_edma_interrupt_enable
eDMA interrupt source
Definition: fsl_edma.h:126
_edma_transfer_size
eDMA transfer configuration
Definition: fsl_edma.h:34
void EDMA_TcdSetMinorOffsetConfig(edma_tcd_t *tcd, const edma_minor_offset_config_t *config)
Configures the eDMA TCD minor offset feature.
Definition: fsl_edma.c:553
bool enableDebugMode
Definition: fsl_edma.h:159
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.
Definition: fsl_edma.c:998
__IO uint16_t CSR
Definition: fsl_edma.h:215
__IO uint16_t BITER
Definition: fsl_edma.h:216
void EDMA_InstallTCDMemory(edma_handle_t *handle, edma_tcd_t *tcdPool, uint32_t tcdSize)
Installs the TCDs memory pool into the eDMA handle.
Definition: fsl_edma.c:896
volatile int8_t tcdUsed
Definition: fsl_edma.h:252
uint32_t minorOffset
Definition: fsl_edma.h:195
enum _edma_modulo edma_modulo_t
eDMA modulo configuration
uint32_t EDMA_GetChannelStatusFlags(DMA_Type *base, uint32_t channel)
Gets the eDMA channel status flags.
Definition: fsl_edma.c:767
uint32_t destAddr
Definition: fsl_edma.h:171
__IO uint32_t SLAST
Definition: fsl_edma.h:210
volatile int8_t tcdSize
Definition: fsl_edma.h:254
edma_tcd_t * tcdPool
Definition: fsl_edma.h:248
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.
Definition: fsl_edma.c:1052
__IO uint32_t DLAST_SGA
Definition: fsl_edma.h:214
edma_transfer_size_t srcTransferSize
Definition: fsl_edma.h:172
struct _edma_minor_offset_config edma_minor_offset_config_t
eDMA minor offset configuration
struct _edma_config edma_config_t
eDMA global configuration structure.
status_t EDMA_SubmitTransfer(edma_handle_t *handle, const edma_transfer_config_t *config)
Submits the eDMA transfer request.
Definition: fsl_edma.c:1106
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.
Definition: fsl_edma.c:324
__IO uint16_t CITER
Definition: fsl_edma.h:213
bool enableHaltOnError
Definition: fsl_edma.h:155
void EDMA_SetCallback(edma_handle_t *handle, edma_callback callback, void *userData)
Installs a callback function for the eDMA transfer.
Definition: fsl_edma.c:928
bool enablePreemptAbility
Definition: fsl_edma.h:186
void EDMA_GetDefaultConfig(edma_config_t *config)
Gets the eDMA default configuration structure.
Definition: fsl_edma.c:172
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.
Definition: fsl_edma.c:651
uint32_t minorLoopBytes
Definition: fsl_edma.h:178
enum _edma_transfer_size edma_transfer_size_t
eDMA transfer configuration
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.
Definition: fsl_edma.c:365
__IO uint32_t SADDR
Definition: fsl_edma.h:206
bool enableChannelPreemption
Definition: fsl_edma.h:185
void EDMA_SetTransferConfig(DMA_Type *base, uint32_t channel, const edma_transfer_config_t *config, edma_tcd_t *nextTcd)
Configures the eDMA transfer attribute.
Definition: fsl_edma.c:228
void EDMA_StartTransfer(edma_handle_t *handle)
eDMA starts transfer.
Definition: fsl_edma.c:1282
bool enableRoundRobinArbitration
Definition: fsl_edma.h:157
struct _edma_channel_Preemption_config edma_channel_Preemption_config_t
eDMA channel priority configuration
uint8_t channel
Definition: fsl_edma.h:249
__IO uint16_t DOFF
Definition: fsl_edma.h:212
bool enableDestMinorOffset
Definition: fsl_edma.h:194
enum _edma_bandwidth edma_bandwidth_t
Bandwidth control.
__IO uint16_t SOFF
Definition: fsl_edma.h:207
uint32_t srcAddr
Definition: fsl_edma.h:170
__IO uint32_t NBYTES
Definition: fsl_edma.h:209
bool enableSrcMinorOffset
Definition: fsl_edma.h:193
volatile int8_t tail
Definition: fsl_edma.h:251
enum _edma_channel_link_type edma_channel_link_type_t
Channel link type.
void EDMA_TcdSetTransferConfig(edma_tcd_t *tcd, const edma_transfer_config_t *config, edma_tcd_t *nextTcd)
Configures the eDMA TCD transfer attribute.
Definition: fsl_edma.c:492
uint8_t flags
Definition: fsl_edma.h:255
__IO uint16_t ATTR
Definition: fsl_edma.h:208
void(* edma_callback)(struct _edma_handle *handle, void *userData, bool transferDone, uint32_t tcds)
Define callback function for eDMA.
Definition: fsl_edma.h:240
enum _edma_transfer_type edma_transfer_type_t
eDMA transfer type
void EDMA_CreateHandle(edma_handle_t *handle, DMA_Type *base, uint32_t channel)
Creates the eDMA handle.
Definition: fsl_edma.c:842
void EDMA_SetMinorOffsetConfig(DMA_Type *base, uint32_t channel, const edma_minor_offset_config_t *config)
Configures the eDMA minor offset feature.
Definition: fsl_edma.c:251
void * userData
Definition: fsl_edma.h:246
void EDMA_HandleIRQ(edma_handle_t *handle)
eDMA IRQ handler for the current major loop transfer completion.
Definition: fsl_edma.c:1398
void EDMA_ResetChannel(DMA_Type *base, uint32_t channel)
Sets all TCD registers to default values.
Definition: fsl_edma.c:196
void EDMA_SetBandWidth(DMA_Type *base, uint32_t channel, edma_bandwidth_t bandWidth)
Sets the bandwidth for the eDMA transfer.
Definition: fsl_edma.c:346
void EDMA_Init(DMA_Type *base, const edma_config_t *config)
Initializes the eDMA peripheral.
Definition: fsl_edma.c:120
void EDMA_TcdEnableInterrupts(edma_tcd_t *tcd, uint32_t mask)
Enables the interrupt source for the eDMA TCD.
Definition: fsl_edma.c:669
@ kStatus_EDMA_QueueFull
Definition: fsl_edma.h:144
@ kStatus_EDMA_Busy
Definition: fsl_edma.h:145
@ kEDMA_Modulo128Mbytes
Definition: fsl_edma.h:73
@ kEDMA_Modulo512Mbytes
Definition: fsl_edma.h:75
@ kEDMA_Modulo1Gbytes
Definition: fsl_edma.h:76
@ kEDMA_Modulo4bytes
Definition: fsl_edma.h:48
@ kEDMA_Modulo16Mbytes
Definition: fsl_edma.h:70
@ kEDMA_Modulo1Mbytes
Definition: fsl_edma.h:66
@ kEDMA_Modulo4Mbytes
Definition: fsl_edma.h:68
@ kEDMA_Modulo256Mbytes
Definition: fsl_edma.h:74
@ kEDMA_Modulo8Kbytes
Definition: fsl_edma.h:59
@ kEDMA_Modulo512bytes
Definition: fsl_edma.h:55
@ kEDMA_Modulo2Mbytes
Definition: fsl_edma.h:67
@ kEDMA_Modulo16Kbytes
Definition: fsl_edma.h:60
@ kEDMA_Modulo1Kbytes
Definition: fsl_edma.h:56
@ kEDMA_Modulo8bytes
Definition: fsl_edma.h:49
@ kEDMA_Modulo64Kbytes
Definition: fsl_edma.h:62
@ kEDMA_Modulo2Gbytes
Definition: fsl_edma.h:77
@ kEDMA_Modulo256bytes
Definition: fsl_edma.h:54
@ kEDMA_ModuloDisable
Definition: fsl_edma.h:46
@ kEDMA_Modulo16bytes
Definition: fsl_edma.h:50
@ kEDMA_Modulo128bytes
Definition: fsl_edma.h:53
@ kEDMA_Modulo32bytes
Definition: fsl_edma.h:51
@ kEDMA_Modulo2Kbytes
Definition: fsl_edma.h:57
@ kEDMA_Modulo8Mbytes
Definition: fsl_edma.h:69
@ kEDMA_Modulo32Mbytes
Definition: fsl_edma.h:71
@ kEDMA_Modulo256Kbytes
Definition: fsl_edma.h:64
@ kEDMA_Modulo4Kbytes
Definition: fsl_edma.h:58
@ kEDMA_Modulo64Mbytes
Definition: fsl_edma.h:72
@ kEDMA_Modulo32Kbytes
Definition: fsl_edma.h:61
@ kEDMA_Modulo64bytes
Definition: fsl_edma.h:52
@ kEDMA_Modulo2bytes
Definition: fsl_edma.h:47
@ kEDMA_Modulo128Kbytes
Definition: fsl_edma.h:63
@ kEDMA_Modulo512Kbytes
Definition: fsl_edma.h:65
@ kEDMA_BandwidthStall4Cycle
Definition: fsl_edma.h:84
@ kEDMA_BandwidthStall8Cycle
Definition: fsl_edma.h:85
@ kEDMA_BandwidthStallNone
Definition: fsl_edma.h:83
@ kEDMA_PeripheralToMemory
Definition: fsl_edma.h:136
@ kEDMA_MemoryToPeripheral
Definition: fsl_edma.h:137
@ kEDMA_PeripheralToPeripheral
Definition: fsl_edma.h:138
@ kEDMA_MemoryToMemory
Definition: fsl_edma.h:135
@ kEDMA_MinorLink
Definition: fsl_edma.h:92
@ kEDMA_MajorLink
Definition: fsl_edma.h:93
@ kEDMA_LinkNone
Definition: fsl_edma.h:91
@ kEDMA_MajorInterruptEnable
Definition: fsl_edma.h:128
@ kEDMA_HalfInterruptEnable
Definition: fsl_edma.h:129
@ kEDMA_ErrorInterruptEnable
Definition: fsl_edma.h:127
@ kEDMA_TransferSize16Bytes
Definition: fsl_edma.h:39
@ kEDMA_TransferSize8Bytes
Definition: fsl_edma.h:38
@ kEDMA_TransferSize4Bytes
Definition: fsl_edma.h:37
@ kEDMA_TransferSize2Bytes
Definition: fsl_edma.h:36
@ kEDMA_TransferSize1Bytes
Definition: fsl_edma.h:35
@ kEDMA_TransferSize32Bytes
Definition: fsl_edma.h:40
@ kEDMA_ErrorFlag
Definition: fsl_edma.h:100
@ kEDMA_DoneFlag
Definition: fsl_edma.h:99
@ kEDMA_InterruptFlag
Definition: fsl_edma.h:101
@ kEDMA_TransferCanceledFlag
Definition: fsl_edma.h:117
@ kEDMA_ErrorChannelFlag
Definition: fsl_edma.h:115
@ kEDMA_SourceAddressErrorFlag
Definition: fsl_edma.h:114
@ kEDMA_DestinationBusErrorFlag
Definition: fsl_edma.h:107
@ kEDMA_SourceBusErrorFlag
Definition: fsl_edma.h:108
@ kEDMA_ChannelPriorityErrorFlag
Definition: fsl_edma.h:116
@ kEDMA_ScatterGatherErrorFlag
Definition: fsl_edma.h:109
@ kEDMA_DestinationOffsetErrorFlag
Definition: fsl_edma.h:111
@ kEDMA_ValidFlag
Definition: fsl_edma.h:121
@ kEDMA_NbytesErrorFlag
Definition: fsl_edma.h:110
@ kEDMA_SourceOffsetErrorFlag
Definition: fsl_edma.h:113
@ kEDMA_DestinationAddressErrorFlag
Definition: fsl_edma.h:112
__IO int32_t DLAST_SGA
Definition: MIMXRT1052.h:14431
int32_t status_t
Type used for all status and error return values.
Definition: fsl_common.h:225
#define MAKE_STATUS(group, code)
Construct a status code value from a group and code number.
Definition: fsl_common.h:47
@ kStatusGroup_EDMA
Definition: fsl_common.h:123
Definition: MIMXRT1052.h:14358
eDMA channel priority configuration
Definition: fsl_edma.h:184
eDMA global configuration structure.
Definition: fsl_edma.h:151
eDMA transfer handle structure
Definition: fsl_edma.h:244
eDMA minor offset configuration
Definition: fsl_edma.h:192
eDMA TCD.
Definition: fsl_edma.h:205
eDMA transfer configuration
Definition: fsl_edma.h:169
Definition: deflate.c:114