26#define FSL_EDMA_DRIVER_VERSION (MAKE_VERSION(2, 1, 4))
30#define DMA_DCHPRI_INDEX(channel) (((channel) & ~0x03U) | (3 - ((channel)&0x03U)))
33#define DMA_DCHPRIn(base, channel) ((volatile uint8_t *)&((base)->DCHPRI3))[DMA_DCHPRI_INDEX(channel)]
121#if defined(FSL_FEATURE_EDMA_CHANNEL_GROUP_COUNT) && FSL_FEATURE_EDMA_CHANNEL_GROUP_COUNT > 1
263#if defined(__cplusplus)
392 assert(
channel < FSL_FEATURE_EDMA_MODULE_CHANNEL);
396 (DMA_DCHPRI0_DPA(!
config->enablePreemptAbility) | DMA_DCHPRI0_ECP(
config->enableChannelPreemption) |
397 DMA_DCHPRI0_CHPRI(
config->channelPriority));
448#if defined(FSL_FEATURE_EDMA_ASYNCHRO_REQUEST_CHANNEL_COUNT) && FSL_FEATURE_EDMA_ASYNCHRO_REQUEST_CHANNEL_COUNT
458 assert(
channel < FSL_FEATURE_DMAMUX_MODULE_CHANNEL);
475 assert(
channel < FSL_FEATURE_DMAMUX_MODULE_CHANNEL);
477 base->TCD[
channel].CSR = (base->TCD[
channel].CSR & (~DMA_CSR_DREQ_MASK)) | DMA_CSR_DREQ(
enable);
588 assert(((uint32_t)tcd & 0x1FU) == 0);
590 tcd->
CSR = (tcd->
CSR & (~DMA_CSR_BWC_MASK)) | DMA_CSR_BWC(bandWidth);
617 assert(((uint32_t)tcd & 0x1FU) == 0);
619 tcd->
CSR = (tcd->
CSR & (~DMA_CSR_DREQ_MASK)) | DMA_CSR_DREQ(
enable);
656 assert(
channel < FSL_FEATURE_DMAMUX_MODULE_CHANNEL);
658 base->SERQ = DMA_SERQ_SERQ(
channel);
671 assert(
channel < FSL_FEATURE_DMAMUX_MODULE_CHANNEL);
673 base->CERQ = DMA_CERQ_CERQ(
channel);
686 assert(
channel < FSL_FEATURE_DMAMUX_MODULE_CHANNEL);
688 base->SSRT = DMA_SSRT_SSRT(
channel);
818 uint32_t bytesEachRequest,
819 uint32_t transferBytes,
890 return (handle->
base->TCD[handle->
channel].DLAST_SGA);
925#if defined(__cplusplus)
static constexpr persistent_config_s * config
static void EDMA_SetChannelPreemptionConfig(DMA_Type *base, uint32_t channel, const edma_channel_Preemption_config_t *config)
Configures the eDMA channel preemption feature.
uint32_t EDMA_GetRemainingMajorLoopCount(DMA_Type *base, uint32_t channel)
Gets the remaining major loop count from the eDMA current channel TCD.
_edma_transfer_status
eDMA transfer status
static void EDMA_EnableAsyncRequest(DMA_Type *base, uint32_t channel, bool enable)
Enables an async request for the eDMA transfer.
edma_transfer_size_t destTransferSize
void EDMA_EnableChannelInterrupts(DMA_Type *base, uint32_t channel, uint32_t mask)
Enables the interrupt source for the eDMA transfer.
_edma_modulo
eDMA modulo configuration
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.
void EDMA_AbortTransfer(edma_handle_t *handle)
eDMA aborts transfer.
void EDMA_InstallTCD(DMA_Type *base, uint32_t channel, edma_tcd_t *tcd)
Push content of TCD structure into hardware TCD register.
static uint32_t EDMA_GetErrorStatusFlags(DMA_Type *base)
Gets the eDMA channel error status flags.
void EDMA_DisableChannelInterrupts(DMA_Type *base, uint32_t channel, uint32_t mask)
Disables the interrupt source for the eDMA transfer.
void EDMA_StopTransfer(edma_handle_t *handle)
eDMA stops transfer.
_edma_bandwidth
Bandwidth control.
void EDMA_Deinit(DMA_Type *base)
Deinitializes the eDMA peripheral.
static uint32_t EDMA_GetNextTCDAddress(edma_handle_t *handle)
Get the next tcd address.
struct _edma_handle edma_handle_t
eDMA transfer handle structure
bool enableContinuousLinkMode
_edma_transfer_type
eDMA transfer type
struct _edma_transfer_config edma_transfer_config_t
eDMA transfer configuration
static void EDMA_TriggerChannelStart(DMA_Type *base, uint32_t channel)
Starts the eDMA transfer by using the software trigger.
_edma_channel_link_type
Channel link type.
void EDMA_TcdReset(edma_tcd_t *tcd)
Sets all fields to default values for the TCD structure.
enum _edma_interrupt_enable edma_interrupt_enable_t
eDMA interrupt source
static void EDMA_DisableChannelRequest(DMA_Type *base, uint32_t channel)
Disables the eDMA hardware channel request.
void EDMA_ClearChannelStatusFlags(DMA_Type *base, uint32_t channel, uint32_t mask)
Clears the eDMA channel status flags.
static uint32_t EDMA_GetUnusedTCDNumber(edma_handle_t *handle)
Get unused TCD slot number.
_edma_interrupt_enable
eDMA interrupt source
_edma_transfer_size
eDMA transfer configuration
_edma_channel_status_flags
eDMA channel status flags.
void EDMA_TcdSetMinorOffsetConfig(edma_tcd_t *tcd, const edma_minor_offset_config_t *config)
Configures the eDMA TCD minor offset feature.
void EDMA_InstallTCDMemory(edma_handle_t *handle, edma_tcd_t *tcdPool, uint32_t tcdSize)
Installs the TCDs memory pool into the eDMA handle.
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.
static void EDMA_TcdSetBandWidth(edma_tcd_t *tcd, edma_bandwidth_t bandWidth)
Sets the bandwidth for the eDMA TCD.
void EDMA_SetChannelLink(DMA_Type *base, uint32_t channel, edma_channel_link_type_t type, uint32_t linkedChannel)
Sets the channel link for the eDMA transfer.
edma_transfer_size_t srcTransferSize
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.
void EDMA_SetCallback(edma_handle_t *handle, edma_callback callback, void *userData)
Installs a callback function for the eDMA transfer.
bool enablePreemptAbility
void EDMA_GetDefaultConfig(edma_config_t *config)
Gets the eDMA default configuration structure.
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.
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 type)
Prepares the eDMA transfer structure.
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.
bool enableChannelPreemption
static void EDMA_EnableChannelRequest(DMA_Type *base, uint32_t channel)
Enables the eDMA hardware channel request.
void EDMA_SetTransferConfig(DMA_Type *base, uint32_t channel, const edma_transfer_config_t *config, edma_tcd_t *nextTcd)
Configures the eDMA transfer attribute.
void EDMA_StartTransfer(edma_handle_t *handle)
eDMA starts transfer.
bool enableRoundRobinArbitration
struct _edma_channel_Preemption_config edma_channel_Preemption_config_t
eDMA channel priority configuration
void EDMA_TcdSetChannelLink(edma_tcd_t *tcd, edma_channel_link_type_t type, uint32_t linkedChannel)
Sets the channel link for the eDMA TCD.
static void EDMA_TcdEnableAutoStopRequest(edma_tcd_t *tcd, bool enable)
Sets the auto stop request for the eDMA TCD.
bool enableDestMinorOffset
enum _edma_bandwidth edma_bandwidth_t
Bandwidth control.
static void EDMA_EnableAutoStopRequest(DMA_Type *base, uint32_t channel, bool enable)
Enables an auto stop request for the eDMA transfer.
bool enableSrcMinorOffset
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.
void(* edma_callback)(struct _edma_handle *handle, void *userData, bool transferDone, uint32_t tcds)
Define callback function for eDMA.
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.
void EDMA_SetMinorOffsetConfig(DMA_Type *base, uint32_t channel, const edma_minor_offset_config_t *config)
Configures the eDMA minor offset feature.
void EDMA_HandleIRQ(edma_handle_t *handle)
eDMA IRQ handler for the current major loop transfer completion.
void EDMA_ResetChannel(DMA_Type *base, uint32_t channel)
Sets all TCD registers to default values.
void EDMA_SetBandWidth(DMA_Type *base, uint32_t channel, edma_bandwidth_t bandWidth)
Sets the bandwidth for the eDMA transfer.
void EDMA_Init(DMA_Type *base, const edma_config_t *config)
Initializes the eDMA peripheral.
_edma_error_status_flags
eDMA channel error status flags.
void EDMA_TcdEnableInterrupts(edma_tcd_t *tcd, uint32_t mask)
Enables the interrupt source for the eDMA TCD.
@ kEDMA_BandwidthStall4Cycle
@ kEDMA_BandwidthStall8Cycle
@ kEDMA_BandwidthStallNone
@ kEDMA_PeripheralToMemory
@ kEDMA_MemoryToPeripheral
@ kEDMA_MajorInterruptEnable
@ kEDMA_HalfInterruptEnable
@ kEDMA_ErrorInterruptEnable
@ kEDMA_TransferSize16Bytes
@ kEDMA_TransferSize8Bytes
@ kEDMA_TransferSize4Bytes
@ kEDMA_TransferSize2Bytes
@ kEDMA_TransferSize1Bytes
@ kEDMA_TransferSize32Bytes
@ kEDMA_TransferCanceledFlag
@ kEDMA_GroupPriorityErrorFlag
@ kEDMA_SourceAddressErrorFlag
@ kEDMA_DestinationBusErrorFlag
@ kEDMA_SourceBusErrorFlag
@ kEDMA_ChannelPriorityErrorFlag
@ kEDMA_ScatterGatherErrorFlag
@ kEDMA_DestinationOffsetErrorFlag
@ kEDMA_SourceOffsetErrorFlag
@ kEDMA_DestinationAddressErrorFlag
int32_t status_t
Type used for all status and error return values.
static void enable(const char *param)
eDMA channel priority configuration
eDMA global configuration structure.
eDMA transfer handle structure
eDMA minor offset configuration
eDMA transfer configuration