stm32f4xx_hal_dma2d.h 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575
  1. /**
  2. ******************************************************************************
  3. * @file stm32f4xx_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 __STM32F4xx_HAL_DMA2D_H
  37. #define __STM32F4xx_HAL_DMA2D_H
  38. #ifdef __cplusplus
  39. extern "C" {
  40. #endif
  41. #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
  42. defined(STM32F469xx) || defined(STM32F479xx)
  43. /* Includes ------------------------------------------------------------------*/
  44. #include "stm32f4xx_hal_def.h"
  45. /** @addtogroup STM32F4xx_HAL_Driver
  46. * @{
  47. */
  48. /** @addtogroup DMA2D DMA2D
  49. * @brief DMA2D HAL module driver
  50. * @{
  51. */
  52. /* Exported types ------------------------------------------------------------*/
  53. /** @defgroup DMA2D_Exported_Types DMA2D Exported Types
  54. * @{
  55. */
  56. #define MAX_DMA2D_LAYER 2U
  57. /**
  58. * @brief DMA2D color Structure definition
  59. */
  60. typedef struct
  61. {
  62. uint32_t Blue; /*!< Configures the blue value.
  63. This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF. */
  64. uint32_t Green; /*!< Configures the green value.
  65. This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF. */
  66. uint32_t Red; /*!< Configures the red value.
  67. This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF. */
  68. } DMA2D_ColorTypeDef;
  69. /**
  70. * @brief DMA2D CLUT Structure definition
  71. */
  72. typedef struct
  73. {
  74. uint32_t *pCLUT; /*!< Configures the DMA2D CLUT memory address.*/
  75. uint32_t CLUTColorMode; /*!< Configures the DMA2D CLUT color mode.
  76. This parameter can be one value of @ref DMA2D_CLUT_CM. */
  77. uint32_t Size; /*!< Configures the DMA2D CLUT size.
  78. This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF.*/
  79. } DMA2D_CLUTCfgTypeDef;
  80. /**
  81. * @brief DMA2D Init structure definition
  82. */
  83. typedef struct
  84. {
  85. uint32_t Mode; /*!< Configures the DMA2D transfer mode.
  86. This parameter can be one value of @ref DMA2D_Mode. */
  87. uint32_t ColorMode; /*!< Configures the color format of the output image.
  88. This parameter can be one value of @ref DMA2D_Output_Color_Mode. */
  89. uint32_t OutputOffset; /*!< Specifies the Offset value.
  90. This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0x3FFF. */
  91. } DMA2D_InitTypeDef;
  92. /**
  93. * @brief DMA2D Layer structure definition
  94. */
  95. typedef struct
  96. {
  97. uint32_t InputOffset; /*!< Configures the DMA2D foreground or background offset.
  98. This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0x3FFF. */
  99. uint32_t InputColorMode; /*!< Configures the DMA2D foreground or background color mode.
  100. This parameter can be one value of @ref DMA2D_Input_Color_Mode. */
  101. uint32_t AlphaMode; /*!< Configures the DMA2D foreground or background alpha mode.
  102. This parameter can be one value of @ref DMA2D_Alpha_Mode. */
  103. uint32_t InputAlpha; /*!< Specifies the DMA2D foreground or background alpha value and color value in case of A8 or A4 color mode.
  104. This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF except for the color modes detailed below.
  105. @note In case of A8 or A4 color mode (ARGB), this parameter must be a number between
  106. Min_Data = 0x00000000 and Max_Data = 0xFFFFFFFF where
  107. - InputAlpha[24:31] is the alpha value ALPHA[0:7]
  108. - InputAlpha[16:23] is the red value RED[0:7]
  109. - InputAlpha[8:15] is the green value GREEN[0:7]
  110. - InputAlpha[0:7] is the blue value BLUE[0:7]. */
  111. } DMA2D_LayerCfgTypeDef;
  112. /**
  113. * @brief HAL DMA2D State structures definition
  114. */
  115. typedef enum
  116. {
  117. HAL_DMA2D_STATE_RESET = 0x00U, /*!< DMA2D not yet initialized or disabled */
  118. HAL_DMA2D_STATE_READY = 0x01U, /*!< Peripheral Initialized and ready for use */
  119. HAL_DMA2D_STATE_BUSY = 0x02U, /*!< An internal process is ongoing */
  120. HAL_DMA2D_STATE_TIMEOUT = 0x03U, /*!< Timeout state */
  121. HAL_DMA2D_STATE_ERROR = 0x04U, /*!< DMA2D state error */
  122. HAL_DMA2D_STATE_SUSPEND = 0x05U /*!< DMA2D process is suspended */
  123. }HAL_DMA2D_StateTypeDef;
  124. /**
  125. * @brief DMA2D handle Structure definition
  126. */
  127. typedef struct __DMA2D_HandleTypeDef
  128. {
  129. DMA2D_TypeDef *Instance; /*!< DMA2D register base address. */
  130. DMA2D_InitTypeDef Init; /*!< DMA2D communication parameters. */
  131. void (* XferCpltCallback)(struct __DMA2D_HandleTypeDef * hdma2d); /*!< DMA2D transfer complete callback. */
  132. void (* XferErrorCallback)(struct __DMA2D_HandleTypeDef * hdma2d); /*!< DMA2D transfer error callback. */
  133. DMA2D_LayerCfgTypeDef LayerCfg[MAX_DMA2D_LAYER]; /*!< DMA2D Layers parameters */
  134. HAL_LockTypeDef Lock; /*!< DMA2D lock. */
  135. __IO HAL_DMA2D_StateTypeDef State; /*!< DMA2D transfer state. */
  136. __IO uint32_t ErrorCode; /*!< DMA2D error code. */
  137. } DMA2D_HandleTypeDef;
  138. /**
  139. * @}
  140. */
  141. /* Exported constants --------------------------------------------------------*/
  142. /** @defgroup DMA2D_Exported_Constants DMA2D Exported Constants
  143. * @{
  144. */
  145. /** @defgroup DMA2D_Error_Code DMA2D Error Code
  146. * @{
  147. */
  148. #define HAL_DMA2D_ERROR_NONE 0x00000000U /*!< No error */
  149. #define HAL_DMA2D_ERROR_TE 0x00000001U /*!< Transfer error */
  150. #define HAL_DMA2D_ERROR_CE 0x00000002U /*!< Configuration error */
  151. #define HAL_DMA2D_ERROR_CAE 0x00000004U /*!< CLUT access error */
  152. #define HAL_DMA2D_ERROR_TIMEOUT 0x00000020U /*!< Timeout error */
  153. /**
  154. * @}
  155. */
  156. /** @defgroup DMA2D_Mode DMA2D Mode
  157. * @{
  158. */
  159. #define DMA2D_M2M 0x00000000U /*!< DMA2D memory to memory transfer mode */
  160. #define DMA2D_M2M_PFC DMA2D_CR_MODE_0 /*!< DMA2D memory to memory with pixel format conversion transfer mode */
  161. #define DMA2D_M2M_BLEND DMA2D_CR_MODE_1 /*!< DMA2D memory to memory with blending transfer mode */
  162. #define DMA2D_R2M DMA2D_CR_MODE /*!< DMA2D register to memory transfer mode */
  163. /**
  164. * @}
  165. */
  166. /** @defgroup DMA2D_Output_Color_Mode DMA2D Output Color Mode
  167. * @{
  168. */
  169. #define DMA2D_OUTPUT_ARGB8888 0x00000000U /*!< ARGB8888 DMA2D color mode */
  170. #define DMA2D_OUTPUT_RGB888 DMA2D_OPFCCR_CM_0 /*!< RGB888 DMA2D color mode */
  171. #define DMA2D_OUTPUT_RGB565 DMA2D_OPFCCR_CM_1 /*!< RGB565 DMA2D color mode */
  172. #define DMA2D_OUTPUT_ARGB1555 (DMA2D_OPFCCR_CM_0|DMA2D_OPFCCR_CM_1) /*!< ARGB1555 DMA2D color mode */
  173. #define DMA2D_OUTPUT_ARGB4444 DMA2D_OPFCCR_CM_2 /*!< ARGB4444 DMA2D color mode */
  174. /**
  175. * @}
  176. */
  177. /** @defgroup DMA2D_Input_Color_Mode DMA2D Input Color Mode
  178. * @{
  179. */
  180. #define DMA2D_INPUT_ARGB8888 0x00000000U /*!< ARGB8888 color mode */
  181. #define DMA2D_INPUT_RGB888 0x00000001U /*!< RGB888 color mode */
  182. #define DMA2D_INPUT_RGB565 0x00000002U /*!< RGB565 color mode */
  183. #define DMA2D_INPUT_ARGB1555 0x00000003U /*!< ARGB1555 color mode */
  184. #define DMA2D_INPUT_ARGB4444 0x00000004U /*!< ARGB4444 color mode */
  185. #define DMA2D_INPUT_L8 0x00000005U /*!< L8 color mode */
  186. #define DMA2D_INPUT_AL44 0x00000006U /*!< AL44 color mode */
  187. #define DMA2D_INPUT_AL88 0x00000007U /*!< AL88 color mode */
  188. #define DMA2D_INPUT_L4 0x00000008U /*!< L4 color mode */
  189. #define DMA2D_INPUT_A8 0x00000009U /*!< A8 color mode */
  190. #define DMA2D_INPUT_A4 0x0000000AU /*!< A4 color mode */
  191. /**
  192. * @}
  193. */
  194. /** @defgroup DMA2D_Alpha_Mode DMA2D Alpha Mode
  195. * @{
  196. */
  197. #define DMA2D_NO_MODIF_ALPHA 0x00000000U /*!< No modification of the alpha channel value */
  198. #define DMA2D_REPLACE_ALPHA 0x00000001U /*!< Replace original alpha channel value by programmed alpha value */
  199. #define DMA2D_COMBINE_ALPHA 0x00000002U /*!< Replace original alpha channel value by programmed alpha value
  200. with original alpha channel value */
  201. /**
  202. * @}
  203. */
  204. /** @defgroup DMA2D_CLUT_CM DMA2D CLUT Color Mode
  205. * @{
  206. */
  207. #define DMA2D_CCM_ARGB8888 0x00000000U /*!< ARGB8888 DMA2D CLUT color mode */
  208. #define DMA2D_CCM_RGB888 0x00000001U /*!< RGB888 DMA2D CLUT color mode */
  209. /**
  210. * @}
  211. */
  212. /** @defgroup DMA2D_Interrupts DMA2D Interrupts
  213. * @{
  214. */
  215. #define DMA2D_IT_CE DMA2D_CR_CEIE /*!< Configuration Error Interrupt */
  216. #define DMA2D_IT_CTC DMA2D_CR_CTCIE /*!< CLUT Transfer Complete Interrupt */
  217. #define DMA2D_IT_CAE DMA2D_CR_CAEIE /*!< CLUT Access Error Interrupt */
  218. #define DMA2D_IT_TW DMA2D_CR_TWIE /*!< Transfer Watermark Interrupt */
  219. #define DMA2D_IT_TC DMA2D_CR_TCIE /*!< Transfer Complete Interrupt */
  220. #define DMA2D_IT_TE DMA2D_CR_TEIE /*!< Transfer Error Interrupt */
  221. /**
  222. * @}
  223. */
  224. /** @defgroup DMA2D_Flags DMA2D Flags
  225. * @{
  226. */
  227. #define DMA2D_FLAG_CE DMA2D_ISR_CEIF /*!< Configuration Error Interrupt Flag */
  228. #define DMA2D_FLAG_CTC DMA2D_ISR_CTCIF /*!< CLUT Transfer Complete Interrupt Flag */
  229. #define DMA2D_FLAG_CAE DMA2D_ISR_CAEIF /*!< CLUT Access Error Interrupt Flag */
  230. #define DMA2D_FLAG_TW DMA2D_ISR_TWIF /*!< Transfer Watermark Interrupt Flag */
  231. #define DMA2D_FLAG_TC DMA2D_ISR_TCIF /*!< Transfer Complete Interrupt Flag */
  232. #define DMA2D_FLAG_TE DMA2D_ISR_TEIF /*!< Transfer Error Interrupt Flag */
  233. /**
  234. * @}
  235. */
  236. /** @defgroup DMA2D_Aliases DMA2D API Aliases
  237. * @{
  238. */
  239. #define HAL_DMA2D_DisableCLUT HAL_DMA2D_CLUTLoading_Abort /*!< Aliased to HAL_DMA2D_CLUTLoading_Abort for compatibility with legacy code */
  240. /**
  241. * @}
  242. */
  243. /**
  244. * @}
  245. */
  246. /* Exported macros ------------------------------------------------------------*/
  247. /** @defgroup DMA2D_Exported_Macros DMA2D Exported Macros
  248. * @{
  249. */
  250. /** @brief Reset DMA2D handle state
  251. * @param __HANDLE__ specifies the DMA2D handle.
  252. * @retval None
  253. */
  254. #define __HAL_DMA2D_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_DMA2D_STATE_RESET)
  255. /**
  256. * @brief Enable the DMA2D.
  257. * @param __HANDLE__ DMA2D handle
  258. * @retval None.
  259. */
  260. #define __HAL_DMA2D_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= DMA2D_CR_START)
  261. /* Interrupt & Flag management */
  262. /**
  263. * @brief Get the DMA2D pending flags.
  264. * @param __HANDLE__ DMA2D handle
  265. * @param __FLAG__ flag to check.
  266. * This parameter can be any combination of the following values:
  267. * @arg DMA2D_FLAG_CE: Configuration error flag
  268. * @arg DMA2D_FLAG_CTC: CLUT transfer complete flag
  269. * @arg DMA2D_FLAG_CAE: CLUT access error flag
  270. * @arg DMA2D_FLAG_TW: Transfer Watermark flag
  271. * @arg DMA2D_FLAG_TC: Transfer complete flag
  272. * @arg DMA2D_FLAG_TE: Transfer error flag
  273. * @retval The state of FLAG.
  274. */
  275. #define __HAL_DMA2D_GET_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR & (__FLAG__))
  276. /**
  277. * @brief Clear the DMA2D pending flags.
  278. * @param __HANDLE__ DMA2D handle
  279. * @param __FLAG__ specifies the flag to clear.
  280. * This parameter can be any combination of the following values:
  281. * @arg DMA2D_FLAG_CE: Configuration error flag
  282. * @arg DMA2D_FLAG_CTC: CLUT transfer complete flag
  283. * @arg DMA2D_FLAG_CAE: CLUT access error flag
  284. * @arg DMA2D_FLAG_TW: Transfer Watermark flag
  285. * @arg DMA2D_FLAG_TC: Transfer complete flag
  286. * @arg DMA2D_FLAG_TE: Transfer error flag
  287. * @retval None
  288. */
  289. #define __HAL_DMA2D_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->IFCR = (__FLAG__))
  290. /**
  291. * @brief Enable the specified DMA2D interrupts.
  292. * @param __HANDLE__ DMA2D handle
  293. * @param __INTERRUPT__ specifies the DMA2D interrupt sources to be enabled.
  294. * This parameter can be any combination of the following values:
  295. * @arg DMA2D_IT_CE: Configuration error interrupt mask
  296. * @arg DMA2D_IT_CTC: CLUT transfer complete interrupt mask
  297. * @arg DMA2D_IT_CAE: CLUT access error interrupt mask
  298. * @arg DMA2D_IT_TW: Transfer Watermark interrupt mask
  299. * @arg DMA2D_IT_TC: Transfer complete interrupt mask
  300. * @arg DMA2D_IT_TE: Transfer error interrupt mask
  301. * @retval None
  302. */
  303. #define __HAL_DMA2D_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__))
  304. /**
  305. * @brief Disable the specified DMA2D interrupts.
  306. * @param __HANDLE__ DMA2D handle
  307. * @param __INTERRUPT__ specifies the DMA2D interrupt sources to be disabled.
  308. * This parameter can be any combination of the following values:
  309. * @arg DMA2D_IT_CE: Configuration error interrupt mask
  310. * @arg DMA2D_IT_CTC: CLUT transfer complete interrupt mask
  311. * @arg DMA2D_IT_CAE: CLUT access error interrupt mask
  312. * @arg DMA2D_IT_TW: Transfer Watermark interrupt mask
  313. * @arg DMA2D_IT_TC: Transfer complete interrupt mask
  314. * @arg DMA2D_IT_TE: Transfer error interrupt mask
  315. * @retval None
  316. */
  317. #define __HAL_DMA2D_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__))
  318. /**
  319. * @brief Check whether the specified DMA2D interrupt source is enabled or not.
  320. * @param __HANDLE__ DMA2D handle
  321. * @param __INTERRUPT__ specifies the DMA2D interrupt source to check.
  322. * This parameter can be one of the following values:
  323. * @arg DMA2D_IT_CE: Configuration error interrupt mask
  324. * @arg DMA2D_IT_CTC: CLUT transfer complete interrupt mask
  325. * @arg DMA2D_IT_CAE: CLUT access error interrupt mask
  326. * @arg DMA2D_IT_TW: Transfer Watermark interrupt mask
  327. * @arg DMA2D_IT_TC: Transfer complete interrupt mask
  328. * @arg DMA2D_IT_TE: Transfer error interrupt mask
  329. * @retval The state of INTERRUPT source.
  330. */
  331. #define __HAL_DMA2D_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR & (__INTERRUPT__))
  332. /**
  333. * @}
  334. */
  335. /* Exported functions --------------------------------------------------------*/
  336. /** @addtogroup DMA2D_Exported_Functions DMA2D Exported Functions
  337. * @{
  338. */
  339. /** @addtogroup DMA2D_Exported_Functions_Group1 Initialization and de-initialization functions
  340. * @{
  341. */
  342. /* Initialization and de-initialization functions *******************************/
  343. HAL_StatusTypeDef HAL_DMA2D_Init(DMA2D_HandleTypeDef *hdma2d);
  344. HAL_StatusTypeDef HAL_DMA2D_DeInit (DMA2D_HandleTypeDef *hdma2d);
  345. void HAL_DMA2D_MspInit(DMA2D_HandleTypeDef* hdma2d);
  346. void HAL_DMA2D_MspDeInit(DMA2D_HandleTypeDef* hdma2d);
  347. /**
  348. * @}
  349. */
  350. /** @addtogroup DMA2D_Exported_Functions_Group2 IO operation functions
  351. * @{
  352. */
  353. /* IO operation functions *******************************************************/
  354. HAL_StatusTypeDef HAL_DMA2D_Start(DMA2D_HandleTypeDef *hdma2d, uint32_t pdata, uint32_t DstAddress, uint32_t Width, uint32_t Height);
  355. HAL_StatusTypeDef HAL_DMA2D_BlendingStart(DMA2D_HandleTypeDef *hdma2d, uint32_t SrcAddress1, uint32_t SrcAddress2, uint32_t DstAddress, uint32_t Width, uint32_t Height);
  356. HAL_StatusTypeDef HAL_DMA2D_Start_IT(DMA2D_HandleTypeDef *hdma2d, uint32_t pdata, uint32_t DstAddress, uint32_t Width, uint32_t Height);
  357. HAL_StatusTypeDef HAL_DMA2D_BlendingStart_IT(DMA2D_HandleTypeDef *hdma2d, uint32_t SrcAddress1, uint32_t SrcAddress2, uint32_t DstAddress, uint32_t Width, uint32_t Height);
  358. HAL_StatusTypeDef HAL_DMA2D_Suspend(DMA2D_HandleTypeDef *hdma2d);
  359. HAL_StatusTypeDef HAL_DMA2D_Resume(DMA2D_HandleTypeDef *hdma2d);
  360. HAL_StatusTypeDef HAL_DMA2D_Abort(DMA2D_HandleTypeDef *hdma2d);
  361. HAL_StatusTypeDef HAL_DMA2D_EnableCLUT(DMA2D_HandleTypeDef *hdma2d, uint32_t LayerIdx);
  362. HAL_StatusTypeDef HAL_DMA2D_CLUTLoad(DMA2D_HandleTypeDef *hdma2d, DMA2D_CLUTCfgTypeDef CLUTCfg, uint32_t LayerIdx);
  363. HAL_StatusTypeDef HAL_DMA2D_CLUTLoad_IT(DMA2D_HandleTypeDef *hdma2d, DMA2D_CLUTCfgTypeDef CLUTCfg, uint32_t LayerIdx);
  364. HAL_StatusTypeDef HAL_DMA2D_CLUTLoading_Abort(DMA2D_HandleTypeDef *hdma2d, uint32_t LayerIdx);
  365. HAL_StatusTypeDef HAL_DMA2D_CLUTLoading_Suspend(DMA2D_HandleTypeDef *hdma2d, uint32_t LayerIdx);
  366. HAL_StatusTypeDef HAL_DMA2D_CLUTLoading_Resume(DMA2D_HandleTypeDef *hdma2d, uint32_t LayerIdx);
  367. HAL_StatusTypeDef HAL_DMA2D_PollForTransfer(DMA2D_HandleTypeDef *hdma2d, uint32_t Timeout);
  368. void HAL_DMA2D_IRQHandler(DMA2D_HandleTypeDef *hdma2d);
  369. void HAL_DMA2D_LineEventCallback(DMA2D_HandleTypeDef *hdma2d);
  370. void HAL_DMA2D_CLUTLoadingCpltCallback(DMA2D_HandleTypeDef *hdma2d);
  371. /**
  372. * @}
  373. */
  374. /** @addtogroup DMA2D_Exported_Functions_Group3 Peripheral Control functions
  375. * @{
  376. */
  377. /* Peripheral Control functions *************************************************/
  378. HAL_StatusTypeDef HAL_DMA2D_ConfigLayer(DMA2D_HandleTypeDef *hdma2d, uint32_t LayerIdx);
  379. HAL_StatusTypeDef HAL_DMA2D_ConfigCLUT(DMA2D_HandleTypeDef *hdma2d, DMA2D_CLUTCfgTypeDef CLUTCfg, uint32_t LayerIdx);
  380. HAL_StatusTypeDef HAL_DMA2D_ProgramLineEvent(DMA2D_HandleTypeDef *hdma2d, uint32_t Line);
  381. HAL_StatusTypeDef HAL_DMA2D_EnableDeadTime(DMA2D_HandleTypeDef *hdma2d);
  382. HAL_StatusTypeDef HAL_DMA2D_DisableDeadTime(DMA2D_HandleTypeDef *hdma2d);
  383. HAL_StatusTypeDef HAL_DMA2D_ConfigDeadTime(DMA2D_HandleTypeDef *hdma2d, uint8_t DeadTime);
  384. /**
  385. * @}
  386. */
  387. /** @addtogroup DMA2D_Exported_Functions_Group4 Peripheral State and Error functions
  388. * @{
  389. */
  390. /* Peripheral State functions ***************************************************/
  391. HAL_DMA2D_StateTypeDef HAL_DMA2D_GetState(DMA2D_HandleTypeDef *hdma2d);
  392. uint32_t HAL_DMA2D_GetError(DMA2D_HandleTypeDef *hdma2d);
  393. /**
  394. * @}
  395. */
  396. /**
  397. * @}
  398. */
  399. /* Private constants ---------------------------------------------------------*/
  400. /** @addtogroup DMA2D_Private_Constants DMA2D Private Constants
  401. * @{
  402. */
  403. /** @defgroup DMA2D_Maximum_Line_WaterMark DMA2D Maximum Line Watermark
  404. * @{
  405. */
  406. #define DMA2D_LINE_WATERMARK_MAX DMA2D_LWR_LW /*!< DMA2D maximum line watermark */
  407. /**
  408. * @}
  409. */
  410. /** @defgroup DMA2D_Color_Value DMA2D Color Value
  411. * @{
  412. */
  413. #define DMA2D_COLOR_VALUE 0x000000FFU /*!< Color value mask */
  414. /**
  415. * @}
  416. */
  417. /** @defgroup DMA2D_Max_Layer DMA2D Maximum Number of Layers
  418. * @{
  419. */
  420. #define DMA2D_MAX_LAYER 2U /*!< DMA2D maximum number of layers */
  421. /**
  422. * @}
  423. */
  424. /** @defgroup DMA2D_Offset DMA2D Offset
  425. * @{
  426. */
  427. #define DMA2D_OFFSET DMA2D_FGOR_LO /*!< Line Offset */
  428. /**
  429. * @}
  430. */
  431. /** @defgroup DMA2D_Size DMA2D Size
  432. * @{
  433. */
  434. #define DMA2D_PIXEL (DMA2D_NLR_PL >> 16U) /*!< DMA2D number of pixels per line */
  435. #define DMA2D_LINE DMA2D_NLR_NL /*!< DMA2D number of lines */
  436. /**
  437. * @}
  438. */
  439. /** @defgroup DMA2D_CLUT_Size DMA2D CLUT Size
  440. * @{
  441. */
  442. #define DMA2D_CLUT_SIZE (DMA2D_FGPFCCR_CS >> 8U) /*!< DMA2D CLUT size */
  443. /**
  444. * @}
  445. */
  446. /**
  447. * @}
  448. */
  449. /* Private macros ------------------------------------------------------------*/
  450. /** @defgroup DMA2D_Private_Macros DMA2D Private Macros
  451. * @{
  452. */
  453. #define IS_DMA2D_LAYER(LAYER) ((LAYER) <= DMA2D_MAX_LAYER)
  454. #define IS_DMA2D_MODE(MODE) (((MODE) == DMA2D_M2M) || ((MODE) == DMA2D_M2M_PFC) || \
  455. ((MODE) == DMA2D_M2M_BLEND) || ((MODE) == DMA2D_R2M))
  456. #define IS_DMA2D_CMODE(MODE_ARGB) (((MODE_ARGB) == DMA2D_OUTPUT_ARGB8888) || ((MODE_ARGB) == DMA2D_OUTPUT_RGB888) || \
  457. ((MODE_ARGB) == DMA2D_OUTPUT_RGB565) || ((MODE_ARGB) == DMA2D_OUTPUT_ARGB1555) || \
  458. ((MODE_ARGB) == DMA2D_OUTPUT_ARGB4444))
  459. #define IS_DMA2D_COLOR(COLOR) ((COLOR) <= DMA2D_COLOR_VALUE)
  460. #define IS_DMA2D_LINE(LINE) ((LINE) <= DMA2D_LINE)
  461. #define IS_DMA2D_PIXEL(PIXEL) ((PIXEL) <= DMA2D_PIXEL)
  462. #define IS_DMA2D_OFFSET(OOFFSET) ((OOFFSET) <= DMA2D_OFFSET)
  463. #define IS_DMA2D_INPUT_COLOR_MODE(INPUT_CM) (((INPUT_CM) == DMA2D_INPUT_ARGB8888) || ((INPUT_CM) == DMA2D_INPUT_RGB888) || \
  464. ((INPUT_CM) == DMA2D_INPUT_RGB565) || ((INPUT_CM) == DMA2D_INPUT_ARGB1555) || \
  465. ((INPUT_CM) == DMA2D_INPUT_ARGB4444) || ((INPUT_CM) == DMA2D_INPUT_L8) || \
  466. ((INPUT_CM) == DMA2D_INPUT_AL44) || ((INPUT_CM) == DMA2D_INPUT_AL88) || \
  467. ((INPUT_CM) == DMA2D_INPUT_L4) || ((INPUT_CM) == DMA2D_INPUT_A8) || \
  468. ((INPUT_CM) == DMA2D_INPUT_A4))
  469. #define IS_DMA2D_ALPHA_MODE(AlphaMode) (((AlphaMode) == DMA2D_NO_MODIF_ALPHA) || \
  470. ((AlphaMode) == DMA2D_REPLACE_ALPHA) || \
  471. ((AlphaMode) == DMA2D_COMBINE_ALPHA))
  472. #define IS_DMA2D_CLUT_CM(CLUT_CM) (((CLUT_CM) == DMA2D_CCM_ARGB8888) || ((CLUT_CM) == DMA2D_CCM_RGB888))
  473. #define IS_DMA2D_CLUT_SIZE(CLUT_SIZE) ((CLUT_SIZE) <= DMA2D_CLUT_SIZE)
  474. #define IS_DMA2D_LINEWATERMARK(LineWatermark) ((LineWatermark) <= DMA2D_LINE_WATERMARK_MAX)
  475. #define IS_DMA2D_IT(IT) (((IT) == DMA2D_IT_CTC) || ((IT) == DMA2D_IT_CAE) || \
  476. ((IT) == DMA2D_IT_TW) || ((IT) == DMA2D_IT_TC) || \
  477. ((IT) == DMA2D_IT_TE) || ((IT) == DMA2D_IT_CE))
  478. #define IS_DMA2D_GET_FLAG(FLAG) (((FLAG) == DMA2D_FLAG_CTC) || ((FLAG) == DMA2D_FLAG_CAE) || \
  479. ((FLAG) == DMA2D_FLAG_TW) || ((FLAG) == DMA2D_FLAG_TC) || \
  480. ((FLAG) == DMA2D_FLAG_TE) || ((FLAG) == DMA2D_FLAG_CE))
  481. /**
  482. * @}
  483. */
  484. /**
  485. * @}
  486. */
  487. /**
  488. * @}
  489. */
  490. #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */
  491. #ifdef __cplusplus
  492. }
  493. #endif
  494. #endif /* __STM32F4xx_HAL_DMA2D_H */
  495. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/