stm32h7xx_hal_mdma.h 46 KB

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