stm32h5xx_hal_dma.h 58 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179
  1. /**
  2. **********************************************************************************************************************
  3. * @file stm32h5xx_hal_dma.h
  4. * @author MCD Application Team
  5. * @brief Header file of DMA HAL module.
  6. **********************************************************************************************************************
  7. * @attention
  8. *
  9. * Copyright (c) 2023 STMicroelectronics.
  10. * All rights reserved.
  11. *
  12. * This software is licensed under terms that can be found in the LICENSE file
  13. * in the root directory of this software component.
  14. * If no LICENSE file comes with this software, it is provided AS-IS.
  15. *
  16. **********************************************************************************************************************
  17. */
  18. /* Define to prevent recursive inclusion -----------------------------------------------------------------------------*/
  19. #ifndef STM32H5xx_HAL_DMA_H
  20. #define STM32H5xx_HAL_DMA_H
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. /* Includes ----------------------------------------------------------------------------------------------------------*/
  25. #include "stm32h5xx_hal_def.h"
  26. /** @addtogroup STM32H5xx_HAL_Driver
  27. * @{
  28. */
  29. /** @addtogroup DMA
  30. * @{
  31. */
  32. /* Exported types ----------------------------------------------------------------------------------------------------*/
  33. /** @defgroup DMA_Exported_Types DMA Exported Types
  34. * @brief DMA Exported Types
  35. * @{
  36. */
  37. /**
  38. * @brief DMA Transfer Configuration Structure definition.
  39. */
  40. typedef struct
  41. {
  42. uint32_t Request; /*!< Specifies the DMA channel request.
  43. This parameter can be a value of @ref DMA_Request_Selection */
  44. uint32_t BlkHWRequest; /*!< Specifies the Block hardware request mode for DMA channel.
  45. Block Hardware request feature can be used only with dedicated peripherals.
  46. This parameter can be a value of @ref DMA_Block_Request */
  47. uint32_t Direction; /*!< Specifies the transfer direction for DMA channel.
  48. This parameter can be a value of @ref DMA_Transfer_Direction */
  49. uint32_t SrcInc; /*!< Specifies the source increment mode for the DMA channel.
  50. This parameter can be a value of @ref DMA_Source_Increment_Mode */
  51. uint32_t DestInc; /*!< Specifies the destination increment mode for the DMA channel.
  52. This parameter can be a value of @ref DMA_Destination_Increment_Mode */
  53. uint32_t SrcDataWidth; /*!< Specifies the source data width for the DMA channel.
  54. This parameter can be a value of @ref DMA_Source_Data_Width */
  55. uint32_t DestDataWidth; /*!< Specifies the destination data width for the DMA channel.
  56. This parameter can be a value of @ref DMA_Destination_Data_Width */
  57. uint32_t Priority; /*!< Specifies the priority level for the DMA channel.
  58. This parameter can be a value of @ref DMA_Priority_Level */
  59. uint32_t SrcBurstLength; /*!< Specifies the source burst length (number of beats within a burst) for the DMA
  60. channel.
  61. This parameter can be a value between 1 and 64 */
  62. uint32_t DestBurstLength; /*!< Specifies the destination burst length (number of beats within a burst) for the
  63. DMA channel.
  64. This parameter can be a value between 1 and 64 */
  65. uint32_t TransferAllocatedPort; /*!< Specifies the transfer allocated ports.
  66. This parameter can be a combination of @ref DMA_Transfer_Allocated_Port */
  67. uint32_t TransferEventMode; /*!< Specifies the transfer event mode for the DMA channel.
  68. This parameter can be a value of @ref DMA_Transfer_Event_Mode */
  69. uint32_t Mode; /*!< Specifies the transfer mode for the DMA channel.
  70. This parameter can be a value of @ref DMA_Transfer_Mode */
  71. } DMA_InitTypeDef;
  72. /**
  73. * @brief DMA Linked-List Configuration Structure Definition.
  74. */
  75. typedef struct
  76. {
  77. uint32_t Priority; /*!< Specifies the priority level for the DMA channel.
  78. This parameter can be a value of @ref DMA_Priority_Level */
  79. uint32_t LinkStepMode; /*!< Specifies the link step mode for the DMA channel.
  80. This parameter can be a value of @ref DMAEx_Link_Step_Mode */
  81. uint32_t LinkAllocatedPort; /*!< Specifies the linked-list allocated port for the DMA channel.
  82. This parameter can be a value of @ref DMAEx_Link_Allocated_Port */
  83. uint32_t TransferEventMode; /*!< Specifies the transfer event mode for the DMA channel.
  84. This parameter can be a value of @ref DMA_Transfer_Event_Mode */
  85. uint32_t LinkedListMode; /*!< Specifies linked-list transfer mode for the DMA channel.
  86. This parameter can be a value of @ref DMAEx_LinkedList_Mode */
  87. } DMA_InitLinkedListTypeDef;
  88. /**
  89. * @brief HAL DMA State Enumeration Definition.
  90. */
  91. typedef enum
  92. {
  93. HAL_DMA_STATE_RESET = 0x00U, /*!< DMA not yet initialized or disabled */
  94. HAL_DMA_STATE_READY = 0x01U, /*!< DMA initialized and ready for use */
  95. HAL_DMA_STATE_BUSY = 0x02U, /*!< DMA process is ongoing */
  96. HAL_DMA_STATE_ERROR = 0x03U, /*!< DMA error state */
  97. HAL_DMA_STATE_ABORT = 0x04U, /*!< DMA Abort state */
  98. HAL_DMA_STATE_SUSPEND = 0x05U, /*!< DMA Suspend state */
  99. } HAL_DMA_StateTypeDef;
  100. /**
  101. * @brief HAL DMA Level Complete Enumeration Definition.
  102. */
  103. typedef enum
  104. {
  105. HAL_DMA_FULL_TRANSFER = 0x00U, /*!< Full channel transfer */
  106. HAL_DMA_HALF_TRANSFER = 0x01U, /*!< Half channel transfer */
  107. } HAL_DMA_LevelCompleteTypeDef;
  108. /**
  109. * @brief HAL DMA Callbacks IDs Enumeration Definition.
  110. */
  111. typedef enum
  112. {
  113. HAL_DMA_XFER_CPLT_CB_ID = 0x00U, /*!< Complete transfer callback ID */
  114. HAL_DMA_XFER_HALFCPLT_CB_ID = 0x01U, /*!< Half complete transfer callback ID */
  115. HAL_DMA_XFER_ERROR_CB_ID = 0x02U, /*!< Error transfer callback ID */
  116. HAL_DMA_XFER_ABORT_CB_ID = 0x03U, /*!< Abort transfer callback ID */
  117. HAL_DMA_XFER_SUSPEND_CB_ID = 0x04U, /*!< Suspend transfer callback ID */
  118. HAL_DMA_XFER_ALL_CB_ID = 0x05U /*!< All callback ID */
  119. } HAL_DMA_CallbackIDTypeDef;
  120. /**
  121. * @brief DMA handle Structure definition
  122. */
  123. typedef struct __DMA_HandleTypeDef
  124. {
  125. DMA_Channel_TypeDef *Instance; /*!< Register the DMA channel base address */
  126. DMA_InitTypeDef Init; /*!< DMA channel init parameters */
  127. DMA_InitLinkedListTypeDef InitLinkedList; /*!< DMA channel linked-list init parameters */
  128. HAL_LockTypeDef Lock; /*!< DMA locking object */
  129. uint32_t Mode; /*!< DMA transfer mode */
  130. __IO HAL_DMA_StateTypeDef State; /*!< DMA transfer state */
  131. __IO uint32_t ErrorCode; /*!< DMA error code */
  132. void *Parent; /*!< Parent object state */
  133. void (* XferCpltCallback)(struct __DMA_HandleTypeDef *hdma); /*!< DMA transfer complete callback */
  134. void (* XferHalfCpltCallback)(struct __DMA_HandleTypeDef *hdma); /*!< DMA half transfer complete callback */
  135. void (* XferErrorCallback)(struct __DMA_HandleTypeDef *hdma); /*!< DMA transfer error callback */
  136. void (* XferAbortCallback)(struct __DMA_HandleTypeDef *hdma); /*!< DMA transfer Abort callback */
  137. void (* XferSuspendCallback)(struct __DMA_HandleTypeDef *hdma); /*!< DMA transfer Suspend callback */
  138. struct __DMA_QListTypeDef *LinkedListQueue; /*!< DMA linked-list queue */
  139. } DMA_HandleTypeDef;
  140. /**
  141. * @}
  142. */
  143. /* Exported constants ------------------------------------------------------------------------------------------------*/
  144. /** @defgroup DMA_Exported_Constants DMA Exported Constants
  145. * @brief DMA Exported constants
  146. * @{
  147. */
  148. /** @defgroup DMA_Error_Codes DMA Error Codes
  149. * @brief DMA Error Codes
  150. * @{
  151. */
  152. #define HAL_DMA_ERROR_NONE (0x0000U) /*!< No error */
  153. #define HAL_DMA_ERROR_DTE (0x0001U) /*!< Data transfer error */
  154. #define HAL_DMA_ERROR_ULE (0x0002U) /*!< Update linked-list item error */
  155. #define HAL_DMA_ERROR_USE (0x0004U) /*!< User setting error */
  156. #define HAL_DMA_ERROR_TO (0x0008U) /*!< Trigger overrun error */
  157. #define HAL_DMA_ERROR_TIMEOUT (0x0010U) /*!< Timeout error */
  158. #define HAL_DMA_ERROR_NO_XFER (0x0020U) /*!< No transfer ongoing error */
  159. #define HAL_DMA_ERROR_BUSY (0x0040U) /*!< Busy error */
  160. #define HAL_DMA_ERROR_INVALID_CALLBACK (0x0080U) /*!< Invalid callback error */
  161. #define HAL_DMA_ERROR_NOT_SUPPORTED (0x0100U) /*!< Not supported mode */
  162. /**
  163. * @}
  164. */
  165. /** @defgroup DMA_Interrupt_Enable_Definition DMA Interrupt Enable Definition
  166. * @brief DMA Interrupt Enable Definition
  167. * @{
  168. */
  169. #define DMA_IT_TC DMA_CCR_TCIE /*!< Transfer complete interrupt */
  170. #define DMA_IT_HT DMA_CCR_HTIE /*!< Half transfer complete interrupt */
  171. #define DMA_IT_DTE DMA_CCR_DTEIE /*!< Data transfer error interrupt */
  172. #define DMA_IT_ULE DMA_CCR_ULEIE /*!< Update linked-list item error interrupt */
  173. #define DMA_IT_USE DMA_CCR_USEIE /*!< User eetting error interrupt */
  174. #define DMA_IT_SUSP DMA_CCR_SUSPIE /*!< Completed suspension interrupt */
  175. #define DMA_IT_TO DMA_CCR_TOIE /*!< Trigger overrun interrupt */
  176. /**
  177. * @}
  178. */
  179. /** @defgroup DMA_Flag_Definition DMA Flag Definition
  180. * @brief DMA Flag Definition
  181. * @{
  182. */
  183. #define DMA_FLAG_IDLE DMA_CSR_IDLEF /*!< Idle flag */
  184. #define DMA_FLAG_TC DMA_CSR_TCF /*!< Transfer complete flag */
  185. #define DMA_FLAG_HT DMA_CSR_HTF /*!< Half transfer complete flag */
  186. #define DMA_FLAG_DTE DMA_CSR_DTEF /*!< Data transfer error flag */
  187. #define DMA_FLAG_ULE DMA_CSR_ULEF /*!< Update linked-list item error flag */
  188. #define DMA_FLAG_USE DMA_CSR_USEF /*!< User setting error flag */
  189. #define DMA_FLAG_SUSP DMA_CSR_SUSPF /*!< Completed suspension flag */
  190. #define DMA_FLAG_TO DMA_CSR_TOF /*!< Trigger overrun flag */
  191. /**
  192. * @}
  193. */
  194. /** @defgroup DMA_Request_Selection DMA Request Selection
  195. * @brief DMA Request Selection
  196. * @{
  197. */
  198. /* GPDMA1 requests */
  199. #define GPDMA1_REQUEST_ADC1 0U /*!< GPDMA1 HW request is ADC1 */
  200. #if defined (ADC2)
  201. #define GPDMA1_REQUEST_ADC2 1U /*!< GPDMA1 HW request is ADC2 */
  202. #endif /* ADC2 */
  203. #define GPDMA1_REQUEST_DAC1_CH1 2U /*!< GPDMA1 HW request is DAC1_CH1 */
  204. #define GPDMA1_REQUEST_DAC1_CH2 3U /*!< GPDMA1 HW request is DAC1_CH2 */
  205. #define GPDMA1_REQUEST_TIM6_UP 4U /*!< GPDMA1 HW request is TIM6_UP */
  206. #define GPDMA1_REQUEST_TIM7_UP 5U /*!< GPDMA1 HW request is TIM7_UP */
  207. #define GPDMA1_REQUEST_SPI1_RX 6U /*!< GPDMA1 HW request is SPI1_RX */
  208. #define GPDMA1_REQUEST_SPI1_TX 7U /*!< GPDMA1 HW request is SPI1_TX */
  209. #define GPDMA1_REQUEST_SPI2_RX 8U /*!< GPDMA1 HW request is SPI2_RX */
  210. #define GPDMA1_REQUEST_SPI2_TX 9U /*!< GPDMA1 HW request is SPI2_TX */
  211. #define GPDMA1_REQUEST_SPI3_RX 10U /*!< GPDMA1 HW request is SPI3_RX */
  212. #define GPDMA1_REQUEST_SPI3_TX 11U /*!< GPDMA1 HW request is SPI3_TX */
  213. #define GPDMA1_REQUEST_I2C1_RX 12U /*!< GPDMA1 HW request is I2C1_RX */
  214. #define GPDMA1_REQUEST_I2C1_TX 13U /*!< GPDMA1 HW request is I2C1_TX */
  215. #define GPDMA1_REQUEST_I2C2_RX 15U /*!< GPDMA1 HW request is I2C2_RX */
  216. #define GPDMA1_REQUEST_I2C2_TX 16U /*!< GPDMA1 HW request is I2C2_TX */
  217. #if defined (I2C3)
  218. #define GPDMA1_REQUEST_I2C3_RX 18U /*!< GPDMA1 HW request is I2C3_RX */
  219. #define GPDMA1_REQUEST_I2C3_TX 19U /*!< GPDMA1 HW request is I2C3_TX */
  220. #endif /* I2C3 */
  221. #define GPDMA1_REQUEST_USART1_RX 21U /*!< GPDMA1 HW request is USART1_RX */
  222. #define GPDMA1_REQUEST_USART1_TX 22U /*!< GPDMA1 HW request is USART1_TX */
  223. #define GPDMA1_REQUEST_USART2_RX 23U /*!< GPDMA1 HW request is USART2_RX */
  224. #define GPDMA1_REQUEST_USART2_TX 24U /*!< GPDMA1 HW request is USART2_TX */
  225. #define GPDMA1_REQUEST_USART3_RX 25U /*!< GPDMA1 HW request is USART3_RX */
  226. #define GPDMA1_REQUEST_USART3_TX 26U /*!< GPDMA1 HW request is USART3_TX */
  227. #if defined (UART4)
  228. #define GPDMA1_REQUEST_UART4_RX 27U /*!< GPDMA1 HW request is UART4_RX */
  229. #define GPDMA1_REQUEST_UART4_TX 28U /*!< GPDMA1 HW request is UART4_TX */
  230. #endif /* UART4 */
  231. #if defined (UART4)
  232. #define GPDMA1_REQUEST_UART5_RX 29U /*!< GPDMA1 HW request is UART5_RX */
  233. #define GPDMA1_REQUEST_UART5_TX 30U /*!< GPDMA1 HW request is UART5_TX */
  234. #endif /* UART5 */
  235. #if defined (UART4)
  236. #define GPDMA1_REQUEST_USART6_RX 31U /*!< GPDMA1 HW request is USART6_RX */
  237. #define GPDMA1_REQUEST_USART6_TX 32U /*!< GPDMA1 HW request is USART6_TX */
  238. #endif /* USART6 */
  239. #if defined (UART7)
  240. #define GPDMA1_REQUEST_UART7_RX 33U /*!< GPDMA1 HW request is UART7_RX */
  241. #define GPDMA1_REQUEST_UART7_TX 34U /*!< GPDMA1 HW request is UART7_TX */
  242. #endif /* UART7 */
  243. #if defined (UART8)
  244. #define GPDMA1_REQUEST_UART8_RX 35U /*!< GPDMA1 HW request is UART8_RX */
  245. #define GPDMA1_REQUEST_UART8_TX 36U /*!< GPDMA1 HW request is UART8_TX */
  246. #endif /* UART8 */
  247. #if defined (UART9)
  248. #define GPDMA1_REQUEST_UART9_RX 37U /*!< GPDMA1 HW request is UART9_RX */
  249. #define GPDMA1_REQUEST_UART9_TX 38U /*!< GPDMA1 HW request is UART9_TX */
  250. #endif /* UART9 */
  251. #if defined (USART10)
  252. #define GPDMA1_REQUEST_USART10_RX 39U /*!< GPDMA1 HW request is USART10_RX */
  253. #define GPDMA1_REQUEST_USART10_TX 40U /*!< GPDMA1 HW request is USART10_TX */
  254. #endif /* USART10 */
  255. #if defined (USART11)
  256. #define GPDMA1_REQUEST_USART11_RX 41U /*!< GPDMA1 HW request is USART11_RX */
  257. #define GPDMA1_REQUEST_USART11_TX 42U /*!< GPDMA1 HW request is USART11_TX */
  258. #endif /* USART11 */
  259. #if defined (UART12)
  260. #define GPDMA1_REQUEST_UART12_RX 43U /*!< GPDMA1 HW request is UART12_RX */
  261. #define GPDMA1_REQUEST_UART12_TX 44U /*!< GPDMA1 HW request is UART12_TX */
  262. #endif /* UART12 */
  263. #define GPDMA1_REQUEST_LPUART1_RX 45U /*!< GPDMA1 HW request is LPUART1_RX */
  264. #define GPDMA1_REQUEST_LPUART1_TX 46U /*!< GPDMA1 HW request is LPUART1_TX */
  265. #if defined (SPI4)
  266. #define GPDMA1_REQUEST_SPI4_RX 47U /*!< GPDMA1 HW request is SPI4_RX */
  267. #define GPDMA1_REQUEST_SPI4_TX 48U /*!< GPDMA1 HW request is SPI4_TX */
  268. #endif /* SPI4 */
  269. #if defined (SPI5)
  270. #define GPDMA1_REQUEST_SPI5_RX 49U /*!< GPDMA1 HW request is SPI5_RX */
  271. #define GPDMA1_REQUEST_SPI5_TX 50U /*!< GPDMA1 HW request is SPI5_TX */
  272. #endif /* SPI5 */
  273. #if defined (SPI6)
  274. #define GPDMA1_REQUEST_SPI6_RX 51U /*!< GPDMA1 HW request is SPI6_RX */
  275. #define GPDMA1_REQUEST_SPI6_TX 52U /*!< GPDMA1 HW request is SPI6_TX */
  276. #endif /* SPI6 */
  277. #if defined (SAI1)
  278. #define GPDMA1_REQUEST_SAI1_A 53U /*!< GPDMA1 HW request is SAI1_A */
  279. #define GPDMA1_REQUEST_SAI1_B 54U /*!< GPDMA1 HW request is SAI1_B */
  280. #endif /* SAI1 */
  281. #if defined (SAI2)
  282. #define GPDMA1_REQUEST_SAI2_A 55U /*!< GPDMA1 HW request is SAI2_A */
  283. #define GPDMA1_REQUEST_SAI2_B 56U /*!< GPDMA1 HW request is SAI2_B */
  284. #endif /* SAI2 */
  285. #if defined (OCTOSPI1)
  286. #define GPDMA1_REQUEST_OCTOSPI1 57U /*!< GPDMA1 HW request is OCTOSPI1 */
  287. #endif /* OCTOSPI1 */
  288. #define GPDMA1_REQUEST_TIM1_CH1 58U /*!< GPDMA1 HW request is TIM1_CH1 */
  289. #define GPDMA1_REQUEST_TIM1_CH2 59U /*!< GPDMA1 HW request is TIM1_CH2 */
  290. #define GPDMA1_REQUEST_TIM1_CH3 60U /*!< GPDMA1 HW request is TIM1_CH3 */
  291. #define GPDMA1_REQUEST_TIM1_CH4 61U /*!< GPDMA1 HW request is TIM1_CH4 */
  292. #define GPDMA1_REQUEST_TIM1_UP 62U /*!< GPDMA1 HW request is TIM1_UP */
  293. #define GPDMA1_REQUEST_TIM1_TRIG 63U /*!< GPDMA1 HW request is TIM1_TRIG */
  294. #define GPDMA1_REQUEST_TIM1_COM 64U /*!< GPDMA1 HW request is TIM1_COM */
  295. #if defined (TIM8)
  296. #define GPDMA1_REQUEST_TIM8_CH1 65U /*!< GPDMA1 HW request is TIM8_CH1 */
  297. #define GPDMA1_REQUEST_TIM8_CH2 66U /*!< GPDMA1 HW request is TIM8_CH2 */
  298. #define GPDMA1_REQUEST_TIM8_CH3 67U /*!< GPDMA1 HW request is TIM8_CH3 */
  299. #define GPDMA1_REQUEST_TIM8_CH4 68U /*!< GPDMA1 HW request is TIM8_CH4 */
  300. #define GPDMA1_REQUEST_TIM8_UP 69U /*!< GPDMA1 HW request is TIM8_UP */
  301. #define GPDMA1_REQUEST_TIM8_TRIG 70U /*!< GPDMA1 HW request is TIM8_TRIG */
  302. #define GPDMA1_REQUEST_TIM8_COM 71U /*!< GPDMA1 HW request is TIM8_COM */
  303. #endif /* TIM8 */
  304. #define GPDMA1_REQUEST_TIM2_CH1 72U /*!< GPDMA1 HW request is TIM2_CH1 */
  305. #define GPDMA1_REQUEST_TIM2_CH2 73U /*!< GPDMA1 HW request is TIM2_CH2 */
  306. #define GPDMA1_REQUEST_TIM2_CH3 74U /*!< GPDMA1 HW request is TIM2_CH3 */
  307. #define GPDMA1_REQUEST_TIM2_CH4 75U /*!< GPDMA1 HW request is TIM2_CH4 */
  308. #define GPDMA1_REQUEST_TIM2_UP 76U /*!< GPDMA1 HW request is TIM2_UP */
  309. #define GPDMA1_REQUEST_TIM3_CH1 77U /*!< GPDMA1 HW request is TIM3_CH1 */
  310. #define GPDMA1_REQUEST_TIM3_CH2 78U /*!< GPDMA1 HW request is TIM3_CH2 */
  311. #define GPDMA1_REQUEST_TIM3_CH3 79U /*!< GPDMA1 HW request is TIM3_CH3 */
  312. #define GPDMA1_REQUEST_TIM3_CH4 80U /*!< GPDMA1 HW request is TIM3_CH4 */
  313. #define GPDMA1_REQUEST_TIM3_UP 81U /*!< GPDMA1 HW request is TIM3_UP */
  314. #define GPDMA1_REQUEST_TIM3_TRIG 82U /*!< GPDMA1 HW request is TIM3_TRIG */
  315. #if defined (TIM4)
  316. #define GPDMA1_REQUEST_TIM4_CH1 83U /*!< GPDMA1 HW request is TIM4_CH1 */
  317. #define GPDMA1_REQUEST_TIM4_CH2 84U /*!< GPDMA1 HW request is TIM4_CH2 */
  318. #define GPDMA1_REQUEST_TIM4_CH3 85U /*!< GPDMA1 HW request is TIM4_CH3 */
  319. #define GPDMA1_REQUEST_TIM4_CH4 86U /*!< GPDMA1 HW request is TIM4_CH4 */
  320. #define GPDMA1_REQUEST_TIM4_UP 87U /*!< GPDMA1 HW request is TIM4_UP */
  321. #endif /* TIM4 */
  322. #if defined (TIM5)
  323. #define GPDMA1_REQUEST_TIM5_CH1 88U /*!< GPDMA1 HW request is TIM5_CH1 */
  324. #define GPDMA1_REQUEST_TIM5_CH2 89U /*!< GPDMA1 HW request is TIM5_CH2 */
  325. #define GPDMA1_REQUEST_TIM5_CH3 90U /*!< GPDMA1 HW request is TIM5_CH3 */
  326. #define GPDMA1_REQUEST_TIM5_CH4 91U /*!< GPDMA1 HW request is TIM5_CH4 */
  327. #define GPDMA1_REQUEST_TIM5_UP 92U /*!< GPDMA1 HW request is TIM5_UP */
  328. #define GPDMA1_REQUEST_TIM5_TRIG 93U /*!< GPDMA1 HW request is TIM5_TRIG */
  329. #endif /* TIM5 */
  330. #if defined (TIM15)
  331. #define GPDMA1_REQUEST_TIM15_CH1 94U /*!< GPDMA1 HW request is TIM15_CH1 */
  332. #define GPDMA1_REQUEST_TIM15_UP 95U /*!< GPDMA1 HW request is TIM15_UP */
  333. #define GPDMA1_REQUEST_TIM15_TRIG 96U /*!< GPDMA1 HW request is TIM15_TRIG */
  334. #define GPDMA1_REQUEST_TIM15_COM 97U /*!< GPDMA1 HW request is TIM15_COM */
  335. #endif /* TIM15 */
  336. #if defined (TIM16)
  337. #define GPDMA1_REQUEST_TIM16_CH1 98U /*!< GPDMA1 HW request is TIM16_CH1 */
  338. #define GPDMA1_REQUEST_TIM16_UP 99U /*!< GPDMA1 HW request is TIM16_UP */
  339. #endif /* TIM16 */
  340. #if defined (TIM17)
  341. #define GPDMA1_REQUEST_TIM17_CH1 100U /*!< GPDMA1 HW request is TIM17_CH1 */
  342. #define GPDMA1_REQUEST_TIM17_UP 101U /*!< GPDMA1 HW request is TIM17_UP */
  343. #endif /* TIM17 */
  344. #define GPDMA1_REQUEST_LPTIM1_IC1 102U /*!< GPDMA1 HW request is LPTIM1_IC1 */
  345. #define GPDMA1_REQUEST_LPTIM1_IC2 103U /*!< GPDMA1 HW request is LPTIM1_IC2 */
  346. #define GPDMA1_REQUEST_LPTIM1_UE 104U /*!< GPDMA1 HW request is LPTIM1_UE */
  347. #define GPDMA1_REQUEST_LPTIM2_IC1 105U /*!< GPDMA1 HW request is LPTIM2_IC1 */
  348. #define GPDMA1_REQUEST_LPTIM2_IC2 106U /*!< GPDMA1 HW request is LPTIM2_IC2 */
  349. #define GPDMA1_REQUEST_LPTIM2_UE 107U /*!< GPDMA1 HW request is LPTIM2_UE */
  350. #if defined (DCMI)
  351. #define GPDMA1_REQUEST_DCMI 108U /*!< GPDMA1 HW request is DCMI */
  352. #endif /* DCMI */
  353. #if defined (AES)
  354. #define GPDMA1_REQUEST_AES_OUT 109U /*!< GPDMA1 HW request is AES_OUT */
  355. #define GPDMA1_REQUEST_AES_IN 110U /*!< GPDMA1 HW request is AES_IN */
  356. #endif /* AES */
  357. #define GPDMA1_REQUEST_HASH_IN 111U /*!< GPDMA1 HW request is HASH_IN */
  358. #if defined (UCPD1)
  359. #define GPDMA1_REQUEST_UCPD1_RX 112U /*!< GPDMA1 HW request is UCPD1_RX */
  360. #define GPDMA1_REQUEST_UCPD1_TX 113U /*!< GPDMA1 HW request is UCPD1_TX */
  361. #endif /* UCPD1 */
  362. #if defined (CORDIC)
  363. #define GPDMA1_REQUEST_CORDIC_READ 114U /*!< GPDMA1 HW request is CORDIC_READ */
  364. #define GPDMA1_REQUEST_CORDIC_WRITE 115U /*!< GPDMA1 HW request is CORDIC_WRITE */
  365. #endif /* CORDIC */
  366. #if defined (FMAC)
  367. #define GPDMA1_REQUEST_FMAC_READ 116U /*!< GPDMA1 HW request is FMAC_READ */
  368. #define GPDMA1_REQUEST_FMAC_WRITE 117U /*!< GPDMA1 HW request is FMAC_WRITE */
  369. #endif /* FMAC */
  370. #if defined (SAES)
  371. #define GPDMA1_REQUEST_SAES_OUT 118U /*!< GPDMA1 HW request is SAES_OUT */
  372. #define GPDMA1_REQUEST_SAES_IN 119U /*!< GPDMA1 HW request is SAES_IN */
  373. #endif /* SAES */
  374. #define GPDMA1_REQUEST_I3C1_RX 120U /*!< GPDMA1 HW request is I3C1_RX */
  375. #define GPDMA1_REQUEST_I3C1_TX 121U /*!< GPDMA1 HW request is I3C1_TX */
  376. #define GPDMA1_REQUEST_I3C1_TC 122U /*!< GPDMA1 HW request is I3C1_TC */
  377. #define GPDMA1_REQUEST_I3C1_RS 123U /*!< GPDMA1 HW request is I3C1_RS */
  378. #if defined (I2C4)
  379. #define GPDMA1_REQUEST_I2C4_RX 124U /*!< GPDMA1 HW request is I2C4_RX */
  380. #define GPDMA1_REQUEST_I2C4_TX 125U /*!< GPDMA1 HW request is I2C4_TX */
  381. #endif /* I2C4 */
  382. #if defined (LPTIM3)
  383. #define GPDMA1_REQUEST_LPTIM3_IC1 127U /*!< GPDMA1 HW request is LPTIM3_IC1 */
  384. #define GPDMA1_REQUEST_LPTIM3_IC2 128U /*!< GPDMA1 HW request is LPTIM3_IC2 */
  385. #define GPDMA1_REQUEST_LPTIM3_UE 129U /*!< GPDMA1 HW request is LPTIM3_UE */
  386. #endif /* LPTIM3 */
  387. #if defined (LPTIM5)
  388. #define GPDMA1_REQUEST_LPTIM5_IC1 130U /*!< GPDMA1 HW request is LPTIM5_IC1 */
  389. #define GPDMA1_REQUEST_LPTIM5_IC2 131U /*!< GPDMA1 HW request is LPTIM5_IC2 */
  390. #define GPDMA1_REQUEST_LPTIM5_UE 132U /*!< GPDMA1 HW request is LPTIM5_UE */
  391. #endif /* LPTIM5 */
  392. #if defined (LPTIM6)
  393. #define GPDMA1_REQUEST_LPTIM6_IC1 133U /*!< GPDMA1 HW request is LPTIM6_IC1 */
  394. #define GPDMA1_REQUEST_LPTIM6_IC2 134U /*!< GPDMA1 HW request is LPTIM6_IC2 */
  395. #define GPDMA1_REQUEST_LPTIM6_UE 135U /*!< GPDMA1 HW request is LPTIM6_UE */
  396. #endif /* LPTIM6 */
  397. #if defined (I3C2)
  398. #define GPDMA1_REQUEST_I3C2_RX 136U /*!< GPDMA1 HW request is I3C2_RX */
  399. #define GPDMA1_REQUEST_I3C2_TX 137U /*!< GPDMA1 HW request is I3C2_TX */
  400. #define GPDMA1_REQUEST_I3C2_TC 138U /*!< GPDMA1 HW request is I3C2_TC */
  401. #define GPDMA1_REQUEST_I3C2_RS 139U /*!< GPDMA1 HW request is I3C2_RS */
  402. #endif /* I3C2 */
  403. /* GPDMA2 requests */
  404. #define GPDMA2_REQUEST_ADC1 0U /*!< GPDMA2 HW request is ADC1 */
  405. #if defined (ADC2)
  406. #define GPDMA2_REQUEST_ADC2 1U /*!< GPDMA2 HW request is ADC2 */
  407. #endif /* ADC2 */
  408. #define GPDMA2_REQUEST_DAC1_CH1 2U /*!< GPDMA2 HW request is DAC1_CH1 */
  409. #define GPDMA2_REQUEST_DAC1_CH2 3U /*!< GPDMA2 HW request is DAC1_CH2 */
  410. #define GPDMA2_REQUEST_TIM6_UP 4U /*!< GPDMA2 HW request is TIM6_UP */
  411. #define GPDMA2_REQUEST_TIM7_UP 5U /*!< GPDMA2 HW request is TIM7_UP */
  412. #define GPDMA2_REQUEST_SPI1_RX 6U /*!< GPDMA2 HW request is SPI1_RX */
  413. #define GPDMA2_REQUEST_SPI1_TX 7U /*!< GPDMA2 HW request is SPI1_TX */
  414. #define GPDMA2_REQUEST_SPI2_RX 8U /*!< GPDMA2 HW request is SPI2_RX */
  415. #define GPDMA2_REQUEST_SPI2_TX 9U /*!< GPDMA2 HW request is SPI2_TX */
  416. #define GPDMA2_REQUEST_SPI3_RX 10U /*!< GPDMA2 HW request is SPI3_RX */
  417. #define GPDMA2_REQUEST_SPI3_TX 11U /*!< GPDMA2 HW request is SPI3_TX */
  418. #define GPDMA2_REQUEST_I2C1_RX 12U /*!< GPDMA2 HW request is I2C1_RX */
  419. #define GPDMA2_REQUEST_I2C1_TX 13U /*!< GPDMA2 HW request is I2C1_TX */
  420. #define GPDMA2_REQUEST_I2C2_RX 15U /*!< GPDMA2 HW request is I2C2_RX */
  421. #define GPDMA2_REQUEST_I2C2_TX 16U /*!< GPDMA2 HW request is I2C2_TX */
  422. #if defined (I2C3)
  423. #define GPDMA2_REQUEST_I2C3_RX 18U /*!< GPDMA2 HW request is I2C3_RX */
  424. #define GPDMA2_REQUEST_I2C3_TX 19U /*!< GPDMA2 HW request is I2C3_TX */
  425. #endif /* I2C3 */
  426. #define GPDMA2_REQUEST_USART1_RX 21U /*!< GPDMA2 HW request is USART1_RX */
  427. #define GPDMA2_REQUEST_USART1_TX 22U /*!< GPDMA2 HW request is USART1_TX */
  428. #define GPDMA2_REQUEST_USART2_RX 23U /*!< GPDMA2 HW request is USART2_RX */
  429. #define GPDMA2_REQUEST_USART2_TX 24U /*!< GPDMA2 HW request is USART2_TX */
  430. #define GPDMA2_REQUEST_USART3_RX 25U /*!< GPDMA2 HW request is USART3_RX */
  431. #define GPDMA2_REQUEST_USART3_TX 26U /*!< GPDMA2 HW request is USART3_TX */
  432. #if defined (UART4)
  433. #define GPDMA2_REQUEST_UART4_RX 27U /*!< GPDMA2 HW request is UART4_RX */
  434. #define GPDMA2_REQUEST_UART4_TX 28U /*!< GPDMA2 HW request is UART4_TX */
  435. #endif /* UART4 */
  436. #if defined (UART4)
  437. #define GPDMA2_REQUEST_UART5_RX 29U /*!< GPDMA2 HW request is UART5_RX */
  438. #define GPDMA2_REQUEST_UART5_TX 30U /*!< GPDMA2 HW request is UART5_TX */
  439. #endif /* UART5 */
  440. #if defined (UART4)
  441. #define GPDMA2_REQUEST_USART6_RX 31U /*!< GPDMA2 HW request is USART6_RX */
  442. #define GPDMA2_REQUEST_USART6_TX 32U /*!< GPDMA2 HW request is USART6_TX */
  443. #endif /* USART6 */
  444. #if defined (UART7)
  445. #define GPDMA2_REQUEST_UART7_RX 33U /*!< GPDMA2 HW request is UART7_RX */
  446. #define GPDMA2_REQUEST_UART7_TX 34U /*!< GPDMA2 HW request is UART7_TX */
  447. #endif /* UART7 */
  448. #if defined (UART8)
  449. #define GPDMA2_REQUEST_UART8_RX 35U /*!< GPDMA2 HW request is UART8_RX */
  450. #define GPDMA2_REQUEST_UART8_TX 36U /*!< GPDMA2 HW request is UART8_TX */
  451. #endif /* UART8 */
  452. #if defined (UART9)
  453. #define GPDMA2_REQUEST_UART9_RX 37U /*!< GPDMA2 HW request is UART9_RX */
  454. #define GPDMA2_REQUEST_UART9_TX 38U /*!< GPDMA2 HW request is UART9_TX */
  455. #endif /* UART9 */
  456. #if defined (USART10)
  457. #define GPDMA2_REQUEST_USART10_RX 39U /*!< GPDMA2 HW request is USART10_RX */
  458. #define GPDMA2_REQUEST_USART10_TX 40U /*!< GPDMA2 HW request is USART10_TX */
  459. #endif /* USART10 */
  460. #if defined (USART11)
  461. #define GPDMA2_REQUEST_USART11_RX 41U /*!< GPDMA2 HW request is USART11_RX */
  462. #define GPDMA2_REQUEST_USART11_TX 42U /*!< GPDMA2 HW request is USART11_TX */
  463. #endif /* USART11 */
  464. #if defined (UART12)
  465. #define GPDMA2_REQUEST_UART12_RX 43U /*!< GPDMA2 HW request is UART12_RX */
  466. #define GPDMA2_REQUEST_UART12_TX 44U /*!< GPDMA2 HW request is UART12_TX */
  467. #endif /* UART12 */
  468. #define GPDMA2_REQUEST_LPUART1_RX 45U /*!< GPDMA2 HW request is LPUART1_RX */
  469. #define GPDMA2_REQUEST_LPUART1_TX 46U /*!< GPDMA2 HW request is LPUART1_TX */
  470. #if defined (SPI4)
  471. #define GPDMA2_REQUEST_SPI4_RX 47U /*!< GPDMA2 HW request is SPI4_RX */
  472. #define GPDMA2_REQUEST_SPI4_TX 48U /*!< GPDMA2 HW request is SPI4_TX */
  473. #endif /* SPI4 */
  474. #if defined (SPI5)
  475. #define GPDMA2_REQUEST_SPI5_RX 49U /*!< GPDMA2 HW request is SPI5_RX */
  476. #define GPDMA2_REQUEST_SPI5_TX 50U /*!< GPDMA2 HW request is SPI5_TX */
  477. #endif /* SPI5 */
  478. #if defined (SPI6)
  479. #define GPDMA2_REQUEST_SPI6_RX 51U /*!< GPDMA2 HW request is SPI6_RX */
  480. #define GPDMA2_REQUEST_SPI6_TX 52U /*!< GPDMA2 HW request is SPI6_TX */
  481. #endif /* SPI6 */
  482. #if defined (SAI1)
  483. #define GPDMA2_REQUEST_SAI1_A 53U /*!< GPDMA2 HW request is SAI1_A */
  484. #define GPDMA2_REQUEST_SAI1_B 54U /*!< GPDMA2 HW request is SAI1_B */
  485. #endif /* SAI1 */
  486. #if defined (SAI2)
  487. #define GPDMA2_REQUEST_SAI2_A 55U /*!< GPDMA2 HW request is SAI2_A */
  488. #define GPDMA2_REQUEST_SAI2_B 56U /*!< GPDMA2 HW request is SAI2_B */
  489. #endif /* SAI2 */
  490. #if defined (OCTOSPI1)
  491. #define GPDMA2_REQUEST_OCTOSPI1 57U /*!< GPDMA2 HW request is OCTOSPI1 */
  492. #endif /* OCTOSPI1 */
  493. #define GPDMA2_REQUEST_TIM1_CH1 58U /*!< GPDMA2 HW request is TIM1_CH1 */
  494. #define GPDMA2_REQUEST_TIM1_CH2 59U /*!< GPDMA2 HW request is TIM1_CH2 */
  495. #define GPDMA2_REQUEST_TIM1_CH3 60U /*!< GPDMA2 HW request is TIM1_CH3 */
  496. #define GPDMA2_REQUEST_TIM1_CH4 61U /*!< GPDMA2 HW request is TIM1_CH4 */
  497. #define GPDMA2_REQUEST_TIM1_UP 62U /*!< GPDMA2 HW request is TIM1_UP */
  498. #define GPDMA2_REQUEST_TIM1_TRIG 63U /*!< GPDMA2 HW request is TIM1_TRIG */
  499. #define GPDMA2_REQUEST_TIM1_COM 64U /*!< GPDMA2 HW request is TIM1_COM */
  500. #if defined (TIM8)
  501. #define GPDMA2_REQUEST_TIM8_CH1 65U /*!< GPDMA2 HW request is TIM8_CH1 */
  502. #define GPDMA2_REQUEST_TIM8_CH2 66U /*!< GPDMA2 HW request is TIM8_CH2 */
  503. #define GPDMA2_REQUEST_TIM8_CH3 67U /*!< GPDMA2 HW request is TIM8_CH3 */
  504. #define GPDMA2_REQUEST_TIM8_CH4 68U /*!< GPDMA2 HW request is TIM8_CH4 */
  505. #define GPDMA2_REQUEST_TIM8_UP 69U /*!< GPDMA2 HW request is TIM8_UP */
  506. #define GPDMA2_REQUEST_TIM8_TRIG 70U /*!< GPDMA2 HW request is TIM8_TRIG */
  507. #define GPDMA2_REQUEST_TIM8_COM 71U /*!< GPDMA2 HW request is TIM8_COM */
  508. #endif /* TIM8 */
  509. #define GPDMA2_REQUEST_TIM2_CH1 72U /*!< GPDMA2 HW request is TIM2_CH1 */
  510. #define GPDMA2_REQUEST_TIM2_CH2 73U /*!< GPDMA2 HW request is TIM2_CH2 */
  511. #define GPDMA2_REQUEST_TIM2_CH3 74U /*!< GPDMA2 HW request is TIM2_CH3 */
  512. #define GPDMA2_REQUEST_TIM2_CH4 75U /*!< GPDMA2 HW request is TIM2_CH4 */
  513. #define GPDMA2_REQUEST_TIM2_UP 76U /*!< GPDMA2 HW request is TIM2_UP */
  514. #define GPDMA2_REQUEST_TIM3_CH1 77U /*!< GPDMA2 HW request is TIM3_CH1 */
  515. #define GPDMA2_REQUEST_TIM3_CH2 78U /*!< GPDMA2 HW request is TIM3_CH2 */
  516. #define GPDMA2_REQUEST_TIM3_CH3 79U /*!< GPDMA2 HW request is TIM3_CH3 */
  517. #define GPDMA2_REQUEST_TIM3_CH4 80U /*!< GPDMA2 HW request is TIM3_CH4 */
  518. #define GPDMA2_REQUEST_TIM3_UP 81U /*!< GPDMA2 HW request is TIM3_UP */
  519. #define GPDMA2_REQUEST_TIM3_TRIG 82U /*!< GPDMA2 HW request is TIM3_TRIG */
  520. #if defined (TIM4)
  521. #define GPDMA2_REQUEST_TIM4_CH1 83U /*!< GPDMA2 HW request is TIM4_CH1 */
  522. #define GPDMA2_REQUEST_TIM4_CH2 84U /*!< GPDMA2 HW request is TIM4_CH2 */
  523. #define GPDMA2_REQUEST_TIM4_CH3 85U /*!< GPDMA2 HW request is TIM4_CH3 */
  524. #define GPDMA2_REQUEST_TIM4_CH4 86U /*!< GPDMA2 HW request is TIM4_CH4 */
  525. #define GPDMA2_REQUEST_TIM4_UP 87U /*!< GPDMA2 HW request is TIM4_UP */
  526. #endif /* TIM4 */
  527. #if defined (TIM5)
  528. #define GPDMA2_REQUEST_TIM5_CH1 88U /*!< GPDMA2 HW request is TIM5_CH1 */
  529. #define GPDMA2_REQUEST_TIM5_CH2 89U /*!< GPDMA2 HW request is TIM5_CH2 */
  530. #define GPDMA2_REQUEST_TIM5_CH3 90U /*!< GPDMA2 HW request is TIM5_CH3 */
  531. #define GPDMA2_REQUEST_TIM5_CH4 91U /*!< GPDMA2 HW request is TIM5_CH4 */
  532. #define GPDMA2_REQUEST_TIM5_UP 92U /*!< GPDMA2 HW request is TIM5_UP */
  533. #define GPDMA2_REQUEST_TIM5_TRIG 93U /*!< GPDMA2 HW request is TIM5_TRIG */
  534. #endif /* TIM5 */
  535. #if defined (TIM15)
  536. #define GPDMA2_REQUEST_TIM15_CH1 94U /*!< GPDMA2 HW request is TIM15_CH1 */
  537. #define GPDMA2_REQUEST_TIM15_UP 95U /*!< GPDMA2 HW request is TIM15_UP */
  538. #define GPDMA2_REQUEST_TIM15_TRIG 96U /*!< GPDMA2 HW request is TIM15_TRIG */
  539. #define GPDMA2_REQUEST_TIM15_COM 97U /*!< GPDMA2 HW request is TIM15_COM */
  540. #endif /* TIM15 */
  541. #if defined (TIM16)
  542. #define GPDMA2_REQUEST_TIM16_CH1 98U /*!< GPDMA2 HW request is TIM16_CH1 */
  543. #define GPDMA2_REQUEST_TIM16_UP 99U /*!< GPDMA2 HW request is TIM16_UP */
  544. #endif /* TIM16 */
  545. #if defined (TIM17)
  546. #define GPDMA2_REQUEST_TIM17_CH1 100U /*!< GPDMA2 HW request is TIM17_CH1 */
  547. #define GPDMA2_REQUEST_TIM17_UP 101U /*!< GPDMA2 HW request is TIM17_UP */
  548. #endif /* TIM17 */
  549. #define GPDMA2_REQUEST_LPTIM1_IC1 102U /*!< GPDMA2 HW request is LPTIM1_IC1 */
  550. #define GPDMA2_REQUEST_LPTIM1_IC2 103U /*!< GPDMA2 HW request is LPTIM1_IC2 */
  551. #define GPDMA2_REQUEST_LPTIM1_UE 104U /*!< GPDMA2 HW request is LPTIM1_UE */
  552. #define GPDMA2_REQUEST_LPTIM2_IC1 105U /*!< GPDMA2 HW request is LPTIM2_IC1 */
  553. #define GPDMA2_REQUEST_LPTIM2_IC2 106U /*!< GPDMA2 HW request is LPTIM2_IC2 */
  554. #define GPDMA2_REQUEST_LPTIM2_UE 107U /*!< GPDMA2 HW request is LPTIM2_UE */
  555. #if defined (DCMI)
  556. #define GPDMA2_REQUEST_DCMI 108U /*!< GPDMA2 HW request is DCMI */
  557. #endif /* DCMI */
  558. #if defined (AES)
  559. #define GPDMA2_REQUEST_AES_OUT 109U /*!< GPDMA2 HW request is AES_OUT */
  560. #define GPDMA2_REQUEST_AES_IN 110U /*!< GPDMA2 HW request is AES_IN */
  561. #endif /* AES */
  562. #define GPDMA2_REQUEST_HASH_IN 111U /*!< GPDMA2 HW request is HASH_IN */
  563. #if defined (UCPD1)
  564. #define GPDMA2_REQUEST_UCPD1_RX 112U /*!< GPDMA2 HW request is UCPD1_RX */
  565. #define GPDMA2_REQUEST_UCPD1_TX 113U /*!< GPDMA2 HW request is UCPD1_TX */
  566. #endif /* UCPD1 */
  567. #if defined (CORDIC)
  568. #define GPDMA2_REQUEST_CORDIC_READ 114U /*!< GPDMA2 HW request is CORDIC_READ */
  569. #define GPDMA2_REQUEST_CORDIC_WRITE 115U /*!< GPDMA2 HW request is CORDIC_WRITE */
  570. #endif /* CORDIC */
  571. #if defined (FMAC)
  572. #define GPDMA2_REQUEST_FMAC_READ 116U /*!< GPDMA2 HW request is FMAC_READ */
  573. #define GPDMA2_REQUEST_FMAC_WRITE 117U /*!< GPDMA2 HW request is FMAC_WRITE */
  574. #endif /* FMAC */
  575. #if defined (SAES)
  576. #define GPDMA2_REQUEST_SAES_OUT 118U /*!< GPDMA2 HW request is SAES_OUT */
  577. #define GPDMA2_REQUEST_SAES_IN 119U /*!< GPDMA2 HW request is SAES_IN */
  578. #endif /* SAES */
  579. #define GPDMA2_REQUEST_I3C1_RX 120U /*!< GPDMA2 HW request is I3C1_RX */
  580. #define GPDMA2_REQUEST_I3C1_TX 121U /*!< GPDMA2 HW request is I3C1_TX */
  581. #define GPDMA2_REQUEST_I3C1_TC 122U /*!< GPDMA2 HW request is I3C1_TC */
  582. #define GPDMA2_REQUEST_I3C1_RS 123U /*!< GPDMA2 HW request is I3C1_RS */
  583. #if defined (I2C4)
  584. #define GPDMA2_REQUEST_I2C4_RX 124U /*!< GPDMA2 HW request is I2C4_RX */
  585. #define GPDMA2_REQUEST_I2C4_TX 125U /*!< GPDMA2 HW request is I2C4_TX */
  586. #endif /* I2C4 */
  587. #if defined (LPTIM3)
  588. #define GPDMA2_REQUEST_LPTIM3_IC1 127U /*!< GPDMA2 HW request is LPTIM3_IC1 */
  589. #define GPDMA2_REQUEST_LPTIM3_IC2 128U /*!< GPDMA2 HW request is LPTIM3_IC2 */
  590. #define GPDMA2_REQUEST_LPTIM3_UE 129U /*!< GPDMA2 HW request is LPTIM3_UE */
  591. #endif /* LPTIM3 */
  592. #if defined (LPTIM5)
  593. #define GPDMA2_REQUEST_LPTIM5_IC1 130U /*!< GPDMA2 HW request is LPTIM5_IC1 */
  594. #define GPDMA2_REQUEST_LPTIM5_IC2 131U /*!< GPDMA2 HW request is LPTIM5_IC2 */
  595. #define GPDMA2_REQUEST_LPTIM5_UE 132U /*!< GPDMA2 HW request is LPTIM5_UE */
  596. #endif /* LPTIM5 */
  597. #if defined (LPTIM6)
  598. #define GPDMA2_REQUEST_LPTIM6_IC1 133U /*!< GPDMA2 HW request is LPTIM6_IC1 */
  599. #define GPDMA2_REQUEST_LPTIM6_IC2 134U /*!< GPDMA2 HW request is LPTIM6_IC2 */
  600. #define GPDMA2_REQUEST_LPTIM6_UE 135U /*!< GPDMA2 HW request is LPTIM6_UE */
  601. #endif /* LPTIM6 */
  602. #if defined (I3C2)
  603. #define GPDMA2_REQUEST_I3C2_RX 136U /*!< GPDMA2 HW request is I3C2_RX */
  604. #define GPDMA2_REQUEST_I3C2_TX 137U /*!< GPDMA2 HW request is I3C2_TX */
  605. #define GPDMA2_REQUEST_I3C2_TC 138U /*!< GPDMA2 HW request is I3C2_TC */
  606. #define GPDMA2_REQUEST_I3C2_RS 139U /*!< GPDMA2 HW request is I3C2_RS */
  607. #endif /* I3C2 */
  608. /* Software request */
  609. #define DMA_REQUEST_SW DMA_CTR2_SWREQ /*!< DMA SW request */
  610. /**
  611. * @}
  612. */
  613. /** @defgroup DMA_Block_Request DMA Block Request
  614. * @brief DMA Block Request
  615. * @{
  616. */
  617. #define DMA_BREQ_SINGLE_BURST 0x00000000U /*!< Hardware request protocol at a single / burst level */
  618. #define DMA_BREQ_BLOCK DMA_CTR2_BREQ /*!< Hardware request protocol at a block level */
  619. /**
  620. * @}
  621. */
  622. /** @defgroup DMA_Transfer_Direction DMA Transfer Direction
  623. * @brief DMA transfer direction
  624. * @{
  625. */
  626. #define DMA_PERIPH_TO_MEMORY 0x00000000U /*!< Peripheral to memory direction */
  627. #define DMA_MEMORY_TO_PERIPH DMA_CTR2_DREQ /*!< Memory to peripheral direction */
  628. #define DMA_MEMORY_TO_MEMORY DMA_CTR2_SWREQ /*!< Memory to memory direction */
  629. /**
  630. * @}
  631. */
  632. /** @defgroup DMA_Source_Increment_Mode DMA Source Increment Mode
  633. * @brief DMA Source Increment Mode
  634. * @{
  635. */
  636. #define DMA_SINC_FIXED 0x00000000U /*!< Source fixed single / burst */
  637. #define DMA_SINC_INCREMENTED DMA_CTR1_SINC /*!< Source incremented single / burst */
  638. /**
  639. * @}
  640. */
  641. /** @defgroup DMA_Destination_Increment_Mode DMA Destination Increment Mode
  642. * @brief DMA Destination Increment Mode
  643. * @{
  644. */
  645. #define DMA_DINC_FIXED 0x00000000U /*!< Destination fixed single / burst */
  646. #define DMA_DINC_INCREMENTED DMA_CTR1_DINC /*!< Destination incremented single / burst */
  647. /**
  648. * @}
  649. */
  650. /** @defgroup DMA_Source_Data_Width DMA Source Data Width
  651. * @brief DMA Source Data Width
  652. * @{
  653. */
  654. #define DMA_SRC_DATAWIDTH_BYTE 0x00000000U /*!< Source data width : Byte */
  655. #define DMA_SRC_DATAWIDTH_HALFWORD DMA_CTR1_SDW_LOG2_0 /*!< Source data width : HalfWord */
  656. #define DMA_SRC_DATAWIDTH_WORD DMA_CTR1_SDW_LOG2_1 /*!< Source data width : Word */
  657. /**
  658. * @}
  659. */
  660. /** @defgroup DMA_Destination_Data_Width DMA destination Data Width
  661. * @brief DMA destination Data Width
  662. * @{
  663. */
  664. #define DMA_DEST_DATAWIDTH_BYTE 0x00000000U /*!< Destination data width : Byte */
  665. #define DMA_DEST_DATAWIDTH_HALFWORD DMA_CTR1_DDW_LOG2_0 /*!< Destination data width : HalfWord */
  666. #define DMA_DEST_DATAWIDTH_WORD DMA_CTR1_DDW_LOG2_1 /*!< Destination data width : Word */
  667. /**
  668. * @}
  669. */
  670. /** @defgroup DMA_Priority_Level DMA Priority Level
  671. * @brief DMA Priority Level
  672. * @{
  673. */
  674. #define DMA_LOW_PRIORITY_LOW_WEIGHT 0x00000000U /*!< Priority level : Low Priority, Low weight */
  675. #define DMA_LOW_PRIORITY_MID_WEIGHT DMA_CCR_PRIO_0 /*!< Priority level : Low Priority, Mid weight */
  676. #define DMA_LOW_PRIORITY_HIGH_WEIGHT DMA_CCR_PRIO_1 /*!< Priority level : Low Priority, High weight */
  677. #define DMA_HIGH_PRIORITY DMA_CCR_PRIO /*!< Priority level : HIGH Priority */
  678. /**
  679. * @}
  680. */
  681. /** @defgroup DMA_Transfer_Allocated_Port DMA Transfer Allocated Port
  682. * @brief DMA Transfer Allocated Port
  683. * @{
  684. */
  685. #define DMA_SRC_ALLOCATED_PORT0 0x00000000U /*!< Source allocated Port 0 */
  686. #define DMA_SRC_ALLOCATED_PORT1 DMA_CTR1_SAP /*!< Source allocated Port 1 */
  687. #define DMA_DEST_ALLOCATED_PORT0 0x00000000U /*!< Destination allocated Port 0 */
  688. #define DMA_DEST_ALLOCATED_PORT1 DMA_CTR1_DAP /*!< Destination allocated Port 1 */
  689. /**
  690. * @}
  691. */
  692. /** @defgroup DMA_Transfer_Event_Mode DMA Transfer Event Mode
  693. * @brief DMA Transfer Event Mode
  694. * @{
  695. */
  696. #define DMA_TCEM_BLOCK_TRANSFER 0x00000000U /*!< The TC event is generated at the end of each block and the
  697. HT event is generated at the half of each block */
  698. #define DMA_TCEM_REPEATED_BLOCK_TRANSFER DMA_CTR2_TCEM_0 /*!< The TC event is generated at the end of the repeated block
  699. and the HT event is generated at the half of the repeated
  700. block */
  701. #define DMA_TCEM_EACH_LL_ITEM_TRANSFER DMA_CTR2_TCEM_1 /*!< The TC event is generated at the end of each linked-list
  702. item and the HT event is generated at the half of each
  703. linked-list item */
  704. #define DMA_TCEM_LAST_LL_ITEM_TRANSFER DMA_CTR2_TCEM /*!< The TC event is generated at the end of the last
  705. linked-list item and the HT event is generated at the half
  706. of the last linked-list item */
  707. /**
  708. * @}
  709. */
  710. /** @defgroup DMA_Transfer_Mode DMA Transfer Mode
  711. * @brief DMA Transfer Mode
  712. * @{
  713. */
  714. #define DMA_NORMAL (0x00U) /*!< Normal DMA transfer */
  715. #define DMA_PFCTRL DMA_CTR2_PFREQ /*!< HW request peripheral flow control mode */
  716. /**
  717. * @}
  718. */
  719. /** @defgroup DMA_Channel_Attributes DMA Channel Attributes
  720. * @brief DMA Channel Security and Privilege Attributes
  721. * @note Secure and non-secure attributes are only available from the secure world when TZEN = 1
  722. * @{
  723. */
  724. #define DMA_CHANNEL_PRIV (DMA_CHANNEL_ATTR_PRIV_MASK | 0x01U) /*!< Channel is privileged */
  725. #define DMA_CHANNEL_NPRIV (DMA_CHANNEL_ATTR_PRIV_MASK) /*!< Channel is unprivileged */
  726. #define DMA_CHANNEL_SEC (DMA_CHANNEL_ATTR_SEC_MASK | 0x02U) /*!< Channel is secure */
  727. #define DMA_CHANNEL_NSEC (DMA_CHANNEL_ATTR_SEC_MASK) /*!< Channel is non-secure */
  728. #define DMA_CHANNEL_SRC_SEC (DMA_CHANNEL_ATTR_SEC_SRC_MASK | 0x04U) /*!< Channel source is secure */
  729. #define DMA_CHANNEL_SRC_NSEC (DMA_CHANNEL_ATTR_SEC_SRC_MASK) /*!< Channel source is non-secure */
  730. #define DMA_CHANNEL_DEST_SEC (DMA_CHANNEL_ATTR_SEC_DEST_MASK | 0x08U) /*!< Channel destination is secure */
  731. #define DMA_CHANNEL_DEST_NSEC (DMA_CHANNEL_ATTR_SEC_DEST_MASK) /*!< Channel destination is non-secure */
  732. #define DMA_CHANNEL_ATTRIBUTE_UNLOCKED (0x00U) /*!< Channel attribute is unlocked */
  733. #define DMA_CHANNEL_ATTRIBUTE_LOCKED (0x01U) /*!< Channel attribute is locked */
  734. /**
  735. * @}
  736. */
  737. /**
  738. * @}
  739. */
  740. /* Exported macro ----------------------------------------------------------------------------------------------------*/
  741. /** @defgroup DMA_Exported_Macros DMA Exported Macros
  742. * @brief DMA Exported Macros
  743. * @{
  744. */
  745. /** @brief Reset DMA handle state.
  746. * @param __HANDLE__ : DMA handle.
  747. * @retval None.
  748. */
  749. #define __HAL_DMA_RESET_HANDLE_STATE(__HANDLE__) \
  750. ((__HANDLE__)->State = HAL_DMA_STATE_RESET)
  751. /**
  752. * @brief Enable the specified DMA Channel.
  753. * @param __HANDLE__ : DMA handle.
  754. * @retval None
  755. */
  756. #define __HAL_DMA_ENABLE(__HANDLE__) \
  757. ((__HANDLE__)->Instance->CCR |= DMA_CCR_EN)
  758. /**
  759. * @brief Disable the specified DMA Channel.
  760. * @param __HANDLE__ : DMA handle.
  761. * @retval None
  762. */
  763. #define __HAL_DMA_DISABLE(__HANDLE__) \
  764. ((__HANDLE__)->Instance->CCR |= (DMA_CCR_SUSP | DMA_CCR_RESET))
  765. /**
  766. * @brief Get the DMA channel pending flags.
  767. * @param __HANDLE__ : DMA handle.
  768. * @param __FLAG__ : Get the specified flag.
  769. * This parameter can be any combination of the following values:
  770. * @arg DMA_FLAG_TC : Transfer Complete flag.
  771. * @arg DMA_FLAG_HT : Half Transfer Complete flag.
  772. * @arg DMA_FLAG_DTE : Data Transfer Error flag.
  773. * @arg DMA_FLAG_ULE : Update linked-list Error flag.
  774. * @arg DMA_FLAG_USE : User Setting Error flag.
  775. * @arg DMA_FLAG_TO : Trigger Overrun flag.
  776. * @arg DMA_FLAG_SUSP : Completed Suspension flag.
  777. * @arg DMA_FLAG_IDLEF : Idle flag.
  778. * @retval The state of FLAG (SET or RESET).
  779. */
  780. #define __HAL_DMA_GET_FLAG(__HANDLE__, __FLAG__) \
  781. ((__HANDLE__)->Instance->CSR & (__FLAG__))
  782. /**
  783. * @brief Clear the DMA Channel pending flags.
  784. * @param __HANDLE__ : DMA handle.
  785. * @param __FLAG__ : Specifies the flag to clear.
  786. * This parameter can be any combination of the following values:
  787. * @arg DMA_FLAG_TC : Transfer Complete flag.
  788. * @arg DMA_FLAG_HT : Half Transfer Complete flag.
  789. * @arg DMA_FLAG_DTE : Data Transfer Error flag.
  790. * @arg DMA_FLAG_ULE : Update Linked-List Error flag.
  791. * @arg DMA_FLAG_USE : User Setting Error flag.
  792. * @arg DMA_FLAG_TO : Trigger Overrun flag.
  793. * @arg DMA_FLAG_SUSP : Completed Suspension flag.
  794. * @retval None
  795. */
  796. #define __HAL_DMA_CLEAR_FLAG(__HANDLE__, __FLAG__) \
  797. ((__HANDLE__)->Instance->CFCR = (__FLAG__))
  798. /**
  799. * @brief Enable the specified DMA Channel interrupts.
  800. * @param __HANDLE__ : DMA handle.
  801. * @param __INTERRUPT__ : Specifies the DMA interrupt sources to be enabled.
  802. * This parameter can be any combination of the following values:
  803. * @arg DMA_IT_TC : Transfer Complete interrupt.
  804. * @arg DMA_IT_HT : Half Transfer Complete interrupt.
  805. * @arg DMA_IT_DTE : Data Transfer Error interrupt.
  806. * @arg DMA_IT_ULE : Update Linked-List Error interrupt.
  807. * @arg DMA_IT_USE : User Setting Error interrupt.
  808. * @arg DMA_IT_TO : Trigger Overrun interrupt.
  809. * @arg DMA_IT_SUSP : Completed Suspension interrupt.
  810. * @retval None
  811. */
  812. #define __HAL_DMA_ENABLE_IT(__HANDLE__, __INTERRUPT__) \
  813. ((__HANDLE__)->Instance->CCR |= (__INTERRUPT__))
  814. /**
  815. * @brief Disable the specified DMA Channel interrupts.
  816. * @param __HANDLE__ : DMA handle.
  817. * @param __INTERRUPT__ : specifies the DMA interrupt sources to be disabled.
  818. * This parameter can be any combination of the following values:
  819. * @arg DMA_IT_TC : Transfer Complete interrupt.
  820. * @arg DMA_IT_HT : Half Transfer Complete interrupt.
  821. * @arg DMA_IT_DTE : Data Transfer Error interrupt.
  822. * @arg DMA_IT_ULE : Update Linked-List Error interrupt.
  823. * @arg DMA_IT_USE : User Setting Error interrupt.
  824. * @arg DMA_IT_TO : Trigger Overrun interrupt.
  825. * @arg DMA_IT_SUSP : Completed Suspension interrupt.
  826. * @retval None
  827. */
  828. #define __HAL_DMA_DISABLE_IT(__HANDLE__, __INTERRUPT__) \
  829. ((__HANDLE__)->Instance->CCR &= ~(__INTERRUPT__))
  830. /**
  831. * @brief Checks whether the specified DMA Channel interrupt is enabled or not.
  832. * @param __HANDLE__ : DMA handle.
  833. * @param __INTERRUPT__ : specifies the DMA interrupt source to check.
  834. * @arg DMA_IT_TC : Transfer Complete interrupt.
  835. * @arg DMA_IT_HT : Half Transfer Complete interrupt.
  836. * @arg DMA_IT_DTE : Data Transfer Error interrupt.
  837. * @arg DMA_IT_ULE : Update Linked-List Error interrupt.
  838. * @arg DMA_IT_USE : User Setting Error interrupt.
  839. * @arg DMA_IT_TO : Trigger Overrun interrupt.
  840. * @arg DMA_IT_SUSP : Completed Suspension interrupt.
  841. * @retval The state of DMA_IT (SET or RESET).
  842. */
  843. #define __HAL_DMA_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) \
  844. (((__HANDLE__)->Instance->CCR & (__INTERRUPT__)))
  845. /**
  846. * @brief Writes the block number of bytes to be transferred from the source on the DMA Channel.
  847. * @param __HANDLE__ : DMA handle.
  848. * @param __COUNTER__ : Number of data bytes to be transferred from the source (from 0 to 65535).
  849. */
  850. #define __HAL_DMA_SET_COUNTER(__HANDLE__, __COUNTER__) \
  851. MODIFY_REG((__HANDLE__)->Instance->CBR1, DMA_CBR1_BNDT, (__COUNTER__))
  852. /**
  853. * @brief Returns the number of remaining data bytes in the current DMA Channel transfer.
  854. * @param __HANDLE__ : DMA handle.
  855. * @retval The number of remaining data units in the current DMA Stream transfer.
  856. */
  857. #define __HAL_DMA_GET_COUNTER(__HANDLE__) \
  858. (((__HANDLE__)->Instance->CBR1) & DMA_CBR1_BNDT)
  859. /**
  860. * @}
  861. */
  862. /* Include DMA HAL Extension module */
  863. #include "stm32h5xx_hal_dma_ex.h"
  864. /* Exported functions ------------------------------------------------------------------------------------------------*/
  865. /** @defgroup DMA_Exported_Functions DMA Exported Functions
  866. * @brief DMA Exported Functions
  867. * @{
  868. */
  869. /** @defgroup DMA_Exported_Functions_Group1 Initialization and De-Initialization Functions
  870. * @brief Initialization and De-Initialization Functions
  871. * @{
  872. */
  873. HAL_StatusTypeDef HAL_DMA_Init(DMA_HandleTypeDef *const hdma);
  874. HAL_StatusTypeDef HAL_DMA_DeInit(DMA_HandleTypeDef *const hdma);
  875. /**
  876. * @}
  877. */
  878. /** @defgroup DMA_Exported_Functions_Group2 I/O Operation Functions
  879. * @brief I/O Operation Functions
  880. * @{
  881. */
  882. HAL_StatusTypeDef HAL_DMA_Start(DMA_HandleTypeDef *const hdma,
  883. uint32_t SrcAddress,
  884. uint32_t DstAddress,
  885. uint32_t SrcDataSize);
  886. HAL_StatusTypeDef HAL_DMA_Start_IT(DMA_HandleTypeDef *const hdma,
  887. uint32_t SrcAddress,
  888. uint32_t DstAddress,
  889. uint32_t SrcDataSize);
  890. HAL_StatusTypeDef HAL_DMA_Abort(DMA_HandleTypeDef *const hdma);
  891. HAL_StatusTypeDef HAL_DMA_Abort_IT(DMA_HandleTypeDef *const hdma);
  892. HAL_StatusTypeDef HAL_DMA_PollForTransfer(DMA_HandleTypeDef *const hdma,
  893. HAL_DMA_LevelCompleteTypeDef CompleteLevel,
  894. uint32_t Timeout);
  895. void HAL_DMA_IRQHandler(DMA_HandleTypeDef *const hdma);
  896. HAL_StatusTypeDef HAL_DMA_RegisterCallback(DMA_HandleTypeDef *const hdma,
  897. HAL_DMA_CallbackIDTypeDef CallbackID,
  898. void (*const pCallback)(DMA_HandleTypeDef *const _hdma));
  899. HAL_StatusTypeDef HAL_DMA_UnRegisterCallback(DMA_HandleTypeDef *const hdma,
  900. HAL_DMA_CallbackIDTypeDef CallbackID);
  901. /**
  902. * @}
  903. */
  904. /** @defgroup DMA_Exported_Functions_Group3 State and Error Functions
  905. * @brief State and Error Functions
  906. * @{
  907. */
  908. HAL_DMA_StateTypeDef HAL_DMA_GetState(DMA_HandleTypeDef const *const hdma);
  909. uint32_t HAL_DMA_GetError(DMA_HandleTypeDef const *const hdma);
  910. /**
  911. * @}
  912. */
  913. /** @defgroup DMA_Exported_Functions_Group4 DMA Attributes Functions
  914. * @brief DMA Attributes Functions
  915. * @{
  916. */
  917. HAL_StatusTypeDef HAL_DMA_ConfigChannelAttributes(DMA_HandleTypeDef *const hdma,
  918. uint32_t ChannelAttributes);
  919. HAL_StatusTypeDef HAL_DMA_GetConfigChannelAttributes(DMA_HandleTypeDef const *const hdma,
  920. uint32_t *const pChannelAttributes);
  921. #if defined (DMA_RCFGLOCKR_LOCK0)
  922. #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
  923. HAL_StatusTypeDef HAL_DMA_LockChannelAttributes(DMA_HandleTypeDef const *const hdma);
  924. #endif /* (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
  925. HAL_StatusTypeDef HAL_DMA_GetLockChannelAttributes(DMA_HandleTypeDef const *const hdma,
  926. uint32_t *const pLockState);
  927. #endif /* DMA_RCFGLOCKR_LOCK0 */
  928. /**
  929. * @}
  930. */
  931. /**
  932. * @}
  933. */
  934. /* Private constants -------------------------------------------------------------------------------------------------*/
  935. /** @defgroup DMA_Private_Constants DMA Private Constants
  936. * @brief DMA Private Constants
  937. * @{
  938. */
  939. #define HAL_TIMEOUT_DMA_ABORT (0x00000005U) /* DMA channel abort timeout 5 milli-second */
  940. #define HAL_DMA_CHANNEL_START (0x00000050U) /* DMA channel offset */
  941. #define HAL_DMA_CHANNEL_SIZE (0x00000080U) /* DMA channel size */
  942. #define HAL_DMA_OFFSET_MASK (0x00000FFFU) /* DMA channel offset mask */
  943. #define DMA_CHANNEL_ATTR_PRIV_MASK (0x00000010U) /* DMA channel privilege mask */
  944. #define DMA_CHANNEL_ATTR_SEC_MASK (0x00000020U) /* DMA channel secure mask */
  945. #define DMA_CHANNEL_ATTR_SEC_SRC_MASK (0x00000040U) /* DMA channel source secure mask */
  946. #define DMA_CHANNEL_ATTR_SEC_DEST_MASK (0x00000080U) /* DMA channel destination secure mask */
  947. #define DMA_CHANNEL_ATTR_VALUE_MASK (0x0000000FU) /* DMA channel attributes value mask */
  948. #define DMA_CHANNEL_ATTR_ITEM_MASK (0x000000F0U) /* DMA channel attributes item mask */
  949. #define DMA_CHANNEL_BURST_MIN (0x00000001U) /* DMA channel minimum burst size */
  950. #define DMA_CHANNEL_BURST_MAX (0x00000040U) /* DMA channel maximum burst size */
  951. /**
  952. * @}
  953. */
  954. /* Private macros ----------------------------------------------------------------------------------------------------*/
  955. /** @defgroup DMA_Private_Macros DMA Private Macros
  956. * @brief DMA Private Macros
  957. * @{
  958. */
  959. #define GET_DMA_INSTANCE(__HANDLE__) \
  960. ((DMA_TypeDef *)((uint32_t)((__HANDLE__)->Instance) & (~HAL_DMA_OFFSET_MASK)))
  961. #define GET_DMA_CHANNEL(__HANDLE__) \
  962. ((((uint32_t)((__HANDLE__)->Instance) & HAL_DMA_OFFSET_MASK) - HAL_DMA_CHANNEL_START) / HAL_DMA_CHANNEL_SIZE)
  963. #define IS_DMA_MODE(MODE) \
  964. (((MODE) == DMA_NORMAL) || \
  965. ((MODE) == DMA_PFCTRL))
  966. #define IS_DMA_DIRECTION(DIRECTION) \
  967. (((DIRECTION) == DMA_PERIPH_TO_MEMORY) || \
  968. ((DIRECTION) == DMA_MEMORY_TO_PERIPH) || \
  969. ((DIRECTION) == DMA_MEMORY_TO_MEMORY))
  970. #define IS_DMA_LEVEL_COMPLETE(LEVEL) \
  971. (((LEVEL) == HAL_DMA_FULL_TRANSFER) || \
  972. ((LEVEL) == HAL_DMA_HALF_TRANSFER))
  973. #define IS_DMA_SOURCE_INC(INC) \
  974. (((INC) == DMA_SINC_FIXED) || \
  975. ((INC) == DMA_SINC_INCREMENTED))
  976. #define IS_DMA_DESTINATION_INC(INC) \
  977. (((INC) == DMA_DINC_FIXED) || \
  978. ((INC) == DMA_DINC_INCREMENTED))
  979. #define IS_DMA_SOURCE_DATA_WIDTH(WIDTH) \
  980. (((WIDTH) == DMA_SRC_DATAWIDTH_BYTE) || \
  981. ((WIDTH) == DMA_SRC_DATAWIDTH_HALFWORD) || \
  982. ((WIDTH) == DMA_SRC_DATAWIDTH_WORD))
  983. #define IS_DMA_DESTINATION_DATA_WIDTH(WIDTH) \
  984. (((WIDTH) == DMA_DEST_DATAWIDTH_BYTE) || \
  985. ((WIDTH) == DMA_DEST_DATAWIDTH_HALFWORD) || \
  986. ((WIDTH) == DMA_DEST_DATAWIDTH_WORD))
  987. #define IS_DMA_BURST_LENGTH(LENGTH) \
  988. (((LENGTH) >= DMA_CHANNEL_BURST_MIN) && \
  989. ((LENGTH) <= DMA_CHANNEL_BURST_MAX))
  990. #define IS_DMA_PRIORITY(PRIORITY) \
  991. (((PRIORITY) == DMA_LOW_PRIORITY_LOW_WEIGHT) || \
  992. ((PRIORITY) == DMA_LOW_PRIORITY_MID_WEIGHT) || \
  993. ((PRIORITY) == DMA_LOW_PRIORITY_HIGH_WEIGHT) || \
  994. ((PRIORITY) == DMA_HIGH_PRIORITY))
  995. #define IS_DMA_TRANSFER_ALLOCATED_PORT(ALLOCATED_PORT) \
  996. (((ALLOCATED_PORT) & (~(DMA_CTR1_SAP | DMA_CTR1_DAP))) == 0U)
  997. #if defined (I3C2)
  998. #define IS_DMA_REQUEST(REQUEST) (((REQUEST) == DMA_REQUEST_SW) || ((REQUEST) <= GPDMA1_REQUEST_I3C2_RS))
  999. #else
  1000. #define IS_DMA_REQUEST(REQUEST) (((REQUEST) == DMA_REQUEST_SW) || ((REQUEST) <= GPDMA1_REQUEST_LPTIM6_UE))
  1001. #endif /* I3C2 */
  1002. #define IS_DMA_BLOCK_HW_REQUEST(MODE) \
  1003. (((MODE) == DMA_BREQ_SINGLE_BURST) || \
  1004. ((MODE) == DMA_BREQ_BLOCK))
  1005. #define IS_DMA_TCEM_EVENT_MODE(MODE) \
  1006. (((MODE) == DMA_TCEM_BLOCK_TRANSFER) || \
  1007. ((MODE) == DMA_TCEM_REPEATED_BLOCK_TRANSFER) || \
  1008. ((MODE) == DMA_TCEM_EACH_LL_ITEM_TRANSFER) || \
  1009. ((MODE) == DMA_TCEM_LAST_LL_ITEM_TRANSFER))
  1010. #define IS_DMA_BLOCK_SIZE(SIZE) \
  1011. (((SIZE) > 0U) && ((SIZE) <= DMA_CBR1_BNDT))
  1012. #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
  1013. #define IS_DMA_ATTRIBUTES(ATTRIBUTE) \
  1014. (((ATTRIBUTE) != 0U) && (((ATTRIBUTE) & (~(DMA_CHANNEL_ATTR_VALUE_MASK | DMA_CHANNEL_ATTR_ITEM_MASK))) == 0U) && \
  1015. (((((ATTRIBUTE) & DMA_CHANNEL_ATTR_ITEM_MASK) >> 4U) | ((ATTRIBUTE) & DMA_CHANNEL_ATTR_VALUE_MASK)) == \
  1016. (((ATTRIBUTE) & DMA_CHANNEL_ATTR_ITEM_MASK) >> 4U)))
  1017. #else
  1018. #define IS_DMA_ATTRIBUTES(ATTRIBUTE) \
  1019. (((ATTRIBUTE) == DMA_CHANNEL_PRIV) || \
  1020. ((ATTRIBUTE) == DMA_CHANNEL_NPRIV))
  1021. #endif /* (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
  1022. #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
  1023. #define IS_DMA_GLOBAL_ACTIVE_FLAG_S(INSTANCE, GLOBAL_FLAG) \
  1024. (((INSTANCE)->SMISR & (GLOBAL_FLAG)))
  1025. #endif /* (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
  1026. #define IS_DMA_GLOBAL_ACTIVE_FLAG_NS(INSTANCE, GLOBAL_FLAG) \
  1027. (((INSTANCE)->MISR & (GLOBAL_FLAG)))
  1028. /**
  1029. * @}
  1030. */
  1031. /* Private functions -------------------------------------------------------------------------------------------------*/
  1032. /** @defgroup DMA_Private_Functions DMA Private Functions
  1033. * @brief DMA Private Functions
  1034. * @{
  1035. */
  1036. /**
  1037. * @}
  1038. */
  1039. /**
  1040. * @}
  1041. */
  1042. /**
  1043. * @}
  1044. */
  1045. /**
  1046. * @}
  1047. */
  1048. #ifdef __cplusplus
  1049. }
  1050. #endif
  1051. #endif /* STM32H5xx_HAL_DMA_H */