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 TRNG HAL driver.

Data Structures

struct  trng_statistical_check_limit_t
 Data structure for definition of statistical check limits. More...
 

Enumerations

enum  trng_work_mode_t {
  kTRNGWorkModeRun = 0U,
  kTRNGWorkModeProgram = 1U
}
 TRNG work mode. More...
 
enum  trng_sample_mode_t {
  kTRNGSampleModeVonNeumann = 0U,
  kTRNGSampleModeRaw = 1U,
  kTRNGSampleModeVonNeumannRaw = 2U
}
 TRNG sample mode. More...
 
enum  trng_clock_mode_t {
  kTRNGClockModeRingOscillator = 0U,
  kTRNGClockModeSystem = 1U
}
 TRNG clock mode. More...
 
enum  trng_ring_osc_div_t {
  kTRNGRingOscDiv0 = 0U,
  kTRNGRingOscDiv2 = 1U,
  kTRNGRingOscDiv4 = 2U,
  kTRNGRingOscDiv8 = 3U
}
 TRNG ring oscillator divide. More...
 
enum  trng_statistical_check_t {
  kTRNGStatisticalCheckMonobit = 1U,
  kTRNGStatisticalCheckRunBit1,
  kTRNGStatisticalCheckRunBit2,
  kTRNGStatisticalCheckRunBit3,
  kTRNGStatisticalCheckRunBit4,
  kTRNGStatisticalCheckRunBit5,
  kTRNGStatisticalCheckRunBit6Plus,
  kTRNGStatisticalCheckPoker,
  kTRNGStatisticalCheckFrequencyCount
}
 TRNG statistical check type. More...
 
enum  trng_interrupt_t {
  kTRNGInterruptFrequencyCountFail = 0x4U,
  kTRNGInterruptFrequencyEntropyValid = 0x2U,
  kTRNGInterruptFrequencyHWError = 0x1U,
  kTRNGInterruptAll = 0x7U
}
 Defines interrupt sources for TRNG. More...
 
enum  trng_status_t {
  kStatus_TRNG_Success = 0x000000U,
  kStatus_TRNG_InvalidArgument = 0x000001U,
  kStatus_TRNG_OSAError = 0x000002U,
  kStatus_TRNG_Error = 0x000004U,
  kStatus_TRNG_TestFailRunBit1Sampling0 = 0x000014U,
  kStatus_TRNG_TestFailRunBit1Sampling1 = 0x000024U,
  kStatus_TRNG_TestFailRunBit2Sampling0 = 0x000044U,
  kStatus_TRNG_TestFailRunBit2Sampling1 = 0x000084U,
  kStatus_TRNG_TestFailRunBit3Sampling0 = 0x000104U,
  kStatus_TRNG_TestFailRunBit3Sampling1 = 0x000204U,
  kStatus_TRNG_TestFailRunBit4Sampling0 = 0x000404U,
  kStatus_TRNG_TestFailRunBit4Sampling1 = 0x000804U,
  kStatus_TRNG_TestFailRunBit5Sampling0 = 0x001004U,
  kStatus_TRNG_TestFailRunBit5Sampling1 = 0x002004U,
  kStatus_TRNG_TestFailRunBit6PlusSampling0 = 0x004004U,
  kStatus_TRNG_TestFailRunBit6PlusSampling1 = 0x008004U,
  kStatus_TRNG_TestFailSparseBit = 0x010004U,
  kStatus_TRNG_TestFailLongRun = 0x020004U,
  kStatus_TRNG_TestFailPoker = 0x040004U,
  kStatus_TRNG_TestFailMonoBit = 0x080004U,
  kStatus_TRNG_TestFailFrequencyCount = 0x100004U
}
 Defines status return codes for TRNG function calls. More...
 

TRNG HAL.

void TRNG_HAL_Init (TRNG_Type *base)
 Initializes the TRNG module. More...
 
void TRNG_HAL_Enable (TRNG_Type *base)
 Enables the TRNG module. More...
 
