stm32f4xx_hal_dma2d.h 26 KB

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