STM32L443xx HAL User Manual
|
00001 /** 00002 ****************************************************************************** 00003 * @file stm32l4xx_hal_gfxmmu.h 00004 * @author MCD Application Team 00005 * @brief Header file of GFXMMU HAL module. 00006 ****************************************************************************** 00007 * @attention 00008 * 00009 * Copyright (c) 2017 STMicroelectronics. 00010 * All rights reserved. 00011 * 00012 * This software is licensed under terms that can be found in the LICENSE file 00013 * in the root directory of this software component. 00014 * If no LICENSE file comes with this software, it is provided AS-IS. 00015 * 00016 ****************************************************************************** 00017 */ 00018 00019 /* Define to prevent recursive inclusion -------------------------------------*/ 00020 #ifndef STM32L4xx_HAL_GFXMMU_H 00021 #define STM32L4xx_HAL_GFXMMU_H 00022 00023 #ifdef __cplusplus 00024 extern "C" { 00025 #endif 00026 00027 /* Includes ------------------------------------------------------------------*/ 00028 #include "stm32l4xx_hal_def.h" 00029 00030 #if defined(GFXMMU) 00031 00032 /** @addtogroup STM32L4xx_HAL_Driver 00033 * @{ 00034 */ 00035 00036 /** @addtogroup GFXMMU 00037 * @{ 00038 */ 00039 00040 /* Exported types ------------------------------------------------------------*/ 00041 /** @defgroup GFXMMU_Exported_Types GFXMMU Exported Types 00042 * @{ 00043 */ 00044 00045 /** 00046 * @brief HAL GFXMMU states definition 00047 */ 00048 typedef enum 00049 { 00050 HAL_GFXMMU_STATE_RESET = 0x00U, /*!< GFXMMU not initialized */ 00051 HAL_GFXMMU_STATE_READY = 0x01U, /*!< GFXMMU initialized and ready for use */ 00052 }HAL_GFXMMU_StateTypeDef; 00053 00054 /** 00055 * @brief GFXMMU buffers structure definition 00056 */ 00057 typedef struct 00058 { 00059 uint32_t Buf0Address; /*!< Physical address of buffer 0. */ 00060 uint32_t Buf1Address; /*!< Physical address of buffer 1. */ 00061 uint32_t Buf2Address; /*!< Physical address of buffer 2. */ 00062 uint32_t Buf3Address; /*!< Physical address of buffer 3. */ 00063 }GFXMMU_BuffersTypeDef; 00064 00065 /** 00066 * @brief GFXMMU interrupts structure definition 00067 */ 00068 typedef struct 00069 { 00070 FunctionalState Activation; /*!< Interrupts enable/disable */ 00071 uint32_t UsedInterrupts; /*!< Interrupts used. 00072 This parameter can be a values combination of @ref GFXMMU_Interrupts. 00073 @note: Usefull only when interrupts are enabled. */ 00074 }GFXMMU_InterruptsTypeDef; 00075 00076 /** 00077 * @brief GFXMMU init structure definition 00078 */ 00079 typedef struct 00080 { 00081 uint32_t BlocksPerLine; /*!< Number of blocks of 16 bytes per line. 00082 This parameter can be a value of @ref GFXMMU_BlocksPerLine. */ 00083 uint32_t DefaultValue; /*!< Value returned when virtual memory location not physically mapped. */ 00084 GFXMMU_BuffersTypeDef Buffers; /*!< Physical buffers addresses. */ 00085 GFXMMU_InterruptsTypeDef Interrupts; /*!< Interrupts parameters. */ 00086 }GFXMMU_InitTypeDef; 00087 00088 /** 00089 * @brief GFXMMU handle structure definition 00090 */ 00091 #if (USE_HAL_GFXMMU_REGISTER_CALLBACKS == 1) 00092 typedef struct __GFXMMU_HandleTypeDef 00093 #else 00094 typedef struct 00095 #endif 00096 { 00097 GFXMMU_TypeDef *Instance; /*!< GFXMMU instance */ 00098 GFXMMU_InitTypeDef Init; /*!< GFXMMU init parameters */ 00099 HAL_GFXMMU_StateTypeDef State; /*!< GFXMMU state */ 00100 __IO uint32_t ErrorCode; /*!< GFXMMU error code */ 00101 #if (USE_HAL_GFXMMU_REGISTER_CALLBACKS == 1) 00102 void (*ErrorCallback) (struct __GFXMMU_HandleTypeDef *hgfxmmu); /*!< GFXMMU error callback */ 00103 void (*MspInitCallback) (struct __GFXMMU_HandleTypeDef *hgfxmmu); /*!< GFXMMU MSP init callback */ 00104 void (*MspDeInitCallback) (struct __GFXMMU_HandleTypeDef *hgfxmmu); /*!< GFXMMU MSP de-init callback */ 00105 #endif 00106 }GFXMMU_HandleTypeDef; 00107 00108 /** 00109 * @brief GFXMMU LUT line structure definition 00110 */ 00111 typedef struct 00112 { 00113 uint32_t LineNumber; /*!< LUT line number. 00114 This parameter must be a number between Min_Data = 0 and Max_Data = 1023. */ 00115 uint32_t LineStatus; /*!< LUT line enable/disable. 00116 This parameter can be a value of @ref GFXMMU_LutLineStatus. */ 00117 uint32_t FirstVisibleBlock; /*!< First visible block on this line. 00118 This parameter must be a number between Min_Data = 0 and Max_Data = 255. */ 00119 uint32_t LastVisibleBlock; /*!< Last visible block on this line. 00120 This parameter must be a number between Min_Data = 0 and Max_Data = 255. */ 00121 int32_t LineOffset; /*!< Offset of block 0 of the current line in physical buffer. 00122 This parameter must be a number between Min_Data = -4080 and Max_Data = 4190208. 00123 @note: Line offset has to be computed with the following formula: 00124 LineOffset = [(Blocks already used) - (1st visible block)]*BlockSize. */ 00125 }GFXMMU_LutLineTypeDef; 00126 00127 #if (USE_HAL_GFXMMU_REGISTER_CALLBACKS == 1) 00128 /** 00129 * @brief GFXMMU callback ID enumeration definition 00130 */ 00131 typedef enum 00132 { 00133 HAL_GFXMMU_ERROR_CB_ID = 0x00U, /*!< GFXMMU error callback ID */ 00134 HAL_GFXMMU_MSPINIT_CB_ID = 0x01U, /*!< GFXMMU MSP init callback ID */ 00135 HAL_GFXMMU_MSPDEINIT_CB_ID = 0x02U /*!< GFXMMU MSP de-init callback ID */ 00136 }HAL_GFXMMU_CallbackIDTypeDef; 00137 00138 /** 00139 * @brief GFXMMU callback pointer definition 00140 */ 00141 typedef void (*pGFXMMU_CallbackTypeDef)(GFXMMU_HandleTypeDef *hgfxmmu); 00142 #endif 00143 00144 /** 00145 * @} 00146 */ 00147 /* End of exported types -----------------------------------------------------*/ 00148 00149 /* Exported constants --------------------------------------------------------*/ 00150 /** @defgroup GFXMMU_Exported_Constants GFXMMU Exported Constants 00151 * @{ 00152 */ 00153 00154 /** @defgroup GFXMMU_BlocksPerLine GFXMMU blocks per line 00155 * @{ 00156 */ 00157 #define GFXMMU_256BLOCKS 0x00000000U /*!< 256 blocks of 16 bytes per line */ 00158 #define GFXMMU_192BLOCKS GFXMMU_CR_192BM /*!< 192 blocks of 16 bytes per line */ 00159 /** 00160 * @} 00161 */ 00162 00163 /** @defgroup GFXMMU_Interrupts GFXMMU interrupts 00164 * @{ 00165 */ 00166 #define GFXMMU_AHB_MASTER_ERROR_IT GFXMMU_CR_AMEIE /*!< AHB master error interrupt */ 00167 #define GFXMMU_BUFFER0_OVERFLOW_IT GFXMMU_CR_B0OIE /*!< Buffer 0 overflow interrupt */ 00168 #define GFXMMU_BUFFER1_OVERFLOW_IT GFXMMU_CR_B1OIE /*!< Buffer 1 overflow interrupt */ 00169 #define GFXMMU_BUFFER2_OVERFLOW_IT GFXMMU_CR_B2OIE /*!< Buffer 2 overflow interrupt */ 00170 #define GFXMMU_BUFFER3_OVERFLOW_IT GFXMMU_CR_B3OIE /*!< Buffer 3 overflow interrupt */ 00171 /** 00172 * @} 00173 */ 00174 00175 /** @defgroup GFXMMU_Error_Code GFXMMU Error Code 00176 * @{ 00177 */ 00178 #define GFXMMU_ERROR_NONE 0x00000000U /*!< No error */ 00179 #define GFXMMU_ERROR_BUFFER0_OVERFLOW GFXMMU_SR_B0OF /*!< Buffer 0 overflow */ 00180 #define GFXMMU_ERROR_BUFFER1_OVERFLOW GFXMMU_SR_B1OF /*!< Buffer 1 overflow */ 00181 #define GFXMMU_ERROR_BUFFER2_OVERFLOW GFXMMU_SR_B2OF /*!< Buffer 2 overflow */ 00182 #define GFXMMU_ERROR_BUFFER3_OVERFLOW GFXMMU_SR_B3OF /*!< Buffer 3 overflow */ 00183 #define GFXMMU_ERROR_AHB_MASTER GFXMMU_SR_AMEF /*!< AHB master error */ 00184 #if (USE_HAL_GFXMMU_REGISTER_CALLBACKS == 1) 00185 #define GFXMMU_ERROR_INVALID_CALLBACK 0x00000100U /*!< Invalid callback error */ 00186 #endif 00187 /** 00188 * @} 00189 */ 00190 00191 /** @defgroup GFXMMU_LutLineStatus GFXMMU LUT line status 00192 * @{ 00193 */ 00194 #define GFXMMU_LUT_LINE_DISABLE 0x00000000U /*!< LUT line disabled */ 00195 #define GFXMMU_LUT_LINE_ENABLE GFXMMU_LUTxL_EN /*!< LUT line enabled */ 00196 /** 00197 * @} 00198 */ 00199 00200 /** 00201 * @} 00202 */ 00203 /* End of exported constants -------------------------------------------------*/ 00204 00205 /* Exported macros -----------------------------------------------------------*/ 00206 /** @defgroup GFXMMU_Exported_Macros GFXMMU Exported Macros 00207 * @{ 00208 */ 00209 00210 /** @brief Reset GFXMMU handle state. 00211 * @param __HANDLE__ GFXMMU handle. 00212 * @retval None 00213 */ 00214 #if (USE_HAL_GFXMMU_REGISTER_CALLBACKS == 1) 00215 #define __HAL_GFXMMU_RESET_HANDLE_STATE(__HANDLE__) do{ \ 00216 (__HANDLE__)->State = HAL_GFXMMU_STATE_RESET; \ 00217 (__HANDLE__)->MspInitCallback = NULL; \ 00218 (__HANDLE__)->MspDeInitCallback = NULL; \ 00219 } while(0) 00220 #else 00221 #define __HAL_GFXMMU_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_GFXMMU_STATE_RESET) 00222 #endif 00223 00224 /** 00225 * @} 00226 */ 00227 /* End of exported macros ----------------------------------------------------*/ 00228 00229 /* Exported functions --------------------------------------------------------*/ 00230 /** @addtogroup GFXMMU_Exported_Functions GFXMMU Exported Functions 00231 * @{ 00232 */ 00233 00234 /** @addtogroup GFXMMU_Exported_Functions_Group1 Initialization and de-initialization functions 00235 * @{ 00236 */ 00237 /* Initialization and de-initialization functions *****************************/ 00238 HAL_StatusTypeDef HAL_GFXMMU_Init(GFXMMU_HandleTypeDef *hgfxmmu); 00239 HAL_StatusTypeDef HAL_GFXMMU_DeInit(GFXMMU_HandleTypeDef *hgfxmmu); 00240 void HAL_GFXMMU_MspInit(GFXMMU_HandleTypeDef *hgfxmmu); 00241 void HAL_GFXMMU_MspDeInit(GFXMMU_HandleTypeDef *hgfxmmu); 00242 #if (USE_HAL_GFXMMU_REGISTER_CALLBACKS == 1) 00243 /* GFXMMU callbacks register/unregister functions *****************************/ 00244 HAL_StatusTypeDef HAL_GFXMMU_RegisterCallback(GFXMMU_HandleTypeDef *hgfxmmu, 00245 HAL_GFXMMU_CallbackIDTypeDef CallbackID, 00246 pGFXMMU_CallbackTypeDef pCallback); 00247 HAL_StatusTypeDef HAL_GFXMMU_UnRegisterCallback(GFXMMU_HandleTypeDef *hgfxmmu, 00248 HAL_GFXMMU_CallbackIDTypeDef CallbackID); 00249 #endif 00250 /** 00251 * @} 00252 */ 00253 00254 /** @addtogroup GFXMMU_Exported_Functions_Group2 Operations functions 00255 * @{ 00256 */ 00257 /* Operation functions ********************************************************/ 00258 HAL_StatusTypeDef HAL_GFXMMU_ConfigLut(GFXMMU_HandleTypeDef *hgfxmmu, 00259 uint32_t FirstLine, 00260 uint32_t LinesNumber, 00261 uint32_t Address); 00262 00263 HAL_StatusTypeDef HAL_GFXMMU_DisableLutLines(GFXMMU_HandleTypeDef *hgfxmmu, 00264 uint32_t FirstLine, 00265 uint32_t LinesNumber); 00266 00267 HAL_StatusTypeDef HAL_GFXMMU_ConfigLutLine(GFXMMU_HandleTypeDef *hgfxmmu, GFXMMU_LutLineTypeDef *lutLine); 00268 00269 HAL_StatusTypeDef HAL_GFXMMU_ModifyBuffers(GFXMMU_HandleTypeDef *hgfxmmu, GFXMMU_BuffersTypeDef *Buffers); 00270 00271 void HAL_GFXMMU_IRQHandler(GFXMMU_HandleTypeDef *hgfxmmu); 00272 00273 void HAL_GFXMMU_ErrorCallback(GFXMMU_HandleTypeDef *hgfxmmu); 00274 /** 00275 * @} 00276 */ 00277 00278 /** @defgroup GFXMMU_Exported_Functions_Group3 State functions 00279 * @{ 00280 */ 00281 /* State function *************************************************************/ 00282 HAL_GFXMMU_StateTypeDef HAL_GFXMMU_GetState(GFXMMU_HandleTypeDef *hgfxmmu); 00283 00284 uint32_t HAL_GFXMMU_GetError(GFXMMU_HandleTypeDef *hgfxmmu); 00285 /** 00286 * @} 00287 */ 00288 00289 /** 00290 * @} 00291 */ 00292 /* End of exported functions -------------------------------------------------*/ 00293 00294 /* Private macros ------------------------------------------------------------*/ 00295 /** @defgroup GFXMMU_Private_Macros GFXMMU Private Macros 00296 * @{ 00297 */ 00298 #define IS_GFXMMU_BLOCKS_PER_LINE(VALUE) (((VALUE) == GFXMMU_256BLOCKS) || \ 00299 ((VALUE) == GFXMMU_192BLOCKS)) 00300 00301 #define IS_GFXMMU_BUFFER_ADDRESS(VALUE) (((VALUE) & 0xFU) == 0U) 00302 00303 #define IS_GFXMMU_INTERRUPTS(VALUE) (((VALUE) & 0x1FU) != 0U) 00304 00305 #define IS_GFXMMU_LUT_LINE(VALUE) ((VALUE) < 1024U) 00306 00307 #define IS_GFXMMU_LUT_LINES_NUMBER(VALUE) (((VALUE) > 0U) && ((VALUE) <= 1024U)) 00308 00309 #define IS_GFXMMU_LUT_LINE_STATUS(VALUE) (((VALUE) == GFXMMU_LUT_LINE_DISABLE) || \ 00310 ((VALUE) == GFXMMU_LUT_LINE_ENABLE)) 00311 00312 #define IS_GFXMMU_LUT_BLOCK(VALUE) ((VALUE) < 256U) 00313 00314 #define IS_GFXMMU_LUT_LINE_OFFSET(VALUE) (((VALUE) >= -4080) && ((VALUE) <= 4190208)) 00315 /** 00316 * @} 00317 */ 00318 /* End of private macros -----------------------------------------------------*/ 00319 00320 /** 00321 * @} 00322 */ 00323 00324 /** 00325 * @} 00326 */ 00327 #endif /* GFXMMU */ 00328 #ifdef __cplusplus 00329 } 00330 #endif 00331 00332 #endif /* STM32L4xx_HAL_GFXMMU_H */ 00333