STM32H735xx HAL User Manual
|
00001 /** 00002 ****************************************************************************** 00003 * @file stm32h7xx_hal_ramecc.h 00004 * @author MCD Application Team 00005 * @brief Header file of RAMECC 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 STM32H7xx_HAL_RAMECC_H 00021 #define STM32H7xx_HAL_RAMECC_H 00022 00023 #ifdef __cplusplus 00024 extern "C" { 00025 #endif 00026 00027 /* Includes ------------------------------------------------------------------*/ 00028 #include "stm32h7xx_hal_def.h" 00029 00030 /** @addtogroup STM32H7xx_HAL_Driver 00031 * @{ 00032 */ 00033 00034 /** @addtogroup RAMECC 00035 * @{ 00036 */ 00037 00038 /* Exported types ------------------------------------------------------------*/ 00039 00040 /** @defgroup RAMECC_Exported_Types RAMECC Exported Types 00041 * @brief RAMECC Exported Types 00042 * @{ 00043 */ 00044 00045 /** 00046 * @brief HAL RAMECC State structures definition 00047 */ 00048 typedef enum 00049 { 00050 HAL_RAMECC_STATE_RESET = 0x00U, /*!< RAMECC not yet initialized or disabled */ 00051 HAL_RAMECC_STATE_READY = 0x01U, /*!< RAMECC initialized and ready for use */ 00052 HAL_RAMECC_STATE_BUSY = 0x02U, /*!< RAMECC process is ongoing */ 00053 HAL_RAMECC_STATE_ERROR = 0x03U, /*!< RAMECC error state */ 00054 }HAL_RAMECC_StateTypeDef; 00055 00056 00057 /** 00058 * @brief RAMECC handle Structure definition 00059 */ 00060 00061 typedef struct __RAMECC_HandleTypeDef 00062 { 00063 RAMECC_MonitorTypeDef *Instance; /*!< Register base address */ 00064 __IO HAL_RAMECC_StateTypeDef State; /*!< RAMECC state */ 00065 __IO uint32_t ErrorCode; /*!< RAMECC Error Code */ 00066 void (* DetectErrorCallback)( struct __RAMECC_HandleTypeDef *hramecc); /*!< RAMECC error detect callback */ 00067 }RAMECC_HandleTypeDef; 00068 00069 /** 00070 * @} 00071 */ 00072 00073 00074 /* Exported constants --------------------------------------------------------*/ 00075 00076 /** @defgroup RAMECC_Error_Codes RAMECC Error Codes 00077 * @{ 00078 */ 00079 #define HAL_RAMECC_ERROR_NONE 0x00000000U /*!< RAMECC No Error */ 00080 #define HAL_RAMECC_ERROR_TIMEOUT 0x00000001U /*!< RAMECC Timeout Error */ 00081 #define HAL_RAMECC_ERROR_BUSY 0x00000002U /*!< RAMECC Busy Error */ 00082 #define HAL_RAMECC_ERROR_INVALID_CALLBACK 0x00000003U /*!< Invalid Callback error */ 00083 /** 00084 * @} 00085 */ 00086 00087 /** @defgroup RAMECC_Interrupt RAMECC interrupts 00088 * @{ 00089 */ 00090 #define RAMECC_IT_GLOBAL_ID 0x10000000UL 00091 #define RAMECC_IT_MONITOR_ID 0x20000000UL 00092 00093 #define RAMECC_IT_GLOBAL_ENABLE (RAMECC_IT_GLOBAL_ID | RAMECC_IER_GIE) 00094 #define RAMECC_IT_GLOBAL_SINGLEERR_R (RAMECC_IT_GLOBAL_ID | RAMECC_IER_GECCSEIE) 00095 #define RAMECC_IT_GLOBAL_DOUBLEERR_R (RAMECC_IT_GLOBAL_ID | RAMECC_IER_GECCDEIE) 00096 #define RAMECC_IT_GLOBAL_DOUBLEERR_W (RAMECC_IT_GLOBAL_ID | RAMECC_IER_GECCDEBWIE) 00097 #define RAMECC_IT_GLOBAL_ALL (RAMECC_IT_GLOBAL_ID | RAMECC_IER_GIE | RAMECC_IER_GECCSEIE | RAMECC_IER_GECCDEIE | RAMECC_IER_GECCDEBWIE) 00098 00099 00100 #define RAMECC_IT_MONITOR_SINGLEERR_R (RAMECC_IT_MONITOR_ID | RAMECC_CR_ECCSEIE) 00101 #define RAMECC_IT_MONITOR_DOUBLEERR_R (RAMECC_IT_MONITOR_ID | RAMECC_CR_ECCDEIE) 00102 #define RAMECC_IT_MONITOR_DOUBLEERR_W (RAMECC_IT_MONITOR_ID | RAMECC_CR_ECCDEBWIE) 00103 #define RAMECC_IT_MONITOR_ALL (RAMECC_IT_MONITOR_ID | RAMECC_CR_ECCDEBWIE | RAMECC_CR_ECCDEIE | RAMECC_CR_ECCSEIE) 00104 /** 00105 * @} 00106 */ 00107 00108 /** @defgroup RAMECC_FLAG RAMECC Monitor flags 00109 * @{ 00110 */ 00111 #define RAMECC_FLAG_SINGLEERR_R RAMECC_SR_SEDCF 00112 #define RAMECC_FLAG_DOUBLEERR_R RAMECC_SR_DEDF 00113 #define RAMECC_FLAG_DOUBLEERR_W RAMECC_SR_DEBWDF 00114 #define RAMECC_FLAGS_ALL (RAMECC_SR_SEDCF | RAMECC_SR_DEDF | RAMECC_SR_DEBWDF) 00115 00116 /** 00117 * @} 00118 */ 00119 00120 /* Exported macro ------------------------------------------------------------*/ 00121 /** @defgroup RAMECC_Exported_Macros RAMECC Exported Macros 00122 * @{ 00123 */ 00124 00125 #define __HAL_RAMECC_ENABLE_GLOBAL_IT(__HANDLE__, __INTERRUPT__) ((((RAMECC_TypeDef *)((uint32_t)(__HANDLE__)->Instance & 0xFFFFFF00U))->IER) |= ((__INTERRUPT__) & ~RAMECC_IT_GLOBAL_ID)) 00126 #define __HAL_RAMECC_ENABLE_MONITOR_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= ((__INTERRUPT__) & ~RAMECC_IT_MONITOR_ID)) 00127 00128 /** 00129 * @brief Enable the specified RAMECC interrupts. 00130 * @param __HANDLE__ : RAMECC handle. 00131 * @param __INTERRUPT__: specifies the RAMECC interrupt sources to be enabled or disabled. 00132 * This parameter can be one of the following values: 00133 * @arg RAMECC_IT_GLOBAL_E : Global interrupt enable mask. 00134 * @arg RAMECC_IT_GLOBAL_SEE : Global ECC single error interrupt enable. 00135 * @arg RAMECC_IT_GLOBAL_DEE : Global ECC double error interrupt enable. 00136 * @arg RAMECC_IT_GLOBAL_DEBWE : Global ECC double error on byte write (BW) interrupt enable. 00137 * @arg RAMECC_IT_GLOBAL_ALL : All Global ECC interrupts enable mask. 00138 * @arg RAMECC_IT_MONITOR_SEE : Monitor ECC single error interrupt enable. 00139 * @arg RAMECC_IT_MONITOR_DEE : Monitor ECC double error interrupt enable. 00140 * @arg RAMECC_IT_MONITOR_DEBWE : Monitor ECC double error on byte write (BW) interrupt enable. 00141 * @arg RAMECC_IT_MONITOR_ALL : All Monitor ECC interrupts enable mask. 00142 * @retval None 00143 */ 00144 #define __HAL_RAMECC_ENABLE_IT(__HANDLE__, __INTERRUPT__) ( \ 00145 (IS_RAMECC_GLOBAL_INTERRUPT(__INTERRUPT__)) ? (__HAL_RAMECC_ENABLE_GLOBAL_IT((__HANDLE__), (__INTERRUPT__))) :\ 00146 (__HAL_RAMECC_ENABLE_MONITOR_IT((__HANDLE__), (__INTERRUPT__)))) 00147 00148 00149 #define __HAL_RAMECC_DISABLE_GLOBAL_IT(__HANDLE__, __INTERRUPT__) ((((RAMECC_TypeDef *)((uint32_t)(__HANDLE__)->Instance & 0xFFFFFF00U))->IER) &= ~((__INTERRUPT__) & ~RAMECC_IT_GLOBAL_ID)) 00150 #define __HAL_RAMECC_DISABLE_MONITOR_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~((__INTERRUPT__) & ~RAMECC_IT_MONITOR_ID)) 00151 00152 /** 00153 * @brief Disable the specified RAMECC interrupts. 00154 * @param __HANDLE__ : RAMECC handle. 00155 * @param __INTERRUPT__: specifies the RAMECC interrupt sources to be enabled or disabled. 00156 * This parameter can be one of the following values: 00157 * @arg RAMECC_IT_GLOBAL_E : Global interrupt enable mask. 00158 * @arg RAMECC_IT_GLOBAL_SEE : Global ECC single error interrupt enable. 00159 * @arg RAMECC_IT_GLOBAL_DEE : Global ECC double error interrupt enable. 00160 * @arg RAMECC_IT_GLOBAL_DEBWE : Global ECC double error on byte write (BW) interrupt enable. 00161 * @arg RAMECC_IT_GLOBAL_ALL : All Global ECC interrupts enable mask. 00162 * @arg RAMECC_IT_MONITOR_SEE : Monitor ECC single error interrupt enable. 00163 * @arg RAMECC_IT_MONITOR_DEE : Monitor ECC double error interrupt enable. 00164 * @arg RAMECC_IT_MONITOR_DEBWE : Monitor ECC double error on byte write (BW) interrupt enable. 00165 * @arg RAMECC_IT_MONITOR_ALL : All Monitor ECC interrupts enable mask. 00166 * @retval None 00167 */ 00168 #define __HAL_RAMECC_DISABLE_IT(__HANDLE__, __INTERRUPT__) ( \ 00169 (IS_RAMECC_GLOBAL_INTERRUPT(__INTERRUPT__)) ? (__HAL_RAMECC_DISABLE_GLOBAL_IT((__HANDLE__), (__INTERRUPT__))) :\ 00170 (__HAL_RAMECC_DISABLE_MONITOR_IT((__HANDLE__), (__INTERRUPT__)))) 00171 00172 00173 #define __HAL_RAMECC_GET_GLOBAL_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((RAMECC_TypeDef *)((uint32_t)(__HANDLE__)->Instance & 0xFFFFFF00U))->IER) & ((__INTERRUPT__) & ~RAMECC_IT_GLOBAL_ID)) ? SET : RESET) 00174 #define __HAL_RAMECC_GET_MONITOR_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->CR) & ((__INTERRUPT__) & ~RAMECC_IT_GLOBAL_ID)) ? SET : RESET) 00175 00176 /** 00177 * @brief Check whether the specified RAMECC interrupt source is enabled or not. 00178 * @param __HANDLE__ : Specifies the RAMECC Handle. 00179 * @param __INTERRUPT__ : Specifies the RAMECC interrupt source to check. 00180 * This parameter can be one of the following values: 00181 * @arg RAMECC_IT_GLOBAL_E : Global interrupt enable mask. 00182 * @arg RAMECC_IT_GLOBAL_SEE : Global ECC single error interrupt enable. 00183 * @arg RAMECC_IT_GLOBAL_DEE : Global ECC double error interrupt enable. 00184 * @arg RAMECC_IT_GLOBAL_DEBWE : Global ECC double error on byte write (BW) interrupt enable. 00185 * @arg RAMECC_IT_GLOBAL_ALL : All Global ECC interrupts enable mask. 00186 * @arg RAMECC_IT_MONITOR_SEE : Monitor ECC single error interrupt enable. 00187 * @arg RAMECC_IT_MONITOR_DEE : Monitor ECC double error interrupt enable. 00188 * @arg RAMECC_IT_MONITOR_DEBWE : Monitor ECC double error on byte write (BW) interrupt enable. 00189 * @arg RAMECC_IT_MONITOR_ALL : All Monitor ECC interrupts enable mask. 00190 * @retval The new state of __INTERRUPT__ (SET or RESET). 00191 */ 00192 #define __HAL_RAMECC_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ( \ 00193 (IS_RAMECC_GLOBAL_INTERRUPT(__INTERRUPT__)) ? (__HAL_RAMECC_GET_GLOBAL_IT_SOURCE((__HANDLE__), (__INTERRUPT__))) :\ 00194 (__HAL_RAMECC_GET_MONITOR_IT_SOURCE((__HANDLE__), (__INTERRUPT__)))) 00195 00196 00197 /** 00198 * @brief Get the RAMECC pending flags. 00199 * @param __HANDLE__ : RAMECC handle. 00200 * @param __FLAG__ : specifies the flag to clear. 00201 * This parameter can be any combination of the following values: 00202 * @arg RAMECC_FLAG_SEDCF : RAMECC instance ECC single error detected and corrected flag. 00203 * @arg RAMECC_FLAG_DEDF : RAMECC instance ECC double error detected flag. 00204 * @arg RAMECC_FLAG_DEBWDF : RAMECC instance ECC double error on byte write (BW) detected flag. 00205 * @arg RAMECC_FLAGS_ALL : RAMECC instance all flag. 00206 * @retval The state of __FLAG__ (SET or RESET). 00207 */ 00208 #define __HAL_RAMECC_GET_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->SR &= (__FLAG__)) 00209 00210 00211 /** 00212 * @brief Clear the RAMECC pending flags. 00213 * @param __HANDLE__ : RAMECC handle. 00214 * @param __FLAG__ : specifies the flag to clear. 00215 * This parameter can be any combination of the following values: 00216 * @arg RAMECC_FLAG_SEDCF : RAMECC instance ECC single error detected and corrected flag. 00217 * @arg RAMECC_FLAG_DEDF : RAMECC instance ECC double error detected flag. 00218 * @arg RAMECC_FLAG_DEBWDF : RAMECC instance ECC double error on byte write (BW) detected flag. 00219 * @arg RAMECC_FLAGS_ALL : RAMECC instance all flag. 00220 * @retval None. 00221 */ 00222 #define __HAL_RAMECC_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->SR &= ~(__FLAG__)) 00223 00224 /** 00225 * @brief Reset the RAMECC handle state. 00226 * @param __HANDLE__ : Specifies the RAMECC Handle. 00227 * @retval None. 00228 */ 00229 #define __HAL_RAMECC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_RAMECC_STATE_RESET) 00230 /** 00231 * @} 00232 */ 00233 00234 /* Exported functions --------------------------------------------------------*/ 00235 00236 /** @defgroup RAMECC_Exported_Functions RAMECC Exported Functions 00237 * @brief RAMECC Exported functions 00238 * @{ 00239 */ 00240 00241 /** @defgroup RAMECC_Exported_Functions_Group1 Initialization and de-initialization functions 00242 * @brief Initialization and de-initialization functions 00243 * @{ 00244 */ 00245 HAL_StatusTypeDef HAL_RAMECC_Init (RAMECC_HandleTypeDef *hramecc); 00246 HAL_StatusTypeDef HAL_RAMECC_DeInit (RAMECC_HandleTypeDef *hramecc); 00247 /** 00248 * @} 00249 */ 00250 00251 /** @defgroup RAMECC_Exported_Functions_Group2 monitoring operation functions 00252 * @brief monitoring operation functions 00253 * @{ 00254 */ 00255 HAL_StatusTypeDef HAL_RAMECC_StartMonitor (RAMECC_HandleTypeDef *hramecc); 00256 HAL_StatusTypeDef HAL_RAMECC_StopMonitor (RAMECC_HandleTypeDef *hramecc); 00257 HAL_StatusTypeDef HAL_RAMECC_EnableNotification (RAMECC_HandleTypeDef *hramecc, uint32_t Notifications); 00258 HAL_StatusTypeDef HAL_RAMECC_DisableNotification (RAMECC_HandleTypeDef *hramecc, uint32_t Notifications); 00259 void HAL_RAMECC_IRQHandler (RAMECC_HandleTypeDef *hramecc); 00260 HAL_StatusTypeDef HAL_RAMECC_RegisterCallback (RAMECC_HandleTypeDef *hramecc, void (* pCallback)(RAMECC_HandleTypeDef *_hramecc)); 00261 HAL_StatusTypeDef HAL_RAMECC_UnRegisterCallback (RAMECC_HandleTypeDef *hramecc); 00262 /** 00263 * @} 00264 */ 00265 00266 /** @defgroup RAMECC_Exported_Functions_Group3 Error information functions 00267 * @brief Error information functions 00268 * @{ 00269 */ 00270 uint32_t HAL_RAMECC_GetFailingAddress (RAMECC_HandleTypeDef *hramecc); 00271 uint32_t HAL_RAMECC_GetFailingDataLow (RAMECC_HandleTypeDef *hramecc); 00272 uint32_t HAL_RAMECC_GetFailingDataHigh (RAMECC_HandleTypeDef *hramecc); 00273 uint32_t HAL_RAMECC_GetHammingErrorCode (RAMECC_HandleTypeDef *hramecc); 00274 uint32_t HAL_RAMECC_IsECCSingleErrorDetected (RAMECC_HandleTypeDef *hramecc); 00275 uint32_t HAL_RAMECC_IsECCDoubleErrorDetected (RAMECC_HandleTypeDef *hramecc); 00276 /** 00277 * @} 00278 */ 00279 00280 /** @defgroup RAMECC_Exported_Functions_Group3 Error information functions 00281 * @brief Error information functions 00282 * @{ 00283 */ 00284 HAL_RAMECC_StateTypeDef HAL_RAMECC_GetState (RAMECC_HandleTypeDef *hramecc); 00285 uint32_t HAL_RAMECC_GetError (RAMECC_HandleTypeDef *hramecc); 00286 /** 00287 * @} 00288 */ 00289 00290 /** 00291 * @} 00292 */ 00293 /* Private Constants -------------------------------------------------------------*/ 00294 /** @defgroup RAMECC_Private_Constants RAMECC Private Constants 00295 * @brief RAMECC private defines and constants 00296 * @{ 00297 */ 00298 /** 00299 * @} 00300 */ 00301 00302 /* Private macros ------------------------------------------------------------*/ 00303 /** @defgroup RAMECC_Private_Macros RAMECC Private Macros 00304 * @brief RAMECC private macros 00305 * @{ 00306 */ 00307 00308 #define IS_RAMECC_GLOBAL_INTERRUPT(INTERRUPT) (((INTERRUPT) == RAMECC_IT_GLOBAL_ENABLE) || \ 00309 ((INTERRUPT) == RAMECC_IT_GLOBAL_SINGLEERR_R) || \ 00310 ((INTERRUPT) == RAMECC_IT_GLOBAL_DOUBLEERR_R) || \ 00311 ((INTERRUPT) == RAMECC_IT_GLOBAL_DOUBLEERR_W) || \ 00312 ((INTERRUPT) == RAMECC_IT_GLOBAL_ALL)) 00313 00314 00315 #define IS_RAMECC_MONITOR_INTERRUPT(INTERRUPT) (((INTERRUPT) == RAMECC_IT_MONITOR_SINGLEERR_R) || \ 00316 ((INTERRUPT) == RAMECC_IT_MONITOR_DOUBLEERR_R) || \ 00317 ((INTERRUPT) == RAMECC_IT_MONITOR_DOUBLEERR_W) || \ 00318 ((INTERRUPT) == RAMECC_IT_MONITOR_ALL)) 00319 00320 #define IS_RAMECC_INTERRUPT(INTERRUPT) ((IS_RAMECC_GLOBAL_INTERRUPT(INTERRUPT)) || \ 00321 (IS_RAMECC_MONITOR_INTERRUPT(INTERRUPT))) 00322 00323 /** 00324 * @} 00325 */ 00326 00327 /** @defgroup RAMECC_FLAG RAMECC Monitor flags 00328 * @{ 00329 */ 00330 00331 /* Private functions ---------------------------------------------------------*/ 00332 /** @defgroup RAMECC_Private_Functions RAMECC Private Functions 00333 * @brief RAMECC private functions 00334 * @{ 00335 */ 00336 /** 00337 * @} 00338 */ 00339 00340 /** 00341 * @} 00342 */ 00343 00344 /** 00345 * @} 00346 */ 00347 00348 /** 00349 * @} 00350 */ 00351 #ifdef __cplusplus 00352 } 00353 #endif 00354 00355 #endif /* STM32H7xx_HAL_RAMECC_H */ 00356