static void TRNG_HAL_SetWorkingMode (TRNG_Type *base, trng_work_mode_t mode)
 Sets the TRNG to Program Mode or Run mode. More...
 
static void TRNG_HAL_Disable (TRNG_Type *base)
 Disables the TRNG module. More...
 
static bool TRNG_HAL_GetEntropyValidCmd (TRNG_Type *base)
 Gets the TRNG status whether the generated entropy is valid. More...
 
static bool TRNG_HAL_GetErrorCmd (TRNG_Type *base)
 Gets the TRNG status whether the error occurred. More...
 
static void TRNG_HAL_ClearError (TRNG_Type *base)
 Clears the TRNG error flag. More...
 
static bool TRNG_HAL_GetOKToStopCmd (TRNG_Type *base)
 Gets the TRNG status whether the TRNG ring oscillator is not running. More...
 
static void TRNG_HAL_EnableLock (TRNG_Type *base)
 Disables the programmability of TRNG registers. More...
 
static bool TRNG_HAL_GetLockCmd (TRNG_Type *base)
 Gets the status of the possibility to program the TRNG registers. More...
 
static void TRNG_HAL_SetSampleMode (TRNG_Type *base, trng_sample_mode_t mode)
 Sets the sample mode of the TRNG ring oscillator. More...
 
static trng_sample_mode_t TRNG_HAL_GetSampleMode (TRNG_Type *base)
 Gets the sample mode of the TRNG ring oscillator. More...
 
static void TRNG_HAL_SetClockMode (TRNG_Type *base, trng_clock_mode_t mode)
 Sets the clock mode used to operate TRNG. More...
 
static trng_clock_mode_t TRNG_HAL_GetClockMode (TRNG_Type *base)
 Gets the clock mode used to operate the TRNG. More...
 
static void TRNG_HAL_SetRingOscDiv (TRNG_Type *base, trng_ring_osc_div_t osc_div)
 Sets the ring oscillator divide used by the TRNG. More...
 
static trng_ring_osc_div_t TRNG_HAL_GetRingOscDiv (TRNG_Type *base)
 Gets the ring oscillator divide used by the TRNG. More...
 
static void TRNG_HAL_SetSampleSize (TRNG_Type *base, uint16_t sample_size)
 Sets the TRNG sample size. More...
 
static uint16_t TRNG_HAL_GetSampleSize (TRNG_Type *base)
 Gets the TRNG sample size. More...
 
static void TRNG_HAL_SetEntropyDelay (TRNG_Type *base, uint16_t ent_delay)
 Sets the TRNG entropy delay. More...
 
static uint16_t TRNG_HAL_GetEntropyDelay (TRNG_Type *base)
 Gets the TRNG entropy delay. More...
 
static void TRNG_HAL_SetSparseBitLimit (TRNG_Type *base, uint16_t sparse_bit_limit)
 Sets the TRNG sparse bit limit. More...
 
static uint16_t TRNG_HAL_GetSparseBitLimit (TRNG_Type *base)
 Gets the TRNG sparse bit limit. More...
 
trng_status_t TRNG_HAL_SetRetryCount (TRNG_Type *base, uint8_t retry_count)
 Sets the TRNG retry count. More...
 
static uint8_t TRNG_HAL_GetRetryCount (TRNG_Type *base)
 Gets the TRNG retry count. More...
 
static void TRNG_HAL_SetLongRunMaxLimit (TRNG_Type *base, uint8_t long_run_max_limit)
 Sets the TRNG long run maximum limit. More...
 
static uint8_t TRNG_HAL_GetLongRunMaxLimit (TRNG_Type *base)
 Gets the TRNG long run maximum limit. More...
 
void TRNG_HAL_SetIntMode (TRNG_Type *base, trng_interrupt_t interrupt, bool enable)
 Enables or disables the related TRNG interrupt. More...
 
static bool TRNG_HAL_GetIntMode (TRNG_Type *base, trng_interrupt_t interrupt)
 Gets whether the TRNG interrupt is enabled. More...
 
