stm32l4xx_hal_gfxmmu.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. /**
  2. ******************************************************************************
  3. * @file stm32l4xx_hal_gfxmmu.h
  4. * @author MCD Application Team
  5. * @brief Header file of GFXMMU 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 __STM32L4xx_HAL_GFXMMU_H
  37. #define __STM32L4xx_HAL_GFXMMU_H
  38. #ifdef __cplusplus
  39. extern "C" {
  40. #endif
  41. /* Includes ------------------------------------------------------------------*/
  42. #include "stm32l4xx_hal_def.h"
  43. #if defined(GFXMMU)
  44. /** @addtogroup STM32L4xx_HAL_Driver
  45. * @{
  46. */
  47. /** @addtogroup GFXMMU
  48. * @{
  49. */
  50. /* Exported types ------------------------------------------------------------*/
  51. /** @defgroup GFXMMU_Exported_Types GFXMMU Exported Types
  52. * @{
  53. */
  54. /**
  55. * @brief HAL GFXMMU states definition
  56. */
  57. typedef enum
  58. {
  59. HAL_GFXMMU_STATE_RESET = 0x00U, /*!< GFXMMU not initialized */
  60. HAL_GFXMMU_STATE_READY = 0x01U, /*!< GFXMMU initialized and ready for use */
  61. }HAL_GFXMMU_StateTypeDef;
  62. /**
  63. * @brief GFXMMU buffers structure definition
  64. */
  65. typedef struct
  66. {
  67. uint32_t Buf0Address; /*!< Physical address of buffer 0. */
  68. uint32_t Buf1Address; /*!< Physical address of buffer 1. */
  69. uint32_t Buf2Address; /*!< Physical address of buffer 2. */
  70. uint32_t Buf3Address; /*!< Physical address of buffer 3. */
  71. }GFXMMU_BuffersTypeDef;
  72. /**
  73. * @brief GFXMMU interrupts structure definition
  74. */
  75. typedef struct
  76. {
  77. FunctionalState Activation; /*!< Interrupts enable/disable */
  78. uint32_t UsedInterrupts; /*!< Interrupts used.
  79. This parameter can be a values combination of @ref GFXMMU_Interrupts.
  80. @note: Usefull only when interrupts are enabled. */
  81. }GFXMMU_InterruptsTypeDef;
  82. /**
  83. * @brief GFXMMU init structure definition
  84. */
  85. typedef struct
  86. {
  87. uint32_t BlocksPerLine; /*!< Number of blocks of 16 bytes per line.
  88. This parameter can be a value of @ref GFXMMU_BlocksPerLine. */
  89. uint32_t DefaultValue; /*!< Value returned when virtual memory location not physically mapped. */
  90. GFXMMU_BuffersTypeDef Buffers; /*!< Physical buffers addresses. */
  91. GFXMMU_InterruptsTypeDef Interrupts; /*!< Interrupts parameters. */
  92. }GFXMMU_InitTypeDef;
  93. /**
  94. * @brief GFXMMU handle structure definition
  95. */
  96. typedef struct
  97. {
  98. GFXMMU_TypeDef *Instance; /*!< GFXMMU instance */
  99. GFXMMU_InitTypeDef Init; /*!< GFXMMU init parameters */
  100. HAL_GFXMMU_StateTypeDef State; /*!< GFXMMU state */
  101. __IO uint32_t ErrorCode; /*!< GFXMMU error code */
  102. }GFXMMU_HandleTypeDef;
  103. /**
  104. * @brief GFXMMU LUT line structure definition
  105. */
  106. typedef struct
  107. {
  108. uint32_t LineNumber; /*!< LUT line number.
  109. This parameter must be a number between Min_Data = 0 and Max_Data = 1023. */
  110. uint32_t LineStatus; /*!< LUT line enable/disable.
  111. This parameter can be a value of @ref GFXMMU_LutLineStatus. */
  112. uint32_t FirstVisibleBlock; /*!< First visible block on this line.
  113. This parameter must be a number between Min_Data = 0 and Max_Data = 255. */
  114. uint32_t LastVisibleBlock; /*!< Last visible block on this line.
  115. This parameter must be a number between Min_Data = 0 and Max_Data = 255. */
  116. int32_t LineOffset; /*!< Offset of block 0 of the current line in physical buffer.
  117. This parameter must be a number between Min_Data = -4080 and Max_Data = 4190208.
  118. @note: Line offset has to be computed with the following formula:
  119. LineOffset = [(Blocks already used) - (1st visible block)]*BlockSize. */
  120. }GFXMMU_LutLineTypeDef;
  121. /**
  122. * @}
  123. */
  124. /* End of exported types -----------------------------------------------------*/
  125. /* Exported constants --------------------------------------------------------*/
  126. /** @defgroup GFXMMU_Exported_Constants GFXMMU Exported Constants
  127. * @{
  128. */
  129. /** @defgroup GFXMMU_BlocksPerLine GFXMMU blocks per line
  130. * @{
  131. */
  132. #define GFXMMU_256BLOCKS 0x00000000U /*!< 256 blocks of 16 bytes per line */
  133. #define GFXMMU_192BLOCKS GFXMMU_CR_192BM /*!< 192 blocks of 16 bytes per line */
  134. /**
  135. * @}
  136. */
  137. /** @defgroup GFXMMU_Interrupts GFXMMU interrupts
  138. * @{
  139. */
  140. #define GFXMMU_AHB_MASTER_ERROR_IT GFXMMU_CR_AMEIE /*!< AHB master error interrupt */
  141. #define GFXMMU_BUFFER0_OVERFLOW_IT GFXMMU_CR_B0OIE /*!< Buffer 0 overflow interrupt */
  142. #define GFXMMU_BUFFER1_OVERFLOW_IT GFXMMU_CR_B1OIE /*!< Buffer 1 overflow interrupt */
  143. #define GFXMMU_BUFFER2_OVERFLOW_IT GFXMMU_CR_B2OIE /*!< Buffer 2 overflow interrupt */
  144. #define GFXMMU_BUFFER3_OVERFLOW_IT GFXMMU_CR_B3OIE /*!< Buffer 3 overflow interrupt */
  145. /**
  146. * @}
  147. */
  148. /** @defgroup GFXMMU_Error_Code GFXMMU Error Code
  149. * @{
  150. */
  151. #define GFXMMU_ERROR_NONE 0x00000000U /*!< No error */
  152. #define GFXMMU_ERROR_BUFFER0_OVERFLOW GFXMMU_SR_B0OF /*!< Buffer 0 overflow */
  153. #define GFXMMU_ERROR_BUFFER1_OVERFLOW GFXMMU_SR_B1OF /*!< Buffer 1 overflow */
  154. #define GFXMMU_ERROR_BUFFER2_OVERFLOW GFXMMU_SR_B2OF /*!< Buffer 2 overflow */
  155. #define GFXMMU_ERROR_BUFFER3_OVERFLOW GFXMMU_SR_B3OF /*!< Buffer 3 overflow */
  156. #define GFXMMU_ERROR_AHB_MASTER GFXMMU_SR_AMEF /*!< AHB master error */
  157. /**
  158. * @}
  159. */
  160. /** @defgroup GFXMMU_LutLineStatus GFXMMU LUT line status
  161. * @{
  162. */
  163. #define GFXMMU_LUT_LINE_DISABLE 0x00000000U /*!< LUT line disabled */
  164. #define GFXMMU_LUT_LINE_ENABLE GFXMMU_LUTxL_EN /*!< LUT line enabled */
  165. /**
  166. * @}
  167. */
  168. /**
  169. * @}
  170. */
  171. /* End of exported constants -------------------------------------------------*/
  172. /* Exported macros -----------------------------------------------------------*/
  173. /** @defgroup GFXMMU_Exported_Macros GFXMMU Exported Macros
  174. * @{
  175. */
  176. /** @brief Reset GFXMMU handle state.
  177. * @param __HANDLE__ GFXMMU handle.
  178. * @retval None
  179. */
  180. #define __HAL_GFXMMU_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_GFXMMU_STATE_RESET)
  181. /**
  182. * @}
  183. */
  184. /* End of exported macros ----------------------------------------------------*/
  185. /* Exported functions --------------------------------------------------------*/
  186. /** @addtogroup GFXMMU_Exported_Functions GFXMMU Exported Functions
  187. * @{
  188. */
  189. /** @addtogroup GFXMMU_Exported_Functions_Group1 Initialization and de-initialization functions
  190. * @{
  191. */
  192. /* Initialization and de-initialization functions *****************************/
  193. HAL_StatusTypeDef HAL_GFXMMU_Init(GFXMMU_HandleTypeDef *hgfxmmu);
  194. HAL_StatusTypeDef HAL_GFXMMU_DeInit(GFXMMU_HandleTypeDef *hgfxmmu);
  195. void HAL_GFXMMU_MspInit(GFXMMU_HandleTypeDef *hgfxmmu);
  196. void HAL_GFXMMU_MspDeInit(GFXMMU_HandleTypeDef *hgfxmmu);
  197. /**
  198. * @}
  199. */
  200. /** @addtogroup GFXMMU_Exported_Functions_Group2 Operations functions
  201. * @{
  202. */
  203. /* Operation functions ********************************************************/
  204. HAL_StatusTypeDef HAL_GFXMMU_ConfigLut(GFXMMU_HandleTypeDef *hgfxmmu,
  205. uint32_t FirstLine,
  206. uint32_t LinesNumber,
  207. uint32_t Address);
  208. HAL_StatusTypeDef HAL_GFXMMU_DisableLutLines(GFXMMU_HandleTypeDef *hgfxmmu,
  209. uint32_t FirstLine,
  210. uint32_t LinesNumber);
  211. HAL_StatusTypeDef HAL_GFXMMU_ConfigLutLine(GFXMMU_HandleTypeDef *hgfxmmu, GFXMMU_LutLineTypeDef *lutLine);
  212. HAL_StatusTypeDef HAL_GFXMMU_ModifyBuffers(GFXMMU_HandleTypeDef *hgfxmmu, GFXMMU_BuffersTypeDef *Buffers);
  213. void HAL_GFXMMU_IRQHandler(GFXMMU_HandleTypeDef *hgfxmmu);
  214. void HAL_GFXMMU_ErrorCallback(GFXMMU_HandleTypeDef *hgfxmmu);
  215. /**
  216. * @}
  217. */
  218. /** @defgroup GFXMMU_Exported_Functions_Group3 State functions
  219. * @{
  220. */
  221. /* State function *************************************************************/
  222. HAL_GFXMMU_StateTypeDef HAL_GFXMMU_GetState(GFXMMU_HandleTypeDef *hgfxmmu);
  223. uint32_t HAL_GFXMMU_GetError(GFXMMU_HandleTypeDef *hgfxmmu);
  224. /**
  225. * @}
  226. */
  227. /**
  228. * @}
  229. */
  230. /* End of exported functions -------------------------------------------------*/
  231. /* Private macros ------------------------------------------------------------*/
  232. /** @defgroup GFXMMU_Private_Macros GFXMMU Private Macros
  233. * @{
  234. */
  235. #define IS_GFXMMU_BLOCKS_PER_LINE(VALUE) (((VALUE) == GFXMMU_256BLOCKS) || \
  236. ((VALUE) == GFXMMU_192BLOCKS))
  237. #define IS_GFXMMU_BUFFER_ADDRESS(VALUE) (((VALUE) & 0xFU) == 0U)
  238. #define IS_GFXMMU_INTERRUPTS(VALUE) (((VALUE) & 0x1FU) != 0U)
  239. #define IS_GFXMMU_LUT_LINE(VALUE) ((VALUE) < 1024U)
  240. #define IS_GFXMMU_LUT_LINES_NUMBER(VALUE) (((VALUE) > 0U) && ((VALUE) <= 1024U))
  241. #define IS_GFXMMU_LUT_LINE_STATUS(VALUE) (((VALUE) == GFXMMU_LUT_LINE_DISABLE) || \
  242. ((VALUE) == GFXMMU_LUT_LINE_ENABLE))
  243. #define IS_GFXMMU_LUT_BLOCK(VALUE) ((VALUE) < 256U)
  244. #define IS_GFXMMU_LUT_LINE_OFFSET(VALUE) (((VALUE) >= -4080) && ((VALUE) <= 4190208))
  245. /**
  246. * @}
  247. */
  248. /* End of private macros -----------------------------------------------------*/
  249. /**
  250. * @}
  251. */
  252. /**
  253. * @}
  254. */
  255. #endif /* GFXMMU */
  256. #ifdef __cplusplus
  257. }
  258. #endif
  259. #endif /* __STM32L4xx_HAL_GFXMMU_H */
  260. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/