stm32f7xx_hal_dma2d.h 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636
  1. /**
  2. ******************************************************************************
  3. * @file stm32f7xx_hal_dma2d.h
  4. * @author MCD Application Team
  5. * @brief Header file of DMA2D HAL module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
  10. *
  11. * Redistribution and use in source and binary forms, with or without modification,
  12. * are permitted provided that the following conditions are met:
  13. * 1. Redistributions of source code must retain the above copyright notice,
  14. * this list of conditions and the following disclaimer.
  15. * 2. Redistributions in binary form must reproduce the above copyright notice,
  16. * this list of conditions and the following disclaimer in the documentation
  17. * and/or other materials provided with the distribution.
  18. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  19. * may be used to endorse or promote products derived from this software
  20. * without specific prior written permission.
  21. *
  22. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  23. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  24. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  25. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  26. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  27. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  28. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  29. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  30. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  31. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. *
  33. ******************************************************************************
  34. */
  35. /* Define to prevent recursive inclusion -------------------------------------*/
  36. #ifndef __STM32F7xx_HAL_DMA2D_H
  37. #define __STM32F7xx_HAL_DMA2D_H
  38. #ifdef __cplusplus
  39. extern "C" {
  40. #endif
  41. /* Includes ------------------------------------------------------------------*/
  42. #include "stm32f7xx_hal_def.h"
  43. #if defined (DMA2D)
  44. /** @addtogroup STM32F7xx_HAL_Driver
  45. * @{
  46. */
  47. /** @addtogroup DMA2D DMA2D
  48. * @brief DMA2D HAL module driver
  49. * @{
  50. */
  51. /* Exported types ------------------------------------------------------------*/
  52. /** @defgroup DMA2D_Exported_Types DMA2D Exported Types
  53. * @{
  54. */
  55. #define MAX_DMA2D_LAYER 2
  56. /**
  57. * @brief DMA2D color Structure definition
  58. */
  59. typedef struct
  60. {
  61. uint32_t Blue; /*!< Configures the blue value.
  62. This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF. */
  63. uint32_t Green; /*!< Configures the green value.
  64. This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF. */
  65. uint32_t Red; /*!< Configures the red value.
  66. This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF. */
  67. } DMA2D_ColorTypeDef;
  68. /**
  69. * @brief DMA2D CLUT Structure definition
  70. */
  71. typedef struct
  72. {
  73. uint32_t *pCLUT; /*!< Configures the DMA2D CLUT memory address.*/
  74. uint32_t CLUTColorMode; /*!< Configures the DMA2D CLUT color mode.
  75. This parameter can be one value of @ref DMA2D_CLUT_CM. */
  76. uint32_t Size; /*!< Configures the DMA2D CLUT size.
  77. This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF.*/
  78. } DMA2D_CLUTCfgTypeDef;
  79. /**
  80. * @brief DMA2D Init structure definition
  81. */
  82. typedef struct
  83. {
  84. uint32_t Mode; /*!< Configures the DMA2D transfer mode.
  85. This parameter can be one value of @ref DMA2D_Mode. */
  86. uint32_t ColorMode; /*!< Configures the color format of the output image.
  87. This parameter can be one value of @ref DMA2D_Output_Color_Mode. */
  88. uint32_t OutputOffset; /*!< Specifies the Offset value.
  89. This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0x3FFF. */
  90. #if defined (DMA2D_OPFCCR_AI)
  91. uint32_t AlphaInverted; /*!< Select regular or inverted alpha value for the output pixel format converter.
  92. This parameter can be one value of @ref DMA2D_Alpha_Inverted. */
  93. #endif /* DMA2D_OPFCCR_AI */
  94. #if defined (DMA2D_OPFCCR_RBS)
  95. uint32_t RedBlueSwap; /*!< Select regular mode (RGB or ARGB) or swap mode (BGR or ABGR)
  96. for the output pixel format converter.
  97. This parameter can be one value of @ref DMA2D_RB_Swap. */
  98. #endif /* DMA2D_OPFCCR_RBS */
  99. } DMA2D_InitTypeDef;
  100. /**
  101. * @brief DMA2D Layer structure definition
  102. */
  103. typedef struct
  104. {
  105. uint32_t InputOffset; /*!< Configures the DMA2D foreground or background offset.
  106. This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0x3FFF. */
  107. uint32_t InputColorMode; /*!< Configures the DMA2D foreground or background color mode.
  108. This parameter can be one value of @ref DMA2D_Input_Color_Mode. */
  109. uint32_t AlphaMode; /*!< Configures the DMA2D foreground or background alpha mode.
  110. This parameter can be one value of @ref DMA2D_Alpha_Mode. */
  111. uint32_t InputAlpha; /*!< Specifies the DMA2D foreground or background alpha value and color value in case of A8 or A4 color mode.
  112. This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF except for the color modes detailed below.
  113. @note In case of A8 or A4 color mode (ARGB), this parameter must be a number between
  114. Min_Data = 0x00000000 and Max_Data = 0xFFFFFFFF where
  115. - InputAlpha[24:31] is the alpha value ALPHA[0:7]
  116. - InputAlpha[16:23] is the red value RED[0:7]
  117. - InputAlpha[8:15] is the green value GREEN[0:7]
  118. - InputAlpha[0:7] is the blue value BLUE[0:7]. */
  119. #if defined (DMA2D_FGPFCCR_AI) && defined (DMA2D_BGPFCCR_AI)
  120. uint32_t AlphaInverted; /*!< Select regular or inverted alpha value.
  121. This parameter can be one value of @ref DMA2D_Alpha_Inverted.
  122. This feature is only available on devices :
  123. STM32F756xx, STM32F767xx, STM32F769xx, STM32F777xx and STM32F779xx.*/
  124. #endif /* (DMA2D_FGPFCCR_AI) && (DMA2D_BGPFCCR_AI) */
  125. #if defined (DMA2D_FGPFCCR_RBS) && defined (DMA2D_BGPFCCR_RBS)
  126. uint32_t RedBlueSwap; /*!< Select regular mode (RGB or ARGB) or swap mode (BGR or ABGR).
  127. This parameter can be one value of @ref DMA2D_RB_Swap
  128. This feature is only available on devices :
  129. STM32F756xx, STM32F767xx, STM32F769xx, STM32F777xx and STM32F779xx.*/
  130. #endif /* (DMA2D_FGPFCCR_RBS) && (DMA2D_BGPFCCR_RBS) */
  131. } DMA2D_LayerCfgTypeDef;
  132. /**
  133. * @brief HAL DMA2D State structures definition
  134. */
  135. typedef enum
  136. {
  137. HAL_DMA2D_STATE_RESET = 0x00U, /*!< DMA2D not yet initialized or disabled */
  138. HAL_DMA2D_STATE_READY = 0x01U, /*!< Peripheral Initialized and ready for use */
  139. HAL_DMA2D_STATE_BUSY = 0x02U, /*!< An internal process is ongoing */
  140. HAL_DMA2D_STATE_TIMEOUT = 0x03U, /*!< Timeout state */
  141. HAL_DMA2D_STATE_ERROR = 0x04U, /*!< DMA2D state error */
  142. HAL_DMA2D_STATE_SUSPEND = 0x05U /*!< DMA2D process is suspended */
  143. }HAL_DMA2D_StateTypeDef;
  144. /**
  145. * @brief DMA2D handle Structure definition
  146. */
  147. typedef struct __DMA2D_HandleTypeDef
  148. {
  149. DMA2D_TypeDef *Instance; /*!< DMA2D register base address. */
  150. DMA2D_InitTypeDef Init; /*!< DMA2D communication parameters. */
  151. void (* XferCpltCallback)(struct __DMA2D_HandleTypeDef * hdma2d); /*!< DMA2D transfer complete callback. */
  152. void (* XferErrorCallback)(struct __DMA2D_HandleTypeDef * hdma2d); /*!< DMA2D transfer error callback. */
  153. DMA2D_LayerCfgTypeDef LayerCfg[MAX_DMA2D_LAYER]; /*!< DMA2D Layers parameters */
  154. HAL_LockTypeDef Lock; /*!< DMA2D lock. */
  155. __IO HAL_DMA2D_StateTypeDef State; /*!< DMA2D transfer state. */
  156. __IO uint32_t ErrorCode; /*!< DMA2D error code. */
  157. } DMA2D_HandleTypeDef;
  158. /**
  159. * @}
  160. */
  161. /* Exported constants --------------------------------------------------------*/
  162. /** @defgroup DMA2D_Exported_Constants DMA2D Exported Constants
  163. * @{
  164. */
  165. /** @defgroup DMA2D_Error_Code DMA2D Error Code
  166. * @{
  167. */
  168. #define HAL_DMA2D_ERROR_NONE ((uint32_t)0x00000000U) /*!< No error */
  169. #define HAL_DMA2D_ERROR_TE ((uint32_t)0x00000001U) /*!< Transfer error */
  170. #define HAL_DMA2D_ERROR_CE ((uint32_t)0x00000002U) /*!< Configuration error */
  171. #define HAL_DMA2D_ERROR_CAE ((uint32_t)0x00000004U) /*!< CLUT access error */
  172. #define HAL_DMA2D_ERROR_TIMEOUT ((uint32_t)0x00000020U) /*!< Timeout error */
  173. /**
  174. * @}
  175. */
  176. /** @defgroup DMA2D_Mode DMA2D Mode
  177. * @{
  178. */
  179. #define DMA2D_M2M ((uint32_t)0x00000000U) /*!< DMA2D memory to memory transfer mode */
  180. #define DMA2D_M2M_PFC DMA2D_CR_MODE_0 /*!< DMA2D memory to memory with pixel format conversion transfer mode */
  181. #define DMA2D_M2M_BLEND DMA2D_CR_MODE_1 /*!< DMA2D memory to memory with blending transfer mode */
  182. #define DMA2D_R2M DMA2D_CR_MODE /*!< DMA2D register to memory transfer mode */
  183. /**
  184. * @}
  185. */
  186. /** @defgroup DMA2D_Output_Color_Mode DMA2D Output Color Mode
  187. * @{
  188. */
  189. #define DMA2D_OUTPUT_ARGB8888 ((uint32_t)0x00000000U) /*!< ARGB8888 DMA2D color mode */
  190. #define DMA2D_OUTPUT_RGB888 DMA2D_OPFCCR_CM_0 /*!< RGB888 DMA2D color mode */
  191. #define DMA2D_OUTPUT_RGB565 DMA2D_OPFCCR_CM_1 /*!< RGB565 DMA2D color mode */
  192. #define DMA2D_OUTPUT_ARGB1555 (DMA2D_OPFCCR_CM_0|DMA2D_OPFCCR_CM_1) /*!< ARGB1555 DMA2D color mode */
  193. #define DMA2D_OUTPUT_ARGB4444 DMA2D_OPFCCR_CM_2 /*!< ARGB4444 DMA2D color mode */
  194. /**
  195. * @}
  196. */
  197. /** @defgroup DMA2D_Input_Color_Mode DMA2D Input Color Mode
  198. * @{
  199. */
  200. #define DMA2D_INPUT_ARGB8888 ((uint32_t)0x00000000U) /*!< ARGB8888 color mode */
  201. #define DMA2D_INPUT_RGB888 ((uint32_t)0x00000001U) /*!< RGB888 color mode */
  202. #define DMA2D_INPUT_RGB565 ((uint32_t)0x00000002U) /*!< RGB565 color mode */
  203. #define DMA2D_INPUT_ARGB1555 ((uint32_t)0x00000003U) /*!< ARGB1555 color mode */
  204. #define DMA2D_INPUT_ARGB4444 ((uint32_t)0x00000004U) /*!< ARGB4444 color mode */
  205. #define DMA2D_INPUT_L8 ((uint32_t)0x00000005U) /*!< L8 color mode */
  206. #define DMA2D_INPUT_AL44 ((uint32_t)0x00000006U) /*!< AL44 color mode */
  207. #define DMA2D_INPUT_AL88 ((uint32_t)0x00000007U) /*!< AL88 color mode */
  208. #define DMA2D_INPUT_L4 ((uint32_t)0x00000008U) /*!< L4 color mode */
  209. #define DMA2D_INPUT_A8 ((uint32_t)0x00000009U) /*!< A8 color mode */
  210. #define DMA2D_INPUT_A4 ((uint32_t)0x0000000AU) /*!< A4 color mode */
  211. /**
  212. * @}
  213. */
  214. /** @defgroup DMA2D_Alpha_Mode DMA2D Alpha Mode
  215. * @{
  216. */
  217. #define DMA2D_NO_MODIF_ALPHA ((uint32_t)0x00000000U) /*!< No modification of the alpha channel value */
  218. #define DMA2D_REPLACE_ALPHA ((uint32_t)0x00000001U) /*!< Replace original alpha channel value by programmed alpha value */
  219. #define DMA2D_COMBINE_ALPHA ((uint32_t)0x00000002U) /*!< Replace original alpha channel value by programmed alpha value
  220. with original alpha channel value */
  221. /**
  222. * @}
  223. */
  224. #if defined (DMA2D_FGPFCCR_AI) && defined (DMA2D_BGPFCCR_AI)
  225. /** @defgroup DMA2D_Alpha_Inverted DMA2D ALPHA Inversion
  226. * @{
  227. */
  228. #define DMA2D_REGULAR_ALPHA ((uint32_t)0x00000000U) /*!< No modification of the alpha channel value */
  229. #define DMA2D_INVERTED_ALPHA ((uint32_t)0x00000001U) /*!< Invert the alpha channel value */
  230. /**
  231. * @}
  232. */
  233. #endif /* (DMA2D_FGPFCCR_AI) && (DMA2D_BGPFCCR_AI) */
  234. #if defined (DMA2D_FGPFCCR_RBS) && defined (DMA2D_BGPFCCR_RBS)
  235. /** @defgroup DMA2D_RB_Swap DMA2D Red and Blue Swap
  236. * @{
  237. */
  238. #define DMA2D_RB_REGULAR ((uint32_t)0x00000000U) /*!< Select regular mode (RGB or ARGB) */
  239. #define DMA2D_RB_SWAP ((uint32_t)0x00000001U) /*!< Select swap mode (BGR or ABGR) */
  240. /**
  241. * @}
  242. */
  243. #endif /* (DMA2D_FGPFCCR_RBS) && (DMA2D_BGPFCCR_RBS) */
  244. /** @defgroup DMA2D_CLUT_CM DMA2D CLUT Color Mode
  245. * @{
  246. */
  247. #define DMA2D_CCM_ARGB8888 ((uint32_t)0x00000000U) /*!< ARGB8888 DMA2D CLUT color mode */
  248. #define DMA2D_CCM_RGB888 ((uint32_t)0x00000001U) /*!< RGB888 DMA2D CLUT color mode */
  249. /**
  250. * @}
  251. */
  252. /** @defgroup DMA2D_Interrupts DMA2D Interrupts
  253. * @{
  254. */
  255. #define DMA2D_IT_CE DMA2D_CR_CEIE /*!< Configuration Error Interrupt */
  256. #define DMA2D_IT_CTC DMA2D_CR_CTCIE /*!< CLUT Transfer Complete Interrupt */
  257. #define DMA2D_IT_CAE DMA2D_CR_CAEIE /*!< CLUT Access Error Interrupt */
  258. #define DMA2D_IT_TW DMA2D_CR_TWIE /*!< Transfer Watermark Interrupt */
  259. #define DMA2D_IT_TC DMA2D_CR_TCIE /*!< Transfer Complete Interrupt */
  260. #define DMA2D_IT_TE DMA2D_CR_TEIE /*!< Transfer Error Interrupt */
  261. /**
  262. * @}
  263. */
  264. /** @defgroup DMA2D_Flags DMA2D Flags
  265. * @{
  266. */
  267. #define DMA2D_FLAG_CE DMA2D_ISR_CEIF /*!< Configuration Error Interrupt Flag */
  268. #define DMA2D_FLAG_CTC DMA2D_ISR_CTCIF /*!< CLUT Transfer Complete Interrupt Flag */
  269. #define DMA2D_FLAG_CAE DMA2D_ISR_CAEIF /*!< CLUT Access Error Interrupt Flag */
  270. #define DMA2D_FLAG_TW DMA2D_ISR_TWIF /*!< Transfer Watermark Interrupt Flag */
  271. #define DMA2D_FLAG_TC DMA2D_ISR_TCIF /*!< Transfer Complete Interrupt Flag */
  272. #define DMA2D_FLAG_TE DMA2D_ISR_TEIF /*!< Transfer Error Interrupt Flag */
  273. /**
  274. * @}
  275. */
  276. /** @defgroup DMA2D_Aliases DMA2D API Aliases
  277. * @{
  278. */
  279. #define HAL_DMA2D_DisableCLUT HAL_DMA2D_CLUTLoading_Abort /*!< Aliased to HAL_DMA2D_CLUTLoading_Abort for compatibility with legacy code */
  280. /**
  281. * @}
  282. */
  283. /**
  284. * @}
  285. */
  286. /* Exported macros ------------------------------------------------------------*/
  287. /** @defgroup DMA2D_Exported_Macros DMA2D Exported Macros
  288. * @{
  289. */
  290. /** @brief Reset DMA2D handle state
  291. * @param __HANDLE__ specifies the DMA2D handle.
  292. * @retval None
  293. */
  294. #define __HAL_DMA2D_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_DMA2D_STATE_RESET)
  295. /**
  296. * @brief Enable the DMA2D.
  297. * @param __HANDLE__ DMA2D handle
  298. * @retval None.
  299. */
  300. #define __HAL_DMA2D_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= DMA2D_CR_START)
  301. /* Interrupt & Flag management */
  302. /**
  303. * @brief Get the DMA2D pending flags.
  304. * @param __HANDLE__ DMA2D handle
  305. * @param __FLAG__ flag to check.
  306. * This parameter can be any combination of the following values:
  307. * @arg DMA2D_FLAG_CE: Configuration error flag
  308. * @arg DMA2D_FLAG_CTC: CLUT transfer complete flag
  309. * @arg DMA2D_FLAG_CAE: CLUT access error flag
  310. * @arg DMA2D_FLAG_TW: Transfer Watermark flag
  311. * @arg DMA2D_FLAG_TC: Transfer complete flag
  312. * @arg DMA2D_FLAG_TE: Transfer error flag
  313. * @retval The state of FLAG.
  314. */
  315. #define __HAL_DMA2D_GET_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR & (__FLAG__))
  316. /**
  317. * @brief Clear the DMA2D pending flags.
  318. * @param __HANDLE__ DMA2D handle
  319. * @param __FLAG__ specifies the flag to clear.
  320. * This parameter can be any combination of the following values:
  321. * @arg DMA2D_FLAG_CE: Configuration error flag
  322. * @arg DMA2D_FLAG_CTC: CLUT transfer complete flag
  323. * @arg DMA2D_FLAG_CAE: CLUT access error flag
  324. * @arg DMA2D_FLAG_TW: Transfer Watermark flag
  325. * @arg DMA2D_FLAG_TC: Transfer complete flag
  326. * @arg DMA2D_FLAG_TE: Transfer error flag
  327. * @retval None
  328. */
  329. #define __HAL_DMA2D_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->IFCR = (__FLAG__))
  330. /**
  331. * @brief Enable the specified DMA2D interrupts.
  332. * @param __HANDLE__ DMA2D handle
  333. * @param __INTERRUPT__ specifies the DMA2D interrupt sources to be enabled.
  334. * This parameter can be any combination of the following values:
  335. * @arg DMA2D_IT_CE: Configuration error interrupt mask
  336. * @arg DMA2D_IT_CTC: CLUT transfer complete interrupt mask
  337. * @arg DMA2D_IT_CAE: CLUT access error interrupt mask
  338. * @arg DMA2D_IT_TW: Transfer Watermark interrupt mask
  339. * @arg DMA2D_IT_TC: Transfer complete interrupt mask
  340. * @arg DMA2D_IT_TE: Transfer error interrupt mask
  341. * @retval None
  342. */
  343. #define __HAL_DMA2D_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__))
  344. /**
  345. * @brief Disable the specified DMA2D interrupts.
  346. * @param __HANDLE__ DMA2D handle
  347. * @param __INTERRUPT__ specifies the DMA2D interrupt sources to be disabled.
  348. * This parameter can be any combination of the following values:
  349. * @arg DMA2D_IT_CE: Configuration error interrupt mask
  350. * @arg DMA2D_IT_CTC: CLUT transfer complete interrupt mask
  351. * @arg DMA2D_IT_CAE: CLUT access error interrupt mask
  352. * @arg DMA2D_IT_TW: Transfer Watermark interrupt mask
  353. * @arg DMA2D_IT_TC: Transfer complete interrupt mask
  354. * @arg DMA2D_IT_TE: Transfer error interrupt mask
  355. * @retval None
  356. */
  357. #define __HAL_DMA2D_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__))
  358. /**
  359. * @brief Check whether the specified DMA2D interrupt source is enabled or not.
  360. * @param __HANDLE__ DMA2D handle
  361. * @param __INTERRUPT__ specifies the DMA2D interrupt source to check.
  362. * This parameter can be one of the following values:
  363. * @arg DMA2D_IT_CE: Configuration error interrupt mask
  364. * @arg DMA2D_IT_CTC: CLUT transfer complete interrupt mask
  365. * @arg DMA2D_IT_CAE: CLUT access error interrupt mask
  366. * @arg DMA2D_IT_TW: Transfer Watermark interrupt mask
  367. * @arg DMA2D_IT_TC: Transfer complete interrupt mask
  368. * @arg DMA2D_IT_TE: Transfer error interrupt mask
  369. * @retval The state of INTERRUPT source.
  370. */
  371. #define __HAL_DMA2D_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR & (__INTERRUPT__))
  372. /**
  373. * @}
  374. */
  375. /* Exported functions --------------------------------------------------------*/
  376. /** @addtogroup DMA2D_Exported_Functions DMA2D Exported Functions
  377. * @{
  378. */
  379. /** @addtogroup DMA2D_Exported_Functions_Group1 Initialization and de-initialization functions
  380. * @{
  381. */
  382. /* Initialization and de-initialization functions *******************************/
  383. HAL_StatusTypeDef HAL_DMA2D_Init(DMA2D_HandleTypeDef *hdma2d);
  384. HAL_StatusTypeDef HAL_DMA2D_DeInit (DMA2D_HandleTypeDef *hdma2d);
  385. void HAL_DMA2D_MspInit(DMA2D_HandleTypeDef* hdma2d);
  386. void HAL_DMA2D_MspDeInit(DMA2D_HandleTypeDef* hdma2d);
  387. /**
  388. * @}
  389. */
  390. /** @addtogroup DMA2D_Exported_Functions_Group2 IO operation functions
  391. * @{
  392. */
  393. /* IO operation functions *******************************************************/
  394. HAL_StatusTypeDef HAL_DMA2D_Start(DMA2D_HandleTypeDef *hdma2d, uint32_t pdata, uint32_t DstAddress, uint32_t Width, uint32_t Height);
  395. HAL_StatusTypeDef HAL_DMA2D_BlendingStart(DMA2D_HandleTypeDef *hdma2d, uint32_t SrcAddress1, uint32_t SrcAddress2, uint32_t DstAddress, uint32_t Width, uint32_t Height);
  396. HAL_StatusTypeDef HAL_DMA2D_Start_IT(DMA2D_HandleTypeDef *hdma2d, uint32_t pdata, uint32_t DstAddress, uint32_t Width, uint32_t Height);
  397. HAL_StatusTypeDef HAL_DMA2D_BlendingStart_IT(DMA2D_HandleTypeDef *hdma2d, uint32_t SrcAddress1, uint32_t SrcAddress2, uint32_t DstAddress, uint32_t Width, uint32_t Height);
  398. HAL_StatusTypeDef HAL_DMA2D_Suspend(DMA2D_HandleTypeDef *hdma2d);
  399. HAL_StatusTypeDef HAL_DMA2D_Resume(DMA2D_HandleTypeDef *hdma2d);
  400. HAL_StatusTypeDef HAL_DMA2D_Abort(DMA2D_HandleTypeDef *hdma2d);
  401. HAL_StatusTypeDef HAL_DMA2D_EnableCLUT(DMA2D_HandleTypeDef *hdma2d, uint32_t LayerIdx);
  402. HAL_StatusTypeDef HAL_DMA2D_CLUTLoad(DMA2D_HandleTypeDef *hdma2d, DMA2D_CLUTCfgTypeDef CLUTCfg, uint32_t LayerIdx);
  403. HAL_StatusTypeDef HAL_DMA2D_CLUTLoad_IT(DMA2D_HandleTypeDef *hdma2d, DMA2D_CLUTCfgTypeDef CLUTCfg, uint32_t LayerIdx);
  404. HAL_StatusTypeDef HAL_DMA2D_CLUTLoading_Abort(DMA2D_HandleTypeDef *hdma2d, uint32_t LayerIdx);
  405. HAL_StatusTypeDef HAL_DMA2D_CLUTLoading_Suspend(DMA2D_HandleTypeDef *hdma2d, uint32_t LayerIdx);
  406. HAL_StatusTypeDef HAL_DMA2D_CLUTLoading_Resume(DMA2D_HandleTypeDef *hdma2d, uint32_t LayerIdx);
  407. HAL_StatusTypeDef HAL_DMA2D_PollForTransfer(DMA2D_HandleTypeDef *hdma2d, uint32_t Timeout);
  408. void HAL_DMA2D_IRQHandler(DMA2D_HandleTypeDef *hdma2d);
  409. void HAL_DMA2D_LineEventCallback(DMA2D_HandleTypeDef *hdma2d);
  410. void HAL_DMA2D_CLUTLoadingCpltCallback(DMA2D_HandleTypeDef *hdma2d);
  411. /**
  412. * @}
  413. */
  414. /** @addtogroup DMA2D_Exported_Functions_Group3 Peripheral Control functions
  415. * @{
  416. */
  417. /* Peripheral Control functions *************************************************/
  418. HAL_StatusTypeDef HAL_DMA2D_ConfigLayer(DMA2D_HandleTypeDef *hdma2d, uint32_t LayerIdx);
  419. HAL_StatusTypeDef HAL_DMA2D_ConfigCLUT(DMA2D_HandleTypeDef *hdma2d, DMA2D_CLUTCfgTypeDef CLUTCfg, uint32_t LayerIdx);
  420. HAL_StatusTypeDef HAL_DMA2D_ProgramLineEvent(DMA2D_HandleTypeDef *hdma2d, uint32_t Line);
  421. HAL_StatusTypeDef HAL_DMA2D_EnableDeadTime(DMA2D_HandleTypeDef *hdma2d);
  422. HAL_StatusTypeDef HAL_DMA2D_DisableDeadTime(DMA2D_HandleTypeDef *hdma2d);
  423. HAL_StatusTypeDef HAL_DMA2D_ConfigDeadTime(DMA2D_HandleTypeDef *hdma2d, uint8_t DeadTime);
  424. /**
  425. * @}
  426. */
  427. /** @addtogroup DMA2D_Exported_Functions_Group4 Peripheral State and Error functions
  428. * @{
  429. */
  430. /* Peripheral State functions ***************************************************/
  431. HAL_DMA2D_StateTypeDef HAL_DMA2D_GetState(DMA2D_HandleTypeDef *hdma2d);
  432. uint32_t HAL_DMA2D_GetError(DMA2D_HandleTypeDef *hdma2d);
  433. /**
  434. * @}
  435. */
  436. /**
  437. * @}
  438. */
  439. /* Private constants ---------------------------------------------------------*/
  440. /** @addtogroup DMA2D_Private_Constants DMA2D Private Constants
  441. * @{
  442. */
  443. /** @defgroup DMA2D_Maximum_Line_WaterMark DMA2D Maximum Line Watermark
  444. * @{
  445. */
  446. #define DMA2D_LINE_WATERMARK_MAX DMA2D_LWR_LW /*!< DMA2D maximum line watermark */
  447. /**
  448. * @}
  449. */
  450. /** @defgroup DMA2D_Color_Value DMA2D Color Value
  451. * @{
  452. */
  453. #define DMA2D_COLOR_VALUE ((uint32_t)0x000000FFU) /*!< Color value mask */
  454. /**
  455. * @}
  456. */
  457. /** @defgroup DMA2D_Max_Layer DMA2D Maximum Number of Layers
  458. * @{
  459. */
  460. #define DMA2D_MAX_LAYER 2 /*!< DMA2D maximum number of layers */
  461. /**
  462. * @}
  463. */
  464. /** @defgroup DMA2D_Offset DMA2D Offset
  465. * @{
  466. */
  467. #define DMA2D_OFFSET DMA2D_FGOR_LO /*!< Line Offset */
  468. /**
  469. * @}
  470. */
  471. /** @defgroup DMA2D_Size DMA2D Size
  472. * @{
  473. */
  474. #define DMA2D_PIXEL (DMA2D_NLR_PL >> 16U) /*!< DMA2D number of pixels per line */
  475. #define DMA2D_LINE DMA2D_NLR_NL /*!< DMA2D number of lines */
  476. /**
  477. * @}
  478. */
  479. /** @defgroup DMA2D_CLUT_Size DMA2D CLUT Size
  480. * @{
  481. */
  482. #define DMA2D_CLUT_SIZE (DMA2D_FGPFCCR_CS >> 8) /*!< DMA2D CLUT size */
  483. /**
  484. * @}
  485. */
  486. /**
  487. * @}
  488. */
  489. /* Private macros ------------------------------------------------------------*/
  490. /** @defgroup DMA2D_Private_Macros DMA2D Private Macros
  491. * @{
  492. */
  493. #define IS_DMA2D_LAYER(LAYER) ((LAYER) <= DMA2D_MAX_LAYER)
  494. #define IS_DMA2D_MODE(MODE) (((MODE) == DMA2D_M2M) || ((MODE) == DMA2D_M2M_PFC) || \
  495. ((MODE) == DMA2D_M2M_BLEND) || ((MODE) == DMA2D_R2M))
  496. #define IS_DMA2D_CMODE(MODE_ARGB) (((MODE_ARGB) == DMA2D_OUTPUT_ARGB8888) || ((MODE_ARGB) == DMA2D_OUTPUT_RGB888) || \
  497. ((MODE_ARGB) == DMA2D_OUTPUT_RGB565) || ((MODE_ARGB) == DMA2D_OUTPUT_ARGB1555) || \
  498. ((MODE_ARGB) == DMA2D_OUTPUT_ARGB4444))
  499. #define IS_DMA2D_COLOR(COLOR) ((COLOR) <= DMA2D_COLOR_VALUE)
  500. #define IS_DMA2D_LINE(LINE) ((LINE) <= DMA2D_LINE)
  501. #define IS_DMA2D_PIXEL(PIXEL) ((PIXEL) <= DMA2D_PIXEL)
  502. #define IS_DMA2D_OFFSET(OOFFSET) ((OOFFSET) <= DMA2D_OFFSET)
  503. #define IS_DMA2D_INPUT_COLOR_MODE(INPUT_CM) (((INPUT_CM) == DMA2D_INPUT_ARGB8888) || ((INPUT_CM) == DMA2D_INPUT_RGB888) || \
  504. ((INPUT_CM) == DMA2D_INPUT_RGB565) || ((INPUT_CM) == DMA2D_INPUT_ARGB1555) || \
  505. ((INPUT_CM) == DMA2D_INPUT_ARGB4444) || ((INPUT_CM) == DMA2D_INPUT_L8) || \
  506. ((INPUT_CM) == DMA2D_INPUT_AL44) || ((INPUT_CM) == DMA2D_INPUT_AL88) || \
  507. ((INPUT_CM) == DMA2D_INPUT_L4) || ((INPUT_CM) == DMA2D_INPUT_A8) || \
  508. ((INPUT_CM) == DMA2D_INPUT_A4))
  509. #define IS_DMA2D_ALPHA_MODE(AlphaMode) (((AlphaMode) == DMA2D_NO_MODIF_ALPHA) || \
  510. ((AlphaMode) == DMA2D_REPLACE_ALPHA) || \
  511. ((AlphaMode) == DMA2D_COMBINE_ALPHA))
  512. #define IS_DMA2D_ALPHA_INVERTED(Alpha_Inverted) (((Alpha_Inverted) == DMA2D_REGULAR_ALPHA) || \
  513. ((Alpha_Inverted) == DMA2D_INVERTED_ALPHA))
  514. #define IS_DMA2D_RB_SWAP(RB_Swap) (((RB_Swap) == DMA2D_RB_REGULAR) || \
  515. ((RB_Swap) == DMA2D_RB_SWAP))
  516. #define IS_DMA2D_CLUT_CM(CLUT_CM) (((CLUT_CM) == DMA2D_CCM_ARGB8888) || ((CLUT_CM) == DMA2D_CCM_RGB888))
  517. #define IS_DMA2D_CLUT_SIZE(CLUT_SIZE) ((CLUT_SIZE) <= DMA2D_CLUT_SIZE)
  518. #define IS_DMA2D_LINEWATERMARK(LineWatermark) ((LineWatermark) <= DMA2D_LINE_WATERMARK_MAX)
  519. #define IS_DMA2D_IT(IT) (((IT) == DMA2D_IT_CTC) || ((IT) == DMA2D_IT_CAE) || \
  520. ((IT) == DMA2D_IT_TW) || ((IT) == DMA2D_IT_TC) || \
  521. ((IT) == DMA2D_IT_TE) || ((IT) == DMA2D_IT_CE))
  522. #define IS_DMA2D_GET_FLAG(FLAG) (((FLAG) == DMA2D_FLAG_CTC) || ((FLAG) == DMA2D_FLAG_CAE) || \
  523. ((FLAG) == DMA2D_FLAG_TW) || ((FLAG) == DMA2D_FLAG_TC) || \
  524. ((FLAG) == DMA2D_FLAG_TE) || ((FLAG) == DMA2D_FLAG_CE))
  525. /**
  526. * @}
  527. */
  528. /**
  529. * @}
  530. */
  531. /**
  532. * @}
  533. */
  534. #endif /* DMA2D */
  535. #ifdef __cplusplus
  536. }
  537. #endif
  538. #endif /* __STM32F7xx_HAL_DMA2D_H */
  539. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/