rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
fsl_edma.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2015, Freescale Semiconductor, Inc.
3 * Copyright 2016-2018 NXP
4 * All rights reserved.
5 *
6 * SPDX-License-Identifier: BSD-3-Clause
7 */
8
9#ifndef _FSL_EDMA_H_
10#define _FSL_EDMA_H_
11
12#include "fsl_common.h"
13
14/*!
15 * @addtogroup edma
16 * @{
17 */
18
19/*******************************************************************************
20 * Definitions
21 ******************************************************************************/
22
23/*! @name Driver version */
24/*@{*/
25/*! @brief eDMA driver version */
26#define FSL_EDMA_DRIVER_VERSION (MAKE_VERSION(2, 1, 4)) /*!< Version 2.1.4. */
27/*@}*/
28
29/*! @brief Compute the offset unit from DCHPRI3 */
30#define DMA_DCHPRI_INDEX(channel) (((channel) & ~0x03U) | (3 - ((channel)&0x03U)))
31
32/*! @brief Get the pointer of DCHPRIn */
33#define DMA_DCHPRIn(base, channel) ((volatile uint8_t *)&((base)->DCHPRI3))[DMA_DCHPRI_INDEX(channel)]
34
35/*! @brief eDMA transfer configuration */
37{
38 kEDMA_TransferSize1Bytes = 0x0U, /*!< Source/Destination data transfer size is 1 byte every time */
39 kEDMA_TransferSize2Bytes = 0x1U, /*!< Source/Destination data transfer size is 2 bytes every time */
40 kEDMA_TransferSize4Bytes = 0x2U, /*!< Source/Destination data transfer size is 4 bytes every time */
41 kEDMA_TransferSize8Bytes = 0x3U, /*!< Source/Destination data transfer size is 8 bytes every time */
42 kEDMA_TransferSize16Bytes = 0x4U, /*!< Source/Destination data transfer size is 16 bytes every time */
43 kEDMA_TransferSize32Bytes = 0x5U, /*!< Source/Destination data transfer size is 32 bytes every time */
45
46/*! @brief eDMA modulo configuration */
47typedef enum _edma_modulo
48{
49 kEDMA_ModuloDisable = 0x0U, /*!< Disable modulo */
50 kEDMA_Modulo2bytes, /*!< Circular buffer size is 2 bytes. */
51 kEDMA_Modulo4bytes, /*!< Circular buffer size is 4 bytes. */
52 kEDMA_Modulo8bytes, /*!< Circular buffer size is 8 bytes. */
53 kEDMA_Modulo16bytes, /*!< Circular buffer size is 16 bytes. */
54 kEDMA_Modulo32bytes, /*!< Circular buffer size is 32 bytes. */
55 kEDMA_Modulo64bytes, /*!< Circular buffer size is 64 bytes. */
56 kEDMA_Modulo128bytes, /*!< Circular buffer size is 128 bytes. */
57 kEDMA_Modulo256bytes, /*!< Circular buffer size is 256 bytes. */
58 kEDMA_Modulo512bytes, /*!< Circular buffer size is 512 bytes. */
59 kEDMA_Modulo1Kbytes, /*!< Circular buffer size is 1 K bytes. */
60 kEDMA_Modulo2Kbytes, /*!< Circular buffer size is 2 K bytes. */
61 kEDMA_Modulo4Kbytes, /*!< Circular buffer size is 4 K bytes. */
62 kEDMA_Modulo8Kbytes, /*!< Circular buffer size is 8 K bytes. */
63 kEDMA_Modulo16Kbytes, /*!< Circular buffer size is 16 K bytes. */
64 kEDMA_Modulo32Kbytes, /*!< Circular buffer size is 32 K bytes. */
65 kEDMA_Modulo64Kbytes, /*!< Circular buffer size is 64 K bytes. */
66 kEDMA_Modulo128Kbytes, /*!< Circular buffer size is 128 K bytes. */
67 kEDMA_Modulo256Kbytes, /*!< Circular buffer size is 256 K bytes. */
68 kEDMA_Modulo512Kbytes, /*!< Circular buffer size is 512 K bytes. */
69 kEDMA_Modulo1Mbytes, /*!< Circular buffer size is 1 M bytes. */
70 kEDMA_Modulo2Mbytes, /*!< Circular buffer size is 2 M bytes. */
71 kEDMA_Modulo4Mbytes, /*!< Circular buffer size is 4 M bytes. */
72 kEDMA_Modulo8Mbytes, /*!< Circular buffer size is 8 M bytes. */
73 kEDMA_Modulo16Mbytes, /*!< Circular buffer size is 16 M bytes. */
74 kEDMA_Modulo32Mbytes, /*!< Circular buffer size is 32 M bytes. */
75 kEDMA_Modulo64Mbytes, /*!< Circular buffer size is 64 M bytes. */
76 kEDMA_Modulo128Mbytes, /*!< Circular buffer size is 128 M bytes. */
77 kEDMA_Modulo256Mbytes, /*!< Circular buffer size is 256 M bytes. */
78 kEDMA_Modulo512Mbytes, /*!< Circular buffer size is 512 M bytes. */
79 kEDMA_Modulo1Gbytes, /*!< Circular buffer size is 1 G bytes. */
80 kEDMA_Modulo2Gbytes, /*!< Circular buffer size is 2 G bytes. */
82
83/*! @brief Bandwidth control */
84typedef enum _edma_bandwidth
85{
86 kEDMA_BandwidthStallNone = 0x0U, /*!< No eDMA engine stalls. */
87 kEDMA_BandwidthStall4Cycle = 0x2U, /*!< eDMA engine stalls for 4 cycles after each read/write. */
88 kEDMA_BandwidthStall8Cycle = 0x3U, /*!< eDMA engine stalls for 8 cycles after each read/write. */
90
91/*! @brief Channel link type */
93{
94 kEDMA_LinkNone = 0x0U, /*!< No channel link */
95 kEDMA_MinorLink, /*!< Channel link after each minor loop */
96 kEDMA_MajorLink, /*!< Channel link while major loop count exhausted */
98
99/*!@brief eDMA channel status flags. */
101{
102 kEDMA_DoneFlag = 0x1U, /*!< DONE flag, set while transfer finished, CITER value exhausted*/
103 kEDMA_ErrorFlag = 0x2U, /*!< eDMA error flag, an error occurred in a transfer */
104 kEDMA_InterruptFlag = 0x4U, /*!< eDMA interrupt flag, set while an interrupt occurred of this channel */
105};
106
107/*! @brief eDMA channel error status flags. */
109{
110 kEDMA_DestinationBusErrorFlag = DMA_ES_DBE_MASK, /*!< Bus error on destination address */
111 kEDMA_SourceBusErrorFlag = DMA_ES_SBE_MASK, /*!< Bus error on the source address */
112 kEDMA_ScatterGatherErrorFlag = DMA_ES_SGE_MASK, /*!< Error on the Scatter/Gather address, not 32byte aligned. */
113 kEDMA_NbytesErrorFlag = DMA_ES_NCE_MASK, /*!< NBYTES/CITER configuration error */
114 kEDMA_DestinationOffsetErrorFlag = DMA_ES_DOE_MASK, /*!< Destination offset not aligned with destination size */
115 kEDMA_DestinationAddressErrorFlag = DMA_ES_DAE_MASK, /*!< Destination address not aligned with destination size */
116 kEDMA_SourceOffsetErrorFlag = DMA_ES_SOE_MASK, /*!< Source offset not aligned with source size */
117 kEDMA_SourceAddressErrorFlag = DMA_ES_SAE_MASK, /*!< Source address not aligned with source size*/
118 kEDMA_ErrorChannelFlag = DMA_ES_ERRCHN_MASK, /*!< Error channel number of the cancelled channel number */
119 kEDMA_ChannelPriorityErrorFlag = DMA_ES_CPE_MASK, /*!< Channel priority is not unique. */
120 kEDMA_TransferCanceledFlag = DMA_ES_ECX_MASK, /*!< Transfer cancelled */
121#if defined(FSL_FEATURE_EDMA_CHANNEL_GROUP_COUNT) && FSL_FEATURE_EDMA_CHANNEL_GROUP_COUNT > 1
122 kEDMA_GroupPriorityErrorFlag = DMA_ES_GPE_MASK, /*!< Group priority is not unique. */
123#endif
124 kEDMA_ValidFlag = (int)DMA_ES_VLD_MASK, /*!< No error occurred, this bit is 0. Otherwise, it is 1. */
125};
126
127/*! @brief eDMA interrupt source */
129{
130 kEDMA_ErrorInterruptEnable = 0x1U, /*!< Enable interrupt while channel error occurs. */
131 kEDMA_MajorInterruptEnable = DMA_CSR_INTMAJOR_MASK, /*!< Enable interrupt while major count exhausted. */
132 kEDMA_HalfInterruptEnable = DMA_CSR_INTHALF_MASK, /*!< Enable interrupt while major count to half value. */
134
135/*! @brief eDMA transfer type */
137{
138 kEDMA_MemoryToMemory = 0x0U, /*!< Transfer from memory to memory */
139 kEDMA_PeripheralToMemory, /*!< Transfer from peripheral to memory */
140 kEDMA_MemoryToPeripheral, /*!< Transfer from memory to peripheral */
142
143/*! @brief eDMA transfer status */
145{
146 kStatus_EDMA_QueueFull = MAKE_STATUS(kStatusGroup_EDMA, 0), /*!< TCD queue is full. */
147 kStatus_EDMA_Busy = MAKE_STATUS(kStatusGroup_EDMA, 1), /*!< Channel is busy and can't handle the
148 transfer request. */
149};
150
151/*! @brief eDMA global configuration structure.*/
152typedef struct _edma_config
153{
154 bool enableContinuousLinkMode; /*!< Enable (true) continuous link mode. Upon minor loop completion, the channel
155 activates again if that channel has a minor loop channel link enabled and
156 the link channel is itself. */
157 bool enableHaltOnError; /*!< Enable (true) transfer halt on error. Any error causes the HALT bit to set.
158 Subsequently, all service requests are ignored until the HALT bit is cleared.*/
159 bool enableRoundRobinArbitration; /*!< Enable (true) round robin channel arbitration method or fixed priority
160 arbitration is used for channel selection */
161 bool enableDebugMode; /*!< Enable(true) eDMA debug mode. When in debug mode, the eDMA stalls the start of
162 a new channel. Executing channels are allowed to complete. */
164
165/*!
166 * @brief eDMA transfer configuration
167 *
168 * This structure configures the source/destination transfer attribute.
169 */
171{
172 uint32_t srcAddr; /*!< Source data address. */
173 uint32_t destAddr; /*!< Destination data address. */
174 edma_transfer_size_t srcTransferSize; /*!< Source data transfer size. */
175 edma_transfer_size_t destTransferSize; /*!< Destination data transfer size. */
176 int16_t srcOffset; /*!< Sign-extended offset applied to the current source address to
177 form the next-state value as each source read is completed. */
178 int16_t destOffset; /*!< Sign-extended offset applied to the current destination address to
179 form the next-state value as each destination write is completed. */
180 uint32_t minorLoopBytes; /*!< Bytes to transfer in a minor loop*/
181 uint32_t majorLoopCounts; /*!< Major loop iteration count. */
183
184/*! @brief eDMA channel priority configuration */
186{
187 bool enableChannelPreemption; /*!< If true: a channel can be suspended by other channel with higher priority */
188 bool enablePreemptAbility; /*!< If true: a channel can suspend other channel with low priority */
189 uint8_t channelPriority; /*!< Channel priority */
191
192/*! @brief eDMA minor offset configuration */
194{
195 bool enableSrcMinorOffset; /*!< Enable(true) or Disable(false) source minor loop offset. */
196 bool enableDestMinorOffset; /*!< Enable(true) or Disable(false) destination minor loop offset. */
197 uint32_t minorOffset; /*!< Offset for a minor loop mapping. */
199
200/*!
201 * @brief eDMA TCD.
202 *
203 * This structure is same as TCD register which is described in reference manual,
204 * and is used to configure the scatter/gather feature as a next hardware TCD.
205 */
206typedef struct _edma_tcd
207{
208 __IO uint32_t SADDR; /*!< SADDR register, used to save source address */
209 __IO uint16_t SOFF; /*!< SOFF register, save offset bytes every transfer */
210 __IO uint16_t ATTR; /*!< ATTR register, source/destination transfer size and modulo */
211 __IO uint32_t NBYTES; /*!< Nbytes register, minor loop length in bytes */
212 __IO uint32_t SLAST; /*!< SLAST register */
213 __IO uint32_t DADDR; /*!< DADDR register, used for destination address */
214 __IO uint16_t DOFF; /*!< DOFF register, used for destination offset */
215 __IO uint16_t CITER; /*!< CITER register, current minor loop numbers, for unfinished minor loop.*/
216 __IO uint32_t DLAST_SGA; /*!< DLASTSGA register, next tcd address used in scatter-gather mode */
217 __IO uint16_t CSR; /*!< CSR register, for TCD control status */
218 __IO uint16_t BITER; /*!< BITER register, begin minor loop count. */
220
221/*! @brief Callback for eDMA */
222struct _edma_handle;
223
224/*! @brief Define callback function for eDMA.
225 *
226 * This callback function is called in the EDMA interrupt handle.
227 * In normal mode, run into callback function means the transfer users need is done.
228 * In scatter gather mode, run into callback function means a transfer control block (tcd) is finished. Not
229 * all transfer finished, users can get the finished tcd numbers using interface EDMA_GetUnusedTCDNumber.
230 *
231 * @param handle EDMA handle pointer, users shall not touch the values inside.
232 * @param userData The callback user parameter pointer. Users can use this parameter to involve things users need to
233 * change in EDMA callback function.
234 * @param transferDone If the current loaded transfer done. In normal mode it means if all transfer done. In scatter
235 * gather mode, this parameter shows is the current transfer block in EDMA register is done. As the
236 * load of core is different, it will be different if the new tcd loaded into EDMA registers while
237 * this callback called. If true, it always means new tcd still not loaded into registers, while
238 * false means new tcd already loaded into registers.
239 * @param tcds How many tcds are done from the last callback. This parameter only used in scatter gather mode. It
240 * tells user how many tcds are finished between the last callback and this.
241 */
242typedef void (*edma_callback)(struct _edma_handle *handle, void *userData, bool transferDone, uint32_t tcds);
243
244/*! @brief eDMA transfer handle structure */
245typedef struct _edma_handle
246{
247 edma_callback callback; /*!< Callback function for major count exhausted. */
248 void *userData; /*!< Callback function parameter. */
249 DMA_Type *base; /*!< eDMA peripheral base address. */
250 edma_tcd_t *tcdPool; /*!< Pointer to memory stored TCDs. */
251 uint8_t channel; /*!< eDMA channel number. */
252 volatile int8_t header; /*!< The first TCD index. Should point to the next TCD to be loaded into the eDMA engine. */
253 volatile int8_t tail; /*!< The last TCD index. Should point to the next TCD to be stored into the memory pool. */
254 volatile int8_t tcdUsed; /*!< The number of used TCD slots. Should reflect the number of TCDs can be used/loaded in
255 the memory. */
256 volatile int8_t tcdSize; /*!< The total number of TCD slots in the queue. */
257 uint8_t flags; /*!< The status of the current channel. */
259
260/*******************************************************************************
261 * APIs
262 ******************************************************************************/
263#if defined(__cplusplus)
264extern "C" {
265#endif /* __cplusplus */
266
267/*!
268 * @name eDMA initialization and de-initialization
269 * @{
270 */
271
272/*!
273 * @brief Initializes the eDMA peripheral.
274 *
275 * This function ungates the eDMA clock and configures the eDMA peripheral according
276 * to the configuration structure.
277 *
278 * @param base eDMA peripheral base address.
279 * @param config A pointer to the configuration structure, see "edma_config_t".
280 * @note This function enables the minor loop map feature.
281 */
282void EDMA_Init(DMA_Type *base, const edma_config_t *config);
283
284/*!
285 * @brief Deinitializes the eDMA peripheral.
286 *
287 * This function gates the eDMA clock.
288 *
289 * @param base eDMA peripheral base address.
290 */
291void EDMA_Deinit(DMA_Type *base);
292
293/*!
294 * @brief Push content of TCD structure into hardware TCD register.
295 *
296 * @param base EDMA peripheral base address.
297 * @param channel EDMA channel number.
298 * @param tcd Point to TCD structure.
299 */
300void EDMA_InstallTCD(DMA_Type *base, uint32_t channel, edma_tcd_t *tcd);
301
302/*!
303 * @brief Gets the eDMA default configuration structure.
304 *
305 * This function sets the configuration structure to default values.
306 * The default configuration is set to the following values.
307 * @code
308 * config.enableContinuousLinkMode = false;
309 * config.enableHaltOnError = true;
310 * config.enableRoundRobinArbitration = false;
311 * config.enableDebugMode = false;
312 * @endcode
313 *
314 * @param config A pointer to the eDMA configuration structure.
315 */
317
318/* @} */
319/*!
320 * @name eDMA Channel Operation
321 * @{
322 */
323
324/*!
325 * @brief Sets all TCD registers to default values.
326 *
327 * This function sets TCD registers for this channel to default values.
328 *
329 * @param base eDMA peripheral base address.
330 * @param channel eDMA channel number.
331 * @note This function must not be called while the channel transfer is ongoing
332 * or it causes unpredictable results.
333 * @note This function enables the auto stop request feature.
334 */
335void EDMA_ResetChannel(DMA_Type *base, uint32_t channel);
336
337/*!
338 * @brief Configures the eDMA transfer attribute.
339 *
340 * This function configures the transfer attribute, including source address, destination address,
341 * transfer size, address offset, and so on. It also configures the scatter gather feature if the
342 * user supplies the TCD address.
343 * Example:
344 * @code
345 * edma_transfer_t config;
346 * edma_tcd_t tcd;
347 * config.srcAddr = ..;
348 * config.destAddr = ..;
349 * ...
350 * EDMA_SetTransferConfig(DMA0, channel, &config, &stcd);
351 * @endcode
352 *
353 * @param base eDMA peripheral base address.
354 * @param channel eDMA channel number.
355 * @param config Pointer to eDMA transfer configuration structure.
356 * @param nextTcd Point to TCD structure. It can be NULL if users
357 * do not want to enable scatter/gather feature.
358 * @note If nextTcd is not NULL, it means scatter gather feature is enabled
359 * and DREQ bit is cleared in the previous transfer configuration, which
360 * is set in the eDMA_ResetChannel.
361 */
362void EDMA_SetTransferConfig(DMA_Type *base,
363 uint32_t channel,
365 edma_tcd_t *nextTcd);
366
367/*!
368 * @brief Configures the eDMA minor offset feature.
369 *
370 * The minor offset means that the signed-extended value is added to the source address or destination
371 * address after each minor loop.
372 *
373 * @param base eDMA peripheral base address.
374 * @param channel eDMA channel number.
375 * @param config A pointer to the minor offset configuration structure.
376 */
377void EDMA_SetMinorOffsetConfig(DMA_Type *base, uint32_t channel, const edma_minor_offset_config_t *config);
378
379/*!
380 * @brief Configures the eDMA channel preemption feature.
381 *
382 * This function configures the channel preemption attribute and the priority of the channel.
383 *
384 * @param base eDMA peripheral base address.
385 * @param channel eDMA channel number
386 * @param config A pointer to the channel preemption configuration structure.
387 */
388static inline void EDMA_SetChannelPreemptionConfig(DMA_Type *base,
389 uint32_t channel,
391{
392 assert(channel < FSL_FEATURE_EDMA_MODULE_CHANNEL);
393 assert(config != NULL);
394
395 DMA_DCHPRIn(base, channel) =
396 (DMA_DCHPRI0_DPA(!config->enablePreemptAbility) | DMA_DCHPRI0_ECP(config->enableChannelPreemption) |
397 DMA_DCHPRI0_CHPRI(config->channelPriority));
398}
399
400/*!
401 * @brief Sets the channel link for the eDMA transfer.
402 *
403 * This function configures either the minor link or the major link mode. The minor link means that the channel link is
404 * triggered every time CITER decreases by 1. The major link means that the channel link is triggered when the CITER is
405 * exhausted.
406 *
407 * @param base eDMA peripheral base address.
408 * @param channel eDMA channel number.
409 * @param type A channel link type, which can be one of the following:
410 * @arg kEDMA_LinkNone
411 * @arg kEDMA_MinorLink
412 * @arg kEDMA_MajorLink
413 * @param linkedChannel The linked channel number.
414 * @note Users should ensure that DONE flag is cleared before calling this interface, or the configuration is invalid.
415 */
416void EDMA_SetChannelLink(DMA_Type *base, uint32_t channel, edma_channel_link_type_t type, uint32_t linkedChannel);
417
418/*!
419 * @brief Sets the bandwidth for the eDMA transfer.
420 *
421 * Because the eDMA processes the minor loop, it continuously generates read/write sequences
422 * until the minor count is exhausted. The bandwidth forces the eDMA to stall after the completion of
423 * each read/write access to control the bus request bandwidth seen by the crossbar switch.
424 *
425 * @param base eDMA peripheral base address.
426 * @param channel eDMA channel number.
427 * @param bandWidth A bandwidth setting, which can be one of the following:
428 * @arg kEDMABandwidthStallNone
429 * @arg kEDMABandwidthStall4Cycle
430 * @arg kEDMABandwidthStall8Cycle
431 */
432void EDMA_SetBandWidth(DMA_Type *base, uint32_t channel, edma_bandwidth_t bandWidth);
433
434/*!
435 * @brief Sets the source modulo and the destination modulo for the eDMA transfer.
436 *
437 * This function defines a specific address range specified to be the value after (SADDR + SOFF)/(DADDR + DOFF)
438 * calculation is performed or the original register value. It provides the ability to implement a circular data
439 * queue easily.
440 *
441 * @param base eDMA peripheral base address.
442 * @param channel eDMA channel number.
443 * @param srcModulo A source modulo value.
444 * @param destModulo A destination modulo value.
445 */
446void EDMA_SetModulo(DMA_Type *base, uint32_t channel, edma_modulo_t srcModulo, edma_modulo_t destModulo);
447
448#if defined(FSL_FEATURE_EDMA_ASYNCHRO_REQUEST_CHANNEL_COUNT) && FSL_FEATURE_EDMA_ASYNCHRO_REQUEST_CHANNEL_COUNT
449/*!
450 * @brief Enables an async request for the eDMA transfer.
451 *
452 * @param base eDMA peripheral base address.
453 * @param channel eDMA channel number.
454 * @param enable The command to enable (true) or disable (false).
455 */
456static inline void EDMA_EnableAsyncRequest(DMA_Type *base, uint32_t channel, bool enable)
457{
458 assert(channel < FSL_FEATURE_DMAMUX_MODULE_CHANNEL);
459
460 base->EARS = (base->EARS & (~(1U << channel))) | ((uint32_t)enable << channel);
461}
462#endif /* FSL_FEATURE_EDMA_ASYNCHRO_REQUEST_CHANNEL_COUNT */
463
464/*!
465 * @brief Enables an auto stop request for the eDMA transfer.
466 *
467 * If enabling the auto stop request, the eDMA hardware automatically disables the hardware channel request.
468 *
469 * @param base eDMA peripheral base address.
470 * @param channel eDMA channel number.
471 * @param enable The command to enable (true) or disable (false).
472 */
473static inline void EDMA_EnableAutoStopRequest(DMA_Type *base, uint32_t channel, bool enable)
474{
475 assert(channel < FSL_FEATURE_DMAMUX_MODULE_CHANNEL);
476
477 base->TCD[channel].CSR = (base->TCD[channel].CSR & (~DMA_CSR_DREQ_MASK)) | DMA_CSR_DREQ(enable);
478}
479
480/*!
481 * @brief Enables the interrupt source for the eDMA transfer.
482 *
483 * @param base eDMA peripheral base address.
484 * @param channel eDMA channel number.
485 * @param mask The mask of interrupt source to be set. Users need to use
486 * the defined edma_interrupt_enable_t type.
487 */
488void EDMA_EnableChannelInterrupts(DMA_Type *base, uint32_t channel, uint32_t mask);
489
490/*!
491 * @brief Disables the interrupt source for the eDMA transfer.
492 *
493 * @param base eDMA peripheral base address.
494 * @param channel eDMA channel number.
495 * @param mask The mask of the interrupt source to be set. Use
496 * the defined edma_interrupt_enable_t type.
497 */
498void EDMA_DisableChannelInterrupts(DMA_Type *base, uint32_t channel, uint32_t mask);
499
500/* @} */
501/*!
502 * @name eDMA TCD Operation
503 * @{
504 */
505
506/*!
507 * @brief Sets all fields to default values for the TCD structure.
508 *
509 * This function sets all fields for this TCD structure to default value.
510 *
511 * @param tcd Pointer to the TCD structure.
512 * @note This function enables the auto stop request feature.
513 */
514void EDMA_TcdReset(edma_tcd_t *tcd);
515
516/*!
517 * @brief Configures the eDMA TCD transfer attribute.
518 *
519 * The TCD is a transfer control descriptor. The content of the TCD is the same as the hardware TCD registers.
520 * The STCD is used in the scatter-gather mode.
521 * This function configures the TCD transfer attribute, including source address, destination address,
522 * transfer size, address offset, and so on. It also configures the scatter gather feature if the
523 * user supplies the next TCD address.
524 * Example:
525 * @code
526 * edma_transfer_t config = {
527 * ...
528 * }
529 * edma_tcd_t tcd __aligned(32);
530 * edma_tcd_t nextTcd __aligned(32);
531 * EDMA_TcdSetTransferConfig(&tcd, &config, &nextTcd);
532 * @endcode
533 *
534 * @param tcd Pointer to the TCD structure.
535 * @param config Pointer to eDMA transfer configuration structure.
536 * @param nextTcd Pointer to the next TCD structure. It can be NULL if users
537 * do not want to enable scatter/gather feature.
538 * @note TCD address should be 32 bytes aligned or it causes an eDMA error.
539 * @note If the nextTcd is not NULL, the scatter gather feature is enabled
540 * and DREQ bit is cleared in the previous transfer configuration, which
541 * is set in the EDMA_TcdReset.
542 */
544
545/*!
546 * @brief Configures the eDMA TCD minor offset feature.
547 *
548 * A minor offset is a signed-extended value added to the source address or a destination
549 * address after each minor loop.
550 *
551 * @param tcd A point to the TCD structure.
552 * @param config A pointer to the minor offset configuration structure.
553 */
555
556/*!
557 * @brief Sets the channel link for the eDMA TCD.
558 *
559 * This function configures either a minor link or a major link. The minor link means the channel link is
560 * triggered every time CITER decreases by 1. The major link means that the channel link is triggered when the CITER is
561 * exhausted.
562 *
563 * @note Users should ensure that DONE flag is cleared before calling this interface, or the configuration is invalid.
564 * @param tcd Point to the TCD structure.
565 * @param type Channel link type, it can be one of:
566 * @arg kEDMA_LinkNone
567 * @arg kEDMA_MinorLink
568 * @arg kEDMA_MajorLink
569 * @param linkedChannel The linked channel number.
570 */
571void EDMA_TcdSetChannelLink(edma_tcd_t *tcd, edma_channel_link_type_t type, uint32_t linkedChannel);
572
573/*!
574 * @brief Sets the bandwidth for the eDMA TCD.
575 *
576 * Because the eDMA processes the minor loop, it continuously generates read/write sequences
577 * until the minor count is exhausted. The bandwidth forces the eDMA to stall after the completion of
578 * each read/write access to control the bus request bandwidth seen by the crossbar switch.
579 * @param tcd A pointer to the TCD structure.
580 * @param bandWidth A bandwidth setting, which can be one of the following:
581 * @arg kEDMABandwidthStallNone
582 * @arg kEDMABandwidthStall4Cycle
583 * @arg kEDMABandwidthStall8Cycle
584 */
585static inline void EDMA_TcdSetBandWidth(edma_tcd_t *tcd, edma_bandwidth_t bandWidth)
586{
587 assert(tcd != NULL);
588 assert(((uint32_t)tcd & 0x1FU) == 0);
589
590 tcd->CSR = (tcd->CSR & (~DMA_CSR_BWC_MASK)) | DMA_CSR_BWC(bandWidth);
591}
592
593/*!
594 * @brief Sets the source modulo and the destination modulo for the eDMA TCD.
595 *
596 * This function defines a specific address range specified to be the value after (SADDR + SOFF)/(DADDR + DOFF)
597 * calculation is performed or the original register value. It provides the ability to implement a circular data
598 * queue easily.
599 *
600 * @param tcd A pointer to the TCD structure.
601 * @param srcModulo A source modulo value.
602 * @param destModulo A destination modulo value.
603 */
604void EDMA_TcdSetModulo(edma_tcd_t *tcd, edma_modulo_t srcModulo, edma_modulo_t destModulo);
605
606/*!
607 * @brief Sets the auto stop request for the eDMA TCD.
608 *
609 * If enabling the auto stop request, the eDMA hardware automatically disables the hardware channel request.
610 *
611 * @param tcd A pointer to the TCD structure.
612 * @param enable The command to enable (true) or disable (false).
613 */
614static inline void EDMA_TcdEnableAutoStopRequest(edma_tcd_t *tcd, bool enable)
615{
616 assert(tcd != NULL);
617 assert(((uint32_t)tcd & 0x1FU) == 0);
618
619 tcd->CSR = (tcd->CSR & (~DMA_CSR_DREQ_MASK)) | DMA_CSR_DREQ(enable);
620}
621
622/*!
623 * @brief Enables the interrupt source for the eDMA TCD.
624 *
625 * @param tcd Point to the TCD structure.
626 * @param mask The mask of interrupt source to be set. Users need to use
627 * the defined edma_interrupt_enable_t type.
628 */
629void EDMA_TcdEnableInterrupts(edma_tcd_t *tcd, uint32_t mask);
630
631/*!
632 * @brief Disables the interrupt source for the eDMA TCD.
633 *
634 * @param tcd Point to the TCD structure.
635 * @param mask The mask of interrupt source to be set. Users need to use
636 * the defined edma_interrupt_enable_t type.
637 */
638void EDMA_TcdDisableInterrupts(edma_tcd_t *tcd, uint32_t mask);
639
640/*! @} */
641/*!
642 * @name eDMA Channel Transfer Operation
643 * @{
644 */
645
646/*!
647 * @brief Enables the eDMA hardware channel request.
648 *
649 * This function enables the hardware channel request.
650 *
651 * @param base eDMA peripheral base address.
652 * @param channel eDMA channel number.
653 */
654static inline void EDMA_EnableChannelRequest(DMA_Type *base, uint32_t channel)
655{
656 assert(channel < FSL_FEATURE_DMAMUX_MODULE_CHANNEL);
657
658 base->SERQ = DMA_SERQ_SERQ(channel);
659}
660
661/*!
662 * @brief Disables the eDMA hardware channel request.
663 *
664 * This function disables the hardware channel request.
665 *
666 * @param base eDMA peripheral base address.
667 * @param channel eDMA channel number.
668 */
669static inline void EDMA_DisableChannelRequest(DMA_Type *base, uint32_t channel)
670{
671 assert(channel < FSL_FEATURE_DMAMUX_MODULE_CHANNEL);
672
673 base->CERQ = DMA_CERQ_CERQ(channel);
674}
675
676/*!
677 * @brief Starts the eDMA transfer by using the software trigger.
678 *
679 * This function starts a minor loop transfer.
680 *
681 * @param base eDMA peripheral base address.
682 * @param channel eDMA channel number.
683 */
684static inline void EDMA_TriggerChannelStart(DMA_Type *base, uint32_t channel)
685{
686 assert(channel < FSL_FEATURE_DMAMUX_MODULE_CHANNEL);
687
688 base->SSRT = DMA_SSRT_SSRT(channel);
689}
690
691/*! @} */
692/*!
693 * @name eDMA Channel Status Operation
694 * @{
695 */
696
697/*!
698 * @brief Gets the remaining major loop count from the eDMA current channel TCD.
699 *
700 * This function checks the TCD (Task Control Descriptor) status for a specified
701 * eDMA channel and returns the number of major loop count that has not finished.
702 *
703 * @param base eDMA peripheral base address.
704 * @param channel eDMA channel number.
705 * @return Major loop count which has not been transferred yet for the current TCD.
706 * @note 1. This function can only be used to get unfinished major loop count of transfer without
707 * the next TCD, or it might be inaccuracy.
708 * 2. The unfinished/remaining transfer bytes cannot be obtained directly from registers while
709 * the channel is running.
710 * Because to calculate the remaining bytes, the initial NBYTES configured in DMA_TCDn_NBYTES_MLNO
711 * register is needed while the eDMA IP does not support getting it while a channel is active.
712 * In another word, the NBYTES value reading is always the actual (decrementing) NBYTES value the dma_engine
713 * is working with while a channel is running.
714 * Consequently, to get the remaining transfer bytes, a software-saved initial value of NBYTES (for example
715 * copied before enabling the channel) is needed. The formula to calculate it is shown below:
716 * RemainingBytes = RemainingMajorLoopCount * NBYTES(initially configured)
717 */
718uint32_t EDMA_GetRemainingMajorLoopCount(DMA_Type *base, uint32_t channel);
719
720/*!
721 * @brief Gets the eDMA channel error status flags.
722 *
723 * @param base eDMA peripheral base address.
724 * @return The mask of error status flags. Users need to use the
725* _edma_error_status_flags type to decode the return variables.
726 */
727static inline uint32_t EDMA_GetErrorStatusFlags(DMA_Type *base)
728{
729 return base->ES;
730}
731
732/*!
733 * @brief Gets the eDMA channel status flags.
734 *
735 * @param base eDMA peripheral base address.
736 * @param channel eDMA channel number.
737 * @return The mask of channel status flags. Users need to use the
738 * _edma_channel_status_flags type to decode the return variables.
739 */
740uint32_t EDMA_GetChannelStatusFlags(DMA_Type *base, uint32_t channel);
741
742/*!
743 * @brief Clears the eDMA channel status flags.
744 *
745 * @param base eDMA peripheral base address.
746 * @param channel eDMA channel number.
747 * @param mask The mask of channel status to be cleared. Users need to use
748 * the defined _edma_channel_status_flags type.
749 */
750void EDMA_ClearChannelStatusFlags(DMA_Type *base, uint32_t channel, uint32_t mask);
751
752/*! @} */
753/*!
754 * @name eDMA Transactional Operation
755 */
756
757/*!
758 * @brief Creates the eDMA handle.
759 *
760 * This function is called if using the transactional API for eDMA. This function
761 * initializes the internal state of the eDMA handle.
762 *
763 * @param handle eDMA handle pointer. The eDMA handle stores callback function and
764 * parameters.
765 * @param base eDMA peripheral base address.
766 * @param channel eDMA channel number.
767 */
768void EDMA_CreateHandle(edma_handle_t *handle, DMA_Type *base, uint32_t channel);
769
770/*!
771 * @brief Installs the TCDs memory pool into the eDMA handle.
772 *
773 * This function is called after the EDMA_CreateHandle to use scatter/gather feature. This function shall only be used
774 * while users need to use scatter gather mode. Scatter gather mode enables EDMA to load a new transfer control block
775 * (tcd) in hardware, and automatically reconfigure that DMA channel for a new transfer.
776 * Users need to prepare tcd memory and also configure tcds using interface EDMA_SubmitTransfer.
777 *
778 * @param handle eDMA handle pointer.
779 * @param tcdPool A memory pool to store TCDs. It must be 32 bytes aligned.
780 * @param tcdSize The number of TCD slots.
781 */
782void EDMA_InstallTCDMemory(edma_handle_t *handle, edma_tcd_t *tcdPool, uint32_t tcdSize);
783
784/*!
785 * @brief Installs a callback function for the eDMA transfer.
786 *
787 * This callback is called in the eDMA IRQ handler. Use the callback to do something after
788 * the current major loop transfer completes. This function will be called every time one tcd finished transfer.
789 *
790 * @param handle eDMA handle pointer.
791 * @param callback eDMA callback function pointer.
792 * @param userData A parameter for the callback function.
793 */
794void EDMA_SetCallback(edma_handle_t *handle, edma_callback callback, void *userData);
795
796/*!
797 * @brief Prepares the eDMA transfer structure.
798 *
799 * This function prepares the transfer configuration structure according to the user input.
800 *
801 * @param config The user configuration structure of type edma_transfer_t.
802 * @param srcAddr eDMA transfer source address.
803 * @param srcWidth eDMA transfer source address width(bytes).
804 * @param destAddr eDMA transfer destination address.
805 * @param destWidth eDMA transfer destination address width(bytes).
806 * @param bytesEachRequest eDMA transfer bytes per channel request.
807 * @param transferBytes eDMA transfer bytes to be transferred.
808 * @param type eDMA transfer type.
809 * @note The data address and the data width must be consistent. For example, if the SRC
810 * is 4 bytes, the source address must be 4 bytes aligned, or it results in
811 * source address error (SAE).
812 */
814 void *srcAddr,
815 uint32_t srcWidth,
816 void *destAddr,
817 uint32_t destWidth,
818 uint32_t bytesEachRequest,
819 uint32_t transferBytes,
821
822/*!
823 * @brief Submits the eDMA transfer request.
824 *
825 * This function submits the eDMA transfer request according to the transfer configuration structure.
826 * In scatter gather mode, call this function will add a configured tcd to the circular list of tcd pool.
827 * The tcd pools is setup by call function EDMA_InstallTCDMemory before.
828 *
829 * @param handle eDMA handle pointer.
830 * @param config Pointer to eDMA transfer configuration structure.
831 * @retval kStatus_EDMA_Success It means submit transfer request succeed.
832 * @retval kStatus_EDMA_QueueFull It means TCD queue is full. Submit transfer request is not allowed.
833 * @retval kStatus_EDMA_Busy It means the given channel is busy, need to submit request later.
834 */
836
837/*!
838 * @brief eDMA starts transfer.
839 *
840 * This function enables the channel request. Users can call this function after submitting the transfer request
841 * or before submitting the transfer request.
842 *
843 * @param handle eDMA handle pointer.
844 */
846
847/*!
848 * @brief eDMA stops transfer.
849 *
850 * This function disables the channel request to pause the transfer. Users can call EDMA_StartTransfer()
851 * again to resume the transfer.
852 *
853 * @param handle eDMA handle pointer.
854 */
855void EDMA_StopTransfer(edma_handle_t *handle);
856
857/*!
858 * @brief eDMA aborts transfer.
859 *
860 * This function disables the channel request and clear transfer status bits.
861 * Users can submit another transfer after calling this API.
862 *
863 * @param handle DMA handle pointer.
864 */
866
867/*!
868 * @brief Get unused TCD slot number.
869 *
870 * This function gets current tcd index which is run. If the TCD pool pointer is NULL, it will return 0.
871 *
872 * @param handle DMA handle pointer.
873 * @return The unused tcd slot number.
874 */
875static inline uint32_t EDMA_GetUnusedTCDNumber(edma_handle_t *handle)
876{
877 return (handle->tcdSize - handle->tcdUsed);
878}
879
880/*!
881 * @brief Get the next tcd address.
882 *
883 * This function gets the next tcd address. If this is last TCD, return 0.
884 *
885 * @param handle DMA handle pointer.
886 * @return The next TCD address.
887 */
888static inline uint32_t EDMA_GetNextTCDAddress(edma_handle_t *handle)
889{
890 return (handle->base->TCD[handle->channel].DLAST_SGA);
891}
892
893/*!
894 * @brief eDMA IRQ handler for the current major loop transfer completion.
895 *
896 * This function clears the channel major interrupt flag and calls
897 * the callback function if it is not NULL.
898 *
899 * Note:
900 * For the case using TCD queue, when the major iteration count is exhausted, additional operations are performed.
901 * These include the final address adjustments and reloading of the BITER field into the CITER.
902 * Assertion of an optional interrupt request also occurs at this time, as does a possible fetch of a new TCD from
903 * memory using the scatter/gather address pointer included in the descriptor (if scatter/gather is enabled).
904 *
905 * For instance, when the time interrupt of TCD[0] happens, the TCD[1] has already been loaded into the eDMA engine.
906 * As sga and sga_index are calculated based on the DLAST_SGA bitfield lies in the TCD_CSR register, the sga_index
907 * in this case should be 2 (DLAST_SGA of TCD[1] stores the address of TCD[2]). Thus, the "tcdUsed" updated should be
908 * (tcdUsed - 2U) which indicates the number of TCDs can be loaded in the memory pool (because TCD[0] and TCD[1] have
909 * been loaded into the eDMA engine at this point already.).
910 *
911 * For the last two continuous ISRs in a scatter/gather process, they both load the last TCD (The last ISR does not
912 * load a new TCD) from the memory pool to the eDMA engine when major loop completes.
913 * Therefore, ensure that the header and tcdUsed updated are identical for them.
914 * tcdUsed are both 0 in this case as no TCD to be loaded.
915 *
916 * See the "eDMA basic data flow" in the eDMA Functional description section of the Reference Manual for
917 * further details.
918 *
919 * @param handle eDMA handle pointer.
920 */
921void EDMA_HandleIRQ(edma_handle_t *handle);
922
923/* @} */
924
925#if defined(__cplusplus)
926}
927#endif /* __cplusplus */
928
929/* @} */
930
931#endif /*_FSL_EDMA_H_*/
uint16_t channel
Definition adc_inputs.h:104
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.
Definition fsl_edma.h:388
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:648
_edma_transfer_status
eDMA transfer status
Definition fsl_edma.h:145
static void EDMA_EnableAsyncRequest(DMA_Type *base, uint32_t channel, bool enable)
Enables an async request for the eDMA transfer.
Definition fsl_edma.h:456
edma_transfer_size_t destTransferSize
Definition fsl_edma.h:175
void EDMA_EnableChannelInterrupts(DMA_Type *base, uint32_t channel, uint32_t mask)
Enables the interrupt source for the eDMA transfer.
Definition fsl_edma.c:330
_edma_modulo
eDMA modulo configuration
Definition fsl_edma.h:48
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:610
void EDMA_AbortTransfer(edma_handle_t *handle)
eDMA aborts transfer.
Definition fsl_edma.c:1164
DMA_Type * base
Definition fsl_edma.h:249
volatile int8_t header
Definition fsl_edma.h:252
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:81
static uint32_t EDMA_GetErrorStatusFlags(DMA_Type *base)
Gets the eDMA channel error status flags.
Definition fsl_edma.h:727
void EDMA_DisableChannelInterrupts(DMA_Type *base, uint32_t channel, uint32_t mask)
Disables the interrupt source for the eDMA transfer.
Definition fsl_edma.c:361
void EDMA_StopTransfer(edma_handle_t *handle)
eDMA stops transfer.
Definition fsl_edma.c:1148
_edma_bandwidth
Bandwidth control.
Definition fsl_edma.h:85
void EDMA_Deinit(DMA_Type *base)
Deinitializes the eDMA peripheral.
Definition fsl_edma.c:143
static uint32_t EDMA_GetNextTCDAddress(edma_handle_t *handle)
Get the next tcd address.
Definition fsl_edma.h:888
struct _edma_handle edma_handle_t
eDMA transfer handle structure
bool enableContinuousLinkMode
Definition fsl_edma.h:154
_edma_transfer_type
eDMA transfer type
Definition fsl_edma.h:137
uint32_t majorLoopCounts
Definition fsl_edma.h:181
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.
Definition fsl_edma.h:684
__IO uint32_t DADDR
Definition fsl_edma.h:213
_edma_channel_link_type
Channel link type.
Definition fsl_edma.h:93
void EDMA_TcdReset(edma_tcd_t *tcd)
Sets all fields to default values for the TCD structure.
Definition fsl_edma.c:392
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.
Definition fsl_edma.h:669
void EDMA_ClearChannelStatusFlags(DMA_Type *base, uint32_t channel, uint32_t mask)
Clears the eDMA channel status flags.
Definition fsl_edma.c:708
edma_callback callback
Definition fsl_edma.h:247
static uint32_t EDMA_GetUnusedTCDNumber(edma_handle_t *handle)
Get unused TCD slot number.
Definition fsl_edma.h:875
_edma_interrupt_enable
eDMA interrupt source
Definition fsl_edma.h:129
_edma_transfer_size
eDMA transfer configuration
Definition fsl_edma.h:37
_edma_channel_status_flags
eDMA channel status flags.
Definition fsl_edma.h:101
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:488
bool enableDebugMode
Definition fsl_edma.h:161
__IO uint16_t CSR
Definition fsl_edma.h:217
__IO uint16_t BITER
Definition fsl_edma.h:218
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:812
volatile int8_t tcdUsed
Definition fsl_edma.h:254
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:684
__IO uint32_t SLAST
Definition fsl_edma.h:212
static void EDMA_TcdSetBandWidth(edma_tcd_t *tcd, edma_bandwidth_t bandWidth)
Sets the bandwidth for the eDMA TCD.
Definition fsl_edma.h:585
volatile int8_t tcdSize
Definition fsl_edma.h:256
edma_tcd_t * tcdPool
Definition fsl_edma.h:250
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.
Definition fsl_edma.c:271
__IO uint32_t DLAST_SGA
Definition fsl_edma.h:216
edma_transfer_size_t srcTransferSize
Definition fsl_edma.h:174
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:956
__IO uint16_t CITER
Definition fsl_edma.h:215
bool enableHaltOnError
Definition fsl_edma.h:157
void EDMA_SetCallback(edma_handle_t *handle, edma_callback callback, void *userData)
Installs a callback function for the eDMA transfer.
Definition fsl_edma.c:836
void EDMA_GetDefaultConfig(edma_config_t *config)
Gets the eDMA default configuration structure.
Definition fsl_edma.c:165
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:568
uint32_t minorLoopBytes
Definition fsl_edma.h:180
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.
Definition fsl_edma.c:861
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:312
__IO uint32_t SADDR
Definition fsl_edma.h:208
static void EDMA_EnableChannelRequest(DMA_Type *base, uint32_t channel)
Enables the eDMA hardware channel request.
Definition fsl_edma.h:654
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:221
void EDMA_StartTransfer(edma_handle_t *handle)
eDMA starts transfer.
Definition fsl_edma.c:1103
bool enableRoundRobinArbitration
Definition fsl_edma.h:159
struct _edma_channel_Preemption_config edma_channel_Preemption_config_t
eDMA channel priority configuration
uint8_t channel
Definition fsl_edma.h:251
__IO uint16_t DOFF
Definition fsl_edma.h:214
void EDMA_TcdSetChannelLink(edma_tcd_t *tcd, edma_channel_link_type_t type, uint32_t linkedChannel)
Sets the channel link for the eDMA TCD.
Definition fsl_edma.c:518
static void EDMA_TcdEnableAutoStopRequest(edma_tcd_t *tcd, bool enable)
Sets the auto stop request for the eDMA TCD.
Definition fsl_edma.h:614
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.
Definition fsl_edma.h:473
__IO uint16_t SOFF
Definition fsl_edma.h:209
__IO uint32_t NBYTES
Definition fsl_edma.h:211
volatile int8_t tail
Definition fsl_edma.h:253
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:439
uint8_t flags
Definition fsl_edma.h:257
__IO uint16_t ATTR
Definition fsl_edma.h:210
void(* edma_callback)(struct _edma_handle *handle, void *userData, bool transferDone, uint32_t tcds)
Define callback function for eDMA.
Definition fsl_edma.h:242
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:757
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:240
void * userData
Definition fsl_edma.h:248
void EDMA_HandleIRQ(edma_handle_t *handle)
eDMA IRQ handler for the current major loop transfer completion.
Definition fsl_edma.c:1213
void EDMA_ResetChannel(DMA_Type *base, uint32_t channel)
Sets all TCD registers to default values.
Definition fsl_edma.c:189
void EDMA_SetBandWidth(DMA_Type *base, uint32_t channel, edma_bandwidth_t bandWidth)
Sets the bandwidth for the eDMA transfer.
Definition fsl_edma.c:293
void EDMA_Init(DMA_Type *base, const edma_config_t *config)
Initializes the eDMA peripheral.
Definition fsl_edma.c:113
_edma_error_status_flags
eDMA channel error status flags.
Definition fsl_edma.h:109
void EDMA_TcdEnableInterrupts(edma_tcd_t *tcd, uint32_t mask)
Enables the interrupt source for the eDMA TCD.
Definition fsl_edma.c:586
@ kStatus_EDMA_QueueFull
Definition fsl_edma.h:146
@ kStatus_EDMA_Busy
Definition fsl_edma.h:147
@ kEDMA_Modulo128Mbytes
Definition fsl_edma.h:76
@ kEDMA_Modulo512Mbytes
Definition fsl_edma.h:78
@ kEDMA_Modulo1Gbytes
Definition fsl_edma.h:79
@ kEDMA_Modulo4bytes
Definition fsl_edma.h:51
@ kEDMA_Modulo16Mbytes
Definition fsl_edma.h:73
@ kEDMA_Modulo1Mbytes
Definition fsl_edma.h:69
@ kEDMA_Modulo4Mbytes
Definition fsl_edma.h:71
@ kEDMA_Modulo256Mbytes
Definition fsl_edma.h:77
@ kEDMA_Modulo8Kbytes
Definition fsl_edma.h:62
@ kEDMA_Modulo512bytes
Definition fsl_edma.h:58
@ kEDMA_Modulo2Mbytes
Definition fsl_edma.h:70
@ kEDMA_Modulo16Kbytes
Definition fsl_edma.h:63
@ kEDMA_Modulo1Kbytes
Definition fsl_edma.h:59
@ kEDMA_Modulo8bytes
Definition fsl_edma.h:52
@ kEDMA_Modulo64Kbytes
Definition fsl_edma.h:65
@ kEDMA_Modulo2Gbytes
Definition fsl_edma.h:80
@ kEDMA_Modulo256bytes
Definition fsl_edma.h:57
@ kEDMA_ModuloDisable
Definition fsl_edma.h:49
@ kEDMA_Modulo16bytes
Definition fsl_edma.h:53
@ kEDMA_Modulo128bytes
Definition fsl_edma.h:56
@ kEDMA_Modulo32bytes
Definition fsl_edma.h:54
@ kEDMA_Modulo2Kbytes
Definition fsl_edma.h:60
@ kEDMA_Modulo8Mbytes
Definition fsl_edma.h:72
@ kEDMA_Modulo32Mbytes
Definition fsl_edma.h:74
@ kEDMA_Modulo256Kbytes
Definition fsl_edma.h:67
@ kEDMA_Modulo4Kbytes
Definition fsl_edma.h:61
@ kEDMA_Modulo64Mbytes
Definition fsl_edma.h:75
@ kEDMA_Modulo32Kbytes
Definition fsl_edma.h:64
@ kEDMA_Modulo64bytes
Definition fsl_edma.h:55
@ kEDMA_Modulo2bytes
Definition fsl_edma.h:50
@ kEDMA_Modulo128Kbytes
Definition fsl_edma.h:66
@ kEDMA_Modulo512Kbytes
Definition fsl_edma.h:68
@ kEDMA_BandwidthStall4Cycle
Definition fsl_edma.h:87
@ kEDMA_BandwidthStall8Cycle
Definition fsl_edma.h:88
@ kEDMA_BandwidthStallNone
Definition fsl_edma.h:86
@ kEDMA_PeripheralToMemory
Definition fsl_edma.h:139
@ kEDMA_MemoryToPeripheral
Definition fsl_edma.h:140
@ kEDMA_MemoryToMemory
Definition fsl_edma.h:138
@ kEDMA_MinorLink
Definition fsl_edma.h:95
@ kEDMA_MajorLink
Definition fsl_edma.h:96
@ kEDMA_LinkNone
Definition fsl_edma.h:94
@ kEDMA_MajorInterruptEnable
Definition fsl_edma.h:131
@ kEDMA_HalfInterruptEnable
Definition fsl_edma.h:132
@ kEDMA_ErrorInterruptEnable
Definition fsl_edma.h:130
@ kEDMA_TransferSize16Bytes
Definition fsl_edma.h:42
@ kEDMA_TransferSize8Bytes
Definition fsl_edma.h:41
@ kEDMA_TransferSize4Bytes
Definition fsl_edma.h:40
@ kEDMA_TransferSize2Bytes
Definition fsl_edma.h:39
@ kEDMA_TransferSize1Bytes
Definition fsl_edma.h:38
@ kEDMA_TransferSize32Bytes
Definition fsl_edma.h:43
@ kEDMA_ErrorFlag
Definition fsl_edma.h:103
@ kEDMA_DoneFlag
Definition fsl_edma.h:102
@ kEDMA_InterruptFlag
Definition fsl_edma.h:104
@ kEDMA_TransferCanceledFlag
Definition fsl_edma.h:120
@ kEDMA_GroupPriorityErrorFlag
Definition fsl_edma.h:122
@ kEDMA_ErrorChannelFlag
Definition fsl_edma.h:118
@ kEDMA_SourceAddressErrorFlag
Definition fsl_edma.h:117
@ kEDMA_DestinationBusErrorFlag
Definition fsl_edma.h:110
@ kEDMA_SourceBusErrorFlag
Definition fsl_edma.h:111
@ kEDMA_ChannelPriorityErrorFlag
Definition fsl_edma.h:119
@ kEDMA_ScatterGatherErrorFlag
Definition fsl_edma.h:112
@ kEDMA_DestinationOffsetErrorFlag
Definition fsl_edma.h:114
@ kEDMA_ValidFlag
Definition fsl_edma.h:124
@ kEDMA_NbytesErrorFlag
Definition fsl_edma.h:113
@ kEDMA_SourceOffsetErrorFlag
Definition fsl_edma.h:116
@ kEDMA_DestinationAddressErrorFlag
Definition fsl_edma.h:115
int32_t status_t
Type used for all status and error return values.
Definition fsl_common.h:169
@ kStatusGroup_EDMA
Definition fsl_common.h:100
static void enable(const char *param)
Definition settings.cpp:441
eDMA channel priority configuration
Definition fsl_edma.h:186
eDMA global configuration structure.
Definition fsl_edma.h:153
eDMA transfer handle structure
Definition fsl_edma.h:246
eDMA minor offset configuration
Definition fsl_edma.h:194
eDMA TCD.
Definition fsl_edma.h:207
eDMA transfer configuration
Definition fsl_edma.h:171