1 /**
2 ******************************************************************************
3 * @file stm32h7xx_hal_ramecc.c
4 * @author MCD Application Team
5 * @brief RAMECC HAL module driver.
6 * This file provides firmware functions to manage the following
7 * functionalities of the RAM ECC monitoring (RAMECC) peripheral:
8 * + Initialization and de-initialization functions
9 * + Monitoring operation functions
10 * + Error information functions
11 * + State and error functions
12 ******************************************************************************
13 * @attention
14 *
15 * Copyright (c) 2017 STMicroelectronics.
16 * All rights reserved.
17 *
18 * This software is licensed under terms that can be found in the LICENSE file
19 * in the root directory of this software component.
20 * If no LICENSE file comes with this software, it is provided AS-IS.
21 *
22 ******************************************************************************
23 @verbatim
24 ==============================================================================
25 ##### How to use this driver #####
26 ==============================================================================
27 [..]
28 (#) Enable and latch error information through HAL_RAMECC_Init().
29
30 (#) For a given Monitor, enable and disable interrupt through
31 HAL_RAMECC_EnableNotification().
32 To enable a notification for a given RAMECC instance, use global
33 interrupts.
34 To enable a notification for only RAMECC monitor, use monitor interrupts.
35 All possible notifications are defined in the driver header file under
36 RAMECC_Interrupt group.
37
38 *** Silent mode ***
39 ===================
40 [..]
41 (+) Use HAL_RAMECC_StartMonitor() to start RAMECC latch failing
42 information without enabling any notification.
43
44 *** Interrupt mode ***
45 ======================
46 [..]
47 (+) Use HAL_RAMECC_EnableNotification() to enable interrupts for a
48 given error.
49 (+) Configure the RAMECC interrupt priority using
50 HAL_NVIC_SetPriority().
51 (+) Enable the RAMECC IRQ handler using HAL_NVIC_EnableIRQ().
52 (+) Start RAMECC latch failing information using HAL_RAMECC_StartMonitor().
53
54 *** Failing information ***
55 ======================
56 [..]
57 (#) Use HAL_RAMECC_GetFailingAddress() function to return the RAMECC
58 failing address.
59 (#) Use HAL_RAMECC_GetFailingDataLow() function to return the RAMECC
60 failing data low.
61 (#) Use HAL_RAMECC_GetFailingDataHigh() function to return the RAMECC
62 failing data high.
63 (#) Use HAL_RAMECC_GetHammingErrorCode() function to return the RAMECC
64 Hamming bits injected.
65 (#) Use HAL_RAMECC_IsECCSingleErrorDetected() function to check if a single
66 error was detected and corrected.
67 (#) Use HAL_RAMECC_IsECCDoubleErrorDetected() function to check if a double
68 error was dedetected.
69
70 *** RAMECC HAL driver macros list ***
71 =============================================
72 [..]
73 Below the list of used macros in RAMECC HAL driver.
74
75 (+) __HAL_RAMECC_ENABLE_IT : Enable the specified ECCRAM Monitor
76 interrupts.
77 (+) __HAL_RAMECC_DISABLE_IT : Disable the specified ECCRAM Monitor
78 interrupts.
79 (+) __HAL_RAMECC_GET_FLAG : Return the current RAMECC Monitor selected
80 flag.
81 (+) __HAL_RAMECC_CLEAR_FLAG : Clear the current RAMECC Monitor selected
82 flag.
83 @endverbatim
84 */
85
86 /* Includes ------------------------------------------------------------------*/
87 #include "stm32h7xx_hal.h"
88
89 /** @addtogroup STM32H7xx_HAL_Driver
90 * @{
91 */
92
93 /** @defgroup RAMECC RAMECC
94 * @brief RAMECC HAL module driver
95 * @{
96 */
97
98 #ifdef HAL_RAMECC_MODULE_ENABLED
99
100 /* Private types -------------------------------------------------------------*/
101 /* Private variables ---------------------------------------------------------*/
102 /* Private constants ---------------------------------------------------------*/
103 /* Private macros ------------------------------------------------------------*/
104 /* Private functions ---------------------------------------------------------*/
105 /* Exported functions --------------------------------------------------------*/
106
107 /** @addtogroup RAMECC_Exported_Functions
108 * @{
109 */
110
111 /** @addtogroup RAMECC_Exported_Functions_Group1
112 *
113 @verbatim
114 ===============================================================================
115 ##### Initialization and de-initialization functions #####
116 ===============================================================================
117 [..]
118 This section provides functions allowing to initialize the RAMECC Monitor.
119 [..]
120 The HAL_RAMECC_Init() function follows the RAMECC configuration procedures
121 as described in reference manual.
122 The HAL_RAMECC_DeInit() function allows to deinitialize the RAMECC monitor.
123
124 @endverbatim
125 * @{
126 */
127
128 /**
129 * @brief Initialize the RAMECC by clearing flags and disabling interrupts.
130 * @param hramecc Pointer to a RAMECC_HandleTypeDef structure that contains
131 * the configuration information for the specified RAMECC
132 * Monitor.
133 * @retval HAL status.
134 */
HAL_RAMECC_Init(RAMECC_HandleTypeDef * hramecc)135 HAL_StatusTypeDef HAL_RAMECC_Init (RAMECC_HandleTypeDef *hramecc)
136 {
137 /* Check the RAMECC peripheral handle */
138 if (hramecc == NULL)
139 {
140 /* Return HAL status */
141 return HAL_ERROR;
142 }
143
144 /* Check the parameters */
145 assert_param (IS_RAMECC_MONITOR_ALL_INSTANCE (hramecc->Instance));
146
147 /* Change RAMECC peripheral state */
148 hramecc->State = HAL_RAMECC_STATE_BUSY;
149
150 /* Disable RAMECC monitor */
151 hramecc->Instance->CR &= ~RAMECC_CR_ECCELEN;
152
153 /* Disable all global interrupts */
154 ((RAMECC_TypeDef *)((uint32_t)hramecc->Instance & 0xFFFFFF00U))->IER &= \
155 ~(RAMECC_IER_GIE | RAMECC_IER_GECCSEIE | RAMECC_IER_GECCDEIE | RAMECC_IER_GECCDEBWIE);
156
157 /* Disable all interrupts monitor */
158 hramecc->Instance->CR &= ~(RAMECC_CR_ECCSEIE | RAMECC_CR_ECCDEIE | RAMECC_CR_ECCDEBWIE);
159
160 /* Clear RAMECC monitor flags */
161 __HAL_RAMECC_CLEAR_FLAG (hramecc, RAMECC_FLAGS_ALL);
162
163 /* Initialise the RAMECC error code */
164 hramecc->ErrorCode = HAL_RAMECC_ERROR_NONE;
165
166 /* Update the RAMECC state */
167 hramecc->State = HAL_RAMECC_STATE_READY;
168
169 /* Return HAL status */
170 return HAL_OK;
171 }
172
173
174 /**
175 * @brief DeInitializes the RAMECC peripheral.
176 * @param hramecc Pointer to a RAMECC_HandleTypeDef structure that contains
177 * the configuration information for the specified RAMECC
178 * Monitor.
179 * @retval HAL status.
180 */
HAL_RAMECC_DeInit(RAMECC_HandleTypeDef * hramecc)181 HAL_StatusTypeDef HAL_RAMECC_DeInit (RAMECC_HandleTypeDef *hramecc)
182 {
183 /* Check the RAMECC peripheral handle */
184 if (hramecc == NULL)
185 {
186 /* Return HAL status */
187 return HAL_ERROR;
188 }
189
190 /* Check the parameters */
191 assert_param (IS_RAMECC_MONITOR_ALL_INSTANCE (hramecc->Instance));
192
193 /* Disable RAMECC monitor */
194 hramecc->Instance->CR &= ~RAMECC_CR_ECCELEN;
195
196 /* Disable all global interrupts */
197 ((RAMECC_TypeDef *)((uint32_t)hramecc->Instance & 0xFFFFFF00U))->IER &= \
198 ~(RAMECC_IER_GIE | RAMECC_IER_GECCSEIE | RAMECC_IER_GECCDEIE | RAMECC_IER_GECCDEBWIE);
199
200 /* Disable all interrupts monitor */
201 hramecc->Instance->CR &= ~(RAMECC_CR_ECCSEIE | RAMECC_CR_ECCDEIE | RAMECC_CR_ECCDEBWIE);
202
203 /* Clear RAMECC monitor flags */
204 __HAL_RAMECC_CLEAR_FLAG (hramecc, RAMECC_FLAGS_ALL);
205
206 /* Clean callback */
207 hramecc->DetectErrorCallback = NULL;
208
209 /* Initialise the RAMECC error code */
210 hramecc->ErrorCode = HAL_RAMECC_ERROR_NONE;
211
212 /* Change RAMECC peripheral state */
213 hramecc->State = HAL_RAMECC_STATE_RESET;
214
215 /* Return HAL status */
216 return HAL_OK;
217 }
218 /**
219 * @}
220 */
221
222 /** @addtogroup RAMECC_Exported_Functions_Group2
223 *
224 @verbatim
225 ===============================================================================
226 ##### Monitoring operation functions #####
227 ===============================================================================
228 [..] This section provides functions allowing to:
229 (+) Configure latching error information.
230 (+) Configure RAMECC Global/Monitor interrupts.
231 (+) Register and Unregister RAMECC callbacks
232 (+) Handle RAMECC interrupt request
233
234 @endverbatim
235 * @{
236 */
237
238 /**
239 * @brief Starts the RAMECC latching error information.
240 * @param hramecc Pointer to a RAMECC_HandleTypeDef structure that contains
241 * the configuration information for the specified RAMECC
242 * Monitor.
243 * @retval HAL status.
244 */
HAL_RAMECC_StartMonitor(RAMECC_HandleTypeDef * hramecc)245 HAL_StatusTypeDef HAL_RAMECC_StartMonitor (RAMECC_HandleTypeDef *hramecc)
246 {
247 /* Check the parameters */
248 assert_param (IS_RAMECC_MONITOR_ALL_INSTANCE (hramecc->Instance));
249
250 /* Check RAMECC state */
251 if (hramecc->State == HAL_RAMECC_STATE_READY)
252 {
253 /* Change RAMECC peripheral state */
254 hramecc->State = HAL_RAMECC_STATE_BUSY;
255
256 /* Enable RAMECC monitor */
257 hramecc->Instance->CR |= RAMECC_CR_ECCELEN;
258
259 /* Change RAMECC peripheral state */
260 hramecc->State = HAL_RAMECC_STATE_READY;
261 }
262 else
263 {
264 /* Update the error code */
265 hramecc->ErrorCode = HAL_RAMECC_ERROR_BUSY;
266
267 /* Return HAL status */
268 return HAL_ERROR;
269 }
270
271 /* Return HAL status */
272 return HAL_OK;
273 }
274
275
276 /**
277 * @brief Stop the RAMECC latching error information.
278 * @param hramecc Pointer to a RAMECC_HandleTypeDef structure that contains
279 * the configuration information for the specified RAMECC
280 * Monitor.
281 * @retval HAL status.
282 */
HAL_RAMECC_StopMonitor(RAMECC_HandleTypeDef * hramecc)283 HAL_StatusTypeDef HAL_RAMECC_StopMonitor (RAMECC_HandleTypeDef *hramecc)
284 {
285 /* Check the parameters */
286 assert_param (IS_RAMECC_MONITOR_ALL_INSTANCE (hramecc->Instance));
287
288 /* Check RAMECC state */
289 if (hramecc->State == HAL_RAMECC_STATE_READY)
290 {
291 /* Change RAMECC peripheral state */
292 hramecc->State = HAL_RAMECC_STATE_BUSY;
293
294 /* Disable RAMECC monitor */
295 hramecc->Instance->CR &= ~RAMECC_CR_ECCELEN;
296
297 /* Change RAMECC peripheral state */
298 hramecc->State = HAL_RAMECC_STATE_READY;
299 }
300 else
301 {
302 /* Update the error code */
303 hramecc->ErrorCode = HAL_RAMECC_ERROR_BUSY;
304
305 /* Return HAL status */
306 return HAL_ERROR;
307 }
308
309 /* Return HAL status */
310 return HAL_OK;
311 }
312
313
314 /**
315 * @brief Enable the RAMECC error interrupts.
316 * @param hramecc Pointer to a RAMECC_HandleTypeDef structure that
317 * contains the configuration information for the
318 * specified RAMECC Monitor.
319 * @param Notifications Select the notification.
320 * @retval HAL status.
321 */
HAL_RAMECC_EnableNotification(RAMECC_HandleTypeDef * hramecc,uint32_t Notifications)322 HAL_StatusTypeDef HAL_RAMECC_EnableNotification (RAMECC_HandleTypeDef *hramecc, uint32_t Notifications)
323 {
324 /* Check the parameters */
325 assert_param (IS_RAMECC_MONITOR_ALL_INSTANCE (hramecc->Instance));
326 assert_param (IS_RAMECC_INTERRUPT (Notifications));
327
328 /* Check RAMECC state */
329 if (hramecc->State == HAL_RAMECC_STATE_READY)
330 {
331 /* Change RAMECC peripheral state */
332 hramecc->State = HAL_RAMECC_STATE_BUSY;
333
334 /* Enable RAMECC interrupts */
335 __HAL_RAMECC_ENABLE_IT (hramecc, Notifications);
336
337 /* Change RAMECC peripheral state */
338 hramecc->State = HAL_RAMECC_STATE_READY;
339 }
340 else
341 {
342 /* Update the error code */
343 hramecc->ErrorCode = HAL_RAMECC_ERROR_BUSY;
344
345 /* Return HAL status */
346 return HAL_ERROR;
347 }
348
349 /* Return HAL status */
350 return HAL_OK;
351 }
352
353
354 /**
355 * @brief Disable the RAMECC error interrupts.
356 * @param hramecc Pointer to a RAMECC_HandleTypeDef structure that
357 * contains the configuration information for the
358 * specified RAMECC Monitor.
359 * @param Notifications Select the notification.
360 * @retval HAL status.
361 */
HAL_RAMECC_DisableNotification(RAMECC_HandleTypeDef * hramecc,uint32_t Notifications)362 HAL_StatusTypeDef HAL_RAMECC_DisableNotification (RAMECC_HandleTypeDef *hramecc, uint32_t Notifications)
363 {
364 /* Check the parameters */
365 assert_param (IS_RAMECC_MONITOR_ALL_INSTANCE (hramecc->Instance));
366 assert_param (IS_RAMECC_INTERRUPT (Notifications));
367
368 /* Check RAMECC state */
369 if (hramecc->State == HAL_RAMECC_STATE_READY)
370 {
371 /* Change RAMECC peripheral state */
372 hramecc->State = HAL_RAMECC_STATE_BUSY;
373
374 /* Disable RAMECC interrupts */
375 __HAL_RAMECC_DISABLE_IT (hramecc, Notifications);
376
377 /* Change RAMECC peripheral state */
378 hramecc->State = HAL_RAMECC_STATE_READY;
379 }
380 else
381 {
382 /* Update the error code */
383 hramecc->ErrorCode = HAL_RAMECC_ERROR_BUSY;
384
385 /* Return HAL status */
386 return HAL_ERROR;
387 }
388
389 /* Return HAL status */
390 return HAL_OK;
391 }
392
393
394 /**
395 * @brief Register callbacks.
396 * @param hramecc Pointer to a RAMECC_HandleTypeDef structure that contains
397 * the configuration information for the specified RAMECC
398 * Monitor.
399 * @param pCallback pointer to private callbacsk function which has pointer to
400 * a RAMECC_HandleTypeDef structure as parameter.
401 * @retval HAL status.
402 */
HAL_RAMECC_RegisterCallback(RAMECC_HandleTypeDef * hramecc,void (* pCallback)(RAMECC_HandleTypeDef * _hramecc))403 HAL_StatusTypeDef HAL_RAMECC_RegisterCallback (RAMECC_HandleTypeDef *hramecc, void (* pCallback)(RAMECC_HandleTypeDef *_hramecc))
404 {
405 HAL_StatusTypeDef status = HAL_OK;
406
407 if (pCallback == NULL)
408 {
409 /* Update the error code */
410 hramecc->ErrorCode |= HAL_RAMECC_ERROR_INVALID_CALLBACK;
411
412 /* Return HAL status */
413 return HAL_ERROR;
414 }
415
416 /* Check the parameters */
417 assert_param (IS_RAMECC_MONITOR_ALL_INSTANCE (hramecc->Instance));
418
419 /* Check RAMECC state */
420 if (hramecc->State == HAL_RAMECC_STATE_READY)
421 {
422 hramecc->DetectErrorCallback = pCallback;
423 }
424 else
425 {
426 /* Update the error code */
427 hramecc->ErrorCode = HAL_RAMECC_ERROR_INVALID_CALLBACK;
428
429 /* Update HAL status */
430 status = HAL_ERROR;
431 }
432
433 /* Return HAL status */
434 return status;
435 }
436
437
438 /**
439 * @brief UnRegister callbacks.
440 * @param hramecc Pointer to a RAMECC_HandleTypeDef structure that contains
441 * the configuration information for the specified RAMECC
442 * Monitor.
443 * @retval HAL status.
444 */
HAL_RAMECC_UnRegisterCallback(RAMECC_HandleTypeDef * hramecc)445 HAL_StatusTypeDef HAL_RAMECC_UnRegisterCallback (RAMECC_HandleTypeDef *hramecc)
446 {
447 HAL_StatusTypeDef status = HAL_OK;
448
449 /* Check the parameters */
450 assert_param (IS_RAMECC_MONITOR_ALL_INSTANCE (hramecc->Instance));
451
452 /* Check RAMECC state */
453 if(hramecc->State == HAL_RAMECC_STATE_READY)
454 {
455 hramecc->DetectErrorCallback = NULL;
456 }
457 else
458 {
459 /* Update the error code */
460 hramecc->ErrorCode = HAL_RAMECC_ERROR_INVALID_CALLBACK;
461
462 /* Update HAL status */
463 status = HAL_ERROR;
464 }
465
466 /* Return HAL status */
467 return status;
468 }
469
470
471 /**
472 * @brief Handles RAMECC interrupt request.
473 * @param hramecc Pointer to a RAMECC_HandleTypeDef structure that contains
474 * the configuration information for the specified RAMECC
475 * Monitor.
476 * @retval None.
477 */
HAL_RAMECC_IRQHandler(RAMECC_HandleTypeDef * hramecc)478 void HAL_RAMECC_IRQHandler (RAMECC_HandleTypeDef *hramecc)
479 {
480 uint32_t ier_reg = ((RAMECC_TypeDef *)((uint32_t)hramecc->Instance & 0xFFFFFF00U))->IER;
481 uint32_t cr_reg = hramecc->Instance->CR >> 1U;
482 uint32_t sr_reg = hramecc->Instance->SR << 1U;
483
484 /* Update global interrupt variables */
485 if ((ier_reg & RAMECC_IER_GIE) == RAMECC_IER_GIE)
486 {
487 ier_reg = RAMECC_IT_GLOBAL_ALL;
488 }
489
490 /* Clear active flags */
491 __HAL_RAMECC_CLEAR_FLAG (hramecc, (((ier_reg | cr_reg) & sr_reg) >> 1U));
492
493 /* Check if a valid double error callback is registered */
494 if (hramecc->DetectErrorCallback != NULL)
495 {
496 /* Error detection callback */
497 hramecc->DetectErrorCallback(hramecc);
498 }
499 }
500 /**
501 * @}
502 */
503
504 /** @addtogroup RAMECC_Exported_Functions_Group3
505 *
506 @verbatim
507 ===============================================================================
508 ##### Error information functions #####
509 ===============================================================================
510 [..] This section provides functions allowing to:
511 (+) Get failing address.
512 (+) Get failing data low.
513 (+) Get failing data high.
514 (+) Get hamming bits injected.
515 (+) Check single error flag.
516 (+) Check double error flag.
517
518 @endverbatim
519 * @{
520 */
521
522 /**
523 * @brief Return the RAMECC failing address.
524 * @param hramecc Pointer to a RAMECC_HandleTypeDef structure that contains
525 * the configuration information for the specified RAMECC
526 * Monitor.
527 * @retval Failing address offset.
528 */
HAL_RAMECC_GetFailingAddress(RAMECC_HandleTypeDef * hramecc)529 uint32_t HAL_RAMECC_GetFailingAddress (RAMECC_HandleTypeDef *hramecc)
530 {
531 /* Check the parameters */
532 assert_param (IS_RAMECC_MONITOR_ALL_INSTANCE (hramecc->Instance));
533
534 /* Return failing address */
535 return hramecc->Instance->FAR;
536 }
537
538
539 /**
540 * @brief Return the RAMECC data low.
541 * @param hramecc Pointer to a RAMECC_HandleTypeDef structure that contains
542 * the configuration information for the specified RAMECC
543 * Monitor.
544 * @retval Failing data low.
545 */
HAL_RAMECC_GetFailingDataLow(RAMECC_HandleTypeDef * hramecc)546 uint32_t HAL_RAMECC_GetFailingDataLow (RAMECC_HandleTypeDef *hramecc)
547 {
548 /* Check the parameters */
549 assert_param (IS_RAMECC_MONITOR_ALL_INSTANCE (hramecc->Instance));
550
551 /* Return failing data low */
552 return hramecc->Instance->FDRL;
553 }
554
555
556 /**
557 * @brief Return the RAMECC data high.
558 * @param hramecc Pointer to a RAMECC_HandleTypeDef structure that contains
559 * the configuration information for the specified RAMECC
560 * Monitor.
561 * @retval Failing data high.
562 */
HAL_RAMECC_GetFailingDataHigh(RAMECC_HandleTypeDef * hramecc)563 uint32_t HAL_RAMECC_GetFailingDataHigh (RAMECC_HandleTypeDef *hramecc)
564 {
565 /* Check the parameters */
566 assert_param (IS_RAMECC_MONITOR_ALL_INSTANCE (hramecc->Instance));
567
568 /* Return failing data high */
569 return hramecc->Instance->FDRH;
570 }
571
572
573 /**
574 * @brief Return the RAMECC Hamming bits injected.
575 * @param hramecc Pointer to a RAMECC_HandleTypeDef structure that contains
576 * the configuration information for the specified RAMECC
577 * Monitor.
578 * @retval Hamming bits injected.
579 */
HAL_RAMECC_GetHammingErrorCode(RAMECC_HandleTypeDef * hramecc)580 uint32_t HAL_RAMECC_GetHammingErrorCode (RAMECC_HandleTypeDef *hramecc)
581 {
582 /* Check the parameters */
583 assert_param (IS_RAMECC_MONITOR_ALL_INSTANCE (hramecc->Instance));
584
585 /* Return hamming bits injected */
586 return hramecc->Instance->FECR;
587 }
588
589 /**
590 * @brief Check if an ECC single error was occurred.
591 * @param hramecc Pointer to a RAMECC_HandleTypeDef structure that contains
592 * the configuration information for the specified RAMECC
593 * Monitor.
594 * @retval State of bit (1 or 0).
595 */
HAL_RAMECC_IsECCSingleErrorDetected(RAMECC_HandleTypeDef * hramecc)596 uint32_t HAL_RAMECC_IsECCSingleErrorDetected (RAMECC_HandleTypeDef *hramecc)
597 {
598 /* Check the parameters */
599 assert_param (IS_RAMECC_MONITOR_ALL_INSTANCE (hramecc->Instance));
600
601 /* Return the state of SEDC flag */
602 return ((READ_BIT(hramecc->Instance->SR, RAMECC_SR_SEDCF) == (RAMECC_SR_SEDCF)) ? 1UL : 0UL);
603 }
604
605 /**
606 * @brief Check if an ECC double error was occurred.
607 * @param hramecc Pointer to a RAMECC_HandleTypeDef structure that contains
608 * the configuration information for the specified RAMECC
609 * Monitor.
610 * @retval State of bit (1 or 0).
611 */
HAL_RAMECC_IsECCDoubleErrorDetected(RAMECC_HandleTypeDef * hramecc)612 uint32_t HAL_RAMECC_IsECCDoubleErrorDetected (RAMECC_HandleTypeDef *hramecc)
613 {
614 /* Check the parameters */
615 assert_param (IS_RAMECC_MONITOR_ALL_INSTANCE (hramecc->Instance));
616
617 /* Return the state of DEDF | DEBWDF flags */
618 return ((READ_BIT(hramecc->Instance->SR, (RAMECC_SR_DEDF | RAMECC_SR_DEBWDF)) != 0U) ? 1UL : 0UL);
619 }
620 /**
621 * @}
622 */
623
624
625 /** @addtogroup RAMECC_Exported_Functions_Group4
626 *
627 @verbatim
628 ===============================================================================
629 ##### State and Error Functions #####
630 ===============================================================================
631 [..]
632 This section provides functions allowing to check and get the RAMECC state
633 and the error code .
634 [..]
635 The HAL_RAMECC_GetState() function allows to get the RAMECC peripheral
636 state.
637 The HAL_RAMECC_GetError() function allows to Get the RAMECC peripheral error
638 code.
639
640 @endverbatim
641 * @{
642 */
643
644 /**
645 * @brief Get the RAMECC peripheral state.
646 * @param hramecc : Pointer to a RAMECC_HandleTypeDef structure that
647 * contains the configuration information for the
648 * specified RAMECC instance.
649 * @retval RAMECC state.
650 */
HAL_RAMECC_GetState(RAMECC_HandleTypeDef * hramecc)651 HAL_RAMECC_StateTypeDef HAL_RAMECC_GetState (RAMECC_HandleTypeDef *hramecc)
652 {
653 /* Return the RAMECC state */
654 return hramecc->State;
655 }
656
657 /**
658 * @brief Get the RAMECC peripheral error code.
659 * @param hramecc : Pointer to a RAMECC_HandleTypeDef structure that
660 * contains the configuration information for the
661 * specified RAMECC instance.
662 * @retval RAMECC error code.
663 */
HAL_RAMECC_GetError(RAMECC_HandleTypeDef * hramecc)664 uint32_t HAL_RAMECC_GetError (RAMECC_HandleTypeDef *hramecc)
665 {
666 /* Return the RAMECC error code */
667 return hramecc->ErrorCode;
668 }
669 /**
670 * @}
671 */
672
673 /**
674 * @}
675 */
676 #endif /* HAL_RAMECC_MODULE_ENABLED */
677 /**
678 * @}
679 */
680
681 /**
682 * @}
683 */
684
685