static bool TRNG_HAL_GetIntStatusFlag (TRNG_Type *base, trng_interrupt_t interrupt)
 Gets the TRNG interrupt status. More...
 
static void TRNG_HAL_ClearIntStatusFlag (TRNG_Type *base, trng_interrupt_t interrupt)
 Clears the interrupt status of the TRNG module. More...
 
trng_status_t TRNG_HAL_SetStatisticalCheckLimit (TRNG_Type *base, trng_statistical_check_t statistical_check, const trng_statistical_check_limit_t *limit)
 Sets statistical check limits. More...
 
void TRNG_HAL_GetStatisticalCheckLimit (TRNG_Type *base, trng_statistical_check_t statistical_check, trng_statistical_check_limit_t *limit)
 Gets statistical check limits. More...
 
uint32_t TRNG_HAL_ReadEntropy (TRNG_Type *base, uint32_t index)
 Gets a entry data from the TRNG. More...
 
trng_status_t TRNG_HAL_GetStatus (TRNG_Type *base)
 Gets the TRNG status. More...
 

Data Structure Documentation

struct trng_statistical_check_limit_t

Data Fields

uint32_t maximum
 Maximum limit. More...
 
uint32_t minimum
 Minimum limit. More...
 

Field Documentation

uint32_t trng_statistical_check_limit_t::maximum
uint32_t trng_statistical_check_limit_t::minimum

Enumeration Type Documentation

Enumerator
kTRNGWorkModeRun 

Run Mode.

kTRNGWorkModeProgram 

Program Mode.

Enumerator
kTRNGSampleModeVonNeumann 

Use Von Neumann data into both Entropy shifter and Statistical Checker.

kTRNGSampleModeRaw 

Use raw data into both Entropy shifter and Statistical Checker.

kTRNGSampleModeVonNeumannRaw 

Use Von Neumann data into Entropy shifter.

Use raw data into Statistical Checker.

Enumerator
kTRNGClockModeRingOscillator 

Ring oscillator is used to operate the TRNG (default).

kTRNGClockModeSystem 

System clock is used to operate the TRNG.

This is for test use only, and indeterminate results may occur.

Enumerator
kTRNGRingOscDiv0 

Ring oscillator with no divide (default).

kTRNGRingOscDiv2 

Ring oscillator divided-by-2.

kTRNGRingOscDiv4 

Ring oscillator divided-by-4.

kTRNGRingOscDiv8 

Ring oscillator divided-by-8.

Enumerator
kTRNGStatisticalCheckMonobit 

Statistical check of number of ones/zero detected during entropy generation.

kTRNGStatisticalCheckRunBit1 

Statistical check of number of runs of length 1 detected during entropy generation.

kTRNGStatisticalCheckRunBit2 

Statistical check of number of runs of length 2 detected during entropy generation.

kTRNGStatisticalCheckRunBit3 

Statistical check of number of runs of length 3 detected during entropy generation.

kTRNGStatisticalCheckRunBit4 

Statistical check of number of runs of length 4 detected during entropy generation.

kTRNGStatisticalCheckRunBit5 

Statistical check of number of runs of length 5 detected during entropy generation.

kTRNGStatisticalCheckRunBit6Plus 

Statistical check of number of runs of length 6 or more detected during entropy generation.

kTRNGStatisticalCheckPoker 

Statistical check of "Poker Test".

kTRNGStatisticalCheckFrequencyCount 

Statistical check of entropy sample frequency count.

Enumerator
kTRNGInterruptFrequencyCountFail 

Frequency Count Fail.

kTRNGInterruptFrequencyEntropyValid 

Entropy Valid.

kTRNGInterruptFrequencyHWError 

Any HW error.

kTRNGInterruptAll 

All interrupts.

Enumerator
kStatus_TRNG_Success 

Success.

No error.

kStatus_TRNG_InvalidArgument 

Invalid argument.

kStatus_TRNG_OSAError 

OSA initialisation failed.

kStatus_TRNG_Error 

Any TRNG module error occurred.

kStatus_TRNG_TestFailRunBit1Sampling0 

