2 ******************************************************************************
3 * @file stm32f7xx_hal_rng.c
4 * @author MCD Application Team
5 * @brief RNG HAL module driver.
6 * This file provides firmware functions to manage the following
7 * functionalities of the Random Number Generator (RNG) peripheral:
8 * + Initialization and configuration functions
9 * + Peripheral Control functions
10 * + Peripheral State functions
13 ==============================================================================
14 ##### How to use this driver #####
15 ==============================================================================
17 The RNG HAL driver can be used as follows:
19 (#) Enable the RNG controller clock using __HAL_RCC_RNG_CLK_ENABLE() macro
21 (#) Activate the RNG peripheral using HAL_RNG_Init() function.
22 (#) Wait until the 32 bit Random Number Generator contains a valid
23 random data using (polling/interrupt) mode.
24 (#) Get the 32 bit random number using HAL_RNG_GenerateRandomNumber() function.
26 ##### Callback registration #####
27 ==================================
30 The compilation define USE_HAL_RNG_REGISTER_CALLBACKS when set to 1
31 allows the user to configure dynamically the driver callbacks.
34 Use Function @ref HAL_RNG_RegisterCallback() to register a user callback.
35 Function @ref HAL_RNG_RegisterCallback() allows to register following callbacks:
36 (+) ErrorCallback : RNG Error Callback.
37 (+) MspInitCallback : RNG MspInit.
38 (+) MspDeInitCallback : RNG MspDeInit.
39 This function takes as parameters the HAL peripheral handle, the Callback ID
40 and a pointer to the user callback function.
43 Use function @ref HAL_RNG_UnRegisterCallback() to reset a callback to the default
44 weak (surcharged) function.
45 @ref HAL_RNG_UnRegisterCallback() takes as parameters the HAL peripheral handle,
47 This function allows to reset following callbacks:
48 (+) ErrorCallback : RNG Error Callback.
49 (+) MspInitCallback : RNG MspInit.
50 (+) MspDeInitCallback : RNG MspDeInit.
53 For specific callback ReadyDataCallback, use dedicated register callbacks:
54 respectively @ref HAL_RNG_RegisterReadyDataCallback() , @ref HAL_RNG_UnRegisterReadyDataCallback().
57 By default, after the @ref HAL_RNG_Init() and when the state is HAL_RNG_STATE_RESET
58 all callbacks are set to the corresponding weak (surcharged) functions:
59 example @ref HAL_RNG_ErrorCallback().
60 Exception done for MspInit and MspDeInit functions that are respectively
61 reset to the legacy weak (surcharged) functions in the @ref HAL_RNG_Init()
62 and @ref HAL_RNG_DeInit() only when these callbacks are null (not registered beforehand).
63 If not, MspInit or MspDeInit are not null, the @ref HAL_RNG_Init() and @ref HAL_RNG_DeInit()
64 keep and use the user MspInit/MspDeInit callbacks (registered beforehand).
67 Callbacks can be registered/unregistered in HAL_RNG_STATE_READY state only.
68 Exception done MspInit/MspDeInit that can be registered/unregistered
69 in HAL_RNG_STATE_READY or HAL_RNG_STATE_RESET state, thus registered (user)
70 MspInit/DeInit callbacks can be used during the Init/DeInit.
71 In that case first register the MspInit/MspDeInit user callbacks
72 using @ref HAL_RNG_RegisterCallback() before calling @ref HAL_RNG_DeInit()
73 or @ref HAL_RNG_Init() function.
76 When The compilation define USE_HAL_RNG_REGISTER_CALLBACKS is set to 0 or
77 not defined, the callback registration feature is not available
78 and weak (surcharged) callbacks are used.
81 ******************************************************************************
84 * <h2><center>© Copyright (c) 2017 STMicroelectronics.
85 * All rights reserved.</center></h2>
87 * This software component is licensed by ST under BSD 3-Clause license,
88 * the "License"; You may not use this file except in compliance with the
89 * License. You may obtain a copy of the License at:
90 * opensource.org/licenses/BSD-3-Clause
92 ******************************************************************************
95 /* Includes ------------------------------------------------------------------*/
96 #include "stm32f7xx_hal.h"
98 /** @addtogroup STM32F7xx_HAL_Driver
105 * @brief RNG HAL module driver.
109 #ifdef HAL_RNG_MODULE_ENABLED
111 /* Private types -------------------------------------------------------------*/
112 /* Private defines -----------------------------------------------------------*/
113 /* Private variables ---------------------------------------------------------*/
114 /* Private constants ---------------------------------------------------------*/
115 /** @defgroup RNG_Private_Constants RNG Private Constants
118 #define RNG_TIMEOUT_VALUE 2U
122 /* Private macros ------------------------------------------------------------*/
123 /* Private functions prototypes ----------------------------------------------*/
124 /* Private functions ---------------------------------------------------------*/
125 /* Exported functions --------------------------------------------------------*/
127 /** @addtogroup RNG_Exported_Functions
131 /** @addtogroup RNG_Exported_Functions_Group1
132 * @brief Initialization and configuration functions
135 ===============================================================================
136 ##### Initialization and configuration functions #####
137 ===============================================================================
138 [..] This section provides functions allowing to:
139 (+) Initialize the RNG according to the specified parameters
140 in the RNG_InitTypeDef and create the associated handle
141 (+) DeInitialize the RNG peripheral
142 (+) Initialize the RNG MSP
143 (+) DeInitialize RNG MSP
150 * @brief Initializes the RNG peripheral and creates the associated handle.
151 * @param hrng pointer to a RNG_HandleTypeDef structure that contains
152 * the configuration information for RNG.
155 HAL_StatusTypeDef
HAL_RNG_Init(RNG_HandleTypeDef
*hrng
)
157 /* Check the RNG handle allocation */
162 /* Check the parameters */
163 assert_param(IS_RNG_ALL_INSTANCE(hrng
->Instance
));
165 #if (USE_HAL_RNG_REGISTER_CALLBACKS == 1)
166 if (hrng
->State
== HAL_RNG_STATE_RESET
)
168 /* Allocate lock resource and initialize it */
169 hrng
->Lock
= HAL_UNLOCKED
;
171 hrng
->ReadyDataCallback
= HAL_RNG_ReadyDataCallback
; /* Legacy weak ReadyDataCallback */
172 hrng
->ErrorCallback
= HAL_RNG_ErrorCallback
; /* Legacy weak ErrorCallback */
174 if (hrng
->MspInitCallback
== NULL
)
176 hrng
->MspInitCallback
= HAL_RNG_MspInit
; /* Legacy weak MspInit */
179 /* Init the low level hardware */
180 hrng
->MspInitCallback(hrng
);
183 if (hrng
->State
== HAL_RNG_STATE_RESET
)
185 /* Allocate lock resource and initialize it */
186 hrng
->Lock
= HAL_UNLOCKED
;
188 /* Init the low level hardware */
189 HAL_RNG_MspInit(hrng
);
191 #endif /* USE_HAL_RNG_REGISTER_CALLBACKS */
193 /* Change RNG peripheral state */
194 hrng
->State
= HAL_RNG_STATE_BUSY
;
197 /* Enable the RNG Peripheral */
198 __HAL_RNG_ENABLE(hrng
);
200 /* Initialize the RNG state */
201 hrng
->State
= HAL_RNG_STATE_READY
;
203 /* Initialise the error code */
204 hrng
->ErrorCode
= HAL_RNG_ERROR_NONE
;
206 /* Return function status */
211 * @brief DeInitializes the RNG peripheral.
212 * @param hrng pointer to a RNG_HandleTypeDef structure that contains
213 * the configuration information for RNG.
216 HAL_StatusTypeDef
HAL_RNG_DeInit(RNG_HandleTypeDef
*hrng
)
218 /* Check the RNG handle allocation */
224 /* Disable the RNG Peripheral */
225 CLEAR_BIT(hrng
->Instance
->CR
, RNG_CR_IE
| RNG_CR_RNGEN
);
227 /* Clear RNG interrupt status flags */
228 CLEAR_BIT(hrng
->Instance
->SR
, RNG_SR_CEIS
| RNG_SR_SEIS
);
230 #if (USE_HAL_RNG_REGISTER_CALLBACKS == 1)
231 if (hrng
->MspDeInitCallback
== NULL
)
233 hrng
->MspDeInitCallback
= HAL_RNG_MspDeInit
; /* Legacy weak MspDeInit */
236 /* DeInit the low level hardware */
237 hrng
->MspDeInitCallback(hrng
);
239 /* DeInit the low level hardware */
240 HAL_RNG_MspDeInit(hrng
);
241 #endif /* USE_HAL_RNG_REGISTER_CALLBACKS */
243 /* Update the RNG state */
244 hrng
->State
= HAL_RNG_STATE_RESET
;
246 /* Initialise the error code */
247 hrng
->ErrorCode
= HAL_RNG_ERROR_NONE
;
252 /* Return the function status */
257 * @brief Initializes the RNG MSP.
258 * @param hrng pointer to a RNG_HandleTypeDef structure that contains
259 * the configuration information for RNG.
262 __weak
void HAL_RNG_MspInit(RNG_HandleTypeDef
*hrng
)
264 /* Prevent unused argument(s) compilation warning */
266 /* NOTE : This function should not be modified. When the callback is needed,
267 function HAL_RNG_MspInit must be implemented in the user file.
272 * @brief DeInitializes the RNG MSP.
273 * @param hrng pointer to a RNG_HandleTypeDef structure that contains
274 * the configuration information for RNG.
277 __weak
void HAL_RNG_MspDeInit(RNG_HandleTypeDef
*hrng
)
279 /* Prevent unused argument(s) compilation warning */
281 /* NOTE : This function should not be modified. When the callback is needed,
282 function HAL_RNG_MspDeInit must be implemented in the user file.
286 #if (USE_HAL_RNG_REGISTER_CALLBACKS == 1)
288 * @brief Register a User RNG Callback
289 * To be used instead of the weak predefined callback
290 * @param hrng RNG handle
291 * @param CallbackID ID of the callback to be registered
292 * This parameter can be one of the following values:
293 * @arg @ref HAL_RNG_ERROR_CB_ID Error callback ID
294 * @arg @ref HAL_RNG_MSPINIT_CB_ID MspInit callback ID
295 * @arg @ref HAL_RNG_MSPDEINIT_CB_ID MspDeInit callback ID
296 * @param pCallback pointer to the Callback function
299 HAL_StatusTypeDef
HAL_RNG_RegisterCallback(RNG_HandleTypeDef
*hrng
, HAL_RNG_CallbackIDTypeDef CallbackID
, pRNG_CallbackTypeDef pCallback
)
301 HAL_StatusTypeDef status
= HAL_OK
;
303 if (pCallback
== NULL
)
305 /* Update the error code */
306 hrng
->ErrorCode
= HAL_RNG_ERROR_INVALID_CALLBACK
;
312 if (HAL_RNG_STATE_READY
== hrng
->State
)
316 case HAL_RNG_ERROR_CB_ID
:
317 hrng
->ErrorCallback
= pCallback
;
320 case HAL_RNG_MSPINIT_CB_ID
:
321 hrng
->MspInitCallback
= pCallback
;
324 case HAL_RNG_MSPDEINIT_CB_ID
:
325 hrng
->MspDeInitCallback
= pCallback
;
329 /* Update the error code */
330 hrng
->ErrorCode
= HAL_RNG_ERROR_INVALID_CALLBACK
;
331 /* Return error status */
336 else if (HAL_RNG_STATE_RESET
== hrng
->State
)
340 case HAL_RNG_MSPINIT_CB_ID
:
341 hrng
->MspInitCallback
= pCallback
;
344 case HAL_RNG_MSPDEINIT_CB_ID
:
345 hrng
->MspDeInitCallback
= pCallback
;
349 /* Update the error code */
350 hrng
->ErrorCode
= HAL_RNG_ERROR_INVALID_CALLBACK
;
351 /* Return error status */
358 /* Update the error code */
359 hrng
->ErrorCode
= HAL_RNG_ERROR_INVALID_CALLBACK
;
360 /* Return error status */
370 * @brief Unregister an RNG Callback
371 * RNG callabck is redirected to the weak predefined callback
372 * @param hrng RNG handle
373 * @param CallbackID ID of the callback to be unregistered
374 * This parameter can be one of the following values:
375 * @arg @ref HAL_RNG_ERROR_CB_ID Error callback ID
376 * @arg @ref HAL_RNG_MSPINIT_CB_ID MspInit callback ID
377 * @arg @ref HAL_RNG_MSPDEINIT_CB_ID MspDeInit callback ID
380 HAL_StatusTypeDef
HAL_RNG_UnRegisterCallback(RNG_HandleTypeDef
*hrng
, HAL_RNG_CallbackIDTypeDef CallbackID
)
382 HAL_StatusTypeDef status
= HAL_OK
;
387 if (HAL_RNG_STATE_READY
== hrng
->State
)
391 case HAL_RNG_ERROR_CB_ID
:
392 hrng
->ErrorCallback
= HAL_RNG_ErrorCallback
; /* Legacy weak ErrorCallback */
395 case HAL_RNG_MSPINIT_CB_ID
:
396 hrng
->MspInitCallback
= HAL_RNG_MspInit
; /* Legacy weak MspInit */
399 case HAL_RNG_MSPDEINIT_CB_ID
:
400 hrng
->MspDeInitCallback
= HAL_RNG_MspDeInit
; /* Legacy weak MspDeInit */
404 /* Update the error code */
405 hrng
->ErrorCode
= HAL_RNG_ERROR_INVALID_CALLBACK
;
406 /* Return error status */
411 else if (HAL_RNG_STATE_RESET
== hrng
->State
)
415 case HAL_RNG_MSPINIT_CB_ID
:
416 hrng
->MspInitCallback
= HAL_RNG_MspInit
; /* Legacy weak MspInit */
419 case HAL_RNG_MSPDEINIT_CB_ID
:
420 hrng
->MspDeInitCallback
= HAL_RNG_MspDeInit
; /* Legacy weak MspInit */
424 /* Update the error code */
425 hrng
->ErrorCode
= HAL_RNG_ERROR_INVALID_CALLBACK
;
426 /* Return error status */
433 /* Update the error code */
434 hrng
->ErrorCode
= HAL_RNG_ERROR_INVALID_CALLBACK
;
435 /* Return error status */
445 * @brief Register Data Ready RNG Callback
446 * To be used instead of the weak HAL_RNG_ReadyDataCallback() predefined callback
447 * @param hrng RNG handle
448 * @param pCallback pointer to the Data Ready Callback function
451 HAL_StatusTypeDef
HAL_RNG_RegisterReadyDataCallback(RNG_HandleTypeDef
*hrng
, pRNG_ReadyDataCallbackTypeDef pCallback
)
453 HAL_StatusTypeDef status
= HAL_OK
;
455 if (pCallback
== NULL
)
457 /* Update the error code */
458 hrng
->ErrorCode
= HAL_RNG_ERROR_INVALID_CALLBACK
;
464 if (HAL_RNG_STATE_READY
== hrng
->State
)
466 hrng
->ReadyDataCallback
= pCallback
;
470 /* Update the error code */
471 hrng
->ErrorCode
= HAL_RNG_ERROR_INVALID_CALLBACK
;
472 /* Return error status */
482 * @brief UnRegister the Data Ready RNG Callback
483 * Data Ready RNG Callback is redirected to the weak HAL_RNG_ReadyDataCallback() predefined callback
484 * @param hrng RNG handle
487 HAL_StatusTypeDef
HAL_RNG_UnRegisterReadyDataCallback(RNG_HandleTypeDef
*hrng
)
489 HAL_StatusTypeDef status
= HAL_OK
;
494 if (HAL_RNG_STATE_READY
== hrng
->State
)
496 hrng
->ReadyDataCallback
= HAL_RNG_ReadyDataCallback
; /* Legacy weak ReadyDataCallback */
500 /* Update the error code */
501 hrng
->ErrorCode
= HAL_RNG_ERROR_INVALID_CALLBACK
;
502 /* Return error status */
511 #endif /* USE_HAL_RNG_REGISTER_CALLBACKS */
517 /** @addtogroup RNG_Exported_Functions_Group2
518 * @brief Peripheral Control functions
521 ===============================================================================
522 ##### Peripheral Control functions #####
523 ===============================================================================
524 [..] This section provides functions allowing to:
525 (+) Get the 32 bit Random number
526 (+) Get the 32 bit Random number with interrupt enabled
527 (+) Handle RNG interrupt request
534 * @brief Generates a 32-bit random number.
535 * @note Each time the random number data is read the RNG_FLAG_DRDY flag
536 * is automatically cleared.
537 * @param hrng pointer to a RNG_HandleTypeDef structure that contains
538 * the configuration information for RNG.
539 * @param random32bit pointer to generated random number variable if successful.
543 HAL_StatusTypeDef
HAL_RNG_GenerateRandomNumber(RNG_HandleTypeDef
*hrng
, uint32_t *random32bit
)
546 HAL_StatusTypeDef status
= HAL_OK
;
551 /* Check RNG peripheral state */
552 if (hrng
->State
== HAL_RNG_STATE_READY
)
554 /* Change RNG peripheral state */
555 hrng
->State
= HAL_RNG_STATE_BUSY
;
558 tickstart
= HAL_GetTick();
560 /* Check if data register contains valid random data */
561 while (__HAL_RNG_GET_FLAG(hrng
, RNG_FLAG_DRDY
) == RESET
)
563 if ((HAL_GetTick() - tickstart
) > RNG_TIMEOUT_VALUE
)
565 hrng
->State
= HAL_RNG_STATE_READY
;
566 hrng
->ErrorCode
= HAL_RNG_ERROR_TIMEOUT
;
567 /* Process Unlocked */
573 /* Get a 32bit Random number */
574 hrng
->RandomNumber
= hrng
->Instance
->DR
;
575 *random32bit
= hrng
->RandomNumber
;
577 hrng
->State
= HAL_RNG_STATE_READY
;
581 hrng
->ErrorCode
= HAL_RNG_ERROR_BUSY
;
585 /* Process Unlocked */
592 * @brief Generates a 32-bit random number in interrupt mode.
593 * @param hrng pointer to a RNG_HandleTypeDef structure that contains
594 * the configuration information for RNG.
597 HAL_StatusTypeDef
HAL_RNG_GenerateRandomNumber_IT(RNG_HandleTypeDef
*hrng
)
599 HAL_StatusTypeDef status
= HAL_OK
;
604 /* Check RNG peripheral state */
605 if (hrng
->State
== HAL_RNG_STATE_READY
)
607 /* Change RNG peripheral state */
608 hrng
->State
= HAL_RNG_STATE_BUSY
;
610 /* Enable the RNG Interrupts: Data Ready, Clock error, Seed error */
611 __HAL_RNG_ENABLE_IT(hrng
);
615 /* Process Unlocked */
618 hrng
->ErrorCode
= HAL_RNG_ERROR_BUSY
;
626 * @brief Returns generated random number in polling mode (Obsolete)
627 * Use HAL_RNG_GenerateRandomNumber() API instead.
628 * @param hrng pointer to a RNG_HandleTypeDef structure that contains
629 * the configuration information for RNG.
630 * @retval Random value
632 uint32_t HAL_RNG_GetRandomNumber(RNG_HandleTypeDef
*hrng
)
634 if(HAL_RNG_GenerateRandomNumber(hrng
, &(hrng
->RandomNumber
)) == HAL_OK
)
636 return hrng
->RandomNumber
;
645 * @brief Returns a 32-bit random number with interrupt enabled (Obsolete),
646 * Use HAL_RNG_GenerateRandomNumber_IT() API instead.
647 * @param hrng pointer to a RNG_HandleTypeDef structure that contains
648 * the configuration information for RNG.
649 * @retval 32-bit random number
651 uint32_t HAL_RNG_GetRandomNumber_IT(RNG_HandleTypeDef
*hrng
)
653 uint32_t random32bit
= 0U;
658 /* Change RNG peripheral state */
659 hrng
->State
= HAL_RNG_STATE_BUSY
;
661 /* Get a 32bit Random number */
662 random32bit
= hrng
->Instance
->DR
;
664 /* Enable the RNG Interrupts: Data Ready, Clock error, Seed error */
665 __HAL_RNG_ENABLE_IT(hrng
);
667 /* Return the 32 bit random number */
672 * @brief Handles RNG interrupt request.
673 * @note In the case of a clock error, the RNG is no more able to generate
674 * random numbers because the PLL48CLK clock is not correct. User has
675 * to check that the clock controller is correctly configured to provide
676 * the RNG clock and clear the CEIS bit using __HAL_RNG_CLEAR_IT().
677 * The clock error has no impact on the previously generated
678 * random numbers, and the RNG_DR register contents can be used.
679 * @note In the case of a seed error, the generation of random numbers is
680 * interrupted as long as the SECS bit is '1'. If a number is
681 * available in the RNG_DR register, it must not be used because it may
682 * not have enough entropy. In this case, it is recommended to clear the
683 * SEIS bit using __HAL_RNG_CLEAR_IT(), then disable and enable
684 * the RNG peripheral to reinitialize and restart the RNG.
685 * @note User-written HAL_RNG_ErrorCallback() API is called once whether SEIS
687 * @param hrng pointer to a RNG_HandleTypeDef structure that contains
688 * the configuration information for RNG.
692 void HAL_RNG_IRQHandler(RNG_HandleTypeDef
*hrng
)
694 uint32_t rngclockerror
= 0U;
696 /* RNG clock error interrupt occurred */
697 if (__HAL_RNG_GET_IT(hrng
, RNG_IT_CEI
) != RESET
)
699 /* Update the error code */
700 hrng
->ErrorCode
= HAL_RNG_ERROR_SEED
;
703 else if (__HAL_RNG_GET_IT(hrng
, RNG_IT_SEI
) != RESET
)
705 /* Update the error code */
706 hrng
->ErrorCode
= HAL_RNG_ERROR_CLOCK
;
714 if (rngclockerror
== 1U)
716 /* Change RNG peripheral state */
717 hrng
->State
= HAL_RNG_STATE_ERROR
;
719 #if (USE_HAL_RNG_REGISTER_CALLBACKS == 1)
720 /* Call registered Error callback */
721 hrng
->ErrorCallback(hrng
);
723 /* Call legacy weak Error callback */
724 HAL_RNG_ErrorCallback(hrng
);
725 #endif /* USE_HAL_RNG_REGISTER_CALLBACKS */
727 /* Clear the clock error flag */
728 __HAL_RNG_CLEAR_IT(hrng
, RNG_IT_CEI
| RNG_IT_SEI
);
731 /* Check RNG data ready interrupt occurred */
732 if (__HAL_RNG_GET_IT(hrng
, RNG_IT_DRDY
) != RESET
)
734 /* Generate random number once, so disable the IT */
735 __HAL_RNG_DISABLE_IT(hrng
);
737 /* Get the 32bit Random number (DRDY flag automatically cleared) */
738 hrng
->RandomNumber
= hrng
->Instance
->DR
;
740 if (hrng
->State
!= HAL_RNG_STATE_ERROR
)
742 /* Change RNG peripheral state */
743 hrng
->State
= HAL_RNG_STATE_READY
;
744 /* Process Unlocked */
747 #if (USE_HAL_RNG_REGISTER_CALLBACKS == 1)
748 /* Call registered Data Ready callback */
749 hrng
->ReadyDataCallback(hrng
, hrng
->RandomNumber
);
751 /* Call legacy weak Data Ready callback */
752 HAL_RNG_ReadyDataCallback(hrng
, hrng
->RandomNumber
);
753 #endif /* USE_HAL_RNG_REGISTER_CALLBACKS */
759 * @brief Read latest generated random number.
760 * @param hrng pointer to a RNG_HandleTypeDef structure that contains
761 * the configuration information for RNG.
762 * @retval random value
764 uint32_t HAL_RNG_ReadLastRandomNumber(RNG_HandleTypeDef
*hrng
)
766 return (hrng
->RandomNumber
);
770 * @brief Data Ready callback in non-blocking mode.
771 * @param hrng pointer to a RNG_HandleTypeDef structure that contains
772 * the configuration information for RNG.
773 * @param random32bit generated random number.
776 __weak
void HAL_RNG_ReadyDataCallback(RNG_HandleTypeDef
*hrng
, uint32_t random32bit
)
778 /* Prevent unused argument(s) compilation warning */
781 /* NOTE : This function should not be modified. When the callback is needed,
782 function HAL_RNG_ReadyDataCallback must be implemented in the user file.
787 * @brief RNG error callbacks.
788 * @param hrng pointer to a RNG_HandleTypeDef structure that contains
789 * the configuration information for RNG.
792 __weak
void HAL_RNG_ErrorCallback(RNG_HandleTypeDef
*hrng
)
794 /* Prevent unused argument(s) compilation warning */
796 /* NOTE : This function should not be modified. When the callback is needed,
797 function HAL_RNG_ErrorCallback must be implemented in the user file.
805 /** @addtogroup RNG_Exported_Functions_Group3
806 * @brief Peripheral State functions
809 ===============================================================================
810 ##### Peripheral State functions #####
811 ===============================================================================
813 This subsection permits to get in run-time the status of the peripheral
821 * @brief Returns the RNG state.
822 * @param hrng pointer to a RNG_HandleTypeDef structure that contains
823 * the configuration information for RNG.
826 HAL_RNG_StateTypeDef
HAL_RNG_GetState(RNG_HandleTypeDef
*hrng
)
832 * @brief Return the RNG handle error code.
833 * @param hrng: pointer to a RNG_HandleTypeDef structure.
834 * @retval RNG Error Code
836 uint32_t HAL_RNG_GetError(RNG_HandleTypeDef
*hrng
)
838 /* Return RNG Error Code */
839 return hrng
->ErrorCode
;
850 #endif /* HAL_RNG_MODULE_ENABLED */
861 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/