Dma_Ip_Hw_Access.c 97 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161
  1. /*==================================================================================================
  2. * Project : RTD AUTOSAR 4.4
  3. * Platform : CORTEXM
  4. * Peripheral : DMA,CACHE,TRGMUX,FLEXIO
  5. * Dependencies : none
  6. *
  7. * Autosar Version : 4.4.0
  8. * Autosar Revision : ASR_REL_4_4_REV_0000
  9. * Autosar Conf.Variant :
  10. * SW Version : 1.0.0
  11. * Build Version : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
  12. *
  13. * (c) Copyright 2020-2021 NXP Semiconductors
  14. * All Rights Reserved.
  15. *
  16. * NXP Confidential. This software is owned or controlled by NXP and may only be
  17. * used strictly in accordance with the applicable license terms. By expressly
  18. * accepting such terms or by downloading, installing, activating and/or otherwise
  19. * using the software, you are agreeing that you have read, and that you agree to
  20. * comply with and are bound by, such license terms. If you do not agree to be
  21. * bound by the applicable license terms, then you may not retain, install,
  22. * activate or otherwise use the software.
  23. ==================================================================================================*/
  24. /**
  25. * @file Dma_Ip_Hw_Access.c
  26. *
  27. * @version 1.0.0
  28. *
  29. * @brief AUTOSAR Mcl - Dma Ip driver source file.
  30. * @details
  31. *
  32. * @addtogroup DMA_IP_DRIVER DMA IP Driver
  33. * @{
  34. */
  35. /*==================================================================================================
  36. * INCLUDE FILES
  37. * 1) system and project includes
  38. * 2) needed interfaces from external units
  39. * 3) internal and external interfaces from this unit
  40. ==================================================================================================*/
  41. #include "Dma_Ip_Hw_Access.h"
  42. #if (DMA_IP_IS_AVAILABLE == STD_ON)
  43. #if (DMA_IP_HWV2_IS_AVAILABLE == STD_ON)
  44. #include "Dma_Ip_Hwv2_AccessInline.h"
  45. #endif /* #if (DMA_IP_HWV2_IS_AVAILABLE == STD_ON) */
  46. #if (DMA_IP_HWV3_IS_AVAILABLE == STD_ON)
  47. #include "Dma_Ip_Hwv3_AccessInline.h"
  48. #endif /* #if (DMA_IP_HWV3_IS_AVAILABLE == STD_ON) */
  49. /*==================================================================================================
  50. SOURCE FILE VERSION INFORMATION
  51. ==================================================================================================*/
  52. #define DMA_IP_HW_ACCESS_VENDOR_ID_C 43
  53. #define DMA_IP_HW_ACCESS_AR_RELEASE_MAJOR_VERSION_C 4
  54. #define DMA_IP_HW_ACCESS_AR_RELEASE_MINOR_VERSION_C 4
  55. #define DMA_IP_HW_ACCESS_AR_RELEASE_REVISION_VERSION_C 0
  56. #define DMA_IP_HW_ACCESS_SW_MAJOR_VERSION_C 1
  57. #define DMA_IP_HW_ACCESS_SW_MINOR_VERSION_C 0
  58. #define DMA_IP_HW_ACCESS_SW_PATCH_VERSION_C 0
  59. /*==================================================================================================
  60. FILE VERSION CHECKS
  61. ==================================================================================================*/
  62. /* Check if Dma_Ip_Hw_Access.c file and Dma_Ip_Hw_Access.h file are of the same vendor */
  63. #if (DMA_IP_HW_ACCESS_VENDOR_ID_C != DMA_IP_HW_ACCESS_VENDOR_ID_H)
  64. #error "Dma_Ip_Hw_Access.c and Dma_Ip_Hw_Access.h have different vendor ids"
  65. #endif
  66. /* Check if Dma_Ip_Hw_Access.c file and Dma_Ip_Hw_Access.h file are of the same Autosar version */
  67. #if ((DMA_IP_HW_ACCESS_AR_RELEASE_MAJOR_VERSION_C != DMA_IP_HW_ACCESS_AR_RELEASE_MAJOR_VERSION_H) || \
  68. (DMA_IP_HW_ACCESS_AR_RELEASE_MINOR_VERSION_C != DMA_IP_HW_ACCESS_AR_RELEASE_MINOR_VERSION_H) || \
  69. (DMA_IP_HW_ACCESS_AR_RELEASE_REVISION_VERSION_C != DMA_IP_HW_ACCESS_AR_RELEASE_REVISION_VERSION_H) \
  70. )
  71. #error "AutoSar Version Numbers of Dma_Ip_Hw_Access.c and Dma_Ip_Hw_Access.h are different"
  72. #endif
  73. /* Check if Dma_Ip_Hw_Access.c file and Dma_Ip_Hw_Access.h file are of the same Software version */
  74. #if ((DMA_IP_HW_ACCESS_SW_MAJOR_VERSION_C != DMA_IP_HW_ACCESS_SW_MAJOR_VERSION_H) || \
  75. (DMA_IP_HW_ACCESS_SW_MINOR_VERSION_C != DMA_IP_HW_ACCESS_SW_MINOR_VERSION_H) || \
  76. (DMA_IP_HW_ACCESS_SW_PATCH_VERSION_C != DMA_IP_HW_ACCESS_SW_PATCH_VERSION_H) \
  77. )
  78. #error "Software Version Numbers of Dma_Ip_Hw_Access.c and Dma_Ip_Hw_Access.h are different"
  79. #endif
  80. #if (DMA_IP_HWV2_IS_AVAILABLE == STD_ON)
  81. /* Check if Dma_Ip_Hw_Access.c file and Dma_Ip_Hwv2_AccessInline.h file are of the same vendor */
  82. #if (DMA_IP_HW_ACCESS_VENDOR_ID_C != DMA_IP_HWV2_ACCESSINLINE_VENDOR_ID_H)
  83. #error "Dma_Ip_Hw_Access.c and Dma_Ip_Hw_AccessInline.h have different vendor ids"
  84. #endif
  85. /* Check if Dma_Ip_Hw_Access.c file and Dma_Ip_Hwv2_AccessInline.h file are of the same Autosar version */
  86. #if ((DMA_IP_HW_ACCESS_AR_RELEASE_MAJOR_VERSION_C != DMA_IP_HWV2_ACCESSINLINE_AR_RELEASE_MAJOR_VERSION_H) || \
  87. (DMA_IP_HW_ACCESS_AR_RELEASE_MINOR_VERSION_C != DMA_IP_HWV2_ACCESSINLINE_AR_RELEASE_MINOR_VERSION_H) || \
  88. (DMA_IP_HW_ACCESS_AR_RELEASE_REVISION_VERSION_C != DMA_IP_HWV2_ACCESSINLINE_AR_RELEASE_REVISION_VERSION_H) \
  89. )
  90. #error "AutoSar Version Numbers of Dma_Ip_Hw_Access.c and Dma_Ip_Hwv2_AccessInline.h are different"
  91. #endif
  92. /* Check if Dma_Ip_Hw_Access.c file and Dma_Ip_Hwv2_AccessInline.h file are of the same Software version */
  93. #if ((DMA_IP_HW_ACCESS_SW_MAJOR_VERSION_C != DMA_IP_HWV2_ACCESSINLINE_SW_MAJOR_VERSION_H) || \
  94. (DMA_IP_HW_ACCESS_SW_MINOR_VERSION_C != DMA_IP_HWV2_ACCESSINLINE_SW_MINOR_VERSION_H) || \
  95. (DMA_IP_HW_ACCESS_SW_PATCH_VERSION_C != DMA_IP_HWV2_ACCESSINLINE_SW_PATCH_VERSION_H) \
  96. )
  97. #error "Software Version Numbers of Dma_Ip_Hw_Access.c and Dma_Ip_Hwv2_AccessInline.h are different"
  98. #endif
  99. #endif /* #if (DMA_IP_HWV2_IS_AVAILABLE == STD_ON) */
  100. #if (DMA_IP_HWV3_IS_AVAILABLE == STD_ON)
  101. /* Check if Dma_Ip_Hw_Access.c file and Dma_Ip_Hwv3_AccessInline.h file are of the same vendor */
  102. #if (DMA_IP_HW_ACCESS_VENDOR_ID_C != DMA_IP_HWV3_ACCESSINLINE_VENDOR_ID_H)
  103. #error "Dma_Ip_Hw_Access.c and Dma_Ip_Hw_AccessInline.h have different vendor ids"
  104. #endif
  105. /* Check if Dma_Ip_Hw_Access.c file and Dma_Ip_Hwv3_AccessInline.h file are of the same Autosar version */
  106. #if ((DMA_IP_HW_ACCESS_AR_RELEASE_MAJOR_VERSION_C != DMA_IP_HWV3_ACCESSINLINE_AR_RELEASE_MAJOR_VERSION_H) || \
  107. (DMA_IP_HW_ACCESS_AR_RELEASE_MINOR_VERSION_C != DMA_IP_HWV3_ACCESSINLINE_AR_RELEASE_MINOR_VERSION_H) || \
  108. (DMA_IP_HW_ACCESS_AR_RELEASE_REVISION_VERSION_C != DMA_IP_HWV3_ACCESSINLINE_AR_RELEASE_REVISION_VERSION_H) \
  109. )
  110. #error "AutoSar Version Numbers of Dma_Ip_Hw_Access.c and Dma_Ip_Hwv3_AccessInline.h are different"
  111. #endif
  112. /* Check if Dma_Ip_Hw_Access.c file and Dma_Ip_Hwv3_AccessInline.h file are of the same Software version */
  113. #if ((DMA_IP_HW_ACCESS_SW_MAJOR_VERSION_C != DMA_IP_HWV3_ACCESSINLINE_SW_MAJOR_VERSION_H) || \
  114. (DMA_IP_HW_ACCESS_SW_MINOR_VERSION_C != DMA_IP_HWV3_ACCESSINLINE_SW_MINOR_VERSION_H) || \
  115. (DMA_IP_HW_ACCESS_SW_PATCH_VERSION_C != DMA_IP_HWV3_ACCESSINLINE_SW_PATCH_VERSION_H) \
  116. )
  117. #error "Software Version Numbers of Dma_Ip_Hw_Access.c and Dma_Ip_Hwv3_AccessInline.h are different"
  118. #endif
  119. #endif /* #if (DMA_IP_HWV3_IS_AVAILABLE == STD_ON) */
  120. /*==================================================================================================
  121. * FUNCTION PROTOYPES
  122. ==================================================================================================*/
  123. #define MCL_START_SEC_CODE
  124. /* @violates @ref Mcl_Dma_h_REF_1 MISRA 2012 Required Directive 4.10, Precautions shall be taken in order to prevent the contents of a header file being included more than once. */
  125. #include "Mcl_MemMap.h"
  126. #if ((DMA_IP_MASTER_ID_REPLICATION_IS_AVAILABLE == STD_OFF) || \
  127. (DMA_IP_BUFFERED_WRITES_IS_AVAILABLE == STD_OFF) || \
  128. (DMA_IP_PREEMPTION_IS_AVAILABLE == STD_OFF) || \
  129. (DMA_IP_DISABLE_PREEMPT_IS_AVAILABLE == STD_OFF))
  130. void HwAccDmaCh_SetGlobalDummyFunction(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, const uint32 LocValue);
  131. #endif
  132. #if ((DMA_IP_STORE_DST_ADDR_IS_AVAILABLE == STD_OFF) || (DMA_IP_END_OF_PACKET_SIGNAL_IS_AVAILABLE == STD_OFF))
  133. void HwAccDmaCh_SetTransferDummyFunction(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue);
  134. #endif
  135. #if ((DMA_IP_STORE_DST_ADDR_IS_AVAILABLE == STD_OFF) || \
  136. (DMA_IP_MASTER_ID_REPLICATION_IS_AVAILABLE == STD_OFF) || \
  137. (DMA_IP_DMACRC_IS_AVAILABLE == STD_OFF))
  138. void HwAccDmaCh_GetParamDummyFunction(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, uint32 * const retValue);
  139. #endif
  140. void hwAccDmaInst_CmdCancelTransfer(const Dma_Ip_LogicInstanceIdType * const pxLocLogicInst);
  141. void hwAccDmaInst_CmdCancelTransferWithError(const Dma_Ip_LogicInstanceIdType * const pxLocLogicInst);
  142. void hwAccDmaInst_CmdHalt(const Dma_Ip_LogicInstanceIdType * const pxLocLogicInst);
  143. void hwAccDmaInst_CmdResume(const Dma_Ip_LogicInstanceIdType * const pxLocLogicInst);
  144. void HwAccDmaCh_CmdSetHwRequest(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh);
  145. void HwAccDmaCh_CmdClearHwRequest(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh);
  146. void HwAccDmaCh_CmdSetSwRequest(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh);
  147. void HwAccDmaCh_CmdClearDone(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh);
  148. void HwAccDmaCh_CmdClearError(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh);
  149. #if (DMA_IP_MASTER_ID_REPLICATION_IS_AVAILABLE == STD_ON)
  150. void HwAccDmaCh_SetControl_EnMasterIdReplication(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, const uint32 LocValue);
  151. #endif /* DMA_IP_MASTER_ID_REPLICATION_IS_AVAILABLE == STD_ON */
  152. #if (DMA_IP_BUFFERED_WRITES_IS_AVAILABLE == STD_ON)
  153. void HwAccDmaCh_SetControl_EnBufferedWrites(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, const uint32 LocValue);
  154. #endif /* DMA_IP_BUFFERED_WRITES_IS_AVAILABLE == STD_ON */
  155. void HwAccDmaCh_SetRequest_EnMuxSource(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, const uint32 LocValue);
  156. void HwAccDmaCh_SetRequest_MuxSource(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, const uint32 LocValue);
  157. void HwAccDmaCh_SetRequest_EnMuxTrigger(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, const uint32 LocValue);
  158. void HwAccDmaCh_SetRequest_EnRequest(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, const uint32 LocValue);
  159. void HwAccDmaCh_SetInterrupt_EnError(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, const uint32 LocValue);
  160. #if (DMA_IP_GROUP_PRIORITY_IS_AVAILABLE == STD_ON)
  161. void HwAccDmaCh_SetPriority_Group(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, const uint32 LocValue);
  162. #endif /* DMA_IP_GROUP_PRIORITY_IS_AVAILABLE == STD_ON */
  163. void HwAccDmaCh_SetPriority_Level(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, const uint32 LocValue);
  164. void HwAccDmaCh_SetPriority_EnPreemption(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, const uint32 LocValue);
  165. void HwAccDmaCh_SetPriority_DisPreempt(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, const uint32 LocValue);
  166. void HwAccDmaCh_SetSource_Address(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue);
  167. void HwAccDmaCh_SetSource_SignedOffset(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue);
  168. void HwAccDmaCh_SetSource_LastAddrAdj(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue);
  169. void HwAccDmaCh_SetSource_TransferSize(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue);
  170. void HwAccDmaCh_SetSource_Modulo(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue);
  171. void HwAccDmaCh_SetDestination_Address(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue);
  172. void HwAccDmaCh_SetDestination_SignedOffset(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue);
  173. void HwAccDmaCh_SetDestination_LastAddrAdj(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue);
  174. void HwAccDmaCh_SetDestination_TransferSize(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue);
  175. void HwAccDmaCh_SetDestination_Modulo(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue);
  176. void HwAccDmaCh_SetMinorLoop_enSrcOffset(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue);
  177. void HwAccDmaCh_SetMinorLoop_enDstOffset(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue);
  178. void HwAccDmaCh_SetMinorLoop_Offset(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue);
  179. void HwAccDmaCh_SetMinorLoop_EnLink(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue);
  180. void HwAccDmaCh_SetMinorLoop_LogicLinkCh(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue);
  181. void HwAccDmaCh_SetMinorLoop_Size(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue);
  182. void HwAccDmaCh_SetMajorLoop_EnLink(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue);
  183. void HwAccDmaCh_SetMajorLoop_LogicLinkCh(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue);
  184. void HwAccDmaCh_SetMajorLoop_Count(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue);
  185. #if (DMA_IP_STORE_DST_ADDR_IS_AVAILABLE == STD_ON)
  186. void HwAccDmaCh_SetControl_StoreDestinationAddress(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue);
  187. #endif
  188. void HwAccDmaCh_SetControl_EnStart(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue);
  189. void HwAccDmaCh_SetControl_EnMajor(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue);
  190. void HwAccDmaCh_SetControl_EnHalfMajor(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue);
  191. void HwAccDmaCh_SetControl_DisAutoHwRequest(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue);
  192. #if (DMA_IP_END_OF_PACKET_SIGNAL_IS_AVAILABLE == STD_ON)
  193. void HwAccDmaCh_SetControl_EnEndOfPacketSignal(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue);
  194. #endif
  195. void HwAccDmaCh_SetControl_BandwidthControl(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue);
  196. #if (DMA_IP_DMACRC_IS_AVAILABLE == STD_ON)
  197. void HwAccDmaCh_SetCrc_ModeSelect(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, const uint32 LocValue);
  198. void HwAccDmaCh_SetCrc_PolynomialSelect(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, const uint32 LocValue);
  199. void HwAccDmaCh_SetCrc_EnableInitialValue(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, const uint32 LocValue);
  200. void HwAccDmaCh_SetCrc_InitialValue(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, const uint32 LocValue);
  201. void HwAccDmaCh_SetCrc_EnableLogic(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, const uint32 LocValue);
  202. void HwAccDmaCh_GetFinalCrc(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, uint32 * const retValue);
  203. #endif
  204. void HwAccDmaCh_GetSourceAddress(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, uint32 * const retValue);
  205. void HwAccDmaCh_GetDestinationAddress(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, uint32 * const retValue);
  206. void HwAccDmaCh_GetBeginIterCount(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, uint32 * const retValue);
  207. void HwAccDmaCh_GetCurrentIterCount(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, uint32 * const retValue);
  208. #if (DMA_IP_STORE_DST_ADDR_IS_AVAILABLE == STD_ON)
  209. void HwAccDmaCh_GetStoreDstAddress(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, uint32 * const retValue);
  210. #endif /* DMA_IP_STORE_DST_ADDR_IS_AVAILABLE == STD_ON */
  211. #if (DMA_IP_MASTER_ID_REPLICATION_IS_AVAILABLE == STD_ON)
  212. void HwAccDmaCh_GetMasterId(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, uint32 * const retValue);
  213. #endif /* DMA_IP_MASTER_ID_REPLICATION_IS_AVAILABLE == STD_ON */
  214. void HwAccDmaCh_GetIntMajor(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, uint32 * const retValue);
  215. void HwAccDmaCh_GetIntHalfMajor(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, uint32 * const retValue);
  216. /*==================================================================================================
  217. * VIRTUAL ADDRESS MAPPING FUNCTIONS
  218. ==================================================================================================*/
  219. #if (DMA_IP_VIRTUAL_ADDRESS_MAPPING_IS_AVAILABLE == STD_ON)
  220. static uint32 HwAccDma_SetVirtualToPhysicalAddress(const uint32 VirtualAddr);
  221. static uint32 HwAccDma_SetPhysicalToVirtualAddress(const uint32 PhysicalAddr);
  222. #endif /* DMA_IP_VIRTUAL_ADDRESS_MAPPING_IS_AVAILABLE == STD_ON */
  223. /*==================================================================================================
  224. * SET PARAM DUMMY FUNCTION
  225. ==================================================================================================*/
  226. #if ((DMA_IP_MASTER_ID_REPLICATION_IS_AVAILABLE == STD_OFF) || \
  227. (DMA_IP_BUFFERED_WRITES_IS_AVAILABLE == STD_OFF) || \
  228. (DMA_IP_PREEMPTION_IS_AVAILABLE == STD_OFF) || \
  229. (DMA_IP_DISABLE_PREEMPT_IS_AVAILABLE == STD_OFF))
  230. void HwAccDmaCh_SetGlobalDummyFunction(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, const uint32 LocValue)
  231. {
  232. /* Set global dummy function */
  233. (void)LocHwVers;
  234. (void)LocHwInst;
  235. (void)LocHwCh;
  236. (void)LocValue;
  237. DMA_IP_DEV_ASSERT(FALSE);
  238. }
  239. #endif
  240. #if ((DMA_IP_STORE_DST_ADDR_IS_AVAILABLE == STD_OFF) || (DMA_IP_END_OF_PACKET_SIGNAL_IS_AVAILABLE == STD_OFF))
  241. void HwAccDmaCh_SetTransferDummyFunction(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue)
  242. {
  243. /* Set transfer dummy function */
  244. (void)LocHwVers;
  245. (void)pxLocTcd;
  246. (void)LocValue;
  247. DMA_IP_DEV_ASSERT(FALSE);
  248. }
  249. #endif
  250. /*==================================================================================================
  251. * GET PARAM DUMMY FUNCTION
  252. ==================================================================================================*/
  253. #if ((DMA_IP_STORE_DST_ADDR_IS_AVAILABLE == STD_OFF) || \
  254. (DMA_IP_MASTER_ID_REPLICATION_IS_AVAILABLE == STD_OFF) || \
  255. (DMA_IP_DMACRC_IS_AVAILABLE == STD_OFF))
  256. void HwAccDmaCh_GetParamDummyFunction(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, uint32 * const retValue)
  257. {
  258. /* Get parameter dummy function */
  259. (void)LocHwVers;
  260. (void)LocHwInst;
  261. (void)LocHwCh;
  262. (void)retValue;
  263. DMA_IP_DEV_ASSERT(FALSE);
  264. }
  265. #endif
  266. /*==================================================================================================
  267. * DMA INSTANCE CONFIG FUNCTIONS
  268. ==================================================================================================*/
  269. void HwAccDmaInst_SetConfig(const Dma_Ip_LogicInstanceIdType * const pxLocLogicInst, const Dma_Ip_LogicInstanceConfigType * const pxLocInstConfig)
  270. {
  271. uint32 LocHwVers = pxLocLogicInst->HwVersId;
  272. uint32 LocHwInst = pxLocLogicInst->HwInstId;
  273. switch (LocHwVers)
  274. {
  275. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  276. case DMA_IP_HARDWARE_VERSION_2:
  277. hwv2AccInlineDmaInst_SetConfig(g_ptHwv2BaseInstPtrArray[LocHwInst], pxLocInstConfig);
  278. break;
  279. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  280. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  281. case DMA_IP_HARDWARE_VERSION_3:
  282. hwv3AccInlineDmaInst_SetConfig(g_ptHwv3BaseInstPtrArray[LocHwInst], pxLocInstConfig);
  283. break;
  284. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  285. default:
  286. DMA_IP_DEV_ASSERT(FALSE);
  287. break;
  288. }
  289. }
  290. #if (DMA_IP_DMACRC_IS_AVAILABLE == STD_ON)
  291. void HwAccDmaInst_SetCrcConfig(const Dma_Ip_LogicInstanceIdType * const pxLocLogicInst, const Dma_Ip_LogicInstanceConfigType * const pxLocInstConfig)
  292. {
  293. uint32 LocHwInst = pxLocLogicInst->HwInstId;
  294. hwv3AccInlineDmaInst_SetCrcConfig((Dma_Ip_HwCrcGlobalType *)g_pDmaCrcPtrArray[LocHwInst], pxLocInstConfig);
  295. }
  296. #endif /* #if (DMA_IP_DMACRC_IS_AVAILABLE == STD_ON) */
  297. /*==================================================================================================
  298. * DMA INSTANCE CMD FUNCTIONS
  299. ==================================================================================================*/
  300. void hwAccDmaInst_CmdCancelTransfer(const Dma_Ip_LogicInstanceIdType * const pxLocLogicInst)
  301. {
  302. uint32 LocHwVers = pxLocLogicInst->HwVersId;
  303. uint32 LocHwInst = pxLocLogicInst->HwInstId;
  304. switch (LocHwVers)
  305. {
  306. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  307. case DMA_IP_HARDWARE_VERSION_2:
  308. hwv2AccInlineDmaInst_CmdCancelTransfer(g_ptHwv2BaseInstPtrArray[LocHwInst]);
  309. break;
  310. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  311. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  312. case DMA_IP_HARDWARE_VERSION_3:
  313. hwv3AccInlineDmaInst_CmdCancelTransfer(g_ptHwv3BaseInstPtrArray[LocHwInst]);
  314. break;
  315. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  316. default:
  317. DMA_IP_DEV_ASSERT(FALSE);
  318. break;
  319. }
  320. }
  321. void hwAccDmaInst_CmdCancelTransferWithError(const Dma_Ip_LogicInstanceIdType * const pxLocLogicInst)
  322. {
  323. uint32 LocHwVers = pxLocLogicInst->HwVersId;
  324. uint32 LocHwInst = pxLocLogicInst->HwInstId;
  325. switch (LocHwVers)
  326. {
  327. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  328. case DMA_IP_HARDWARE_VERSION_2:
  329. hwv2AccInlineDmaInst_CmdCancelTransferWithError(g_ptHwv2BaseInstPtrArray[LocHwInst]);
  330. break;
  331. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  332. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  333. case DMA_IP_HARDWARE_VERSION_3:
  334. hwv3AccInlineDmaInst_CmdCancelTransferWithError(g_ptHwv3BaseInstPtrArray[LocHwInst]);
  335. break;
  336. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  337. default:
  338. DMA_IP_DEV_ASSERT(FALSE);
  339. break;
  340. }
  341. }
  342. void hwAccDmaInst_CmdHalt(const Dma_Ip_LogicInstanceIdType * const pxLocLogicInst)
  343. {
  344. uint32 LocHwVers = pxLocLogicInst->HwVersId;
  345. uint32 LocHwInst = pxLocLogicInst->HwInstId;
  346. switch (LocHwVers)
  347. {
  348. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  349. case DMA_IP_HARDWARE_VERSION_2:
  350. hwv2AccInlineDmaInst_CmdHalt(g_ptHwv2BaseInstPtrArray[LocHwInst]);
  351. break;
  352. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  353. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  354. case DMA_IP_HARDWARE_VERSION_3:
  355. hwv3AccInlineDmaInst_CmdHalt(g_ptHwv3BaseInstPtrArray[LocHwInst]);
  356. break;
  357. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  358. default:
  359. DMA_IP_DEV_ASSERT(FALSE);
  360. break;
  361. }
  362. }
  363. void hwAccDmaInst_CmdResume(const Dma_Ip_LogicInstanceIdType * const pxLocLogicInst)
  364. {
  365. uint32 LocHwVers = pxLocLogicInst->HwVersId;
  366. uint32 LocHwInst = pxLocLogicInst->HwInstId;
  367. switch (LocHwVers)
  368. {
  369. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  370. case DMA_IP_HARDWARE_VERSION_2:
  371. hwv2AccInlineDmaInst_CmdResume(g_ptHwv2BaseInstPtrArray[LocHwInst]);
  372. break;
  373. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  374. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  375. case DMA_IP_HARDWARE_VERSION_3:
  376. hwv3AccInlineDmaInst_CmdResume(g_ptHwv3BaseInstPtrArray[LocHwInst]);
  377. break;
  378. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  379. default:
  380. DMA_IP_DEV_ASSERT(FALSE);
  381. break;
  382. }
  383. }
  384. /*==================================================================================================
  385. * DMA INSTANCE CMD - FUNCTION POINTER
  386. ==================================================================================================*/
  387. void HwAccDmaInst_SetCommand(const uint32 Command, const Dma_Ip_LogicInstanceIdType * const pxLocLogicInst)
  388. {
  389. static void (* const fpHwAcc_DmaInst_Command[])(const Dma_Ip_LogicInstanceIdType * const pxLocLogicInst) =
  390. {
  391. hwAccDmaInst_CmdCancelTransfer,
  392. hwAccDmaInst_CmdCancelTransferWithError,
  393. hwAccDmaInst_CmdHalt,
  394. hwAccDmaInst_CmdResume,
  395. };
  396. fpHwAcc_DmaInst_Command[Command](pxLocLogicInst);
  397. }
  398. /*==================================================================================================
  399. * DMA INSTANCE STATUS FUNCTION
  400. ==================================================================================================*/
  401. void HwAccDmaInst_GetStatus(const Dma_Ip_LogicInstanceIdType * const pxLocLogicInst, Dma_Ip_LogicInstanceStatusType * const Status)
  402. {
  403. uint32 LocHwVers = pxLocLogicInst->HwVersId;
  404. uint32 LocHwInst = pxLocLogicInst->HwInstId;
  405. switch (LocHwVers)
  406. {
  407. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  408. case DMA_IP_HARDWARE_VERSION_2:
  409. hwv2AccInlineDmaInst_GetErrorStatus(g_ptHwv2BaseInstPtrArray[LocHwInst], &Status->Errors);
  410. hwv2AccInlineDmaInst_GetActiveIdStatus(g_ptHwv2BaseInstPtrArray[LocHwInst], &Status->ActiveId);
  411. hwv2AccInlineDmaInst_GetActiveStatus(g_ptHwv2BaseInstPtrArray[LocHwInst], &Status->Active);
  412. break;
  413. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  414. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  415. case DMA_IP_HARDWARE_VERSION_3:
  416. hwv3AccInlineDmaInst_GetErrorStatus(g_ptHwv3BaseInstPtrArray[LocHwInst], &Status->Errors);
  417. hwv3AccInlineDmaInst_GetActiveIdStatus(g_ptHwv3BaseInstPtrArray[LocHwInst], &Status->ActiveId);
  418. hwv3AccInlineDmaInst_GetActiveStatus(g_ptHwv3BaseInstPtrArray[LocHwInst], &Status->Active);
  419. break;
  420. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  421. default:
  422. DMA_IP_DEV_ASSERT(FALSE);
  423. break;
  424. }
  425. }
  426. /*==================================================================================================
  427. * DMA CHANNEL CMD FUNCTIONS
  428. ==================================================================================================*/
  429. void HwAccDmaCh_CmdSetHwRequest(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh)
  430. {
  431. switch (LocHwVers)
  432. {
  433. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  434. case DMA_IP_HARDWARE_VERSION_2:
  435. hwv2AccInlineDmaCh_CmdSetRequest(DMA_IP_HWV2_TCD_CH_VALUE(LocHwInst), LocHwCh);
  436. break;
  437. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  438. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  439. case DMA_IP_HARDWARE_VERSION_3:
  440. hwv3AccInlineDmaCh_CmdSetRequest(&DMA_IP_HWV3_TCD_CH_VALUE(LocHwInst, LocHwCh));
  441. break;
  442. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  443. default:
  444. DMA_IP_DEV_ASSERT(FALSE);
  445. break;
  446. }
  447. }
  448. void HwAccDmaCh_CmdClearHwRequest(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh)
  449. {
  450. switch (LocHwVers)
  451. {
  452. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  453. case DMA_IP_HARDWARE_VERSION_2:
  454. hwv2AccInlineDmaCh_CmdClearRequest(DMA_IP_HWV2_TCD_CH_VALUE(LocHwInst), LocHwCh);
  455. break;
  456. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  457. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  458. case DMA_IP_HARDWARE_VERSION_3:
  459. hwv3AccInlineDmaCh_CmdClearRequest(&DMA_IP_HWV3_TCD_CH_VALUE(LocHwInst, LocHwCh));
  460. break;
  461. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  462. default:
  463. DMA_IP_DEV_ASSERT(FALSE);
  464. break;
  465. }
  466. }
  467. void HwAccDmaCh_CmdSetSwRequest(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh)
  468. {
  469. switch (LocHwVers)
  470. {
  471. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  472. case DMA_IP_HARDWARE_VERSION_2:
  473. hwv2AccInlineDmaCh_CmdSwReqStart(DMA_IP_HWV2_TCD_CH_VALUE(LocHwInst), LocHwCh);
  474. break;
  475. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  476. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  477. case DMA_IP_HARDWARE_VERSION_3:
  478. hwv3AccInlineDmaCh_CmdSwReqStart(&DMA_IP_HWV3_TCD_TCD_VALUE(LocHwInst, LocHwCh));
  479. break;
  480. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  481. default:
  482. DMA_IP_DEV_ASSERT(FALSE);
  483. break;
  484. }
  485. }
  486. void HwAccDmaCh_CmdClearDone(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh)
  487. {
  488. switch (LocHwVers)
  489. {
  490. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  491. case DMA_IP_HARDWARE_VERSION_2:
  492. hwv2AccInlineDmaCh_CmdClearDone(DMA_IP_HWV2_TCD_CH_VALUE(LocHwInst), LocHwCh);
  493. break;
  494. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  495. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  496. case DMA_IP_HARDWARE_VERSION_3:
  497. hwv3AccInlineDmaCh_CmdClearDone(&DMA_IP_HWV3_TCD_CH_VALUE(LocHwInst, LocHwCh));
  498. break;
  499. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  500. default:
  501. DMA_IP_DEV_ASSERT(FALSE);
  502. break;
  503. }
  504. }
  505. void HwAccDmaCh_CmdClearError(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh)
  506. {
  507. switch (LocHwVers)
  508. {
  509. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  510. case DMA_IP_HARDWARE_VERSION_2:
  511. hwv2AccInlineDmaCh_CmdClearError(DMA_IP_HWV2_TCD_CH_VALUE(LocHwInst), LocHwCh);
  512. break;
  513. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  514. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  515. case DMA_IP_HARDWARE_VERSION_3:
  516. hwv3AccInlineDmaCh_CmdClearError(&DMA_IP_HWV3_TCD_CH_VALUE(LocHwInst, LocHwCh));
  517. break;
  518. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  519. default:
  520. DMA_IP_DEV_ASSERT(FALSE);
  521. break;
  522. }
  523. }
  524. /*==================================================================================================
  525. * DMA CHANNEL CMD - FUNCTION POINTER
  526. ==================================================================================================*/
  527. void HwAccDmaCh_SetCommand(const uint32 Command, const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh)
  528. {
  529. static void (* const fpHwAcc_DmaCh_Command[])(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh) =
  530. {
  531. HwAccDmaCh_CmdSetHwRequest,
  532. HwAccDmaCh_CmdClearHwRequest,
  533. HwAccDmaCh_CmdSetSwRequest,
  534. HwAccDmaCh_CmdClearDone,
  535. HwAccDmaCh_CmdClearError
  536. };
  537. fpHwAcc_DmaCh_Command[Command](LocHwVers, LocHwInst, LocHwCh);
  538. }
  539. /*==================================================================================================
  540. * DMA CHANNEL STATUS FUNCTIONS
  541. ==================================================================================================*/
  542. void HwAccDmaCh_GetStatus(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, Dma_Ip_LogicChannelStatusType * const pChStatus)
  543. {
  544. switch (LocHwVers)
  545. {
  546. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  547. case DMA_IP_HARDWARE_VERSION_2:
  548. hwv2AccInlineDmaCh_GetActiveStatus(&DMA_IP_HWV2_TCD_TCD_VALUE(LocHwInst, LocHwCh), &pChStatus->Active);
  549. hwv2AccInlineDmaCh_GetDoneStatus(&DMA_IP_HWV2_TCD_TCD_VALUE(LocHwInst, LocHwCh), &pChStatus->Done);
  550. break;
  551. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  552. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  553. case DMA_IP_HARDWARE_VERSION_3:
  554. hwv3AccInlineDmaCh_GetActiveStatus(&DMA_IP_HWV3_TCD_CH_VALUE(LocHwInst, LocHwCh), &pChStatus->Active);
  555. hwv3AccInlineDmaCh_GetDoneStatus(&DMA_IP_HWV3_TCD_CH_VALUE(LocHwInst, LocHwCh), &pChStatus->Done);
  556. break;
  557. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  558. default:
  559. DMA_IP_DEV_ASSERT(FALSE);
  560. break;
  561. }
  562. }
  563. void HwAccDmaCh_GetStatus_Error(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, uint32 * const pLocError)
  564. {
  565. switch (LocHwVers)
  566. {
  567. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  568. case DMA_IP_HARDWARE_VERSION_2:
  569. (void)LocHwCh;
  570. hwv2AccInlineDmaCh_GetErrorStatus(LocHwCh, DMA_IP_HWV2_TCD_CH_VALUE(LocHwInst), pLocError);
  571. break;
  572. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  573. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  574. case DMA_IP_HARDWARE_VERSION_3:
  575. hwv3AccInlineDmaCh_GetErrorStatus(&DMA_IP_HWV3_TCD_CH_VALUE(LocHwInst, LocHwCh), pLocError);
  576. break;
  577. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  578. default:
  579. DMA_IP_DEV_ASSERT(FALSE);
  580. break;
  581. }
  582. }
  583. /*==================================================================================================
  584. * DMA CHANNEL GLOBAL FUNCTIONS
  585. ==================================================================================================*/
  586. #if (DMA_IP_MASTER_ID_REPLICATION_IS_AVAILABLE == STD_ON)
  587. void HwAccDmaCh_SetControl_EnMasterIdReplication(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, const uint32 LocValue)
  588. {
  589. switch (LocHwVers)
  590. {
  591. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  592. case DMA_IP_HARDWARE_VERSION_2:
  593. (void)LocHwInst;
  594. (void)LocHwCh;
  595. (void)LocValue;
  596. DMA_IP_DEV_ASSERT(FALSE);
  597. break;
  598. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  599. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  600. case DMA_IP_HARDWARE_VERSION_3:
  601. hwv3AccInlineDmaCh_SetControl_EnMasterIdReplication(&DMA_IP_HWV3_TCD_CH_VALUE(LocHwInst, LocHwCh), LocValue);
  602. break;
  603. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  604. default:
  605. DMA_IP_DEV_ASSERT(FALSE);
  606. break;
  607. }
  608. }
  609. #endif /* DMA_IP_MASTER_ID_REPLICATION_IS_AVAILABLE == STD_ON */
  610. #if (DMA_IP_BUFFERED_WRITES_IS_AVAILABLE == STD_ON)
  611. void HwAccDmaCh_SetControl_EnBufferedWrites(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, const uint32 LocValue)
  612. {
  613. switch (LocHwVers)
  614. {
  615. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  616. case DMA_IP_HARDWARE_VERSION_2:
  617. (void)LocHwInst;
  618. (void)LocHwCh;
  619. (void)LocValue;
  620. DMA_IP_DEV_ASSERT(FALSE);
  621. break;
  622. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  623. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  624. case DMA_IP_HARDWARE_VERSION_3:
  625. hwv3AccInlineDmaCh_SetControl_EnBufferedWrites(&DMA_IP_HWV3_TCD_CH_VALUE(LocHwInst, LocHwCh), LocValue);
  626. break;
  627. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  628. default:
  629. DMA_IP_DEV_ASSERT(FALSE);
  630. break;
  631. }
  632. }
  633. #endif /* DMA_IP_BUFFERED_WRITES_IS_AVAILABLE == STD_ON */
  634. void HwAccDmaCh_SetRequest_EnMuxSource(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, const uint32 LocValue)
  635. {
  636. uint32 LocDmaCh = 0U;
  637. uint32 LocDmaMuxInst = 0U;
  638. uint32 LocDmaMuxCh = 0U;
  639. switch (LocHwVers)
  640. {
  641. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  642. case DMA_IP_HARDWARE_VERSION_2:
  643. LocDmaCh = ((LocHwInst * DMA_IP_HWV2_TCD_NOF_CH) + LocHwCh);
  644. LocDmaMuxInst = LocDmaCh / DMA_IP_HWV2_DMAMUX_NOF_CHANNELS;
  645. LocDmaMuxCh = DMA_IP_HWV2_DMAMUX_REG_INDEX_CONV(LocDmaCh % DMA_IP_HWV2_DMAMUX_NOF_CHANNELS);
  646. hwv2AccInlineDmaCh_SetRequest_EnHwRequestMux((volatile Dma_Ip_MuxRegType*)&g_ptHwv2MuxBasePtrArray[LocDmaMuxInst]->CHCFG[LocDmaMuxCh], LocValue);
  647. break;
  648. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  649. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  650. case DMA_IP_HARDWARE_VERSION_3:
  651. #if (DMAMUX_IP_NOT_ALIGNED == STD_ON)
  652. LocDmaMuxInst = DMA_IP_DMAMUX_REG_INST_CONV(LocHwInst, LocHwCh);
  653. LocDmaCh = DMA_IP_DMAMUX_REG_CH_CONV(LocHwInst, LocHwCh);
  654. LocDmaMuxCh = DMA_IP_DMAMUX_REG_INDEX_CONV(LocDmaCh);
  655. hwv3AccInlineDmaCh_SetRequest_EnHwRequestMux((volatile Dma_Ip_MuxRegType*)&g_ptHwv3MuxBasePtrArray[LocDmaMuxInst]->CHCFG[LocDmaMuxCh], LocValue);
  656. #else
  657. LocDmaCh = ((LocHwInst * DMA_IP_TCD_NOF_HWV3_CH) + LocHwCh);
  658. LocDmaMuxInst = LocDmaCh / DMA_IP_DMAMUX_NOF_CHANNELS;
  659. LocDmaMuxCh = DMA_IP_DMAMUX_REG_INDEX_CONV(LocDmaCh % DMA_IP_DMAMUX_NOF_CHANNELS);
  660. hwv3AccInlineDmaCh_SetRequest_EnHwRequestMux((volatile Dma_Ip_MuxRegType*)&g_ptHwv3MuxBasePtrArray[LocDmaMuxInst]->CHCFG[LocDmaMuxCh], LocValue);
  661. #endif /* #if (STD_ON == DMAMUX_IP_NOT_ALIGNED) */
  662. break;
  663. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  664. default:
  665. DMA_IP_DEV_ASSERT(FALSE);
  666. break;
  667. }
  668. }
  669. void HwAccDmaCh_SetRequest_MuxSource(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, const uint32 LocValue)
  670. {
  671. uint32 LocDmaCh = 0U;
  672. uint32 LocDmaMuxInst = 0U;
  673. uint32 LocDmaMuxCh = 0U;
  674. switch (LocHwVers)
  675. {
  676. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  677. case DMA_IP_HARDWARE_VERSION_2:
  678. LocDmaCh = ((LocHwInst * DMA_IP_HWV2_TCD_NOF_CH) + LocHwCh);
  679. LocDmaMuxInst = LocDmaCh / DMA_IP_HWV2_DMAMUX_NOF_CHANNELS;
  680. LocDmaMuxCh = DMA_IP_HWV2_DMAMUX_REG_INDEX_CONV(LocDmaCh % DMA_IP_HWV2_DMAMUX_NOF_CHANNELS);
  681. hwv2AccInlineDmaCh_SetRequest_SourceMux((volatile Dma_Ip_MuxRegType*)&g_ptHwv2MuxBasePtrArray[LocDmaMuxInst]->CHCFG[LocDmaMuxCh], LocValue);
  682. break;
  683. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  684. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  685. case DMA_IP_HARDWARE_VERSION_3:
  686. #if (DMAMUX_IP_NOT_ALIGNED == STD_ON)
  687. LocDmaMuxInst = DMA_IP_DMAMUX_REG_INST_CONV(LocHwInst, LocHwCh);
  688. LocDmaCh = DMA_IP_DMAMUX_REG_CH_CONV(LocHwInst, LocHwCh);
  689. LocDmaMuxCh = DMA_IP_DMAMUX_REG_INDEX_CONV(LocDmaCh);
  690. hwv3AccInlineDmaCh_SetRequest_SourceMux((volatile Dma_Ip_MuxRegType*)&g_ptHwv3MuxBasePtrArray[LocDmaMuxInst]->CHCFG[LocDmaMuxCh], LocValue);
  691. #else
  692. LocDmaCh = ((LocHwInst * DMA_IP_TCD_NOF_HWV3_CH) + LocHwCh);
  693. LocDmaMuxInst = LocDmaCh / DMA_IP_DMAMUX_NOF_CHANNELS;
  694. LocDmaMuxCh = DMA_IP_DMAMUX_REG_INDEX_CONV(LocDmaCh % DMA_IP_DMAMUX_NOF_CHANNELS);
  695. hwv3AccInlineDmaCh_SetRequest_SourceMux((volatile Dma_Ip_MuxRegType*)&g_ptHwv3MuxBasePtrArray[LocDmaMuxInst]->CHCFG[LocDmaMuxCh], LocValue);
  696. #endif /* #if (STD_ON == DMAMUX_IP_NOT_ALIGNED) */
  697. break;
  698. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  699. default:
  700. DMA_IP_DEV_ASSERT(FALSE);
  701. break;
  702. }
  703. }
  704. void HwAccDmaCh_SetRequest_EnMuxTrigger(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, const uint32 LocValue)
  705. {
  706. uint32 LocDmaCh = 0U;
  707. uint32 LocDmaMuxInst = 0U;
  708. uint32 LocDmaMuxCh = 0U;
  709. switch (LocHwVers)
  710. {
  711. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  712. case DMA_IP_HARDWARE_VERSION_2:
  713. LocDmaCh = ((LocHwInst * DMA_IP_HWV2_TCD_NOF_CH) + LocHwCh);
  714. LocDmaMuxInst = LocDmaCh / DMA_IP_HWV2_DMAMUX_NOF_CHANNELS;
  715. LocDmaMuxCh = DMA_IP_HWV2_DMAMUX_REG_INDEX_CONV(LocDmaCh % DMA_IP_HWV2_DMAMUX_NOF_CHANNELS);
  716. hwv2AccInlineDmaCh_SetRequest_EnTriggerMux((volatile Dma_Ip_MuxRegType*)&g_ptHwv2MuxBasePtrArray[LocDmaMuxInst]->CHCFG[LocDmaMuxCh], LocValue);
  717. break;
  718. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  719. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  720. case DMA_IP_HARDWARE_VERSION_3:
  721. #if (DMAMUX_IP_NOT_ALIGNED == STD_ON)
  722. LocDmaMuxInst = DMA_IP_DMAMUX_REG_INST_CONV(LocHwInst, LocHwCh);
  723. LocDmaCh = DMA_IP_DMAMUX_REG_CH_CONV(LocHwInst, LocHwCh);
  724. LocDmaMuxCh = DMA_IP_DMAMUX_REG_INDEX_CONV(LocDmaCh);
  725. hwv3AccInlineDmaCh_SetRequest_EnTriggerMux((volatile Dma_Ip_MuxRegType*)&g_ptHwv3MuxBasePtrArray[LocDmaMuxInst]->CHCFG[LocDmaMuxCh], LocValue);
  726. #else
  727. LocDmaCh = ((LocHwInst * DMA_IP_TCD_NOF_HWV3_CH) + LocHwCh);
  728. LocDmaMuxInst = LocDmaCh / DMA_IP_DMAMUX_NOF_CHANNELS;
  729. LocDmaMuxCh = DMA_IP_DMAMUX_REG_INDEX_CONV(LocDmaCh % DMA_IP_DMAMUX_NOF_CHANNELS);
  730. hwv3AccInlineDmaCh_SetRequest_EnTriggerMux((volatile Dma_Ip_MuxRegType*)&g_ptHwv3MuxBasePtrArray[LocDmaMuxInst]->CHCFG[LocDmaMuxCh], LocValue);
  731. #endif /* #if (STD_ON == DMAMUX_IP_NOT_ALIGNED) */
  732. break;
  733. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  734. default:
  735. DMA_IP_DEV_ASSERT(FALSE);
  736. break;
  737. }
  738. }
  739. void HwAccDmaCh_SetRequest_EnRequest(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, const uint32 LocValue)
  740. {
  741. switch (LocHwVers)
  742. {
  743. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  744. case DMA_IP_HARDWARE_VERSION_2:
  745. hwv2AccInlineDmaCh_SetRequest_EnHwRequest(DMA_IP_HWV2_TCD_CH_VALUE(LocHwInst), LocHwCh, LocValue);
  746. break;
  747. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  748. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  749. case DMA_IP_HARDWARE_VERSION_3:
  750. hwv3AccInlineDmaCh_SetRequest_EnHwRequest(&DMA_IP_HWV3_TCD_CH_VALUE(LocHwInst, LocHwCh), LocValue);
  751. break;
  752. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  753. default:
  754. DMA_IP_DEV_ASSERT(FALSE);
  755. break;
  756. }
  757. }
  758. void HwAccDmaCh_SetInterrupt_EnError(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, const uint32 LocValue)
  759. {
  760. switch (LocHwVers)
  761. {
  762. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  763. case DMA_IP_HARDWARE_VERSION_2:
  764. hwv2AccInlineDmaCh_SetInterrupt_EnError(DMA_IP_HWV2_TCD_CH_VALUE(LocHwInst), LocHwCh, LocValue);
  765. break;
  766. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  767. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  768. case DMA_IP_HARDWARE_VERSION_3:
  769. hwv3AccInlineDmaCh_SetInterrupt_EnError(&DMA_IP_HWV3_TCD_CH_VALUE(LocHwInst, LocHwCh), LocValue);
  770. break;
  771. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  772. default:
  773. DMA_IP_DEV_ASSERT(FALSE);
  774. break;
  775. }
  776. }
  777. #if (DMA_IP_GROUP_PRIORITY_IS_AVAILABLE == STD_ON)
  778. void HwAccDmaCh_SetPriority_Group(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, const uint32 LocValue)
  779. {
  780. switch (LocHwVers)
  781. {
  782. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  783. case DMA_IP_HARDWARE_VERSION_2:
  784. (void)LocHwInst;
  785. (void)LocHwCh;
  786. (void)LocValue;
  787. break;
  788. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  789. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  790. case DMA_IP_HARDWARE_VERSION_3:
  791. hwv3AccInlineDmaCh_SetPriority_Group((volatile uint32 *)&g_ptHwv3BaseInstPtrArray[LocHwInst]->reg_CH_GRPRI[LocHwCh], LocValue);
  792. break;
  793. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  794. default:
  795. DMA_IP_DEV_ASSERT(FALSE);
  796. break;
  797. }
  798. }
  799. #endif /* DMA_IP_GROUP_PRIORITY_IS_AVAILABLE == STD_ON */
  800. void HwAccDmaCh_SetPriority_Level(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, const uint32 LocValue)
  801. {
  802. switch (LocHwVers)
  803. {
  804. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  805. case DMA_IP_HARDWARE_VERSION_2:
  806. hwv2AccInlineDmaCh_SetPriority_Level(DMA_IP_HWV2_TCD_CH_VALUE(LocHwInst), DMA_CHN_TO_DCHPRI_INDEX(LocHwCh), LocValue);
  807. break;
  808. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  809. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  810. case DMA_IP_HARDWARE_VERSION_3:
  811. hwv3AccInlineDmaCh_SetPriority_Level(&DMA_IP_HWV3_TCD_CH_VALUE(LocHwInst, LocHwCh), LocValue);
  812. break;
  813. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  814. default:
  815. DMA_IP_DEV_ASSERT(FALSE);
  816. break;
  817. }
  818. }
  819. #if (DMA_IP_PREEMPTION_IS_AVAILABLE == STD_ON)
  820. void HwAccDmaCh_SetPriority_EnPreemption(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, const uint32 LocValue)
  821. {
  822. switch (LocHwVers)
  823. {
  824. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  825. case DMA_IP_HARDWARE_VERSION_2:
  826. hwv2AccInlineDmaCh_SetPriority_EnPreemption(DMA_IP_HWV2_TCD_CH_VALUE(LocHwInst), DMA_CHN_TO_DCHPRI_INDEX(LocHwCh), LocValue);
  827. break;
  828. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  829. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  830. case DMA_IP_HARDWARE_VERSION_3:
  831. hwv3AccInlineDmaCh_SetPriority_EnPreemption(&DMA_IP_HWV3_TCD_CH_VALUE(LocHwInst, LocHwCh), LocValue);
  832. break;
  833. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  834. default:
  835. DMA_IP_DEV_ASSERT(FALSE);
  836. break;
  837. }
  838. }
  839. #endif /* #if (DMA_IP_PREEMPTION_IS_AVAILABLE == STD_ON) */
  840. #if (DMA_IP_DISABLE_PREEMPT_IS_AVAILABLE == STD_ON)
  841. void HwAccDmaCh_SetPriority_DisPreempt(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, const uint32 LocValue)
  842. {
  843. switch (LocHwVers)
  844. {
  845. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  846. case DMA_IP_HARDWARE_VERSION_2:
  847. hwv2AccInlineDmaCh_SetPriority_DisPreempt(DMA_IP_HWV2_TCD_CH_VALUE(LocHwInst), DMA_CHN_TO_DCHPRI_INDEX(LocHwCh), LocValue);
  848. break;
  849. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  850. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  851. case DMA_IP_HARDWARE_VERSION_3:
  852. hwv3AccInlineDmaCh_SetPriority_DisPreempt(&DMA_IP_HWV3_TCD_CH_VALUE(LocHwInst, LocHwCh), LocValue);
  853. break;
  854. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  855. default:
  856. DMA_IP_DEV_ASSERT(FALSE);
  857. break;
  858. }
  859. }
  860. #endif /* #if (DMA_IP_DISABLE_PREEMPT_IS_AVAILABLE == STD_ON) */
  861. /*==================================================================================================
  862. * DMA CHANNEL SET GLOBAL PARAMETER - FUNCTION POINTER
  863. ==================================================================================================*/
  864. void HwAccDmaCh_SetGlobalParam(const uint32 Parameter, const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, const uint32 LocValue)
  865. {
  866. static void (* const fpHwAcc_DmaCh_SetGlobalParam[])(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, const uint32 LocValue) =
  867. {
  868. #if (DMA_IP_MASTER_ID_REPLICATION_IS_AVAILABLE == STD_ON)
  869. HwAccDmaCh_SetControl_EnMasterIdReplication,
  870. #else
  871. HwAccDmaCh_SetGlobalDummyFunction,
  872. #endif
  873. #if (DMA_IP_BUFFERED_WRITES_IS_AVAILABLE == STD_ON)
  874. HwAccDmaCh_SetControl_EnBufferedWrites,
  875. #else
  876. HwAccDmaCh_SetGlobalDummyFunction,
  877. #endif
  878. HwAccDmaCh_SetRequest_EnMuxSource,
  879. HwAccDmaCh_SetRequest_MuxSource,
  880. HwAccDmaCh_SetRequest_EnMuxTrigger,
  881. HwAccDmaCh_SetRequest_EnRequest,
  882. HwAccDmaCh_SetInterrupt_EnError,
  883. #if (DMA_IP_GROUP_PRIORITY_IS_AVAILABLE == STD_ON)
  884. HwAccDmaCh_SetPriority_Group,
  885. #else
  886. HwAccDmaCh_SetGlobalDummyFunction,
  887. #endif /* DMA_IP_GROUP_PRIORITY_IS_AVAILABLE == STD_ON */
  888. HwAccDmaCh_SetPriority_Level,
  889. #if (DMA_IP_PREEMPTION_IS_AVAILABLE == STD_ON)
  890. HwAccDmaCh_SetPriority_EnPreemption,
  891. #else
  892. HwAccDmaCh_SetGlobalDummyFunction,
  893. #endif
  894. #if (DMA_IP_DISABLE_PREEMPT_IS_AVAILABLE == STD_ON)
  895. HwAccDmaCh_SetPriority_DisPreempt,
  896. #else
  897. HwAccDmaCh_SetGlobalDummyFunction,
  898. #endif
  899. };
  900. fpHwAcc_DmaCh_SetGlobalParam[Parameter](LocHwVers, LocHwInst, LocHwCh, LocValue);
  901. }
  902. /*==================================================================================================
  903. * DMA CHANNEL TRANSFER FUNCTIONS
  904. ==================================================================================================*/
  905. void HwAccDmaCh_SetSource_Address(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue)
  906. {
  907. switch (LocHwVers)
  908. {
  909. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  910. case DMA_IP_HARDWARE_VERSION_2:
  911. #if (DMA_IP_VIRTUAL_ADDRESS_MAPPING_IS_AVAILABLE == STD_ON)
  912. hwv2AccInlineDmaCh_SetSource_Address(pxLocTcd, HwAccDma_SetVirtualToPhysicalAddress(LocValue));
  913. #else
  914. hwv2AccInlineDmaCh_SetSource_Address(pxLocTcd, LocValue);
  915. #endif /* DMA_IP_VIRTUAL_ADDRESS_MAPPING_IS_AVAILABLE == STD_ON */
  916. break;
  917. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  918. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  919. case DMA_IP_HARDWARE_VERSION_3:
  920. #if (DMA_IP_VIRTUAL_ADDRESS_MAPPING_IS_AVAILABLE == STD_ON)
  921. hwv3AccInlineDmaCh_SetSource_Address(pxLocTcd, HwAccDma_SetVirtualToPhysicalAddress(LocValue));
  922. #else
  923. hwv3AccInlineDmaCh_SetSource_Address(pxLocTcd, LocValue);
  924. #endif /* DMA_IP_VIRTUAL_ADDRESS_MAPPING_IS_AVAILABLE == STD_ON */
  925. break;
  926. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  927. default:
  928. DMA_IP_DEV_ASSERT(FALSE);
  929. break;
  930. }
  931. }
  932. void HwAccDmaCh_SetSource_SignedOffset(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue)
  933. {
  934. switch (LocHwVers)
  935. {
  936. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  937. case DMA_IP_HARDWARE_VERSION_2:
  938. hwv2AccInlineDmaCh_SetSource_SignedOffset(pxLocTcd, LocValue);
  939. break;
  940. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  941. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  942. case DMA_IP_HARDWARE_VERSION_3:
  943. hwv3AccInlineDmaCh_SetSource_SignedOffset(pxLocTcd, LocValue);
  944. break;
  945. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  946. default:
  947. DMA_IP_DEV_ASSERT(FALSE);
  948. break;
  949. }
  950. }
  951. void HwAccDmaCh_SetSource_LastAddrAdj(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue)
  952. {
  953. switch (LocHwVers)
  954. {
  955. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  956. case DMA_IP_HARDWARE_VERSION_2:
  957. hwv2AccInlineDmaCh_SetSource_SignedLastAddrAdj(pxLocTcd, LocValue);
  958. break;
  959. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  960. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  961. case DMA_IP_HARDWARE_VERSION_3:
  962. hwv3AccInlineDmaCh_SetAuxiliary_EnDestinationStoreAddress(pxLocTcd, FALSE);
  963. hwv3AccInlineDmaCh_SetSource_SignedLastAddrAdj(pxLocTcd, LocValue);
  964. break;
  965. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  966. default:
  967. DMA_IP_DEV_ASSERT(FALSE);
  968. break;
  969. }
  970. }
  971. void HwAccDmaCh_SetSource_TransferSize(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue)
  972. {
  973. switch (LocHwVers)
  974. {
  975. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  976. case DMA_IP_HARDWARE_VERSION_2:
  977. hwv2AccInlineDmaCh_SetSource_TransferSize(pxLocTcd, LocValue);
  978. break;
  979. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  980. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  981. case DMA_IP_HARDWARE_VERSION_3:
  982. hwv3AccInlineDmaCh_SetSource_TransferSize(pxLocTcd, LocValue);
  983. break;
  984. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  985. default:
  986. DMA_IP_DEV_ASSERT(FALSE);
  987. break;
  988. }
  989. }
  990. void HwAccDmaCh_SetSource_Modulo(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue)
  991. {
  992. switch (LocHwVers)
  993. {
  994. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  995. case DMA_IP_HARDWARE_VERSION_2:
  996. hwv2AccInlineDmaCh_SetSource_Modulo(pxLocTcd, LocValue);
  997. break;
  998. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  999. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  1000. case DMA_IP_HARDWARE_VERSION_3:
  1001. hwv3AccInlineDmaCh_SetSource_Modulo(pxLocTcd, LocValue);
  1002. break;
  1003. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  1004. default:
  1005. DMA_IP_DEV_ASSERT(FALSE);
  1006. break;
  1007. }
  1008. }
  1009. void HwAccDmaCh_SetDestination_Address(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue)
  1010. {
  1011. switch (LocHwVers)
  1012. {
  1013. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  1014. case DMA_IP_HARDWARE_VERSION_2:
  1015. #if (DMA_IP_VIRTUAL_ADDRESS_MAPPING_IS_AVAILABLE == STD_ON)
  1016. hwv2AccInlineDmaCh_SetDestination_Address(pxLocTcd, HwAccDma_SetVirtualToPhysicalAddress(LocValue));
  1017. #else
  1018. hwv2AccInlineDmaCh_SetDestination_Address(pxLocTcd, LocValue);
  1019. #endif /* DMA_IP_VIRTUAL_ADDRESS_MAPPING_IS_AVAILABLE == STD_ON */
  1020. break;
  1021. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  1022. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  1023. case DMA_IP_HARDWARE_VERSION_3:
  1024. #if (DMA_IP_VIRTUAL_ADDRESS_MAPPING_IS_AVAILABLE == STD_ON)
  1025. hwv3AccInlineDmaCh_SetDestination_Address(pxLocTcd, HwAccDma_SetVirtualToPhysicalAddress(LocValue));
  1026. #else
  1027. hwv3AccInlineDmaCh_SetDestination_Address(pxLocTcd, LocValue);
  1028. #endif /* DMA_IP_VIRTUAL_ADDRESS_MAPPING_IS_AVAILABLE == STD_ON */
  1029. break;
  1030. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  1031. default:
  1032. DMA_IP_DEV_ASSERT(FALSE);
  1033. break;
  1034. }
  1035. }
  1036. void HwAccDmaCh_SetDestination_SignedOffset(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue)
  1037. {
  1038. switch (LocHwVers)
  1039. {
  1040. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  1041. case DMA_IP_HARDWARE_VERSION_2:
  1042. hwv2AccInlineDmaCh_SetDestination_SignedOffset(pxLocTcd, LocValue);
  1043. break;
  1044. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  1045. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  1046. case DMA_IP_HARDWARE_VERSION_3:
  1047. hwv3AccInlineDmaCh_SetDestination_SignedOffset(pxLocTcd, LocValue);
  1048. break;
  1049. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  1050. default:
  1051. DMA_IP_DEV_ASSERT(FALSE);
  1052. break;
  1053. }
  1054. }
  1055. void HwAccDmaCh_SetDestination_LastAddrAdj(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue)
  1056. {
  1057. switch (LocHwVers)
  1058. {
  1059. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  1060. case DMA_IP_HARDWARE_VERSION_2:
  1061. hwv2AccInlineDmaCh_SetDestination_LastAddrAdj(pxLocTcd, LocValue);
  1062. break;
  1063. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  1064. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  1065. case DMA_IP_HARDWARE_VERSION_3:
  1066. hwv3AccInlineDmaCh_SetDestination_LastAddrAdj(pxLocTcd, LocValue);
  1067. break;
  1068. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  1069. default:
  1070. DMA_IP_DEV_ASSERT(FALSE);
  1071. break;
  1072. }
  1073. }
  1074. void HwAccDmaCh_SetDestination_TransferSize(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue)
  1075. {
  1076. switch (LocHwVers)
  1077. {
  1078. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  1079. case DMA_IP_HARDWARE_VERSION_2:
  1080. hwv2AccInlineDmaCh_SetDestination_TransferSize(pxLocTcd, LocValue);
  1081. break;
  1082. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  1083. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  1084. case DMA_IP_HARDWARE_VERSION_3:
  1085. hwv3AccInlineDmaCh_SetDestination_TransferSize(pxLocTcd, LocValue);
  1086. break;
  1087. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  1088. default:
  1089. DMA_IP_DEV_ASSERT(FALSE);
  1090. break;
  1091. }
  1092. }
  1093. void HwAccDmaCh_SetDestination_Modulo(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue)
  1094. {
  1095. switch (LocHwVers)
  1096. {
  1097. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  1098. case DMA_IP_HARDWARE_VERSION_2:
  1099. hwv2AccInlineDmaCh_SetDestination_Modulo(pxLocTcd, LocValue);
  1100. break;
  1101. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  1102. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  1103. case DMA_IP_HARDWARE_VERSION_3:
  1104. hwv3AccInlineDmaCh_SetDestination_Modulo(pxLocTcd, LocValue);
  1105. break;
  1106. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  1107. default:
  1108. DMA_IP_DEV_ASSERT(FALSE);
  1109. break;
  1110. }
  1111. }
  1112. void HwAccDmaCh_SetMinorLoop_enSrcOffset(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue)
  1113. {
  1114. switch (LocHwVers)
  1115. {
  1116. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  1117. case DMA_IP_HARDWARE_VERSION_2:
  1118. hwv2AccInlineDmaCh_SetMinorLoop_enSrcOffset(pxLocTcd, LocValue);
  1119. break;
  1120. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  1121. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  1122. case DMA_IP_HARDWARE_VERSION_3:
  1123. hwv3AccInlineDmaCh_SetMinorLoop_enSrcOffset(pxLocTcd, LocValue);
  1124. break;
  1125. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  1126. default:
  1127. DMA_IP_DEV_ASSERT(FALSE);
  1128. break;
  1129. }
  1130. }
  1131. void HwAccDmaCh_SetMinorLoop_enDstOffset(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue)
  1132. {
  1133. switch (LocHwVers)
  1134. {
  1135. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  1136. case DMA_IP_HARDWARE_VERSION_2:
  1137. hwv2AccInlineDmaCh_SetMinorLoop_enDstOffset(pxLocTcd, LocValue);
  1138. break;
  1139. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  1140. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  1141. case DMA_IP_HARDWARE_VERSION_3:
  1142. hwv3AccInlineDmaCh_SetMinorLoop_enDstOffset(pxLocTcd, LocValue);
  1143. break;
  1144. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  1145. default:
  1146. DMA_IP_DEV_ASSERT(FALSE);
  1147. break;
  1148. }
  1149. }
  1150. void HwAccDmaCh_SetMinorLoop_Offset(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue)
  1151. {
  1152. switch (LocHwVers)
  1153. {
  1154. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  1155. case DMA_IP_HARDWARE_VERSION_2:
  1156. hwv2AccInlineDmaCh_SetMinorLoop_SignedOffset(pxLocTcd, LocValue);
  1157. break;
  1158. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  1159. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  1160. case DMA_IP_HARDWARE_VERSION_3:
  1161. hwv3AccInlineDmaCh_SetMinorLoop_SignedOffset(pxLocTcd, LocValue);
  1162. break;
  1163. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  1164. default:
  1165. DMA_IP_DEV_ASSERT(FALSE);
  1166. break;
  1167. }
  1168. }
  1169. void HwAccDmaCh_SetMinorLoop_EnLink(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue)
  1170. {
  1171. switch (LocHwVers)
  1172. {
  1173. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  1174. case DMA_IP_HARDWARE_VERSION_2:
  1175. hwv2AccInlineDmaCh_SetMinorLoop_EnLink(pxLocTcd, LocValue);
  1176. break;
  1177. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  1178. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  1179. case DMA_IP_HARDWARE_VERSION_3:
  1180. hwv3AccInlineDmaCh_SetMinorLoop_EnLink(pxLocTcd, LocValue);
  1181. break;
  1182. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  1183. default:
  1184. DMA_IP_DEV_ASSERT(FALSE);
  1185. break;
  1186. }
  1187. }
  1188. void HwAccDmaCh_SetMinorLoop_LogicLinkCh(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue)
  1189. {
  1190. uint32 hwLinkCh = Dma_Ip_ConvertLogicChToHwCh(LocValue);
  1191. switch (LocHwVers)
  1192. {
  1193. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  1194. case DMA_IP_HARDWARE_VERSION_2:
  1195. hwv2AccInlineDmaCh_SetMinorLoop_LinkCh(pxLocTcd, hwLinkCh);
  1196. break;
  1197. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  1198. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  1199. case DMA_IP_HARDWARE_VERSION_3:
  1200. hwv3AccInlineDmaCh_SetMinorLoop_LinkCh(pxLocTcd, hwLinkCh);
  1201. break;
  1202. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  1203. default:
  1204. DMA_IP_DEV_ASSERT(FALSE);
  1205. break;
  1206. }
  1207. }
  1208. void HwAccDmaCh_SetMinorLoop_Size(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue)
  1209. {
  1210. switch (LocHwVers)
  1211. {
  1212. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  1213. case DMA_IP_HARDWARE_VERSION_2:
  1214. hwv2AccInlineDmaCh_SetMinorLoop_Size(pxLocTcd, LocValue);
  1215. break;
  1216. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  1217. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  1218. case DMA_IP_HARDWARE_VERSION_3:
  1219. hwv3AccInlineDmaCh_SetMinorLoop_Size(pxLocTcd, LocValue);
  1220. break;
  1221. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  1222. default:
  1223. DMA_IP_DEV_ASSERT(FALSE);
  1224. break;
  1225. }
  1226. }
  1227. void HwAccDmaCh_SetMajorLoop_EnLink(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue)
  1228. {
  1229. switch (LocHwVers)
  1230. {
  1231. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  1232. case DMA_IP_HARDWARE_VERSION_2:
  1233. hwv2AccInlineDmaCh_SetMajorLoop_EnLink(pxLocTcd, LocValue);
  1234. break;
  1235. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  1236. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  1237. case DMA_IP_HARDWARE_VERSION_3:
  1238. hwv3AccInlineDmaCh_SetMajorLoop_EnLink(pxLocTcd, LocValue);
  1239. break;
  1240. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  1241. default:
  1242. DMA_IP_DEV_ASSERT(FALSE);
  1243. break;
  1244. }
  1245. }
  1246. void HwAccDmaCh_SetMajorLoop_LogicLinkCh(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue)
  1247. {
  1248. uint32 hwLinkCh = Dma_Ip_ConvertLogicChToHwCh(LocValue);
  1249. switch (LocHwVers)
  1250. {
  1251. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  1252. case DMA_IP_HARDWARE_VERSION_2:
  1253. hwv2AccInlineDmaCh_SetMajorLoop_LinkCh(pxLocTcd, hwLinkCh);
  1254. break;
  1255. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  1256. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  1257. case DMA_IP_HARDWARE_VERSION_3:
  1258. hwv3AccInlineDmaCh_SetMajorLoop_LinkCh(pxLocTcd, hwLinkCh);
  1259. break;
  1260. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  1261. default:
  1262. DMA_IP_DEV_ASSERT(FALSE);
  1263. break;
  1264. }
  1265. }
  1266. void HwAccDmaCh_SetMajorLoop_Count(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue)
  1267. {
  1268. switch (LocHwVers)
  1269. {
  1270. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  1271. case DMA_IP_HARDWARE_VERSION_2:
  1272. hwv2AccInlineDmaCh_SetMajorLoop_Count(pxLocTcd, LocValue);
  1273. break;
  1274. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  1275. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  1276. case DMA_IP_HARDWARE_VERSION_3:
  1277. hwv3AccInlineDmaCh_SetMajorLoop_Count(pxLocTcd, LocValue);
  1278. break;
  1279. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  1280. default:
  1281. DMA_IP_DEV_ASSERT(FALSE);
  1282. break;
  1283. }
  1284. }
  1285. #if (DMA_IP_STORE_DST_ADDR_IS_AVAILABLE == STD_ON)
  1286. void HwAccDmaCh_SetControl_StoreDestinationAddress(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue)
  1287. {
  1288. switch (LocHwVers)
  1289. {
  1290. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  1291. case DMA_IP_HARDWARE_VERSION_2:
  1292. DMA_IP_DEV_ASSERT(FALSE);
  1293. break;
  1294. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  1295. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  1296. case DMA_IP_HARDWARE_VERSION_3:
  1297. #if (DMA_IP_VIRTUAL_ADDRESS_MAPPING_IS_AVAILABLE == STD_ON)
  1298. hwv3AccInlineDmaCh_SetControl_StoreDestinationAddress(pxLocTcd, HwAccDma_SetVirtualToPhysicalAddress(LocValue));
  1299. #else
  1300. hwv3AccInlineDmaCh_SetControl_StoreDestinationAddress(pxLocTcd, LocValue);
  1301. #endif /* DMA_IP_VIRTUAL_ADDRESS_MAPPING_IS_AVAILABLE == STD_ON */
  1302. hwv3AccInlineDmaCh_SetAuxiliary_EnDestinationStoreAddress(pxLocTcd, TRUE);
  1303. break;
  1304. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  1305. default:
  1306. DMA_IP_DEV_ASSERT(FALSE);
  1307. break;
  1308. }
  1309. }
  1310. #endif
  1311. void HwAccDmaCh_SetControl_EnStart(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue)
  1312. {
  1313. switch (LocHwVers)
  1314. {
  1315. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  1316. case DMA_IP_HARDWARE_VERSION_2:
  1317. hwv2AccInlineDmaCh_SetControl_EnStart(pxLocTcd, ((LocValue != 0U) ? TRUE : FALSE));
  1318. break;
  1319. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  1320. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  1321. case DMA_IP_HARDWARE_VERSION_3:
  1322. hwv3AccInlineDmaCh_SetControl_EnStart(pxLocTcd, ((LocValue != 0U) ? TRUE : FALSE));
  1323. break;
  1324. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  1325. default:
  1326. DMA_IP_DEV_ASSERT(FALSE);
  1327. break;
  1328. }
  1329. }
  1330. void HwAccDmaCh_SetControl_EnMajor(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue)
  1331. {
  1332. switch (LocHwVers)
  1333. {
  1334. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  1335. case DMA_IP_HARDWARE_VERSION_2:
  1336. hwv2AccInlineDmaCh_SetControl_EnMajor(pxLocTcd, LocValue);
  1337. break;
  1338. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  1339. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  1340. case DMA_IP_HARDWARE_VERSION_3:
  1341. hwv3AccInlineDmaCh_SetControl_EnMajor(pxLocTcd, LocValue);
  1342. break;
  1343. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  1344. default:
  1345. DMA_IP_DEV_ASSERT(FALSE);
  1346. break;
  1347. }
  1348. }
  1349. void HwAccDmaCh_SetControl_EnHalfMajor(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue)
  1350. {
  1351. switch (LocHwVers)
  1352. {
  1353. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  1354. case DMA_IP_HARDWARE_VERSION_2:
  1355. hwv2AccInlineDmaCh_SetControl_EnHalfMajor(pxLocTcd, LocValue);
  1356. break;
  1357. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  1358. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  1359. case DMA_IP_HARDWARE_VERSION_3:
  1360. hwv3AccInlineDmaCh_SetControl_EnHalfMajor(pxLocTcd, LocValue);
  1361. break;
  1362. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  1363. default:
  1364. DMA_IP_DEV_ASSERT(FALSE);
  1365. break;
  1366. }
  1367. }
  1368. void HwAccDmaCh_SetControl_DisAutoHwRequest(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue)
  1369. {
  1370. switch (LocHwVers)
  1371. {
  1372. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  1373. case DMA_IP_HARDWARE_VERSION_2:
  1374. hwv2AccInlineDmaCh_SetControl_DisAutoHwRequest(pxLocTcd, LocValue);
  1375. break;
  1376. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  1377. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  1378. case DMA_IP_HARDWARE_VERSION_3:
  1379. hwv3AccInlineDmaCh_SetControl_DisAutoHwRequest(pxLocTcd, LocValue);
  1380. break;
  1381. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  1382. default:
  1383. DMA_IP_DEV_ASSERT(FALSE);
  1384. break;
  1385. }
  1386. }
  1387. #if (DMA_IP_END_OF_PACKET_SIGNAL_IS_AVAILABLE == STD_ON)
  1388. void HwAccDmaCh_SetControl_EnEndOfPacketSignal(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue)
  1389. {
  1390. switch (LocHwVers)
  1391. {
  1392. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  1393. case DMA_IP_HARDWARE_VERSION_2:
  1394. hwv2AccInlineDmaCh_SetControl_EnEndOfPacketSignal(pxLocTcd, LocValue);
  1395. break;
  1396. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  1397. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  1398. case DMA_IP_HARDWARE_VERSION_3:
  1399. hwv3AccInlineDmaCh_SetControl_EnEndOfPacketSignal(pxLocTcd, LocValue);
  1400. break;
  1401. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  1402. default:
  1403. DMA_IP_DEV_ASSERT(FALSE);
  1404. break;
  1405. }
  1406. }
  1407. #endif
  1408. void HwAccDmaCh_SetControl_BandwidthControl(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue)
  1409. {
  1410. switch (LocHwVers)
  1411. {
  1412. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  1413. case DMA_IP_HARDWARE_VERSION_2:
  1414. hwv2AccInlineDmaCh_SetControl_BandwidthControl(pxLocTcd, LocValue);
  1415. break;
  1416. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  1417. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  1418. case DMA_IP_HARDWARE_VERSION_3:
  1419. hwv3AccInlineDmaCh_SetControl_BandwidthControl(pxLocTcd, LocValue);
  1420. break;
  1421. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  1422. default:
  1423. DMA_IP_DEV_ASSERT(FALSE);
  1424. break;
  1425. }
  1426. }
  1427. /*==================================================================================================
  1428. * DMA CHANNEL SET TRANSFER PARAMETER - FUNCTION POINTER
  1429. ==================================================================================================*/
  1430. void HwAccDmaCh_SetTransferParam(const uint32 Parameter, const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue)
  1431. {
  1432. static void (* const fpHwAcc_DmaCh_SetTransferParam[])(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, const uint32 LocValue) =
  1433. {
  1434. HwAccDmaCh_SetSource_Address,
  1435. HwAccDmaCh_SetSource_SignedOffset,
  1436. HwAccDmaCh_SetSource_LastAddrAdj,
  1437. HwAccDmaCh_SetSource_TransferSize,
  1438. HwAccDmaCh_SetSource_Modulo,
  1439. HwAccDmaCh_SetDestination_Address,
  1440. HwAccDmaCh_SetDestination_SignedOffset,
  1441. HwAccDmaCh_SetDestination_LastAddrAdj,
  1442. HwAccDmaCh_SetDestination_TransferSize,
  1443. HwAccDmaCh_SetDestination_Modulo,
  1444. HwAccDmaCh_SetMinorLoop_enSrcOffset,
  1445. HwAccDmaCh_SetMinorLoop_enDstOffset,
  1446. HwAccDmaCh_SetMinorLoop_Offset,
  1447. HwAccDmaCh_SetMinorLoop_EnLink,
  1448. HwAccDmaCh_SetMinorLoop_LogicLinkCh,
  1449. HwAccDmaCh_SetMinorLoop_Size,
  1450. HwAccDmaCh_SetMajorLoop_EnLink,
  1451. HwAccDmaCh_SetMajorLoop_LogicLinkCh,
  1452. HwAccDmaCh_SetMajorLoop_Count,
  1453. #if (DMA_IP_STORE_DST_ADDR_IS_AVAILABLE == STD_ON)
  1454. HwAccDmaCh_SetControl_StoreDestinationAddress,
  1455. #else
  1456. HwAccDmaCh_SetTransferDummyFunction,
  1457. #endif
  1458. HwAccDmaCh_SetControl_EnStart,
  1459. HwAccDmaCh_SetControl_EnMajor,
  1460. HwAccDmaCh_SetControl_EnHalfMajor,
  1461. HwAccDmaCh_SetControl_DisAutoHwRequest,
  1462. #if (DMA_IP_END_OF_PACKET_SIGNAL_IS_AVAILABLE == STD_ON)
  1463. HwAccDmaCh_SetControl_EnEndOfPacketSignal,
  1464. #else
  1465. HwAccDmaCh_SetTransferDummyFunction,
  1466. #endif
  1467. HwAccDmaCh_SetControl_BandwidthControl,
  1468. };
  1469. fpHwAcc_DmaCh_SetTransferParam[Parameter](LocHwVers, pxLocTcd, LocValue);
  1470. }
  1471. #if (DMA_IP_DMACRC_IS_AVAILABLE == STD_ON)
  1472. /*==================================================================================================
  1473. * DMA CHANNEL CRC FUNCTIONS
  1474. ==================================================================================================*/
  1475. void HwAccDmaCh_SetCrc_ModeSelect(const uint32 LocHwVers, const uint32 LocHwCrcInst, const uint32 LocHwCrcCh, const uint32 LocValue)
  1476. {
  1477. hwv3AccInlineDmaCh_SetCrc_ModeSelect((Dma_Ip_HwCrcCtrlType*)&g_pDmaCrcPtrArray[LocHwCrcInst]->CONTROL_REGISTER[LocHwCrcCh], LocValue);
  1478. }
  1479. void HwAccDmaCh_SetCrc_PolynomialSelect(const uint32 LocHwVers, const uint32 LocHwCrcInst, const uint32 LocHwCrcCh, const uint32 LocValue)
  1480. {
  1481. hwv3AccInlineDmaCh_SetCrc_PolynomialSelect((Dma_Ip_HwCrcCtrlType*)&g_pDmaCrcPtrArray[LocHwCrcInst]->CONTROL_REGISTER[LocHwCrcCh], LocValue);
  1482. }
  1483. void HwAccDmaCh_SetCrc_EnableInitialValue(const uint32 LocHwVers, const uint32 LocHwCrcInst, const uint32 LocHwCrcCh, const uint32 LocValue)
  1484. {
  1485. hwv3AccInlineDmaCh_SetCrc_EnableInitialValue((Dma_Ip_HwCrcCtrlType*)&g_pDmaCrcPtrArray[LocHwCrcInst]->CONTROL_REGISTER[LocHwCrcCh], LocValue);
  1486. }
  1487. void HwAccDmaCh_SetCrc_InitialValue(const uint32 LocHwVers, const uint32 LocHwCrcInst, const uint32 LocHwCrcCh, const uint32 LocValue)
  1488. {
  1489. hwv3AccInlineDmaCh_SetCrc_InitialValue((Dma_Ip_HwCrcCtrlType*)&g_pDmaCrcPtrArray[LocHwCrcInst]->CONTROL_REGISTER[LocHwCrcCh], LocValue);
  1490. }
  1491. void HwAccDmaCh_SetCrc_EnableLogic(const uint32 LocHwVers, const uint32 LocHwCrcInst, const uint32 LocHwCrcCh, const uint32 LocValue)
  1492. {
  1493. hwv3AccInlineDmaCh_SetCrc_EnableLogic((Dma_Ip_HwCrcCtrlType*)&g_pDmaCrcPtrArray[LocHwCrcInst]->CONTROL_REGISTER[LocHwCrcCh], LocValue);
  1494. }
  1495. /*==================================================================================================
  1496. * DMA CHANNEL CRC PARAMETER - FUNCTION POINTER
  1497. ==================================================================================================*/
  1498. void HwAccDmaCh_SetCrcParam(const uint32 Parameter, const uint32 LocHwVers, const uint32 LocHwCrcInst, const uint32 LocHwCrcCh, const uint32 LocValue)
  1499. {
  1500. static void (*fpHwAcc_DmaCh_SetCrcParam[])(const uint32 LocHwVers, const uint32 LocHwCrcInst, const uint32 LocHwCrcCh, const uint32 LocValue) =
  1501. {
  1502. HwAccDmaCh_SetCrc_ModeSelect,
  1503. HwAccDmaCh_SetCrc_PolynomialSelect,
  1504. HwAccDmaCh_SetCrc_EnableInitialValue,
  1505. HwAccDmaCh_SetCrc_InitialValue,
  1506. HwAccDmaCh_SetCrc_EnableLogic
  1507. };
  1508. fpHwAcc_DmaCh_SetCrcParam[Parameter](LocHwVers, LocHwCrcInst, LocHwCrcCh, LocValue);
  1509. }
  1510. #endif /* #if (DMA_IP_DMACRC_IS_AVAILABLE == STD_ON) */
  1511. /*==================================================================================================
  1512. * DMA CHANNEL GET PARAMETER
  1513. ==================================================================================================*/
  1514. void HwAccDmaCh_GetSourceAddress(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, uint32 * const retValue)
  1515. {
  1516. uint32 LocPhysicalAddress;
  1517. switch (LocHwVers)
  1518. {
  1519. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  1520. case DMA_IP_HARDWARE_VERSION_2:
  1521. hwv2AccInlineDmaCh_GetSourceAddress(&DMA_IP_HWV2_TCD_TCD_VALUE(LocHwInst, LocHwCh), &LocPhysicalAddress);
  1522. #if (DMA_IP_VIRTUAL_ADDRESS_MAPPING_IS_AVAILABLE == STD_ON)
  1523. *retValue = HwAccDma_SetPhysicalToVirtualAddress(LocPhysicalAddress);
  1524. #else
  1525. *retValue = LocPhysicalAddress;
  1526. #endif /* DMA_IP_VIRTUAL_ADDRESS_MAPPING_IS_AVAILABLE == STD_ON */
  1527. break;
  1528. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  1529. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  1530. case DMA_IP_HARDWARE_VERSION_3:
  1531. hwv3AccInlineDmaCh_GetSourceAddress(&DMA_IP_HWV3_TCD_TCD_VALUE(LocHwInst, LocHwCh), &LocPhysicalAddress);
  1532. #if (DMA_IP_VIRTUAL_ADDRESS_MAPPING_IS_AVAILABLE == STD_ON)
  1533. *retValue = HwAccDma_SetPhysicalToVirtualAddress(LocPhysicalAddress);
  1534. #else
  1535. *retValue = LocPhysicalAddress;
  1536. #endif /* DMA_IP_VIRTUAL_ADDRESS_MAPPING_IS_AVAILABLE == STD_ON */
  1537. break;
  1538. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  1539. default:
  1540. DMA_IP_DEV_ASSERT(FALSE);
  1541. break;
  1542. }
  1543. }
  1544. void HwAccDmaCh_GetDestinationAddress(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, uint32 * const retValue)
  1545. {
  1546. uint32 LocPhysicalAddress;
  1547. switch (LocHwVers)
  1548. {
  1549. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  1550. case DMA_IP_HARDWARE_VERSION_2:
  1551. hwv2AccInlineDmaCh_GetDestinationAddress(&DMA_IP_HWV2_TCD_TCD_VALUE(LocHwInst, LocHwCh), &LocPhysicalAddress);
  1552. #if (DMA_IP_VIRTUAL_ADDRESS_MAPPING_IS_AVAILABLE == STD_ON)
  1553. *retValue = HwAccDma_SetPhysicalToVirtualAddress(LocPhysicalAddress);
  1554. #else
  1555. *retValue = LocPhysicalAddress;
  1556. #endif /* DMA_IP_VIRTUAL_ADDRESS_MAPPING_IS_AVAILABLE == STD_ON */
  1557. break;
  1558. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  1559. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  1560. case DMA_IP_HARDWARE_VERSION_3:
  1561. hwv3AccInlineDmaCh_GetDestinationAddress(&DMA_IP_HWV3_TCD_TCD_VALUE(LocHwInst, LocHwCh), &LocPhysicalAddress);
  1562. #if (DMA_IP_VIRTUAL_ADDRESS_MAPPING_IS_AVAILABLE == STD_ON)
  1563. *retValue = HwAccDma_SetPhysicalToVirtualAddress(LocPhysicalAddress);
  1564. #else
  1565. *retValue = LocPhysicalAddress;
  1566. #endif /* DMA_IP_VIRTUAL_ADDRESS_MAPPING_IS_AVAILABLE == STD_ON */
  1567. break;
  1568. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  1569. default:
  1570. DMA_IP_DEV_ASSERT(FALSE);
  1571. break;
  1572. }
  1573. }
  1574. void HwAccDmaCh_GetBeginIterCount(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, uint32 * const retValue)
  1575. {
  1576. switch (LocHwVers)
  1577. {
  1578. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  1579. case DMA_IP_HARDWARE_VERSION_2:
  1580. hwv2AccInlineDmaCh_GetBeginIterCount(&DMA_IP_HWV2_TCD_TCD_VALUE(LocHwInst, LocHwCh), retValue);
  1581. break;
  1582. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  1583. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  1584. case DMA_IP_HARDWARE_VERSION_3:
  1585. hwv3AccInlineDmaCh_GetBeginIterCount(&DMA_IP_HWV3_TCD_TCD_VALUE(LocHwInst, LocHwCh), retValue);
  1586. break;
  1587. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  1588. default:
  1589. DMA_IP_DEV_ASSERT(FALSE);
  1590. break;
  1591. }
  1592. }
  1593. void HwAccDmaCh_GetCurrentIterCount(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, uint32 * const retValue)
  1594. {
  1595. switch (LocHwVers)
  1596. {
  1597. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  1598. case DMA_IP_HARDWARE_VERSION_2:
  1599. hwv2AccInlineDmaCh_GetCurrentIterCount(&DMA_IP_HWV2_TCD_TCD_VALUE(LocHwInst, LocHwCh), retValue);
  1600. break;
  1601. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  1602. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  1603. case DMA_IP_HARDWARE_VERSION_3:
  1604. hwv3AccInlineDmaCh_GetCurrentIterCount(&DMA_IP_HWV3_TCD_TCD_VALUE(LocHwInst, LocHwCh), retValue);
  1605. break;
  1606. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  1607. default:
  1608. DMA_IP_DEV_ASSERT(FALSE);
  1609. break;
  1610. }
  1611. }
  1612. #if (DMA_IP_STORE_DST_ADDR_IS_AVAILABLE == STD_ON)
  1613. void HwAccDmaCh_GetStoreDstAddress(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, uint32 * const retValue)
  1614. {
  1615. uint32 LocPhysicalAddress;
  1616. switch (LocHwVers)
  1617. {
  1618. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  1619. case DMA_IP_HARDWARE_VERSION_2:
  1620. DMA_IP_DEV_ASSERT(FALSE);
  1621. break;
  1622. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  1623. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  1624. case DMA_IP_HARDWARE_VERSION_3:
  1625. hwv3AccInlineDmaCh_GetStoreDstAddress(&DMA_IP_HWV3_TCD_TCD_VALUE(LocHwInst, LocHwCh), &LocPhysicalAddress);
  1626. #if (DMA_IP_VIRTUAL_ADDRESS_MAPPING_IS_AVAILABLE == STD_ON)
  1627. *retValue = HwAccDma_SetPhysicalToVirtualAddress(LocPhysicalAddress);
  1628. #else
  1629. *retValue = LocPhysicalAddress;
  1630. #endif /* DMA_IP_VIRTUAL_ADDRESS_MAPPING_IS_AVAILABLE == STD_ON */
  1631. break;
  1632. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  1633. default:
  1634. DMA_IP_DEV_ASSERT(FALSE);
  1635. break;
  1636. }
  1637. }
  1638. #endif
  1639. #if (DMA_IP_MASTER_ID_REPLICATION_IS_AVAILABLE == STD_ON)
  1640. void HwAccDmaCh_GetMasterId(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, uint32 * const retValue)
  1641. {
  1642. switch (LocHwVers)
  1643. {
  1644. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  1645. case DMA_IP_HARDWARE_VERSION_2:
  1646. DMA_IP_DEV_ASSERT(FALSE);
  1647. break;
  1648. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  1649. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  1650. case DMA_IP_HARDWARE_VERSION_3:
  1651. hwv3AccInlineDmaCh_GetMasterId(&DMA_IP_HWV3_TCD_CH_VALUE(LocHwInst, LocHwCh), retValue);
  1652. break;
  1653. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  1654. default:
  1655. DMA_IP_DEV_ASSERT(FALSE);
  1656. break;
  1657. }
  1658. }
  1659. #endif
  1660. void HwAccDmaCh_GetIntMajor(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, uint32 * const retValue)
  1661. {
  1662. switch (LocHwVers)
  1663. {
  1664. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  1665. case DMA_IP_HARDWARE_VERSION_2:
  1666. hwv2AccInlineDmaCh_GetIntMajor(&DMA_IP_HWV2_TCD_TCD_VALUE(LocHwInst, LocHwCh), retValue);
  1667. break;
  1668. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  1669. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  1670. case DMA_IP_HARDWARE_VERSION_3:
  1671. hwv3AccInlineDmaCh_GetIntMajor(&DMA_IP_HWV3_TCD_TCD_VALUE(LocHwInst, LocHwCh), retValue);
  1672. break;
  1673. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  1674. default:
  1675. DMA_IP_DEV_ASSERT(FALSE);
  1676. break;
  1677. }
  1678. }
  1679. void HwAccDmaCh_GetIntHalfMajor(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, uint32 * const retValue)
  1680. {
  1681. switch (LocHwVers)
  1682. {
  1683. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  1684. case DMA_IP_HARDWARE_VERSION_2:
  1685. hwv2AccInlineDmaCh_GetIntHalfMajor(&DMA_IP_HWV2_TCD_TCD_VALUE(LocHwInst, LocHwCh), retValue);
  1686. break;
  1687. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  1688. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  1689. case DMA_IP_HARDWARE_VERSION_3:
  1690. hwv3AccInlineDmaCh_GetIntHalfMajor(&DMA_IP_HWV3_TCD_TCD_VALUE(LocHwInst, LocHwCh), retValue);
  1691. break;
  1692. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  1693. default:
  1694. DMA_IP_DEV_ASSERT(FALSE);
  1695. break;
  1696. }
  1697. }
  1698. #if (DMA_IP_DMACRC_IS_AVAILABLE == STD_ON)
  1699. void HwAccDmaCh_GetFinalCrc(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, uint32 * const retValue)
  1700. {
  1701. switch (LocHwVers)
  1702. {
  1703. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  1704. case DMA_IP_HARDWARE_VERSION_2:
  1705. DMA_IP_DEV_ASSERT(FALSE);
  1706. break;
  1707. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  1708. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  1709. case DMA_IP_HARDWARE_VERSION_3:
  1710. hwv3AccInlineDmaCh_GetFinalCrc((Dma_Ip_HwCrcCtrlType*)&g_pDmaCrcPtrArray[LocHwInst]->CONTROL_REGISTER[LocHwCh], retValue);
  1711. break;
  1712. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  1713. default:
  1714. DMA_IP_DEV_ASSERT(FALSE);
  1715. break;
  1716. }
  1717. }
  1718. #endif /* #if (DMA_IP_DMACRC_IS_AVAILABLE == STD_ON) */
  1719. /*==================================================================================================
  1720. * DMA CHANNEL GET PARAMETER - FUNCTION POINTER
  1721. ==================================================================================================*/
  1722. void HwAccDmaCh_GetParam(const uint32 Parameter, const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, uint32 * const retValue)
  1723. {
  1724. static void (* const fpHwAcc_DmaCh_GetParam[])(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, uint32 * const retValue) =
  1725. {
  1726. HwAccDmaCh_GetSourceAddress,
  1727. HwAccDmaCh_GetDestinationAddress,
  1728. HwAccDmaCh_GetBeginIterCount,
  1729. HwAccDmaCh_GetCurrentIterCount,
  1730. #if (DMA_IP_STORE_DST_ADDR_IS_AVAILABLE == STD_ON)
  1731. HwAccDmaCh_GetStoreDstAddress,
  1732. #else
  1733. HwAccDmaCh_GetParamDummyFunction,
  1734. #endif
  1735. #if (DMA_IP_MASTER_ID_REPLICATION_IS_AVAILABLE == STD_ON)
  1736. HwAccDmaCh_GetMasterId,
  1737. #else
  1738. HwAccDmaCh_GetParamDummyFunction,
  1739. #endif
  1740. HwAccDmaCh_GetIntMajor,
  1741. HwAccDmaCh_GetIntHalfMajor,
  1742. #if (DMA_IP_DMACRC_IS_AVAILABLE == STD_ON)
  1743. HwAccDmaCh_GetFinalCrc,
  1744. #else
  1745. HwAccDmaCh_GetParamDummyFunction,
  1746. #endif
  1747. };
  1748. fpHwAcc_DmaCh_GetParam[Parameter](LocHwVers, LocHwInst, LocHwCh, retValue);
  1749. }
  1750. /*==================================================================================================
  1751. * DMA LOGIC CHANNEL SOFTWARE TCD -> LOAD WITH CONFIGURATION
  1752. ==================================================================================================*/
  1753. void HwAccDmaCh_LoadConfigIntoSoftwareTcd(uint32 HwVersId, const Dma_Ip_ScatterGatherConfigType * const pxLocScatterGather, const uint32 ElementId, const boolean NotLastElement)
  1754. {
  1755. uint32 hwLinkCh;
  1756. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  1757. if(DMA_IP_HARDWARE_VERSION_3 == HwVersId)
  1758. {
  1759. /* Enable SGA bit and set SGA next software TCD address */
  1760. if(TRUE == NotLastElement)
  1761. {
  1762. hwv3AccInlineDmaCh_SetControl_ScatterGatherAddress(pxLocScatterGather->Stcd, (uint32)pxLocScatterGather->NextConfig->Stcd);
  1763. }
  1764. else
  1765. {
  1766. hwv3AccInlineDmaCh_SetControl_ScatterGatherAddress(pxLocScatterGather->Stcd, (uint32)0U);
  1767. }
  1768. hwv3AccInlineDmaCh_SetAuxiliary_EnScatterGatherProcessing(pxLocScatterGather->Stcd, NotLastElement);
  1769. if(NULL_PTR != pxLocScatterGather->TransferConfig)
  1770. {
  1771. /* Control */
  1772. hwv3AccInlineDmaCh_SetControl_EnStart(pxLocScatterGather->Stcd, pxLocScatterGather->TransferConfig->Control.EnStart);
  1773. hwv3AccInlineDmaCh_SetControl_BandwidthControl(pxLocScatterGather->Stcd, pxLocScatterGather->TransferConfig->Control.BandwidthControl);
  1774. hwv3AccInlineDmaCh_SetControl_EnMajor(pxLocScatterGather->Stcd, (uint32)pxLocScatterGather->TransferConfig->Control.EnMajorInt);
  1775. hwv3AccInlineDmaCh_SetControl_EnHalfMajor(pxLocScatterGather->Stcd, (uint32)pxLocScatterGather->TransferConfig->Control.EnHalfMajorInt);
  1776. hwv3AccInlineDmaCh_SetControl_DisAutoHwRequest(pxLocScatterGather->Stcd, (uint32)pxLocScatterGather->TransferConfig->Control.DisAutoHwRequest);
  1777. hwv3AccInlineDmaCh_SetControl_EnEndOfPacketSignal(pxLocScatterGather->Stcd, (uint32)pxLocScatterGather->TransferConfig->Control.EnEndOfPacketSignal);
  1778. /* Source */
  1779. hwv3AccInlineDmaCh_SetSource_Address(pxLocScatterGather->Stcd, pxLocScatterGather->TransferConfig->Source.Addr);
  1780. hwv3AccInlineDmaCh_SetSource_SignedOffset(pxLocScatterGather->Stcd, (uint32)pxLocScatterGather->TransferConfig->Source.SignedOffset);
  1781. hwv3AccInlineDmaCh_SetSource_TransferSize(pxLocScatterGather->Stcd, pxLocScatterGather->TransferConfig->Source.TransferSize);
  1782. hwv3AccInlineDmaCh_SetSource_Modulo(pxLocScatterGather->Stcd, pxLocScatterGather->TransferConfig->Source.Modulo);
  1783. /* Destination */
  1784. hwv3AccInlineDmaCh_SetDestination_Address(pxLocScatterGather->Stcd, pxLocScatterGather->TransferConfig->Destination.Addr);
  1785. hwv3AccInlineDmaCh_SetDestination_SignedOffset(pxLocScatterGather->Stcd, (uint32)pxLocScatterGather->TransferConfig->Destination.SignedOffset);
  1786. hwv3AccInlineDmaCh_SetDestination_TransferSize(pxLocScatterGather->Stcd, pxLocScatterGather->TransferConfig->Destination.TransferSize);
  1787. hwv3AccInlineDmaCh_SetDestination_Modulo(pxLocScatterGather->Stcd, pxLocScatterGather->TransferConfig->Destination.Modulo);
  1788. /* MinorLoop */
  1789. hwv3AccInlineDmaCh_SetMinorLoop_enSrcOffset(pxLocScatterGather->Stcd, (uint32)pxLocScatterGather->TransferConfig->MinorLoop.EnSrcOffset);
  1790. hwv3AccInlineDmaCh_SetMinorLoop_enDstOffset(pxLocScatterGather->Stcd, (uint32)pxLocScatterGather->TransferConfig->MinorLoop.EnDstOffset);
  1791. hwv3AccInlineDmaCh_SetMinorLoop_SignedOffset(pxLocScatterGather->Stcd, (uint32)pxLocScatterGather->TransferConfig->MinorLoop.Offset);
  1792. hwv3AccInlineDmaCh_SetMinorLoop_EnLink(pxLocScatterGather->Stcd, (uint32)pxLocScatterGather->TransferConfig->MinorLoop.EnLink);
  1793. hwLinkCh = Dma_Ip_ConvertLogicChToHwCh(pxLocScatterGather->TransferConfig->MinorLoop.LogicLinkCh);
  1794. hwv3AccInlineDmaCh_SetMinorLoop_LinkCh(pxLocScatterGather->Stcd, hwLinkCh);
  1795. hwv3AccInlineDmaCh_SetMinorLoop_Size(pxLocScatterGather->Stcd, pxLocScatterGather->TransferConfig->MinorLoop.Size);
  1796. /* MajorLoop */
  1797. hwv3AccInlineDmaCh_SetMajorLoop_EnLink(pxLocScatterGather->Stcd, (uint32)pxLocScatterGather->TransferConfig->MajorLoop.EnLink);
  1798. if(TRUE == pxLocScatterGather->TransferConfig->MajorLoop.EnLink)
  1799. {
  1800. hwLinkCh = Dma_Ip_ConvertLogicChToHwCh(pxLocScatterGather->TransferConfig->MajorLoop.LogicLinkCh);
  1801. hwv3AccInlineDmaCh_SetMajorLoop_LinkCh(pxLocScatterGather->Stcd, hwLinkCh);
  1802. }
  1803. else
  1804. {
  1805. hwv3AccInlineDmaCh_SetMajorLoop_LinkCh(pxLocScatterGather->Stcd, ElementId);
  1806. }
  1807. hwv3AccInlineDmaCh_SetMajorLoop_Count(pxLocScatterGather->Stcd, pxLocScatterGather->TransferConfig->MajorLoop.Count);
  1808. /* At initialization, Store Destination Address can't be set. */
  1809. hwv3AccInlineDmaCh_SetAuxiliary_EnDestinationStoreAddress(pxLocScatterGather->Stcd, FALSE);
  1810. hwv3AccInlineDmaCh_SetSource_SignedLastAddrAdj(pxLocScatterGather->Stcd, (uint32)pxLocScatterGather->TransferConfig->Source.LastAddrAdj);
  1811. }
  1812. }
  1813. else
  1814. {
  1815. /* Do Nothing */
  1816. }
  1817. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  1818. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  1819. if(DMA_IP_HARDWARE_VERSION_2 == HwVersId)
  1820. {
  1821. /* Enable SGA bit and set SGA next software TCD address */
  1822. if(TRUE == NotLastElement)
  1823. {
  1824. hwv2AccInlineDmaCh_SetControl_ScatterGatherAddress(pxLocScatterGather->Stcd, (uint32)pxLocScatterGather->NextConfig->Stcd);
  1825. }
  1826. else
  1827. {
  1828. hwv2AccInlineDmaCh_SetControl_ScatterGatherAddress(pxLocScatterGather->Stcd, (uint32)0U);
  1829. }
  1830. hwv2AccInlineDmaCh_SetAuxiliary_EnScatterGatherProcessing(pxLocScatterGather->Stcd, NotLastElement);
  1831. if(NULL_PTR != pxLocScatterGather->TransferConfig)
  1832. {
  1833. /* Control and Status */
  1834. hwv2AccInlineDmaCh_SetControlAndStatus(pxLocScatterGather->Stcd, pxLocScatterGather);
  1835. /* Source */
  1836. hwv2AccInlineDmaCh_SetSource_Address(pxLocScatterGather->Stcd, pxLocScatterGather->TransferConfig->Source.Addr);
  1837. hwv2AccInlineDmaCh_SetSource_SignedOffset(pxLocScatterGather->Stcd, (uint32)pxLocScatterGather->TransferConfig->Source.SignedOffset);
  1838. /* Destination */
  1839. hwv2AccInlineDmaCh_SetDestination_Address(pxLocScatterGather->Stcd, pxLocScatterGather->TransferConfig->Destination.Addr);
  1840. hwv2AccInlineDmaCh_SetDestination_SignedOffset(pxLocScatterGather->Stcd, (uint32)pxLocScatterGather->TransferConfig->Destination.SignedOffset);
  1841. /* Transfer Attributes */
  1842. hwv2AccInlineDmaCh_SetTransferAttributes(pxLocScatterGather->Stcd, pxLocScatterGather);
  1843. /* Signed minor loop offset */
  1844. hwv2AccInlineDmaCh_SetSignedMinorLoopOffset(pxLocScatterGather->Stcd, pxLocScatterGather);
  1845. /* MinorLoop */
  1846. hwv2AccInlineDmaCh_SetMinorLoop_EnLink(pxLocScatterGather->Stcd, pxLocScatterGather->TransferConfig->MinorLoop.EnLink ? 1U : 0U);
  1847. hwLinkCh = Dma_Ip_ConvertLogicChToHwCh(pxLocScatterGather->TransferConfig->MinorLoop.LogicLinkCh);
  1848. hwv2AccInlineDmaCh_SetMinorLoop_LinkCh(pxLocScatterGather->Stcd, hwLinkCh);
  1849. hwv2AccInlineDmaCh_SetMinorLoop_Size(pxLocScatterGather->Stcd, pxLocScatterGather->TransferConfig->MinorLoop.Size);
  1850. /* MajorLoop */
  1851. hwv2AccInlineDmaCh_SetMajorLoop_EnLink(pxLocScatterGather->Stcd, pxLocScatterGather->TransferConfig->MajorLoop.EnLink ? 1U : 0U);
  1852. if(TRUE == pxLocScatterGather->TransferConfig->MajorLoop.EnLink)
  1853. {
  1854. hwLinkCh = Dma_Ip_ConvertLogicChToHwCh(pxLocScatterGather->TransferConfig->MajorLoop.LogicLinkCh);
  1855. hwv2AccInlineDmaCh_SetMajorLoop_LinkCh(pxLocScatterGather->Stcd, hwLinkCh);
  1856. }
  1857. else
  1858. {
  1859. hwv2AccInlineDmaCh_SetMajorLoop_LinkCh(pxLocScatterGather->Stcd, ElementId);
  1860. }
  1861. hwv2AccInlineDmaCh_SetMajorLoop_Count(pxLocScatterGather->Stcd, pxLocScatterGather->TransferConfig->MajorLoop.Count);
  1862. hwv2AccInlineDmaCh_SetSource_SignedLastAddrAdj(pxLocScatterGather->Stcd, (uint32)pxLocScatterGather->TransferConfig->Source.LastAddrAdj);
  1863. }
  1864. }
  1865. else
  1866. {
  1867. /* Do Nothing */
  1868. }
  1869. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  1870. }
  1871. /*==================================================================================================
  1872. * DMA LOGIC CHANNEL HARDWARE TCD -> LOAD WITH SOFTWARE TCD
  1873. ==================================================================================================*/
  1874. void HwAccDmaCh_LoadSoftwareTcdIntoHardwareTcd(const Dma_Ip_LogicChannelIdType * const pxLocLogicCh, const Dma_Ip_ScatterGatherConfigType * const pxLocScatterGather)
  1875. {
  1876. uint32 LocHwVers = pxLocLogicCh->HwVersId;
  1877. uint32 LocHwInst = pxLocLogicCh->HwInstId;
  1878. uint32 LocHwCh = pxLocLogicCh->HwChId;
  1879. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  1880. if(DMA_IP_HARDWARE_VERSION_3 == LocHwVers)
  1881. {
  1882. /* Force channel to retire: Clear DONE bit in order to write the ESG bit */
  1883. hwv3AccInlineDmaCh_CmdClearDone(&DMA_IP_HWV3_TCD_CH_VALUE(LocHwInst, LocHwCh));
  1884. /* Update Hardware TCD */
  1885. DMA_IP_HWV3_TCD_TCD_VALUE(LocHwInst, LocHwCh).reg_SADDR = pxLocScatterGather->Stcd->reg_SADDR;
  1886. DMA_IP_HWV3_TCD_TCD_VALUE(LocHwInst, LocHwCh).reg_SOFF = pxLocScatterGather->Stcd->reg_SOFF;
  1887. DMA_IP_HWV3_TCD_TCD_VALUE(LocHwInst, LocHwCh).reg_ATTR = pxLocScatterGather->Stcd->reg_ATTR;
  1888. DMA_IP_HWV3_TCD_TCD_VALUE(LocHwInst, LocHwCh).reg_NBYTES.reg_MLOFFYES = pxLocScatterGather->Stcd->reg_NBYTES.reg_MLOFFYES;
  1889. DMA_IP_HWV3_TCD_TCD_VALUE(LocHwInst, LocHwCh).reg_SLAST_SDA = pxLocScatterGather->Stcd->reg_SLAST_SDA;
  1890. DMA_IP_HWV3_TCD_TCD_VALUE(LocHwInst, LocHwCh).reg_DADDR = pxLocScatterGather->Stcd->reg_DADDR;
  1891. DMA_IP_HWV3_TCD_TCD_VALUE(LocHwInst, LocHwCh).reg_DOFF = pxLocScatterGather->Stcd->reg_DOFF;
  1892. DMA_IP_HWV3_TCD_TCD_VALUE(LocHwInst, LocHwCh).reg_CITER.reg_ELINKYES = pxLocScatterGather->Stcd->reg_CITER.reg_ELINKYES;
  1893. DMA_IP_HWV3_TCD_TCD_VALUE(LocHwInst, LocHwCh).reg_DLAST_SGA = pxLocScatterGather->Stcd->reg_DLAST_SGA;
  1894. DMA_IP_HWV3_TCD_TCD_VALUE(LocHwInst, LocHwCh).reg_BITER.reg_ELINKYES = pxLocScatterGather->Stcd->reg_BITER.reg_ELINKYES;
  1895. /* CSR shall be loaded last due to Start bit */
  1896. DMA_IP_HWV3_TCD_TCD_VALUE(LocHwInst, LocHwCh).reg_CSR = pxLocScatterGather->Stcd->reg_CSR;
  1897. }
  1898. else
  1899. {
  1900. /* Do Nothing */
  1901. }
  1902. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  1903. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  1904. if(DMA_IP_HARDWARE_VERSION_2 == LocHwVers)
  1905. {
  1906. /* Force channel to retire: Clear DONE bit in order to write the ESG bit */
  1907. hwv2AccInlineDmaCh_CmdClearDone(DMA_IP_HWV2_TCD_CH_VALUE(LocHwInst), LocHwCh);
  1908. /* Update Hardware TCD */
  1909. DMA_IP_HWV2_TCD_TCD_VALUE(LocHwInst, LocHwCh).reg_SADDR = pxLocScatterGather->Stcd->reg_SADDR;
  1910. DMA_IP_HWV2_TCD_TCD_VALUE(LocHwInst, LocHwCh).reg_SOFF = pxLocScatterGather->Stcd->reg_SOFF;
  1911. DMA_IP_HWV2_TCD_TCD_VALUE(LocHwInst, LocHwCh).reg_ATTR = pxLocScatterGather->Stcd->reg_ATTR;
  1912. DMA_IP_HWV2_TCD_TCD_VALUE(LocHwInst, LocHwCh).reg_NBYTES.reg_MLOFFYES = pxLocScatterGather->Stcd->reg_NBYTES.reg_MLOFFYES;
  1913. DMA_IP_HWV2_TCD_TCD_VALUE(LocHwInst, LocHwCh).reg_SLAST = pxLocScatterGather->Stcd->reg_SLAST;
  1914. DMA_IP_HWV2_TCD_TCD_VALUE(LocHwInst, LocHwCh).reg_DADDR = pxLocScatterGather->Stcd->reg_DADDR;
  1915. DMA_IP_HWV2_TCD_TCD_VALUE(LocHwInst, LocHwCh).reg_DOFF = pxLocScatterGather->Stcd->reg_DOFF;
  1916. DMA_IP_HWV2_TCD_TCD_VALUE(LocHwInst, LocHwCh).reg_CITER.reg_ELINKYES = pxLocScatterGather->Stcd->reg_CITER.reg_ELINKYES;
  1917. DMA_IP_HWV2_TCD_TCD_VALUE(LocHwInst, LocHwCh).reg_DLAST_SGA = pxLocScatterGather->Stcd->reg_DLAST_SGA;
  1918. DMA_IP_HWV2_TCD_TCD_VALUE(LocHwInst, LocHwCh).reg_BITER.reg_ELINKYES = pxLocScatterGather->Stcd->reg_BITER.reg_ELINKYES;
  1919. /* CSR shall be loaded last due to Start bit */
  1920. DMA_IP_HWV2_TCD_TCD_VALUE(LocHwInst, LocHwCh).reg_CSR = pxLocScatterGather->Stcd->reg_CSR;
  1921. }
  1922. else
  1923. {
  1924. /* Do Nothing */
  1925. }
  1926. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  1927. }
  1928. /*==================================================================================================
  1929. * IP INTERNAL FUNCTIONS
  1930. ==================================================================================================*/
  1931. void HwAccDmaCh_SetControl_ScatterGatherAddress(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, uint32 LocValue)
  1932. {
  1933. switch (LocHwVers)
  1934. {
  1935. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  1936. case DMA_IP_HARDWARE_VERSION_2:
  1937. hwv2AccInlineDmaCh_SetControl_ScatterGatherAddress(pxLocTcd, LocValue);
  1938. break;
  1939. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  1940. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  1941. case DMA_IP_HARDWARE_VERSION_3:
  1942. hwv3AccInlineDmaCh_SetControl_ScatterGatherAddress(pxLocTcd, LocValue);
  1943. break;
  1944. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  1945. default:
  1946. DMA_IP_DEV_ASSERT(FALSE);
  1947. break;
  1948. }
  1949. }
  1950. void HwAccDmaCh_SetControl_EnScatterGatherProcessing(const uint32 LocHwVers, Dma_Ip_TcdRegType * pxLocTcd, boolean LocValue)
  1951. {
  1952. switch (LocHwVers)
  1953. {
  1954. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  1955. case DMA_IP_HARDWARE_VERSION_2:
  1956. hwv2AccInlineDmaCh_SetAuxiliary_EnScatterGatherProcessing(pxLocTcd, LocValue);
  1957. break;
  1958. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  1959. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  1960. case DMA_IP_HARDWARE_VERSION_3:
  1961. hwv3AccInlineDmaCh_SetAuxiliary_EnScatterGatherProcessing(pxLocTcd, LocValue);
  1962. break;
  1963. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  1964. default:
  1965. DMA_IP_DEV_ASSERT(FALSE);
  1966. break;
  1967. }
  1968. }
  1969. #if (DMA_IP_DMACRC_IS_AVAILABLE == STD_ON)
  1970. void HwAccDmaCh_SetCrc_InstanceChannelSelect(const uint32 LocHwVers, const uint32 LocHwInst, const uint32 LocHwCh, const uint32 LocValue)
  1971. {
  1972. switch (LocHwVers)
  1973. {
  1974. #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE)
  1975. case DMA_IP_HARDWARE_VERSION_2:
  1976. (void)LocHwInst;
  1977. (void)LocHwCh;
  1978. (void)LocValue;
  1979. DMA_IP_DEV_ASSERT(FALSE);
  1980. break;
  1981. #endif /* #if (STD_ON == DMA_IP_HWV2_IS_AVAILABLE) */
  1982. #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE)
  1983. case DMA_IP_HARDWARE_VERSION_3:
  1984. hwv3AccInlineDmaCh_SetCrc_InstanceChannelSelect((Dma_Ip_HwCrcCtrlType*)&g_pDmaCrcPtrArray[LocHwInst]->CONTROL_REGISTER[LocHwCh], LocValue);
  1985. break;
  1986. #endif /* #if (STD_ON == DMA_IP_HWV3_IS_AVAILABLE) */
  1987. default:
  1988. DMA_IP_DEV_ASSERT(FALSE);
  1989. break;
  1990. }
  1991. }
  1992. #endif /* #if (DMA_IP_DMACRC_IS_AVAILABLE == STD_ON) */
  1993. /*==================================================================================================
  1994. * VIRTUAL ADDRESS MAPPING FUNCTIONS
  1995. ==================================================================================================*/
  1996. #if (DMA_IP_VIRTUAL_ADDRESS_MAPPING_IS_AVAILABLE == STD_ON)
  1997. static uint32 HwAccDma_SetVirtualToPhysicalAddress(const uint32 VirtualAddr)
  1998. {
  1999. uint32 PhysicAddr = VirtualAddr;
  2000. uint8 SectionIdx;
  2001. const Dma_Ip_InitType * ConfigPtr;
  2002. /* Get the initial pointer */
  2003. ConfigPtr = Dma_Ip_GetInitPtr();
  2004. for(SectionIdx = 0; SectionIdx < ConfigPtr->pxVirtualMemoryConfig->NumOfSection; SectionIdx++)
  2005. {
  2006. if((VirtualAddr >= (*(ConfigPtr->pxVirtualMemoryConfig->pSectionConfig))[SectionIdx].VirtualAddrStart) && (VirtualAddr < (*(ConfigPtr->pxVirtualMemoryConfig->pSectionConfig))[SectionIdx].VirtualAddrEnd))
  2007. {
  2008. /* Convert from Virtual address to Physical address */
  2009. PhysicAddr = (VirtualAddr - (*(ConfigPtr->pxVirtualMemoryConfig->pSectionConfig))[SectionIdx].VirtualAddrStart) + (*(ConfigPtr->pxVirtualMemoryConfig->pSectionConfig))[SectionIdx].PhysicalAddrStart;
  2010. }
  2011. }
  2012. return PhysicAddr;
  2013. }
  2014. static uint32 HwAccDma_SetPhysicalToVirtualAddress(const uint32 PhysicalAddr)
  2015. {
  2016. uint32 VirtualAddr = PhysicalAddr;
  2017. uint8 SectionIdx;
  2018. const Dma_Ip_InitType * ConfigPtr;
  2019. /* Get the initial pointer */
  2020. ConfigPtr = Dma_Ip_GetInitPtr();
  2021. for(SectionIdx = 0; SectionIdx < ConfigPtr->pxVirtualMemoryConfig->NumOfSection; SectionIdx++)
  2022. {
  2023. if((PhysicalAddr >= (*(ConfigPtr->pxVirtualMemoryConfig->pSectionConfig))[SectionIdx].PhysicalAddrStart) && (PhysicalAddr < (*(ConfigPtr->pxVirtualMemoryConfig->pSectionConfig))[SectionIdx].PhysicalAddrEnd))
  2024. {
  2025. /* Convert from Physical address to Virtual address */
  2026. VirtualAddr = (PhysicalAddr - (*(ConfigPtr->pxVirtualMemoryConfig->pSectionConfig))[SectionIdx].PhysicalAddrStart) + (*(ConfigPtr->pxVirtualMemoryConfig->pSectionConfig))[SectionIdx].VirtualAddrStart;
  2027. }
  2028. }
  2029. return VirtualAddr;
  2030. }
  2031. #endif /* DMA_IP_VIRTUAL_ADDRESS_MAPPING_IS_AVAILABLE == STD_ON */
  2032. #define MCL_STOP_SEC_CODE
  2033. /* @violates @ref Mcl_Dma_h_REF_1 MISRA 2012 Required Directive 4.10, Precautions shall be taken in order to prevent the contents of a header file being included more than once. */
  2034. #include "Mcl_MemMap.h"
  2035. #endif /* #if (DMA_IP_IS_AVAILABLE == STD_ON) */
  2036. /** @} */
  2037. /*==================================================================================================
  2038. * END OF FILE
  2039. ==================================================================================================*/