The 1-Bit Run, Sampling 0s Test has failed.

kStatus_TRNG_TestFailRunBit1Sampling1 

The 1-Bit Run, Sampling 1s Test has failed.

kStatus_TRNG_TestFailRunBit2Sampling0 

The 2-Bit Run, Sampling 0s Test has failed.

kStatus_TRNG_TestFailRunBit2Sampling1 

The 2-Bit Run, Sampling 1s Test has failed.

kStatus_TRNG_TestFailRunBit3Sampling0 

The 3-Bit Run, Sampling 0s Test has failed.

kStatus_TRNG_TestFailRunBit3Sampling1 

The 3-Bit Run, Sampling 1s Test has failed.

kStatus_TRNG_TestFailRunBit4Sampling0 

The 4-Bit Run, Sampling 0s Test has failed.

kStatus_TRNG_TestFailRunBit4Sampling1 

The 4-Bit Run, Sampling 1s Test has failed.

kStatus_TRNG_TestFailRunBit5Sampling0 

The 5-Bit Run, Sampling 0s Test has failed.

kStatus_TRNG_TestFailRunBit5Sampling1 

The 5-Bit Run, Sampling 1s Test has failed.

kStatus_TRNG_TestFailRunBit6PlusSampling0 

The 6 Plus Bit Run, Sampling 0s Test has failed.

kStatus_TRNG_TestFailRunBit6PlusSampling1 

The 6 Plus Bit Run, Sampling 1s Test has failed.

kStatus_TRNG_TestFailSparseBit 

The Sparse Bit Test has failed.

kStatus_TRNG_TestFailLongRun 

The Long Run Test has failed.

kStatus_TRNG_TestFailPoker 

The Poker Test has failed.

kStatus_TRNG_TestFailMonoBit 

The Mono Bit Test has failed.

kStatus_TRNG_TestFailFrequencyCount 

Frequency Count Fail.

The frequency counter has detected a failure. This may be due to improper programming of maximum and minimum limits for statistical check of entropy sample frequency count, or a hardware failure in the ring oscillator.

Function Documentation

void TRNG_HAL_Init ( TRNG_Type *  base)

This function initializes the TRNG to a default state.

Parameters
baseTRNG base address
void TRNG_HAL_Enable ( TRNG_Type *  base)

This function enables the TRNG random data generation and loading.

Parameters
baseTRNG base address
static void TRNG_HAL_SetWorkingMode ( TRNG_Type *  base,
trng_work_mode_t  mode 
)
inlinestatic

This function specifies whether the TRNG is in Program Mode or Run mode.

Parameters
baseTRNG base address
modekTRNGWorkModeRun means set TRNG in Run Mode. kTRNGWorkModeProgram means set TRNG in Program Mode (default after init).
static void TRNG_HAL_Disable ( TRNG_Type *  base)
inlinestatic

This function disables the TRNG module and stops generation of Entropy value.

Parameters
baseTRNG base address
static bool TRNG_HAL_GetEntropyValidCmd ( TRNG_Type *  base)
inlinestatic

This function gets the TRNG status whether an entropy is valid.

Parameters
baseTRNG base address
Returns
0 means Entropy is not valid, 1 means Entropy is valid
static bool TRNG_HAL_GetErrorCmd ( TRNG_Type *  base)
inlinestatic

This function gets the TRNG status whether an error is detected.

Parameters
baseTRNG base address
Returns
0 means no error, 1 means error is detected
static void TRNG_HAL_ClearError ( TRNG_Type *  base)
inlinestatic

This function clears the TRNG error flag.

Parameters
baseTRNG base address
static bool TRNG_HAL_GetOKToStopCmd ( TRNG_Type *  base)
inlinestatic

This function gets the TRNG status that indicates whether the TRNG ring oscillator is not running. Software should check this status before transitioning TRNG to low power mode (TRNG clock stopped). TRNG turns on the TRNG free-running ring oscillator whenever new entropy is being generated and turns off the ring oscillator when entropy generation is complete. If the TRNG clock is stopped while the TRNG ring oscillator is running, the oscillator continues running though the RNG clock. is stopped.

