hc32f4a0_dma.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553
  1. /**
  2. *******************************************************************************
  3. * @file hc32f4a0_dma.h
  4. * @brief This file contains all the functions prototypes of the DMA driver
  5. * library.
  6. @verbatim
  7. Change Logs:
  8. Date Author Notes
  9. 2020-06-12 Zhangxl First version
  10. @endverbatim
  11. *******************************************************************************
  12. * Copyright (C) 2020, Huada Semiconductor Co., Ltd. All rights reserved.
  13. *
  14. * This software component is licensed by HDSC under BSD 3-Clause license
  15. * (the "License"); You may not use this file except in compliance with the
  16. * License. You may obtain a copy of the License at:
  17. * opensource.org/licenses/BSD-3-Clause
  18. *
  19. *******************************************************************************
  20. */
  21. #ifndef __HC32F4A0_DMA_H__
  22. #define __HC32F4A0_DMA_H__
  23. /* C binding of definitions if building with C++ compiler */
  24. #ifdef __cplusplus
  25. extern "C"
  26. {
  27. #endif
  28. /*******************************************************************************
  29. * Include files
  30. ******************************************************************************/
  31. #include "hc32_common.h"
  32. #include "ddl_config.h"
  33. /**
  34. * @addtogroup HC32F4A0_DDL_Driver
  35. * @{
  36. */
  37. /**
  38. * @addtogroup DDL_DMA
  39. * @{
  40. */
  41. #if (DDL_DMA_ENABLE == DDL_ON)
  42. /*******************************************************************************
  43. * Global type definitions ('typedef')
  44. ******************************************************************************/
  45. /**
  46. * @defgroup DMA_Global_Types DMA Global Types
  47. * @{
  48. */
  49. /**
  50. * @brief DMA basic configuration
  51. */
  52. typedef struct
  53. {
  54. uint32_t u32IntEn; /*!< Specifies the DMA interrupt function.
  55. This parameter can be a value of @ref DMA_Int_Config */
  56. uint32_t u32SrcAddr; /*!< Specifies the DMA source address. */
  57. uint32_t u32DestAddr; /*!< Specifies the DMA destination address. */
  58. uint32_t u32DataWidth; /*!< Specifies the DMA transfer data width.
  59. This parameter can be a value of @ref DMA_DataWidth_Sel */
  60. uint32_t u32BlockSize; /*!< Specifies the DMA block size. */
  61. uint32_t u32TransCnt; /*!< Specifies the DMA transfer count. */
  62. uint32_t u32SrcInc; /*!< Specifies the source address increment mode.
  63. This parameter can be a value of @ref DMA_SrcAddr_Incremented_Mode */
  64. uint32_t u32DestInc; /*!< Specifies the destination address increment mode.
  65. This parameter can be a value of @ref DMA_DesAddr_Incremented_Mode */
  66. } stc_dma_init_t;
  67. /**
  68. * @brief DMA repeat mode configuration
  69. */
  70. typedef struct
  71. {
  72. uint32_t u32SrcRptEn; /*!< Specifies the DMA source repeat function.
  73. This parameter can be a value of @ref DMA_Repeat_Config */
  74. uint32_t u32SrcRptSize; /*!< Specifies the DMA source repeat size. */
  75. uint32_t u32DestRptEn; /*!< Specifies the DMA destination repeat function.
  76. This parameter can be a value of @ref DMA_Repeat_Config */
  77. uint32_t u32DestRptSize; /*!< Specifies the DMA destination repeat size. */
  78. } stc_dma_rpt_init_t;
  79. /**
  80. * @brief DMA non-sequence mode configuration
  81. */
  82. typedef struct
  83. {
  84. uint32_t u32SrcNonSeqEn; /*!< Specifies the DMA source non-sequence function.
  85. This parameter can be a value of @ref DMA_NonSeq_Config */
  86. uint32_t u32SrcNonSeqCnt; /*!< Specifies the DMA source non-sequence function count. */
  87. uint32_t u32SrcNonSeqOfs; /*!< Specifies the DMA source non-sequence function offset. */
  88. uint32_t u32DestNonSeqEn; /*!< Specifies the DMA destination non-sequence function.
  89. This parameter can be a value of @ref DMA_NonSeq_Config */
  90. uint32_t u32DestNonSeqCnt; /*!< Specifies the DMA destination non-sequence function count. */
  91. uint32_t u32DestNonSeqOfs; /*!< Specifies the DMA destination non-sequence function offset. */
  92. } stc_dma_nonseq_init_t;
  93. /**
  94. * @brief DMA Link List Pointer (LLP) mode configuration
  95. */
  96. typedef struct
  97. {
  98. uint32_t u32LlpEn; /*!< Specifies the DMA LLP function.
  99. This parameter can be a value of @ref DMA_Llp_En */
  100. uint32_t u32LlpRun; /*!< Specifies the DMA LLP auto or wait REQ.
  101. This parameter can be a value of @ref DMA_Llp_Mode */
  102. uint32_t u32LlpAddr; /*!< Specifies the DMA list pointer address for LLP function. */
  103. } stc_dma_llp_init_t;
  104. /**
  105. * @brief DMA re-config function configuration
  106. */
  107. typedef struct
  108. {
  109. uint32_t u32CntMode; /*!< Specifies the DMA reconfig function count mode.
  110. This parameter can be a value of @ref DMA_ReConfig_Cnt_Sel */
  111. uint32_t u32DestAddrMode; /*!< Specifies the DMA reconfig function destination address mode.
  112. This parameter can be a value of @ref DMA_ReConfig_DestAddr_Sel */
  113. uint32_t u32SrcAddrMode; /*!< Specifies the DMA reconfig function source address mode.
  114. This parameter can be a value of @ref DMA_ReConfig_SrcAddr_Sel */
  115. } stc_dma_reconfig_init_t;
  116. /**
  117. * @brief Dma LLP(linked list pointer) descriptor structure definition
  118. */
  119. typedef struct
  120. {
  121. uint32_t SARx; /*!< LLP source address */
  122. uint32_t DARx; /*!< LLP destination address */
  123. uint32_t DTCTLx; /*!< LLP transfer count and block size */
  124. uint32_t RPTx; /*!< LLP source & destination repeat size */
  125. uint32_t SNSEQCTLx; /*!< LLP source non-seq count and offset */
  126. uint32_t DNSEQCTLx; /*!< LLP destination non-seq count and offset */
  127. uint32_t LLPx; /*!< LLP next list pointer */
  128. uint32_t CHCTLx; /*!< LLP channel control */
  129. } stc_dma_llp_descriptor_t;
  130. /**
  131. * @}
  132. */
  133. /*******************************************************************************
  134. * Global pre-processor symbols/macros ('#define')
  135. ******************************************************************************/
  136. /**
  137. * @defgroup DMA_Global_Macros DMA Global Macros
  138. * @{
  139. */
  140. /**
  141. * @defgroup DMA_Channel_selection DMA Channel Position selection
  142. * @{
  143. */
  144. #define DMA_CH0 (0x00U) /*!< DMA Channel 0 */
  145. #define DMA_CH1 (0x01U) /*!< DMA Channel 1 */
  146. #define DMA_CH2 (0x02U) /*!< DMA Channel 2 */
  147. #define DMA_CH3 (0x03U) /*!< DMA Channel 3 */
  148. #define DMA_CH4 (0x04U) /*!< DMA Channel 4 */
  149. #define DMA_CH5 (0x05U) /*!< DMA Channel 5 */
  150. #define DMA_CH6 (0x06U) /*!< DMA Channel 6 */
  151. #define DMA_CH7 (0x07U) /*!< DMA Channel 7 */
  152. /**
  153. * @}
  154. */
  155. /**
  156. * @defgroup DMA_Mx_Channel_selection DMA Multiplex Channel selection
  157. * @{
  158. */
  159. #define DMA_MX_CH0 (0x01UL) /*!< DMA Channel 0 position */
  160. #define DMA_MX_CH1 (0x02UL) /*!< DMA Channel 1 position */
  161. #define DMA_MX_CH2 (0x04UL) /*!< DMA Channel 2 position */
  162. #define DMA_MX_CH3 (0x08UL) /*!< DMA Channel 3 position */
  163. #define DMA_MX_CH4 (0x10UL) /*!< DMA Channel 4 position */
  164. #define DMA_MX_CH5 (0x20UL) /*!< DMA Channel 5 position */
  165. #define DMA_MX_CH6 (0x40UL) /*!< DMA Channel 6 position */
  166. #define DMA_MX_CH7 (0x80UL) /*!< DMA Channel 7 position */
  167. #define DMA_MX_CH_ALL (0xFFUL) /*!< DMA Channel mask position */
  168. /**
  169. * @}
  170. */
  171. /**
  172. * @defgroup DMA_ReqErrIrq_Sel DMA request error interrupt selection
  173. * @{
  174. */
  175. #define DMA_REQ_ERR_CH0 (DMA_INTSTAT0_REQERR_0) /*!< DMA request error interrupt CH.0 */
  176. #define DMA_REQ_ERR_CH1 (DMA_INTSTAT0_REQERR_1) /*!< DMA request error interrupt CH.1 */
  177. #define DMA_REQ_ERR_CH2 (DMA_INTSTAT0_REQERR_2) /*!< DMA request error interrupt CH.2 */
  178. #define DMA_REQ_ERR_CH3 (DMA_INTSTAT0_REQERR_3) /*!< DMA request error interrupt CH.3 */
  179. #define DMA_REQ_ERR_CH4 (DMA_INTSTAT0_REQERR_4) /*!< DMA request error interrupt CH.4 */
  180. #define DMA_REQ_ERR_CH5 (DMA_INTSTAT0_REQERR_5) /*!< DMA request error interrupt CH.5 */
  181. #define DMA_REQ_ERR_CH6 (DMA_INTSTAT0_REQERR_6) /*!< DMA request error interrupt CH.6 */
  182. #define DMA_REQ_ERR_CH7 (DMA_INTSTAT0_REQERR_7) /*!< DMA request error interrupt CH.7 */
  183. /**
  184. * @}
  185. */
  186. /**
  187. * @defgroup DMA_TransErrIrq_Sel DMA transfer error interrupt selection
  188. * @{
  189. */
  190. #define DMA_TRANS_ERR_CH0 (DMA_INTSTAT0_TRNERR_0) /*!< DMA transfer error interrupt CH.0 */
  191. #define DMA_TRANS_ERR_CH1 (DMA_INTSTAT0_TRNERR_1) /*!< DMA transfer error interrupt CH.1 */
  192. #define DMA_TRANS_ERR_CH2 (DMA_INTSTAT0_TRNERR_2) /*!< DMA transfer error interrupt CH.2 */
  193. #define DMA_TRANS_ERR_CH3 (DMA_INTSTAT0_TRNERR_3) /*!< DMA transfer error interrupt CH.3 */
  194. #define DMA_TRANS_ERR_CH4 (DMA_INTSTAT0_TRNERR_4) /*!< DMA transfer error interrupt CH.4 */
  195. #define DMA_TRANS_ERR_CH5 (DMA_INTSTAT0_TRNERR_5) /*!< DMA transfer error interrupt CH.5 */
  196. #define DMA_TRANS_ERR_CH6 (DMA_INTSTAT0_TRNERR_6) /*!< DMA transfer error interrupt CH.6 */
  197. #define DMA_TRANS_ERR_CH7 (DMA_INTSTAT0_TRNERR_7) /*!< DMA transfer error interrupt CH.7 */
  198. /**
  199. * @}
  200. */
  201. /**
  202. * @defgroup DMA_BtcIrq_Sel DMA block transfer completed interrupt selection
  203. * @{
  204. */
  205. #define DMA_BTC_INT_CH0 (DMA_INTSTAT1_BTC_0) /*!< DMA block transfer completed interrupt CH.0 */
  206. #define DMA_BTC_INT_CH1 (DMA_INTSTAT1_BTC_1) /*!< DMA block transfer completed interrupt CH.1 */
  207. #define DMA_BTC_INT_CH2 (DMA_INTSTAT1_BTC_2) /*!< DMA block transfer completed interrupt CH.2 */
  208. #define DMA_BTC_INT_CH3 (DMA_INTSTAT1_BTC_3) /*!< DMA block transfer completed interrupt CH.3 */
  209. #define DMA_BTC_INT_CH4 (DMA_INTSTAT1_BTC_4) /*!< DMA block transfer completed interrupt CH.4 */
  210. #define DMA_BTC_INT_CH5 (DMA_INTSTAT1_BTC_5) /*!< DMA block transfer completed interrupt CH.5 */
  211. #define DMA_BTC_INT_CH6 (DMA_INTSTAT1_BTC_6) /*!< DMA block transfer completed interrupt CH.6 */
  212. #define DMA_BTC_INT_CH7 (DMA_INTSTAT1_BTC_7) /*!< DMA block transfer completed interrupt CH.7 */
  213. /**
  214. * @}
  215. */
  216. /**
  217. * @defgroup DMA_TcIrq_Sel DMA transfer completed interrupt selection
  218. * @{
  219. */
  220. #define DMA_TC_INT_CH0 (DMA_INTSTAT1_TC_0) /*!< DMA transfer completed interrupt CH.0 */
  221. #define DMA_TC_INT_CH1 (DMA_INTSTAT1_TC_1) /*!< DMA transfer completed interrupt CH.1 */
  222. #define DMA_TC_INT_CH2 (DMA_INTSTAT1_TC_2) /*!< DMA transfer completed interrupt CH.2 */
  223. #define DMA_TC_INT_CH3 (DMA_INTSTAT1_TC_3) /*!< DMA transfer completed interrupt CH.3 */
  224. #define DMA_TC_INT_CH4 (DMA_INTSTAT1_TC_4) /*!< DMA transfer completed interrupt CH.4 */
  225. #define DMA_TC_INT_CH5 (DMA_INTSTAT1_TC_5) /*!< DMA transfer completed interrupt CH.5 */
  226. #define DMA_TC_INT_CH6 (DMA_INTSTAT1_TC_6) /*!< DMA transfer completed interrupt CH.6 */
  227. #define DMA_TC_INT_CH7 (DMA_INTSTAT1_TC_7) /*!< DMA transfer completed interrupt CH.7 */
  228. /**
  229. * @}
  230. */
  231. /**
  232. * @defgroup DMA_IntMsk_Sel DMA interrupt mask selection
  233. * @{
  234. */
  235. #define DMA_ERR_INT_MASK (0x00FF00FFUL) /*!< DMA error interrupt mask */
  236. #define DMA_TRANS_INT_MASK (0x00FF00FFUL) /*!< DMA transfer interrupt mask */
  237. /**
  238. * @}
  239. */
  240. /**
  241. * @defgroup DMA_Req_Status_Sel DMA request status
  242. * @{
  243. */
  244. #define DMA_REQ_CH0 (DMA_REQSTAT_CHREQ_0) /*!< DMA request from CH.0 */
  245. #define DMA_REQ_CH1 (DMA_REQSTAT_CHREQ_1) /*!< DMA request from CH.1 */
  246. #define DMA_REQ_CH2 (DMA_REQSTAT_CHREQ_2) /*!< DMA request from CH.2 */
  247. #define DMA_REQ_CH3 (DMA_REQSTAT_CHREQ_3) /*!< DMA request from CH.3 */
  248. #define DMA_REQ_CH4 (DMA_REQSTAT_CHREQ_4) /*!< DMA request from CH.4 */
  249. #define DMA_REQ_CH5 (DMA_REQSTAT_CHREQ_5) /*!< DMA request from CH.5 */
  250. #define DMA_REQ_CH6 (DMA_REQSTAT_CHREQ_6) /*!< DMA request from CH.6 */
  251. #define DMA_REQ_CH7 (DMA_REQSTAT_CHREQ_7) /*!< DMA request from CH.7 */
  252. #define DMA_REQ_RECONFIG (DMA_REQSTAT_RCFGREQ) /*!< DMA request from reconfig */
  253. #define DMA_REQ_STAT_MASK (0x000080FFUL) /*!< DMA request mask */
  254. /**
  255. * @}
  256. */
  257. /**
  258. * @defgroup DMA_Trans_Status_Sel DMA transfer status
  259. * @{
  260. */
  261. #define DMA_TRANS_CH0 (DMA_CHSTAT_CHACT_0) /*!< DMA transfer status of CH.0 */
  262. #define DMA_TRANS_CH1 (DMA_CHSTAT_CHACT_1) /*!< DMA transfer status of CH.1 */
  263. #define DMA_TRANS_CH2 (DMA_CHSTAT_CHACT_2) /*!< DMA transfer status of CH.2 */
  264. #define DMA_TRANS_CH3 (DMA_CHSTAT_CHACT_3) /*!< DMA transfer status of CH.3 */
  265. #define DMA_TRANS_CH4 (DMA_CHSTAT_CHACT_4) /*!< DMA transfer status of CH.4 */
  266. #define DMA_TRANS_CH5 (DMA_CHSTAT_CHACT_5) /*!< DMA transfer status of CH.5 */
  267. #define DMA_TRANS_CH6 (DMA_CHSTAT_CHACT_6) /*!< DMA transfer status of CH.6 */
  268. #define DMA_TRANS_CH7 (DMA_CHSTAT_CHACT_7) /*!< DMA transfer status of CH.7 */
  269. #define DMA_TRANS_RECONFIG (DMA_CHSTAT_RCFGACT) /*!< DMA reconfig status */
  270. #define DMA_TRANS_DMA (DMA_CHSTAT_DMAACT) /*!< DMA transfer status of the DMA */
  271. #define DMA_TRANS_STAT_MASK (0x0000FF03UL) /*!< DMA request mask */
  272. /**
  273. * @}
  274. */
  275. /**
  276. * @defgroup DMA_DataWidth_Sel DMA transfer data width
  277. * @{
  278. */
  279. #define DMA_DATAWIDTH_8BIT (0x00000000UL) /*!< DMA transfer data width 8bit */
  280. #define DMA_DATAWIDTH_16BIT (DMA_CHCTL_HSIZE_0) /*!< DMA transfer data width 16bit */
  281. #define DMA_DATAWIDTH_32BIT (DMA_CHCTL_HSIZE_1) /*!< DMA transfer data width 32bit */
  282. /**
  283. * @}
  284. */
  285. /**
  286. * @defgroup DMA_Llp_En DMA LLP(linked list pinter) enable or disable
  287. * @{
  288. */
  289. #define DMA_LLP_ENABLE (DMA_CHCTL_LLPEN) /*!< DMA LLP(linked list pinter) enable */
  290. #define DMA_LLP_DISABLE (0x00000000UL) /*!< DMA LLP(linked list pinter) disable */
  291. /**
  292. * @}
  293. */
  294. /**
  295. * @defgroup DMA_Llp_Mode DMA linked list pinter mode while transferring complete
  296. * @{
  297. */
  298. #define DMA_LLP_RUN (DMA_CHCTL_LLPRUN) /*!< DMA Llp run right now while transfering complete */
  299. #define DMA_LLP_WAIT (0x00000000UL) /*!< DMA Llp wait next request while transfering complete */
  300. /**
  301. * @}
  302. */
  303. /**
  304. * @defgroup DMA_SrcAddr_Incremented_Mode DMA source address increment mode
  305. * @{
  306. */
  307. #define DMA_SRC_ADDR_FIX (0x00000000UL) /*!< DMA source address fix */
  308. #define DMA_SRC_ADDR_INC (DMA_CHCTL_SINC_0) /*!< DMA source address increment */
  309. #define DMA_SRC_ADDR_DEC (DMA_CHCTL_SINC_1) /*!< DMA source address decrement */
  310. /**
  311. * @}
  312. */
  313. /**
  314. * @defgroup DMA_DesAddr_Incremented_Mode DMA destination address increment mode
  315. * @{
  316. */
  317. #define DMA_DEST_ADDR_FIX (0x00000000UL) /*!< DMA destination address fix */
  318. #define DMA_DEST_ADDR_INC (DMA_CHCTL_DINC_0) /*!< DMA destination address increment */
  319. #define DMA_DEST_ADDR_DEC (DMA_CHCTL_DINC_1) /*!< DMA destination address decrement */
  320. /**
  321. * @}
  322. */
  323. /**
  324. * @defgroup DMA_Int_Config DMA interrupt function config
  325. * @{
  326. */
  327. #define DMA_INT_ENABLE (DMA_CHCTL_IE) /*!< DMA interrupt enable */
  328. #define DMA_INT_DISABLE (0x00000000UL) /*!< DMA interrupt disable */
  329. /**
  330. * @}
  331. */
  332. /**
  333. * @defgroup DMA_Repeat_Config DMA repeat mode function config
  334. * @{
  335. */
  336. #define DMA_SRC_RPT_ENABLE (DMA_CHCTL_SRTPEN) /*!< DMA source repeat enable */
  337. #define DMA_SRC_RPT_DISABLE (0x00000000UL) /*!< DMA source repeat disable */
  338. #define DMA_DEST_RPT_ENABLE (DMA_CHCTL_DRPTEN) /*!< DMA destination repeat enable */
  339. #define DMA_DEST_RPT_DISABLE (0x00000000UL) /*!< DMA destination repeat disable */
  340. /**
  341. * @}
  342. */
  343. /**
  344. * @defgroup DMA_NonSeq_Config DMA non-sequence mode function config
  345. * @{
  346. */
  347. #define DMA_SRC_NS_ENABLE (DMA_CHCTL_SNSEQEN) /*!< DMA source non-sequence enable */
  348. #define DMA_SRC_NS_DISABLE (0x00000000UL) /*!< DMA source non-sequence disable */
  349. #define DMA_DEST_NS_ENABLE (DMA_CHCTL_DNSEQEN) /*!< DMA destination non-sequence enable */
  350. #define DMA_DEST_NS_DISABLE (0x00000000UL) /*!< DMA destination non-sequence disable */
  351. /**
  352. * @}
  353. */
  354. /**
  355. * @defgroup DMA_ReConfig_Cnt_Sel DMA reconfig count mode selection
  356. * @{
  357. */
  358. #define DMA_RC_CNT_FIX (0x00UL) /*!< Keep the original counting method */
  359. #define DMA_RC_CNT_SRC (DMA_RCFGCTL_CNTMD_0) /*!< Use source address counting method */
  360. #define DMA_RC_CNT_DEST (DMA_RCFGCTL_CNTMD_1) /*!< Use destination address counting method */
  361. /**
  362. * @}
  363. */
  364. /**
  365. * @defgroup DMA_ReConfig_DestAddr_Sel DMA reconfig destination address mode selection
  366. * @{
  367. */
  368. #define DMA_RC_DA_FIX (0x00000000UL) /*!< Destination address fixed */
  369. #define DMA_RC_DA_NS (DMA_RCFGCTL_DARMD_0) /*!< Destination address non-sequence */
  370. #define DMA_RC_DA_RPT (DMA_RCFGCTL_DARMD_1) /*!< Destination address repeat */
  371. /**
  372. * @}
  373. */
  374. /**
  375. * @defgroup DMA_ReConfig_SrcAddr_Sel DMA reconfig source address mode selection
  376. * @{
  377. */
  378. #define DMA_RC_SA_FIX (0x00000000UL) /*!< Source address fixed */
  379. #define DMA_RC_SA_NS (DMA_RCFGCTL_SARMD_0) /*!< Source address non-sequence */
  380. #define DMA_RC_SA_RPT (DMA_RCFGCTL_SARMD_1) /*!< Source address repeat */
  381. /**
  382. * @}
  383. */
  384. /**
  385. * @defgroup DMA_Common_Trigger_Source_Config DMA common Trigger Source Config
  386. * @{
  387. */
  388. #define DMA_COM_TRIG1 (AOS_DMA_1_TRGSEL_COMTRG_EN_0)
  389. #define DMA_COM_TRIG2 (AOS_DMA_1_TRGSEL_COMTRG_EN_1)
  390. #define DMA_COM_TRIG_MASK (AOS_DMA_1_TRGSEL_COMTRG_EN)
  391. /**
  392. * @}
  393. */
  394. /**
  395. * @}
  396. */
  397. /*******************************************************************************
  398. * Global variable definitions ('extern')
  399. ******************************************************************************/
  400. /*******************************************************************************
  401. Global function prototypes (definition in C source)
  402. ******************************************************************************/
  403. /**
  404. * @addtogroup DMA_Global_Functions
  405. * @{
  406. */
  407. void DMA_Cmd(M4_DMA_TypeDef *DMAx, en_functional_state_t enNewState);
  408. void DMA_ErrIntCmd(M4_DMA_TypeDef *DMAx, uint32_t u32ErrInt, en_functional_state_t enNewState);
  409. en_flag_status_t DMA_GetErrIntStatus(const M4_DMA_TypeDef *DMAx, uint32_t u32ErrInt);
  410. void DMA_ClearErrIntStatus(M4_DMA_TypeDef *DMAx, uint32_t u32ErrInt);
  411. void DMA_TransIntCmd(M4_DMA_TypeDef *DMAx, uint32_t u32TransInt, en_functional_state_t enNewState);
  412. en_flag_status_t DMA_GetTransIntStatus(const M4_DMA_TypeDef *DMAx, uint32_t u32TransInt);
  413. void DMA_ClearTransIntStatus(M4_DMA_TypeDef *DMAx, uint32_t u32TransInt);
  414. void DMA_MxChannelCmd(M4_DMA_TypeDef *DMAx, uint8_t u8MxCh, en_functional_state_t enNewState);
  415. void DMA_ChannelCmd(M4_DMA_TypeDef *DMAx, uint8_t u8Ch, en_functional_state_t enNewState);
  416. void DMA_SetReConfigTriggerSrc(en_event_src_t enSrc);
  417. void DMA_RCComTriggerCmd(uint32_t u32ComTrig, en_functional_state_t enNewState);
  418. void DMA_SetTriggerSrc(const M4_DMA_TypeDef *DMAx, uint8_t u8Ch, en_event_src_t enSrc);
  419. void DMA_ComTriggerCmd(const M4_DMA_TypeDef *DMAx, uint8_t u8Ch, uint32_t u32ComTrig, en_functional_state_t enNewState);
  420. en_flag_status_t DMA_GetReqStatus(const M4_DMA_TypeDef *DMAx, uint32_t u32Status);
  421. en_flag_status_t DMA_GetTransStatus(const M4_DMA_TypeDef *DMAx, uint32_t u32Status);
  422. void DMA_SetSrcAddr(M4_DMA_TypeDef *DMAx, uint8_t u8Ch, uint32_t u32Addr);
  423. void DMA_SetDestAddr(M4_DMA_TypeDef *DMAx, uint8_t u8Ch, uint32_t u32Addr);
  424. void DMA_SetTransCnt(M4_DMA_TypeDef *DMAx, uint8_t u8Ch, uint16_t u16Cnt);
  425. void DMA_SetBlockSize(M4_DMA_TypeDef *DMAx, uint8_t u8Ch, uint16_t u16Size);
  426. void DMA_SetSrcRptSize(M4_DMA_TypeDef *DMAx, uint8_t u8Ch, uint16_t u16Size);
  427. void DMA_SetDestRptSize(M4_DMA_TypeDef *DMAx, uint8_t u8Ch, uint16_t u16Size);
  428. void DMA_SetNonSeqSrcCnt(M4_DMA_TypeDef *DMAx, uint8_t u8Ch, uint32_t u32Cnt);
  429. void DMA_SetNonSeqDestCnt(M4_DMA_TypeDef *DMAx, uint8_t u8Ch, uint32_t u32Cnt);
  430. void DMA_SetNonSeqSrcOffset(M4_DMA_TypeDef *DMAx, uint8_t u8Ch, uint32_t u32Ofs);
  431. void DMA_SetNonSeqDestOffset(M4_DMA_TypeDef *DMAx, uint8_t u8Ch, uint32_t u32Ofs);
  432. void DMA_SetLlpAddr(M4_DMA_TypeDef *DMAx, uint8_t u8Ch, uint32_t u32LlpAddr);
  433. en_result_t DMA_Init(M4_DMA_TypeDef *DMAx, uint8_t u8Ch, const stc_dma_init_t *pstcDmaInit);
  434. en_result_t DMA_RepeatInit(M4_DMA_TypeDef *DMAx, uint8_t u8Ch, const stc_dma_rpt_init_t *pstcDmaRptInit);
  435. en_result_t DMA_NonSeqInit(M4_DMA_TypeDef *DMAx, uint8_t u8Ch, const stc_dma_nonseq_init_t *pstcDmaNonSeqInit);
  436. en_result_t DMA_LlpInit(M4_DMA_TypeDef *DMAx, uint8_t u8Ch, const stc_dma_llp_init_t *pstcDmaLlpInit);
  437. en_result_t DMA_ReConfigInit(M4_DMA_TypeDef *DMAx, uint8_t u8Ch, const stc_dma_reconfig_init_t *pstcDmaRCInit);
  438. en_result_t DMA_StructInit(stc_dma_init_t *pstcDmaInit);
  439. en_result_t DMA_RepeatStructInit(stc_dma_rpt_init_t *pstcDmaRptInit);
  440. en_result_t DMA_NonSeqStructInit(stc_dma_nonseq_init_t *pstcDmaNonSeqInit);
  441. en_result_t DMA_LlpStructInit(stc_dma_llp_init_t *pstcDmaLlpInit);
  442. en_result_t DMA_ReConfigStructInit(stc_dma_reconfig_init_t *pstcDmaRCInit);
  443. void DMA_LlpCmd(M4_DMA_TypeDef *DMAx, uint8_t u8Ch, en_functional_state_t enNewState);
  444. void DMA_ReConfigCmd(M4_DMA_TypeDef *DMAx, en_functional_state_t enNewState);
  445. void DMA_ReConfigLlpCmd(M4_DMA_TypeDef *DMAx, uint8_t u8Ch, en_functional_state_t enNewState);
  446. uint32_t DMA_GetSrcAddr(const M4_DMA_TypeDef *DMAx, uint8_t u8Ch);
  447. uint32_t DMA_GetDestAddr(const M4_DMA_TypeDef *DMAx, uint8_t u8Ch);
  448. uint32_t DMA_GetTransCnt(const M4_DMA_TypeDef *DMAx, uint8_t u8Ch);
  449. uint32_t DMA_GetBlockSize(const M4_DMA_TypeDef *DMAx, uint8_t u8Ch);
  450. uint32_t DMA_GetSrcRptSize(const M4_DMA_TypeDef *DMAx, uint8_t u8Ch);
  451. uint32_t DMA_GetDestRptSize(const M4_DMA_TypeDef *DMAx, uint8_t u8Ch);
  452. uint32_t DMA_GetNonSeqSrcCnt(const M4_DMA_TypeDef *DMAx, uint8_t u8Ch);
  453. uint32_t DMA_GetNonSeqDestCnt(const M4_DMA_TypeDef *DMAx, uint8_t u8Ch);
  454. uint32_t DMA_GetNonSeqSrcOffset(const M4_DMA_TypeDef *DMAx, uint8_t u8Ch);
  455. uint32_t DMA_GetNonSeqDestOffset(const M4_DMA_TypeDef *DMAx, uint8_t u8Ch);
  456. /**
  457. * @}
  458. */
  459. #endif /* DDL_DMA_ENABLE */
  460. /**
  461. * @}
  462. */
  463. /**
  464. * @}
  465. */
  466. #ifdef __cplusplus
  467. }
  468. #endif
  469. #endif /* __HC32F4A0_DMA_H__ */
  470. /*******************************************************************************
  471. * EOF (not truncated)
  472. ******************************************************************************/