MCUXpresso SDK API Reference Manual
Rev. 0
NXP Semiconductors
|
This document consists of sections titled with Driver Overview, Data Structures, Enumerations, Functions, etc., each with an overview list and detailed documentation. It is recommended to read the Driver Overview first for it includes a comprehensive description of the peripheral, driver and driver changes. Other sections give detailed information for APIs, enums, macros, etc., for your further reference.
Driver Overview | |
EDMA Peripheral and Driver Overview | |
Content including 1) peripheral features, work logic and work method; 2) driver design logic and use method; 3) typical use case. | |
The Driver Change Log | |
The current eDMA driver version is 2.0.0. | |
Data Structures | |
struct | edma_channel_Preemption_config_t |
eDMA channel priority configuration, useful to the fixed priority arbitration type More... | |
struct | edma_channel_transfer_config_t |
edma channel transfer configuration More... | |
struct | edma_channel_tcd_t |
eDMA software Transfer control descriptor structure. More... | |
struct | edma_config_t |
edma configuration structure More... | |
struct | edma_handle_t |
eDMA transfer handle structure More... | |
Macros | |
#define | EDMA_ENTER_CRITICAL_SECTION() |
edma transactional tcd pool resource protection lock definition Application should overwrite below two macros if multi task trying to access the same channel. | |
#define | DMA_DCHPRI_INDEX(channel) (((channel) & ~0x03U) | (3U - ((channel)&0x03U))) |
Compute the offset unit from DCHPRI3. | |
Typedefs | |
typedef void(* | edma_transfer_callback_t )(edma_handle_t *psHandle, void *pUserData, bool bTransferDone, uint32_t u32Tcds) |
Define callback function for eDMA. More... | |
eDMA Initialization and De-initialization interfaces | |
void | EDMA_GetDefaultConfig (edma_config_t *psConfig) |
Get default edma peripheral configuration. More... | |
void | EDMA_Init (DMA_Type *base, edma_config_t *psConfig) |
EDMA initialization. More... | |
void | EDMA_Deinit (DMA_Type *base) |
EDMA De-initialization. More... | |
eDMA non-channel functional interfaces | |
static void | EDMA_EnableContinuousChannelLinkMode (DMA_Type *base, bool bEnable) |
Enable/Disable arbitration before the channel been activate by minor loop link trigger from itself. More... | |
static void | EDMA_EnableMinorLoopMapping (DMA_Type *base, bool bEnable) |
Enable/Disable redefine the minor loop bytes register. More... | |
static void | EDMA_EnableHaltOnError (DMA_Type *base, bool bEnable) |
Enable/Disable the eDMA halt when error occur feature. More... | |
static void | EDMA_SetArbitration (DMA_Type *base, edma_arbitration_type_t eArbitration) |
set EDMA arbitration type to fixed priority or round robin. More... | |
eDMA channel functional interfaces | |
void | EDMA_GetChannelDefaultTransferConfig (edma_channel_transfer_config_t *psTransfer, void *pSrcAddr, void *pDstAddr, uint32_t u32BytesEachRequest, uint32_t u32TotalBytes, edma_channel_transfer_width_t eTransferWidth, edma_channel_transfer_type_t eTransferType) |
Get channel default transfer configuration. More... | |
void | EDMA_SetChannelTransferConfig (DMA_Type *base, edma_channel_t eChannel, edma_channel_transfer_config_t *psTransfer) |
EDMA set channel transfer configurations. More... | |
void | EDMA_SetChannelMinorLoopOffset (DMA_Type *base, edma_channel_t eChannel, bool bEnableSrcMinorLoopOffset, bool bEnableDestMinorLoopOffset, int32_t i32MinorLoopOffset) |
Configures the eDMA channel minor loop offset value. More... | |
void | EDMA_SetChannelPreemption (DMA_Type *base, edma_channel_t eChannel, bool bSuspendedByHighPriorityChannel, bool bSuspendLowPriorityChannel, uint8_t u8Priority) |
Configures the eDMA channel preemption configurations. More... | |
void | EDMA_EnableMinorLoopChannelLink (DMA_Type *base, edma_channel_t eChannel, edma_channel_t eLinkChannel) |
Enable the minor loop channel link and configure the linked channel number. More... | |
static void | EDMA_DisableMinorLoopChannelLink (DMA_Type *base, edma_channel_t eChannel) |
Disable the minor loop channel link for the eDMA transfer. More... | |
void | EDMA_EnableMajorLoopChannelLink (DMA_Type *base, edma_channel_t eChannel, edma_channel_t eLinkChannel) |
Enable the major loop channel link and configure the linked channel number. More... | |
static void | EDMA_DisableMajorLoopChannelLink (DMA_Type *base, edma_channel_t eChannel) |
Disable the major loop channel link for the eDMA transfer. More... | |
void | EDMA_SetChannelBandWidth (DMA_Type *base, edma_channel_t eChannel, edma_channel_bandwidth_t eBandWidth) |
Sets the edma channel stall cycles after each R/W. More... | |
void | EDMA_SetChannelModulo (DMA_Type *base, edma_channel_t eChannel, edma_channel_modulo_t eSrcModulo, edma_channel_modulo_t eDestModulo) |
Sets the source address range and the destination address range for the eDMA transfer. More... | |
static void | EDMA_EnableChannelAsyncRequestInStopMode (DMA_Type *base, edma_channel_t eChannel, bool bEnable) |
Enables the edma channel async request in stop mode. More... | |
static void | EDMA_EnableChannelAutoStopRequest (DMA_Type *base, edma_channel_t eChannel, bool bEnable) |
Enables the edma channel auto disable request after major loop complete. More... | |
void | EDMA_SetChannelMajorLoopOffset (DMA_Type *base, edma_channel_t eChannel, int32_t i32SourceOffset, int32_t i32DestOffset) |
Configures the eDMA channel major loop offset feature. More... | |
static void | EDMA_EnableChannelRequest (DMA_Type *base, edma_channel_t eChannel, bool bEnable) |
Enable/disable the eDMA hardware channel request. More... | |
static void | EDMA_SoftwareTriggerChannelStart (DMA_Type *base, edma_channel_t eChannel) |
Starts the eDMA transfer by using the software trigger. More... | |
uint32_t | EDMA_GetChannelRemainingMajorLoopCount (DMA_Type *base, edma_channel_t eChannel) |
Gets the remaining major loop count from the eDMA current channel TCD. More... | |
eDMA Channel interrupt Interfaces | |
void | EDMA_EnableChannelInterrupts (DMA_Type *base, edma_channel_t eChannel, uint16_t u16InterruptsMask, bool bEnable) |
Enables the edma channel interrupts according to a provided mask, the mask is a logical OR of enumerator members _edma_channel_interrupt_enable. More... | |
eDMA Channel Status Interfaces | |
uint16_t | EDMA_GetChannelStatusFlags (DMA_Type *base, edma_channel_t eChannel) |
Gets the eDMA channel status flags. More... | |
void | EDMA_ClearChannelStatusFlags (DMA_Type *base, edma_channel_t eChannel, uint16_t u16StatusFlags) |
Clears the eDMA channel status flags. More... | |
static uint32_t | EDMA_GetErrorStatusFlags (DMA_Type *base) |
Gets the eDMA channel error status flags. More... | |
eDMA software TCD Interfaces | |
void | EDMA_ConfigChannelSoftwareTCD (edma_channel_tcd_t *psTcd, edma_channel_transfer_config_t *psTransfer) |
Sets TCD fields according to the user's channel transfer configuration structure, edma_channel_transfer_config_t. More... | |
void | EDMA_InstallChannelSoftwareTCD (DMA_Type *base, edma_channel_t eChannel, edma_channel_tcd_t *psTcd) |
Push content of software TCD structure into hardware TCD register. More... | |
eDMA Transactional Interfaces | |
void | EDMA_TransferCreateHandle (DMA_Type *base, edma_handle_t *psHandle, edma_channel_t eChannel, edma_channel_tcd_t *psTcdPool, uint32_t u32TcdCount, edma_transfer_callback_t pfCallback, void *pUserData) |
Creates the eDMA channel handle. More... | |
status_t | EDMA_TransferSubmitSingleTransfer (edma_handle_t *psHandle, edma_channel_transfer_config_t *psTransfer) |
Submits the eDMA single transfer configuration. More... | |
status_t | EDMA_TransferSubmitLoopTransfer (edma_handle_t *psHandle, edma_channel_transfer_config_t *psTransfer, uint32_t transferLoopCount) |
Submits the eDMA scatter gather transfer configurations. More... | |
void | EDMA_TransferStart (edma_handle_t *psHandle) |
eDMA starts transfer. More... | |
void | EDMA_TransferStop (edma_handle_t *psHandle) |
eDMA stops transfer. More... | |
void | EDMA_TransferAbort (edma_handle_t *psHandle) |
eDMA aborts transfer. More... | |
void | EDMA_TransferHandleIRQ (edma_handle_t *psHandle) |
eDMA IRQ handler for the current major loop transfer completion. More... | |
struct edma_channel_Preemption_config_t |
Data Fields | |
bool | bSuspendedByHighPriorityChannel: 1 |
a channel can be suspended by other channel with higher priority | |
bool | bSuspendLowPriorityChannel: 1 |
a channel can suspend other channel with low priority | |
uint8_t | u8ChannelPriority: 5 |
Channel priority. | |
struct edma_channel_transfer_config_t |
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 .pSrcAddr - source address .pDstAddr - destination address .eSrcWidthOfEachTransfer - data width of source address .eDstWidthOfEachTransfer - data width of destination address, normally it should be as same as eSrcWidthOfEachTransfer .u32BytesEachRequest - bytes to be transferred in each DMA request .u32TotalBytes - total bytes to be transferred .i16SrcOffsetOfEachTransfer - offset value in bytes unit to be applied to source address as each source read is completed .i16DstOffsetOfEachTransfer - offset value in bytes unit to be applied to destination address as each destination write is completed bEnableChannelRequest - 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 | |
void * | pSrcAddr |
source address | |
void * | pDstAddr |
destination address | |
edma_channel_transfer_width_t | eSrcWidthOfEachTransfer |
source width of each transfer | |
edma_channel_transfer_width_t | eDstWidthOfEachTransfer |
destination width of each transfer | |
uint32_t | u32BytesEachMinorLoop |
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 | |
uint16_t | u16MinorLoopCountsEachMajorLoop |
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 = u16MinorLoopCountsEachMajorLoop * u32BytesEachMinorLoop | |
uint16_t | u16EnabledInterruptMask |
channel interrupt to enable, can be OR'ed value of _edma_channel_interrupt_enable | |
int16_t | i16SrcOffsetOfEachTransfer |
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 | |
edma_channel_modulo_t | eSrcAddrModulo |
source circular data queue range | |
int32_t | i32SrcMajorLoopOffset |
source major loop offset | |
int16_t | i16DstOffsetOfEachTransfer |
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. More... | |
edma_channel_modulo_t | eDstAddrModulo |
destination circular data queue range | |
int32_t | i32DstMajorLoopOffset |
destination major loop offset | |
bool | bEnableSrcMinorLoopOffset |
enable source minor loop offset | |
bool | bEnableDstMinorLoopOffset |
enable dest minor loop offset | |
int32_t | i32MinorLoopOffset |
burst offset, the offset will be applied after minor loop update | |
bool | bEnableChannelMajorLoopLink |
channel link when major loop complete | |
edma_channel_t | eMajorLoopLinkChannel |
major loop link channel number | |
bool | bEnableChannelMinorLoopLink |
channel link when minor loop complete | |
edma_channel_t | eMinorLoopLinkChannel |
minor loop link channel number | |
edma_channel_bandwidth_t | eChannelBandWidth |
channel bandwidth | |
bool | bDisableRequestAfterMajorLoopComplete |
the channel's ERQ bit can be cleared after the major loop complete automatically | |
bool | bEnableChannelRequest |
enable the channel request signal | |
edma_channel_tcd_t * | psLinkTCD |
pointer to the link transfer control descriptor | |
int16_t edma_channel_transfer_config_t::i16DstOffsetOfEachTransfer |
struct _edma_channel_tcd |
edma channel software tcd definition
This structure is same as eDMA hardware channel TCD registers, user doesn't need to understand the structures, since eDMA driver will responsible for configure it.
The software TCD is useful to configure a software TCD which is linked by the channel hardware TCD to have scatter/gather feature without using transactional interface.
Data Fields | |
__IO uint32_t | u32SADDR |
SADDR register, used to save source address. | |
__IO uint16_t | u16SOFF |
SOFF register, offset bytes added to source address every transfer. | |
__IO uint16_t | u16ATTR |
ATTR register, source/destination transfer size and modulo. | |
__IO uint32_t | u32NBYTES |
Nbytes register, minor loop length in bytes. | |
__IO uint32_t | u32SLAST |
SLAST register, adjustment value added to the source address at the completion of the major loop. | |
__IO uint32_t | u32DADDR |
DADDR register, used for destination address. | |
__IO uint16_t | u16DOFF |
DOFF register, offset bytes added to destination address every transfer. | |
__IO uint16_t | u16CITER |
CITER register, current minor loop numbers, for unfinished minor loop. More... | |
__IO uint32_t | u32DLAST_SGA |
DLASTSGA register, next tcd address used in scatter-gather mode. | |
__IO uint16_t | u16CSR |
CSR register, for TCD control status. | |
__IO uint16_t | u16BITER |
BITER register, begin minor loop count. More... | |
__IO uint16_t edma_channel_tcd_t::u16CITER |
__IO uint16_t edma_channel_tcd_t::u16BITER |
struct edma_config_t |
This structure target for whole edma module configurations.
Data Fields | |
bool | bEnableContinuousLinkMode |
Enable (true) continuous link mode. More... | |
bool | bEnableHaltOnError |
Enable (true) transfer halt on error. More... | |
bool | bEnableDmaInDebugMode |
Enable(true) eDMA debug mode. More... | |
bool | bEnableMinorLoopMapping |
TCDn.word2 is redefined to include individual enable fields, an offset field, and the NBYTES field. More... | |
edma_arbitration_type_t | eArbitrationType |
Enable (true) round robin channel arbitration method or fixed priority arbitration is used for channel selection. | |
edma_channel_Preemption_config_t | sChannelPreemptionConfig [FSL_FEATURE_EDMA_MODULE_CHANNEL] |
channel preemption configuration | |
edma_channel_transfer_config_t * | psChannelTransferConfig [FSL_FEATURE_EDMA_MODULE_CHANNEL] |
channel transfer configuration pointer | |
bool edma_config_t::bEnableContinuousLinkMode |
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::bEnableHaltOnError |
Any error causes the HALT bit to set. Subsequently, all service requests are ignored until the HALT bit is cleared.
bool edma_config_t::bEnableDmaInDebugMode |
When in debug mode, the eDMA stalls the start of a new channel. Executing channels are allowed to complete.
bool edma_config_t::bEnableMinorLoopMapping |
The individual enable fields allow the minor loop offset to be applied to the source address, the destination address, or both. The NBYTES field is reduced when either offset is enabled
struct _edma_handle |
handler for eDMA
Data Fields | |
edma_transfer_callback_t | pfCallback |
Callback function for major count exhausted. More... | |
void * | pUserData |
Callback function parameter. More... | |
DMA_Type * | psBase |
eDMA peripheral base address. More... | |
edma_channel_tcd_t * | psTcdPool |
Pointer to memory stored TCDs. More... | |
edma_channel_t | eChannel |
eDMA channel number. More... | |
volatile uint8_t | u8Header |
The first TCD index. More... | |
volatile uint8_t | u8Tail |
The last TCD index. More... | |
volatile uint8_t | u8TcdUsed |
The number of used TCD slots. More... | |
volatile uint8_t | u8TcdSize |
The total number of TCD slots in the queue. More... | |
edma_transfer_callback_t edma_handle_t::pfCallback |
void* edma_handle_t::pUserData |
DMA_Type* edma_handle_t::psBase |
edma_channel_tcd_t* edma_handle_t::psTcdPool |
edma_channel_t edma_handle_t::eChannel |
volatile uint8_t edma_handle_t::u8Header |
Should point to the next TCD to be loaded into the eDMA engine.
volatile uint8_t edma_handle_t::u8Tail |
Should point to the next TCD to be stored into the memory pool.
volatile uint8_t edma_handle_t::u8TcdUsed |
Should reflect the number of TCDs can be used/loaded in the memory.
volatile uint8_t edma_handle_t::u8TcdSize |
typedef void(* edma_transfer_callback_t)(edma_handle_t *psHandle, void *pUserData, bool bTransferDone, uint32_t u32Tcds) |
This callback function is called in the EDMA interrupt handler function. In normal mode, running 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. |
The eDMA peripheral support generate interrupt when half of the total request bytes transferred or all of the request bytes transferred.
enum edma_channel_t |
The eDMA modulo feature can be used to specify the address range of the source/destination address, it is useful to implement a circular data queue.
Generally, as the eDMA processes the minor loop, it continuously generates read/write sequences until the minor count is exhausted. This bandwidth field forces the eDMA to stall after the completion of each read/write access to control the bus request bandwidth.
The default configuration is kEDMA_BandwidthStallNone.
void EDMA_GetDefaultConfig | ( | edma_config_t * | psConfig | ) |
psConfig | pointer to user's eDMA config structure, see edma_config_t for detail. |
void EDMA_Init | ( | DMA_Type * | base, |
edma_config_t * | psConfig | ||
) |
base | eDMA peripheral base address. |
psConfig | pointer to user's eDMA config structure, see edma_transfer_config_t for detail. |
void EDMA_Deinit | ( | DMA_Type * | base | ) |
base | eDMA peripheral base address. |
|
inlinestatic |
A minor loop channel link made to itself does not go through channel arbitration before being activated again. Upon minor loop completion, the channel activates again if that channel has a minor loop channel link enabled and the link channel is itself. This effectively applies the minor loop offsets and restarts the next minor loop.
base | EDMA peripheral base address. |
bEnable | true is channel link to itself without arbitration false is channel link to itself with arbitration |
|
inlinestatic |
The TCDn.word2 is redefined to include individual enable fields, an offset field and the NBYTES field, the offset will be applied to source/destination address after minor loop complete
base | EDMA peripheral base address. |
bEnable | true is minor loop bytes register redefined to individual enable/offset/minor loop bytes fields. false is minor loop bytes register defined as minor loop bytes fields only. |
|
inlinestatic |
Any error causes the HALT bit to set will cause the EDMA halt. Subsequently, all service requests are ignored until the HALT bit is cleared
base | EDMA peripheral base address. |
bEnable | true is Stall the start of any new channels when error occur. false is eDMA service request operation normal when error occur. |
|
inlinestatic |
base | EDMA peripheral base address. |
eArbitration,arbitration | by priority or round robin, edma_arbitration_type_t. |
void EDMA_GetChannelDefaultTransferConfig | ( | edma_channel_transfer_config_t * | psTransfer, |
void * | pSrcAddr, | ||
void * | pDstAddr, | ||
uint32_t | u32BytesEachRequest, | ||
uint32_t | u32TotalBytes, | ||
edma_channel_transfer_width_t | eTransferWidth, | ||
edma_channel_transfer_type_t | eTransferType | ||
) |
psConfig | pointer to user's eDMA channel configure structure, see edma_channel_transfer_config_t for detail. |
pSrcAddr | source address, must be byte address. |
pDstAddr | destination address, must be byte address. |
u32BytesEachRequest | bytes to be transferred in each request(namely, in each minor loop). |
u32TotalBytes | total bytes to be transferred. |
eTransferWidth,it | represents how many bits are transferred in each read/write. |
eTransferType | eDMA channel transfer type. |
void EDMA_SetChannelTransferConfig | ( | DMA_Type * | base, |
edma_channel_t | eChannel, | ||
edma_channel_transfer_config_t * | psTransfer | ||
) |
base | eDMA peripheral base address. |
eChannel | eDMA channel number. |
psTransfer | pointer to user's eDMA channel configure structure, see edma_channel_transfer_config_t for detail. |
void EDMA_SetChannelMinorLoopOffset | ( | DMA_Type * | base, |
edma_channel_t | eChannel, | ||
bool | bEnableSrcMinorLoopOffset, | ||
bool | bEnableDestMinorLoopOffset, | ||
int32_t | i32MinorLoopOffset | ||
) |
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. |
eChannel | eDMA channel number. |
bEnableSrcMinorLoopOffset,true | is enable source address minor offset, otherwise is disable |
bEnableDestMinorLoopOffset,true | is enable source address minor offset, otherwise is disable |
i32MinorLoopOffset,minor | loop offset value. |
void EDMA_SetChannelPreemption | ( | DMA_Type * | base, |
edma_channel_t | eChannel, | ||
bool | bSuspendedByHighPriorityChannel, | ||
bool | bSuspendLowPriorityChannel, | ||
uint8_t | u8Priority | ||
) |
This function configures the channel preemption attribute and the priority of the channel.
base | eDMA peripheral base address. |
eChannel | eDMA channel number |
bSuspendedByHighPriorityChannel,true | is the channel can be suspended by high priority channel, otherwise cannot. |
bSuspendLowPriorityChannel,true | is the channel can suspend low priority channel, otherwise cannot. |
priority,channel | priority. |
void EDMA_EnableMinorLoopChannelLink | ( | DMA_Type * | base, |
edma_channel_t | eChannel, | ||
edma_channel_t | eLinkChannel | ||
) |
This function configures the minor link mode. The minor link means that the channel link is triggered every time that the minor loop bytes transferred complete.
base | eDMA peripheral base address. |
eChannel | eDMA channel number. |
eLinkChannel | The linked channel number. |
|
inlinestatic |
base | eDMA peripheral base address. |
eChannel | eDMA channel number. |
void EDMA_EnableMajorLoopChannelLink | ( | DMA_Type * | base, |
edma_channel_t | eChannel, | ||
edma_channel_t | eLinkChannel | ||
) |
This function configures the major link mode. The major link means that the channel link is triggered when the CITER is exhausted.
base | eDMA peripheral base address. |
eChannel | eDMA channel number. |
eLinkChannel | The linked channel number. |
|
inlinestatic |
base | eDMA peripheral base address. |
eChannel | eDMA channel number. |
void EDMA_SetChannelBandWidth | ( | DMA_Type * | base, |
edma_channel_t | eChannel, | ||
edma_channel_bandwidth_t | eBandWidth | ||
) |
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. |
eChannel | eDMA channel number. |
eBandWidth | A bandwidth setting, which can be one of the |
void EDMA_SetChannelModulo | ( | DMA_Type * | base, |
edma_channel_t | eChannel, | ||
edma_channel_modulo_t | eSrcModulo, | ||
edma_channel_modulo_t | eDestModulo | ||
) |
This function defines a specific address range of source/destination address, after the source/destination address hits the range boundary, source/destination address will wrap to origin value.
Setting this field provides the ability to implement a circular data queue easily. For data queues require loop power-of-2 size bytes, the queue should start at a 0-modulo-size address and the SMOD field should be set to the appropriate value for the queue, freezing the desired number of upper address bits. The value programmed into this field specifies the number of lower address bits allowed to change
base | eDMA peripheral base address. |
eChannel | eDMA channel number. |
eSrcModulo | A source modulo value. |
eDestModulo | A destination modulo value. |
|
inlinestatic |
The EARS register is used to enable or disable the DMA requests in Enable Request Register (ERQ) by AND'ing the bits of these two registers in stop mode only.
base | eDMA peripheral base address. |
eChannel | eDMA channel number. |
bEnable | The command to enable (true) or disable (false). |
|
inlinestatic |
The eDMA hardware automatically clears the corresponding ERQ bit when the current major iteration count reaches zero.
base | eDMA peripheral base address. |
eChannel | eDMA channel number. |
bEnable | The command to enable (true) or disable (false). |
void EDMA_SetChannelMajorLoopOffset | ( | DMA_Type * | base, |
edma_channel_t | eChannel, | ||
int32_t | i32SourceOffset, | ||
int32_t | i32DestOffset | ||
) |
Adjustment value added to the source/destination address at the completion of the major iteration count
base | eDMA peripheral base address. |
eChannel | edma channel number. |
i32SourceOffset | source address offset. |
i32DestOffset | destination address offset. |
|
inlinestatic |
This function enables the hardware channel request.
base | eDMA peripheral base address. |
eChannel | eDMA channel number. |
bEnable | true is start, false is stop. |
|
inlinestatic |
This function starts a minor loop transfer only, the channel will halt when minor loop complete, so application should re-call the function to start the transfer again.
base | eDMA peripheral base address. |
eChannel | eDMA channel number. |
uint32_t EDMA_GetChannelRemainingMajorLoopCount | ( | DMA_Type * | base, |
edma_channel_t | eChannel | ||
) |
This function checks the TCD (Transfer 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. |
Major | loop count which has not been transferred yet for the current TCD. |
void EDMA_EnableChannelInterrupts | ( | DMA_Type * | base, |
edma_channel_t | eChannel, | ||
uint16_t | u16InterruptsMask, | ||
bool | bEnable | ||
) |
base | eDMA peripheral base address. |
eChannel | eDMA channel number. |
u16InterruptsMask | the mask is a logical OR of enumerator members see _edma_channel_interrupt_enable. |
bEnable | true is enable, false is disable. |
uint16_t EDMA_GetChannelStatusFlags | ( | DMA_Type * | base, |
edma_channel_t | eChannel | ||
) |
base | eDMA peripheral base address. |
eChannel | eDMA channel number. |
The | mask of channel status flags. Users need to use the _edma_channel_status_flags type to decode the return variables. |
void EDMA_ClearChannelStatusFlags | ( | DMA_Type * | base, |
edma_channel_t | eChannel, | ||
uint16_t | u16StatusFlags | ||
) |
base | eDMA peripheral base address. |
eChannel | eDMA channel number. |
u16StatusFlags | The mask of channel status to be cleared. Users need to use the defined _edma_channel_status_flags type. |
|
inlinestatic |
base | eDMA peripheral base address. |
void EDMA_ConfigChannelSoftwareTCD | ( | edma_channel_tcd_t * | psTcd, |
edma_channel_transfer_config_t * | psTransfer | ||
) |
Application should be careful about the TCD pool buffer storage class,
psTcd | Pointer to the TCD structure. |
psTransfer | channel transfer configuration pointer. |
void EDMA_InstallChannelSoftwareTCD | ( | DMA_Type * | base, |
edma_channel_t | eChannel, | ||
edma_channel_tcd_t * | psTcd | ||
) |
base | EDMA peripheral base address. |
eChannel | EDMA channel number. |
psTcd | Point to TCD structure. |
void EDMA_TransferCreateHandle | ( | DMA_Type * | base, |
edma_handle_t * | psHandle, | ||
edma_channel_t | eChannel, | ||
edma_channel_tcd_t * | psTcdPool, | ||
uint32_t | u32TcdCount, | ||
edma_transfer_callback_t | pfCallback, | ||
void * | pUserData | ||
) |
This function is called if using the transactional API for eDMA. This function initializes the internal state of the eDMA handle.
base | eDMA peripheral base address. |
handle | eDMA handle pointer. The eDMA handle stores callback function and parameters. |
channel | eDMA channel number. |
psTcdPool | A memory pool to store TCDs. It must be 32 bytes aligned. |
u32TcdCount | The number of TCD slots. |
callback | eDMA callback function pointer. |
userData | A parameter for the callback function. |
status_t EDMA_TransferSubmitSingleTransfer | ( | edma_handle_t * | psHandle, |
edma_channel_transfer_config_t * | psTransfer | ||
) |
Application can submit single transfer when
It is suggest that application should check the return value of this function to make sure that the transfer request is submitted successfully.
psHandle | eDMA handle pointer. |
psTransfer | pointer to user's eDMA channel configure structure, see edma_channel_transfer_config_t for detail. |
#kStatus_EDMA_Success | It means submit transfer request succeed. |
#kStatus_EDMA_QueueFull | It means TCD queue is full. Submit transfer request is not allowed. |
status_t EDMA_TransferSubmitLoopTransfer | ( | edma_handle_t * | psHandle, |
edma_channel_transfer_config_t * | psTransfer, | ||
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
psHandle | eDMA handle pointer |
psTransfer | 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_EDMA_Success | It means submit transfer request succeed |
kStatus_EDMA_ChannelBusy | channel is in busy status |
#kStatus_EDMA_QueueFull | It means TCD pool is not len enough for the ring transfer request |
void EDMA_TransferStart | ( | edma_handle_t * | psHandle | ) |
This function enables the channel request. Users can call this function after submitting the transfer request or before submitting the transfer request.
psHandle | eDMA handle pointer. |
void EDMA_TransferStop | ( | edma_handle_t * | psHandle | ) |
This function disables the channel request to pause the transfer. Users can call EDMA_StartTransfer() again to resume the transfer.
psHandle | eDMA handle pointer. |
void EDMA_TransferAbort | ( | edma_handle_t * | psHandle | ) |
This function disables the channel request and clear transfer status bits. Users can submit another transfer after calling this API.
psHandle | DMA handle pointer. |
void EDMA_TransferHandleIRQ | ( | edma_handle_t * | psHandle | ) |
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 Interfaces 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 bit field 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.
psHandle | eDMA handle pointer. |