Parameters
baseTRNG base address
Returns
0 means TRNG ring oscillator is running, 1 means TRNG ring oscillator is not running
static void TRNG_HAL_EnableLock ( TRNG_Type *  base)
inlinestatic

This function disables the possibility to program TRNG registers regardless of the TRNG working mode. After that, any attempt to modify a TRNG register causes a hard fault. Only the asynchronous reset returns the possibility to write to the TRNG registers.

Parameters
baseTRNG base address
static bool TRNG_HAL_GetLockCmd ( TRNG_Type *  base)
inlinestatic

This function gets current status of possibility to program TRNG registers.

Parameters
baseTRNG base address
Returns
0 means that is enabled programmability of TRNG registers (default value). 1 means that is disabled programmability of TRNG registers in any mode.
static void TRNG_HAL_SetSampleMode ( TRNG_Type *  base,
trng_sample_mode_t  mode 
)
inlinestatic

This function specifies the method of sampling the ring oscillator while generating the entropy value.

Parameters
baseTRNG base address
modekTRNGSampleModeVonNeumann means use Von Neumann data into both Entropy shifter and Statistical Checker kTRNGSampleModeRaw means use raw data into both Entropy shifter and Statistical Checker (default value). kTRNGSampleModeVonNeumannRaw means use Von Neumann data into Entropy shifter. Use raw data into Statistical Checker.
static trng_sample_mode_t TRNG_HAL_GetSampleMode ( TRNG_Type *  base)
inlinestatic

This function gets the method of sampling the ring oscillator while generating the entropy value.

Parameters
baseTRNG base address
Returns
kTRNGSampleModeVonNeumann means Von Neumann data placed into both Entropy shifter and Statistical Checker, kTRNGSampleModeRaw means raw data placed into both Entropy shifter and Statistical Checker, kTRNGSampleModeVonNeumannRaw means Von Neumann data placed into Entropy shifter and raw data placed into Statistical Checker.
static void TRNG_HAL_SetClockMode ( TRNG_Type *  base,
trng_clock_mode_t  mode 
)
inlinestatic

This function specifies the clock mode used to operate TRNG. By default is used TRNG ring oscillator. Changing clock mode is for test use only, and indeterminate results may occur.

Parameters
baseTRNG base address
modekTRNGClockModeRingOscillator means use ring oscillator to operate the TRNG (default), kTRNGClockModeSystem means force system clock to operate the TRNG.
static trng_clock_mode_t TRNG_HAL_GetClockMode ( TRNG_Type *  base)
inlinestatic

This function gets the clock mode used to operate TRNG.

Parameters
baseTRNG base address
Returns
kTRNGClockModeRingOscillator means ring oscillator is used to operate the TRNG, kTRNGClockModeSystem means system clock is used to operate the TRNG.
static void TRNG_HAL_SetRingOscDiv ( TRNG_Type *  base,
trng_ring_osc_div_t  osc_div 
)
inlinestatic

This function determines the amount of dividing done to the ring oscillator before it is used by the TRNG.

Parameters
baseTRNG base address
osc_divkTRNGRingOscDiv0 means use ring oscillator with no divide (default), kTRNGRingOscDiv2 means use ring oscillator divided-by-2, kTRNGRingOscDiv4 means use ring oscillator divided-by-4, kTRNGRingOscDiv8 means use ring oscillator divided-by-8.
static trng_ring_osc_div_t TRNG_HAL_GetRingOscDiv ( TRNG_Type *  base)
inlinestatic

This function gets the amount of dividing done to the ring oscillator before it is used by the TRNG.

Parameters
baseTRNG base address
Returns
kTRNGRingOscDiv0 means ring oscillator with no divide is used, kTRNGRingOscDiv2 means ring oscillator divided-by-2 is used, kTRNGRingOscDiv4 means ring oscillator divided-by-4 is used, kTRNGRingOscDiv8 means ring oscillator divided-by-8 is used.
static void TRNG_HAL_SetSampleSize ( TRNG_Type *  base,
uint16_t  sample_size 
)
inlinestatic

