|
STM32L4xx_HAL_Driver
1.14.0
|
RNG HAL module driver. This file provides firmware functions to manage the following functionalities of the Random Number Generator (RNG) peripheral: More...
Go to the source code of this file.
Functions | |
| HAL_StatusTypeDef | HAL_RNG_Init (RNG_HandleTypeDef *hrng) |
| Initialize the RNG peripheral and initialize the associated handle. More... | |
| HAL_StatusTypeDef | HAL_RNG_DeInit (RNG_HandleTypeDef *hrng) |
| DeInitialize the RNG peripheral. More... | |
| void | HAL_RNG_MspInit (RNG_HandleTypeDef *hrng) |
| Initialize the RNG MSP. More... | |
| void | HAL_RNG_MspDeInit (RNG_HandleTypeDef *hrng) |
| DeInitialize the RNG MSP. More... | |
| HAL_StatusTypeDef | HAL_RNG_RegisterCallback (RNG_HandleTypeDef *hrng, HAL_RNG_CallbackIDTypeDef CallbackID, pRNG_CallbackTypeDef pCallback) |
| Register a User RNG Callback To be used instead of the weak predefined callback. More... | |
| HAL_StatusTypeDef | HAL_RNG_UnRegisterCallback (RNG_HandleTypeDef *hrng, HAL_RNG_CallbackIDTypeDef CallbackID) |
| Unregister an RNG Callback RNG callabck is redirected to the weak predefined callback. More... | |
| HAL_StatusTypeDef | HAL_RNG_RegisterReadyDataCallback (RNG_HandleTypeDef *hrng, pRNG_ReadyDataCallbackTypeDef pCallback) |
| Register Data Ready RNG Callback To be used instead of the weak HAL_RNG_ReadyDataCallback() predefined callback. More... | |
| HAL_StatusTypeDef | HAL_RNG_UnRegisterReadyDataCallback (RNG_HandleTypeDef *hrng) |
| UnRegister the Data Ready RNG Callback Data Ready RNG Callback is redirected to the weak HAL_RNG_ReadyDataCallback() predefined callback. More... | |
| HAL_StatusTypeDef | HAL_RNG_GenerateRandomNumber (RNG_HandleTypeDef *hrng, uint32_t *random32bit) |
| Generate a 32-bit random number. More... | |
| HAL_StatusTypeDef | HAL_RNG_GenerateRandomNumber_IT (RNG_HandleTypeDef *hrng) |
| Generate a 32-bit random number in interrupt mode. More... | |
| void | HAL_RNG_IRQHandler (RNG_HandleTypeDef *hrng) |
| Handle RNG interrupt request. More... | |
| uint32_t | HAL_RNG_GetRandomNumber (RNG_HandleTypeDef *hrng) |
| Return generated random number in polling mode (Obsolete). More... | |
| uint32_t | HAL_RNG_GetRandomNumber_IT (RNG_HandleTypeDef *hrng) |
| Return a 32-bit random number with interrupt enabled (Obsolete). More... | |
| uint32_t | HAL_RNG_ReadLastRandomNumber (RNG_HandleTypeDef *hrng) |
| Read latest generated random number. More... | |
| void | HAL_RNG_ReadyDataCallback (RNG_HandleTypeDef *hrng, uint32_t random32bit) |
| Data Ready callback in non-blocking mode. More... | |
| void | HAL_RNG_ErrorCallback (RNG_HandleTypeDef *hrng) |
| RNG error callback. More... | |
| HAL_RNG_StateTypeDef | HAL_RNG_GetState (RNG_HandleTypeDef *hrng) |
| Return the RNG handle state. More... | |
| uint32_t | HAL_RNG_GetError (RNG_HandleTypeDef *hrng) |
| Return the RNG handle error code. More... | |
RNG HAL module driver. This file provides firmware functions to manage the following functionalities of the Random Number Generator (RNG) peripheral:
==============================================================================
##### How to use this driver #####
==============================================================================
[..]
The RNG HAL driver can be used as follows:
(#) Enable the RNG controller clock using __HAL_RCC_RNG_CLK_ENABLE() macro
in HAL_RNG_MspInit().
(#) Activate the RNG peripheral using HAL_RNG_Init() function.
(#) Wait until the 32-bit Random Number Generator contains a valid
random data using (polling/interrupt) mode.
(#) Get the 32 bit random number using HAL_RNG_GenerateRandomNumber() function.
##### Callback registration #####
==================================
[..]
The compilation define USE_HAL_RNG_REGISTER_CALLBACKS when set to 1
allows the user to configure dynamically the driver callbacks.
[..]
Use Function @ref HAL_RNG_RegisterCallback() to register a user callback.
Function @ref HAL_RNG_RegisterCallback() allows to register following callbacks:
(+) ErrorCallback : RNG Error Callback.
(+) MspInitCallback : RNG MspInit.
(+) MspDeInitCallback : RNG MspDeInit.
This function takes as parameters the HAL peripheral handle, the Callback ID
and a pointer to the user callback function.
[..]
Use function @ref HAL_RNG_UnRegisterCallback() to reset a callback to the default
weak (surcharged) function.
@ref HAL_RNG_UnRegisterCallback() takes as parameters the HAL peripheral handle,
and the Callback ID.
This function allows to reset following callbacks:
(+) ErrorCallback : RNG Error Callback.
(+) MspInitCallback : RNG MspInit.
(+) MspDeInitCallback : RNG MspDeInit.
[..]
For specific callback ReadyDataCallback, use dedicated register callbacks:
respectively @ref HAL_RNG_RegisterReadyDataCallback() , @ref HAL_RNG_UnRegisterReadyDataCallback().
[..]
By default, after the @ref HAL_RNG_Init() and when the state is HAL_RNG_STATE_RESET
all callbacks are set to the corresponding weak (surcharged) functions:
example @ref HAL_RNG_ErrorCallback().
Exception done for MspInit and MspDeInit functions that are respectively
reset to the legacy weak (surcharged) functions in the @ref HAL_RNG_Init()
and @ref HAL_RNG_DeInit() only when these callbacks are null (not registered beforehand).
If not, MspInit or MspDeInit are not null, the @ref HAL_RNG_Init() and @ref HAL_RNG_DeInit()
keep and use the user MspInit/MspDeInit callbacks (registered beforehand).
[..]
Callbacks can be registered/unregistered in HAL_RNG_STATE_READY state only.
Exception done MspInit/MspDeInit that can be registered/unregistered
in HAL_RNG_STATE_READY or HAL_RNG_STATE_RESET state, thus registered (user)
MspInit/DeInit callbacks can be used during the Init/DeInit.
In that case first register the MspInit/MspDeInit user callbacks
using @ref HAL_RNG_RegisterCallback() before calling @ref HAL_RNG_DeInit()
or @ref HAL_RNG_Init() function.
[..]
When The compilation define USE_HAL_RNG_REGISTER_CALLBACKS is set to 0 or
not defined, the callback registration feature is not available
and weak (surcharged) callbacks are used.This software component is licensed by ST under BSD 3-Clause license, the "License"; You may not use this file except in compliance with the License. You may obtain a copy of the License at: opensource.org/licenses/BSD-3-Clause
Definition in file stm32l4xx_hal_rng.c.