stm32h7xx_hal_mdma.h 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868
  1. /**
  2. ******************************************************************************
  3. * @file stm32h7xx_hal_mdma.h
  4. * @author MCD Application Team
  5. * @brief Header file of DMA HAL module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * Copyright (c) 2017 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 STM32H7xx_HAL_MDMA_H
  20. #define STM32H7xx_HAL_MDMA_H
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. /* Includes ------------------------------------------------------------------*/
  25. #include "stm32h7xx_hal_def.h"
  26. /** @addtogroup STM32H7xx_HAL_Driver
  27. * @{
  28. */
  29. /** @addtogroup MDMA
  30. * @{
  31. */
  32. /* Exported types ------------------------------------------------------------*/
  33. /** @defgroup MDMA_Exported_Types MDMA Exported Types
  34. * @brief MDMA Exported Types
  35. * @{
  36. */
  37. /**
  38. * @brief MDMA Configuration Structure definition
  39. */
  40. typedef struct
  41. {
  42. uint32_t Request; /*!< Specifies the MDMA request.
  43. This parameter can be a value of @ref MDMA_Request_selection*/
  44. uint32_t TransferTriggerMode; /*!< Specifies the Trigger Transfer mode : each request triggers a :
  45. a buffer transfer, a block transfer, a repeated block transfer or a linked list transfer
  46. This parameter can be a value of @ref MDMA_Transfer_TriggerMode */
  47. uint32_t Priority; /*!< Specifies the software priority for the MDMAy channelx.
  48. This parameter can be a value of @ref MDMA_Priority_level */
  49. uint32_t Endianness; /*!< Specifies if the MDMA transactions preserve the Little endianness.
  50. This parameter can be a value of @ref MDMA_Endianness */
  51. uint32_t SourceInc; /*!< Specifies if the Source increment mode .
  52. This parameter can be a value of @ref MDMA_Source_increment_mode */
  53. uint32_t DestinationInc; /*!< Specifies if the Destination increment mode .
  54. This parameter can be a value of @ref MDMA_Destination_increment_mode */
  55. uint32_t SourceDataSize; /*!< Specifies the source data size.
  56. This parameter can be a value of @ref MDMA_Source_data_size */
  57. uint32_t DestDataSize; /*!< Specifies the destination data size.
  58. This parameter can be a value of @ref MDMA_Destination_data_size */
  59. uint32_t DataAlignment; /*!< Specifies the source to destination Memory data packing/padding mode.
  60. This parameter can be a value of @ref MDMA_data_Alignment */
  61. uint32_t BufferTransferLength; /*!< Specifies the buffer Transfer Length (number of bytes),
  62. this is the number of bytes to be transferred in a single transfer (1 byte to 128 bytes)*/
  63. uint32_t SourceBurst; /*!< Specifies the Burst transfer configuration for the source memory transfers.
  64. It specifies the amount of data to be transferred in a single non interruptible
  65. transaction.
  66. This parameter can be a value of @ref MDMA_Source_burst
  67. @note : the burst may be FIXED/INCR based on SourceInc value ,
  68. the BURST must be programmed as to ensure that the burst size will be lower than than
  69. BufferTransferLength */
  70. uint32_t DestBurst; /*!< Specifies the Burst transfer configuration for the destination memory transfers.
  71. It specifies the amount of data to be transferred in a single non interruptible
  72. transaction.
  73. This parameter can be a value of @ref MDMA_Destination_burst
  74. @note : the burst may be FIXED/INCR based on DestinationInc value ,
  75. the BURST must be programmed as to ensure that the burst size will be lower than than
  76. BufferTransferLength */
  77. int32_t SourceBlockAddressOffset; /*!< this field specifies the Next block source address offset
  78. signed value : if > 0 then increment the next block source Address by offset from where the last block ends
  79. if < 0 then decrement the next block source Address by offset from where the last block ends
  80. if == 0, the next block source address starts from where the last block ends
  81. */
  82. int32_t DestBlockAddressOffset; /*!< this field specifies the Next block destination address offset
  83. signed value : if > 0 then increment the next block destination Address by offset from where the last block ends
  84. if < 0 then decrement the next block destination Address by offset from where the last block ends
  85. if == 0, the next block destination address starts from where the last block ends
  86. */
  87. }MDMA_InitTypeDef;
  88. /**
  89. * @brief HAL MDMA linked list node structure definition
  90. * @note The Linked list node allows to define a new MDMA configuration
  91. * (CTCR ,CBNDTR ,CSAR ,CDAR ,CBRUR, CLAR, CTBR, CMAR and CMDR registers).
  92. * When CLAR register is configured to a non NULL value , each time a transfer ends,
  93. * a new configuration (linked list node) is automatically loaded from the address given in CLAR register.
  94. */
  95. typedef struct
  96. {
  97. __IO uint32_t CTCR; /*!< New CTCR register configuration for the given MDMA linked list node */
  98. __IO uint32_t CBNDTR; /*!< New CBNDTR register configuration for the given MDMA linked list node */
  99. __IO uint32_t CSAR; /*!< New CSAR register configuration for the given MDMA linked list node */
  100. __IO uint32_t CDAR; /*!< New CDAR register configuration for the given MDMA linked list node */
  101. __IO uint32_t CBRUR; /*!< New CBRUR register configuration for the given MDMA linked list node */
  102. __IO uint32_t CLAR; /*!< New CLAR register configuration for the given MDMA linked list node */
  103. __IO uint32_t CTBR; /*!< New CTBR register configuration for the given MDMA linked list node */
  104. __IO uint32_t Reserved; /*!< Reserved register */
  105. __IO uint32_t CMAR; /*!< New CMAR register configuration for the given MDMA linked list node */
  106. __IO uint32_t CMDR; /*!< New CMDR register configuration for the given MDMA linked list node */
  107. }MDMA_LinkNodeTypeDef;
  108. /**
  109. * @brief HAL MDMA linked list node configuration structure definition
  110. * @note used with HAL_MDMA_LinkedList_CreateNode function
  111. */
  112. typedef struct
  113. {
  114. MDMA_InitTypeDef Init; /*!< configuration of the specified MDMA Linked List Node */
  115. uint32_t SrcAddress; /*!< The source memory address for the Linked list Node */
  116. uint32_t DstAddress; /*!< The destination memory address for the Linked list Node */
  117. uint32_t BlockDataLength; /*!< The data length of a block in bytes */
  118. uint32_t BlockCount; /*!< The number of blocks to be transferred */
  119. uint32_t PostRequestMaskAddress; /*!< specifies the address to be updated (written) with PostRequestMaskData after a request is served.
  120. PostRequestMaskAddress and PostRequestMaskData could be used to automatically clear a peripheral flag when the request is served */
  121. uint32_t PostRequestMaskData; /*!< specifies the value to be written to PostRequestMaskAddress after a request is served.
  122. PostRequestMaskAddress and PostRequestMaskData could be used to automatically clear a peripheral flag when the request is served */
  123. }MDMA_LinkNodeConfTypeDef;
  124. /**
  125. * @brief HAL MDMA State structure definition
  126. */
  127. typedef enum
  128. {
  129. HAL_MDMA_STATE_RESET = 0x00U, /*!< MDMA not yet initialized or disabled */
  130. HAL_MDMA_STATE_READY = 0x01U, /*!< MDMA initialized and ready for use */
  131. HAL_MDMA_STATE_BUSY = 0x02U, /*!< MDMA process is ongoing */
  132. HAL_MDMA_STATE_ERROR = 0x03U, /*!< MDMA error state */
  133. HAL_MDMA_STATE_ABORT = 0x04U, /*!< MDMA Abort state */
  134. }HAL_MDMA_StateTypeDef;
  135. /**
  136. * @brief HAL MDMA Level Complete structure definition
  137. */
  138. typedef enum
  139. {
  140. HAL_MDMA_FULL_TRANSFER = 0x00U, /*!< Full transfer */
  141. HAL_MDMA_BUFFER_TRANSFER = 0x01U, /*!< Buffer Transfer */
  142. HAL_MDMA_BLOCK_TRANSFER = 0x02U, /*!< Block Transfer */
  143. HAL_MDMA_REPEAT_BLOCK_TRANSFER = 0x03U /*!< repeat block Transfer */
  144. }HAL_MDMA_LevelCompleteTypeDef;
  145. /**
  146. * @brief HAL MDMA Callbacks IDs structure definition
  147. */
  148. typedef enum
  149. {
  150. HAL_MDMA_XFER_CPLT_CB_ID = 0x00U, /*!< Full transfer */
  151. HAL_MDMA_XFER_BUFFERCPLT_CB_ID = 0x01U, /*!< Buffer Transfer */
  152. HAL_MDMA_XFER_BLOCKCPLT_CB_ID = 0x02U, /*!< Block Transfer */
  153. HAL_MDMA_XFER_REPBLOCKCPLT_CB_ID = 0x03U, /*!< Repeated Block Transfer */
  154. HAL_MDMA_XFER_ERROR_CB_ID = 0x04U, /*!< Error */
  155. HAL_MDMA_XFER_ABORT_CB_ID = 0x05U, /*!< Abort */
  156. HAL_MDMA_XFER_ALL_CB_ID = 0x06U /*!< All */
  157. }HAL_MDMA_CallbackIDTypeDef;
  158. /**
  159. * @brief MDMA handle Structure definition
  160. */
  161. typedef struct __MDMA_HandleTypeDef
  162. {
  163. MDMA_Channel_TypeDef *Instance; /*!< Register base address */
  164. MDMA_InitTypeDef Init; /*!< MDMA communication parameters */
  165. HAL_LockTypeDef Lock; /*!< MDMA locking object */
  166. __IO HAL_MDMA_StateTypeDef State; /*!< MDMA transfer state */
  167. void *Parent; /*!< Parent object state */
  168. void (* XferCpltCallback)( struct __MDMA_HandleTypeDef * hmdma); /*!< MDMA transfer complete callback */
  169. void (* XferBufferCpltCallback)( struct __MDMA_HandleTypeDef * hmdma); /*!< MDMA buffer transfer complete callback */
  170. void (* XferBlockCpltCallback)( struct __MDMA_HandleTypeDef * hmdma); /*!< MDMA block transfer complete callback */
  171. void (* XferRepeatBlockCpltCallback)( struct __MDMA_HandleTypeDef * hmdma); /*!< MDMA block transfer repeat callback */
  172. void (* XferErrorCallback)( struct __MDMA_HandleTypeDef * hmdma); /*!< MDMA transfer error callback */
  173. void (* XferAbortCallback)( struct __MDMA_HandleTypeDef * hmdma); /*!< MDMA transfer Abort callback */
  174. MDMA_LinkNodeTypeDef *FirstLinkedListNodeAddress; /*!< specifies the first node address of the transfer list
  175. (after the initial node defined by the Init struct)
  176. this parameter is used internally by the MDMA driver
  177. to construct the linked list node
  178. */
  179. MDMA_LinkNodeTypeDef *LastLinkedListNodeAddress; /*!< specifies the last node address of the transfer list
  180. this parameter is used internally by the MDMA driver
  181. to construct the linked list node
  182. */
  183. uint32_t LinkedListNodeCounter; /*!< Number of nodes in the MDMA linked list */
  184. __IO uint32_t ErrorCode; /*!< MDMA Error code */
  185. } MDMA_HandleTypeDef;
  186. /**
  187. * @}
  188. */
  189. /* Exported constants --------------------------------------------------------*/
  190. /** @defgroup MDMA_Exported_Constants MDMA Exported Constants
  191. * @brief MDMA Exported constants
  192. * @{
  193. */
  194. /** @defgroup MDMA_Error_Codes MDMA Error Codes
  195. * @brief MDMA Error Codes
  196. * @{
  197. */
  198. #define HAL_MDMA_ERROR_NONE ((uint32_t)0x00000000U) /*!< No error */
  199. #define HAL_MDMA_ERROR_READ_XFER ((uint32_t)0x00000001U) /*!< Read Transfer error */
  200. #define HAL_MDMA_ERROR_WRITE_XFER ((uint32_t)0x00000002U) /*!< Write Transfer error */
  201. #define HAL_MDMA_ERROR_MASK_DATA ((uint32_t)0x00000004U) /*!< Error Mask Data error */
  202. #define HAL_MDMA_ERROR_LINKED_LIST ((uint32_t)0x00000008U) /*!< Linked list Data error */
  203. #define HAL_MDMA_ERROR_ALIGNMENT ((uint32_t)0x00000010U) /*!< Address/Size alignment error */
  204. #define HAL_MDMA_ERROR_BLOCK_SIZE ((uint32_t)0x00000020U) /*!< Block Size error */
  205. #define HAL_MDMA_ERROR_TIMEOUT ((uint32_t)0x00000040U) /*!< Timeout error */
  206. #define HAL_MDMA_ERROR_NO_XFER ((uint32_t)0x00000080U) /*!< Abort or SW trigger requested with no Xfer ongoing */
  207. #define HAL_MDMA_ERROR_BUSY ((uint32_t)0x00000100U) /*!< DeInit or SW trigger requested with Xfer ongoing */
  208. /**
  209. * @}
  210. */
  211. /** @defgroup MDMA_Request_selection MDMA Request selection
  212. * @brief MDMA_Request_selection
  213. * @{
  214. */
  215. #define MDMA_REQUEST_DMA1_Stream0_TC ((uint32_t)0x00000000U) /*!< MDMA HW request is DMA1 Stream 0 Transfer Complete Flag */
  216. #define MDMA_REQUEST_DMA1_Stream1_TC ((uint32_t)0x00000001U) /*!< MDMA HW request is DMA1 Stream 1 Transfer Complete Flag */
  217. #define MDMA_REQUEST_DMA1_Stream2_TC ((uint32_t)0x00000002U) /*!< MDMA HW request is DMA1 Stream 2 Transfer Complete Flag */
  218. #define MDMA_REQUEST_DMA1_Stream3_TC ((uint32_t)0x00000003U) /*!< MDMA HW request is DMA1 Stream 3 Transfer Complete Flag */
  219. #define MDMA_REQUEST_DMA1_Stream4_TC ((uint32_t)0x00000004U) /*!< MDMA HW request is DMA1 Stream 4 Transfer Complete Flag */
  220. #define MDMA_REQUEST_DMA1_Stream5_TC ((uint32_t)0x00000005U) /*!< MDMA HW request is DMA1 Stream 5 Transfer Complete Flag */
  221. #define MDMA_REQUEST_DMA1_Stream6_TC ((uint32_t)0x00000006U) /*!< MDMA HW request is DMA1 Stream 6 Transfer Complete Flag */
  222. #define MDMA_REQUEST_DMA1_Stream7_TC ((uint32_t)0x00000007U) /*!< MDMA HW request is DMA1 Stream 7 Transfer Complete Flag */
  223. #define MDMA_REQUEST_DMA2_Stream0_TC ((uint32_t)0x00000008U) /*!< MDMA HW request is DMA2 Stream 0 Transfer Complete Flag */
  224. #define MDMA_REQUEST_DMA2_Stream1_TC ((uint32_t)0x00000009U) /*!< MDMA HW request is DMA2 Stream 1 Transfer Complete Flag */
  225. #define MDMA_REQUEST_DMA2_Stream2_TC ((uint32_t)0x0000000AU) /*!< MDMA HW request is DMA2 Stream 2 Transfer Complete Flag */
  226. #define MDMA_REQUEST_DMA2_Stream3_TC ((uint32_t)0x0000000BU) /*!< MDMA HW request is DMA2 Stream 3 Transfer Complete Flag */
  227. #define MDMA_REQUEST_DMA2_Stream4_TC ((uint32_t)0x0000000CU) /*!< MDMA HW request is DMA2 Stream 4 Transfer Complete Flag */
  228. #define MDMA_REQUEST_DMA2_Stream5_TC ((uint32_t)0x0000000DU) /*!< MDMA HW request is DMA2 Stream 5 Transfer Complete Flag */
  229. #define MDMA_REQUEST_DMA2_Stream6_TC ((uint32_t)0x0000000EU) /*!< MDMA HW request is DMA2 Stream 6 Transfer Complete Flag */
  230. #define MDMA_REQUEST_DMA2_Stream7_TC ((uint32_t)0x0000000FU) /*!< MDMA HW request is DMA2 Stream 7 Transfer Complete Flag */
  231. #if defined (LTDC)
  232. #define MDMA_REQUEST_LTDC_LINE_IT ((uint32_t)0x00000010U) /*!< MDMA HW request is LTDC Line interrupt Flag */
  233. #endif /* LTDC */
  234. #if defined (JPEG)
  235. #define MDMA_REQUEST_JPEG_INFIFO_TH ((uint32_t)0x00000011U) /*!< MDMA HW request is JPEG Input FIFO threshold Flag */
  236. #define MDMA_REQUEST_JPEG_INFIFO_NF ((uint32_t)0x00000012U) /*!< MDMA HW request is JPEG Input FIFO not full Flag */
  237. #define MDMA_REQUEST_JPEG_OUTFIFO_TH ((uint32_t)0x00000013U) /*!< MDMA HW request is JPEG Output FIFO threshold Flag */
  238. #define MDMA_REQUEST_JPEG_OUTFIFO_NE ((uint32_t)0x00000014U) /*!< MDMA HW request is JPEG Output FIFO not empty Flag */
  239. #define MDMA_REQUEST_JPEG_END_CONVERSION ((uint32_t)0x00000015U) /*!< MDMA HW request is JPEG End of conversion Flag */
  240. #endif /* JPEG */
  241. #if defined (OCTOSPI1)
  242. #define MDMA_REQUEST_OCTOSPI1_FIFO_TH ((uint32_t)0x00000016U) /*!< MDMA HW request is OCTOSPI1 FIFO threshold Flag */
  243. #define MDMA_REQUEST_OCTOSPI1_TC ((uint32_t)0x00000017U) /*!< MDMA HW request is OCTOSPI1 Transfer complete Flag */
  244. #endif /* OCTOSPI1 */
  245. #if defined (QUADSPI)
  246. #define MDMA_REQUEST_QUADSPI_FIFO_TH ((uint32_t)0x00000016U) /*!< MDMA HW request is QSPI FIFO threshold Flag */
  247. #define MDMA_REQUEST_QUADSPI_TC ((uint32_t)0x00000017U) /*!< MDMA HW request is QSPI Transfer complete Flag */
  248. #endif /* QUADSPI */
  249. #define MDMA_REQUEST_DMA2D_CLUT_TC ((uint32_t)0x00000018U) /*!< MDMA HW request is DMA2D CLUT Transfer Complete Flag */
  250. #define MDMA_REQUEST_DMA2D_TC ((uint32_t)0x00000019U) /*!< MDMA HW request is DMA2D Transfer Complete Flag */
  251. #define MDMA_REQUEST_DMA2D_TW ((uint32_t)0x0000001AU) /*!< MDMA HW request is DMA2D Transfer Watermark Flag */
  252. #if defined (DSI)
  253. #define MDMA_REQUEST_DSI_TEARING_EFFECT ((uint32_t)0x0000001BU) /*!< MDMA HW request is DSI Tearing Effect Flag */
  254. #define MDMA_REQUEST_DSI_END_REFRESH ((uint32_t)0x0000001CU) /*!< MDMA HW request is DSI End of refresh Flag */
  255. #endif /* DSI */
  256. #define MDMA_REQUEST_SDMMC1_END_DATA ((uint32_t)0x0000001DU) /*!< MDMA HW request is SDMMC1 End of Data Flag */
  257. #define MDMA_REQUEST_SDMMC1_DMA_ENDBUFFER ((uint32_t)0x0000001EU) /*!< MDMA HW request is SDMMC1 Internal DMA buffer End Flag */
  258. #define MDMA_REQUEST_SDMMC1_COMMAND_END ((uint32_t)0x0000001FU) /*!< MDMA HW request is SDMMC1 Command End Flag */
  259. #if defined (OCTOSPI2)
  260. #define MDMA_REQUEST_OCTOSPI2_FIFO_TH ((uint32_t)0x00000020U) /*!< MDMA HW request is OCTOSPI2 FIFO threshold Flag */
  261. #define MDMA_REQUEST_OCTOSPI2_TC ((uint32_t)0x00000021U) /*!< MDMA HW request is OCTOSPI2 Transfer complete Flag */
  262. #endif /* OCTOSPI2 */
  263. #define MDMA_REQUEST_SW ((uint32_t)0x40000000U) /*!< MDMA SW request */
  264. /**
  265. * @}
  266. */
  267. /** @defgroup MDMA_Transfer_TriggerMode MDMA Transfer Trigger Mode
  268. * @brief MDMA Transfer Trigger Mode
  269. * @{
  270. */
  271. #define MDMA_BUFFER_TRANSFER ((uint32_t)0x00000000U) /*!< Each MDMA request (SW or HW) triggers a buffer transfer */
  272. #define MDMA_BLOCK_TRANSFER ((uint32_t)MDMA_CTCR_TRGM_0) /*!< Each MDMA request (SW or HW) triggers a block transfer */
  273. #define MDMA_REPEAT_BLOCK_TRANSFER ((uint32_t)MDMA_CTCR_TRGM_1) /*!< Each MDMA request (SW or HW) triggers a repeated block transfer */
  274. #define MDMA_FULL_TRANSFER ((uint32_t)MDMA_CTCR_TRGM) /*!< Each MDMA request (SW or HW) triggers a Full transfer or a linked list transfer if any */
  275. /**
  276. * @}
  277. */
  278. /** @defgroup MDMA_Priority_level MDMA Priority level
  279. * @brief MDMA Priority level
  280. * @{
  281. */
  282. #define MDMA_PRIORITY_LOW ((uint32_t)0x00000000U) /*!< Priority level: Low */
  283. #define MDMA_PRIORITY_MEDIUM ((uint32_t)MDMA_CCR_PL_0) /*!< Priority level: Medium */
  284. #define MDMA_PRIORITY_HIGH ((uint32_t)MDMA_CCR_PL_1) /*!< Priority level: High */
  285. #define MDMA_PRIORITY_VERY_HIGH ((uint32_t)MDMA_CCR_PL) /*!< Priority level: Very High */
  286. /**
  287. * @}
  288. */
  289. /** @defgroup MDMA_Endianness MDMA Endianness
  290. * @brief MDMA Endianness
  291. * @{
  292. */
  293. #define MDMA_LITTLE_ENDIANNESS_PRESERVE ((uint32_t)0x00000000U) /*!< little endianness preserve */
  294. #define MDMA_LITTLE_BYTE_ENDIANNESS_EXCHANGE ((uint32_t)MDMA_CCR_BEX) /*!< BYTEs endianness exchange when destination data size is > Byte */
  295. #define MDMA_LITTLE_HALFWORD_ENDIANNESS_EXCHANGE ((uint32_t)MDMA_CCR_HEX) /*!< HALF WORDs endianness exchange when destination data size is > HALF WORD */
  296. #define MDMA_LITTLE_WORD_ENDIANNESS_EXCHANGE ((uint32_t)MDMA_CCR_WEX) /*!< WORDs endianness exchange when destination data size is > DOUBLE WORD */
  297. /**
  298. * @}
  299. */
  300. /** @defgroup MDMA_Source_increment_mode MDMA Source increment mode
  301. * @brief MDMA Source increment mode
  302. * @{
  303. */
  304. #define MDMA_SRC_INC_DISABLE ((uint32_t)0x00000000U) /*!< Source address pointer is fixed */
  305. #define MDMA_SRC_INC_BYTE ((uint32_t)MDMA_CTCR_SINC_1) /*!< Source address pointer is incremented by a BYTE (8 bits) */
  306. #define MDMA_SRC_INC_HALFWORD ((uint32_t)MDMA_CTCR_SINC_1 | (uint32_t)MDMA_CTCR_SINCOS_0) /*!< Source address pointer is incremented by a half Word (16 bits) */
  307. #define MDMA_SRC_INC_WORD ((uint32_t)MDMA_CTCR_SINC_1 | (uint32_t)MDMA_CTCR_SINCOS_1) /*!< Source address pointer is incremented by a Word (32 bits) */
  308. #define MDMA_SRC_INC_DOUBLEWORD ((uint32_t)MDMA_CTCR_SINC_1 | (uint32_t)MDMA_CTCR_SINCOS) /*!< Source address pointer is incremented by a double Word (64 bits)) */
  309. #define MDMA_SRC_DEC_BYTE ((uint32_t)MDMA_CTCR_SINC) /*!< Source address pointer is decremented by a BYTE (8 bits) */
  310. #define MDMA_SRC_DEC_HALFWORD ((uint32_t)MDMA_CTCR_SINC | (uint32_t)MDMA_CTCR_SINCOS_0) /*!< Source address pointer is decremented by a half Word (16 bits) */
  311. #define MDMA_SRC_DEC_WORD ((uint32_t)MDMA_CTCR_SINC | (uint32_t)MDMA_CTCR_SINCOS_1) /*!< Source address pointer is decremented by a Word (32 bits) */
  312. #define MDMA_SRC_DEC_DOUBLEWORD ((uint32_t)MDMA_CTCR_SINC | (uint32_t)MDMA_CTCR_SINCOS) /*!< Source address pointer is decremented by a double Word (64 bits)) */
  313. /**
  314. * @}
  315. */
  316. /** @defgroup MDMA_Destination_increment_mode MDMA Destination increment mode
  317. * @brief MDMA Destination increment mode
  318. * @{
  319. */
  320. #define MDMA_DEST_INC_DISABLE ((uint32_t)0x00000000U) /*!< Source address pointer is fixed */
  321. #define MDMA_DEST_INC_BYTE ((uint32_t)MDMA_CTCR_DINC_1) /*!< Source address pointer is incremented by a BYTE (8 bits) */
  322. #define MDMA_DEST_INC_HALFWORD ((uint32_t)MDMA_CTCR_DINC_1 | (uint32_t)MDMA_CTCR_DINCOS_0) /*!< Source address pointer is incremented by a half Word (16 bits) */
  323. #define MDMA_DEST_INC_WORD ((uint32_t)MDMA_CTCR_DINC_1 | (uint32_t)MDMA_CTCR_DINCOS_1) /*!< Source address pointer is incremented by a Word (32 bits) */
  324. #define MDMA_DEST_INC_DOUBLEWORD ((uint32_t)MDMA_CTCR_DINC_1 | (uint32_t)MDMA_CTCR_DINCOS) /*!< Source address pointer is incremented by a double Word (64 bits)) */
  325. #define MDMA_DEST_DEC_BYTE ((uint32_t)MDMA_CTCR_DINC) /*!< Source address pointer is decremented by a BYTE (8 bits) */
  326. #define MDMA_DEST_DEC_HALFWORD ((uint32_t)MDMA_CTCR_DINC | (uint32_t)MDMA_CTCR_DINCOS_0) /*!< Source address pointer is decremented by a half Word (16 bits) */
  327. #define MDMA_DEST_DEC_WORD ((uint32_t)MDMA_CTCR_DINC | (uint32_t)MDMA_CTCR_DINCOS_1) /*!< Source address pointer is decremented by a Word (32 bits) */
  328. #define MDMA_DEST_DEC_DOUBLEWORD ((uint32_t)MDMA_CTCR_DINC | (uint32_t)MDMA_CTCR_DINCOS) /*!< Source address pointer is decremented by a double Word (64 bits)) */
  329. /**
  330. * @}
  331. */
  332. /** @defgroup MDMA_Source_data_size MDMA Source data size
  333. * @brief MDMA Source data size
  334. * @{
  335. */
  336. #define MDMA_SRC_DATASIZE_BYTE ((uint32_t)0x00000000U) /*!< Source data size is Byte */
  337. #define MDMA_SRC_DATASIZE_HALFWORD ((uint32_t)MDMA_CTCR_SSIZE_0) /*!< Source data size is half word */
  338. #define MDMA_SRC_DATASIZE_WORD ((uint32_t)MDMA_CTCR_SSIZE_1) /*!< Source data size is word */
  339. #define MDMA_SRC_DATASIZE_DOUBLEWORD ((uint32_t)MDMA_CTCR_SSIZE) /*!< Source data size is double word */
  340. /**
  341. * @}
  342. */
  343. /** @defgroup MDMA_Destination_data_size MDMA Destination data size
  344. * @brief MDMA Destination data size
  345. * @{
  346. */
  347. #define MDMA_DEST_DATASIZE_BYTE ((uint32_t)0x00000000U) /*!< Destination data size is Byte */
  348. #define MDMA_DEST_DATASIZE_HALFWORD ((uint32_t)MDMA_CTCR_DSIZE_0) /*!< Destination data size is half word */
  349. #define MDMA_DEST_DATASIZE_WORD ((uint32_t)MDMA_CTCR_DSIZE_1) /*!< Destination data size is word */
  350. #define MDMA_DEST_DATASIZE_DOUBLEWORD ((uint32_t)MDMA_CTCR_DSIZE) /*!< Destination data size is double word */
  351. /**
  352. * @}
  353. */
  354. /** @defgroup MDMA_data_Alignment MDMA data alignment
  355. * @brief MDMA data alignment
  356. * @{
  357. */
  358. #define MDMA_DATAALIGN_PACKENABLE ((uint32_t)MDMA_CTCR_PKE) /*!< The source data is packed/un-packed into the destination data size
  359. All data are right aligned, in Little Endien mode. */
  360. #define MDMA_DATAALIGN_RIGHT ((uint32_t)0x00000000U) /*!< Right Aligned, padded w/ 0s (default) */
  361. #define MDMA_DATAALIGN_RIGHT_SIGNED ((uint32_t)MDMA_CTCR_PAM_0) /*!< Right Aligned, Sign extended ,
  362. Note : this mode is allowed only if the Source data size is smaller than Destination data size */
  363. #define MDMA_DATAALIGN_LEFT ((uint32_t)MDMA_CTCR_PAM_1) /*!< Left Aligned (padded with 0s) */
  364. /**
  365. * @}
  366. */
  367. /** @defgroup MDMA_Source_burst MDMA Source burst
  368. * @brief MDMA Source burst
  369. * @{
  370. */
  371. #define MDMA_SOURCE_BURST_SINGLE ((uint32_t)0x00000000U) /*!< single transfer */
  372. #define MDMA_SOURCE_BURST_2BEATS ((uint32_t)MDMA_CTCR_SBURST_0) /*!< Burst 2 beats */
  373. #define MDMA_SOURCE_BURST_4BEATS ((uint32_t)MDMA_CTCR_SBURST_1) /*!< Burst 4 beats */
  374. #define MDMA_SOURCE_BURST_8BEATS ((uint32_t)MDMA_CTCR_SBURST_0 | (uint32_t)MDMA_CTCR_SBURST_1) /*!< Burst 8 beats */
  375. #define MDMA_SOURCE_BURST_16BEATS ((uint32_t)MDMA_CTCR_SBURST_2) /*!< Burst 16 beats */
  376. #define MDMA_SOURCE_BURST_32BEATS ((uint32_t)MDMA_CTCR_SBURST_0 | (uint32_t)MDMA_CTCR_SBURST_2) /*!< Burst 32 beats */
  377. #define MDMA_SOURCE_BURST_64BEATS ((uint32_t)MDMA_CTCR_SBURST_1 | (uint32_t)MDMA_CTCR_SBURST_2) /*!< Burst 64 beats */
  378. #define MDMA_SOURCE_BURST_128BEATS ((uint32_t)MDMA_CTCR_SBURST) /*!< Burst 128 beats */
  379. /**
  380. * @}
  381. */
  382. /** @defgroup MDMA_Destination_burst MDMA Destination burst
  383. * @brief MDMA Destination burst
  384. * @{
  385. */
  386. #define MDMA_DEST_BURST_SINGLE ((uint32_t)0x00000000U) /*!< single transfer */
  387. #define MDMA_DEST_BURST_2BEATS ((uint32_t)MDMA_CTCR_DBURST_0) /*!< Burst 2 beats */
  388. #define MDMA_DEST_BURST_4BEATS ((uint32_t)MDMA_CTCR_DBURST_1) /*!< Burst 4 beats */
  389. #define MDMA_DEST_BURST_8BEATS ((uint32_t)MDMA_CTCR_DBURST_0 | (uint32_t)MDMA_CTCR_DBURST_1) /*!< Burst 8 beats */
  390. #define MDMA_DEST_BURST_16BEATS ((uint32_t)MDMA_CTCR_DBURST_2) /*!< Burst 16 beats */
  391. #define MDMA_DEST_BURST_32BEATS ((uint32_t)MDMA_CTCR_DBURST_0 | (uint32_t)MDMA_CTCR_DBURST_2) /*!< Burst 32 beats */
  392. #define MDMA_DEST_BURST_64BEATS ((uint32_t)MDMA_CTCR_DBURST_1 | (uint32_t)MDMA_CTCR_DBURST_2) /*!< Burst 64 beats */
  393. #define MDMA_DEST_BURST_128BEATS ((uint32_t)MDMA_CTCR_DBURST) /*!< Burst 128 beats */
  394. /**
  395. * @}
  396. */
  397. /** @defgroup MDMA_interrupt_enable_definitions MDMA interrupt enable definitions
  398. * @brief MDMA interrupt enable definitions
  399. * @{
  400. */
  401. #define MDMA_IT_TE ((uint32_t)MDMA_CCR_TEIE) /*!< Transfer Error interrupt */
  402. #define MDMA_IT_CTC ((uint32_t)MDMA_CCR_CTCIE) /*!< Channel Transfer Complete interrupt */
  403. #define MDMA_IT_BRT ((uint32_t)MDMA_CCR_BRTIE) /*!< Block Repeat Transfer interrupt */
  404. #define MDMA_IT_BT ((uint32_t)MDMA_CCR_BTIE) /*!< Block Transfer interrupt */
  405. #define MDMA_IT_BFTC ((uint32_t)MDMA_CCR_TCIE) /*!< Buffer Transfer Complete interrupt */
  406. /**
  407. * @}
  408. */
  409. /** @defgroup MDMA_flag_definitions MDMA flag definitions
  410. * @brief MDMA flag definitions
  411. * @{
  412. */
  413. #define MDMA_FLAG_TE ((uint32_t)MDMA_CISR_TEIF) /*!< Transfer Error flag */
  414. #define MDMA_FLAG_CTC ((uint32_t)MDMA_CISR_CTCIF) /*!< Channel Transfer Complete flag */
  415. #define MDMA_FLAG_BRT ((uint32_t)MDMA_CISR_BRTIF) /*!< Block Repeat Transfer complete flag */
  416. #define MDMA_FLAG_BT ((uint32_t)MDMA_CISR_BTIF) /*!< Block Transfer complete flag */
  417. #define MDMA_FLAG_BFTC ((uint32_t)MDMA_CISR_TCIF) /*!< BuFfer Transfer complete flag */
  418. #define MDMA_FLAG_CRQA ((uint32_t)MDMA_CISR_CRQA) /*!< Channel request Active flag */
  419. /**
  420. * @}
  421. */
  422. /**
  423. * @}
  424. */
  425. /* Exported macro ------------------------------------------------------------*/
  426. /** @defgroup MDMA_Exported_Macros MDMA Exported Macros
  427. * @{
  428. */
  429. /**
  430. * @brief Enable the specified MDMA Channel.
  431. * @param __HANDLE__: MDMA handle
  432. * @retval None
  433. */
  434. #define __HAL_MDMA_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CCR |= MDMA_CCR_EN)
  435. /**
  436. * @brief Disable the specified MDMA Channel.
  437. * @param __HANDLE__: MDMA handle
  438. * @retval None
  439. */
  440. #define __HAL_MDMA_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CCR &= ~MDMA_CCR_EN)
  441. /**
  442. * @brief Get the MDMA Channel pending flags.
  443. * @param __HANDLE__: MDMA handle
  444. * @param __FLAG__: Get the specified flag.
  445. * This parameter can be any combination of the following values:
  446. * @arg MDMA_FLAG_TE : Transfer Error flag.
  447. * @arg MDMA_FLAG_CTC : Channel Transfer Complete flag.
  448. * @arg MDMA_FLAG_BRT : Block Repeat Transfer flag.
  449. * @arg MDMA_FLAG_BT : Block Transfer complete flag.
  450. * @arg MDMA_FLAG_BFTC : BuFfer Transfer Complete flag.
  451. * @arg MDMA_FLAG_CRQA : Channel request Active flag.
  452. * @retval The state of FLAG (SET or RESET).
  453. */
  454. #define __HAL_MDMA_GET_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->CISR & (__FLAG__))
  455. /**
  456. * @brief Clear the MDMA Stream pending flags.
  457. * @param __HANDLE__: MDMA handle
  458. * @param __FLAG__: specifies the flag to clear.
  459. * This parameter can be any combination of the following values:
  460. * @arg MDMA_FLAG_TE : Transfer Error flag.
  461. * @arg MDMA_FLAG_CTC : Channel Transfer Complete flag.
  462. * @arg MDMA_FLAG_BRT : Block Repeat Transfer flag.
  463. * @arg MDMA_FLAG_BT : Block Transfer complete flag.
  464. * @arg MDMA_FLAG_BFTC : BuFfer Transfer Complete flag.
  465. * @retval None
  466. */
  467. #define __HAL_MDMA_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->CIFCR = (__FLAG__))
  468. /**
  469. * @brief Enables the specified MDMA Channel interrupts.
  470. * @param __HANDLE__: MDMA handle
  471. * @param __INTERRUPT__: specifies the DMA interrupt sources to be enabled or disabled.
  472. * This parameter can be any combination of the following values:
  473. * @arg MDMA_IT_TE : Transfer Error interrupt mask
  474. * @arg MDMA_IT_CTC : Channel Transfer Complete interrupt mask
  475. * @arg MDMA_IT_BRT : Block Repeat Transfer interrupt mask
  476. * @arg MDMA_IT_BT : Block Transfer interrupt mask
  477. * @arg MDMA_IT_BFTC : BuFfer Transfer Complete interrupt mask
  478. * @retval None
  479. */
  480. #define __HAL_MDMA_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CCR |= (__INTERRUPT__))
  481. /**
  482. * @brief Disables the specified MDMA Channel interrupts.
  483. * @param __HANDLE__: MDMA handle
  484. * @param __INTERRUPT__: specifies the MDMA interrupt sources to be enabled or disabled.
  485. * This parameter can be any combination of the following values:
  486. * @arg MDMA_IT_TE : Transfer Error interrupt mask
  487. * @arg MDMA_IT_CTC : Channel Transfer Complete interrupt mask
  488. * @arg MDMA_IT_BRT : Block Repeat Transfer interrupt mask
  489. * @arg MDMA_IT_BT : Block Transfer interrupt mask
  490. * @arg MDMA_IT_BFTC : BuFfer Transfer Complete interrupt mask
  491. * @retval None
  492. */
  493. #define __HAL_MDMA_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CCR &= ~(__INTERRUPT__))
  494. /**
  495. * @brief Checks whether the specified MDMA Channel interrupt is enabled or not.
  496. * @param __HANDLE__: MDMA handle
  497. * @param __INTERRUPT__: specifies the MDMA interrupt source to check.
  498. * @arg MDMA_IT_TE : Transfer Error interrupt mask
  499. * @arg MDMA_IT_CTC : Channel Transfer Complete interrupt mask
  500. * @arg MDMA_IT_BRT : Block Repeat Transfer interrupt mask
  501. * @arg MDMA_IT_BT : Block Transfer interrupt mask
  502. * @arg MDMA_IT_BFTC : BuFfer Transfer Complete interrupt mask
  503. * @retval The state of MDMA_IT (SET or RESET).
  504. */
  505. #define __HAL_MDMA_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CCR & (__INTERRUPT__)))
  506. /**
  507. * @brief Writes the number of data in bytes to be transferred on the MDMA Channelx.
  508. * @param __HANDLE__ : MDMA handle
  509. * @param __COUNTER__: Number of data in bytes to be transferred.
  510. * @retval None
  511. */
  512. #define __HAL_MDMA_SET_COUNTER(__HANDLE__, __COUNTER__) ((__HANDLE__)->Instance->CBNDTR |= ((__COUNTER__) & MDMA_CBNDTR_BNDT))
  513. /**
  514. * @brief Returns the number of remaining data in bytes in the current MDMA Channelx transfer.
  515. * @param __HANDLE__ : MDMA handle
  516. * @retval The number of remaining data in bytes in the current MDMA Channelx transfer.
  517. */
  518. #define __HAL_MDMA_GET_COUNTER(__HANDLE__) ((__HANDLE__)->Instance->CBNDTR & MDMA_CBNDTR_BNDT)
  519. /**
  520. * @}
  521. */
  522. /* Exported functions --------------------------------------------------------*/
  523. /** @defgroup MDMA_Exported_Functions MDMA Exported Functions
  524. * @{
  525. */
  526. /* Initialization and de-initialization functions *****************************/
  527. /** @defgroup MDMA_Exported_Functions_Group1 Initialization and de-initialization functions
  528. * @brief Initialization and de-initialization functions
  529. * @{
  530. */
  531. HAL_StatusTypeDef HAL_MDMA_Init(MDMA_HandleTypeDef *hmdma);
  532. HAL_StatusTypeDef HAL_MDMA_DeInit (MDMA_HandleTypeDef *hmdma);
  533. HAL_StatusTypeDef HAL_MDMA_ConfigPostRequestMask(MDMA_HandleTypeDef *hmdma, uint32_t MaskAddress, uint32_t MaskData);
  534. HAL_StatusTypeDef HAL_MDMA_RegisterCallback(MDMA_HandleTypeDef *hmdma, HAL_MDMA_CallbackIDTypeDef CallbackID, void (* pCallback)(MDMA_HandleTypeDef *_hmdma));
  535. HAL_StatusTypeDef HAL_MDMA_UnRegisterCallback(MDMA_HandleTypeDef *hmdma, HAL_MDMA_CallbackIDTypeDef CallbackID);
  536. /**
  537. * @}
  538. */
  539. /* Linked list operation functions ********************************************/
  540. /** @defgroup MDMA_Exported_Functions_Group2 Linked List operation functions
  541. * @brief Linked list operation functions
  542. * @{
  543. */
  544. HAL_StatusTypeDef HAL_MDMA_LinkedList_CreateNode(MDMA_LinkNodeTypeDef *pNode, MDMA_LinkNodeConfTypeDef *pNodeConfig);
  545. HAL_StatusTypeDef HAL_MDMA_LinkedList_AddNode(MDMA_HandleTypeDef *hmdma, MDMA_LinkNodeTypeDef *pNewNode, MDMA_LinkNodeTypeDef *pPrevNode);
  546. HAL_StatusTypeDef HAL_MDMA_LinkedList_RemoveNode(MDMA_HandleTypeDef *hmdma, MDMA_LinkNodeTypeDef *pNode);
  547. HAL_StatusTypeDef HAL_MDMA_LinkedList_EnableCircularMode(MDMA_HandleTypeDef *hmdma);
  548. HAL_StatusTypeDef HAL_MDMA_LinkedList_DisableCircularMode(MDMA_HandleTypeDef *hmdma);
  549. /**
  550. * @}
  551. */
  552. /* IO operation functions *****************************************************/
  553. /** @defgroup MDMA_Exported_Functions_Group3 I/O operation functions
  554. * @brief I/O operation functions
  555. * @{
  556. */
  557. HAL_StatusTypeDef HAL_MDMA_Start (MDMA_HandleTypeDef *hmdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t BlockDataLength, uint32_t BlockCount);
  558. HAL_StatusTypeDef HAL_MDMA_Start_IT(MDMA_HandleTypeDef *hmdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t BlockDataLength, uint32_t BlockCount);
  559. HAL_StatusTypeDef HAL_MDMA_Abort(MDMA_HandleTypeDef *hmdma);
  560. HAL_StatusTypeDef HAL_MDMA_Abort_IT(MDMA_HandleTypeDef *hmdma);
  561. HAL_StatusTypeDef HAL_MDMA_PollForTransfer(MDMA_HandleTypeDef *hmdma, HAL_MDMA_LevelCompleteTypeDef CompleteLevel, uint32_t Timeout);
  562. HAL_StatusTypeDef HAL_MDMA_GenerateSWRequest(MDMA_HandleTypeDef *hmdma);
  563. void HAL_MDMA_IRQHandler(MDMA_HandleTypeDef *hmdma);
  564. /**
  565. * @}
  566. */
  567. /* Peripheral State and Error functions ***************************************/
  568. /** @defgroup MDMA_Exported_Functions_Group4 Peripheral State functions
  569. * @brief Peripheral State functions
  570. * @{
  571. */
  572. HAL_MDMA_StateTypeDef HAL_MDMA_GetState(MDMA_HandleTypeDef *hmdma);
  573. uint32_t HAL_MDMA_GetError(MDMA_HandleTypeDef *hmdma);
  574. /**
  575. * @}
  576. */
  577. /**
  578. * @}
  579. */
  580. /* Private types -------------------------------------------------------------*/
  581. /** @defgroup MDMA_Private_Types MDMA Private Types
  582. * @{
  583. */
  584. /**
  585. * @}
  586. */
  587. /* Private defines -----------------------------------------------------------*/
  588. /** @defgroup MDMA_Private_Defines MDMA Private Defines
  589. * @{
  590. */
  591. /**
  592. * @}
  593. */
  594. /* Private variables ---------------------------------------------------------*/
  595. /** @defgroup MDMA_Private_Variables MDMA Private Variables
  596. * @{
  597. */
  598. /**
  599. * @}
  600. */
  601. /* Private constants ---------------------------------------------------------*/
  602. /** @defgroup MDMA_Private_Constants MDMA Private Constants
  603. * @{
  604. */
  605. /**
  606. * @}
  607. */
  608. /* Private macros ------------------------------------------------------------*/
  609. /** @defgroup MDMA_Private_Macros MDMA Private Macros
  610. * @{
  611. */
  612. #define IS_MDMA_LEVEL_COMPLETE(__LEVEL__) (((__LEVEL__) == HAL_MDMA_FULL_TRANSFER ) || \
  613. ((__LEVEL__) == HAL_MDMA_BUFFER_TRANSFER )|| \
  614. ((__LEVEL__) == HAL_MDMA_BLOCK_TRANSFER ) || \
  615. ((__LEVEL__) == HAL_MDMA_REPEAT_BLOCK_TRANSFER ))
  616. #define IS_MDMA_PRIORITY(__PRIORITY__) (((__PRIORITY__) == MDMA_PRIORITY_LOW ) || \
  617. ((__PRIORITY__) == MDMA_PRIORITY_MEDIUM) || \
  618. ((__PRIORITY__) == MDMA_PRIORITY_HIGH) || \
  619. ((__PRIORITY__) == MDMA_PRIORITY_VERY_HIGH))
  620. #define IS_MDMA_ENDIANNESS_MODE(__ENDIANNESS__) (((__ENDIANNESS__) == MDMA_LITTLE_ENDIANNESS_PRESERVE ) || \
  621. ((__ENDIANNESS__) == MDMA_LITTLE_BYTE_ENDIANNESS_EXCHANGE) || \
  622. ((__ENDIANNESS__) == MDMA_LITTLE_HALFWORD_ENDIANNESS_EXCHANGE) || \
  623. ((__ENDIANNESS__) == MDMA_LITTLE_WORD_ENDIANNESS_EXCHANGE))
  624. #if defined (OCTOSPI2)
  625. #define IS_MDMA_REQUEST(__REQUEST__) (((__REQUEST__) == MDMA_REQUEST_SW ) || ((__REQUEST__) <= MDMA_REQUEST_OCTOSPI2_TC))
  626. #else
  627. #define IS_MDMA_REQUEST(__REQUEST__) (((__REQUEST__) == MDMA_REQUEST_SW ) || ((__REQUEST__) <= MDMA_REQUEST_SDMMC1_COMMAND_END))
  628. #endif /* OCTOSPI2 */
  629. #define IS_MDMA_SOURCE_INC(__INC__) (((__INC__) == MDMA_SRC_INC_DISABLE ) || \
  630. ((__INC__) == MDMA_SRC_INC_BYTE ) || \
  631. ((__INC__) == MDMA_SRC_INC_HALFWORD ) || \
  632. ((__INC__) == MDMA_SRC_INC_WORD ) || \
  633. ((__INC__) == MDMA_SRC_INC_DOUBLEWORD) || \
  634. ((__INC__) == MDMA_SRC_DEC_BYTE) || \
  635. ((__INC__) == MDMA_SRC_DEC_HALFWORD) || \
  636. ((__INC__) == MDMA_SRC_DEC_WORD) || \
  637. ((__INC__) == MDMA_SRC_DEC_DOUBLEWORD))
  638. #define IS_MDMA_DESTINATION_INC(__INC__) (((__INC__) == MDMA_DEST_INC_DISABLE ) || \
  639. ((__INC__) == MDMA_DEST_INC_BYTE ) || \
  640. ((__INC__) == MDMA_DEST_INC_HALFWORD ) || \
  641. ((__INC__) == MDMA_DEST_INC_WORD ) || \
  642. ((__INC__) == MDMA_DEST_INC_DOUBLEWORD) || \
  643. ((__INC__) == MDMA_DEST_DEC_BYTE) || \
  644. ((__INC__) == MDMA_DEST_DEC_HALFWORD) || \
  645. ((__INC__) == MDMA_DEST_DEC_WORD) || \
  646. ((__INC__) == MDMA_DEST_DEC_DOUBLEWORD))
  647. #define IS_MDMA_SOURCE_DATASIZE(__SIZE__) (((__SIZE__) == MDMA_SRC_DATASIZE_BYTE ) || \
  648. ((__SIZE__) == MDMA_SRC_DATASIZE_HALFWORD ) || \
  649. ((__SIZE__) == MDMA_SRC_DATASIZE_WORD ) || \
  650. ((__SIZE__) == MDMA_SRC_DATASIZE_DOUBLEWORD))
  651. #define IS_MDMA_DESTINATION_DATASIZE(__SIZE__) (((__SIZE__) == MDMA_DEST_DATASIZE_BYTE ) || \
  652. ((__SIZE__) == MDMA_DEST_DATASIZE_HALFWORD ) || \
  653. ((__SIZE__) == MDMA_DEST_DATASIZE_WORD ) || \
  654. ((__SIZE__) == MDMA_DEST_DATASIZE_DOUBLEWORD))
  655. #define IS_MDMA_DATA_ALIGNMENT(__ALIGNMENT__) (((__ALIGNMENT__) == MDMA_DATAALIGN_PACKENABLE ) || \
  656. ((__ALIGNMENT__) == MDMA_DATAALIGN_RIGHT ) || \
  657. ((__ALIGNMENT__) == MDMA_DATAALIGN_RIGHT_SIGNED ) || \
  658. ((__ALIGNMENT__) == MDMA_DATAALIGN_LEFT))
  659. #define IS_MDMA_SOURCE_BURST(__BURST__) (((__BURST__) == MDMA_SOURCE_BURST_SINGLE ) || \
  660. ((__BURST__) == MDMA_SOURCE_BURST_2BEATS ) || \
  661. ((__BURST__) == MDMA_SOURCE_BURST_4BEATS ) || \
  662. ((__BURST__) == MDMA_SOURCE_BURST_8BEATS) || \
  663. ((__BURST__) == MDMA_SOURCE_BURST_16BEATS) || \
  664. ((__BURST__) == MDMA_SOURCE_BURST_32BEATS) || \
  665. ((__BURST__) == MDMA_SOURCE_BURST_64BEATS) || \
  666. ((__BURST__) == MDMA_SOURCE_BURST_128BEATS))
  667. #define IS_MDMA_DESTINATION_BURST(__BURST__) (((__BURST__) == MDMA_DEST_BURST_SINGLE ) || \
  668. ((__BURST__) == MDMA_DEST_BURST_2BEATS ) || \
  669. ((__BURST__) == MDMA_DEST_BURST_4BEATS ) || \
  670. ((__BURST__) == MDMA_DEST_BURST_8BEATS) || \
  671. ((__BURST__) == MDMA_DEST_BURST_16BEATS) || \
  672. ((__BURST__) == MDMA_DEST_BURST_32BEATS) || \
  673. ((__BURST__) == MDMA_DEST_BURST_64BEATS) || \
  674. ((__BURST__) == MDMA_DEST_BURST_128BEATS))
  675. #define IS_MDMA_TRANSFER_TRIGGER_MODE(__MODE__) (((__MODE__) == MDMA_BUFFER_TRANSFER ) || \
  676. ((__MODE__) == MDMA_BLOCK_TRANSFER ) || \
  677. ((__MODE__) == MDMA_REPEAT_BLOCK_TRANSFER ) || \
  678. ((__MODE__) == MDMA_FULL_TRANSFER))
  679. #define IS_MDMA_BUFFER_TRANSFER_LENGTH(__LENGTH__) (((__LENGTH__) >= 0x00000001U) && ((__LENGTH__) < 0x000000FFU))
  680. #define IS_MDMA_BLOCK_COUNT(__COUNT__) (((__COUNT__) > 0U ) && ((__COUNT__) <= 4096U))
  681. #define IS_MDMA_TRANSFER_LENGTH(SIZE) (((SIZE) > 0U) && ((SIZE) <= 65536U))
  682. #define IS_MDMA_BLOCK_ADDR_OFFSET(__BLOCK_ADD_OFFSET__) (((__BLOCK_ADD_OFFSET__) > (-65536)) && ((__BLOCK_ADD_OFFSET__) < 65536))
  683. /**
  684. * @}
  685. */
  686. /* Private functions prototypes ----------------------------------------------*/
  687. /** @defgroup MDMA_Private_Functions_Prototypes MDMA Private Functions Prototypes
  688. * @{
  689. */
  690. /**
  691. * @}
  692. */
  693. /* Private functions ---------------------------------------------------------*/
  694. /** @defgroup MDMA_Private_Functions MDMA Private Functions
  695. * @{
  696. */
  697. /**
  698. * @}
  699. */
  700. /**
  701. * @}
  702. */
  703. /**
  704. * @}
  705. */
  706. #ifdef __cplusplus
  707. }
  708. #endif
  709. #endif /* STM32H7xx_HAL_MDMA_H */