This function sets the total number of Entropy samples that is taken during the entropy generation.

Parameters
baseTRNG base address
sample_sizeNumber of samples.
static uint16_t TRNG_HAL_GetSampleSize ( TRNG_Type *  base)
inlinestatic

This function gets the total number of entropy samples that are taken during the entropy generation.

Parameters
baseTRNG base address
Returns
Sample size. After initialization, it is reset to default 2500.
static void TRNG_HAL_SetEntropyDelay ( TRNG_Type *  base,
uint16_t  ent_delay 
)
inlinestatic

This function sets the length (in system clocks) of each entropy sample taken.

Parameters
baseTRNG base address
ent_delayEntropy delay.
static uint16_t TRNG_HAL_GetEntropyDelay ( TRNG_Type *  base)
inlinestatic

This function gets the length (in system clocks) of each entropy sample taken.

Parameters
baseTRNG base address
Returns
Entropy delay. After initialization, it is reset to default 3200.
static void TRNG_HAL_SetSparseBitLimit ( TRNG_Type *  base,
uint16_t  sparse_bit_limit 
)
inlinestatic

This function sets the Sparse Bit Limit which defines the maximum number of consecutive samples that may be discarded before an error is generated. This limit is used only for During Von Neumann sampling (enabled by TRNG_HAL_SetSampleMode()). Samples are discarded if two consecutive raw samples are both 0 or both 1. If this discarding occurs for a long period of time, it indicates that there is insufficient Entropy.

Parameters
baseTRNG base address
sparse_bit_limitSparse bit limit.
static uint16_t TRNG_HAL_GetSparseBitLimit ( TRNG_Type *  base)
inlinestatic

This function gets the Sparse Bit Limit which defines the maximum number of consecutive samples that may be discarded before an error is generated. This limit is used only for During Von Neumann sampling (enabled by TRNG_HAL_SetSampleMode()). Samples are discarded if two consecutive raw samples are both 0 or both 1. If this discarding occurs for a long period of time, it indicates that there is insufficient Entropy.

Parameters
baseTRNG base address
Returns
Sparse bit limit. After initialization, it is reset to default 63.
trng_status_t TRNG_HAL_SetRetryCount ( TRNG_Type *  base,
uint8_t  retry_count 
)

This function sets the retry counter which defines the number of times a statistical check may fails during the TRNG entropy generation before generating an error.

Parameters
baseTRNG base address
retry_countRetry count [1-15].
Returns
If successful, returns the kStatus_TRNG_Success. Otherwise, it returns kStatus_TRNG_InvalidArgument.
static uint8_t TRNG_HAL_GetRetryCount ( TRNG_Type *  base)
inlinestatic

This function gets the retry counter which defines the number of times a statistical check may fails during the TRNG entropy generation before generating an error.

Parameters
baseTRNG base address
Returns
Retry count. After initialization, it is reset to default 1.
static void TRNG_HAL_SetLongRunMaxLimit ( TRNG_Type *  base,
uint8_t  long_run_max_limit 
)
inlinestatic

This function sets the largest allowable number of consecutive samples of all 1, or all 0, that is allowed during the Entropy generation.

Parameters
baseTRNG base address
long_run_max_limitMaximum limit of consecutive samples of all 1, or all 0.
static uint8_t TRNG_HAL_GetLongRunMaxLimit ( TRNG_Type *  base)
inlinestatic

This function gets value of largest allowable number of consecutive samples of all 1, or all 0, that is allowed during the Entropy generation.

Parameters
baseTRNG base address
Returns
Maximum limit of consecutive samples of all 1, or all 0.
void TRNG_HAL_SetIntMode ( TRNG_Type *  base,
trng_interrupt_t  interrupt,
bool  enable 
)

This function enables or disables interrupts that are generated by the TRNG.

Parameters
baseTRNG base address
interruptThe interrupt sources defined by trng_interrupt_t.
enableThe interrupt enable switch.
static bool TRNG_HAL_GetIntMode ( TRNG_Type *  base,
trng_interrupt_t  interrupt 
)
inlinestatic

