You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

639 lines
28 KiB

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