MSPM0G1X0X_G3X0X Driver Library  1.10.01.05
Data Structures | Macros | Enumerations | Functions
dl_trng.h File Reference

Detailed Description

True Random Number Generator (TRNG) Driver Library.


#include <stdbool.h>
#include <stdint.h>
#include <ti/devices/msp/msp.h>
#include <ti/driverlib/dl_common.h>
Include dependency graph for dl_trng.h:

Go to the source code of this file.

Data Structures

struct  DL_TRNG_backupConfig
 Configuration structure to backup TRNG peripheral state before going to STOP/STANDBY mode. Not required after PG 1.0 silicon. Used by DL_TRNG_saveConfiguration. More...
 

Macros

#define DL_TRNG_INTERRUPT_HEALTH_FAIL_EVENT   (TRNG_IMASK_IRQ_HEALTH_FAIL_MASK)
 TRNG interrupt definition for health test failed.
 
#define DL_TRNG_INTERRUPT_CMD_DONE_EVENT   (TRNG_IMASK_IRQ_CMD_DONE_MASK)
 TRNG interrupt definition for commafnd done.
 
#define DL_TRNG_INTERRUPT_CMD_FAIL_EVENT   (TRNG_IMASK_IRQ_CMD_FAIL_MASK)
 TRNG interrupt definition for command fail.
 
#define DL_TRNG_INTERRUPT_CAPTURE_RDY_EVENT   (TRNG_IMASK_IRQ_CAPTURED_RDY_MASK)
 TRNG interrupt definition for capture ready.
 
#define DL_TRNG_DIGITAL_HEALTH_TEST_SUCCESS   (0xFF)
 TRNG Digital health test success value.
 
#define DL_TRNG_ANALOG_HEALTH_TEST_SUCCESS   (0x1)
 TRNG Analog health test success value.
 

Enumerations

enum  DL_TRNG_IIDX {
  DL_TRNG_IIDX_HEALTH_FAIL = TRNG_IIDX_STAT_IRQ_HEALTH_FAIL,
  DL_TRNG_IIDX_CMD_DONE = TRNG_IIDX_STAT_IRQ_CMD_DONE,
  DL_TRNG_IIDX_CMD_FAIL = TRNG_IIDX_STAT_IRQ_CMD_FAIL,
  DL_TRNG_IIDX_CAPTURED_READY = TRNG_IIDX_STAT_IRQ_CAPTURED_RDY
}
 
enum  DL_TRNG_DECIMATION_RATE {
  DL_TRNG_DECIMATION_RATE_1 = 0x0,
  DL_TRNG_DECIMATION_RATE_2 = 0x1,
  DL_TRNG_DECIMATION_RATE_3 = 0x2,
  DL_TRNG_DECIMATION_RATE_4 = 0x3,
  DL_TRNG_DECIMATION_RATE_5 = 0x4,
  DL_TRNG_DECIMATION_RATE_6 = 0x5,
  DL_TRNG_DECIMATION_RATE_7 = 0x6,
  DL_TRNG_DECIMATION_RATE_8 = 0x7
}
 
enum  DL_TRNG_CMD {
  DL_TRNG_CMD_PWROFF = TRNG_CTL_CMD_PWR_OFF,
  DL_TRNG_CMD_TEST_DIG = TRNG_CTL_CMD_PWRUP_DIG,
  DL_TRNG_CMD_TEST_ANA = TRNG_CTL_CMD_PWRUP_ANA,
  DL_TRNG_CMD_NORM_FUNC = TRNG_CTL_CMD_NORM_FUNC
}
 
enum  DL_TRNG_CLOCK_DIVIDE {
  DL_TRNG_CLOCK_DIVIDE_1 = TRNG_CLKDIVIDE_RATIO_DIV_BY_1,
  DL_TRNG_CLOCK_DIVIDE_2 = TRNG_CLKDIVIDE_RATIO_DIV_BY_2,
  DL_TRNG_CLOCK_DIVIDE_4 = TRNG_CLKDIVIDE_RATIO_DIV_BY_4,
  DL_TRNG_CLOCK_DIVIDE_6 = TRNG_CLKDIVIDE_RATIO_DIV_BY_6,
  DL_TRNG_CLOCK_DIVIDE_8 = TRNG_CLKDIVIDE_RATIO_DIV_BY_8
}
 
enum  DL_TRNG_STATE {
  DL_TRNG_STATE_OFF = 0x0,
  DL_TRNG_STATE_PWRUP_ES = 0x1,
  DL_TRNG_STATE_NORM_FUNC = 0x3,
  DL_TRNG_STATE_TEST_DIG = 0x7,
  DL_TRNG_STATE_TEST_ANA = 0xB,
  DL_TRNG_STATE_ERROR = 0xA,
  DL_TRNG_STATE_PWRDOWN = 0x2
}
 

Functions

__STATIC_INLINE void DL_TRNG_enablePower (TRNG_Regs *trng)
 Enables power on TRNG module. More...
 
__STATIC_INLINE void DL_TRNG_disablePower (TRNG_Regs *trng)
 Disable power on TRNG module. More...
 
