Kinetis SDK v.1.2 API Reference Manual  Rev. 0
Freescale Semiconductor, Inc.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages

Overview

This section describes the programming interface of the RNGA HAL driver.

Macros

#define MAX_COUNT   4096
 the max cpu clock cycles rnga module used to get a new random data
 

Enumerations

enum  rnga_mode_t {
  kRNGAModeNormal = 0U,
  kRNGAModeSleep = 1U
}
 RNGA working mode. More...
 
enum  rnga_output_reg_level_t {
  kRNGAOutputRegLevelNowords = 0U,
  kRNGAOutputRegLevelOneword = 1U
}
 Defines the value of output register level. More...
 
enum  rnga_status_t {
  kStatus_RNGA_Success = 0U,
  kStatus_RNGA_InvalidArgument = 1U,
  kStatus_RNGA_Underflow = 2U,
  kStatus_RNGA_Timeout = 3U
}
 Status structure for RNGA. More...
 

RNGA HAL.

static void RNGA_HAL_Init (RNG_Type *base)
 Initializes the RNGA module. More...
 
static void RNGA_HAL_Enable (RNG_Type *base)
 Enables the RNGA module. More...
 
static void RNGA_HAL_Disable (RNG_Type *base)
 Disables the RNGA module. More...
 
static void RNGA_HAL_SetHighAssuranceCmd (RNG_Type *base, bool enable)
 Sets the RNGA high assurance. More...
 
static void RNGA_HAL_SetIntMaskCmd (RNG_Type *base, bool enable)
 Sets the RNGA interrupt mask. More...
 
static void RNGA_HAL_ClearIntFlag (RNG_Type *base, bool enable)
 Clears the RNGA interrupt. More...
 
static void RNGA_HAL_SetWorkModeCmd (RNG_Type *base, rnga_mode_t mode)
 Sets the RNGA in sleep mode or normal mode. More...
 
static uint8_t RNGA_HAL_GetOutputRegSize (RNG_Type *base)
 Gets the output register size. More...
 
static rnga_output_reg_level_t RNGA_HAL_GetOutputRegLevel (RNG_Type *base)
 Gets the output register level. More...
 
static rnga_mode_t RNGA_HAL_GetWorkMode (RNG_Type *base)
 Gets the RNGA working mode. More...
 
static bool RNGA_HAL_GetErrorIntCmd (RNG_Type *base)
 Gets the RNGA status whether an error interrupt has occurred. More...
 
static bool RNGA_HAL_GetOutputRegUnderflowCmd (RNG_Type *base)
 Gets the RNGA status whether an output register underflow has occurred. More...
 
static bool RNGA_HAL_GetLastReadStatusCmd (RNG_Type *base)
 Gets the most recent RNGA read status. More...
 
static bool RNGA_HAL_GetSecurityViolationCmd (RNG_Type *base)
 Gets the RNGA status whether a security violation has occurred. More...
 
static uint32_t RNGA_HAL_ReadRandomData (RNG_Type *base)
 Gets a random data from the RNGA. More...
 
rnga_status_t RNGA_HAL_GetRandomData (RNG_Type *base, uint32_t *data)
 Get random data. More...
 
static void RNGA_HAL_WriteSeed (RNG_Type *base, uint32_t data)
 Inputs an entropy value used to seed the RNGA. More...
 

Enumeration Type Documentation

Enumerator
kRNGAModeNormal 

Normal Mode.

kRNGAModeSleep 

Sleep Mode.

Enumerator
kRNGAOutputRegLevelNowords 

output register no words.

kRNGAOutputRegLevelOneword 

output register one word.

This structure holds the return code of RNGA module.

Enumerator
kStatus_RNGA_Success 

Success.

kStatus_RNGA_InvalidArgument 

Invalid argument.

kStatus_RNGA_Underflow 

Underflow.

kStatus_RNGA_Timeout 

Timeout.

Function Documentation

static void RNGA_HAL_Init ( RNG_Type *  base)
inlinestatic

This function initializes the RNGA to a default state.

Parameters
base,RNGAbase address
static void RNGA_HAL_Enable ( RNG_Type *  base)
inlinestatic

This function enables the RNGA random data generation and loading.

