MCUXpresso SDK API Reference Manual
Rev. 0
NXP Semiconductors
|
The MCUXpresso SDK provides a peripheral driver for the Secure Non-Volatile Storage Low-Power (SNVS-LP) module.
The SNVS_LP is a data storage subsystem. Its purpose is to store and protect system data, regardless of the main system power state. The SNVS _LP is in the always-powered-up domain, which is a separate power domain with its own power supply.
Data Structures | |
struct | snvs_lp_passive_tamper_t |
Structure is used to configure SNVS LP passive tamper pins. More... | |
struct | tamper_active_tx_config_t |
Structure is used to configure SNVS LP active TX tamper pins. More... | |
struct | tamper_active_rx_config_t |
Structure is used to configure SNVS LP active RX tamper pins. More... | |
struct | snvs_lp_srtc_datetime_t |
Structure is used to hold the date and time. More... | |
struct | snvs_lp_srtc_config_t |
SNVS_LP config structure. More... | |
Macros | |
#define | SNVS_ZMK_REG_COUNT 8U /* 8 Zeroizable Master Key registers. */ |
Define of SNVS_LP Zeroizable Master Key registers. | |
#define | SNVS_LP_MAX_TAMPER kSNVS_ExternalTamper10 |
Define of SNVS_LP Max possible tamper. | |
Enumerations | |
enum | snvs_lp_srtc_interrupts_t { kSNVS_SRTC_AlarmInterrupt = SNVS_LPCR_LPTA_EN_MASK } |
List of SNVS_LP interrupts. More... | |
enum | snvs_lp_srtc_status_flags_t { kSNVS_SRTC_AlarmInterruptFlag = SNVS_LPSR_LPTA_MASK } |
List of SNVS_LP flags. More... | |
enum | snvs_lp_external_tamper_t |
List of SNVS_LP external tampers. | |
enum | snvs_lp_active_tamper_t |
List of SNVS_LP active tampers. | |
enum | snvs_lp_active_clock_t |
List of SNVS_LP external tampers. | |
enum | snvs_lp_external_tamper_status_t |
List of SNVS_LP external tampers status. | |
enum | snvs_lp_external_tamper_polarity_t |
SNVS_LP external tamper polarity. | |
enum | snvs_lp_zmk_program_mode_t { kSNVS_ZMKSoftwareProgram, kSNVS_ZMKHardwareProgram } |
SNVS_LP Zeroizable Master Key programming mode. More... | |
enum | snvs_lp_master_key_mode_t { kSNVS_OTPMK = 0, kSNVS_ZMK = 2, kSNVS_CMK = 3 } |
SNVS_LP Master Key mode. More... | |
Functions | |
void | SNVS_LP_SRTC_Init (SNVS_Type *base, const snvs_lp_srtc_config_t *config) |
Ungates the SNVS clock and configures the peripheral for basic operation. More... | |
void | SNVS_LP_SRTC_Deinit (SNVS_Type *base) |
Stops the SRTC timer. More... | |
void | SNVS_LP_SRTC_GetDefaultConfig (snvs_lp_srtc_config_t *config) |
Fills in the SNVS_LP config struct with the default settings. More... | |
Driver version | |
#define | FSL_SNVS_LP_DRIVER_VERSION (MAKE_VERSION(2, 3, 0)) |
Version 2.3.0. | |
Initialization and deinitialization | |
void | SNVS_LP_Init (SNVS_Type *base) |
Ungates the SNVS clock and configures the peripheral for basic operation. More... | |
void | SNVS_LP_Deinit (SNVS_Type *base) |
Deinit the SNVS LP section. More... | |
Secure RTC (SRTC) current Time & Alarm | |
status_t | SNVS_LP_SRTC_SetDatetime (SNVS_Type *base, const snvs_lp_srtc_datetime_t *datetime) |
Sets the SNVS SRTC date and time according to the given time structure. More... | |
void | SNVS_LP_SRTC_GetDatetime (SNVS_Type *base, snvs_lp_srtc_datetime_t *datetime) |
Gets the SNVS SRTC time and stores it in the given time structure. More... | |
status_t | SNVS_LP_SRTC_SetAlarm (SNVS_Type *base, const snvs_lp_srtc_datetime_t *alarmTime) |
Sets the SNVS SRTC alarm time. More... | |
void | SNVS_LP_SRTC_GetAlarm (SNVS_Type *base, snvs_lp_srtc_datetime_t *datetime) |
Returns the SNVS SRTC alarm time. More... | |
Interrupt Interface | |
static void | SNVS_LP_SRTC_EnableInterrupts (SNVS_Type *base, uint32_t mask) |
Enables the selected SNVS interrupts. More... | |
static void | SNVS_LP_SRTC_DisableInterrupts (SNVS_Type *base, uint32_t mask) |
Disables the selected SNVS interrupts. More... | |
uint32_t | SNVS_LP_SRTC_GetEnabledInterrupts (SNVS_Type *base) |
Gets the enabled SNVS interrupts. More... | |
Status Interface | |
uint32_t | SNVS_LP_SRTC_GetStatusFlags (SNVS_Type *base) |
Gets the SNVS status flags. More... | |
static void | SNVS_LP_SRTC_ClearStatusFlags (SNVS_Type *base, uint32_t mask) |
Clears the SNVS status flags. More... | |
Timer Start and Stop | |
static void | SNVS_LP_SRTC_StartTimer (SNVS_Type *base) |
Starts the SNVS SRTC time counter. More... | |
static void | SNVS_LP_SRTC_StopTimer (SNVS_Type *base) |
Stops the SNVS SRTC time counter. More... | |
External tampering | |
void | SNVS_LP_EnablePassiveTamper (SNVS_Type *base, snvs_lp_external_tamper_t pin, snvs_lp_passive_tamper_t config) |
Enables the specified SNVS external tamper. More... | |
status_t | SNVS_LP_EnableTxActiveTamper (SNVS_Type *base, snvs_lp_active_tamper_t pin, tamper_active_tx_config_t config) |
Enable active tamper tx external pad. More... | |
status_t | SNVS_LP_EnableRxActiveTamper (SNVS_Type *base, snvs_lp_external_tamper_t rx, tamper_active_rx_config_t config) |
Enable active tamper rx external pad. More... | |
status_t | SNVS_LP_SetVoltageTamper (SNVS_Type *base, bool enable) |
Sets voltage tamper detect. More... | |
status_t | SNVS_LP_SetTemperatureTamper (SNVS_Type *base, bool enable) |
Sets temperature tamper detect. More... | |
status_t | SNVS_LP_SetClockTamper (SNVS_Type *base, bool enable) |
Sets clock tamper detect. More... | |
snvs_lp_external_tamper_status_t | SNVS_LP_CheckVoltageTamper (SNVS_Type *base) |
brief Check voltage tamper More... | |
snvs_lp_external_tamper_status_t | SNVS_LP_CheckTemperatureTamper (SNVS_Type *base) |
Check temperature tamper. More... | |
snvs_lp_external_tamper_status_t | SNVS_LP_CheckClockTamper (SNVS_Type *base) |
brief Check clock tamper More... | |
void | SNVS_LP_TamperPin_GetDefaultConfig (snvs_lp_passive_tamper_t *config) |
Fills in the SNVS tamper pin config struct with the default settings. More... | |
void | SNVS_LP_TamperPinTx_GetDefaultConfig (tamper_active_tx_config_t *config) |
Fills in the SNVS tamper pin config struct with the default settings. More... | |
void | SNVS_LP_TamperPinRx_GetDefaultConfig (tamper_active_rx_config_t *config) |
brief Fills in the SNVS tamper pin config struct with the default settings. More... | |
void | SNVS_LP_DisableExternalTamper (SNVS_Type *base, snvs_lp_external_tamper_t pin) |
Disables the specified SNVS external tamper. More... | |
void | SNVS_LP_DisableAllExternalTamper (SNVS_Type *base) |
Disable all external tamper. More... | |
snvs_lp_external_tamper_status_t | SNVS_LP_GetExternalTamperStatus (SNVS_Type *base, snvs_lp_external_tamper_t pin) |
Returns status of the specified external tamper. More... | |
void | SNVS_LP_ClearExternalTamperStatus (SNVS_Type *base, snvs_lp_external_tamper_t pin) |
Clears status of the specified external tamper. More... | |
void | SNVS_LP_ClearAllExternalTamperStatus (SNVS_Type *base) |
Clears status of the all external tamper. More... | |
Monotonic Counter (MC) | |
static void | SNVS_LP_EnableMonotonicCounter (SNVS_Type *base, bool enable) |
Enable or disable the Monotonic Counter. More... | |
uint64_t | SNVS_LP_GetMonotonicCounter (SNVS_Type *base) |
Get the current Monotonic Counter. More... | |
static void | SNVS_LP_IncreaseMonotonicCounter (SNVS_Type *base) |
Increase the Monotonic Counter. More... | |
Zeroizable Master Key (ZMK) | |
void | SNVS_LP_WriteZeroizableMasterKey (SNVS_Type *base, uint32_t ZMKey[SNVS_ZMK_REG_COUNT]) |
Write Zeroizable Master Key (ZMK) to the SNVS registers. More... | |
static void | SNVS_LP_SetZeroizableMasterKeyValid (SNVS_Type *base, bool valid) |
Set Zeroizable Master Key valid. More... | |
static bool | SNVS_LP_GetZeroizableMasterKeyValid (SNVS_Type *base) |
Get Zeroizable Master Key valid status. More... | |
static void | SNVS_LP_SetZeroizableMasterKeyProgramMode (SNVS_Type *base, snvs_lp_zmk_program_mode_t mode) |
Set Zeroizable Master Key programming mode. More... | |
static void | SNVS_LP_EnableZeroizableMasterKeyECC (SNVS_Type *base, bool enable) |
Enable or disable Zeroizable Master Key ECC. More... | |
static void | SNVS_LP_SetMasterKeyMode (SNVS_Type *base, snvs_lp_master_key_mode_t mode) |
Set SNVS Master Key mode. More... | |
struct snvs_lp_passive_tamper_t |
struct tamper_active_tx_config_t |
struct tamper_active_rx_config_t |
struct snvs_lp_srtc_datetime_t |
Data Fields | |
uint16_t | year |
Range from 1970 to 2099. More... | |
uint8_t | month |
Range from 1 to 12. More... | |
uint8_t | day |
Range from 1 to 31 (depending on month). More... | |
uint8_t | hour |
Range from 0 to 23. More... | |
uint8_t | minute |
Range from 0 to 59. More... | |
uint8_t | second |
Range from 0 to 59. More... | |
uint16_t snvs_lp_srtc_datetime_t::year |
uint8_t snvs_lp_srtc_datetime_t::month |
uint8_t snvs_lp_srtc_datetime_t::day |
uint8_t snvs_lp_srtc_datetime_t::hour |
uint8_t snvs_lp_srtc_datetime_t::minute |
uint8_t snvs_lp_srtc_datetime_t::second |
struct snvs_lp_srtc_config_t |
This structure holds the configuration settings for the SNVS_LP peripheral. To initialize this structure to reasonable defaults, call the SNVS_LP_GetDefaultConfig() function and pass a pointer to your config structure instance.
The config struct can be made const so it resides in flash
Data Fields | |
bool | srtcCalEnable |
true: SRTC calibration mechanism is enabled; false: No calibration is used | |
uint32_t | srtcCalValue |
Defines signed calibration value for SRTC; This is a 5-bit 2's complement value, range from -16 to +15. | |
void SNVS_LP_Init | ( | SNVS_Type * | base | ) |
base | SNVS peripheral base address |
void SNVS_LP_Deinit | ( | SNVS_Type * | base | ) |
base | SNVS peripheral base address |
void SNVS_LP_SRTC_Init | ( | SNVS_Type * | base, |
const snvs_lp_srtc_config_t * | config | ||
) |
base | SNVS peripheral base address |
config | Pointer to the user's SNVS configuration structure. |
void SNVS_LP_SRTC_Deinit | ( | SNVS_Type * | base | ) |
base | SNVS peripheral base address |
void SNVS_LP_SRTC_GetDefaultConfig | ( | snvs_lp_srtc_config_t * | config | ) |
The default values are as follows.
config | Pointer to the user's SNVS configuration structure. |
status_t SNVS_LP_SRTC_SetDatetime | ( | SNVS_Type * | base, |
const snvs_lp_srtc_datetime_t * | datetime | ||
) |
base | SNVS peripheral base address |
datetime | Pointer to the structure where the date and time details are stored. |
void SNVS_LP_SRTC_GetDatetime | ( | SNVS_Type * | base, |
snvs_lp_srtc_datetime_t * | datetime | ||
) |
base | SNVS peripheral base address |
datetime | Pointer to the structure where the date and time details are stored. |
status_t SNVS_LP_SRTC_SetAlarm | ( | SNVS_Type * | base, |
const snvs_lp_srtc_datetime_t * | alarmTime | ||
) |
The function sets the SRTC alarm. It also checks whether the specified alarm time is greater than the present time. If not, the function does not set the alarm and returns an error. Please note, that SRTC alarm has limited resolution because only 32 most significant bits of SRTC counter are compared to SRTC Alarm register. If the alarm time is beyond SRTC resolution, the function does not set the alarm and returns an error.
base | SNVS peripheral base address |
alarmTime | Pointer to the structure where the alarm time is stored. |
void SNVS_LP_SRTC_GetAlarm | ( | SNVS_Type * | base, |
snvs_lp_srtc_datetime_t * | datetime | ||
) |
base | SNVS peripheral base address |
datetime | Pointer to the structure where the alarm date and time details are stored. |
|
inlinestatic |
base | SNVS peripheral base address |
mask | The interrupts to enable. This is a logical OR of members of the enumeration :: _snvs_lp_srtc_interrupts |
|
inlinestatic |
base | SNVS peripheral base address |
mask | The interrupts to enable. This is a logical OR of members of the enumeration :: _snvs_lp_srtc_interrupts |
uint32_t SNVS_LP_SRTC_GetEnabledInterrupts | ( | SNVS_Type * | base | ) |
base | SNVS peripheral base address |
uint32_t SNVS_LP_SRTC_GetStatusFlags | ( | SNVS_Type * | base | ) |
base | SNVS peripheral base address |
|
inlinestatic |
base | SNVS peripheral base address |
mask | The status flags to clear. This is a logical OR of members of the enumeration :: _snvs_lp_srtc_status_flags |
|
inlinestatic |
base | SNVS peripheral base address |
|
inlinestatic |
base | SNVS peripheral base address |
void SNVS_LP_EnablePassiveTamper | ( | SNVS_Type * | base, |
snvs_lp_external_tamper_t | pin, | ||
snvs_lp_passive_tamper_t | config | ||
) |
base | SNVS peripheral base address |
pin | SNVS external tamper pin |
config | Configuration structure of external passive tamper |
status_t SNVS_LP_EnableTxActiveTamper | ( | SNVS_Type * | base, |
snvs_lp_active_tamper_t | pin, | ||
tamper_active_tx_config_t | config | ||
) |
base | SNVS peripheral base address |
pin | SNVS active tamper pin |
config | Configuration structure of external active tamper |
status_t SNVS_LP_EnableRxActiveTamper | ( | SNVS_Type * | base, |
snvs_lp_external_tamper_t | rx, | ||
tamper_active_rx_config_t | config | ||
) |
base | SNVS peripheral base address |
rx | SNVS external RX tamper pin |
config | SNVS RX tamper config structure |
status_t SNVS_LP_SetVoltageTamper | ( | SNVS_Type * | base, |
bool | enable | ||
) |
base | SNVS peripheral base address |
enable | True if enable false if disable |
status_t SNVS_LP_SetTemperatureTamper | ( | SNVS_Type * | base, |
bool | enable | ||
) |
base | SNVS peripheral base address |
enable | True if enable false if disable |
status_t SNVS_LP_SetClockTamper | ( | SNVS_Type * | base, |
bool | enable | ||
) |
base | SNVS peripheral base address |
enable | True if enable false if disable |
snvs_lp_external_tamper_status_t SNVS_LP_CheckVoltageTamper | ( | SNVS_Type * | base | ) |
param base SNVS peripheral base address
snvs_lp_external_tamper_status_t SNVS_LP_CheckTemperatureTamper | ( | SNVS_Type * | base | ) |
base | SNVS peripheral base address |
snvs_lp_external_tamper_status_t SNVS_LP_CheckClockTamper | ( | SNVS_Type * | base | ) |
param base SNVS peripheral base address
void SNVS_LP_TamperPin_GetDefaultConfig | ( | snvs_lp_passive_tamper_t * | config | ) |
The default values are as follows. code config->polarity = 0U; config->filterenable = 0U; config->filter = 0U; endcode
config | Pointer to the user's SNVS configuration structure. |
void SNVS_LP_TamperPinTx_GetDefaultConfig | ( | tamper_active_tx_config_t * | config | ) |
The default values are as follows. code config->clock = kSNVS_ActiveTamper16HZ; config->seed = 0U; config->polynomial = 0U; endcode
config | Pointer to the user's SNVS configuration structure. |
void SNVS_LP_TamperPinRx_GetDefaultConfig | ( | tamper_active_rx_config_t * | config | ) |
The default values are as follows. code config->filterenable = 0U; config->filter = 0U; config->tx = kSNVS_activeTamper1; endcode param config Pointer to the user's SNVS configuration structure.
void SNVS_LP_DisableExternalTamper | ( | SNVS_Type * | base, |
snvs_lp_external_tamper_t | pin | ||
) |
base | SNVS peripheral base address |
pin | SNVS external tamper pin |
void SNVS_LP_DisableAllExternalTamper | ( | SNVS_Type * | base | ) |
base | SNVS peripheral base address |
snvs_lp_external_tamper_status_t SNVS_LP_GetExternalTamperStatus | ( | SNVS_Type * | base, |
snvs_lp_external_tamper_t | pin | ||
) |
base | SNVS peripheral base address |
pin | SNVS external tamper pin |
void SNVS_LP_ClearExternalTamperStatus | ( | SNVS_Type * | base, |
snvs_lp_external_tamper_t | pin | ||
) |
base | SNVS peripheral base address |
pin | SNVS external tamper pin |
void SNVS_LP_ClearAllExternalTamperStatus | ( | SNVS_Type * | base | ) |
base | SNVS peripheral base address |
|
inlinestatic |
base | SNVS peripheral base address |
enable | Pass true to enable, false to disable. |
uint64_t SNVS_LP_GetMonotonicCounter | ( | SNVS_Type * | base | ) |
base | SNVS peripheral base address |
|
inlinestatic |
Increase the Monotonic Counter by 1.
base | SNVS peripheral base address |
void SNVS_LP_WriteZeroizableMasterKey | ( | SNVS_Type * | base, |
uint32_t | ZMKey[SNVS_ZMK_REG_COUNT] | ||
) |
base | SNVS peripheral base address |
ZMKey | The ZMK write to the SNVS register. |
|
inlinestatic |
This API could only be called when using software programming mode. After writing ZMK using SNVS_LP_WriteZeroizableMasterKey, call this API to make the ZMK valid.
base | SNVS peripheral base address |
valid | Pass true to set valid, false to set invalid. |
|
inlinestatic |
In hardware programming mode, call this API to check whether the ZMK is valid.
base | SNVS peripheral base address |
|
inlinestatic |
base | SNVS peripheral base address |
mode | ZMK programming mode. |
|
inlinestatic |
base | SNVS peripheral base address |
enable | Pass true to enable, false to disable. |
|
inlinestatic |