__STATIC_INLINE DL_TRNG_CLOCK_DIVIDE DL_TRNG_getClockDivider (TRNG_Regs *trng)
 Get the clock divider on the TRNG module. More...
 
__STATIC_INLINE void DL_TRNG_setClockDivider (TRNG_Regs *trng, DL_TRNG_CLOCK_DIVIDE clockDivider)
 Set the clock divider on the TRNG module. More...
 
__STATIC_INLINE void DL_TRNG_reset (TRNG_Regs *trng)
 Resets the TRNG module. More...
 
__STATIC_INLINE bool DL_TRNG_isReset (TRNG_Regs *trng)
 Returns if TRNG peripheral was reset. More...
 
__STATIC_INLINE bool DL_TRNG_isCaptureReady (TRNG_Regs *trng)
 Returns if the data capture is ready. More...
 
__STATIC_INLINE bool DL_TRNG_isCommandDone (TRNG_Regs *trng)
 Returns if the issued TRNG command is done. More...
 
__STATIC_INLINE bool DL_TRNG_isCommandFail (TRNG_Regs *trng)
 Returns if the issued TRNG command failed. More...
 
__STATIC_INLINE bool DL_TRNG_isHealthTestFail (TRNG_Regs *trng)
 Returns if a health test failed. More...
 
__STATIC_INLINE void DL_TRNG_setDecimationRate (TRNG_Regs *trng, DL_TRNG_DECIMATION_RATE decimationRate)
 Set the decimation rate. More...
 
__STATIC_INLINE DL_TRNG_DECIMATION_RATE DL_TRNG_getDecimationRate (TRNG_Regs *trng)
 Get the decimation rate. More...
 
__STATIC_INLINE uint8_t DL_TRNG_getDigitalHealthTestResults (TRNG_Regs *trng)
 Get the digital health test results. More...
 
__STATIC_INLINE uint8_t DL_TRNG_getAnalogHealthTestResults (TRNG_Regs *trng)
 Get the analog health test results. More...
 
__STATIC_INLINE uint32_t DL_TRNG_getCurrentState (TRNG_Regs *trng)
 Get the current state of the TRNG front end FSM. More...
 
__STATIC_INLINE uint32_t DL_TRNG_getIssuedCommand (TRNG_Regs *trng)
 Get the last accepted command that was issued to the TRNG. More...
 
__STATIC_INLINE bool DL_TRNG_isRepetitionTestFail (TRNG_Regs *trng)
 Indicates if the repetition counter test caused the most recent failure. More...
 
__STATIC_INLINE bool DL_TRNG_isAdaptiveTestFail (TRNG_Regs *trng)
 Indicates if the Adaptive Proportion Test (1,2,3, or 4-bit counters) caused the most recent failure. More...
 
__STATIC_INLINE void DL_TRNG_enableInterrupt (TRNG_Regs *trng, uint32_t interruptMask)
 Enable TRNG interrupt. More...
 
__STATIC_INLINE void DL_TRNG_disableInterrupt (TRNG_Regs *trng, uint32_t interruptMask)
 Disable TRNG interrupt. More...
 
__STATIC_INLINE uint32_t DL_TRNG_getEnabledInterrupts (TRNG_Regs *trng, uint32_t interruptMask)
 Check which TRNG interrupts are enabled. More...
 
__STATIC_INLINE uint32_t DL_TRNG_getEnabledInterruptStatus (TRNG_Regs *trng, uint32_t interruptMask)
 Check interrupt flag of enabled TRNG interrupt. More...
 
__STATIC_INLINE uint32_t DL_TRNG_getRawInterruptStatus (TRNG_Regs *trng, uint32_t interruptMask)
 Check interrupt flag of any TRNG interrupt. More...
 
__STATIC_INLINE DL_TRNG_IIDX DL_TRNG_getPendingInterrupt (TRNG_Regs *trng)
 Get highest priority pending TRNG interrupt. More...
 
__STATIC_INLINE void DL_TRNG_clearInterruptStatus (TRNG_Regs *trng, uint32_t interruptMask)
 Clear pending TRNG interrupt. More...
 
__STATIC_INLINE void DL_TRNG_sendCommand (TRNG_Regs *trng, DL_TRNG_CMD cmd)
 Update control register's command bits to send a TRNG command. More...
 
__STATIC_INLINE uint32_t DL_TRNG_getCapture (TRNG_Regs *trng)
 Get word capture from TRNG. More...
 
bool DL_TRNG_saveConfiguration (TRNG_Regs *trng, DL_TRNG_backupConfig *ptr)
 Save TRNG configuration before entering a power loss state. Only necessary for PG 1.0 silicon. More...
 
bool DL_TRNG_restoreConfiguration (TRNG_Regs *trng, DL_TRNG_backupConfig *ptr)
 Restore TRNG configuration after leaving a power loss state. Upon restoration, if the TRNG was not originally in OFF state, then the TRNG will be set to the normal operating mode. Only necessary for PG 1.0 silicon. More...
 
© Copyright 1995-2023, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale