rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
fsl_edma.c
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#include "hal.h"
10#include "fsl_edma.h"
11
12/*******************************************************************************
13 * Definitions
14 ******************************************************************************/
15
16/* Component ID definition, used by tools. */
17#ifndef FSL_COMPONENT_ID
18#define FSL_COMPONENT_ID "platform.drivers.edma"
19#endif
20
21#define EDMA_TRANSFER_ENABLED_MASK 0x80U
22
23/*******************************************************************************
24 * Prototypes
25 ******************************************************************************/
26
27/*!
28 * @brief Get instance number for EDMA.
29 *
30 * @param base EDMA peripheral base address.
31 */
32static uint32_t EDMA_GetInstance(DMA_Type *base);
33
34/*******************************************************************************
35 * Variables
36 ******************************************************************************/
37
38/*! @brief Array to map EDMA instance number to base pointer. */
39static DMA_Type *const s_edmaBases[] = DMA_BASE_PTRS;
40
41#if !(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL)
42/*! @brief Array to map EDMA instance number to clock name. */
43static const clock_ip_name_t s_edmaClockName[] = EDMA_CLOCKS;
44#endif /* FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL */
45
46/*! @brief Array to map EDMA instance number to IRQ number. */
47static const IRQn_Type s_edmaIRQNumber[][FSL_FEATURE_EDMA_MODULE_CHANNEL] = DMA_CHN_IRQS;
48
49/*! @brief Pointers to transfer handle for each EDMA channel. */
50static edma_handle_t *s_EDMAHandle[FSL_FEATURE_EDMA_MODULE_CHANNEL * FSL_FEATURE_SOC_EDMA_COUNT];
51
52/*******************************************************************************
53 * Code
54 ******************************************************************************/
55
56static uint32_t EDMA_GetInstance(DMA_Type *base)
57{
58 uint32_t instance;
59
60 /* Find the instance index from base address mappings. */
61 for (instance = 0; instance < ARRAY_SIZE(s_edmaBases); instance++)
62 {
63 if (s_edmaBases[instance] == base)
64 {
65 break;
66 }
67 }
68
69 assert(instance < ARRAY_SIZE(s_edmaBases));
70
71 return instance;
72}
73
74/*!
75 * brief Push content of TCD structure into hardware TCD register.
76 *
77 * param base EDMA peripheral base address.
78 * param channel EDMA channel number.
79 * param tcd Point to TCD structure.
80 */
81void EDMA_InstallTCD(DMA_Type *base, uint32_t channel, edma_tcd_t *tcd)
82{
83 assert(channel < FSL_FEATURE_EDMA_MODULE_CHANNEL);
84 assert(tcd != NULL);
85 assert(((uint32_t)tcd & 0x1FU) == 0);
86
87 /* Push tcd into hardware TCD register */
88 base->TCD[channel].SADDR = tcd->SADDR;
89 base->TCD[channel].SOFF = tcd->SOFF;
90 base->TCD[channel].ATTR = tcd->ATTR;
91 base->TCD[channel].NBYTES_MLNO = tcd->NBYTES;
92 base->TCD[channel].SLAST = tcd->SLAST;
93 base->TCD[channel].DADDR = tcd->DADDR;
94 base->TCD[channel].DOFF = tcd->DOFF;
95 base->TCD[channel].CITER_ELINKNO = tcd->CITER;
96 base->TCD[channel].DLAST_SGA = tcd->DLAST_SGA;
97 /* Clear DONE bit first, otherwise ESG cannot be set */
98 base->TCD[channel].CSR = 0;
99 base->TCD[channel].CSR = tcd->CSR;
100 base->TCD[channel].BITER_ELINKNO = tcd->BITER;
101}
102
103/*!
104 * brief Initializes the eDMA peripheral.
105 *
106 * This function ungates the eDMA clock and configures the eDMA peripheral according
107 * to the configuration structure.
108 *
109 * param base eDMA peripheral base address.
110 * param config A pointer to the configuration structure, see "edma_config_t".
111 * note This function enables the minor loop map feature.
112 */
113void EDMA_Init(DMA_Type *base, const edma_config_t *config)
114{
115 assert(config != NULL);
116
117 uint32_t tmpreg;
118
119#if !(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL)
120 /* Ungate EDMA peripheral clock */
122#endif /* FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL */
123
124 /* clear all the enabled request, status to make sure EDMA status is in normal condition */
125 base->ERQ = 0U;
126 base->INT = 0xFFFFFFFFU;
127 base->ERR = 0xFFFFFFFFU;
128 /* Configure EDMA peripheral according to the configuration structure. */
129 tmpreg = base->CR;
130 tmpreg &= ~(DMA_CR_ERCA_MASK | DMA_CR_HOE_MASK | DMA_CR_CLM_MASK | DMA_CR_EDBG_MASK);
131 tmpreg |= (DMA_CR_ERCA(config->enableRoundRobinArbitration) | DMA_CR_HOE(config->enableHaltOnError) |
132 DMA_CR_CLM(config->enableContinuousLinkMode) | DMA_CR_EDBG(config->enableDebugMode) | DMA_CR_EMLM(true));
133 base->CR = tmpreg;
134}
135
136/*!
137 * brief Deinitializes the eDMA peripheral.
138 *
139 * This function gates the eDMA clock.
140 *
141 * param base eDMA peripheral base address.
142 */
143void EDMA_Deinit(DMA_Type *base)
144{
145#if !(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL)
146 /* Gate EDMA peripheral clock */
148#endif /* FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL */
149}
150
151/*!
152 * brief Gets the eDMA default configuration structure.
153 *
154 * This function sets the configuration structure to default values.
155 * The default configuration is set to the following values.
156 * code
157 * config.enableContinuousLinkMode = false;
158 * config.enableHaltOnError = true;
159 * config.enableRoundRobinArbitration = false;
160 * config.enableDebugMode = false;
161 * endcode
162 *
163 * param config A pointer to the eDMA configuration structure.
164 */
166{
167 assert(config != NULL);
168
169 /* Initializes the configure structure to zero. */
170 memset(config, 0, sizeof(*config));
171
172 config->enableRoundRobinArbitration = false;
173 config->enableHaltOnError = true;
174 config->enableContinuousLinkMode = false;
175 config->enableDebugMode = false;
176}
177
178/*!
179 * brief Sets all TCD registers to default values.
180 *
181 * This function sets TCD registers for this channel to default values.
182 *
183 * param base eDMA peripheral base address.
184 * param channel eDMA channel number.
185 * note This function must not be called while the channel transfer is ongoing
186 * or it causes unpredictable results.
187 * note This function enables the auto stop request feature.
188 */
189void EDMA_ResetChannel(DMA_Type *base, uint32_t channel)
190{
191 assert(channel < FSL_FEATURE_EDMA_MODULE_CHANNEL);
192
193 EDMA_TcdReset((edma_tcd_t *)&base->TCD[channel]);
194}
195
196/*!
197 * brief Configures the eDMA transfer attribute.
198 *
199 * This function configures the transfer attribute, including source address, destination address,
200 * transfer size, address offset, and so on. It also configures the scatter gather feature if the
201 * user supplies the TCD address.
202 * Example:
203 * code
204 * edma_transfer_t config;
205 * edma_tcd_t tcd;
206 * config.srcAddr = ..;
207 * config.destAddr = ..;
208 * ...
209 * EDMA_SetTransferConfig(DMA0, channel, &config, &stcd);
210 * endcode
211 *
212 * param base eDMA peripheral base address.
213 * param channel eDMA channel number.
214 * param config Pointer to eDMA transfer configuration structure.
215 * param nextTcd Point to TCD structure. It can be NULL if users
216 * do not want to enable scatter/gather feature.
217 * note If nextTcd is not NULL, it means scatter gather feature is enabled
218 * and DREQ bit is cleared in the previous transfer configuration, which
219 * is set in the eDMA_ResetChannel.
220 */
221void EDMA_SetTransferConfig(DMA_Type *base, uint32_t channel, const edma_transfer_config_t *config, edma_tcd_t *nextTcd)
222{
223 assert(channel < FSL_FEATURE_EDMA_MODULE_CHANNEL);
224 assert(config != NULL);
225 assert(((uint32_t)nextTcd & 0x1FU) == 0);
226
227 EDMA_TcdSetTransferConfig((edma_tcd_t *)&base->TCD[channel], config, nextTcd);
228}
229
230/*!
231 * brief Configures the eDMA minor offset feature.
232 *
233 * The minor offset means that the signed-extended value is added to the source address or destination
234 * address after each minor loop.
235 *
236 * param base eDMA peripheral base address.
237 * param channel eDMA channel number.
238 * param config A pointer to the minor offset configuration structure.
239 */
241{
242 assert(channel < FSL_FEATURE_EDMA_MODULE_CHANNEL);
243 assert(config != NULL);
244
245 uint32_t tmpreg;
246
247 tmpreg = base->TCD[channel].NBYTES_MLOFFYES;
248 tmpreg &= ~(DMA_NBYTES_MLOFFYES_SMLOE_MASK | DMA_NBYTES_MLOFFYES_DMLOE_MASK | DMA_NBYTES_MLOFFYES_MLOFF_MASK);
249 tmpreg |=
250 (DMA_NBYTES_MLOFFYES_SMLOE(config->enableSrcMinorOffset) |
251 DMA_NBYTES_MLOFFYES_DMLOE(config->enableDestMinorOffset) | DMA_NBYTES_MLOFFYES_MLOFF(config->minorOffset));
252 base->TCD[channel].NBYTES_MLOFFYES = tmpreg;
253}
254
255/*!
256 * brief Sets the channel link for the eDMA transfer.
257 *
258 * This function configures either the minor link or the major link mode. The minor link means that the channel link is
259 * triggered every time CITER decreases by 1. The major link means that the channel link is triggered when the CITER is
260 * exhausted.
261 *
262 * param base eDMA peripheral base address.
263 * param channel eDMA channel number.
264 * param type A channel link type, which can be one of the following:
265 * arg kEDMA_LinkNone
266 * arg kEDMA_MinorLink
267 * arg kEDMA_MajorLink
268 * param linkedChannel The linked channel number.
269 * note Users should ensure that DONE flag is cleared before calling this interface, or the configuration is invalid.
270 */
271void EDMA_SetChannelLink(DMA_Type *base, uint32_t channel, edma_channel_link_type_t type, uint32_t linkedChannel)
272{
273 assert(channel < FSL_FEATURE_EDMA_MODULE_CHANNEL);
274 assert(linkedChannel < FSL_FEATURE_EDMA_MODULE_CHANNEL);
275
276 EDMA_TcdSetChannelLink((edma_tcd_t *)&base->TCD[channel], type, linkedChannel);
277}
278
279/*!
280 * brief Sets the bandwidth for the eDMA transfer.
281 *
282 * Because the eDMA processes the minor loop, it continuously generates read/write sequences
283 * until the minor count is exhausted. The bandwidth forces the eDMA to stall after the completion of
284 * each read/write access to control the bus request bandwidth seen by the crossbar switch.
285 *
286 * param base eDMA peripheral base address.
287 * param channel eDMA channel number.
288 * param bandWidth A bandwidth setting, which can be one of the following:
289 * arg kEDMABandwidthStallNone
290 * arg kEDMABandwidthStall4Cycle
291 * arg kEDMABandwidthStall8Cycle
292 */
293void EDMA_SetBandWidth(DMA_Type *base, uint32_t channel, edma_bandwidth_t bandWidth)
294{
295 assert(channel < FSL_FEATURE_EDMA_MODULE_CHANNEL);
296
297 base->TCD[channel].CSR = (base->TCD[channel].CSR & (~DMA_CSR_BWC_MASK)) | DMA_CSR_BWC(bandWidth);
298}
299
300/*!
301 * brief Sets the source modulo and the destination modulo for the eDMA transfer.
302 *
303 * This function defines a specific address range specified to be the value after (SADDR + SOFF)/(DADDR + DOFF)
304 * calculation is performed or the original register value. It provides the ability to implement a circular data
305 * queue easily.
306 *
307 * param base eDMA peripheral base address.
308 * param channel eDMA channel number.
309 * param srcModulo A source modulo value.
310 * param destModulo A destination modulo value.
311 */
312void EDMA_SetModulo(DMA_Type *base, uint32_t channel, edma_modulo_t srcModulo, edma_modulo_t destModulo)
313{
314 assert(channel < FSL_FEATURE_EDMA_MODULE_CHANNEL);
315
316 uint32_t tmpreg;
317
318 tmpreg = base->TCD[channel].ATTR & (~(DMA_ATTR_SMOD_MASK | DMA_ATTR_DMOD_MASK));
319 base->TCD[channel].ATTR = tmpreg | DMA_ATTR_DMOD(destModulo) | DMA_ATTR_SMOD(srcModulo);
320}
321
322/*!
323 * brief Enables the interrupt source for the eDMA transfer.
324 *
325 * param base eDMA peripheral base address.
326 * param channel eDMA channel number.
327 * param mask The mask of interrupt source to be set. Users need to use
328 * the defined edma_interrupt_enable_t type.
329 */
330void EDMA_EnableChannelInterrupts(DMA_Type *base, uint32_t channel, uint32_t mask)
331{
332 assert(channel < FSL_FEATURE_EDMA_MODULE_CHANNEL);
333
334 /* Enable error interrupt */
336 {
337 base->EEI |= (0x1U << channel);
338 }
339
340 /* Enable Major interrupt */
342 {
343 base->TCD[channel].CSR |= DMA_CSR_INTMAJOR_MASK;
344 }
345
346 /* Enable Half major interrupt */
347 if (mask & kEDMA_HalfInterruptEnable)
348 {
349 base->TCD[channel].CSR |= DMA_CSR_INTHALF_MASK;
350 }
351}
352
353/*!
354 * brief Disables the interrupt source for the eDMA transfer.
355 *
356 * param base eDMA peripheral base address.
357 * param channel eDMA channel number.
358 * param mask The mask of the interrupt source to be set. Use
359 * the defined edma_interrupt_enable_t type.
360 */
361void EDMA_DisableChannelInterrupts(DMA_Type *base, uint32_t channel, uint32_t mask)
362{
363 assert(channel < FSL_FEATURE_EDMA_MODULE_CHANNEL);
364
365 /* Disable error interrupt */
367 {
368 base->EEI &= ~(0x1U << channel);
369 }
370
371 /* Disable Major interrupt */
373 {
374 base->TCD[channel].CSR &= ~DMA_CSR_INTMAJOR_MASK;
375 }
376
377 /* Disable Half major interrupt */
378 if (mask & kEDMA_HalfInterruptEnable)
379 {
380 base->TCD[channel].CSR &= ~DMA_CSR_INTHALF_MASK;
381 }
382}
383
384/*!
385 * brief Sets all fields to default values for the TCD structure.
386 *
387 * This function sets all fields for this TCD structure to default value.
388 *
389 * param tcd Pointer to the TCD structure.
390 * note This function enables the auto stop request feature.
391 */
393{
394 assert(tcd != NULL);
395 assert(((uint32_t)tcd & 0x1FU) == 0);
396
397 /* Reset channel TCD */
398 tcd->SADDR = 0U;
399 tcd->SOFF = 0U;
400 tcd->ATTR = 0U;
401 tcd->NBYTES = 0U;
402 tcd->SLAST = 0U;
403 tcd->DADDR = 0U;
404 tcd->DOFF = 0U;
405 tcd->CITER = 0U;
406 tcd->DLAST_SGA = 0U;
407 /* Enable auto disable request feature */
408 tcd->CSR = DMA_CSR_DREQ(true);
409 tcd->BITER = 0U;
410}
411
412/*!
413 * brief Configures the eDMA TCD transfer attribute.
414 *
415 * The TCD is a transfer control descriptor. The content of the TCD is the same as the hardware TCD registers.
416 * The STCD is used in the scatter-gather mode.
417 * This function configures the TCD transfer attribute, including source address, destination address,
418 * transfer size, address offset, and so on. It also configures the scatter gather feature if the
419 * user supplies the next TCD address.
420 * Example:
421 * code
422 * edma_transfer_t config = {
423 * ...
424 * }
425 * edma_tcd_t tcd __aligned(32);
426 * edma_tcd_t nextTcd __aligned(32);
427 * EDMA_TcdSetTransferConfig(&tcd, &config, &nextTcd);
428 * endcode
429 *
430 * param tcd Pointer to the TCD structure.
431 * param config Pointer to eDMA transfer configuration structure.
432 * param nextTcd Pointer to the next TCD structure. It can be NULL if users
433 * do not want to enable scatter/gather feature.
434 * note TCD address should be 32 bytes aligned or it causes an eDMA error.
435 * note If the nextTcd is not NULL, the scatter gather feature is enabled
436 * and DREQ bit is cleared in the previous transfer configuration, which
437 * is set in the EDMA_TcdReset.
438 */
440{
441 assert(tcd != NULL);
442 assert(((uint32_t)tcd & 0x1FU) == 0);
443 assert(config != NULL);
444 assert(((uint32_t)nextTcd & 0x1FU) == 0);
445
446 /* source address */
447 tcd->SADDR = config->srcAddr;
448 /* destination address */
449 tcd->DADDR = config->destAddr;
450 /* Source data and destination data transfer size */
451 tcd->ATTR = DMA_ATTR_SSIZE(config->srcTransferSize) | DMA_ATTR_DSIZE(config->destTransferSize);
452 /* Source address signed offset */
453 tcd->SOFF = config->srcOffset;
454 /* Destination address signed offset */
455 tcd->DOFF = config->destOffset;
456 /* Minor byte transfer count */
457 tcd->NBYTES = config->minorLoopBytes;
458 /* Current major iteration count */
459 tcd->CITER = config->majorLoopCounts;
460 /* Starting major iteration count */
461 tcd->BITER = config->majorLoopCounts;
462 /* Enable scatter/gather processing */
463 if (nextTcd != NULL)
464 {
465 tcd->DLAST_SGA = (uint32_t)nextTcd;
466 /*
467 Before call EDMA_TcdSetTransferConfig or EDMA_SetTransferConfig,
468 user must call EDMA_TcdReset or EDMA_ResetChannel which will set
469 DREQ, so must use "|" or "&" rather than "=".
470
471 Clear the DREQ bit because scatter gather has been enabled, so the
472 previous transfer is not the last transfer, and channel request should
473 be enabled at the next transfer(the next TCD).
474 */
475 tcd->CSR = (tcd->CSR | DMA_CSR_ESG_MASK) & ~DMA_CSR_DREQ_MASK;
476 }
477}
478
479/*!
480 * brief Configures the eDMA TCD minor offset feature.
481 *
482 * A minor offset is a signed-extended value added to the source address or a destination
483 * address after each minor loop.
484 *
485 * param tcd A point to the TCD structure.
486 * param config A pointer to the minor offset configuration structure.
487 */
489{
490 assert(tcd != NULL);
491 assert(((uint32_t)tcd & 0x1FU) == 0);
492
493 uint32_t tmpreg;
494
495 tmpreg = tcd->NBYTES &
496 ~(DMA_NBYTES_MLOFFYES_SMLOE_MASK | DMA_NBYTES_MLOFFYES_DMLOE_MASK | DMA_NBYTES_MLOFFYES_MLOFF_MASK);
497 tmpreg |=
498 (DMA_NBYTES_MLOFFYES_SMLOE(config->enableSrcMinorOffset) |
499 DMA_NBYTES_MLOFFYES_DMLOE(config->enableDestMinorOffset) | DMA_NBYTES_MLOFFYES_MLOFF(config->minorOffset));
500 tcd->NBYTES = tmpreg;
501}
502
503/*!
504 * brief Sets the channel link for the eDMA TCD.
505 *
506 * This function configures either a minor link or a major link. The minor link means the channel link is
507 * triggered every time CITER decreases by 1. The major link means that the channel link is triggered when the CITER is
508 * exhausted.
509 *
510 * note Users should ensure that DONE flag is cleared before calling this interface, or the configuration is invalid.
511 * param tcd Point to the TCD structure.
512 * param type Channel link type, it can be one of:
513 * arg kEDMA_LinkNone
514 * arg kEDMA_MinorLink
515 * arg kEDMA_MajorLink
516 * param linkedChannel The linked channel number.
517 */
518void EDMA_TcdSetChannelLink(edma_tcd_t *tcd, edma_channel_link_type_t type, uint32_t linkedChannel)
519{
520 assert(tcd != NULL);
521 assert(((uint32_t)tcd & 0x1FU) == 0);
522 assert(linkedChannel < FSL_FEATURE_EDMA_MODULE_CHANNEL);
523
524 if (type == kEDMA_MinorLink) /* Minor link config */
525 {
526 uint32_t tmpreg;
527
528 /* Enable minor link */
529 tcd->CITER |= DMA_CITER_ELINKYES_ELINK_MASK;
530 tcd->BITER |= DMA_BITER_ELINKYES_ELINK_MASK;
531 /* Set linked channel */
532 tmpreg = tcd->CITER & (~DMA_CITER_ELINKYES_LINKCH_MASK);
533 tmpreg |= DMA_CITER_ELINKYES_LINKCH(linkedChannel);
534 tcd->CITER = tmpreg;
535 tmpreg = tcd->BITER & (~DMA_BITER_ELINKYES_LINKCH_MASK);
536 tmpreg |= DMA_BITER_ELINKYES_LINKCH(linkedChannel);
537 tcd->BITER = tmpreg;
538 }
539 else if (type == kEDMA_MajorLink) /* Major link config */
540 {
541 uint32_t tmpreg;
542
543 /* Enable major link */
544 tcd->CSR |= DMA_CSR_MAJORELINK_MASK;
545 /* Set major linked channel */
546 tmpreg = tcd->CSR & (~DMA_CSR_MAJORLINKCH_MASK);
547 tcd->CSR = tmpreg | DMA_CSR_MAJORLINKCH(linkedChannel);
548 }
549 else /* Link none */
550 {
551 tcd->CITER &= ~DMA_CITER_ELINKYES_ELINK_MASK;
552 tcd->BITER &= ~DMA_BITER_ELINKYES_ELINK_MASK;
553 tcd->CSR &= ~DMA_CSR_MAJORELINK_MASK;
554 }
555}
556
557/*!
558 * brief Sets the source modulo and the destination modulo for the eDMA TCD.
559 *
560 * This function defines a specific address range specified to be the value after (SADDR + SOFF)/(DADDR + DOFF)
561 * calculation is performed or the original register value. It provides the ability to implement a circular data
562 * queue easily.
563 *
564 * param tcd A pointer to the TCD structure.
565 * param srcModulo A source modulo value.
566 * param destModulo A destination modulo value.
567 */
569{
570 assert(tcd != NULL);
571 assert(((uint32_t)tcd & 0x1FU) == 0);
572
573 uint32_t tmpreg;
574
575 tmpreg = tcd->ATTR & (~(DMA_ATTR_SMOD_MASK | DMA_ATTR_DMOD_MASK));
576 tcd->ATTR = tmpreg | DMA_ATTR_DMOD(destModulo) | DMA_ATTR_SMOD(srcModulo);
577}
578
579/*!
580 * brief Enables the interrupt source for the eDMA TCD.
581 *
582 * param tcd Point to the TCD structure.
583 * param mask The mask of interrupt source to be set. Users need to use
584 * the defined edma_interrupt_enable_t type.
585 */
586void EDMA_TcdEnableInterrupts(edma_tcd_t *tcd, uint32_t mask)
587{
588 assert(tcd != NULL);
589
590 /* Enable Major interrupt */
592 {
593 tcd->CSR |= DMA_CSR_INTMAJOR_MASK;
594 }
595
596 /* Enable Half major interrupt */
597 if (mask & kEDMA_HalfInterruptEnable)
598 {
599 tcd->CSR |= DMA_CSR_INTHALF_MASK;
600 }
601}
602
603/*!
604 * brief Disables the interrupt source for the eDMA TCD.
605 *
606 * param tcd Point to the TCD structure.
607 * param mask The mask of interrupt source to be set. Users need to use
608 * the defined edma_interrupt_enable_t type.
609 */
610void EDMA_TcdDisableInterrupts(edma_tcd_t *tcd, uint32_t mask)
611{
612 assert(tcd != NULL);
613
614 /* Disable Major interrupt */
616 {
617 tcd->CSR &= ~DMA_CSR_INTMAJOR_MASK;
618 }
619
620 /* Disable Half major interrupt */
621 if (mask & kEDMA_HalfInterruptEnable)
622 {
623 tcd->CSR &= ~DMA_CSR_INTHALF_MASK;
624 }
625}
626
627/*!
628 * brief Gets the remaining major loop count from the eDMA current channel TCD.
629 *
630 * This function checks the TCD (Task Control Descriptor) status for a specified
631 * eDMA channel and returns the number of major loop count that has not finished.
632 *
633 * param base eDMA peripheral base address.
634 * param channel eDMA channel number.
635 * return Major loop count which has not been transferred yet for the current TCD.
636 * note 1. This function can only be used to get unfinished major loop count of transfer without
637 * the next TCD, or it might be inaccuracy.
638 * 2. The unfinished/remaining transfer bytes cannot be obtained directly from registers while
639 * the channel is running.
640 * Because to calculate the remaining bytes, the initial NBYTES configured in DMA_TCDn_NBYTES_MLNO
641 * register is needed while the eDMA IP does not support getting it while a channel is active.
642 * In another word, the NBYTES value reading is always the actual (decrementing) NBYTES value the dma_engine
643 * is working with while a channel is running.
644 * Consequently, to get the remaining transfer bytes, a software-saved initial value of NBYTES (for example
645 * copied before enabling the channel) is needed. The formula to calculate it is shown below:
646 * RemainingBytes = RemainingMajorLoopCount * NBYTES(initially configured)
647 */
648uint32_t EDMA_GetRemainingMajorLoopCount(DMA_Type *base, uint32_t channel)
649{
650 assert(channel < FSL_FEATURE_EDMA_MODULE_CHANNEL);
651
652 uint32_t remainingCount = 0;
653
654 if (DMA_CSR_DONE_MASK & base->TCD[channel].CSR)
655 {
656 remainingCount = 0;
657 }
658 else
659 {
660 /* Calculate the unfinished bytes */
661 if (base->TCD[channel].CITER_ELINKNO & DMA_CITER_ELINKNO_ELINK_MASK)
662 {
663 remainingCount =
664 (base->TCD[channel].CITER_ELINKYES & DMA_CITER_ELINKYES_CITER_MASK) >> DMA_CITER_ELINKYES_CITER_SHIFT;
665 }
666 else
667 {
668 remainingCount =
669 (base->TCD[channel].CITER_ELINKNO & DMA_CITER_ELINKNO_CITER_MASK) >> DMA_CITER_ELINKNO_CITER_SHIFT;
670 }
671 }
672
673 return remainingCount;
674}
675
676/*!
677 * brief Gets the eDMA channel status flags.
678 *
679 * param base eDMA peripheral base address.
680 * param channel eDMA channel number.
681 * return The mask of channel status flags. Users need to use the
682 * _edma_channel_status_flags type to decode the return variables.
683 */
684uint32_t EDMA_GetChannelStatusFlags(DMA_Type *base, uint32_t channel)
685{
686 assert(channel < FSL_FEATURE_EDMA_MODULE_CHANNEL);
687
688 uint32_t retval = 0;
689
690 /* Get DONE bit flag */
691 retval |= ((base->TCD[channel].CSR & DMA_CSR_DONE_MASK) >> DMA_CSR_DONE_SHIFT);
692 /* Get ERROR bit flag */
693 retval |= (((base->ERR >> channel) & 0x1U) << 1U);
694 /* Get INT bit flag */
695 retval |= (((base->INT >> channel) & 0x1U) << 2U);
696
697 return retval;
698}
699
700/*!
701 * brief Clears the eDMA channel status flags.
702 *
703 * param base eDMA peripheral base address.
704 * param channel eDMA channel number.
705 * param mask The mask of channel status to be cleared. Users need to use
706 * the defined _edma_channel_status_flags type.
707 */
708void EDMA_ClearChannelStatusFlags(DMA_Type *base, uint32_t channel, uint32_t mask)
709{
710 assert(channel < FSL_FEATURE_EDMA_MODULE_CHANNEL);
711
712 /* Clear DONE bit flag */
713 if (mask & kEDMA_DoneFlag)
714 {
715 base->CDNE = channel;
716 }
717 /* Clear ERROR bit flag */
718 if (mask & kEDMA_ErrorFlag)
719 {
720 base->CERR = channel;
721 }
722 /* Clear INT bit flag */
723 if (mask & kEDMA_InterruptFlag)
724 {
725 base->CINT = channel;
726 }
727}
728
729static uint8_t Get_StartInstance(void)
730{
731 static uint8_t StartInstanceNum;
732
733#if defined(DMA0)
734 StartInstanceNum = EDMA_GetInstance(DMA0);
735#elif defined(DMA1)
736 StartInstanceNum = EDMA_GetInstance(DMA1);
737#elif defined(DMA2)
738 StartInstanceNum = EDMA_GetInstance(DMA2);
739#elif defined(DMA3)
740 StartInstanceNum = EDMA_GetInstance(DMA3);
741#endif
742
743 return StartInstanceNum;
744}
745
746/*!
747 * brief Creates the eDMA handle.
748 *
749 * This function is called if using the transactional API for eDMA. This function
750 * initializes the internal state of the eDMA handle.
751 *
752 * param handle eDMA handle pointer. The eDMA handle stores callback function and
753 * parameters.
754 * param base eDMA peripheral base address.
755 * param channel eDMA channel number.
756 */
757void EDMA_CreateHandle(edma_handle_t *handle, DMA_Type *base, uint32_t channel)
758{
759 assert(handle != NULL);
760 assert(channel < FSL_FEATURE_EDMA_MODULE_CHANNEL);
761
762 uint32_t edmaInstance;
763 uint32_t channelIndex;
764 uint8_t StartInstance;
765 edma_tcd_t *tcdRegs;
766
767 /* Zero the handle */
768 memset(handle, 0, sizeof(*handle));
769
770 handle->base = base;
771 handle->channel = channel;
772 /* Get the DMA instance number */
773 edmaInstance = EDMA_GetInstance(base);
774 StartInstance = Get_StartInstance();
775 channelIndex = ((edmaInstance - StartInstance) * FSL_FEATURE_EDMA_MODULE_CHANNEL) + channel;
776 s_EDMAHandle[channelIndex] = handle;
777
778 /* Enable NVIC interrupt */
779 EnableIRQ(s_edmaIRQNumber[edmaInstance][channel]);
780
781 /*
782 Reset TCD registers to zero. Unlike the EDMA_TcdReset(DREQ will be set),
783 CSR will be 0. Because in order to suit EDMA busy check mechanism in
784 EDMA_SubmitTransfer, CSR must be set 0.
785 */
786 tcdRegs = (edma_tcd_t *)&handle->base->TCD[handle->channel];
787 tcdRegs->SADDR = 0;
788 tcdRegs->SOFF = 0;
789 tcdRegs->ATTR = 0;
790 tcdRegs->NBYTES = 0;
791 tcdRegs->SLAST = 0;
792 tcdRegs->DADDR = 0;
793 tcdRegs->DOFF = 0;
794 tcdRegs->CITER = 0;
795 tcdRegs->DLAST_SGA = 0;
796 tcdRegs->CSR = 0;
797 tcdRegs->BITER = 0;
798}
799
800/*!
801 * brief Installs the TCDs memory pool into the eDMA handle.
802 *
803 * This function is called after the EDMA_CreateHandle to use scatter/gather feature. This function shall only be used
804 * while users need to use scatter gather mode. Scatter gather mode enables EDMA to load a new transfer control block
805 * (tcd) in hardware, and automatically reconfigure that DMA channel for a new transfer.
806 * Users need to prepare tcd memory and also configure tcds using interface EDMA_SubmitTransfer.
807 *
808 * param handle eDMA handle pointer.
809 * param tcdPool A memory pool to store TCDs. It must be 32 bytes aligned.
810 * param tcdSize The number of TCD slots.
811 */
812void EDMA_InstallTCDMemory(edma_handle_t *handle, edma_tcd_t *tcdPool, uint32_t tcdSize)
813{
814 assert(handle != NULL);
815 assert(((uint32_t)tcdPool & 0x1FU) == 0);
816
817 /* Initialize tcd queue attribute. */
818 handle->header = 0;
819 handle->tail = 0;
820 handle->tcdUsed = 0;
821 handle->tcdSize = tcdSize;
822 handle->flags = 0;
823 handle->tcdPool = tcdPool;
824}
825
826/*!
827 * brief Installs a callback function for the eDMA transfer.
828 *
829 * This callback is called in the eDMA IRQ handler. Use the callback to do something after
830 * the current major loop transfer completes. This function will be called every time one tcd finished transfer.
831 *
832 * param handle eDMA handle pointer.
833 * param callback eDMA callback function pointer.
834 * param userData A parameter for the callback function.
835 */
836void EDMA_SetCallback(edma_handle_t *handle, edma_callback callback, void *userData)
837{
838 assert(handle != NULL);
839
840 handle->callback = callback;
841 handle->userData = userData;
842}
843
844/*!
845 * brief Prepares the eDMA transfer structure.
846 *
847 * This function prepares the transfer configuration structure according to the user input.
848 *
849 * param config The user configuration structure of type edma_transfer_t.
850 * param srcAddr eDMA transfer source address.
851 * param srcWidth eDMA transfer source address width(bytes).
852 * param destAddr eDMA transfer destination address.
853 * param destWidth eDMA transfer destination address width(bytes).
854 * param bytesEachRequest eDMA transfer bytes per channel request.
855 * param transferBytes eDMA transfer bytes to be transferred.
856 * param type eDMA transfer type.
857 * note The data address and the data width must be consistent. For example, if the SRC
858 * is 4 bytes, the source address must be 4 bytes aligned, or it results in
859 * source address error (SAE).
860 */
862 void *srcAddr,
863 uint32_t srcWidth,
864 void *destAddr,
865 uint32_t destWidth,
866 uint32_t bytesEachRequest,
867 uint32_t transferBytes,
869{
870 assert(config != NULL);
871 assert(srcAddr != NULL);
872 assert(destAddr != NULL);
873 assert((srcWidth == 1U) || (srcWidth == 2U) || (srcWidth == 4U) || (srcWidth == 16U) || (srcWidth == 32U));
874 assert((destWidth == 1U) || (destWidth == 2U) || (destWidth == 4U) || (destWidth == 16U) || (destWidth == 32U));
875 assert(transferBytes % bytesEachRequest == 0);
876
877 /* Initializes the configure structure to zero. */
878 memset(config, 0, sizeof(*config));
879
880 config->destAddr = (uint32_t)destAddr;
881 config->srcAddr = (uint32_t)srcAddr;
882 config->minorLoopBytes = bytesEachRequest;
883 config->majorLoopCounts = transferBytes / bytesEachRequest;
884 switch (srcWidth)
885 {
886 case 1U:
887 config->srcTransferSize = kEDMA_TransferSize1Bytes;
888 break;
889 case 2U:
890 config->srcTransferSize = kEDMA_TransferSize2Bytes;
891 break;
892 case 4U:
893 config->srcTransferSize = kEDMA_TransferSize4Bytes;
894 break;
895 case 16U:
896 config->srcTransferSize = kEDMA_TransferSize16Bytes;
897 break;
898 case 32U:
899 config->srcTransferSize = kEDMA_TransferSize32Bytes;
900 break;
901 default:
902 break;
903 }
904 switch (destWidth)
905 {
906 case 1U:
907 config->destTransferSize = kEDMA_TransferSize1Bytes;
908 break;
909 case 2U:
910 config->destTransferSize = kEDMA_TransferSize2Bytes;
911 break;
912 case 4U:
913 config->destTransferSize = kEDMA_TransferSize4Bytes;
914 break;
915 case 16U:
916 config->destTransferSize = kEDMA_TransferSize16Bytes;
917 break;
918 case 32U:
919 config->destTransferSize = kEDMA_TransferSize32Bytes;
920 break;
921 default:
922 break;
923 }
924 switch (type)
925 {
927 config->destOffset = destWidth;
928 config->srcOffset = srcWidth;
929 break;
931 config->destOffset = 0U;
932 config->srcOffset = srcWidth;
933 break;
935 config->destOffset = destWidth;
936 config->srcOffset = 0U;
937 break;
938 default:
939 break;
940 }
941}
942
943/*!
944 * brief Submits the eDMA transfer request.
945 *
946 * This function submits the eDMA transfer request according to the transfer configuration structure.
947 * In scatter gather mode, call this function will add a configured tcd to the circular list of tcd pool.
948 * The tcd pools is setup by call function EDMA_InstallTCDMemory before.
949 *
950 * param handle eDMA handle pointer.
951 * param config Pointer to eDMA transfer configuration structure.
952 * retval kStatus_EDMA_Success It means submit transfer request succeed.
953 * retval kStatus_EDMA_QueueFull It means TCD queue is full. Submit transfer request is not allowed.
954 * retval kStatus_EDMA_Busy It means the given channel is busy, need to submit request later.
955 */
957{
958 assert(handle != NULL);
959 assert(config != NULL);
960
961 edma_tcd_t *tcdRegs = (edma_tcd_t *)&handle->base->TCD[handle->channel];
962
963 if (handle->tcdPool == NULL)
964 {
965 /*
966 Check if EDMA is busy: if the given channel started transfer, CSR will be not zero. Because
967 if it is the last transfer, DREQ will be set. If not, ESG will be set. So in order to suit
968 this check mechanism, EDMA_CreatHandle will clear CSR register.
969 */
970 if ((tcdRegs->CSR != 0) && ((tcdRegs->CSR & DMA_CSR_DONE_MASK) == 0))
971 {
972 return kStatus_EDMA_Busy;
973 }
974 else
975 {
976 EDMA_SetTransferConfig(handle->base, handle->channel, config, NULL);
977 /* Enable auto disable request feature */
978 handle->base->TCD[handle->channel].CSR |= DMA_CSR_DREQ_MASK;
979 /* Enable major interrupt */
980 handle->base->TCD[handle->channel].CSR |= DMA_CSR_INTMAJOR_MASK;
981
982 return kStatus_Success;
983 }
984 }
985 else /* Use the TCD queue. */
986 {
987 uint32_t primask;
988 uint32_t csr;
989 int8_t currentTcd;
990 int8_t previousTcd;
991 int8_t nextTcd;
992
993 /* Check if tcd pool is full. */
994 primask = DisableGlobalIRQ();
995 if (handle->tcdUsed >= handle->tcdSize)
996 {
997 EnableGlobalIRQ(primask);
998
1000 }
1001 currentTcd = handle->tail;
1002 handle->tcdUsed++;
1003 /* Calculate index of next TCD */
1004 nextTcd = currentTcd + 1U;
1005 if (nextTcd == handle->tcdSize)
1006 {
1007 nextTcd = 0U;
1008 }
1009 /* Advance queue tail index */
1010 handle->tail = nextTcd;
1011 EnableGlobalIRQ(primask);
1012 /* Calculate index of previous TCD */
1013 previousTcd = currentTcd ? currentTcd - 1U : handle->tcdSize - 1U;
1014 /* Configure current TCD block. */
1015 EDMA_TcdReset(&handle->tcdPool[currentTcd]);
1016 EDMA_TcdSetTransferConfig(&handle->tcdPool[currentTcd], config, NULL);
1017 /* Enable major interrupt */
1018 handle->tcdPool[currentTcd].CSR |= DMA_CSR_INTMAJOR_MASK;
1019 /* Link current TCD with next TCD for identification of current TCD */
1020 handle->tcdPool[currentTcd].DLAST_SGA = (uint32_t)&handle->tcdPool[nextTcd];
1021 /* Chain from previous descriptor unless tcd pool size is 1(this descriptor is its own predecessor). */
1022 if (currentTcd != previousTcd)
1023 {
1024 /* Enable scatter/gather feature in the previous TCD block. */
1025 csr = (handle->tcdPool[previousTcd].CSR | DMA_CSR_ESG_MASK) & ~DMA_CSR_DREQ_MASK;
1026 handle->tcdPool[previousTcd].CSR = csr;
1027 /*
1028 Check if the TCD block in the registers is the previous one (points to current TCD block). It
1029 is used to check if the previous TCD linked has been loaded in TCD register. If so, it need to
1030 link the TCD register in case link the current TCD with the dead chain when TCD loading occurs
1031 before link the previous TCD block.
1032 */
1033 if (tcdRegs->DLAST_SGA == (uint32_t)&handle->tcdPool[currentTcd])
1034 {
1035 /* Clear the DREQ bits for the dynamic scatter gather */
1036 tcdRegs->CSR |= DMA_CSR_DREQ_MASK;
1037 /* Enable scatter/gather also in the TCD registers. */
1038 csr = tcdRegs->CSR | DMA_CSR_ESG_MASK;
1039 /* Must write the CSR register one-time, because the transfer maybe finished anytime. */
1040 tcdRegs->CSR = csr;
1041 /*
1042 It is very important to check the ESG bit!
1043 Because this hardware design: if DONE bit is set, the ESG bit can not be set. So it can
1044 be used to check if the dynamic TCD link operation is successful. If ESG bit is not set
1045 and the DLAST_SGA is not the next TCD address(it means the dynamic TCD link succeed and
1046 the current TCD block has been loaded into TCD registers), it means transfer finished
1047 and TCD link operation fail, so must install TCD content into TCD registers and enable
1048 transfer again. And if ESG is set, it means transfer has not finished, so TCD dynamic
1049 link succeed.
1050 */
1051 if (tcdRegs->CSR & DMA_CSR_ESG_MASK)
1052 {
1053 tcdRegs->CSR &= ~DMA_CSR_DREQ_MASK;
1054 return kStatus_Success;
1055 }
1056 /*
1057 Check whether the current TCD block is already loaded in the TCD registers. It is another
1058 condition when ESG bit is not set: it means the dynamic TCD link succeed and the current
1059 TCD block has been loaded into TCD registers.
1060 */
1061 if (tcdRegs->DLAST_SGA == (uint32_t)&handle->tcdPool[nextTcd])
1062 {
1063 return kStatus_Success;
1064 }
1065 /*
1066 If go to this, means the previous transfer finished, and the DONE bit is set.
1067 So shall configure TCD registers.
1068 */
1069 }
1070 else if (tcdRegs->DLAST_SGA != 0)
1071 {
1072 /* The current TCD block has been linked successfully. */
1073 return kStatus_Success;
1074 }
1075 else
1076 {
1077 /*
1078 DLAST_SGA is 0 and it means the first submit transfer, so shall configure
1079 TCD registers.
1080 */
1081 }
1082 }
1083 /* There is no live chain, TCD block need to be installed in TCD registers. */
1084 EDMA_InstallTCD(handle->base, handle->channel, &handle->tcdPool[currentTcd]);
1085 /* Enable channel request again. */
1086 if (handle->flags & EDMA_TRANSFER_ENABLED_MASK)
1087 {
1088 handle->base->SERQ = DMA_SERQ_SERQ(handle->channel);
1089 }
1090
1091 return kStatus_Success;
1092 }
1093}
1094
1095/*!
1096 * brief eDMA starts transfer.
1097 *
1098 * This function enables the channel request. Users can call this function after submitting the transfer request
1099 * or before submitting the transfer request.
1100 *
1101 * param handle eDMA handle pointer.
1102 */
1104{
1105 assert(handle != NULL);
1106
1107 if (handle->tcdPool == NULL)
1108 {
1109 handle->base->SERQ = DMA_SERQ_SERQ(handle->channel);
1110 }
1111 else /* Use the TCD queue. */
1112 {
1113 uint32_t primask;
1114 edma_tcd_t *tcdRegs = (edma_tcd_t *)&handle->base->TCD[handle->channel];
1115
1116 handle->flags |= EDMA_TRANSFER_ENABLED_MASK;
1117
1118 /* Check if there was at least one descriptor submitted since reset (TCD in registers is valid) */
1119 if (tcdRegs->DLAST_SGA != 0U)
1120 {
1121 primask = DisableGlobalIRQ();
1122 /* Check if channel request is actually disable. */
1123 if ((handle->base->ERQ & (1U << handle->channel)) == 0U)
1124 {
1125 /* Check if transfer is paused. */
1126 if ((!(tcdRegs->CSR & DMA_CSR_DONE_MASK)) || (tcdRegs->CSR & DMA_CSR_ESG_MASK))
1127 {
1128 /*
1129 Re-enable channel request must be as soon as possible, so must put it into
1130 critical section to avoid task switching or interrupt service routine.
1131 */
1132 handle->base->SERQ = DMA_SERQ_SERQ(handle->channel);
1133 }
1134 }
1135 EnableGlobalIRQ(primask);
1136 }
1137 }
1138}
1139
1140/*!
1141 * brief eDMA stops transfer.
1142 *
1143 * This function disables the channel request to pause the transfer. Users can call EDMA_StartTransfer()
1144 * again to resume the transfer.
1145 *
1146 * param handle eDMA handle pointer.
1147 */
1149{
1150 assert(handle != NULL);
1151
1152 handle->flags &= (~EDMA_TRANSFER_ENABLED_MASK);
1153 handle->base->CERQ = DMA_CERQ_CERQ(handle->channel);
1154}
1155
1156/*!
1157 * brief eDMA aborts transfer.
1158 *
1159 * This function disables the channel request and clear transfer status bits.
1160 * Users can submit another transfer after calling this API.
1161 *
1162 * param handle DMA handle pointer.
1163 */
1165{
1166 handle->base->CERQ = DMA_CERQ_CERQ(handle->channel);
1167 /*
1168 Clear CSR to release channel. Because if the given channel started transfer,
1169 CSR will be not zero. Because if it is the last transfer, DREQ will be set.
1170 If not, ESG will be set.
1171 */
1172 handle->base->TCD[handle->channel].CSR = 0;
1173 /* Cancel all next TCD transfer. */
1174 handle->base->TCD[handle->channel].DLAST_SGA = 0;
1175
1176 /* Handle the tcd */
1177 if (handle->tcdPool != NULL)
1178 {
1179 handle->header = 0;
1180 handle->tail = 0;
1181 handle->tcdUsed = 0;
1182 }
1183}
1184
1185/*!
1186 * brief eDMA IRQ handler for the current major loop transfer completion.
1187 *
1188 * This function clears the channel major interrupt flag and calls
1189 * the callback function if it is not NULL.
1190 *
1191 * Note:
1192 * For the case using TCD queue, when the major iteration count is exhausted, additional operations are performed.
1193 * These include the final address adjustments and reloading of the BITER field into the CITER.
1194 * Assertion of an optional interrupt request also occurs at this time, as does a possible fetch of a new TCD from
1195 * memory using the scatter/gather address pointer included in the descriptor (if scatter/gather is enabled).
1196 *
1197 * For instance, when the time interrupt of TCD[0] happens, the TCD[1] has already been loaded into the eDMA engine.
1198 * As sga and sga_index are calculated based on the DLAST_SGA bitfield lies in the TCD_CSR register, the sga_index
1199 * in this case should be 2 (DLAST_SGA of TCD[1] stores the address of TCD[2]). Thus, the "tcdUsed" updated should be
1200 * (tcdUsed - 2U) which indicates the number of TCDs can be loaded in the memory pool (because TCD[0] and TCD[1] have
1201 * been loaded into the eDMA engine at this point already.).
1202 *
1203 * For the last two continuous ISRs in a scatter/gather process, they both load the last TCD (The last ISR does not
1204 * load a new TCD) from the memory pool to the eDMA engine when major loop completes.
1205 * Therefore, ensure that the header and tcdUsed updated are identical for them.
1206 * tcdUsed are both 0 in this case as no TCD to be loaded.
1207 *
1208 * See the "eDMA basic data flow" in the eDMA Functional description section of the Reference Manual for
1209 * further details.
1210 *
1211 * param handle eDMA handle pointer.
1212 */
1214{
1215 assert(handle != NULL);
1216
1217 /* Clear EDMA interrupt flag */
1218 handle->base->CINT = handle->channel;
1219 if ((handle->tcdPool == NULL) && (handle->callback != NULL))
1220 {
1221 (handle->callback)(handle, handle->userData, true, 0);
1222 }
1223 else /* Use the TCD queue. Please refer to the API descriptions in the eDMA header file for detailed information. */
1224 {
1225 uint32_t sga = handle->base->TCD[handle->channel].DLAST_SGA;
1226 uint32_t sga_index;
1227 int32_t tcds_done;
1228 uint8_t new_header;
1229 bool transfer_done;
1230
1231 /* Check if transfer is already finished. */
1232 transfer_done = ((handle->base->TCD[handle->channel].CSR & DMA_CSR_DONE_MASK) != 0);
1233 /* Get the offset of the next transfer TCD blocks to be loaded into the eDMA engine. */
1234 sga -= (uint32_t)handle->tcdPool;
1235 /* Get the index of the next transfer TCD blocks to be loaded into the eDMA engine. */
1236 sga_index = sga / sizeof(edma_tcd_t);
1237 /* Adjust header positions. */
1238 if (transfer_done)
1239 {
1240 /* New header shall point to the next TCD to be loaded (current one is already finished) */
1241 new_header = sga_index;
1242 }
1243 else
1244 {
1245 /* New header shall point to this descriptor currently loaded (not finished yet) */
1246 new_header = sga_index ? sga_index - 1U : handle->tcdSize - 1U;
1247 }
1248 /* Calculate the number of finished TCDs */
1249 if (new_header == handle->header)
1250 {
1251 if (handle->tcdUsed == handle->tcdSize)
1252 {
1253 tcds_done = handle->tcdUsed;
1254 }
1255 else
1256 {
1257 /* No TCD in the memory are going to be loaded or internal error occurs. */
1258 tcds_done = 0;
1259 }
1260 }
1261 else
1262 {
1263 tcds_done = new_header - handle->header;
1264 if (tcds_done < 0)
1265 {
1266 tcds_done += handle->tcdSize;
1267 }
1268 }
1269 /* Advance header which points to the TCD to be loaded into the eDMA engine from memory. */
1270 handle->header = new_header;
1271 /* Release TCD blocks. tcdUsed is the TCD number which can be used/loaded in the memory pool. */
1272 handle->tcdUsed -= tcds_done;
1273 /* Invoke callback function. */
1274 if (handle->callback)
1275 {
1276 (handle->callback)(handle, handle->userData, transfer_done, tcds_done);
1277 }
1278
1279 /* clear the DONE bit here is meaningful for below cases:
1280 *1.A new TCD has been loaded to EDMA already:
1281 * need to clear the DONE bit in the IRQ handler to avoid TCD in EDMA been overwritten
1282 * if peripheral request isn't coming before next transfer request.
1283 *2.A new TCD has not been loaded to EDMA:
1284 * for the case that transfer request occur in the privious edma callback, this is a case that doesn't
1285 * need scatter gather, so keep DONE bit during the next transfer request will re-install the TCD.
1286 */
1287 if (transfer_done)
1288 {
1289 handle->base->CDNE = handle->channel;
1290 }
1291 }
1292}
1293
1294/* 8 channels (Shared): kl28 */
1295#if defined(FSL_FEATURE_EDMA_MODULE_CHANNEL) && FSL_FEATURE_EDMA_MODULE_CHANNEL == 8U
1296
1297#if defined(DMA0)
1299{
1300 if ((EDMA_GetChannelStatusFlags(DMA0, 0U) & kEDMA_InterruptFlag) != 0U)
1301 {
1303 }
1304 if ((EDMA_GetChannelStatusFlags(DMA0, 4U) & kEDMA_InterruptFlag) != 0U)
1305 {
1307 }
1308/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
1309 exception return operation might vector to incorrect interrupt */
1310#if defined __CORTEX_M && (__CORTEX_M == 4U)
1311 __DSB();
1312#endif
1313}
1314
1316{
1317 if ((EDMA_GetChannelStatusFlags(DMA0, 1U) & kEDMA_InterruptFlag) != 0U)
1318 {
1320 }
1321 if ((EDMA_GetChannelStatusFlags(DMA0, 5U) & kEDMA_InterruptFlag) != 0U)
1322 {
1324 }
1325/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
1326 exception return operation might vector to incorrect interrupt */
1327#if defined __CORTEX_M && (__CORTEX_M == 4U)
1328 __DSB();
1329#endif
1330}
1331
1333{
1334 if ((EDMA_GetChannelStatusFlags(DMA0, 2U) & kEDMA_InterruptFlag) != 0U)
1335 {
1337 }
1338 if ((EDMA_GetChannelStatusFlags(DMA0, 6U) & kEDMA_InterruptFlag) != 0U)
1339 {
1341 }
1342/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
1343 exception return operation might vector to incorrect interrupt */
1344#if defined __CORTEX_M && (__CORTEX_M == 4U)
1345 __DSB();
1346#endif
1347}
1348
1350{
1351 if ((EDMA_GetChannelStatusFlags(DMA0, 3U) & kEDMA_InterruptFlag) != 0U)
1352 {
1354 }
1355 if ((EDMA_GetChannelStatusFlags(DMA0, 7U) & kEDMA_InterruptFlag) != 0U)
1356 {
1358 }
1359/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
1360 exception return operation might vector to incorrect interrupt */
1361#if defined __CORTEX_M && (__CORTEX_M == 4U)
1362 __DSB();
1363#endif
1364}
1365#endif
1366
1367#if defined(DMA1)
1368
1369#if defined(DMA0)
1371{
1372 if ((EDMA_GetChannelStatusFlags(DMA1, 0U) & kEDMA_InterruptFlag) != 0U)
1373 {
1375 }
1376 if ((EDMA_GetChannelStatusFlags(DMA1, 4U) & kEDMA_InterruptFlag) != 0U)
1377 {
1379 }
1380/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
1381 exception return operation might vector to incorrect interrupt */
1382#if defined __CORTEX_M && (__CORTEX_M == 4U)
1383 __DSB();
1384#endif
1385}
1386
1388{
1389 if ((EDMA_GetChannelStatusFlags(DMA1, 1U) & kEDMA_InterruptFlag) != 0U)
1390 {
1392 }
1393 if ((EDMA_GetChannelStatusFlags(DMA1, 5U) & kEDMA_InterruptFlag) != 0U)
1394 {
1396 }
1397/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
1398 exception return operation might vector to incorrect interrupt */
1399#if defined __CORTEX_M && (__CORTEX_M == 4U)
1400 __DSB();
1401#endif
1402}
1403
1405{
1406 if ((EDMA_GetChannelStatusFlags(DMA1, 2U) & kEDMA_InterruptFlag) != 0U)
1407 {
1409 }
1410 if ((EDMA_GetChannelStatusFlags(DMA1, 6U) & kEDMA_InterruptFlag) != 0U)
1411 {
1413 }
1414/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
1415 exception return operation might vector to incorrect interrupt */
1416#if defined __CORTEX_M && (__CORTEX_M == 4U)
1417 __DSB();
1418#endif
1419}
1420
1422{
1423 if ((EDMA_GetChannelStatusFlags(DMA1, 3U) & kEDMA_InterruptFlag) != 0U)
1424 {
1426 }
1427 if ((EDMA_GetChannelStatusFlags(DMA1, 7U) & kEDMA_InterruptFlag) != 0U)
1428 {
1430 }
1431/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
1432 exception return operation might vector to incorrect interrupt */
1433#if defined __CORTEX_M && (__CORTEX_M == 4U)
1434 __DSB();
1435#endif
1436}
1437
1438#else
1439void DMA1_04_DriverIRQHandler(void)
1440{
1441 if ((EDMA_GetChannelStatusFlags(DMA1, 0U) & kEDMA_InterruptFlag) != 0U)
1442 {
1444 }
1445 if ((EDMA_GetChannelStatusFlags(DMA1, 4U) & kEDMA_InterruptFlag) != 0U)
1446 {
1448 }
1449/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
1450 exception return operation might vector to incorrect interrupt */
1451#if defined __CORTEX_M && (__CORTEX_M == 4U)
1452 __DSB();
1453#endif
1454}
1455
1456void DMA1_15_DriverIRQHandler(void)
1457{
1458 if ((EDMA_GetChannelStatusFlags(DMA1, 1U) & kEDMA_InterruptFlag) != 0U)
1459 {
1461 }
1462 if ((EDMA_GetChannelStatusFlags(DMA1, 5U) & kEDMA_InterruptFlag) != 0U)
1463 {
1465 }
1466/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
1467 exception return operation might vector to incorrect interrupt */
1468#if defined __CORTEX_M && (__CORTEX_M == 4U)
1469 __DSB();
1470#endif
1471}
1472
1473void DMA1_26_DriverIRQHandler(void)
1474{
1475 if ((EDMA_GetChannelStatusFlags(DMA1, 2U) & kEDMA_InterruptFlag) != 0U)
1476 {
1478 }
1479 if ((EDMA_GetChannelStatusFlags(DMA1, 6U) & kEDMA_InterruptFlag) != 0U)
1480 {
1482 }
1483/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
1484 exception return operation might vector to incorrect interrupt */
1485#if defined __CORTEX_M && (__CORTEX_M == 4U)
1486 __DSB();
1487#endif
1488}
1489
1490void DMA1_37_DriverIRQHandler(void)
1491{
1492 if ((EDMA_GetChannelStatusFlags(DMA1, 3U) & kEDMA_InterruptFlag) != 0U)
1493 {
1495 }
1496 if ((EDMA_GetChannelStatusFlags(DMA1, 7U) & kEDMA_InterruptFlag) != 0U)
1497 {
1499 }
1500/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
1501 exception return operation might vector to incorrect interrupt */
1502#if defined __CORTEX_M && (__CORTEX_M == 4U)
1503 __DSB();
1504#endif
1505}
1506#endif
1507#endif
1508#endif /* 8 channels (Shared) */
1509
1510/* 16 channels (Shared): K32H844P */
1511#if defined(FSL_FEATURE_EDMA_MODULE_CHANNEL) && FSL_FEATURE_EDMA_MODULE_CHANNEL == 16U
1512
1514{
1515 if ((EDMA_GetChannelStatusFlags(DMA0, 0U) & kEDMA_InterruptFlag) != 0U)
1516 {
1518 }
1519 if ((EDMA_GetChannelStatusFlags(DMA0, 8U) & kEDMA_InterruptFlag) != 0U)
1520 {
1522 }
1523/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
1524 exception return operation might vector to incorrect interrupt */
1525#if defined __CORTEX_M && (__CORTEX_M == 4U)
1526 __DSB();
1527#endif
1528}
1529
1531{
1532 if ((EDMA_GetChannelStatusFlags(DMA0, 1U) & kEDMA_InterruptFlag) != 0U)
1533 {
1535 }
1536 if ((EDMA_GetChannelStatusFlags(DMA0, 9U) & kEDMA_InterruptFlag) != 0U)
1537 {
1539 }
1540/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
1541 exception return operation might vector to incorrect interrupt */
1542#if defined __CORTEX_M && (__CORTEX_M == 4U)
1543 __DSB();
1544#endif
1545}
1546
1548{
1549 if ((EDMA_GetChannelStatusFlags(DMA0, 2U) & kEDMA_InterruptFlag) != 0U)
1550 {
1552 }
1553 if ((EDMA_GetChannelStatusFlags(DMA0, 10U) & kEDMA_InterruptFlag) != 0U)
1554 {
1556 }
1557/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
1558 exception return operation might vector to incorrect interrupt */
1559#if defined __CORTEX_M && (__CORTEX_M == 4U)
1560 __DSB();
1561#endif
1562}
1563
1565{
1566 if ((EDMA_GetChannelStatusFlags(DMA0, 3U) & kEDMA_InterruptFlag) != 0U)
1567 {
1569 }
1570 if ((EDMA_GetChannelStatusFlags(DMA0, 11U) & kEDMA_InterruptFlag) != 0U)
1571 {
1573 }
1574/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
1575 exception return operation might vector to incorrect interrupt */
1576#if defined __CORTEX_M && (__CORTEX_M == 4U)
1577 __DSB();
1578#endif
1579}
1580
1582{
1583 if ((EDMA_GetChannelStatusFlags(DMA0, 4U) & kEDMA_InterruptFlag) != 0U)
1584 {
1586 }
1587 if ((EDMA_GetChannelStatusFlags(DMA0, 12U) & kEDMA_InterruptFlag) != 0U)
1588 {
1590 }
1591/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
1592 exception return operation might vector to incorrect interrupt */
1593#if defined __CORTEX_M && (__CORTEX_M == 4U)
1594 __DSB();
1595#endif
1596}
1597
1599{
1600 if ((EDMA_GetChannelStatusFlags(DMA0, 5U) & kEDMA_InterruptFlag) != 0U)
1601 {
1603 }
1604 if ((EDMA_GetChannelStatusFlags(DMA0, 13U) & kEDMA_InterruptFlag) != 0U)
1605 {
1607 }
1608/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
1609 exception return operation might vector to incorrect interrupt */
1610#if defined __CORTEX_M && (__CORTEX_M == 4U)
1611 __DSB();
1612#endif
1613}
1614
1616{
1617 if ((EDMA_GetChannelStatusFlags(DMA0, 6U) & kEDMA_InterruptFlag) != 0U)
1618 {
1620 }
1621 if ((EDMA_GetChannelStatusFlags(DMA0, 14U) & kEDMA_InterruptFlag) != 0U)
1622 {
1624 }
1625/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
1626 exception return operation might vector to incorrect interrupt */
1627#if defined __CORTEX_M && (__CORTEX_M == 4U)
1628 __DSB();
1629#endif
1630}
1631
1633{
1634 if ((EDMA_GetChannelStatusFlags(DMA0, 7U) & kEDMA_InterruptFlag) != 0U)
1635 {
1637 }
1638 if ((EDMA_GetChannelStatusFlags(DMA0, 15U) & kEDMA_InterruptFlag) != 0U)
1639 {
1641 }
1642/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
1643 exception return operation might vector to incorrect interrupt */
1644#if defined __CORTEX_M && (__CORTEX_M == 4U)
1645 __DSB();
1646#endif
1647}
1648
1649#if defined(DMA1)
1651{
1652 if ((EDMA_GetChannelStatusFlags(DMA1, 0U) & kEDMA_InterruptFlag) != 0U)
1653 {
1655 }
1656 if ((EDMA_GetChannelStatusFlags(DMA1, 8U) & kEDMA_InterruptFlag) != 0U)
1657 {
1659 }
1660/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
1661 exception return operation might vector to incorrect interrupt */
1662#if defined __CORTEX_M && (__CORTEX_M == 4U)
1663 __DSB();
1664#endif
1665}
1666
1668{
1669 if ((EDMA_GetChannelStatusFlags(DMA1, 1U) & kEDMA_InterruptFlag) != 0U)
1670 {
1672 }
1673 if ((EDMA_GetChannelStatusFlags(DMA1, 9U) & kEDMA_InterruptFlag) != 0U)
1674 {
1676 }
1677/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
1678 exception return operation might vector to incorrect interrupt */
1679#if defined __CORTEX_M && (__CORTEX_M == 4U)
1680 __DSB();
1681#endif
1682}
1683
1685{
1686 if ((EDMA_GetChannelStatusFlags(DMA1, 2U) & kEDMA_InterruptFlag) != 0U)
1687 {
1689 }
1690 if ((EDMA_GetChannelStatusFlags(DMA1, 10U) & kEDMA_InterruptFlag) != 0U)
1691 {
1693 }
1694/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
1695 exception return operation might vector to incorrect interrupt */
1696#if defined __CORTEX_M && (__CORTEX_M == 4U)
1697 __DSB();
1698#endif
1699}
1700
1702{
1703 if ((EDMA_GetChannelStatusFlags(DMA1, 3U) & kEDMA_InterruptFlag) != 0U)
1704 {
1706 }
1707 if ((EDMA_GetChannelStatusFlags(DMA1, 11U) & kEDMA_InterruptFlag) != 0U)
1708 {
1710 }
1711/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
1712 exception return operation might vector to incorrect interrupt */
1713#if defined __CORTEX_M && (__CORTEX_M == 4U)
1714 __DSB();
1715#endif
1716}
1717
1719{
1720 if ((EDMA_GetChannelStatusFlags(DMA1, 4U) & kEDMA_InterruptFlag) != 0U)
1721 {
1723 }
1724 if ((EDMA_GetChannelStatusFlags(DMA1, 12U) & kEDMA_InterruptFlag) != 0U)
1725 {
1727 }
1728/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
1729 exception return operation might vector to incorrect interrupt */
1730#if defined __CORTEX_M && (__CORTEX_M == 4U)
1731 __DSB();
1732#endif
1733}
1734
1736{
1737 if ((EDMA_GetChannelStatusFlags(DMA1, 5U) & kEDMA_InterruptFlag) != 0U)
1738 {
1740 }
1741 if ((EDMA_GetChannelStatusFlags(DMA1, 13U) & kEDMA_InterruptFlag) != 0U)
1742 {
1744 }
1745/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
1746 exception return operation might vector to incorrect interrupt */
1747#if defined __CORTEX_M && (__CORTEX_M == 4U)
1748 __DSB();
1749#endif
1750}
1751
1753{
1754 if ((EDMA_GetChannelStatusFlags(DMA1, 6U) & kEDMA_InterruptFlag) != 0U)
1755 {
1757 }
1758 if ((EDMA_GetChannelStatusFlags(DMA1, 14U) & kEDMA_InterruptFlag) != 0U)
1759 {
1761 }
1762/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
1763 exception return operation might vector to incorrect interrupt */
1764#if defined __CORTEX_M && (__CORTEX_M == 4U)
1765 __DSB();
1766#endif
1767}
1768
1770{
1771 if ((EDMA_GetChannelStatusFlags(DMA1, 7U) & kEDMA_InterruptFlag) != 0U)
1772 {
1774 }
1775 if ((EDMA_GetChannelStatusFlags(DMA1, 15U) & kEDMA_InterruptFlag) != 0U)
1776 {
1778 }
1779/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
1780 exception return operation might vector to incorrect interrupt */
1781#if defined __CORTEX_M && (__CORTEX_M == 4U)
1782 __DSB();
1783#endif
1784}
1785#endif
1786#endif /* 16 channels (Shared) */
1787
1788/* 32 channels (Shared): k80 */
1789#if defined(FSL_FEATURE_EDMA_MODULE_CHANNEL) && FSL_FEATURE_EDMA_MODULE_CHANNEL == 32U
1790
1792{
1793 if ((EDMA_GetChannelStatusFlags(DMA0, 0U) & kEDMA_InterruptFlag) != 0U)
1794 {
1796 }
1797 if ((EDMA_GetChannelStatusFlags(DMA0, 16U) & kEDMA_InterruptFlag) != 0U)
1798 {
1800 }
1801/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
1802 exception return operation might vector to incorrect interrupt */
1803#if defined __CORTEX_M && (__CORTEX_M == 4U)
1804 __DSB();
1805#endif
1806}
1807
1809{
1810 if ((EDMA_GetChannelStatusFlags(DMA0, 1U) & kEDMA_InterruptFlag) != 0U)
1811 {
1813 }
1814 if ((EDMA_GetChannelStatusFlags(DMA0, 17U) & kEDMA_InterruptFlag) != 0U)
1815 {
1817 }
1818/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
1819 exception return operation might vector to incorrect interrupt */
1820#if defined __CORTEX_M && (__CORTEX_M == 4U)
1821 __DSB();
1822#endif
1823}
1824
1826{
1827 if ((EDMA_GetChannelStatusFlags(DMA0, 2U) & kEDMA_InterruptFlag) != 0U)
1828 {
1830 }
1831 if ((EDMA_GetChannelStatusFlags(DMA0, 18U) & kEDMA_InterruptFlag) != 0U)
1832 {
1834 }
1835/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
1836 exception return operation might vector to incorrect interrupt */
1837#if defined __CORTEX_M && (__CORTEX_M == 4U)
1838 __DSB();
1839#endif
1840}
1841
1843{
1844 if ((EDMA_GetChannelStatusFlags(DMA0, 3U) & kEDMA_InterruptFlag) != 0U)
1845 {
1847 }
1848 if ((EDMA_GetChannelStatusFlags(DMA0, 19U) & kEDMA_InterruptFlag) != 0U)
1849 {
1851 }
1852/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
1853 exception return operation might vector to incorrect interrupt */
1854#if defined __CORTEX_M && (__CORTEX_M == 4U)
1855 __DSB();
1856#endif
1857}
1858
1860{
1861 if ((EDMA_GetChannelStatusFlags(DMA0, 4U) & kEDMA_InterruptFlag) != 0U)
1862 {
1864 }
1865 if ((EDMA_GetChannelStatusFlags(DMA0, 20U) & kEDMA_InterruptFlag) != 0U)
1866 {
1868 }
1869/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
1870 exception return operation might vector to incorrect interrupt */
1871#if defined __CORTEX_M && (__CORTEX_M == 4U)
1872 __DSB();
1873#endif
1874}
1875
1877{
1878 if ((EDMA_GetChannelStatusFlags(DMA0, 5U) & kEDMA_InterruptFlag) != 0U)
1879 {
1881 }
1882 if ((EDMA_GetChannelStatusFlags(DMA0, 21U) & kEDMA_InterruptFlag) != 0U)
1883 {
1885 }
1886/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
1887 exception return operation might vector to incorrect interrupt */
1888#if defined __CORTEX_M && (__CORTEX_M == 4U)
1889 __DSB();
1890#endif
1891}
1892
1894{
1895 if ((EDMA_GetChannelStatusFlags(DMA0, 6U) & kEDMA_InterruptFlag) != 0U)
1896 {
1898 }
1899 if ((EDMA_GetChannelStatusFlags(DMA0, 22U) & kEDMA_InterruptFlag) != 0U)
1900 {
1902 }
1903/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
1904 exception return operation might vector to incorrect interrupt */
1905#if defined __CORTEX_M && (__CORTEX_M == 4U)
1906 __DSB();
1907#endif
1908}
1909
1911{
1912 if ((EDMA_GetChannelStatusFlags(DMA0, 7U) & kEDMA_InterruptFlag) != 0U)
1913 {
1915 }
1916 if ((EDMA_GetChannelStatusFlags(DMA0, 23U) & kEDMA_InterruptFlag) != 0U)
1917 {
1919 }
1920/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
1921 exception return operation might vector to incorrect interrupt */
1922#if defined __CORTEX_M && (__CORTEX_M == 4U)
1923 __DSB();
1924#endif
1925}
1926
1928{
1929 if ((EDMA_GetChannelStatusFlags(DMA0, 8U) & kEDMA_InterruptFlag) != 0U)
1930 {
1932 }
1933 if ((EDMA_GetChannelStatusFlags(DMA0, 24U) & kEDMA_InterruptFlag) != 0U)
1934 {
1936 }
1937/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
1938 exception return operation might vector to incorrect interrupt */
1939#if defined __CORTEX_M && (__CORTEX_M == 4U)
1940 __DSB();
1941#endif
1942}
1943
1945{
1946 if ((EDMA_GetChannelStatusFlags(DMA0, 9U) & kEDMA_InterruptFlag) != 0U)
1947 {
1949 }
1950 if ((EDMA_GetChannelStatusFlags(DMA0, 25U) & kEDMA_InterruptFlag) != 0U)
1951 {
1953 }
1954/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
1955 exception return operation might vector to incorrect interrupt */
1956#if defined __CORTEX_M && (__CORTEX_M == 4U)
1957 __DSB();
1958#endif
1959}
1960
1962{
1963 if ((EDMA_GetChannelStatusFlags(DMA0, 10U) & kEDMA_InterruptFlag) != 0U)
1964 {
1966 }
1967 if ((EDMA_GetChannelStatusFlags(DMA0, 26U) & kEDMA_InterruptFlag) != 0U)
1968 {
1970 }
1971/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
1972 exception return operation might vector to incorrect interrupt */
1973#if defined __CORTEX_M && (__CORTEX_M == 4U)
1974 __DSB();
1975#endif
1976}
1977
1979{
1980 if ((EDMA_GetChannelStatusFlags(DMA0, 11U) & kEDMA_InterruptFlag) != 0U)
1981 {
1983 }
1984 if ((EDMA_GetChannelStatusFlags(DMA0, 27U) & kEDMA_InterruptFlag) != 0U)
1985 {
1987 }
1988/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
1989 exception return operation might vector to incorrect interrupt */
1990#if defined __CORTEX_M && (__CORTEX_M == 4U)
1991 __DSB();
1992#endif
1993}
1994
1996{
1997 if ((EDMA_GetChannelStatusFlags(DMA0, 12U) & kEDMA_InterruptFlag) != 0U)
1998 {
2000 }
2001 if ((EDMA_GetChannelStatusFlags(DMA0, 28U) & kEDMA_InterruptFlag) != 0U)
2002 {
2004 }
2005/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2006 exception return operation might vector to incorrect interrupt */
2007#if defined __CORTEX_M && (__CORTEX_M == 4U)
2008 __DSB();
2009#endif
2010}
2011
2013{
2014 if ((EDMA_GetChannelStatusFlags(DMA0, 13U) & kEDMA_InterruptFlag) != 0U)
2015 {
2017 }
2018 if ((EDMA_GetChannelStatusFlags(DMA0, 29U) & kEDMA_InterruptFlag) != 0U)
2019 {
2021 }
2022/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2023 exception return operation might vector to incorrect interrupt */
2024#if defined __CORTEX_M && (__CORTEX_M == 4U)
2025 __DSB();
2026#endif
2027}
2028
2030{
2031 if ((EDMA_GetChannelStatusFlags(DMA0, 14U) & kEDMA_InterruptFlag) != 0U)
2032 {
2034 }
2035 if ((EDMA_GetChannelStatusFlags(DMA0, 30U) & kEDMA_InterruptFlag) != 0U)
2036 {
2038 }
2039/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2040 exception return operation might vector to incorrect interrupt */
2041#if defined __CORTEX_M && (__CORTEX_M == 4U)
2042 __DSB();
2043#endif
2044}
2045
2047{
2048 if ((EDMA_GetChannelStatusFlags(DMA0, 15U) & kEDMA_InterruptFlag) != 0U)
2049 {
2051 }
2052 if ((EDMA_GetChannelStatusFlags(DMA0, 31U) & kEDMA_InterruptFlag) != 0U)
2053 {
2055 }
2056/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2057 exception return operation might vector to incorrect interrupt */
2058#if defined __CORTEX_M && (__CORTEX_M == 4U)
2059 __DSB();
2060#endif
2061}
2062#endif /* 32 channels (Shared) */
2063
2064/* 32 channels (Shared): MCIMX7U5_M4 */
2065#if defined(FSL_FEATURE_EDMA_MODULE_CHANNEL) && FSL_FEATURE_EDMA_MODULE_CHANNEL == 32U
2066
2068{
2069 if ((EDMA_GetChannelStatusFlags(DMA0, 0U) & kEDMA_InterruptFlag) != 0U)
2070 {
2072 }
2073 if ((EDMA_GetChannelStatusFlags(DMA0, 4U) & kEDMA_InterruptFlag) != 0U)
2074 {
2076 }
2077/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2078 exception return operation might vector to incorrect interrupt */
2079#if defined __CORTEX_M && (__CORTEX_M == 4U)
2080 __DSB();
2081#endif
2082}
2083
2085{
2086 if ((EDMA_GetChannelStatusFlags(DMA0, 1U) & kEDMA_InterruptFlag) != 0U)
2087 {
2089 }
2090 if ((EDMA_GetChannelStatusFlags(DMA0, 5U) & kEDMA_InterruptFlag) != 0U)
2091 {
2093 }
2094/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2095 exception return operation might vector to incorrect interrupt */
2096#if defined __CORTEX_M && (__CORTEX_M == 4U)
2097 __DSB();
2098#endif
2099}
2100
2102{
2103 if ((EDMA_GetChannelStatusFlags(DMA0, 2U) & kEDMA_InterruptFlag) != 0U)
2104 {
2106 }
2107 if ((EDMA_GetChannelStatusFlags(DMA0, 6U) & kEDMA_InterruptFlag) != 0U)
2108 {
2110 }
2111/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2112 exception return operation might vector to incorrect interrupt */
2113#if defined __CORTEX_M && (__CORTEX_M == 4U)
2114 __DSB();
2115#endif
2116}
2117
2119{
2120 if ((EDMA_GetChannelStatusFlags(DMA0, 3U) & kEDMA_InterruptFlag) != 0U)
2121 {
2123 }
2124 if ((EDMA_GetChannelStatusFlags(DMA0, 7U) & kEDMA_InterruptFlag) != 0U)
2125 {
2127 }
2128/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2129 exception return operation might vector to incorrect interrupt */
2130#if defined __CORTEX_M && (__CORTEX_M == 4U)
2131 __DSB();
2132#endif
2133}
2134
2136{
2137 if ((EDMA_GetChannelStatusFlags(DMA0, 8U) & kEDMA_InterruptFlag) != 0U)
2138 {
2140 }
2141 if ((EDMA_GetChannelStatusFlags(DMA0, 12U) & kEDMA_InterruptFlag) != 0U)
2142 {
2144 }
2145/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2146 exception return operation might vector to incorrect interrupt */
2147#if defined __CORTEX_M && (__CORTEX_M == 4U)
2148 __DSB();
2149#endif
2150}
2151
2153{
2154 if ((EDMA_GetChannelStatusFlags(DMA0, 9U) & kEDMA_InterruptFlag) != 0U)
2155 {
2157 }
2158 if ((EDMA_GetChannelStatusFlags(DMA0, 13U) & kEDMA_InterruptFlag) != 0U)
2159 {
2161 }
2162/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2163 exception return operation might vector to incorrect interrupt */
2164#if defined __CORTEX_M && (__CORTEX_M == 4U)
2165 __DSB();
2166#endif
2167}
2168
2170{
2171 if ((EDMA_GetChannelStatusFlags(DMA0, 10U) & kEDMA_InterruptFlag) != 0U)
2172 {
2174 }
2175 if ((EDMA_GetChannelStatusFlags(DMA0, 14U) & kEDMA_InterruptFlag) != 0U)
2176 {
2178 }
2179/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2180 exception return operation might vector to incorrect interrupt */
2181#if defined __CORTEX_M && (__CORTEX_M == 4U)
2182 __DSB();
2183#endif
2184}
2185
2187{
2188 if ((EDMA_GetChannelStatusFlags(DMA0, 11U) & kEDMA_InterruptFlag) != 0U)
2189 {
2191 }
2192 if ((EDMA_GetChannelStatusFlags(DMA0, 15U) & kEDMA_InterruptFlag) != 0U)
2193 {
2195 }
2196/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2197 exception return operation might vector to incorrect interrupt */
2198#if defined __CORTEX_M && (__CORTEX_M == 4U)
2199 __DSB();
2200#endif
2201}
2202
2204{
2205 if ((EDMA_GetChannelStatusFlags(DMA0, 16U) & kEDMA_InterruptFlag) != 0U)
2206 {
2208 }
2209 if ((EDMA_GetChannelStatusFlags(DMA0, 20U) & kEDMA_InterruptFlag) != 0U)
2210 {
2212 }
2213/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2214 exception return operation might vector to incorrect interrupt */
2215#if defined __CORTEX_M && (__CORTEX_M == 4U)
2216 __DSB();
2217#endif
2218}
2219
2221{
2222 if ((EDMA_GetChannelStatusFlags(DMA0, 17U) & kEDMA_InterruptFlag) != 0U)
2223 {
2225 }
2226 if ((EDMA_GetChannelStatusFlags(DMA0, 21U) & kEDMA_InterruptFlag) != 0U)
2227 {
2229 }
2230/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2231 exception return operation might vector to incorrect interrupt */
2232#if defined __CORTEX_M && (__CORTEX_M == 4U)
2233 __DSB();
2234#endif
2235}
2236
2238{
2239 if ((EDMA_GetChannelStatusFlags(DMA0, 18U) & kEDMA_InterruptFlag) != 0U)
2240 {
2242 }
2243 if ((EDMA_GetChannelStatusFlags(DMA0, 22U) & kEDMA_InterruptFlag) != 0U)
2244 {
2246 }
2247/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2248 exception return operation might vector to incorrect interrupt */
2249#if defined __CORTEX_M && (__CORTEX_M == 4U)
2250 __DSB();
2251#endif
2252}
2253
2255{
2256 if ((EDMA_GetChannelStatusFlags(DMA0, 19U) & kEDMA_InterruptFlag) != 0U)
2257 {
2259 }
2260 if ((EDMA_GetChannelStatusFlags(DMA0, 23U) & kEDMA_InterruptFlag) != 0U)
2261 {
2263 }
2264/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2265 exception return operation might vector to incorrect interrupt */
2266#if defined __CORTEX_M && (__CORTEX_M == 4U)
2267 __DSB();
2268#endif
2269}
2270
2272{
2273 if ((EDMA_GetChannelStatusFlags(DMA0, 24U) & kEDMA_InterruptFlag) != 0U)
2274 {
2276 }
2277 if ((EDMA_GetChannelStatusFlags(DMA0, 28U) & kEDMA_InterruptFlag) != 0U)
2278 {
2280 }
2281/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2282 exception return operation might vector to incorrect interrupt */
2283#if defined __CORTEX_M && (__CORTEX_M == 4U)
2284 __DSB();
2285#endif
2286}
2287
2289{
2290 if ((EDMA_GetChannelStatusFlags(DMA0, 25U) & kEDMA_InterruptFlag) != 0U)
2291 {
2293 }
2294 if ((EDMA_GetChannelStatusFlags(DMA0, 29U) & kEDMA_InterruptFlag) != 0U)
2295 {
2297 }
2298/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2299 exception return operation might vector to incorrect interrupt */
2300#if defined __CORTEX_M && (__CORTEX_M == 4U)
2301 __DSB();
2302#endif
2303}
2304
2306{
2307 if ((EDMA_GetChannelStatusFlags(DMA0, 26U) & kEDMA_InterruptFlag) != 0U)
2308 {
2310 }
2311 if ((EDMA_GetChannelStatusFlags(DMA0, 30U) & kEDMA_InterruptFlag) != 0U)
2312 {
2314 }
2315/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2316 exception return operation might vector to incorrect interrupt */
2317#if defined __CORTEX_M && (__CORTEX_M == 4U)
2318 __DSB();
2319#endif
2320}
2321
2323{
2324 if ((EDMA_GetChannelStatusFlags(DMA0, 27U) & kEDMA_InterruptFlag) != 0U)
2325 {
2327 }
2328 if ((EDMA_GetChannelStatusFlags(DMA0, 31U) & kEDMA_InterruptFlag) != 0U)
2329 {
2331 }
2332/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2333 exception return operation might vector to incorrect interrupt */
2334#if defined __CORTEX_M && (__CORTEX_M == 4U)
2335 __DSB();
2336#endif
2337}
2338#endif /* 32 channels (Shared): MCIMX7U5 */
2339
2340/* 4 channels (No Shared): kv10 */
2341#if defined(FSL_FEATURE_EDMA_MODULE_CHANNEL) && FSL_FEATURE_EDMA_MODULE_CHANNEL > 0
2342
2344{
2346/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2347 exception return operation might vector to incorrect interrupt */
2348#if defined __CORTEX_M && (__CORTEX_M == 4U)
2349 __DSB();
2350#endif
2351}
2352
2354{
2356/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2357 exception return operation might vector to incorrect interrupt */
2358#if defined __CORTEX_M && (__CORTEX_M == 4U)
2359 __DSB();
2360#endif
2361}
2362
2364{
2366/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2367 exception return operation might vector to incorrect interrupt */
2368#if defined __CORTEX_M && (__CORTEX_M == 4U)
2369 __DSB();
2370#endif
2371}
2372
2374{
2376/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2377 exception return operation might vector to incorrect interrupt */
2378#if defined __CORTEX_M && (__CORTEX_M == 4U)
2379 __DSB();
2380#endif
2381}
2382
2383/* 8 channels (No Shared) */
2384#if defined(FSL_FEATURE_EDMA_MODULE_CHANNEL) && FSL_FEATURE_EDMA_MODULE_CHANNEL > 4U
2385
2387{
2389/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2390 exception return operation might vector to incorrect interrupt */
2391#if defined __CORTEX_M && (__CORTEX_M == 4U)
2392 __DSB();
2393#endif
2394}
2395
2397{
2399/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2400 exception return operation might vector to incorrect interrupt */
2401#if defined __CORTEX_M && (__CORTEX_M == 4U)
2402 __DSB();
2403#endif
2404}
2405
2407{
2409/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2410 exception return operation might vector to incorrect interrupt */
2411#if defined __CORTEX_M && (__CORTEX_M == 4U)
2412 __DSB();
2413#endif
2414}
2415
2417{
2419/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2420 exception return operation might vector to incorrect interrupt */
2421#if defined __CORTEX_M && (__CORTEX_M == 4U)
2422 __DSB();
2423#endif
2424}
2425#endif /* FSL_FEATURE_EDMA_MODULE_CHANNEL == 8 */
2426
2427/* 16 channels (No Shared) */
2428#if defined(FSL_FEATURE_EDMA_MODULE_CHANNEL) && FSL_FEATURE_EDMA_MODULE_CHANNEL > 8U
2429
2431{
2433/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2434 exception return operation might vector to incorrect interrupt */
2435#if defined __CORTEX_M && (__CORTEX_M == 4U)
2436 __DSB();
2437#endif
2438}
2439
2441{
2443/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2444 exception return operation might vector to incorrect interrupt */
2445#if defined __CORTEX_M && (__CORTEX_M == 4U)
2446 __DSB();
2447#endif
2448}
2449
2451{
2453/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2454 exception return operation might vector to incorrect interrupt */
2455#if defined __CORTEX_M && (__CORTEX_M == 4U)
2456 __DSB();
2457#endif
2458}
2459
2461{
2463/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2464 exception return operation might vector to incorrect interrupt */
2465#if defined __CORTEX_M && (__CORTEX_M == 4U)
2466 __DSB();
2467#endif
2468}
2469
2471{
2473/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2474 exception return operation might vector to incorrect interrupt */
2475#if defined __CORTEX_M && (__CORTEX_M == 4U)
2476 __DSB();
2477#endif
2478}
2479
2481{
2483/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2484 exception return operation might vector to incorrect interrupt */
2485#if defined __CORTEX_M && (__CORTEX_M == 4U)
2486 __DSB();
2487#endif
2488}
2489
2491{
2493/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2494 exception return operation might vector to incorrect interrupt */
2495#if defined __CORTEX_M && (__CORTEX_M == 4U)
2496 __DSB();
2497#endif
2498}
2499
2501{
2503/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2504 exception return operation might vector to incorrect interrupt */
2505#if defined __CORTEX_M && (__CORTEX_M == 4U)
2506 __DSB();
2507#endif
2508}
2509#endif /* FSL_FEATURE_EDMA_MODULE_CHANNEL == 16 */
2510
2511/* 32 channels (No Shared) */
2512#if defined(FSL_FEATURE_EDMA_MODULE_CHANNEL) && FSL_FEATURE_EDMA_MODULE_CHANNEL > 16U
2513
2515{
2517/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2518 exception return operation might vector to incorrect interrupt */
2519#if defined __CORTEX_M && (__CORTEX_M == 4U)
2520 __DSB();
2521#endif
2522}
2523
2525{
2527/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2528 exception return operation might vector to incorrect interrupt */
2529#if defined __CORTEX_M && (__CORTEX_M == 4U)
2530 __DSB();
2531#endif
2532}
2533
2535{
2537/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2538 exception return operation might vector to incorrect interrupt */
2539#if defined __CORTEX_M && (__CORTEX_M == 4U)
2540 __DSB();
2541#endif
2542}
2543
2545{
2547/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2548 exception return operation might vector to incorrect interrupt */
2549#if defined __CORTEX_M && (__CORTEX_M == 4U)
2550 __DSB();
2551#endif
2552}
2553
2555{
2557/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2558 exception return operation might vector to incorrect interrupt */
2559#if defined __CORTEX_M && (__CORTEX_M == 4U)
2560 __DSB();
2561#endif
2562}
2563
2565{
2567/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2568 exception return operation might vector to incorrect interrupt */
2569#if defined __CORTEX_M && (__CORTEX_M == 4U)
2570 __DSB();
2571#endif
2572}
2573
2575{
2577/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2578 exception return operation might vector to incorrect interrupt */
2579#if defined __CORTEX_M && (__CORTEX_M == 4U)
2580 __DSB();
2581#endif
2582}
2583
2585{
2587/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2588 exception return operation might vector to incorrect interrupt */
2589#if defined __CORTEX_M && (__CORTEX_M == 4U)
2590 __DSB();
2591#endif
2592}
2593
2595{
2597/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2598 exception return operation might vector to incorrect interrupt */
2599#if defined __CORTEX_M && (__CORTEX_M == 4U)
2600 __DSB();
2601#endif
2602}
2603
2605{
2607/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2608 exception return operation might vector to incorrect interrupt */
2609#if defined __CORTEX_M && (__CORTEX_M == 4U)
2610 __DSB();
2611#endif
2612}
2613
2615{
2617/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2618 exception return operation might vector to incorrect interrupt */
2619#if defined __CORTEX_M && (__CORTEX_M == 4U)
2620 __DSB();
2621#endif
2622}
2623
2625{
2627/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2628 exception return operation might vector to incorrect interrupt */
2629#if defined __CORTEX_M && (__CORTEX_M == 4U)
2630 __DSB();
2631#endif
2632}
2633
2635{
2637/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2638 exception return operation might vector to incorrect interrupt */
2639#if defined __CORTEX_M && (__CORTEX_M == 4U)
2640 __DSB();
2641#endif
2642}
2643
2645{
2647/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2648 exception return operation might vector to incorrect interrupt */
2649#if defined __CORTEX_M && (__CORTEX_M == 4U)
2650 __DSB();
2651#endif
2652}
2653
2655{
2657/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2658 exception return operation might vector to incorrect interrupt */
2659#if defined __CORTEX_M && (__CORTEX_M == 4U)
2660 __DSB();
2661#endif
2662}
2663
2665{
2667/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
2668 exception return operation might vector to incorrect interrupt */
2669#if defined __CORTEX_M && (__CORTEX_M == 4U)
2670 __DSB();
2671#endif
2672}
2673#endif /* FSL_FEATURE_EDMA_MODULE_CHANNEL == 32 */
2674
2675#endif /* 4/8/16/32 channels (No Shared) */
uint16_t channel
Definition adc_inputs.h:104
static BenchController instance
static constexpr persistent_config_s * config
void DMA0_10_14_DriverIRQHandler(void)
Definition fsl_edma.c:2169
void DMA26_DriverIRQHandler(void)
Definition fsl_edma.c:2614
void DMA17_DriverIRQHandler(void)
Definition fsl_edma.c:2524
void DMA1_614_DriverIRQHandler(void)
Definition fsl_edma.c:1752
void DMA29_DriverIRQHandler(void)
Definition fsl_edma.c:2644
void DMA12_DriverIRQHandler(void)
Definition fsl_edma.c:2470
void DMA30_DriverIRQHandler(void)
Definition fsl_edma.c:2654
void DMA24_DriverIRQHandler(void)
Definition fsl_edma.c:2594
void DMA8_DMA24_DriverIRQHandler(void)
Definition fsl_edma.c:1927
void DMA0_3_7_DriverIRQHandler(void)
Definition fsl_edma.c:2118
static DMA_Type *const s_edmaBases[]
Array to map EDMA instance number to base pointer.
Definition fsl_edma.c:39
void DMA0_614_DriverIRQHandler(void)
Definition fsl_edma.c:1615
void DMA0_27_31_DriverIRQHandler(void)
Definition fsl_edma.c:2322
void DMA27_DriverIRQHandler(void)
Definition fsl_edma.c:2624
void DMA0_311_DriverIRQHandler(void)
Definition fsl_edma.c:1564
void DMA3_DriverIRQHandler(void)
Definition fsl_edma.c:2373
void DMA14_DMA30_DriverIRQHandler(void)
Definition fsl_edma.c:2029
void DMA1_15_DriverIRQHandler(void)
Definition fsl_edma.c:1387
void DMA25_DriverIRQHandler(void)
Definition fsl_edma.c:2604
void DMA10_DriverIRQHandler(void)
Definition fsl_edma.c:2450
void DMA0_08_DriverIRQHandler(void)
Definition fsl_edma.c:1513
void DMA0_DMA16_DriverIRQHandler(void)
Definition fsl_edma.c:1791
void DMA31_DriverIRQHandler(void)
Definition fsl_edma.c:2664
void DMA10_DMA26_DriverIRQHandler(void)
Definition fsl_edma.c:1961
void DMA11_DMA27_DriverIRQHandler(void)
Definition fsl_edma.c:1978
void DMA1_513_DriverIRQHandler(void)
Definition fsl_edma.c:1735
void DMA15_DriverIRQHandler(void)
Definition fsl_edma.c:2500
static const IRQn_Type s_edmaIRQNumber[][FSL_FEATURE_EDMA_MODULE_CHANNEL]
Array to map EDMA instance number to IRQ number.
Definition fsl_edma.c:47
void DMA7_DMA23_DriverIRQHandler(void)
Definition fsl_edma.c:1910
void DMA0_9_13_DriverIRQHandler(void)
Definition fsl_edma.c:2152
void DMA0_1_5_DriverIRQHandler(void)
Definition fsl_edma.c:2084
void DMA1_19_DriverIRQHandler(void)
Definition fsl_edma.c:1667
void DMA1_311_DriverIRQHandler(void)
Definition fsl_edma.c:1701
void DMA1_412_DriverIRQHandler(void)
Definition fsl_edma.c:1718
void DMA4_DriverIRQHandler(void)
Definition fsl_edma.c:2386
void DMA9_DriverIRQHandler(void)
Definition fsl_edma.c:2440
void DMA6_DMA22_DriverIRQHandler(void)
Definition fsl_edma.c:1893
void DMA16_DriverIRQHandler(void)
Definition fsl_edma.c:2514
void DMA1_210_DriverIRQHandler(void)
Definition fsl_edma.c:1684
void DMA0_16_20_DriverIRQHandler(void)
Definition fsl_edma.c:2203
static edma_handle_t * s_EDMAHandle[FSL_FEATURE_EDMA_MODULE_CHANNEL *FSL_FEATURE_SOC_EDMA_COUNT]
Pointers to transfer handle for each EDMA channel.
Definition fsl_edma.c:50
void DMA1_715_DriverIRQHandler(void)
Definition fsl_edma.c:1769
void DMA21_DriverIRQHandler(void)
Definition fsl_edma.c:2564
void DMA0_2_6_DriverIRQHandler(void)
Definition fsl_edma.c:2101
void DMA13_DMA29_DriverIRQHandler(void)
Definition fsl_edma.c:2012
void DMA19_DriverIRQHandler(void)
Definition fsl_edma.c:2544
void DMA12_DMA28_DriverIRQHandler(void)
Definition fsl_edma.c:1995
void DMA18_DriverIRQHandler(void)
Definition fsl_edma.c:2534
void DMA9_DMA25_DriverIRQHandler(void)
Definition fsl_edma.c:1944
void DMA4_DMA20_DriverIRQHandler(void)
Definition fsl_edma.c:1859
void DMA1_08_DriverIRQHandler(void)
Definition fsl_edma.c:1650
void DMA1_37_DriverIRQHandler(void)
Definition fsl_edma.c:1421
void DMA0_412_DriverIRQHandler(void)
Definition fsl_edma.c:1581
void DMA2_DMA18_DriverIRQHandler(void)
Definition fsl_edma.c:1825
void DMA5_DMA21_DriverIRQHandler(void)
Definition fsl_edma.c:1876
void DMA1_26_DriverIRQHandler(void)
Definition fsl_edma.c:1404
void DMA7_DriverIRQHandler(void)
Definition fsl_edma.c:2416
void DMA0_37_DriverIRQHandler(void)
Definition fsl_edma.c:1349
void DMA0_17_21_DriverIRQHandler(void)
Definition fsl_edma.c:2220
void DMA13_DriverIRQHandler(void)
Definition fsl_edma.c:2480
void DMA20_DriverIRQHandler(void)
Definition fsl_edma.c:2554
void DMA22_DriverIRQHandler(void)
Definition fsl_edma.c:2574
void DMA0_19_23_DriverIRQHandler(void)
Definition fsl_edma.c:2254
static uint32_t EDMA_GetInstance(DMA_Type *base)
Get instance number for EDMA.
Definition fsl_edma.c:56
void DMA0_513_DriverIRQHandler(void)
Definition fsl_edma.c:1598
void DMA11_DriverIRQHandler(void)
Definition fsl_edma.c:2460
void DMA5_DriverIRQHandler(void)
Definition fsl_edma.c:2396
static uint8_t Get_StartInstance(void)
Definition fsl_edma.c:729
void DMA0_24_28_DriverIRQHandler(void)
Definition fsl_edma.c:2271
static const clock_ip_name_t s_edmaClockName[]
Array to map EDMA instance number to clock name.
Definition fsl_edma.c:43
void DMA3_DMA19_DriverIRQHandler(void)
Definition fsl_edma.c:1842
void DMA0_210_DriverIRQHandler(void)
Definition fsl_edma.c:1547
void DMA15_DMA31_DriverIRQHandler(void)
Definition fsl_edma.c:2046
void DMA2_DriverIRQHandler(void)
Definition fsl_edma.c:2363
void DMA0_19_DriverIRQHandler(void)
Definition fsl_edma.c:1530
void DMA1_04_DriverIRQHandler(void)
Definition fsl_edma.c:1370
void DMA0_26_DriverIRQHandler(void)
Definition fsl_edma.c:1332
void DMA0_15_DriverIRQHandler(void)
Definition fsl_edma.c:1315
void DMA0_11_15_DriverIRQHandler(void)
Definition fsl_edma.c:2186
void DMA0_DriverIRQHandler(void)
Definition fsl_edma.c:2343
void DMA0_715_DriverIRQHandler(void)
Definition fsl_edma.c:1632
void DMA0_04_DriverIRQHandler(void)
Definition fsl_edma.c:1298
void DMA14_DriverIRQHandler(void)
Definition fsl_edma.c:2490
void DMA0_26_30_DriverIRQHandler(void)
Definition fsl_edma.c:2305
void DMA8_DriverIRQHandler(void)
Definition fsl_edma.c:2430
void DMA1_DMA17_DriverIRQHandler(void)
Definition fsl_edma.c:1808
void DMA0_8_12_DriverIRQHandler(void)
Definition fsl_edma.c:2135
void DMA28_DriverIRQHandler(void)
Definition fsl_edma.c:2634
void DMA0_18_22_DriverIRQHandler(void)
Definition fsl_edma.c:2237
void DMA0_0_4_DriverIRQHandler(void)
Definition fsl_edma.c:2067
void DMA1_DriverIRQHandler(void)
Definition fsl_edma.c:2353
void DMA6_DriverIRQHandler(void)
Definition fsl_edma.c:2406
void DMA0_25_29_DriverIRQHandler(void)
Definition fsl_edma.c:2288
void DMA23_DriverIRQHandler(void)
Definition fsl_edma.c:2584
enum _clock_ip_name clock_ip_name_t
Peripheral clock name difinition used for clock gate, clock source and clock divider setting....
static void CLOCK_DisableClock(clock_ip_name_t name)
Disable the clock for specific IP.
Definition fsl_clock.h:653
static void CLOCK_EnableClock(clock_ip_name_t name)
Enable the clock for specific IP.
Definition fsl_clock.h:641
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
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
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
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
void EDMA_Deinit(DMA_Type *base)
Deinitializes the eDMA peripheral.
Definition fsl_edma.c:143
__IO uint32_t DADDR
Definition fsl_edma.h:213
void EDMA_TcdReset(edma_tcd_t *tcd)
Sets all fields to default values for the TCD structure.
Definition fsl_edma.c:392
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
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
__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
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
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
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
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
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
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
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
enum _edma_bandwidth edma_bandwidth_t
Bandwidth control.
__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
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_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_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_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
int32_t status_t
Type used for all status and error return values.
Definition fsl_common.h:169
@ kStatus_Success
Definition fsl_common.h:159
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