16 #ifndef FSL_COMPONENT_ID
17 #define FSL_COMPONENT_ID "platform.drivers.edma"
20 #define EDMA_TRANSFER_ENABLED_MASK 0x80U
46 #if !(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL)
90 assert(((uint32_t)tcd & 0x1FU) == 0U);
103 base->
TCD[channel].
CSR = 0;
124 #if !(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL)
131 base->
INT = 0xFFFFFFFFU;
132 base->
ERR = 0xFFFFFFFFU;
150 #if !(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL)
177 config->enableRoundRobinArbitration =
false;
178 config->enableHaltOnError =
true;
179 config->enableContinuousLinkMode =
false;
180 config->enableDebugMode =
false;
230 assert(((uint32_t)nextTcd & 0x1FU) == 0U);
274 bool tmpEnablePreemptAbility =
config->enablePreemptAbility;
275 bool tmpEnableChannelPreemption =
config->enableChannelPreemption;
276 uint8_t tmpChannelPriority =
config->channelPriority;
277 volatile uint8_t *tmpReg = &base->
DCHPRI3;
366 base->
EEI |= ((uint32_t)0x1U << channel);
397 base->
EEI &= (~((uint32_t)0x1U << channel));
424 assert(((uint32_t)tcd & 0x1FU) == 0U);
471 assert(((uint32_t)tcd & 0x1FU) == 0U);
473 assert(((uint32_t)nextTcd & 0x1FU) == 0U);
474 assert((
config->srcAddr % (1UL << (uint32_t)
config->srcTransferSize)) == 0U);
475 assert((
config->destAddr % (1UL << (uint32_t)
config->destTransferSize)) == 0U);
522 assert(((uint32_t)tcd & 0x1FU) == 0U);
552 assert(((uint32_t)tcd & 0x1FU) == 0U);
602 assert(((uint32_t)tcd & 0x1FU) == 0U);
683 uint32_t remainingCount = 0;
704 return remainingCount;
724 retval |= ((((uint32_t)base->
ERR >> channel) & 0x1U) << 1U);
726 retval |= ((((uint32_t)base->
INT >> channel) & 0x1U) << 2U);
746 base->
CDNE = (uint8_t)channel;
751 base->
CERR = (uint8_t)channel;
756 base->
CINT = (uint8_t)channel;
762 static uint8_t startInstanceNum;
774 assert(startInstanceNum <= instance);
776 return instance - startInstanceNum;
792 assert(handle !=
NULL);
795 uint32_t edmaInstance;
796 uint32_t channelIndex;
800 (void)memset(handle, 0,
sizeof(*handle));
803 handle->
channel = (uint8_t)channel;
845 assert(handle !=
NULL);
846 assert(((uint32_t)tcdPool & 0x1FU) == 0U);
852 handle->
tcdSize = (int8_t)tcdSize;
869 assert(handle !=
NULL);
894 #if (defined(FSL_FEATURE_EDMA_SUPPORT_8_BYTES_TRANSFER) && FSL_FEATURE_EDMA_SUPPORT_8_BYTES_TRANSFER)
900 #if (defined(FSL_FEATURE_EDMA_SUPPORT_16_BYTES_TRANSFER) && FSL_FEATURE_EDMA_SUPPORT_16_BYTES_TRANSFER)
944 uint32_t bytesEachRequest,
945 uint32_t transferBytes)
948 assert(srcAddr !=
NULL);
949 assert(destAddr !=
NULL);
950 assert((srcWidth != 0U) && (srcWidth <= 32U) && ((srcWidth & (srcWidth - 1U)) == 0U));
951 assert((destWidth != 0U) && (destWidth <= 32U) && ((destWidth & (destWidth - 1U)) == 0U));
952 assert((transferBytes % bytesEachRequest) == 0U);
953 assert((((uint32_t)(uint32_t *)srcAddr) % srcWidth) == 0U);
954 assert((((uint32_t)(uint32_t *)destAddr) % destWidth) == 0U);
959 config->destAddr = (uint32_t)(uint32_t *)destAddr;
960 config->srcAddr = (uint32_t)(uint32_t *)srcAddr;
961 config->minorLoopBytes = bytesEachRequest;
962 config->majorLoopCounts = transferBytes / bytesEachRequest;
965 config->destOffset = destOffset;
966 config->srcOffset = srcOffset;
991 uint32_t bytesEachRequest,
992 uint32_t transferBytes,
997 int16_t srcOffset = 0, destOffset = 0;
1002 destOffset = (int16_t)destWidth;
1003 srcOffset = (int16_t)srcWidth;
1007 srcOffset = (int16_t)srcWidth;
1010 destOffset = (int16_t)destWidth;
1042 assert(handle !=
NULL);
1092 if (tmpTcdUsed >= tmpTcdSize)
1098 currentTcd = handle->
tail;
1101 nextTcd = currentTcd + 1;
1102 if (nextTcd == handle->
tcdSize)
1107 handle->
tail = nextTcd;
1110 previousTcd = currentTcd != 0 ? currentTcd - 1 : (handle->
tcdSize - 1);
1119 if (currentTcd != previousTcd)
1203 assert(handle !=
NULL);
1204 uint32_t tmpCSR = 0;
1222 if ((handle->
base->
ERQ & ((uint32_t)1U << handle->
channel)) == 0U)
1225 tmpCSR = tcdRegs->
CSR;
1250 assert(handle !=
NULL);
1315 assert(handle !=
NULL);
1339 sga -= (uint32_t)handle->
tcdPool;
1346 new_header = (uint8_t)sga_index;
1351 new_header = sga_index != 0U ? (uint8_t)sga_index - 1U : (uint8_t)handle->
tcdSize - 1U;
1354 if (new_header == (uint8_t)handle->
header)
1356 int8_t tmpTcdUsed = handle->
tcdUsed;
1357 int8_t tmpTcdSize = handle->
tcdSize;
1359 if (tmpTcdUsed == tmpTcdSize)
1371 tcds_done = (int32_t)new_header - (int32_t)handle->
header;
1378 handle->
header = (int8_t)new_header;
1380 handle->
tcdUsed -= (int8_t)tcds_done;
1402 #if defined(FSL_FEATURE_EDMA_MODULE_CHANNEL_IRQ_ENTRY_SHARED_OFFSET) && \
1403 (FSL_FEATURE_EDMA_MODULE_CHANNEL_IRQ_ENTRY_SHARED_OFFSET == 4)
1405 #if defined(FSL_FEATURE_EDMA_MODULE_CHANNEL) && (FSL_FEATURE_EDMA_MODULE_CHANNEL == 8U)
1408 void DMA0_04_DriverIRQHandler(
void)
1421 void DMA0_15_DriverIRQHandler(
void)
1434 void DMA0_26_DriverIRQHandler(
void)
1447 void DMA0_37_DriverIRQHandler(
void)
1464 void DMA1_04_DriverIRQHandler(
void)
1477 void DMA1_15_DriverIRQHandler(
void)
1490 void DMA1_26_DriverIRQHandler(
void)
1503 void DMA1_37_DriverIRQHandler(
void)
1517 void DMA1_04_DriverIRQHandler(
void)
1530 void DMA1_15_DriverIRQHandler(
void)
1543 void DMA1_26_DriverIRQHandler(
void)
1556 void DMA1_37_DriverIRQHandler(
void)
1573 #if defined(FSL_FEATURE_EDMA_MODULE_CHANNEL_IRQ_ENTRY_SHARED_OFFSET) && \
1574 (FSL_FEATURE_EDMA_MODULE_CHANNEL_IRQ_ENTRY_SHARED_OFFSET == 8)
1576 #if defined(FSL_FEATURE_EDMA_MODULE_CHANNEL) && (FSL_FEATURE_EDMA_MODULE_CHANNEL == 16U)
1578 void DMA0_08_DriverIRQHandler(
void)
1591 void DMA0_19_DriverIRQHandler(
void)
1604 void DMA0_210_DriverIRQHandler(
void)
1617 void DMA0_311_DriverIRQHandler(
void)
1630 void DMA0_412_DriverIRQHandler(
void)
1643 void DMA0_513_DriverIRQHandler(
void)
1656 void DMA0_614_DriverIRQHandler(
void)
1669 void DMA0_715_DriverIRQHandler(
void)
1683 void DMA1_08_DriverIRQHandler(
void)
1696 void DMA1_19_DriverIRQHandler(
void)
1709 void DMA1_210_DriverIRQHandler(
void)
1722 void DMA1_311_DriverIRQHandler(
void)
1735 void DMA1_412_DriverIRQHandler(
void)
1748 void DMA1_513_DriverIRQHandler(
void)
1761 void DMA1_614_DriverIRQHandler(
void)
1774 void DMA1_715_DriverIRQHandler(
void)
1790 #if defined(FSL_FEATURE_EDMA_MODULE_CHANNEL_IRQ_ENTRY_SHARED_OFFSET) && \
1791 (FSL_FEATURE_EDMA_MODULE_CHANNEL_IRQ_ENTRY_SHARED_OFFSET == 16)
1793 #if defined(FSL_FEATURE_EDMA_MODULE_CHANNEL) && FSL_FEATURE_EDMA_MODULE_CHANNEL == 32U
1794 #if defined(DMA0) && !(defined(DMA1))
1808 void DMA1_DMA17_DriverIRQHandler(
void)
1821 void DMA2_DMA18_DriverIRQHandler(
void)
1834 void DMA3_DMA19_DriverIRQHandler(
void)
1847 void DMA4_DMA20_DriverIRQHandler(
void)
1860 void DMA5_DMA21_DriverIRQHandler(
void)
1873 void DMA6_DMA22_DriverIRQHandler(
void)
1886 void DMA7_DMA23_DriverIRQHandler(
void)
1899 void DMA8_DMA24_DriverIRQHandler(
void)
1912 void DMA9_DMA25_DriverIRQHandler(
void)
1925 void DMA10_DMA26_DriverIRQHandler(
void)
1938 void DMA11_DMA27_DriverIRQHandler(
void)
1951 void DMA12_DMA28_DriverIRQHandler(
void)
1964 void DMA13_DMA29_DriverIRQHandler(
void)
1977 void DMA14_DMA30_DriverIRQHandler(
void)
1990 void DMA15_DMA31_DriverIRQHandler(
void)
2004 void DMA0_0_16_DriverIRQHandler(
void)
2017 void DMA0_1_17_DriverIRQHandler(
void)
2030 void DMA0_2_18_DriverIRQHandler(
void)
2043 void DMA0_3_19_DriverIRQHandler(
void)
2056 void DMA0_4_20_DriverIRQHandler(
void)
2069 void DMA0_5_21_DriverIRQHandler(
void)
2082 void DMA0_6_22_DriverIRQHandler(
void)
2095 void DMA0_7_23_DriverIRQHandler(
void)
2108 void DMA0_8_24_DriverIRQHandler(
void)
2121 void DMA0_9_25_DriverIRQHandler(
void)
2134 void DMA0_10_26_DriverIRQHandler(
void)
2147 void DMA0_11_27_DriverIRQHandler(
void)
2160 void DMA0_12_28_DriverIRQHandler(
void)
2173 void DMA0_13_29_DriverIRQHandler(
void)
2186 void DMA0_14_30_DriverIRQHandler(
void)
2199 void DMA0_15_31_DriverIRQHandler(
void)
2212 void DMA1_0_16_DriverIRQHandler(
void)
2225 void DMA1_1_17_DriverIRQHandler(
void)
2238 void DMA1_2_18_DriverIRQHandler(
void)
2251 void DMA1_3_19_DriverIRQHandler(
void)
2264 void DMA1_4_20_DriverIRQHandler(
void)
2277 void DMA1_5_21_DriverIRQHandler(
void)
2290 void DMA1_6_22_DriverIRQHandler(
void)
2303 void DMA1_7_23_DriverIRQHandler(
void)
2316 void DMA1_8_24_DriverIRQHandler(
void)
2329 void DMA1_9_25_DriverIRQHandler(
void)
2342 void DMA1_10_26_DriverIRQHandler(
void)
2355 void DMA1_11_27_DriverIRQHandler(
void)
2368 void DMA1_12_28_DriverIRQHandler(
void)
2381 void DMA1_13_29_DriverIRQHandler(
void)
2394 void DMA1_14_30_DriverIRQHandler(
void)
2407 void DMA1_15_31_DriverIRQHandler(
void)
2424 #if defined(FSL_FEATURE_EDMA_MODULE_CHANNEL_IRQ_ENTRY_SHARED_OFFSET) && \
2425 (FSL_FEATURE_EDMA_MODULE_CHANNEL_IRQ_ENTRY_SHARED_OFFSET == 4)
2427 #if defined(FSL_FEATURE_EDMA_MODULE_CHANNEL) && (FSL_FEATURE_EDMA_MODULE_CHANNEL == 32U)
2429 void DMA0_0_4_DriverIRQHandler(
void)
2442 void DMA0_1_5_DriverIRQHandler(
void)
2455 void DMA0_2_6_DriverIRQHandler(
void)
2468 void DMA0_3_7_DriverIRQHandler(
void)
2481 void DMA0_8_12_DriverIRQHandler(
void)
2494 void DMA0_9_13_DriverIRQHandler(
void)
2507 void DMA0_10_14_DriverIRQHandler(
void)
2520 void DMA0_11_15_DriverIRQHandler(
void)
2533 void DMA0_16_20_DriverIRQHandler(
void)
2546 void DMA0_17_21_DriverIRQHandler(
void)
2559 void DMA0_18_22_DriverIRQHandler(
void)
2572 void DMA0_19_23_DriverIRQHandler(
void)
2585 void DMA0_24_28_DriverIRQHandler(
void)
2598 void DMA0_25_29_DriverIRQHandler(
void)
2611 void DMA0_26_30_DriverIRQHandler(
void)
2624 void DMA0_27_31_DriverIRQHandler(
void)
2639 #if defined(FSL_FEATURE_EDMA_MODULE_CHANNEL_IRQ_ENTRY_SHARED_OFFSET) && \
2640 (FSL_FEATURE_EDMA_MODULE_CHANNEL_IRQ_ENTRY_SHARED_OFFSET == 0)
2642 #if defined(FSL_FEATURE_EDMA_MODULE_CHANNEL) && (FSL_FEATURE_EDMA_MODULE_CHANNEL > 0)
2644 void DMA0_DriverIRQHandler(
void)
2650 void DMA1_DriverIRQHandler(
void)
2656 void DMA2_DriverIRQHandler(
void)
2662 void DMA3_DriverIRQHandler(
void)
2669 #if defined(FSL_FEATURE_EDMA_MODULE_CHANNEL) && (FSL_FEATURE_EDMA_MODULE_CHANNEL > 4U)
2671 void DMA4_DriverIRQHandler(
void)
2677 void DMA5_DriverIRQHandler(
void)
2683 void DMA6_DriverIRQHandler(
void)
2689 void DMA7_DriverIRQHandler(
void)
2697 #if defined(FSL_FEATURE_EDMA_MODULE_CHANNEL) && (FSL_FEATURE_EDMA_MODULE_CHANNEL > 8U)
2699 void DMA8_DriverIRQHandler(
void)
2705 void DMA9_DriverIRQHandler(
void)
2711 void DMA10_DriverIRQHandler(
void)
2717 void DMA11_DriverIRQHandler(
void)
2723 void DMA12_DriverIRQHandler(
void)
2729 void DMA13_DriverIRQHandler(
void)
2735 void DMA14_DriverIRQHandler(
void)
2741 void DMA15_DriverIRQHandler(
void)
2749 #if defined(FSL_FEATURE_EDMA_MODULE_CHANNEL) && (FSL_FEATURE_EDMA_MODULE_CHANNEL > 16U)
2751 void DMA16_DriverIRQHandler(
void)
2757 void DMA17_DriverIRQHandler(
void)
2763 void DMA18_DriverIRQHandler(
void)
2769 void DMA19_DriverIRQHandler(
void)
2775 void DMA20_DriverIRQHandler(
void)
2781 void DMA21_DriverIRQHandler(
void)
2787 void DMA22_DriverIRQHandler(
void)
2793 void DMA23_DriverIRQHandler(
void)
2799 void DMA24_DriverIRQHandler(
void)
2805 void DMA25_DriverIRQHandler(
void)
2811 void DMA26_DriverIRQHandler(
void)
2817 void DMA27_DriverIRQHandler(
void)
2823 void DMA28_DriverIRQHandler(
void)
2829 void DMA29_DriverIRQHandler(
void)
2835 void DMA30_DriverIRQHandler(
void)
2841 void DMA31_DriverIRQHandler(
void)