MG32F157 Standard Peripherals Firmware Library
Modules | Functions

TRNG driver modules. More...

Modules

 TRNG_Exported_Constants
 
 TRNG_Private_Defines
 
 TRNG_Private_Functions
 

Functions

void TRNG_DeInit (void)
 Deinitializes the TRNG peripheral registers to their default reset values. More...
 
void TRNG_Cmd (FunctionalState NewState)
 Enables or disables the TRNG peripheral generate true random number. More...
 
void TRNG_Clock_CheckCmd (FunctionalState NewState)
 Enables or disables the TRNG clock error detection. More...
 
void TRNG_ClearFlag (uint8_t TRNG_FLAG)
 Clears the TRNG's pending flags. More...
 
void TRNG_ClearITPendingBit (uint16_t TRNG_IT)
 Clears the TRNG's pending interrupt pending bits. More...
 
uint32_t TRNG_GetData (void)
 Returns true random number value. More...
 
FlagStatus TRNG_GetFlagStatus (uint8_t TRNG_FLAG)
 Checks whether the specified TRNG flag is set or not. More...
 
ITStatus TRNG_GetITStatus (uint16_t TRNG_IT)
 Checks whether the specified TRNG interrupt has occurred or not. More...
 
void TRNG_ITCmd (FunctionalState NewState)
 Enable or Disable the TRNG interrupt. More...
 

Detailed Description

TRNG driver modules.

Function Documentation

◆ TRNG_ClearFlag()

void TRNG_ClearFlag ( uint8_t  TRNG_FLAG)

Clears the TRNG's pending flags.

Parameters
TRNG_FLAGspecifies the flags to clear. This parameter can be any combination of the following values:
  • TRNG_FLAG_SECS: Seed error current status flag
  • TRNG_FLAG_CECS: Clock error current status flag
Note
Data ready bit(DRDY) in SR register only can be read but written, so you can not clear the TRNG_FLAG_DRDY.
Returns
None

◆ TRNG_ClearITPendingBit()

void TRNG_ClearITPendingBit ( uint16_t  TRNG_IT)

Clears the TRNG's pending interrupt pending bits.

Parameters
TRNG_ITspecifies the interrupt pending bit to clear. This parameter can be any combination of the following values:
  • TRNG_IT_SEIS: Seed error interrupt
  • TRNG_IT_CEIS: Clock error interrupt
Note
Data ready bit(DRDY) in SR register only can be read but writen, so you can not clear TRNG_IT_DRDY.
Returns
None

◆ TRNG_Clock_CheckCmd()

void TRNG_Clock_CheckCmd ( FunctionalState  NewState)

Enables or disables the TRNG clock error detection.

Parameters
NewStatenew state of the TRNG clock error detection. This parameter can be: ENABLE or DISABLE.
Note
When enables the clock error detection, TRNG peripheral should be disabled, and then TRNG peripheral can not generate true random number.
Returns
None.

◆ TRNG_Cmd()

void TRNG_Cmd ( FunctionalState  NewState)

Enables or disables the TRNG peripheral generate true random number.

Parameters
NewStatenew state of the TRNG. This parameter can be: ENABLE or DISABLE.
Note
When enables the TRNG peripheral, clock error detection should be disabled.
Returns
None

◆ TRNG_DeInit()

void TRNG_DeInit ( void  )

Deinitializes the TRNG peripheral registers to their default reset values.

Parameters
None
Returns
None

◆ TRNG_GetData()

uint32_t TRNG_GetData ( void  )

Returns true random number value.

Parameters
None
Returns
32-bit TRNG

◆ TRNG_GetFlagStatus()

FlagStatus TRNG_GetFlagStatus ( uint8_t  TRNG_FLAG)

Checks whether the specified TRNG flag is set or not.

Parameters
TRNG_FLAGspecifies the flag to check. This parameter can be one of the following values:
  • TRNG_FLAG_SECS: Seed error current status flag
  • TRNG_FLAG_CECS: Clock error current status flag
  • TRNG_FLAG_DRDY: TRNG data ready flag
Returns
The new state of TRNG_FLAG (SET or RESET).

◆ TRNG_GetITStatus()

ITStatus TRNG_GetITStatus ( uint16_t  TRNG_IT)

Checks whether the specified TRNG interrupt has occurred or not.

Parameters
TRNG_ITspecifies the interrupt source to check. This parameter can be one of the following values:
  • TRNG_IT_SEIS: Seed error interrupt
  • TRNG_IT_CEIS: Clock error interrupt
  • TRNG_IT_DRDY: TRNG data ready interrupt
Returns
The new state of TRNG_IT (SET or RESET).

◆ TRNG_ITCmd()

void TRNG_ITCmd ( FunctionalState  NewState)

Enable or Disable the TRNG interrupt.

Parameters
NewStatenew state of the TRNG interrupt. This parameter can be: ENABLE or DISABLE.
Returns
None