Kinetis SDK v.1.3 API Reference Manual  Rev. 0
Freescale Semiconductor, Inc.
 All Data Structures 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 maximum CPU clock cycles that the RNGA module uses to get 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,
  kStatus_RNGA_OSAError = 4U
}
 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 random data from the RNGA. More...
 
rnga_status_t RNGA_HAL_GetRandomData (RNG_Type *base, uint32_t *data)
 Gets 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.

kStatus_RNGA_OSAError 

Failure of OS abstraction layer.

Function Documentation

static void RNGA_HAL_Init ( RNG_Type *  base)
inlinestatic

This function initializes the RNGA to a default state.

Parameters
baseRNGA base address
static void RNGA_HAL_Enable ( RNG_Type *  base)
inlinestatic

This function enables the RNGA random data generation and loading.

Parameters
baseRNGA base address
static void RNGA_HAL_Disable ( RNG_Type *  base)
inlinestatic

This function disables the RNGA module.

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

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

Parameters
baseRNGA base address
enable0 means 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
baseRNGA base address
enable0 means 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
baseRNGA base address
enable0 means 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
baseRNGA base address
modekRNGAModeNormal means 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
baseRNGA base 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
baseRNGA base 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
baseRNGA base 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
baseRNGA base 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
baseRNGA base 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
baseRNGA base address
Returns
0 means no security violation, 1 means security violation
static uint32_t RNGA_HAL_ReadRandomData ( RNG_Type *  base)
inlinestatic

This function gets random data from the RNGA.

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

This function gets random data from RNGA.

Parameters
baseRNGA base address
datapointer address 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 pseudo-random algorithm.

Parameters
baseRNGA base address
dataexternal entropy value