CC26xx Driver Library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
[trng] True Random Number Generator

Functions

void TRNGConfigure (uint32_t ui32MinSamplesPerCycle, uint32_t ui32MaxSamplesPerCycle, uint32_t ui32ClocksPerSample)
 Configure the true random number generator. More...
 
__STATIC_INLINE void TRNGEnable (void)
 Enable the TRNG. More...
 
__STATIC_INLINE void TRNGDisable (void)
 Disable the TRNG module. More...
 
uint32_t TRNGNumberGet (uint32_t ui32Word)
 Get a random number from the generator. More...
 
__STATIC_INLINE uint32_t TRNGStatusGet (void)
 Get the status of the TRNG. More...
 
__STATIC_INLINE void TRNGReset (void)
 Reset the TRNG. More...
 
__STATIC_INLINE void TRNGIntEnable (uint32_t ui32IntFlags)
 Enables individual TRNG interrupt sources. More...
 
__STATIC_INLINE void TRNGIntDisable (uint32_t ui32IntFlags)
 Disables individual TRNG interrupt sources. More...
 
__STATIC_INLINE uint32_t TRNGIntStatus (bool bMasked)
 Gets the current interrupt status of the TRNG module. More...
 
__STATIC_INLINE void TRNGIntClear (uint32_t ui32IntFlags)
 Clears TRNG interrupt sources. More...
 
__STATIC_INLINE void TRNGIntRegister (void(*pfnHandler)(void))
 Registers an interrupt handler for a TRNG interrupt. More...
 
__STATIC_INLINE void TRNGIntUnregister (void)
 Unregisters an interrupt handler for a TRNG interrupt. More...
 

Detailed Description

Function Documentation

void TRNGConfigure ( uint32_t  ui32MinSamplesPerCycle,
uint32_t  ui32MaxSamplesPerCycle,
uint32_t  ui32ClocksPerSample 
)

Configure the true random number generator.

Use this function to set the minimum and maximum number of samples required in each generation of a new random number.

Parameters
ui32MinSamplesPerCycleis the minimum number of samples pr. each generated random number.
ui32MaxSamplesPerCycleis the maximum number of samples pr. each generated random number
ui32ClocksPerSampledefines the number of clocs cycles for each time a new sample is generated from the FROs.
Returns
None

Definition at line 60 of file trng.c.

__STATIC_INLINE void TRNGDisable ( void  )

Disable the TRNG module.

Returns
None

Definition at line 155 of file trng.h.

__STATIC_INLINE void TRNGEnable ( void  )

Enable the TRNG.

Enable the TRNG to start preparing a random number.

Returns
None

Definition at line 139 of file trng.h.

__STATIC_INLINE void TRNGIntClear ( uint32_t  ui32IntFlags)

Clears TRNG interrupt sources.

The specified TRNG interrupt sources are cleared, so that they no longer assert. This function must be called in the interrupt handler to keep the interrupt from being recognized again immediately upon exit.

Note
Because there is a write buffer in the Cortex-M3 processor, it may take several clock cycles before the interrupt source is actually cleared. Therefore, it is recommended that the interrupt source be cleared early in the interrupt handler (as opposed to the very last action) to avoid returning from the interrupt handler before the interrupt source is actually cleared. Failure to do so may result in the interrupt handler being immediately reentered (because the interrupt controller still sees the interrupt source asserted).
Parameters
ui32IntFlagsis a bit mask of the interrupt sources to be cleared. The parameter is the bitwise OR of any of the following:
Returns
None

Definition at line 350 of file trng.h.

__STATIC_INLINE void TRNGIntDisable ( uint32_t  ui32IntFlags)

Disables individual TRNG interrupt sources.

This function disables the indicated TRNG interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor.

Parameters
ui32IntFlagsis the bit mask of the interrupt sources to be disabled. The parameter is the bitwise OR of any of the following:
Returns
None

Definition at line 273 of file trng.h.

__STATIC_INLINE void TRNGIntEnable ( uint32_t  ui32IntFlags)

Enables individual TRNG interrupt sources.

This function enables the indicated TRNG interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor.

Parameters
ui32IntFlagsis the bit mask of the interrupt sources to be enabled. The parameter is the bitwise OR of any of the following:
Returns
None

Definition at line 242 of file trng.h.

__STATIC_INLINE void TRNGIntRegister ( void(*)(void)  pfnHandler)

Registers an interrupt handler for a TRNG interrupt.

This function does the actual registering of the interrupt handler. This function enables the global interrupt in the interrupt controller; specific UART interrupts must be enabled via TRNGIntEnable(). It is the interrupt handler's responsibility to clear the interrupt source.

Parameters
pfnHandleris a pointer to the function to be called when the UART interrupt occurs.
Returns
None
See also
IntRegister() for important information about registering interrupt handlers.

Definition at line 383 of file trng.h.

__STATIC_INLINE uint32_t TRNGIntStatus ( bool  bMasked)

Gets the current interrupt status of the TRNG module.

This function returns the interrupt status for the specified TRNG. Either the raw interrupt status or the status of interrupts that are allowed to reflect to the processor can be returned.

Parameters
bMaskedselects either raw or masked interrupt status.
  • true : Masked interrupt.
  • false : Raw interrupt.
Returns
Returns the current interrupt status, enumerated as:

Definition at line 305 of file trng.h.

__STATIC_INLINE void TRNGIntUnregister ( void  )

Unregisters an interrupt handler for a TRNG interrupt.

This function does the actual unregistering of the interrupt handler. It clears the handler to be called when a Crypto interrupt occurs. This function also masks off the interrupt in the interrupt controller so that the interrupt handler no longer is called.

Returns
None
See also
IntRegister() for important information about registering interrupt handlers.

Definition at line 412 of file trng.h.

uint32_t TRNGNumberGet ( uint32_t  ui32Word)

Get a random number from the generator.

Use this function to get either the high or low part of the 64 bit generated number.

Note
Data from this register is only valid if the TRNG has produced a number. Use TRNGStatusGet() to poll the for status. After calling this function a new random number will be generated.
Parameters
ui32Worddetermines if whether to return the high or low 32 bits.
Returns
Return either the high or low part of the 64 bit generated random number.

Definition at line 95 of file trng.c.

__STATIC_INLINE void TRNGReset ( void  )

Reset the TRNG.

Use this function to reset the TRNG module. Reset will be low for approximately 5 clock cyles.

Returns
None

Definition at line 217 of file trng.h.

__STATIC_INLINE uint32_t TRNGStatusGet ( void  )

Get the status of the TRNG.

Use this function to retrieve the status of the TRNG.

Returns
Returns the current status of the TRNG module. The returned status is a bitwise OR'ed combination of:

Definition at line 198 of file trng.h.

Macro Definition Documentation

#define TRNG_FRO_SHUTDOWN   0x00000002

Definition at line 96 of file trng.h.

Referenced by TRNGIntClear(), TRNGIntDisable(), and TRNGIntEnable().

#define TRNG_HI_WORD   0x00000001

Definition at line 99 of file trng.h.

Referenced by TRNGNumberGet().

#define TRNG_LOW_WORD   0x00000002

Definition at line 100 of file trng.h.

Referenced by TRNGNumberGet().

#define TRNG_NEED_CLOCK   0x80000000

Definition at line 97 of file trng.h.

#define TRNG_NUMBER_READY   0x00000001

Definition at line 95 of file trng.h.

Referenced by TRNGIntClear(), TRNGIntDisable(), and TRNGIntEnable().