RNG driver modules.
More...
RNG driver modules.
void RNG_ClearFlag |
( |
uint8_t |
RNG_FLAG | ) |
|
Clears the RNG flags.
- Parameters
-
RNG_FLAG | specifies the flag to clear. This parameter can be any combination of the following values:
- RNG_FLAG_CECS: Clock Error Current flag.
- RNG_FLAG_SECS: Seed Error Current flag.
|
- Note
- RNG_FLAG_DRDY can not be cleared by RNG_ClearFlag() function. This flag is cleared only by reading the Random number data (using RNG_GetRandomNumber() function).
- Return values
-
Definition at line 326 of file stm32f4xx_rng.c.
void RNG_ClearITPendingBit |
( |
uint8_t |
RNG_IT | ) |
|
Clears the RNG interrupt pending bit(s).
- Parameters
-
RNG_IT | specifies the RNG interrupt pending bit(s) to clear. This parameter can be any combination of the following values:
- RNG_IT_CEI: Clock Error Interrupt.
- RNG_IT_SEI: Seed Error Interrupt.
|
- Return values
-
Definition at line 372 of file stm32f4xx_rng.c.
Enables or disables the RNG peripheral.
- Parameters
-
NewState | new state of the RNG peripheral. This parameter can be: ENABLE or DISABLE. |
- Return values
-
Definition at line 114 of file stm32f4xx_rng.c.
De-initializes the RNG peripheral registers to their default reset values.
- Parameters
-
- Return values
-
Definition at line 99 of file stm32f4xx_rng.c.
Checks whether the specified RNG flag is set or not.
- Parameters
-
RNG_FLAG | specifies the RNG flag to check. This parameter can be one of the following values:
- RNG_FLAG_DRDY: Data Ready flag.
- RNG_FLAG_CECS: Clock Error Current flag.
- RNG_FLAG_SECS: Seed Error Current flag.
|
- Return values
-
The | new state of RNG_FLAG (SET or RESET). |
Definition at line 293 of file stm32f4xx_rng.c.
ITStatus RNG_GetITStatus |
( |
uint8_t |
RNG_IT | ) |
|
Checks whether the specified RNG interrupt has occurred or not.
- Parameters
-
RNG_IT | specifies the RNG interrupt source to check. This parameter can be one of the following values:
- RNG_IT_CEI: Clock Error Interrupt.
- RNG_IT_SEI: Seed Error Interrupt.
|
- Return values
-
The | new state of RNG_IT (SET or RESET). |
Definition at line 342 of file stm32f4xx_rng.c.
uint32_t RNG_GetRandomNumber |
( |
void |
| ) |
|
Returns a 32-bit random number.
- Note
- Before to call this function you have to wait till DRDY (data ready) flag is set, using RNG_GetFlagStatus(RNG_FLAG_DRDY) function.
-
Each time the the Random number data is read (using RNG_GetRandomNumber() function), the RNG_FLAG_DRDY flag is automatically cleared.
-
In the case of a seed error, the generation of random numbers is interrupted for as long as the SECS bit is '1'. If a number is available in the RNG_DR register, it must not be used because it may not have enough entropy. In this case, it is recommended to clear the SEIS bit(using RNG_ClearFlag(RNG_FLAG_SECS) function), then disable and enable the RNG peripheral (using RNG_Cmd() function) to reinitialize and restart the RNG.
-
In the case of a clock error, the RNG is no more able to generate random numbers because the PLL48CLK clock is not correct. User have to check that the clock controller is correctly configured to provide the RNG clock and clear the CEIS bit (using RNG_ClearFlag(RNG_FLAG_CECS) function) . The clock error has no impact on the previously generated random numbers, and the RNG_DR register contents can be used.
- Parameters
-
- Return values
-
Definition at line 176 of file stm32f4xx_rng.c.
Enables or disables the RNG interrupt.
- Note
- The RNG provides 3 interrupt sources,
- Computed data is ready event (DRDY), and
- Seed error Interrupt (SEI) and
- Clock error Interrupt (CEI), all these interrupts sources are enabled by setting the IE bit in CR register. However, each interrupt have its specific status bit (see RNG_GetITStatus() function) and clear bit except the DRDY event (see RNG_ClearITPendingBit() function).
- Parameters
-
NewState | new state of the RNG interrupt. This parameter can be: ENABLE or DISABLE. |
- Return values
-
Definition at line 267 of file stm32f4xx_rng.c.