This function returns whether the TRNG interrupt is enabled or disabled.

Parameters
baseTRNG base address
interruptThe interrupt sources defined by trng_interrupt_t.
Returns
true, if interrupt enabled(unmasked). false, if interrupt disabled(masked).
static bool TRNG_HAL_GetIntStatusFlag ( TRNG_Type *  base,
trng_interrupt_t  interrupt 
)
inlinestatic

This function returns whether the TRNG interrupt is happened or not.

Parameters
baseTRNG base address
interruptThe interrupt sources defined by trng_interrupt_t.
Returns
true, if the interrupt event happened. false, if the interrupt event has not happened.
static void TRNG_HAL_ClearIntStatusFlag ( TRNG_Type *  base,
trng_interrupt_t  interrupt 
)
inlinestatic

This function clears the TRNG interrupt status.

Parameters
baseTRNG base address
interruptThe interrupt source to be cleared, defined by trng_interrupt_t.
trng_status_t TRNG_HAL_SetStatisticalCheckLimit ( TRNG_Type *  base,
trng_statistical_check_t  statistical_check,
const trng_statistical_check_limit_t limit 
)

This function is used to set minimum and maximum limits of a statistical check.

Parameters
baseTRNG base address
statistical_checktype of statistical check defined by trng_statistical_check_t
limitPointer to structure used to store maximum and minimum limits of statistic
Returns
If successful, returns the kStatus_TRNG_Success. Otherwise, it returns kStatus_TRNG_InvalidArgument.
void TRNG_HAL_GetStatisticalCheckLimit ( TRNG_Type *  base,
trng_statistical_check_t  statistical_check,
trng_statistical_check_limit_t limit 
)

This function is used to get current setting of minimum and maximum limits of a statistical check.

Parameters
baseTRNG base address
statistical_checkType of statistical check defined by trng_statistical_check_t
limitPointer to structure used to store maximum and minimum limits of statistic
Returns
minimum and maximum limits of a statistical check
uint32_t TRNG_HAL_ReadEntropy ( TRNG_Type *  base,
uint32_t  index 
)

This function gets an entropy data from TRNG. Entropy data is spread over TRNG_ENT_COUNT registers. Read register number is defined by index parameter. Entropy data is valid only if TRNG_HAL_GetEntropyValidCmd() returns 1.

Parameters
baseTRNG base address
indexTRNG entropy register index. It is rounded by module TRNG_ENT_COUNT by the function, to be sure that register index is set to value from 0 till (TRNG_ENT_COUNT-1) and to allow incrementing of the index without the limit control from an application.
Returns
32bit entropy data
trng_status_t TRNG_HAL_GetStatus ( TRNG_Type *  base)

This function gets current status after the TRNG entropy generation.

Parameters
baseTRNG base address
Returns
TRNG status. It can be kStatus_TRNG_Success if no error, kStatus_TRNG_Error if any error with any combination of kStatus_TRNG_TestFailRunBit1Sampling0, kStatus_TRNG_TestFailRunBit1Sampling1, kStatus_TRNG_TestFailRunBit2Sampling0, kStatus_TRNG_TestFailRunBit2Sampling1, kStatus_TRNG_TestFailRunBit3Sampling0, kStatus_TRNG_TestFailRunBit3Sampling1, kStatus_TRNG_TestFailRunBit4Sampling0, kStatus_TRNG_TestFailRunBit4Sampling1, kStatus_TRNG_TestFailRunBit5Sampling0, kStatus_TRNG_TestFailRunBit5Sampling1, kStatus_TRNG_TestFailRunBit6PlusSampling0, kStatus_TRNG_TestFailRunBit6PlusSampling1, kStatus_TRNG_TestFailSparseBit, kStatus_TRNG_TestFailLongRun, kStatus_TRNG_TestFailPoker, kStatus_TRNG_TestFailMonoBit, kStatus_TRNG_TestFailFrequencyCount.