HAL RNG Functions ¶
Initialization and de-initialization functions ¶
- group RNG_Exported_Functions_Group1
-
This subsection provides a set of functions allowing to initialize an de-initialize the RNG peripheral:
-
HAL_RNG_Init() to initialize the selected HAl RNG handle and associate a RNG peripheral instance.
-
HAL_RNG_DeInit() to de-initialize the given HAL RNG instance and resetting the state machine.
Functions
-
hal_status_t
HAL_RNG_Init
(
hal_rng_handle_t
*
hrng
,
hal_rng_t
instance
)
¶
-
Initialize the RNG handle and associates an instance.
- Parameters :
-
-
hrng – pointer to hal_rng_handle_t structure.
-
instance – one of the values of the enumeration hal_rng_t .
-
- Return values :
-
-
HAL_OK – RNG handle has been correctly initialized.
-
HAL_INVALID_PARAM – invalid parameter.
-
-
void
HAL_RNG_DeInit
(
hal_rng_handle_t
*
hrng
)
¶
-
DeInitialize the RNG peripheral.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
-
- group RNG_Exported_Functions_Group1
-
This subsection provides a set of functions allowing to initialize an de-initialize the RNG peripheral:
-
HAL_RNG_Init() to initialize the selected HAl RNG handle and associate a RNG peripheral instance.
-
HAL_RNG_DeInit() to de-initialize the given HAL RNG instance and resetting the state machine.
Functions
-
hal_status_t
HAL_RNG_Init
(
hal_rng_handle_t
*
hrng
,
hal_rng_t
instance
)
-
Initialize the RNG handle and associates an instance.
- Parameters :
-
-
hrng – pointer to hal_rng_handle_t structure.
-
instance – one of the values of the enumeration hal_rng_t .
-
- Return values :
-
-
HAL_OK – RNG handle has been correctly initialized.
-
HAL_INVALID_PARAM – invalid parameter.
-
-
void
HAL_RNG_DeInit
(
hal_rng_handle_t
*
hrng
)
-
DeInitialize the RNG peripheral.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
-
- group RNG_Exported_Functions_Group1
-
This subsection provides a set of functions allowing to initialize an de-initialize the RNG peripheral:
-
HAL_RNG_Init() to initialize the selected HAl RNG handle and associate a RNG peripheral instance.
-
HAL_RNG_DeInit() to de-initialize the given HAL RNG instance and resetting the state machine.
Functions
-
hal_status_t
HAL_RNG_Init
(
hal_rng_handle_t
*
hrng
,
hal_rng_t
instance
)
-
Initialize the RNG handle and associates an instance.
- Parameters :
-
-
hrng – pointer to hal_rng_handle_t structure.
-
instance – one of the values of the enumeration hal_rng_t .
-
- Return values :
-
-
HAL_OK – RNG handle has been correctly initialized.
-
HAL_INVALID_PARAM – invalid parameter.
-
-
void
HAL_RNG_DeInit
(
hal_rng_handle_t
*
hrng
)
-
DeInitialize the RNG peripheral.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
-
Configuration functions ¶
- group RNG_Exported_Functions_Group2
-
This subsection provides a set of APIs allowing to configure the RNG peripheral:
-
HAL_RNG_SetConfig() set the configuration of the RNG peripheral.
-
HAL_RNG_SetCertifiedNISTConfig() set RNG peripheral within a NIST compliant configuration.
-
HAL_RNG_SetCandidateNISTConfig() set RNG peripheral within candidate NIST compliant configuration.
-
HAL_RNG_SetCandidateGermanBSIConfig() set RNG peripheral within candidate German BSI compliant configuration.
-
HAL_RNG_GetConfig() retrieve the RNG peripheral configuration.
-
HAL_RNG_EnableClockErrorDetection() enable the clock error detection feature.
-
HAL_RNG_DisableClockErrorDetection() disable the clock error detection feature.
-
HAL_RNG_IsEnabledClockErrorDetection() check if the clock error detection feature is enabled or not.
-
HAL_RNG_EnableAutoReset() enable the auto reset feature.
-
HAL_RNG_DisableAutoReset() disable the auto reset feature.
-
HAL_RNG_IsEnabledAutoReset() check if the auto reset feature is enabled or not.
-
HAL_RNG_SetClockDivider() set the clock divider.
-
HAL_RNG_GetClockDivider() retrieve the clock divider value.
Functions
-
hal_status_t
HAL_RNG_SetConfig
(
hal_rng_handle_t
*
hrng
,
const
hal_rng_config_t
*
p_config
)
¶
-
Configure the RNG with the specified parameters in the hal_rng_config_t .
- Parameters :
-
-
hrng – pointer to hal_rng_handle_t structure.
-
p_config – pointer to hal_rng_config_t structure.
-
- Return values :
-
-
HAL_OK – configuration succeeded.
-
HAL_ERROR – configuration fail.
-
HAL_INVALID_PARAM – invalid parameter.
-
-
hal_status_t
HAL_RNG_SetCertifiedNISTConfig
(
hal_rng_handle_t
*
hrng
)
¶
-
Configure the RNG with the NIST compliant configuration.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
- Return values :
-
-
HAL_OK – configuration succeeded.
-
HAL_ERROR – configuration fail.
-
HAL_INVALID_PARAM – invalid parameter.
-
-
hal_status_t
HAL_RNG_SetCandidateNISTConfig
(
hal_rng_handle_t
*
hrng
)
¶
-
Configure the RNG with the candidate NIST compliant configuration.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
- Return values :
-
-
HAL_OK – configuration succeeded.
-
HAL_ERROR – configuration fail.
-
HAL_INVALID_PARAM – invalid parameter.
-
-
hal_status_t
HAL_RNG_SetCandidateGermanBSIConfig
(
hal_rng_handle_t
*
hrng
)
¶
-
Configure the RNG with the candidate German BSI compliant configuration.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
- Return values :
-
-
HAL_OK – configuration succeeded.
-
HAL_ERROR – configuration fail.
-
HAL_INVALID_PARAM – invalid parameter.
-
-
void
HAL_RNG_GetConfig
(
const
hal_rng_handle_t
*
hrng
,
hal_rng_config_t
*
p_config
)
¶
-
Get the RNG configuration and fill parameters in the hal_rng_config_t .
- Parameters :
-
-
hrng – pointer to hal_rng_handle_t structure.
-
p_config – pointer to hal_rng_config_t structure. module
-
-
hal_status_t
HAL_RNG_EnableClockErrorDetection
(
hal_rng_handle_t
*
hrng
)
¶
-
Enable the clock error detection feature.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
- Return values :
-
-
HAL_OK – configuration succeeded.
-
HAL_ERROR – configuration fail.
-
HAL_INVALID_PARAM – invalid parameter.
-
-
hal_status_t
HAL_RNG_DisableClockErrorDetection
(
hal_rng_handle_t
*
hrng
)
¶
-
Disable the clock error detection feature.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
- Return values :
-
-
HAL_OK – configuration succeeded.
-
HAL_ERROR – configuration fail.
-
HAL_INVALID_PARAM – invalid parameter.
-
-
hal_rng_clock_error_detection_status_t
HAL_RNG_IsEnabledClockErrorDetection
(
const
hal_rng_handle_t
*
hrng
)
¶
-
Check the clock error detection status.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
- Return values :
-
hal_rng_clock_error_detection_status_t – error detection state.
-
hal_status_t
HAL_RNG_EnableAutoReset
(
hal_rng_handle_t
*
hrng
)
¶
-
Enable the automatic reset.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
- Return values :
-
-
HAL_OK – auto-reset enabled successfully.
-
HAL_ERROR – fail to enable the auto-reset.
-
HAL_INVALID_PARAM – invalid parameter.
-
-
hal_status_t
HAL_RNG_DisableAutoReset
(
hal_rng_handle_t
*
hrng
)
¶
-
Disable the auto reset.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
- Return values :
-
-
HAL_OK – auto-reset disabled successfully.
-
HAL_ERROR – fail to disable the auto-reset.
-
HAL_INVALID_PARAM – invalid parameter.
-
-
hal_rng_auto_reset_status_t
HAL_RNG_IsEnabledAutoReset
(
const
hal_rng_handle_t
*
hrng
)
¶
-
Check the status of the auto reset.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
- Return values :
-
hal_rng_auto_reset_status_t – auto-reset state
-
hal_status_t
HAL_RNG_SetClockDivider
(
hal_rng_handle_t
*
hrng
,
hal_rng_clock_divider_t
clk_divider
)
¶
-
Set RNG Clock divider factor.
- Parameters :
-
-
hrng – pointer to hal_rng_handle_t structure.
-
clk_divider – is a value of the hal_rng_clock_divider_t enumeration.
-
- Return values :
-
-
HAL_OK – clock divider set successfully.
-
HAL_ERROR – fail to set the clock divider.
-
HAL_INVALID_PARAM – invalid parameter.
-
-
hal_rng_clock_divider_t
HAL_RNG_GetClockDivider
(
const
hal_rng_handle_t
*
hrng
)
¶
-
Get RNG Clock divider factor.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
- Return values :
-
hal_rng_clock_divider_t – Clock divider.
-
- group RNG_Exported_Functions_Group2
-
This subsection provides a set of APIs allowing to configure the RNG peripheral:
-
HAL_RNG_SetConfig() set the configuration of the RNG peripheral.
-
HAL_RNG_SetCertifiedNISTConfig() set RNG peripheral within a NIST compliant configuration.
-
HAL_RNG_SetCandidateNISTConfig() set RNG peripheral within candidate NIST compliant configuration.
-
HAL_RNG_SetCandidateGermanBSIConfig() set RNG peripheral within candidate German BSI compliant configuration.
-
HAL_RNG_GetConfig() retrieve the RNG peripheral configuration.
-
HAL_RNG_EnableClockErrorDetection() enable the clock error detection feature.
-
HAL_RNG_DisableClockErrorDetection() disable the clock error detection feature.
-
HAL_RNG_IsEnabledClockErrorDetection() check if the clock error detection feature is enabled or not.
-
HAL_RNG_EnableAutoReset() enable the auto reset feature.
-
HAL_RNG_DisableAutoReset() disable the auto reset feature.
-
HAL_RNG_IsEnabledAutoReset() check if the auto reset feature is enabled or not.
-
HAL_RNG_SetClockDivider() set the clock divider.
-
HAL_RNG_GetClockDivider() retrieve the clock divider value.
Functions
-
hal_status_t
HAL_RNG_SetConfig
(
hal_rng_handle_t
*
hrng
,
const
hal_rng_config_t
*
p_config
)
-
Configure the RNG with the specified parameters in the hal_rng_config_t .
- Parameters :
-
-
hrng – pointer to hal_rng_handle_t structure.
-
p_config – pointer to hal_rng_config_t structure.
-
- Return values :
-
-
HAL_OK – configuration succeeded.
-
HAL_ERROR – configuration fail.
-
HAL_INVALID_PARAM – invalid parameter.
-
-
hal_status_t
HAL_RNG_SetCandidateNISTConfig
(
hal_rng_handle_t
*
hrng
)
-
Configure the RNG with the candidate NIST compliant configuration.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
- Return values :
-
-
HAL_OK – configuration succeeded.
-
HAL_ERROR – configuration fail.
-
HAL_INVALID_PARAM – invalid parameter.
-
-
hal_status_t
HAL_RNG_SetCandidateGermanBSIConfig
(
hal_rng_handle_t
*
hrng
)
-
Configure the RNG with the candidate German BSI compliant configuration.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
- Return values :
-
-
HAL_OK – configuration succeeded.
-
HAL_ERROR – configuration fail.
-
HAL_INVALID_PARAM – invalid parameter.
-
-
void
HAL_RNG_GetConfig
(
const
hal_rng_handle_t
*
hrng
,
hal_rng_config_t
*
p_config
)
-
Get the RNG configuration and fill parameters in the hal_rng_config_t .
- Parameters :
-
-
hrng – pointer to hal_rng_handle_t structure.
-
p_config – pointer to hal_rng_config_t structure. module
-
-
hal_status_t
HAL_RNG_EnableClockErrorDetection
(
hal_rng_handle_t
*
hrng
)
-
Enable the clock error detection feature.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
- Return values :
-
-
HAL_OK – configuration succeeded.
-
HAL_ERROR – configuration fail.
-
HAL_INVALID_PARAM – invalid parameter.
-
-
hal_status_t
HAL_RNG_DisableClockErrorDetection
(
hal_rng_handle_t
*
hrng
)
-
Disable the clock error detection feature.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
- Return values :
-
-
HAL_OK – configuration succeeded.
-
HAL_ERROR – configuration fail.
-
HAL_INVALID_PARAM – invalid parameter.
-
-
hal_rng_clock_error_detection_status_t
HAL_RNG_IsEnabledClockErrorDetection
(
const
hal_rng_handle_t
*
hrng
)
-
Check the clock error detection status.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
- Return values :
-
hal_rng_clock_error_detection_status_t – error detection state.
-
hal_status_t
HAL_RNG_EnableAutoReset
(
hal_rng_handle_t
*
hrng
)
-
Enable the automatic reset.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
- Return values :
-
-
HAL_OK – auto-reset enabled successfully.
-
HAL_ERROR – fail to enable the auto-reset.
-
HAL_INVALID_PARAM – invalid parameter.
-
-
hal_status_t
HAL_RNG_DisableAutoReset
(
hal_rng_handle_t
*
hrng
)
-
Disable the auto reset.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
- Return values :
-
-
HAL_OK – auto-reset disabled successfully.
-
HAL_ERROR – fail to disable the auto-reset.
-
HAL_INVALID_PARAM – invalid parameter.
-
-
hal_rng_auto_reset_status_t
HAL_RNG_IsEnabledAutoReset
(
const
hal_rng_handle_t
*
hrng
)
-
Check the status of the auto reset.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
- Return values :
-
hal_rng_auto_reset_status_t – auto-reset state
-
hal_status_t
HAL_RNG_SetClockDivider
(
hal_rng_handle_t
*
hrng
,
hal_rng_clock_divider_t
clk_divider
)
-
Set RNG Clock divider factor.
- Parameters :
-
-
hrng – pointer to hal_rng_handle_t structure.
-
clk_divider – is a value of the hal_rng_clock_divider_t enumeration.
-
- Return values :
-
-
HAL_OK – clock divider set successfully.
-
HAL_ERROR – fail to set the clock divider.
-
HAL_INVALID_PARAM – invalid parameter.
-
-
hal_rng_clock_divider_t
HAL_RNG_GetClockDivider
(
const
hal_rng_handle_t
*
hrng
)
-
Get RNG Clock divider factor.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
- Return values :
-
hal_rng_clock_divider_t – Clock divider.
-
- group RNG_Exported_Functions_Group2
-
This subsection provides a set of APIs allowing to configure the RNG peripheral:
-
HAL_RNG_SetConfig() set the configuration of the RNG peripheral.
-
HAL_RNG_SetCertifiedNISTConfig() set RNG peripheral within a NIST compliant configuration.
-
HAL_RNG_SetCandidateNISTConfig() set RNG peripheral within candidate NIST compliant configuration.
-
HAL_RNG_SetCandidateGermanBSIConfig() set RNG peripheral within candidate German BSI compliant configuration.
-
HAL_RNG_GetConfig() retrieve the RNG peripheral configuration.
-
HAL_RNG_EnableClockErrorDetection() enable the clock error detection feature.
-
HAL_RNG_DisableClockErrorDetection() disable the clock error detection feature.
-
HAL_RNG_IsEnabledClockErrorDetection() check if the clock error detection feature is enabled or not.
-
HAL_RNG_EnableAutoReset() enable the auto reset feature.
-
HAL_RNG_DisableAutoReset() disable the auto reset feature.
-
HAL_RNG_IsEnabledAutoReset() check if the auto reset feature is enabled or not.
-
HAL_RNG_SetClockDivider() set the clock divider.
-
HAL_RNG_GetClockDivider() retrieve the clock divider value.
Functions
-
hal_status_t
HAL_RNG_SetConfig
(
hal_rng_handle_t
*
hrng
,
const
hal_rng_config_t
*
p_config
)
-
Configure the RNG with the specified parameters in the hal_rng_config_t .
- Parameters :
-
-
hrng – pointer to hal_rng_handle_t structure.
-
p_config – pointer to hal_rng_config_t structure.
-
- Return values :
-
-
HAL_OK – configuration succeeded.
-
HAL_ERROR – configuration fail.
-
HAL_INVALID_PARAM – invalid parameter.
-
-
hal_status_t
HAL_RNG_SetCandidateNISTConfig
(
hal_rng_handle_t
*
hrng
)
-
Configure the RNG with the candidate NIST compliant configuration.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
- Return values :
-
-
HAL_OK – configuration succeeded.
-
HAL_ERROR – configuration fail.
-
HAL_INVALID_PARAM – invalid parameter.
-
-
hal_status_t
HAL_RNG_SetCandidateGermanBSIConfig
(
hal_rng_handle_t
*
hrng
)
-
Configure the RNG with the candidate German BSI compliant configuration.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
- Return values :
-
-
HAL_OK – configuration succeeded.
-
HAL_ERROR – configuration fail.
-
HAL_INVALID_PARAM – invalid parameter.
-
-
void
HAL_RNG_GetConfig
(
const
hal_rng_handle_t
*
hrng
,
hal_rng_config_t
*
p_config
)
-
Get the RNG configuration and fill parameters in the hal_rng_config_t .
- Parameters :
-
-
hrng – pointer to hal_rng_handle_t structure.
-
p_config – pointer to hal_rng_config_t structure. module
-
-
hal_status_t
HAL_RNG_EnableClockErrorDetection
(
hal_rng_handle_t
*
hrng
)
-
Enable the clock error detection feature.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
- Return values :
-
-
HAL_OK – configuration succeeded.
-
HAL_ERROR – configuration fail.
-
HAL_INVALID_PARAM – invalid parameter.
-
-
hal_status_t
HAL_RNG_DisableClockErrorDetection
(
hal_rng_handle_t
*
hrng
)
-
Disable the clock error detection feature.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
- Return values :
-
-
HAL_OK – configuration succeeded.
-
HAL_ERROR – configuration fail.
-
HAL_INVALID_PARAM – invalid parameter.
-
-
hal_rng_clock_error_detection_status_t
HAL_RNG_IsEnabledClockErrorDetection
(
const
hal_rng_handle_t
*
hrng
)
-
Check the clock error detection status.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
- Return values :
-
hal_rng_clock_error_detection_status_t – error detection state.
-
hal_status_t
HAL_RNG_EnableAutoReset
(
hal_rng_handle_t
*
hrng
)
-
Enable the automatic reset.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
- Return values :
-
-
HAL_OK – auto-reset enabled successfully.
-
HAL_ERROR – fail to enable the auto-reset.
-
HAL_INVALID_PARAM – invalid parameter.
-
-
hal_status_t
HAL_RNG_DisableAutoReset
(
hal_rng_handle_t
*
hrng
)
-
Disable the auto reset.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
- Return values :
-
-
HAL_OK – auto-reset disabled successfully.
-
HAL_ERROR – fail to disable the auto-reset.
-
HAL_INVALID_PARAM – invalid parameter.
-
-
hal_rng_auto_reset_status_t
HAL_RNG_IsEnabledAutoReset
(
const
hal_rng_handle_t
*
hrng
)
-
Check the status of the auto reset.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
- Return values :
-
hal_rng_auto_reset_status_t – auto-reset state
-
hal_status_t
HAL_RNG_SetClockDivider
(
hal_rng_handle_t
*
hrng
,
hal_rng_clock_divider_t
clk_divider
)
-
Set RNG Clock divider factor.
- Parameters :
-
-
hrng – pointer to hal_rng_handle_t structure.
-
clk_divider – is a value of the hal_rng_clock_divider_t enumeration.
-
- Return values :
-
-
HAL_OK – clock divider set successfully.
-
HAL_ERROR – fail to set the clock divider.
-
HAL_INVALID_PARAM – invalid parameter.
-
-
hal_rng_clock_divider_t
HAL_RNG_GetClockDivider
(
const
hal_rng_handle_t
*
hrng
)
-
Get RNG Clock divider factor.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
- Return values :
-
hal_rng_clock_divider_t – Clock divider.
-
Peripheral control functions ¶
- group RNG_Exported_Functions_Group3
-
This subsection provides a set of APIs allowing to generate random number in polling and interrupt mode :
-
HAL_RNG_GenerateRandomNumber() generate a N random number word in polling mode.
-
HAL_RNG_GenerateRandomNumber_IT() generate a N random number word in interrupt mode.
-
HAL_RNG_IRQHandler() handle RNG interrupt requests.
Functions
-
hal_status_t
HAL_RNG_GenerateRandomNumber
(
hal_rng_handle_t
*
hrng
,
uint32_t
*
p_data
,
uint32_t
size_word
,
uint32_t
timeout_ms
)
¶
-
Generate a N x 32-bit random number in polling mode.
- Parameters :
-
-
hrng – pointer to hal_rng_handle_t structure.
-
p_data – pointer to be filled with random number.
-
size_word – total number of random number to be generated.
-
timeout_ms – timeout in millisecond.
-
- Return values :
-
-
HAL_OK – random numbers are generated successfully.
-
HAL_ERROR – seed error occurred when generated random number.
-
HAL_TIMEOUT – timeout occurred when generating random number.
-
HAL_BUSY – process is already ongoing.
-
HAL_INVALID_PARAM – invalid parameter.
-
-
hal_status_t
HAL_RNG_GenerateRandomNumber_IT
(
hal_rng_handle_t
*
hrng
,
uint32_t
*
p_data
,
uint32_t
size_word
)
¶
-
Generate a N x 32-bit random number in interrupt mode.
- Parameters :
-
-
hrng – pointer to hal_rng_handle_t structure.
-
p_data – pointer to be filled with random number.
-
size_word – total number of random number to be generated.
-
- Return values :
-
-
HAL_OK – 32-bit random number generated successfully.
-
HAL_BUSY – process is already ongoing.
-
HAL_INVALID_PARAM – invalid parameter.
-
-
void
HAL_RNG_IRQHandler
(
hal_rng_handle_t
*
hrng
)
¶
-
Handle the RNG interrupt request.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
-
- group RNG_Exported_Functions_Group3
-
This subsection provides a set of APIs allowing to generate random number in polling and interrupt mode :
-
HAL_RNG_GenerateRandomNumber() generate a N random number word in polling mode.
-
HAL_RNG_GenerateRandomNumber_IT() generate a N random number word in interrupt mode.
-
HAL_RNG_IRQHandler() handle RNG interrupt requests.
Functions
-
hal_status_t
HAL_RNG_GenerateRandomNumber
(
hal_rng_handle_t
*
hrng
,
uint32_t
*
p_data
,
uint32_t
size_word
,
uint32_t
timeout_ms
)
-
Generate a N x 32-bit random number in polling mode.
- Parameters :
-
-
hrng – pointer to hal_rng_handle_t structure.
-
p_data – pointer to be filled with random number.
-
size_word – total number of random number to be generated.
-
timeout_ms – timeout in millisecond.
-
- Return values :
-
-
HAL_OK – random numbers are generated successfully.
-
HAL_ERROR – seed error occurred when generated random number.
-
HAL_TIMEOUT – timeout occurred when generating random number.
-
HAL_BUSY – process is already ongoing.
-
HAL_INVALID_PARAM – invalid parameter.
-
-
hal_status_t
HAL_RNG_GenerateRandomNumber_IT
(
hal_rng_handle_t
*
hrng
,
uint32_t
*
p_data
,
uint32_t
size_word
)
-
Generate a N x 32-bit random number in interrupt mode.
- Parameters :
-
-
hrng – pointer to hal_rng_handle_t structure.
-
p_data – pointer to be filled with random number.
-
size_word – total number of random number to be generated.
-
- Return values :
-
-
HAL_OK – 32-bit random number generated successfully.
-
HAL_BUSY – process is already ongoing.
-
HAL_INVALID_PARAM – invalid parameter.
-
-
void
HAL_RNG_IRQHandler
(
hal_rng_handle_t
*
hrng
)
-
Handle the RNG interrupt request.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
-
- group RNG_Exported_Functions_Group3
-
This subsection provides a set of APIs allowing to generate random number in polling and interrupt mode :
-
HAL_RNG_GenerateRandomNumber() generate a N random number word in polling mode.
-
HAL_RNG_GenerateRandomNumber_IT() generate a N random number word in interrupt mode.
-
HAL_RNG_IRQHandler() handle RNG interrupt requests.
Functions
-
hal_status_t
HAL_RNG_GenerateRandomNumber
(
hal_rng_handle_t
*
hrng
,
uint32_t
*
p_data
,
uint32_t
size_word
,
uint32_t
timeout_ms
)
-
Generate a N x 32-bit random number in polling mode.
- Parameters :
-
-
hrng – pointer to hal_rng_handle_t structure.
-
p_data – pointer to be filled with random number.
-
size_word – total number of random number to be generated.
-
timeout_ms – timeout in millisecond.
-
- Return values :
-
-
HAL_OK – random numbers are generated successfully.
-
HAL_ERROR – seed error occurred when generated random number.
-
HAL_TIMEOUT – timeout occurred when generating random number.
-
HAL_BUSY – process is already ongoing.
-
HAL_INVALID_PARAM – invalid parameter.
-
-
hal_status_t
HAL_RNG_GenerateRandomNumber_IT
(
hal_rng_handle_t
*
hrng
,
uint32_t
*
p_data
,
uint32_t
size_word
)
-
Generate a N x 32-bit random number in interrupt mode.
- Parameters :
-
-
hrng – pointer to hal_rng_handle_t structure.
-
p_data – pointer to be filled with random number.
-
size_word – total number of random number to be generated.
-
- Return values :
-
-
HAL_OK – 32-bit random number generated successfully.
-
HAL_BUSY – process is already ongoing.
-
HAL_INVALID_PARAM – invalid parameter.
-
-
void
HAL_RNG_IRQHandler
(
hal_rng_handle_t
*
hrng
)
-
Handle the RNG interrupt request.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
-
Seed error recovery function ¶
- group RNG_Exported_Functions_Group4
-
This subsection provides the RNG recover from seed error function :
-
HAL_RNG_RecoverSeedError() recover seed error when occurs.
Functions
-
hal_status_t
HAL_RNG_RecoverSeedError
(
hal_rng_handle_t
*
hrng
)
¶
-
Recover the RNG sequence when a seed error occurs.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
- Return values :
-
-
HAL_OK – operation succeeded
-
HAL_ERROR – operation failed
-
HAL_INVALID_PARAM – invalid parameter.
-
-
- group RNG_Exported_Functions_Group4
-
This subsection provides the RNG recover from seed error function :
-
HAL_RNG_RecoverSeedError() recover seed error when occurs.
Functions
-
hal_status_t
HAL_RNG_RecoverSeedError
(
hal_rng_handle_t
*
hrng
)
-
Recover the RNG sequence when a seed error occurs.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
- Return values :
-
-
HAL_OK – operation succeeded
-
HAL_ERROR – operation failed
-
HAL_INVALID_PARAM – invalid parameter.
-
-
- group RNG_Exported_Functions_Group4
-
This subsection provides the RNG recover from seed error function :
-
HAL_RNG_RecoverSeedError() recover seed error when occurs.
Functions
-
hal_status_t
HAL_RNG_RecoverSeedError
(
hal_rng_handle_t
*
hrng
)
-
Recover the RNG sequence when a seed error occurs.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
- Return values :
-
-
HAL_OK – operation succeeded
-
HAL_ERROR – operation failed
-
HAL_INVALID_PARAM – invalid parameter.
-
-
Callbacks functions ¶
- group RNG_Exported_Functions_Group5
-
This subsection provides a set the RNG callbacks registration APIs :
-
HAL_RNG_RegisterGenerationCpltCallback() register callback function for interrupts when generate completed.
-
HAL_RNG_RegisterErrorCallback() register callback function for interrupts when error occurs.
Functions
-
void
HAL_RNG_ErrorCallback
(
hal_rng_handle_t
*
hrng
)
¶
-
Handle the RNG error callback.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
-
void
HAL_RNG_GenerationCpltCallback
(
hal_rng_handle_t
*
hrng
)
¶
-
Handle the Random number generation complete callback in non-blocking mode.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
-
hal_status_t
HAL_RNG_RegisterGenerationCpltCallback
(
hal_rng_handle_t
*
hrng
,
hal_rng_cb_t
callback
)
¶
-
Register random number RNG generation complete callback.
To be used instead of the weak
HAL_RNG_GenerationCpltCallback() .- Parameters :
-
-
hrng – pointer to hal_rng_handle_t structure.
-
callback – pointer to the random number Ready callback function.
-
- Return values :
-
-
HAL_OK – succeed.
-
HAL_INVALID_PARAM – invalid callback.
-
-
hal_status_t
HAL_RNG_RegisterErrorCallback
(
hal_rng_handle_t
*
hrng
,
hal_rng_cb_t
callback
)
¶
-
Register a User RNG callback.
To be used instead of the weak HAL_RNG_RegisterErrorCallback.
- Parameters :
-
-
hrng – pointer to hal_rng_handle_t structure.
-
callback – pointer to the callback function
-
- Return values :
-
-
HAL_OK – succeed.
-
HAL_INVALID_PARAM – invalid callback.
-
-
- group RNG_Exported_Functions_Group5
-
This subsection provides a set the RNG callbacks registration APIs :
-
HAL_RNG_RegisterGenerationCpltCallback() register callback function for interrupts when generate completed.
-
HAL_RNG_RegisterErrorCallback() register callback function for interrupts when error occurs.
Functions
-
void
HAL_RNG_ErrorCallback
(
hal_rng_handle_t
*
hrng
)
-
Handle the RNG error callback.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
-
void
HAL_RNG_GenerationCpltCallback
(
hal_rng_handle_t
*
hrng
)
-
Handle the Random number generation complete callback in non-blocking mode.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
-
hal_status_t
HAL_RNG_RegisterGenerationCpltCallback
(
hal_rng_handle_t
*
hrng
,
hal_rng_cb_t
callback
)
-
Register random number RNG generation complete callback.
To be used instead of the weak
HAL_RNG_GenerationCpltCallback() .- Parameters :
-
-
hrng – pointer to hal_rng_handle_t structure.
-
callback – pointer to the random number Ready callback function.
-
- Return values :
-
-
HAL_OK – succeed.
-
HAL_INVALID_PARAM – invalid callback.
-
-
hal_status_t
HAL_RNG_RegisterErrorCallback
(
hal_rng_handle_t
*
hrng
,
hal_rng_cb_t
callback
)
-
Register a User RNG callback.
To be used instead of the weak HAL_RNG_RegisterErrorCallback.
- Parameters :
-
-
hrng – pointer to hal_rng_handle_t structure.
-
callback – pointer to the callback function
-
- Return values :
-
-
HAL_OK – succeed.
-
HAL_INVALID_PARAM – invalid callback.
-
-
- group RNG_Exported_Functions_Group5
-
This subsection provides a set the RNG callbacks registration APIs :
-
HAL_RNG_RegisterGenerationCpltCallback() register callback function for interrupts when generate completed.
-
HAL_RNG_RegisterErrorCallback() register callback function for interrupts when error occurs.
Functions
-
void
HAL_RNG_ErrorCallback
(
hal_rng_handle_t
*
hrng
)
-
Handle the RNG error callback.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
-
void
HAL_RNG_GenerationCpltCallback
(
hal_rng_handle_t
*
hrng
)
-
Handle the Random number generation complete callback in non-blocking mode.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
-
hal_status_t
HAL_RNG_RegisterGenerationCpltCallback
(
hal_rng_handle_t
*
hrng
,
hal_rng_cb_t
callback
)
-
Register random number RNG generation complete callback.
To be used instead of the weak
HAL_RNG_GenerationCpltCallback() .- Parameters :
-
-
hrng – pointer to hal_rng_handle_t structure.
-
callback – pointer to the random number Ready callback function.
-
- Return values :
-
-
HAL_OK – succeed.
-
HAL_INVALID_PARAM – invalid callback.
-
-
hal_status_t
HAL_RNG_RegisterErrorCallback
(
hal_rng_handle_t
*
hrng
,
hal_rng_cb_t
callback
)
-
Register a User RNG callback.
To be used instead of the weak HAL_RNG_RegisterErrorCallback.
- Parameters :
-
-
hrng – pointer to hal_rng_handle_t structure.
-
callback – pointer to the callback function
-
- Return values :
-
-
HAL_OK – succeed.
-
HAL_INVALID_PARAM – invalid callback.
-
-
User Data functions ¶
- group RNG_Exported_Functions_Group6
-
This subsection provides a set of functions allowing to Set and Get user data :
-
HAL_RNG_SetUserData() store user data pointer into the handle.
-
HAL_RNG_GetUserData() retrieve user data pointer from the handle.
Functions
-
void
HAL_RNG_SetUserData
(
hal_rng_handle_t
*
hrng
,
const
void
*
p_user_data
)
¶
-
Store the user data into the RNG handle.
- Parameters :
-
-
hrng – pointer to hal_rng_handle_t structure.
-
p_user_data – pointer to the user data
-
-
const
void
*
HAL_RNG_GetUserData
(
const
hal_rng_handle_t
*
hrng
)
¶
-
Retrieve the user data from the RNG handle.
- Parameters :
-
hrng – Pointer to RNG handle
- Return values :
-
Pointer – to the user data
-
- group RNG_Exported_Functions_Group6
-
This subsection provides a set of functions allowing to Set and Get user data :
-
HAL_RNG_SetUserData() store user data pointer into the handle.
-
HAL_RNG_GetUserData() retrieve user data pointer from the handle.
Functions
-
void
HAL_RNG_SetUserData
(
hal_rng_handle_t
*
hrng
,
const
void
*
p_user_data
)
-
Store the user data into the RNG handle.
- Parameters :
-
-
hrng – pointer to hal_rng_handle_t structure.
-
p_user_data – pointer to the user data
-
-
const
void
*
HAL_RNG_GetUserData
(
const
hal_rng_handle_t
*
hrng
)
-
Retrieve the user data from the RNG handle.
- Parameters :
-
hrng – Pointer to RNG handle
- Return values :
-
Pointer – to the user data
-
- group RNG_Exported_Functions_Group6
-
This subsection provides a set of functions allowing to Set and Get user data :
-
HAL_RNG_SetUserData() store user data pointer into the handle.
-
HAL_RNG_GetUserData() retrieve user data pointer from the handle.
Functions
-
void
HAL_RNG_SetUserData
(
hal_rng_handle_t
*
hrng
,
const
void
*
p_user_data
)
-
Store the user data into the RNG handle.
- Parameters :
-
-
hrng – pointer to hal_rng_handle_t structure.
-
p_user_data – pointer to the user data
-
-
const
void
*
HAL_RNG_GetUserData
(
const
hal_rng_handle_t
*
hrng
)
-
Retrieve the user data from the RNG handle.
- Parameters :
-
hrng – Pointer to RNG handle
- Return values :
-
Pointer – to the user data
-
Status functions ¶
- group RNG_Exported_Functions_Group7
-
This subsection provides a set of functions to retrieve the state and the error codes
-
HAL_RNG_GetState() retrieve the global state of the current RNG peripheral.
-
HAL_RNG_GetLastErrorCodes() retrieve the last error code of the RNG peripheral.
Functions
-
hal_rng_state_t
HAL_RNG_GetState
(
const
hal_rng_handle_t
*
hrng
)
¶
-
Return the RNG state.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
- Return values :
-
hal_rng_state_t – RNG global state.
-
uint32_t
HAL_RNG_GetLastErrorCodes
(
const
hal_rng_handle_t
*
hrng
)
¶
-
Return the RNG handle error code.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
- Return values :
-
uint32_t – RNG last error codes.
-
- group RNG_Exported_Functions_Group7
-
This subsection provides a set of functions to retrieve the state and the error codes
-
HAL_RNG_GetState() retrieve the global state of the current RNG peripheral.
-
HAL_RNG_GetLastErrorCodes() retrieve the last error code of the RNG peripheral.
Functions
-
hal_rng_state_t
HAL_RNG_GetState
(
const
hal_rng_handle_t
*
hrng
)
-
Return the RNG state.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
- Return values :
-
hal_rng_state_t – RNG global state.
-
uint32_t
HAL_RNG_GetLastErrorCodes
(
const
hal_rng_handle_t
*
hrng
)
-
Return the RNG handle error code.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
- Return values :
-
uint32_t – RNG last error codes.
-
- group RNG_Exported_Functions_Group7
-
This subsection provides a set of functions to retrieve the state and the error codes
-
HAL_RNG_GetState() retrieve the global state of the current RNG peripheral.
-
HAL_RNG_GetLastErrorCodes() retrieve the last error code of the RNG peripheral.
Functions
-
hal_rng_state_t
HAL_RNG_GetState
(
const
hal_rng_handle_t
*
hrng
)
-
Return the RNG state.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
- Return values :
-
hal_rng_state_t – RNG global state.
-
uint32_t
HAL_RNG_GetLastErrorCodes
(
const
hal_rng_handle_t
*
hrng
)
-
Return the RNG handle error code.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
- Return values :
-
uint32_t – RNG last error codes.
-
Lock configuration functions ¶
- group RNG_Exported_Functions_Group8
-
This subsection provides a set of functions to lock RNG configuration
-
HAL_RNG_LockConfig() lock the RNG configuration.
-
HAL_RNG_IsConfigLocked() check if the RNG peripheral configuration is locked or not.
Functions
-
hal_status_t
HAL_RNG_LockConfig
(
hal_rng_handle_t
*
hrng
)
¶
-
Lock the current RNG configuration.
Warning
This function allows to lock RNG peripheral configuration. Once locked, a system reset or RNG peripheral reset through RCC has to be performed prior any further configuration update.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
- Return values :
-
-
HAL_OK – configuration locked successfully.
-
HAL_INVALID_PARAM – invalid parameter.
-
-
hal_rng_lock_config_status_t
HAL_RNG_IsConfigLocked
(
const
hal_rng_handle_t
*
hrng
)
¶
-
Check if RNG Config Lock is enabled.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
- Return values :
-
hal_rng_lock_config_status_t – RNG lock config state.
-
- group RNG_Exported_Functions_Group8
-
This subsection provides a set of functions to lock RNG configuration
-
HAL_RNG_LockConfig() lock the RNG configuration.
-
HAL_RNG_IsConfigLocked() check if the RNG peripheral configuration is locked or not.
Functions
-
hal_status_t
HAL_RNG_LockConfig
(
hal_rng_handle_t
*
hrng
)
-
Lock the current RNG configuration.
Warning
This function allows to lock RNG peripheral configuration. Once locked, a system reset or RNG peripheral reset through RCC has to be performed prior any further configuration update.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
- Return values :
-
-
HAL_OK – configuration locked successfully.
-
HAL_INVALID_PARAM – invalid parameter.
-
-
hal_rng_lock_config_status_t
HAL_RNG_IsConfigLocked
(
const
hal_rng_handle_t
*
hrng
)
-
Check if RNG Config Lock is enabled.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
- Return values :
-
hal_rng_lock_config_status_t – RNG lock config state.
-
- group RNG_Exported_Functions_Group8
-
This subsection provides a set of functions to lock RNG configuration
-
HAL_RNG_LockConfig() lock the RNG configuration.
-
HAL_RNG_IsConfigLocked() check if the RNG peripheral configuration is locked or not.
Functions
-
hal_status_t
HAL_RNG_LockConfig
(
hal_rng_handle_t
*
hrng
)
-
Lock the current RNG configuration.
Warning
This function allows to lock RNG peripheral configuration. Once locked, a system reset or RNG peripheral reset through RCC has to be performed prior any further configuration update.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
- Return values :
-
-
HAL_OK – configuration locked successfully.
-
HAL_INVALID_PARAM – invalid parameter.
-
-
hal_rng_lock_config_status_t
HAL_RNG_IsConfigLocked
(
const
hal_rng_handle_t
*
hrng
)
-
Check if RNG Config Lock is enabled.
- Parameters :
-
hrng – pointer to hal_rng_handle_t structure.
- Return values :
-
hal_rng_lock_config_status_t – RNG lock config state.
-