Dma_Ip.h 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666
  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. /* Prevention from multiple including the same header */
  25. #ifndef DMA_IP_DRIVER_H_
  26. #define DMA_IP_DRIVER_H_
  27. /**
  28. * @file Dma_Ip.h
  29. *
  30. * @version 1.0.0
  31. *
  32. * @brief AUTOSAR Mcl - Dma Ip driver header file.
  33. * @details
  34. *
  35. * @addtogroup DMA_IP_DRIVER DMA IP Driver
  36. * @{
  37. */
  38. /*==================================================================================================
  39. * INCLUDE FILES
  40. * 1) system and project includes
  41. * 2) needed interfaces from external units
  42. * 3) internal and external interfaces from this unit
  43. ==================================================================================================*/
  44. #include "Dma_Ip_Cfg.h"
  45. /*==================================================================================================
  46. SOURCE FILE VERSION INFORMATION
  47. ==================================================================================================*/
  48. #define DMA_IP_VENDOR_ID_H 43
  49. #define DMA_IP_AR_RELEASE_MAJOR_VERSION_H 4
  50. #define DMA_IP_AR_RELEASE_MINOR_VERSION_H 4
  51. #define DMA_IP_AR_RELEASE_REVISION_VERSION_H 0
  52. #define DMA_IP_SW_MAJOR_VERSION_H 1
  53. #define DMA_IP_SW_MINOR_VERSION_H 0
  54. #define DMA_IP_SW_PATCH_VERSION_H 0
  55. /*==================================================================================================
  56. FILE VERSION CHECKS
  57. ==================================================================================================*/
  58. /* Check if header file and Dma_Ip_Cfg.h file are of the same vendor */
  59. #if (DMA_IP_VENDOR_ID_H != DMA_IP_CFG_VENDOR_ID_H)
  60. #error "Dma_Ip.h and Dma_Ip_Cfg.h have different vendor ids"
  61. #endif
  62. /* Check if header file and Dma_Ip_Cfg.h file are of the same Autosar version */
  63. #if ((DMA_IP_AR_RELEASE_MAJOR_VERSION_H != DMA_IP_CFG_AR_RELEASE_MAJOR_VERSION_H) || \
  64. (DMA_IP_AR_RELEASE_MINOR_VERSION_H != DMA_IP_CFG_AR_RELEASE_MINOR_VERSION_H) || \
  65. (DMA_IP_AR_RELEASE_REVISION_VERSION_H != DMA_IP_CFG_AR_RELEASE_REVISION_VERSION_H) \
  66. )
  67. #error "AutoSar Version Numbers of Dma_Ip.h and Dma_Ip_Cfg.h are different"
  68. #endif
  69. /* Check if header file and Dma_Ip_Cfg.h file are of the same Software version */
  70. #if ((DMA_IP_SW_MAJOR_VERSION_H != DMA_IP_CFG_SW_MAJOR_VERSION_H) || \
  71. (DMA_IP_SW_MINOR_VERSION_H != DMA_IP_CFG_SW_MINOR_VERSION_H) || \
  72. (DMA_IP_SW_PATCH_VERSION_H != DMA_IP_CFG_SW_PATCH_VERSION_H) \
  73. )
  74. #error "Software Version Numbers of Dma_Ip.h and Dma_Ip_Cfg.h are different"
  75. #endif
  76. #if (DMA_IP_IS_AVAILABLE == STD_ON)
  77. /*===============================================================================================
  78. ENUMS
  79. ===============================================================================================*/
  80. /**
  81. * @brief This type contains the Dma Ip Logic Instance Commands.
  82. * @details The Commands trigger specific actions in the Dma Logic Instance.
  83. *
  84. * */
  85. typedef enum{
  86. DMA_IP_INST_CANCEL_TRANSFER = 0U, /**< @brief The Cancel Transfer cancels the executing channel and forces the Minor Loop to finish. */
  87. DMA_IP_INST_CANCEL_TRANSFER_WITH_ERROR = 1U, /**< @brief The Cancel Transfer With Error Command cancels the executing channel, forces the Minor Loop to finish and generates an error interrupt. */
  88. DMA_IP_INST_HALT = 2U, /**< @brief The Halt Command allows the ongoing transfer to finish and halts any new transfer. */
  89. DMA_IP_INST_RESUME = 3U, /**< @brief The Resume Command allows the transfer to continue. */
  90. }Dma_Ip_LogicInstanceCmdType;
  91. /**
  92. * @brief This type contains the Dma Ip Logic Channel Commands.
  93. * @details The Commands trigger specific actions in the Dma Ip Logic Channel.
  94. *
  95. * */
  96. typedef enum{
  97. DMA_IP_CH_SET_HARDWARE_REQUEST = 0U, /**< @brief The Set Hardware Request Command enables the Dma Channel to be triggered by hardware requests. */
  98. DMA_IP_CH_CLEAR_HARDWARE_REQUEST = 1U, /**< @brief The Clear Hardware Request Command disables the Dma Channel to be triggered by hardware requests. */
  99. DMA_IP_CH_SET_SOFTWARE_REQUEST = 2U, /**< @brief The Set Software Request Command sends a soft start request to the Dma Channel. */
  100. DMA_IP_CH_CLEAR_DONE = 3U, /**< @brief The Clear Done Command resets the Dma Channel Done status. */
  101. DMA_IP_CH_CLEAR_ERROR = 4U, /**< @brief The Clear Error Command resets the Dma Channel Error status. */
  102. }Dma_Ip_LogicChannelCmdType;
  103. /**
  104. * @brief This type contains the Dma Ip Logic Channel Global Parameters.
  105. * @details The Parameters set specific functionalities for the Dma Ip Logic Channel.
  106. *
  107. * */
  108. typedef enum{
  109. #if (DMA_IP_MASTER_ID_REPLICATION_IS_AVAILABLE == STD_ON)
  110. DMA_IP_CH_SET_EN_MASTER_ID_REPLICATION = 0U, /**< @brief [BOOLEAN] The EnMasterIdReplication Parameter sets the Dma Channel to use the same protection level and system bus ID of the master programming the Dma Channel. */
  111. #endif
  112. #if (DMA_IP_BUFFERED_WRITES_IS_AVAILABLE == STD_ON)
  113. DMA_IP_CH_SET_EN_BUFFERED_WRITES = 1U, /**< @brief [BOOLEAN] The EnBufferedWrites Parameter sets the Dma Channel writes to be bufferable. */
  114. #endif
  115. DMA_IP_CH_SET_EN_MUX_SOURCE_REQ = 2U, /**< @brief [BOOLEAN] The EnMuxSource Parameter enables the Dma Channel Mux Source. */
  116. DMA_IP_CH_SET_MUX_SOURCE_REQ = 3U, /**< @brief [VALUE] The MuxSource Parameter sets the Dma Channel Mux Source value. */
  117. DMA_IP_CH_SET_EN_MUX_TRIGGER = 4U, /**< @brief [BOOLEAN] The EnMuxTrigger Parameter enables the Dma Channel Mux Trigger. */
  118. DMA_IP_CH_SET_EN_HARDWARE_REQ = 5U, /**< @brief [BOOLEAN] The EnRequest Parameter enables the Dma Channel Request. */
  119. DMA_IP_CH_SET_EN_ERROR_INTERRUPT = 6U, /**< @brief [BOOLEAN] The EnError Parameter enables the Dma Channel Error Interrupt. */
  120. DMA_IP_CH_SET_GROUP_PRIORITY = 7U, /**< @brief [VALUE] The Group Parameter sets the Dma Channel Group Priority. */
  121. DMA_IP_CH_SET_LEVEL_PRIORITY = 8U, /**< @brief [VALUE] The Level Parameter sets the Dma Channel Level Priority. */
  122. #if (DMA_IP_PREEMPTION_IS_AVAILABLE == STD_ON)
  123. DMA_IP_CH_SET_EN_PREEMPTION_PRIORITY = 9U, /**< @brief [BOOLEAN] The EnPreemption Parameter enables the Dma Channel Preemption. */
  124. #endif
  125. #if (DMA_IP_DISABLE_PREEMPT_IS_AVAILABLE == STD_ON)
  126. DMA_IP_CH_SET_DIS_PREEMPT_PRIORITY = 10U, /**< @brief [BOOLEAN] The DisPreempt Parameter disables the Dma Channel Preempt. */
  127. #endif
  128. }Dma_Ip_LogicChannelGlobalParamType;
  129. /**
  130. * @brief This type contains the Dma Ip Logic Channel Transfer Parameters.
  131. * @details The Parameters set specific functionalities.
  132. *
  133. * */
  134. typedef enum{
  135. DMA_IP_CH_SET_SOURCE_ADDRESS = 0U, /**< @brief [VALUE] The Source Address Parameter sets the Dma Channel source address value. */
  136. DMA_IP_CH_SET_SOURCE_SIGNED_OFFSET = 1U, /**< @brief [VALUE] The Source Signed Offset Parameter sets the Dma Channel source signed offset value. */
  137. DMA_IP_CH_SET_SOURCE_SIGNED_LAST_ADDR_ADJ = 2U, /**< @brief [VALUE] The Source Signed Last Address Adjustment Parameter sets the Dma Channel source signed last address adjustment. */
  138. DMA_IP_CH_SET_SOURCE_TRANSFER_SIZE = 3U, /**< @brief [VALUE] The Source Transfer Size Parameter sets the Dma Channel source transfer size. */
  139. DMA_IP_CH_SET_SOURCE_MODULO = 4U, /**< @brief [VALUE] The Source Modulo Parameter sets the Dma Channel source modulo. */
  140. DMA_IP_CH_SET_DESTINATION_ADDRESS = 5U, /**< @brief [VALUE] The Destination Address Parameter sets the Dma Channel destination address value. */
  141. DMA_IP_CH_SET_DESTINATION_SIGNED_OFFSET = 6U, /**< @brief [VALUE] The Destination Signed Offset Parameter sets the Dma Channel destination signed offset value. */
  142. DMA_IP_CH_SET_DESTINATION_SIGNED_LAST_ADDR_ADJ = 7U, /**< @brief [VALUE] The Destination Signed Last Address Adjustment Parameter sets the Dma Channel destination signed last address adjustment. */
  143. DMA_IP_CH_SET_DESTINATION_TRANSFER_SIZE = 8U, /**< @brief [VALUE] The Destination Transfer Size Parameter sets the Dma Channel destination transfer size. */
  144. DMA_IP_CH_SET_DESTINATION_MODULO = 9U, /**< @brief [VALUE] The Destination Modulo Parameter sets the Dma Channel destination modulo. */
  145. DMA_IP_CH_SET_MINORLOOP_EN_SRC_OFFSET = 10U, /**< @brief [BOOLEAN] The Minor Loop Enable Source Offset Parameter enables the Dma Channel minor loop source offset. */
  146. DMA_IP_CH_SET_MINORLOOP_EN_DST_OFFSET = 11U, /**< @brief [BOOLEAN] The Minor Loop Enable Destination Offset Parameter enables the Dma Channel minor loop destination offset. */
  147. DMA_IP_CH_SET_MINORLOOP_SIGNED_OFFSET = 12U, /**< @brief [VALUE] The Minor Loop Signed Offset Parameter sets the Dma Channel minor loop signed offset. */
  148. DMA_IP_CH_SET_MINORLOOP_EN_LINK = 13U, /**< @brief [BOOLEAN] The Minor Loop Enable Link Parameter enables the Dma Channel minor loop logic channel linking. */
  149. DMA_IP_CH_SET_MINORLOOP_LOGIC_LINK_CH = 14U, /**< @brief [VALUE] The Minor Loop Logic Channel Link Parameter sets the Dma Channel minor loop logic channel link. */
  150. DMA_IP_CH_SET_MINORLOOP_SIZE = 15U, /**< @brief [VALUE] The Minor Loop Size Parameter sets the Dma Channel minor loop transfer size. */
  151. DMA_IP_CH_SET_MAJORLOOP_EN_LINK = 16U, /**< @brief [BOOLEAN] The Major Loop Enable Link Parameter enables the Dma Channel major loop logic channel linking. */
  152. DMA_IP_CH_SET_MAJORLOOP_LOGIC_LINK_CH = 17U, /**< @brief [VALUE] The Major Loop Logic Channel Link Parameter sets the Dma Channel major loop logic channel link. */
  153. DMA_IP_CH_SET_MAJORLOOP_COUNT = 18U, /**< @brief [VALUE] The Major Loop Count Parameter sets the Dma Channel major loop count. */
  154. #if (DMA_IP_STORE_DST_ADDR_IS_AVAILABLE == STD_ON)
  155. DMA_IP_CH_SET_CONTROL_STORE_DST_ADDR = 19U, /**< @brief [VALUE] The Store Destination Address Parameter saves the final destination address in system memory. */
  156. #endif
  157. DMA_IP_CH_SET_CONTROL_SOFTWARE_REQUEST = 20U, /**< @brief [BOOLEAN] The Enable Start Parameter enables the Dma Channel start service request. The main usage is for ScatterGather Element configuration. */
  158. DMA_IP_CH_SET_CONTROL_EN_MAJOR_INTERRUPT = 21U, /**< @brief [BOOLEAN] The Enable Major Interrupt Parameter enables the Dma Channel major interrupt. */
  159. DMA_IP_CH_SET_CONTROL_EN_HALF_MAJOR_INTERRUPT = 22U, /**< @brief [BOOLEAN] The Enable Half Interrupt Parameter enables the Dma Channel half major interrupt. */
  160. DMA_IP_CH_SET_CONTROL_DIS_AUTO_REQUEST = 23U, /**< @brief [BOOLEAN] The Disable Automatic Request Parameter disables the Dma Channel automatic request. */
  161. #if (DMA_IP_END_OF_PACKET_SIGNAL_IS_AVAILABLE == STD_ON)
  162. DMA_IP_CH_SET_CONTROL_EN_END_OF_PACKET_SIGNAL = 24U, /**< @brief [BOOLEAN] The Enable End Of Packet Signal Parameter enables the Dma Channel end of packet signal. */
  163. #endif
  164. DMA_IP_CH_SET_CONTROL_BANDWIDTH = 25U, /**< @brief [VALUE] The Bandwidth Control Parameter sets the Dma Channel bandwidth control. */
  165. }Dma_Ip_LogicChannelTransferParamType;
  166. #if (DMA_IP_DMACRC_IS_AVAILABLE == STD_ON)
  167. /**
  168. * @brief This type contains the Dma Ip Logic Channel Crc Parameters.
  169. * @details The Parameters set specific CRC information.
  170. *
  171. * */
  172. typedef enum{
  173. DMA_IP_CH_SET_CRC_MODE = 0U,
  174. DMA_IP_CH_SET_CRC_POLYNOMIAL = 1U,
  175. DMA_IP_CH_SET_CRC_EN_INITIAL_VALUE = 2U,
  176. DMA_IP_CH_SET_CRC_INITIAL_VALUE = 3U,
  177. DMA_IP_CH_SET_CRC_EN_LOGIC = 4U,
  178. }Dma_Ip_LogicChannelCrcParamType;
  179. #endif
  180. /**
  181. * @brief This type contains the Dma Ip Logic Channel Information Parameters.
  182. * @details The Parameters get specific information.
  183. *
  184. * */
  185. typedef enum{
  186. DMA_IP_CH_GET_SOURCE_ADDRESS = 0U, /**< @brief [VALUE] The Source Address Parameter gets the Dma Channel source address. */
  187. DMA_IP_CH_GET_DESTINATION_ADDRESS = 1U, /**< @brief [VALUE] The Destination Address Parameter gets the Dma Channel destination address. */
  188. DMA_IP_CH_GET_BEGIN_ITER_COUNT = 2U, /**< @brief [VALUE] The Begin Iteration Count Parameter gets the Dma Channel begin iteration count. */
  189. DMA_IP_CH_GET_CURRENT_ITER_COUNT = 3U, /**< @brief [VALUE] The Current Iteration Count Parameter gets the Dma Channel current iteration count. */
  190. #if (DMA_IP_STORE_DST_ADDR_IS_AVAILABLE == STD_ON)
  191. DMA_IP_CH_GET_STORE_DST_ADDR = 4U, /**< @brief [VALUE] The Store Destination Address Parameter gets the Dma Channel stored destination address. */
  192. #endif
  193. #if (DMA_IP_MASTER_ID_REPLICATION_IS_AVAILABLE == STD_ON)
  194. DMA_IP_CH_GET_MASTER_ID = 5U, /**< @brief [VALUE] The Master Id Parameter gets the Dma Channel master id. */
  195. #endif
  196. DMA_IP_CH_GET_MAJOR_INTERRUPT = 6U, /**< @brief [BOOLEAN] The Major Interrupt Parameter gets the Dma Channel major interrupt. */
  197. DMA_IP_CH_GET_HALF_MAJOR_INTERRUPT = 7U, /**< @brief [BOOLEAN] The Half Major Interrupt Parameter gets the Dma Channel half major interrupt. */
  198. #if (DMA_IP_DMACRC_IS_AVAILABLE == STD_ON)
  199. DMA_IP_CH_GET_FINAL_CRC = 8U,
  200. #endif
  201. }Dma_Ip_LogicChannelInfoParamType;
  202. /*===============================================================================================
  203. STRUCTS
  204. ===============================================================================================*/
  205. /**
  206. * @brief This type contains the Dma Ip Logic Channel Global List.
  207. * @details The Dma Ip Channel Global List contains a pair composed from Dma Channel Global Parameter
  208. * Type and the Value of the parameter.
  209. * The Dma Ip Channel Global Parameter Type selects a parameter form the Global Parameter
  210. * enum type.
  211. * The Value stores the parameter's value.
  212. * */
  213. typedef struct{
  214. Dma_Ip_LogicChannelGlobalParamType Param;
  215. uint32 Value;
  216. }Dma_Ip_LogicChannelGlobalListType;
  217. /**
  218. * @brief This type contains the Dma Ip Channel Transfer List.
  219. * @details The Dma Ip Channel Transfer List contains a pair composed from Dma Channel Transfer
  220. * Parameter Type and the Value of the parameter.
  221. * The Dma Ip Channel Transfer Parameter Type selects a parameter form the Transfer Parameter
  222. * enum type.
  223. * The Value stores the parameter's value.
  224. * @implements Dma_Ip_LogicChannelTransferListType_struct
  225. * */
  226. /**
  227. * @brief This type contains the Dma Ip Channel ScatterGather List.
  228. * @details The Dma Ip Channel Transfer List contains a pair composed from Dma Channel ScatterGather
  229. * Parameter Type and the Value of the parameter.
  230. * The Dma Ip Channel ScatterGather Parameter Type selects a parameter form the ScatterGather
  231. * Parameter enum type.
  232. * The Value stores the parameter's value.
  233. * @implements Dma_Ip_LogicChannelScatterGatherListType_struct
  234. * */
  235. typedef struct{
  236. Dma_Ip_LogicChannelTransferParamType Param;
  237. uint32 Value;
  238. }Dma_Ip_LogicChannelTransferListType, Dma_Ip_LogicChannelScatterGatherListType;
  239. #if (DMA_IP_DMACRC_IS_AVAILABLE == STD_ON)
  240. /**
  241. * @brief This type contains the Dma Ip Channel ScatterGather List.
  242. * @details The Dma Ip Channel Transfer List contains a pair composed from Dma Channel ScatterGather
  243. * Parameter Type and the Value of the parameter.
  244. * The Dma Ip Channel ScatterGather Parameter Type selects a parameter form the ScatterGather
  245. * Parameter enum type.
  246. * The Value stores the parameter's value.
  247. * @implements Dma_Ip_LogicChannelCrcListType_struct
  248. * */
  249. typedef struct{
  250. Dma_Ip_LogicChannelCrcParamType Param;
  251. uint32 Value;
  252. }Dma_Ip_LogicChannelCrcListType;
  253. #endif
  254. /**
  255. * @brief This type contains the Dma Ip Instance Status.
  256. * @details The Dma Ip Instance Status contains the Hardware Errors, Active Id and Active indication for
  257. * the running Dma Channel.
  258. * The Errors shall contain the Hardware Errors.
  259. * The ActiveId shall contain the running Dma Channel Id.
  260. * The Active shall contain the running Dma Channel Active status.
  261. * @implements Dma_Ip_LogicInstanceStatusType_struct
  262. * */
  263. /* DMA Logic Instance Status */
  264. typedef struct{
  265. uint32 Errors; /**< @brief [VALUE] The Errors value is read from the DMA Instance Error Register (ES) as it is. */
  266. uint8 ActiveId; /**< @brief [VALUE] The ActiveId value is read from the DMA Instance Control Register (CR) field ACTIVE_ID. */
  267. boolean Active; /**< @brief [BOOLEAN] The Active value is read from the DMA Instance Control Register (CR) field ACTIVE. */
  268. }Dma_Ip_LogicInstanceStatusType;
  269. /**
  270. * @brief This type contains the Dma Ip Channel Status.
  271. * @details The Dma Ip Channel Status contains the Hardware Errors, Active status and Done indication for
  272. * the running Dma Channel.
  273. * The Channel State Value shall contain the internal driver state of the Dma Channel.
  274. * The Errors shall contain the Hardware Dma Channel Errors.
  275. * The Active shall contain the running Dma Channel Id.
  276. * The Done shall contain the running Dma Channel Active status.
  277. * @implements Dma_Ip_LogicChannelStatusType_struct
  278. * */
  279. /* DMA Logic Channel Status */
  280. typedef struct{
  281. Dma_Ip_HwChannelStateValueType ChStateValue;
  282. /**< @brief [VALUE] The ChStateValue value is read from the internal DMA Driver Channel State Machine. Check UM for additional information. */
  283. uint32 Errors; /**< @brief [VALUE] The Errors value is read from the DMA Channel Error Register (CHx_ES) as it is. */
  284. boolean Active; /**< @brief [BOOLEAN] The Active value is read from the DMA Channel Control and Status Register (CHx_CSR) field ACTIVE. */
  285. boolean Done; /**< @brief [BOOLEAN] The Active value is read from the DMA Channel Control and Status Register (CHx_CSR) field DONE. */
  286. }Dma_Ip_LogicChannelStatusType;
  287. /*==================================================================================================
  288. * GLOBAL FUNCTION PROTOTYPES
  289. ==================================================================================================*/
  290. #define MCL_START_SEC_CODE
  291. /* @violates @ref DMA_IP_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. */
  292. #include "Mcl_MemMap.h"
  293. /**
  294. * @brief This function initializes the Dma Ip Driver.
  295. * @details This service is a non reentrant function that shall initialize the Dma Ip driver.
  296. *
  297. * @param[in] DmaInit Pointer to the configuration structure.
  298. *
  299. * @return Dma_Ip_ReturnType DMA_IP_STATUS_SUCCESS is returned if the initialization finished ok.
  300. * DMA_IP_STATUS_WRONG_STATE is returned if the Dma Ip Channel state is
  301. * not Dma_Ip_Ch_ResetState.
  302. *
  303. * @implements Dma_Ip_Init_Activity
  304. * */
  305. Dma_Ip_ReturnType Dma_Ip_Init(const Dma_Ip_InitType * const pxDmaInit);
  306. /**
  307. * @brief This function deinitializes the Dma Ip Driver.
  308. * @details This service is a non reentrant function that shall deinitialize the Dma Ip driver.
  309. *
  310. * @return Dma_Ip_ReturnType DMA_IP_STATUS_SUCCESS is returned if the deinitialization finished ok
  311. *
  312. * @implements Dma_Ip_Deinit_Activity
  313. * */
  314. Dma_Ip_ReturnType Dma_Ip_Deinit(void);
  315. /**
  316. * @brief This function sets Dma Ip Instance Command.
  317. * @details This service is a reentrant function that shall command the Dma Instance.
  318. * The command shall trigger specific functionalities of the Dma Instance.
  319. *
  320. * @param[in] LogicInst Selection value of the Logic Instance.
  321. * @param[in] Command The command for the Logic Instance.
  322. *
  323. * @return Dma_Ip_ReturnType DMA_IP_STATUS_SUCCESS is returned if the command finished ok.
  324. *
  325. * @implements Dma_Ip_SetLogicInstanceCommand_Activity
  326. * */
  327. Dma_Ip_ReturnType Dma_Ip_SetLogicInstanceCommand(const uint32 LogicInst, const Dma_Ip_LogicInstanceCmdType Command);
  328. /**
  329. * @brief This function gets Dma Ip Instance Status.
  330. * @details This service is a reentrant function that shall get the Dma Instance status.
  331. * The command shall read specific functionalities of the Dma Instance.
  332. *
  333. * @param[in] LogicInst Selection value of the Logic Instance.
  334. * @param[out] Status Pointer to the Dma Instance status.
  335. *
  336. * @return Dma_Ip_ReturnType DMA_IP_STATUS_SUCCESS is returned if the get status finished ok.
  337. *
  338. * @implements Dma_Ip_GetLogicInstanceStatus_Activity
  339. * */
  340. Dma_Ip_ReturnType Dma_Ip_GetLogicInstanceStatus(const uint32 LogicInst, Dma_Ip_LogicInstanceStatusType * const Status);
  341. /**
  342. * @brief This function initializes the Dma Ip Logic Channel.
  343. * @details This service is a non reentrant function that shall initialize the Dma Ip Logic Channel.
  344. *
  345. * @param[in] LogicCh Selection value of the Logic Channel.
  346. *
  347. * @return Dma_Ip_ReturnType DMA_IP_STATUS_SUCCESS is returned if the initialization finished ok.
  348. * DMA_IP_STATUS_WRONG_STATE is returned if the Dma Ip Channel state is
  349. * not Dma_Ip_Ch_ResetState.
  350. * DMA_IP_STATUS_WRONG_CONFIG is returned if wrong configuration was detected.
  351. *
  352. * @implements Dma_Ip_LogicChannelInit_Activity
  353. * */
  354. Dma_Ip_ReturnType Dma_Ip_LogicChannelInit(const uint32 LogicCh);
  355. /**
  356. * @brief This function deinitializes the Dma Ip Logic Channel.
  357. * @details This service is a non reentrant function that shall deinitialize the Dma Ip Logic Channel.
  358. *
  359. * @param[in] LogicCh Selection value of the Logic Channel.
  360. *
  361. * @return Dma_Ip_ReturnType DMA_IP_STATUS_SUCCESS is returned if the deinitialization finished ok.
  362. *
  363. * @implements Dma_Ip_LogicChannelDeinit_Activity
  364. * */
  365. Dma_Ip_ReturnType Dma_Ip_LogicChannelDeinit(const uint32 LogicCh);
  366. /**
  367. * @brief This function sets Dma Ip Logic Channel Command.
  368. * @details This service is a reentrant function that shall command the Dma Channel.
  369. * The command shall trigger specific functionalities of the Dma Channel.
  370. *
  371. * @param[in] LogicCh Selection value of the Logic Channel.
  372. * @param[in] Command The command for the Logic Channel.
  373. *
  374. * @return Dma_Ip_ReturnType DMA_IP_STATUS_SUCCESS is returned if the initialization finished ok.
  375. * DMA_IP_STATUS_WRONG_STATE is returned if the Dma Ip Channel state is
  376. * not Dma_Ip_Ch_ReadyState.
  377. *
  378. * @implements Dma_Ip_SetLogicChannelCommand_Activity
  379. * */
  380. Dma_Ip_ReturnType Dma_Ip_SetLogicChannelCommand(const uint32 LogicCh, const Dma_Ip_LogicChannelCmdType Command);
  381. /**
  382. * @brief This function gets Dma Ip Logic Channel Status.
  383. * @details This service is a reentrant function that shall get the Dma Channel status.
  384. * The command shall read specific functionalities of the Dma Channel.
  385. *
  386. * @param[in] LogicCh Selection value of the Logic Channel.
  387. * @param[out] Status Pointer to the Dma Channel status.
  388. *
  389. * @return Dma_Ip_ReturnType DMA_IP_STATUS_SUCCESS is returned if the get status finished ok.
  390. *
  391. * @implements Dma_Ip_GetLogicChannelStatus_Activity
  392. * */
  393. Dma_Ip_ReturnType Dma_Ip_GetLogicChannelStatus(const uint32 LogicCh, Dma_Ip_LogicChannelStatusType * const ChStatus);
  394. /**
  395. * @brief This function sets Dma Ip Logic Channel Global List settings.
  396. * @details This service is a reentrant function that shall set the Dma Ip Logic Channel
  397. * global parameters list.
  398. * The list is composed of an array of Dma Ip Logic Channel global parameters settings.
  399. * The settings list(array) is defined by the user needs: it contains the
  400. * desired parameters to be configured, in any desired order.
  401. *
  402. * How to use this interface:
  403. * 1. Use the "Dma_Ip_LogicChannelGlobalListType" to create a list(array) with the desired
  404. * paramaters to configure (see parameters: "Dma_Ip_LogicChannelGlobalParamType")
  405. * The list can declared globally or locally:
  406. * A. Global example:
  407. * Dma_Ip_LogicChannelGlobalListType global_Dma_Ip_ChannelGlobalList0[NUMBER_OF_PARAMETERS] = {...};
  408. * B. Local example:
  409. * Dma_Ip_LogicChannelGlobalListType Dma_Ip_ChannelGlobalList[NUMBER_OF_PARAMETERS];
  410. * Dma_Ip_ChannelGlobalList[PARAMETER0].Param = DMA_IP_CH_SET_EN_PREEMPTION_PRIORITY;
  411. * Dma_Ip_ChannelGlobalList[PARAMETER0].Value = TRUE;
  412. * Dma_Ip_ChannelGlobalList[PARAMETER1].Param = ...;
  413. * Dma_Ip_ChannelGlobalList[PARAMETER1].Value = ...;
  414. * 2. Call the "Dma_Ip_SetLogicChannelGlobalList()" interface:
  415. * Dma_Ip_SetLogicChannelGlobalList(LOGIC_CHANNELx, Dma_Ip_ChannelGlobalList, NUMBER_OF_PARAMETERS);
  416. *
  417. * @param[in] Channel Specifies the Logic Channel Id.
  418. * @param[in] List Pointer to the Global List Array.
  419. * @param[in] ListDimension Number of entries in the List.
  420. *
  421. * @return Dma_Ip_ReturnType DMA_IP_STATUS_SUCCESS is returned if the initialization finished ok.
  422. * DMA_IP_STATUS_WRONG_STATE is returned if the Dma Ip Channel state is
  423. * not Dma_Ip_Ch_ReadyState.
  424. *
  425. * @implements Dma_Ip_SetLogicChannelGlobalList_Activity
  426. * */
  427. Dma_Ip_ReturnType Dma_Ip_SetLogicChannelGlobalList(const uint32 LogicCh, const Dma_Ip_LogicChannelGlobalListType List[], const uint32 ListDimension);
  428. /**
  429. * @brief This function sets Dma Ip Logic Channel Transfer List settings.
  430. * @details -> This service is a reentrant function that shall set the Dma Ip Logic Channel
  431. * transfer parameters list.
  432. * -> The "Transfer List" loads the configuration directly into the Hardware TCD and disables
  433. * the ScatterGather for the Hardware TCD.
  434. * -> The list is composed of an array of Dma Ip Logic Channel transfer parameters settings.
  435. * -> The settings array is defined by the user needs: it contains entries for each desired
  436. * parameter to be configured, in any suitable order.
  437. *
  438. * -> How to use this interface: <-
  439. * 1. Use the "Dma_Ip_LogicChannelTransferListType" to create a list(array) with the desired
  440. * paramaters to configure (see parameters: "Dma_Ip_LogicChannelTransferParamType")
  441. * The list can declared globally or locally:
  442. * Global example:
  443. * #define DMA_IP_TRANSFER_LIST0_DIMENSION ((uint32)2U)
  444. * Dma_Ip_LogicChannelTransferListType global_Dma_Ip_ChannelTransferList0[DMA_IP_TRANSFER_LIST0_DIMENSION] = {...};
  445. * Local example:
  446. * #define DMA_IP_TRANSFER_LIST0_DIMENSION ((uint32)2U)
  447. * Dma_Ip_LogicChannelTransferListType Dma_Ip_ChannelTransferList0[DMA_IP_TRANSFER_LIST0_DIMENSION];
  448. * Dma_Ip_ChannelTransferList0[PARAMETER0].Param = DMA_IP_CH_SET_VAL_SOURCE_ADDRESS;
  449. * Dma_Ip_ChannelTransferList0[PARAMETER0].Value = &SourceBuffer;
  450. * Dma_Ip_ChannelTransferList0[PARAMETER1].Param = DMA_IP_CH_SET_DESTINATION_ADDRESS;
  451. * Dma_Ip_ChannelTransferList0[PARAMETER1].Value = &DestinationBuffer;
  452. * 2. Call the "Dma_Ip_SetLogicChannelTransferList()" interface:
  453. * Dma_Ip_SetLogicChannelTransferList(LOGIC_CHANNELx, Dma_Ip_ChannelTransferList0, DMA_IP_TRANSFER_LIST0_DIMENSION);
  454. *
  455. * -> Coding Example: <-
  456. * -> The user shall create the desired configuration list for his specific application.
  457. * "UserDefinedFileName.h"
  458. * #define DMA_IP_TRANSFER_LIST0_DIMENSION ((uint32)8U)
  459. * #define DMA_IP_SET_TRANSFER_TYPE0(CHANNEL, DIMENSION, SADDR, SOFF, SSIZE, DADDR, DOFF, DSIZE, MINOR_SIZE, MAJOR_COUNT) \
  460. * Dma_Ip_LogicChannelTransferListType Dma_Ip_ChannelTransferList0[DIMENSION]; \
  461. * Dma_Ip_ChannelTransferList0[0U].Param = DMA_IP_CH_SET_VAL_SOURCE_ADDRESS; \
  462. * Dma_Ip_ChannelTransferList0[0U].Value = SADDR; \
  463. * Dma_Ip_ChannelTransferList0[1U].Param = DMA_IP_CH_SET_SOURCE_SIGNED_OFFSET; \
  464. * Dma_Ip_ChannelTransferList0[1U].Value = SOFF; \
  465. * Dma_Ip_ChannelTransferList0[2U].Param = DMA_IP_CH_SET_SOURCE_TRANSFER_SIZE; \
  466. * Dma_Ip_ChannelTransferList0[2U].Value = SSIZE; \
  467. * Dma_Ip_ChannelTransferList0[3U].Param = DMA_IP_CH_SET_DESTINATION_ADDRESS; \
  468. * Dma_Ip_ChannelTransferList0[3U].Value = DADDR; \
  469. * Dma_Ip_ChannelTransferList0[4U].Param = DMA_IP_CH_SET_DESTINATION_SIGNED_OFFSET; \
  470. * Dma_Ip_ChannelTransferList0[4U].Value = DOFF; \
  471. * Dma_Ip_ChannelTransferList0[5U].Param = DMA_IP_CH_SET_DESTINATION_TRANSFER_SIZE; \
  472. * Dma_Ip_ChannelTransferList0[5U].Value = DSIZE; \
  473. * Dma_Ip_ChannelTransferList0[6U].Param = DMA_IP_CH_SET_MINORLOOP_SIZE; \
  474. * Dma_Ip_ChannelTransferList0[6U].Value = MINOR_SIZE; \
  475. * Dma_Ip_ChannelTransferList0[7U].Param = DMA_IP_CH_SET_MAJORLOOP_COUNT; \
  476. * Dma_Ip_ChannelTransferList0[7U].Value = MAJOR_COUNT; \
  477. * Dma_Ip_SetLogicChannelTransferList(CHANNEL, Dma_Ip_ChannelTransferList0, DIMENSION);
  478. *
  479. * "ApplicationFileName.c"
  480. * void ConfigureDmaChannel(ConfigType * pxConfig)
  481. * {
  482. * uint32 MinorLoopSize = 2U;
  483. * uint32 MajorLoopCount;
  484. * if(pxConfig->MajorLoopCondition == TRUE)
  485. * {
  486. * MajorLoopCount = 8U;
  487. * }
  488. * else
  489. * {
  490. * MajorLoopCount = 24U;
  491. * }
  492. * DMA_IP_SET_TRANSFER_TYPE0(pxConfig->LogicChannel,
  493. * DMA_IP_TRANSFER_LIST0_DIMENSION,
  494. * pxConfig->SourceBuffer,
  495. * 2U,
  496. * DMA_IP_TRANSFER_SIZE_2_BYTE,
  497. * &RegisterAddress,
  498. * 0U,
  499. * DMA_IP_TRANSFER_SIZE_2_BYTE,
  500. * MinorLoopSize,
  501. * MajorLoopCount);
  502. * }
  503. *
  504. * @param[in] Channel Specifies the Logic Channel Id.
  505. * @param[in] List Pointer to the Transfer List Array.
  506. * @param[in] ListDimension Number of entries in the List.
  507. *
  508. * @return Dma_Ip_ReturnType DMA_IP_STATUS_SUCCESS is returned if the initialization finished ok.
  509. * DMA_IP_STATUS_WRONG_STATE is returned if the Dma Ip Channel state is
  510. * not Dma_Ip_Ch_ReadyState.
  511. *
  512. * @implements Dma_Ip_SetLogicChannelTransferList_Activity
  513. * */
  514. Dma_Ip_ReturnType Dma_Ip_SetLogicChannelTransferList(const uint32 LogicCh, const Dma_Ip_LogicChannelTransferListType List[], const uint32 ListDimension);
  515. /**
  516. * @brief This function sets Dma Ip Logic Channel Scatter/Gather List settings.
  517. * @details -> This service is a reentrant function that shall set the Dma Ip Logic Channel
  518. * scatter/gather parameters list.
  519. * -> The "Scatter/Gather List" configures Logic Elements belonging to the same
  520. * Dma Logic Channel.
  521. * -> The "Scatter/Gather List" loads the configuration into the Software TCD.
  522. * The Software TCD has the Scatter/Gather Enable set (ESG bit) and the Next Software
  523. * TCD Address already loaded during the configuration generation process.
  524. * -> The "Scatter/Gather List" shall not be able to modify the Scatter/Gather Element
  525. * linkage (reorder of elements in the chain). The linkage of the elements is set only
  526. * during the configuration process.
  527. * -> The settings array is defined by the user needs: it contains entries for
  528. * each desired parameter to be configured, in any suitable order.
  529. * -> This service does not load the Logic Element into the Hardware TCD. This functionality
  530. * is covered by Dma_Ip_SetLogicChannelScatterGatherConfig.
  531. *
  532. * How to use this interface:
  533. * 1. Use the "Dma_Ip_LogicChannelScatterGatherListType" to create a list(array) with the desired
  534. * paramaters to configure (see parameters: "Dma_Ip_LogicChannelTransferParamType")
  535. * The list can declared globally or locally:
  536. * Global example:
  537. * Dma_Ip_LogicChannelScatterGatherListType global_Dma_Ip_ChannelScatterGatherList0[NUMBER_OF_PARAMETERS] = {...};
  538. * Local example:
  539. * Dma_Ip_LogicChannelScatterGatherListType Dma_Ip_ChannelScatterGatherList[NUMBER_OF_PARAMETERS];
  540. * Dma_Ip_ChannelScatterGatherList[PARAMETER0].Param = DMA_IP_CH_SET_VAL_SOURCE_ADDRESS;
  541. * Dma_Ip_ChannelScatterGatherList[PARAMETER0].Value = &SourceBuffer;
  542. * Dma_Ip_ChannelScatterGatherList[PARAMETER1].Param = DMA_IP_CH_SET_DESTINATION_ADDRESS;
  543. * Dma_Ip_ChannelScatterGatherList[PARAMETER1].Value = &DestinationBuffer;
  544. * 2. Call the "Dma_Ip_SetLogicChannelScatterGatherList()" interface:
  545. * Dma_Ip_SetLogicChannelScatterGatherList(LOGIC_CHANNELx, LOGIC_ELEMENTy, Dma_Ip_ChannelScatterGatherList, NUMBER_OF_PARAMETERS);
  546. *
  547. * @return Dma_Ip_ReturnType DMA_IP_STATUS_SUCCESS is returned if the initialization finished ok.
  548. * DMA_IP_STATUS_WRONG_STATE is returned if the Dma Ip Channel state is
  549. * not Dma_Ip_Ch_ReadyState.
  550. *
  551. * @implements Dma_Ip_SetLogicChannelScatterGatherList_Activity
  552. * */
  553. Dma_Ip_ReturnType Dma_Ip_SetLogicChannelScatterGatherList(const uint32 LogicCh, const uint32 Element, const Dma_Ip_LogicChannelScatterGatherListType List[], const uint32 ListDimension);
  554. #if (DMA_IP_DMACRC_IS_AVAILABLE == STD_ON)
  555. /**
  556. * @brief This function sets Dma Ip Logic Channel Crc List settings.
  557. * @details This service is a reentrant function that shall set the Dma Ip Logic Channel
  558. * crc parameters list.
  559. * The settings array is defined by the user needs: it contains entries for
  560. * each desired parameter to be configured, in any suitable order.
  561. *
  562. * How to use this interface:
  563. * 1. Use the "Dma_Ip_LogicChannelCrcListType" to create a list(array) with the desired
  564. * paramaters to configure (see parameters: "Dma_Ip_LogicChannelCrcParamType")
  565. * The list can declared globally or locally:
  566. * Global example:
  567. * Dma_Ip_LogicChannelCrcListType global_Dma_Ip_ChannelCrcList0[NUMBER_OF_PARAMETERS] = {...};
  568. * Local example:
  569. * Dma_Ip_LogicChannelCrcListType Dma_Ip_ChannelCrcList[NUMBER_OF_PARAMETERS];
  570. * Dma_Ip_ChannelCrcList[PARAMETER0].Param = DMA_IP_CH_SET_CRC_POLYNOMIAL;
  571. * Dma_Ip_ChannelCrcList[PARAMETER0].Value = ISCSICRC-32C;
  572. * Dma_Ip_ChannelCrcList[PARAMETER1].Param = DMA_IP_CH_SET_CRC_EN_LOGIC;
  573. * Dma_Ip_ChannelCrcList[PARAMETER1].Value = TRUE;
  574. * 2. Call the "Dma_Ip_SetLogicChannelCrcList()" interface:
  575. * Dma_Ip_SetLogicChannelCrcList(LOGIC_CHANNELx, Dma_Ip_ChannelCrcList, NUMBER_OF_PARAMETERS);
  576. *
  577. * @return Dma_Ip_ReturnType DMA_IP_STATUS_SUCCESS is returned if the initialization finished ok.
  578. * DMA_IP_STATUS_WRONG_STATE is returned if the Dma Ip Channel state is
  579. * not Dma_Ip_Ch_ReadyState.
  580. *
  581. * @implements Dma_Ip_SetLogicChannelCrcList_Activity
  582. * */
  583. Dma_Ip_ReturnType Dma_Ip_SetLogicChannelCrcList(const uint32 LogicCh, Dma_Ip_LogicChannelCrcListType List[], const uint32 ListDimension);
  584. #endif
  585. /**
  586. * @brief This function gets the Dma Ip Logic Channel Parameter value.
  587. * @details This service is a reentrant function that shall get the Dma Channel
  588. * parameters value.
  589. *
  590. * @param[in] LogicCh Selection value of the Logic Channel.
  591. * @param[in] Param Selection parameter.
  592. * @param[out] Value Pointer to the parameter value.
  593. *
  594. * @return Dma_Ip_ReturnType DMA_IP_STATUS_SUCCESS is returned if the get information finished ok.
  595. *
  596. * @implements Dma_Ip_GetLogicChannelParam_Activity
  597. * */
  598. Dma_Ip_ReturnType Dma_Ip_GetLogicChannelParam(const uint32 LogicCh, const Dma_Ip_LogicChannelInfoParamType Param, uint32 * const Value);
  599. /**
  600. * @brief This function configures the Dma Ip Logic Channel Scatter/Gather.
  601. * @details This service is a reentrant function that shall configure the Dma Channel
  602. * scatter/gather functionality.
  603. * The specified Logic Element (corresponding to a Software TCD) shall be loaded
  604. * into the Dma Logic Channel's Hardware TCD.
  605. * The Logic Elements (describing the Software TCDs) form a simple chained list
  606. * and the "Element" parameter represents the lists's head.
  607. *
  608. * @param[in] LogicCh Selection value of the Logic Channel.
  609. * @param[in] Element Selection value of the Logic Element representing the
  610. * list's head.
  611. *
  612. * @return Dma_Ip_ReturnType DMA_IP_STATUS_SUCCESS is returned if the initialization finished ok.
  613. * DMA_IP_STATUS_WRONG_STATE is returned if the Dma Ip Channel state is
  614. * not Dma_Ip_Ch_ReadyState.
  615. * DMA_IP_STATUS_ERROR is returned if the Dma Ip Channel contains an error.
  616. *
  617. * @implements Dma_Ip_SetLogicChannelScatterGatherConfig_Activity
  618. * */
  619. Dma_Ip_ReturnType Dma_Ip_SetLogicChannelScatterGatherConfig(const uint32 LogicCh, const uint32 Element);
  620. #define MCL_STOP_SEC_CODE
  621. /* @violates @ref DMA_IP_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. */
  622. #include "Mcl_MemMap.h"
  623. #endif /* #if (DMA_IP_IS_AVAILABLE == STD_ON) */
  624. /** @} */
  625. #endif /* #ifndef DMA_IP_DRIVER_H_ */
  626. /*==================================================================================================
  627. * END OF FILE
  628. ==================================================================================================*/