STM32H735xx HAL User Manual
stm32h7xx_hal_ramecc.c
Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm32h7xx_hal_ramecc.c
00004   * @author  MCD Application Team
00005   * @brief   RAMECC HAL module driver.
00006   *          This file provides firmware functions to manage the following
00007   *          functionalities of the RAM ECC monitoring (RAMECC) peripheral:
00008   *           + Initialization and de-initialization functions
00009   *           + Monitoring operation functions
00010   *           + Error information functions
00011   *           + State and error functions
00012   ******************************************************************************
00013   * @attention
00014   *
00015   * Copyright (c) 2017 STMicroelectronics.
00016   * All rights reserved.
00017   *
00018   * This software is licensed under terms that can be found in the LICENSE file
00019   * in the root directory of this software component.
00020   * If no LICENSE file comes with this software, it is provided AS-IS.
00021   *
00022   ******************************************************************************
00023   @verbatim
00024   ==============================================================================
00025                         ##### How to use this driver #####
00026   ==============================================================================
00027   [..]
00028    (#) Enable and latch error information through HAL_RAMECC_Init().
00029 
00030    (#) For a given Monitor, enable and disable interrupt through
00031        HAL_RAMECC_EnableNotification().
00032        To enable a notification for a given RAMECC instance, use global
00033        interrupts.
00034        To enable a notification for only RAMECC monitor, use monitor interrupts.
00035        All possible notifications are defined in the driver header file under
00036        RAMECC_Interrupt group.
00037 
00038      *** Silent mode ***
00039      ===================
00040     [..]
00041           (+) Use HAL_RAMECC_StartMonitor() to start RAMECC latch failing
00042               information without enabling any notification.
00043 
00044      *** Interrupt mode ***
00045      ======================
00046     [..]
00047           (+) Use HAL_RAMECC_EnableNotification() to enable interrupts for a
00048               given error.
00049           (+) Configure the RAMECC interrupt priority using
00050               HAL_NVIC_SetPriority().
00051           (+) Enable the RAMECC IRQ handler using HAL_NVIC_EnableIRQ().
00052           (+) Start RAMECC latch failing information using HAL_RAMECC_StartMonitor().
00053 
00054      *** Failing information ***
00055      ======================
00056     [..]
00057      (#) Use HAL_RAMECC_GetFailingAddress() function to return the RAMECC
00058          failing address.
00059      (#) Use HAL_RAMECC_GetFailingDataLow() function to return the RAMECC
00060          failing data low.
00061      (#) Use HAL_RAMECC_GetFailingDataHigh() function to return the RAMECC
00062          failing data high.
00063      (#) Use HAL_RAMECC_GetHammingErrorCode() function to return the RAMECC
00064          Hamming bits injected.
00065      (#) Use HAL_RAMECC_IsECCSingleErrorDetected() function to check if a single
00066          error was detected and corrected.
00067      (#) Use HAL_RAMECC_IsECCDoubleErrorDetected() function to check if a double
00068          error was dedetected.
00069 
00070      *** RAMECC HAL driver macros list ***
00071      =============================================
00072      [..]
00073        Below the list of used macros in RAMECC HAL driver.
00074 
00075       (+) __HAL_RAMECC_ENABLE_IT  : Enable the specified ECCRAM Monitor
00076                                     interrupts.
00077       (+) __HAL_RAMECC_DISABLE_IT : Disable the specified ECCRAM Monitor
00078                                     interrupts.
00079       (+) __HAL_RAMECC_GET_FLAG   : Return the current RAMECC Monitor selected
00080                                     flag.
00081       (+) __HAL_RAMECC_CLEAR_FLAG : Clear the current RAMECC Monitor selected
00082                                     flag.
00083   @endverbatim
00084   */
00085 
00086 /* Includes ------------------------------------------------------------------*/
00087 #include "stm32h7xx_hal.h"
00088 
00089 /** @addtogroup STM32H7xx_HAL_Driver
00090   * @{
00091   */
00092 
00093 /** @defgroup RAMECC RAMECC
00094   * @brief RAMECC HAL module driver
00095   * @{
00096   */
00097 
00098 #ifdef HAL_RAMECC_MODULE_ENABLED
00099 
00100 /* Private types -------------------------------------------------------------*/
00101 /* Private variables ---------------------------------------------------------*/
00102 /* Private constants ---------------------------------------------------------*/
00103 /* Private macros ------------------------------------------------------------*/
00104 /* Private functions ---------------------------------------------------------*/
00105 /* Exported functions --------------------------------------------------------*/
00106 
00107 /** @addtogroup RAMECC_Exported_Functions
00108   * @{
00109   */
00110 
00111 /** @addtogroup RAMECC_Exported_Functions_Group1
00112   *
00113 @verbatim
00114  ===============================================================================
00115              ##### Initialization and de-initialization functions  #####
00116  ===============================================================================
00117     [..]
00118     This section provides functions allowing to initialize the RAMECC Monitor.
00119     [..]
00120     The HAL_RAMECC_Init() function follows the RAMECC configuration procedures
00121     as described in reference manual.
00122     The HAL_RAMECC_DeInit() function allows to deinitialize the RAMECC monitor.
00123 
00124 @endverbatim
00125   * @{
00126   */
00127 
00128 /**
00129   * @brief  Initialize the RAMECC by clearing flags and disabling interrupts.
00130   * @param  hramecc  Pointer to a RAMECC_HandleTypeDef structure that contains
00131   *                  the configuration information for the specified RAMECC
00132   *                  Monitor.
00133   * @retval HAL status.
00134   */
00135 HAL_StatusTypeDef HAL_RAMECC_Init (RAMECC_HandleTypeDef *hramecc)
00136 {
00137   /* Check the RAMECC peripheral handle */
00138   if (hramecc == NULL)
00139   {
00140     /* Return HAL status */
00141     return HAL_ERROR;
00142   }
00143 
00144   /* Check the parameters */
00145   assert_param (IS_RAMECC_MONITOR_ALL_INSTANCE (hramecc->Instance));
00146 
00147   /* Change RAMECC peripheral state */
00148   hramecc->State = HAL_RAMECC_STATE_BUSY;
00149 
00150   /* Disable RAMECC monitor */
00151   hramecc->Instance->CR &= ~RAMECC_CR_ECCELEN;
00152 
00153   /* Disable all global interrupts */
00154   ((RAMECC_TypeDef *)((uint32_t)hramecc->Instance & 0xFFFFFF00U))->IER &= \
00155     ~(RAMECC_IER_GIE | RAMECC_IER_GECCSEIE | RAMECC_IER_GECCDEIE | RAMECC_IER_GECCDEBWIE);
00156 
00157   /* Disable all interrupts monitor  */
00158   hramecc->Instance->CR &= ~(RAMECC_CR_ECCSEIE | RAMECC_CR_ECCDEIE | RAMECC_CR_ECCDEBWIE);
00159 
00160   /* Clear RAMECC monitor flags */
00161   __HAL_RAMECC_CLEAR_FLAG (hramecc, RAMECC_FLAGS_ALL);
00162 
00163   /* Initialise the RAMECC error code */
00164   hramecc->ErrorCode = HAL_RAMECC_ERROR_NONE;
00165 
00166   /* Update the RAMECC state */
00167   hramecc->State = HAL_RAMECC_STATE_READY;
00168 
00169   /* Return HAL status */
00170   return HAL_OK;
00171 }
00172 
00173 
00174 /**
00175   * @brief  DeInitializes the RAMECC peripheral.
00176   * @param  hramecc  Pointer to a RAMECC_HandleTypeDef structure that contains
00177   *                  the configuration information for the specified RAMECC
00178   *                  Monitor.
00179   * @retval HAL status.
00180   */
00181 HAL_StatusTypeDef HAL_RAMECC_DeInit (RAMECC_HandleTypeDef *hramecc)
00182 {
00183   /* Check the RAMECC peripheral handle */
00184   if (hramecc == NULL)
00185   {
00186     /* Return HAL status */
00187     return HAL_ERROR;
00188   }
00189 
00190   /* Check the parameters */
00191   assert_param (IS_RAMECC_MONITOR_ALL_INSTANCE (hramecc->Instance));
00192 
00193   /* Disable RAMECC monitor */
00194   hramecc->Instance->CR &= ~RAMECC_CR_ECCELEN;
00195 
00196   /* Disable all global interrupts */
00197   ((RAMECC_TypeDef *)((uint32_t)hramecc->Instance & 0xFFFFFF00U))->IER &= \
00198     ~(RAMECC_IER_GIE | RAMECC_IER_GECCSEIE | RAMECC_IER_GECCDEIE | RAMECC_IER_GECCDEBWIE);
00199 
00200   /* Disable all interrupts monitor  */
00201   hramecc->Instance->CR &= ~(RAMECC_CR_ECCSEIE | RAMECC_CR_ECCDEIE | RAMECC_CR_ECCDEBWIE);
00202 
00203   /* Clear RAMECC monitor flags */
00204   __HAL_RAMECC_CLEAR_FLAG (hramecc, RAMECC_FLAGS_ALL);
00205 
00206   /* Clean callback */
00207   hramecc->DetectErrorCallback = NULL;
00208 
00209   /* Initialise the RAMECC error code */
00210   hramecc->ErrorCode = HAL_RAMECC_ERROR_NONE;
00211 
00212   /* Change RAMECC peripheral state */
00213   hramecc->State = HAL_RAMECC_STATE_RESET;
00214 
00215   /* Return HAL status */
00216   return HAL_OK;
00217 }
00218 /**
00219   * @}
00220   */
00221 
00222 /**
00223   * @}
00224   */
00225 
00226 /** @addtogroup RAMECC_Exported_Functions_Group2
00227   *
00228 @verbatim
00229  ===============================================================================
00230                    #####  Monitoring operation functions  #####
00231  ===============================================================================
00232     [..]  This section provides functions allowing to:
00233       (+) Configure latching error information.
00234       (+) Configure RAMECC Global/Monitor interrupts.
00235       (+) Register and Unregister RAMECC callbacks
00236       (+) Handle RAMECC interrupt request
00237 
00238 @endverbatim
00239   * @{
00240   */
00241 
00242 /**
00243   * @brief  Starts the RAMECC latching error information.
00244   * @param  hramecc  Pointer to a RAMECC_HandleTypeDef structure that contains
00245   *                  the configuration information for the specified RAMECC
00246   *                  Monitor.
00247   * @retval HAL status.
00248   */
00249 HAL_StatusTypeDef HAL_RAMECC_StartMonitor (RAMECC_HandleTypeDef *hramecc)
00250 {
00251   /* Check the parameters */
00252   assert_param (IS_RAMECC_MONITOR_ALL_INSTANCE (hramecc->Instance));
00253 
00254   /* Check RAMECC state */
00255   if (hramecc->State == HAL_RAMECC_STATE_READY)
00256   {
00257     /* Change RAMECC peripheral state */
00258     hramecc->State = HAL_RAMECC_STATE_BUSY;
00259 
00260     /* Enable RAMECC monitor */
00261     hramecc->Instance->CR |= RAMECC_CR_ECCELEN;
00262 
00263     /* Change RAMECC peripheral state */
00264     hramecc->State = HAL_RAMECC_STATE_READY;
00265   }
00266   else
00267   {
00268     /* Update the error code */
00269     hramecc->ErrorCode = HAL_RAMECC_ERROR_BUSY;
00270 
00271     /* Return HAL status */
00272     return HAL_ERROR;
00273   }
00274 
00275   /* Return HAL status */
00276   return HAL_OK;
00277 }
00278 
00279 
00280 /**
00281   * @brief  Stop the RAMECC latching error information.
00282   * @param  hramecc  Pointer to a RAMECC_HandleTypeDef structure that contains
00283   *                  the configuration information for the specified RAMECC
00284   *                  Monitor.
00285   * @retval HAL status.
00286   */
00287 HAL_StatusTypeDef HAL_RAMECC_StopMonitor (RAMECC_HandleTypeDef *hramecc)
00288 {
00289   /* Check the parameters */
00290   assert_param (IS_RAMECC_MONITOR_ALL_INSTANCE (hramecc->Instance));
00291 
00292   /* Check RAMECC state */
00293   if (hramecc->State == HAL_RAMECC_STATE_READY)
00294   {
00295     /* Change RAMECC peripheral state */
00296     hramecc->State = HAL_RAMECC_STATE_BUSY;
00297 
00298     /* Disable RAMECC monitor */
00299     hramecc->Instance->CR &= ~RAMECC_CR_ECCELEN;
00300 
00301     /* Change RAMECC peripheral state */
00302     hramecc->State = HAL_RAMECC_STATE_READY;
00303   }
00304   else
00305   {
00306     /* Update the error code */
00307     hramecc->ErrorCode = HAL_RAMECC_ERROR_BUSY;
00308 
00309     /* Return HAL status */
00310     return HAL_ERROR;
00311   }
00312 
00313   /* Return HAL status */
00314   return HAL_OK;
00315 }
00316 
00317 
00318 /**
00319   * @brief  Enable the RAMECC error interrupts.
00320   * @param  hramecc        Pointer to a RAMECC_HandleTypeDef structure that
00321   *                        contains the configuration information for the
00322   *                        specified RAMECC Monitor.
00323   * @param  Notifications  Select the notification.
00324   * @retval HAL status.
00325   */
00326 HAL_StatusTypeDef HAL_RAMECC_EnableNotification (RAMECC_HandleTypeDef *hramecc, uint32_t Notifications)
00327 {
00328   /* Check the parameters */
00329   assert_param (IS_RAMECC_MONITOR_ALL_INSTANCE (hramecc->Instance));
00330   assert_param (IS_RAMECC_INTERRUPT (Notifications));
00331 
00332   /* Check RAMECC state */
00333   if (hramecc->State == HAL_RAMECC_STATE_READY)
00334   {
00335     /* Change RAMECC peripheral state */
00336     hramecc->State = HAL_RAMECC_STATE_BUSY;
00337 
00338     /* Enable RAMECC interrupts */
00339     __HAL_RAMECC_ENABLE_IT (hramecc, Notifications);
00340 
00341     /* Change RAMECC peripheral state */
00342     hramecc->State = HAL_RAMECC_STATE_READY;
00343   }
00344   else
00345   {
00346     /* Update the error code */
00347     hramecc->ErrorCode = HAL_RAMECC_ERROR_BUSY;
00348 
00349     /* Return HAL status */
00350     return HAL_ERROR;
00351   }
00352 
00353   /* Return HAL status */
00354   return HAL_OK;
00355 }
00356 
00357 
00358 /**
00359   * @brief  Disable the RAMECC error interrupts.
00360   * @param  hramecc        Pointer to a RAMECC_HandleTypeDef structure that
00361   *                        contains the configuration information for the
00362   *                        specified RAMECC Monitor.
00363   * @param  Notifications  Select the notification.
00364   * @retval HAL status.
00365   */
00366 HAL_StatusTypeDef HAL_RAMECC_DisableNotification (RAMECC_HandleTypeDef *hramecc, uint32_t Notifications)
00367 {
00368   /* Check the parameters */
00369   assert_param (IS_RAMECC_MONITOR_ALL_INSTANCE (hramecc->Instance));
00370   assert_param (IS_RAMECC_INTERRUPT (Notifications));
00371 
00372   /* Check RAMECC state */
00373   if (hramecc->State == HAL_RAMECC_STATE_READY)
00374   {
00375     /* Change RAMECC peripheral state */
00376     hramecc->State = HAL_RAMECC_STATE_BUSY;
00377 
00378     /* Disable RAMECC interrupts */
00379     __HAL_RAMECC_DISABLE_IT (hramecc, Notifications);
00380 
00381     /* Change RAMECC peripheral state */
00382     hramecc->State = HAL_RAMECC_STATE_READY;
00383   }
00384   else
00385   {
00386     /* Update the error code */
00387     hramecc->ErrorCode = HAL_RAMECC_ERROR_BUSY;
00388 
00389     /* Return HAL status */
00390     return HAL_ERROR;
00391   }
00392 
00393   /* Return HAL status */
00394   return HAL_OK;
00395 }
00396 
00397 
00398 /**
00399   * @brief  Register callbacks.
00400   * @param  hramecc    Pointer to a RAMECC_HandleTypeDef structure that contains
00401   *                    the configuration information for the specified RAMECC
00402   *                    Monitor.
00403   * @param  pCallback  pointer to private callbacsk function which has pointer to
00404   *                    a RAMECC_HandleTypeDef structure as parameter.
00405   * @retval HAL status.
00406   */
00407 HAL_StatusTypeDef HAL_RAMECC_RegisterCallback (RAMECC_HandleTypeDef *hramecc, void (* pCallback)(RAMECC_HandleTypeDef *_hramecc))
00408 {
00409   HAL_StatusTypeDef status = HAL_OK;
00410 
00411   if (pCallback == NULL)
00412   {
00413     /* Update the error code */
00414     hramecc->ErrorCode |= HAL_RAMECC_ERROR_INVALID_CALLBACK;
00415 
00416     /* Return HAL status */
00417     return HAL_ERROR;
00418   }
00419 
00420   /* Check the parameters */
00421   assert_param (IS_RAMECC_MONITOR_ALL_INSTANCE (hramecc->Instance));
00422 
00423   /* Check RAMECC state */
00424   if (hramecc->State == HAL_RAMECC_STATE_READY)
00425   {
00426     hramecc->DetectErrorCallback = pCallback;
00427   }
00428   else
00429   {
00430     /* Update the error code */
00431     hramecc->ErrorCode = HAL_RAMECC_ERROR_INVALID_CALLBACK;
00432 
00433     /* Update HAL status */
00434     status = HAL_ERROR;
00435   }
00436 
00437   /* Return HAL status */
00438   return status;
00439 }
00440 
00441 
00442 /**
00443   * @brief  UnRegister callbacks.
00444   * @param  hramecc    Pointer to a RAMECC_HandleTypeDef structure that contains
00445   *                    the configuration information for the specified RAMECC
00446   *                    Monitor.
00447   * @retval HAL status.
00448   */
00449 HAL_StatusTypeDef HAL_RAMECC_UnRegisterCallback (RAMECC_HandleTypeDef *hramecc)
00450 {
00451   HAL_StatusTypeDef status = HAL_OK;
00452 
00453   /* Check the parameters */
00454   assert_param (IS_RAMECC_MONITOR_ALL_INSTANCE (hramecc->Instance));
00455 
00456   /* Check RAMECC state */
00457   if(hramecc->State == HAL_RAMECC_STATE_READY)
00458   {
00459     hramecc->DetectErrorCallback = NULL;
00460   }
00461   else
00462   {
00463     /* Update the error code */
00464     hramecc->ErrorCode = HAL_RAMECC_ERROR_INVALID_CALLBACK;
00465 
00466     /* Update HAL status */
00467     status = HAL_ERROR;
00468   }
00469 
00470   /* Return HAL status */
00471   return status;
00472 }
00473 
00474 
00475 /**
00476   * @brief  Handles RAMECC interrupt request.
00477   * @param  hramecc  Pointer to a RAMECC_HandleTypeDef structure that contains
00478   *                  the configuration information for the specified RAMECC
00479   *                  Monitor.
00480   * @retval None.
00481   */
00482 void HAL_RAMECC_IRQHandler (RAMECC_HandleTypeDef *hramecc)
00483 {
00484   uint32_t ier_reg = ((RAMECC_TypeDef *)((uint32_t)hramecc->Instance & 0xFFFFFF00U))->IER;
00485   uint32_t cr_reg = hramecc->Instance->CR >> 1U;
00486   uint32_t sr_reg = hramecc->Instance->SR << 1U;
00487 
00488   /* Update global interrupt variables */
00489   if ((ier_reg & RAMECC_IER_GIE) == RAMECC_IER_GIE)
00490   {
00491     ier_reg = RAMECC_IT_GLOBAL_ALL;
00492   }
00493 
00494   /* Clear active flags */
00495   __HAL_RAMECC_CLEAR_FLAG (hramecc, (((ier_reg | cr_reg) & sr_reg) >> 1U));
00496 
00497   /* Check if a valid double error callback is registered */
00498   if (hramecc->DetectErrorCallback != NULL)
00499   {
00500     /* Error detection callback */
00501     hramecc->DetectErrorCallback(hramecc);
00502   }
00503 }
00504 
00505 
00506 /** @addtogroup RAMECC_Exported_Functions_Group3
00507   *
00508 @verbatim
00509  ===============================================================================
00510                    #####  Error information functions  #####
00511  ===============================================================================
00512     [..]  This section provides functions allowing to:
00513       (+) Get failing address.
00514       (+) Get failing data low.
00515       (+) Get failing data high.
00516       (+) Get hamming bits injected.
00517       (+) Check single error flag.
00518       (+) Check double error flag.
00519 
00520 @endverbatim
00521   * @{
00522   */
00523 
00524 /**
00525   * @brief  Return the RAMECC failing address.
00526   * @param  hramecc  Pointer to a RAMECC_HandleTypeDef structure that contains
00527   *                  the configuration information for the specified RAMECC
00528   *                  Monitor.
00529   * @retval Failing address offset.
00530   */
00531 uint32_t HAL_RAMECC_GetFailingAddress (RAMECC_HandleTypeDef *hramecc)
00532 {
00533   /* Check the parameters */
00534   assert_param (IS_RAMECC_MONITOR_ALL_INSTANCE (hramecc->Instance));
00535 
00536   /* Return failing address */
00537   return hramecc->Instance->FAR;
00538 }
00539 
00540 
00541 /**
00542   * @brief  Return the RAMECC data low.
00543   * @param  hramecc  Pointer to a RAMECC_HandleTypeDef structure that contains
00544   *                  the configuration information for the specified RAMECC
00545   *                  Monitor.
00546   * @retval Failing data low.
00547   */
00548 uint32_t HAL_RAMECC_GetFailingDataLow (RAMECC_HandleTypeDef *hramecc)
00549 {
00550   /* Check the parameters */
00551   assert_param (IS_RAMECC_MONITOR_ALL_INSTANCE (hramecc->Instance));
00552 
00553   /* Return failing data low */
00554   return hramecc->Instance->FDRL;
00555 }
00556 
00557 
00558 /**
00559   * @brief  Return the RAMECC data high.
00560   * @param  hramecc  Pointer to a RAMECC_HandleTypeDef structure that contains
00561   *                  the configuration information for the specified RAMECC
00562   *                  Monitor.
00563   * @retval Failing data high.
00564   */
00565 uint32_t HAL_RAMECC_GetFailingDataHigh (RAMECC_HandleTypeDef *hramecc)
00566 {
00567   /* Check the parameters */
00568   assert_param (IS_RAMECC_MONITOR_ALL_INSTANCE (hramecc->Instance));
00569 
00570   /* Return failing data high */
00571   return hramecc->Instance->FDRH;
00572 }
00573 
00574 
00575 /**
00576   * @brief  Return the RAMECC Hamming bits injected.
00577   * @param  hramecc  Pointer to a RAMECC_HandleTypeDef structure that contains
00578   *                  the configuration information for the specified RAMECC
00579   *                  Monitor.
00580   * @retval Hamming bits injected.
00581   */
00582 uint32_t HAL_RAMECC_GetHammingErrorCode (RAMECC_HandleTypeDef *hramecc)
00583 {
00584   /* Check the parameters */
00585   assert_param (IS_RAMECC_MONITOR_ALL_INSTANCE (hramecc->Instance));
00586 
00587   /* Return hamming bits injected */
00588   return hramecc->Instance->FECR;
00589 }
00590 
00591 /**
00592   * @brief  Check if an ECC single error was occurred.
00593   * @param  hramecc  Pointer to a RAMECC_HandleTypeDef structure that contains
00594   *                  the configuration information for the specified RAMECC
00595   *                  Monitor.
00596   * @retval State of bit (1 or 0).
00597   */
00598 uint32_t HAL_RAMECC_IsECCSingleErrorDetected (RAMECC_HandleTypeDef *hramecc)
00599 {
00600   /* Check the parameters */
00601   assert_param (IS_RAMECC_MONITOR_ALL_INSTANCE (hramecc->Instance));
00602 
00603   /* Return the state of SEDC flag */
00604   return ((READ_BIT(hramecc->Instance->SR, RAMECC_SR_SEDCF) == (RAMECC_SR_SEDCF)) ? 1UL : 0UL);
00605 }
00606 
00607 /**
00608   * @brief  Check if an ECC double error was occurred.
00609   * @param  hramecc  Pointer to a RAMECC_HandleTypeDef structure that contains
00610   *                  the configuration information for the specified RAMECC
00611   *                  Monitor.
00612   * @retval State of bit (1 or 0).
00613   */
00614 uint32_t HAL_RAMECC_IsECCDoubleErrorDetected (RAMECC_HandleTypeDef *hramecc)
00615 {
00616   /* Check the parameters */
00617   assert_param (IS_RAMECC_MONITOR_ALL_INSTANCE (hramecc->Instance));
00618 
00619   /* Return the state of DEDF | DEBWDF flags */
00620   return ((READ_BIT(hramecc->Instance->SR, (RAMECC_SR_DEDF | RAMECC_SR_DEBWDF)) != 0U) ? 1UL : 0UL);
00621 }
00622 /**
00623   * @}
00624   */
00625 
00626 
00627 /** @addtogroup RAMECC_Exported_Functions_Group4
00628   *
00629 @verbatim
00630  ===============================================================================
00631                     ##### State and Error Functions  #####
00632  ===============================================================================
00633     [..]
00634     This section provides functions allowing to check and get the RAMECC state
00635     and the error code .
00636     [..]
00637     The HAL_RAMECC_GetState() function allows to get the RAMECC peripheral
00638     state.
00639     The HAL_RAMECC_GetError() function allows to Get the RAMECC peripheral error
00640     code.
00641 
00642 @endverbatim
00643   * @{
00644   */
00645 
00646 /**
00647   * @brief  Get the RAMECC peripheral state.
00648   * @param  hramecc       : Pointer to a RAMECC_HandleTypeDef structure that
00649   *                         contains the configuration information for the
00650   *                         specified RAMECC instance.
00651   * @retval RAMECC state.
00652   */
00653 HAL_RAMECC_StateTypeDef HAL_RAMECC_GetState (RAMECC_HandleTypeDef *hramecc)
00654 {
00655   /* Return the RAMECC state */
00656   return hramecc->State;
00657 }
00658 
00659 /**
00660   * @brief  Get the RAMECC peripheral error code.
00661   * @param  hramecc       : Pointer to a RAMECC_HandleTypeDef structure that
00662   *                         contains the configuration information for the
00663   *                         specified RAMECC instance.
00664   * @retval RAMECC error code.
00665   */
00666 uint32_t HAL_RAMECC_GetError (RAMECC_HandleTypeDef *hramecc)
00667 {
00668   /* Return the RAMECC error code */
00669   return hramecc->ErrorCode;
00670 }
00671 /**
00672   * @}
00673   */
00674 #endif /* HAL_RAMECC_MODULE_ENABLED */
00675 
00676 /**
00677   * @}
00678   */
00679 
00680 /**
00681   * @}
00682   */
00683 
00684 /**
00685   * @}
00686   */
00687 
00688 /**
00689   * @}
00690   */
00691