Parameters
base,RNGAbase address
static void RNGA_HAL_Disable ( RNG_Type *  base)
inlinestatic

This function disables the RNGA module.

Parameters
base,RNGAbase address
static void RNGA_HAL_SetHighAssuranceCmd ( RNG_Type *  base,
bool  enable 
)
inlinestatic

This function sets the RNGA high assurance(notification of security violations.

Parameters
base,RNGAbase address
enable,0means notification of security violations disabled. 1 means notification of security violations enabled.
static void RNGA_HAL_SetIntMaskCmd ( RNG_Type *  base,
bool  enable 
)
inlinestatic

This function sets the RNGA error interrupt mask.

Parameters
base,RNGAbase address
enable,0means unmask RNGA interrupt. 1 means mask RNGA interrupt.
static void RNGA_HAL_ClearIntFlag ( RNG_Type *  base,
bool  enable 
)
inlinestatic

This function clears the RNGA interrupt.

Parameters
base,RNGAbase address
enable,0means do not clear the interrupt. 1 means clear the interrupt.
static void RNGA_HAL_SetWorkModeCmd ( RNG_Type *  base,
rnga_mode_t  mode 
)
inlinestatic

This function specifies whether the RNGA is in sleep mode or normal mode.

Parameters
base,RNGAbase address
mode,kRNGAModeNormalmeans set RNGA in normal mode. kRNGAModeSleep means set RNGA in sleep mode.
static uint8_t RNGA_HAL_GetOutputRegSize ( RNG_Type *  base)
inlinestatic

This function gets the size of the output register as 32-bit random data words it can hold.

Parameters
base,RNGAbase address
Returns
1 means one word(this value is fixed).
static rnga_output_reg_level_t RNGA_HAL_GetOutputRegLevel ( RNG_Type *  base)
inlinestatic

This function gets the number of random-data words that are in OR [RANDOUT], which indicates if OR is valid.

Parameters
base,RNGAbase address
Returns
0 means no words(empty), 1 means one word(valid).
static rnga_mode_t RNGA_HAL_GetWorkMode ( RNG_Type *  base)
inlinestatic

This function checks whether the RNGA works in sleep mode or normal mode.

Parameters
base,RNGAbase address
Returns
Kmode_RNGA_Normal means in normal mode Kmode_RNGA_Sleep means in sleep mode
static bool RNGA_HAL_GetErrorIntCmd ( RNG_Type *  base)
inlinestatic

This function gets the RNGA status whether an OR underflow condition has occurred since the error interrupt was last cleared or the RNGA was reset.

Parameters
base,RNGAbase address
Returns
0 means no underflow, 1 means underflow
static bool RNGA_HAL_GetOutputRegUnderflowCmd ( RNG_Type *  base)
inlinestatic

This function gets the RNGA status whether an OR underflow condition has occurred since the register (SR) was last read or the RNGA was reset.

Parameters
base,RNGAbase address
Returns
0 means no underflow, 1 means underflow
static bool RNGA_HAL_GetLastReadStatusCmd ( RNG_Type *  base)
inlinestatic

This function gets the RNGA status whether the most recent read of OR[RANDOUT] causes an OR underflow condition.

Parameters
base,RNGAbase address
Returns
0 means no underflow, 1 means underflow
static bool RNGA_HAL_GetSecurityViolationCmd ( RNG_Type *  base)
inlinestatic

This function gets the RNGA status whether a security violation has occurred when high assurance is enabled.

Parameters
base,RNGAbase address
Returns
0 means no security violation, 1 means security violation
static uint32_t RNGA_HAL_ReadRandomData ( RNG_Type *  base)
inlinestatic

This function gets a random data from RNGA.

Parameters
base,RNGAbase address
Returns
random data obtained
rnga_status_t RNGA_HAL_GetRandomData ( RNG_Type *  base,
uint32_t *  data 
)

This function is used to get a random data from RNGA

Parameters
base,RNGAbase address
data,pointeraddress used to store random data
Returns
one random data
static void RNGA_HAL_WriteSeed ( RNG_Type *  base,
uint32_t  data 
)
inlinestatic

This function specifies an entropy value that RNGA uses with its ring oscillations to seed its pseudorandom algorithm.

Parameters
base,RNGAbase address
data,externalentropy value