MCUXpresso SDK API Reference Manual  Rev. 0
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Secure Non-Volatile Storage High-Power

Overview

The MCUXpresso SDK provides a Peripheral driver for the Secure Non-Volatile Storage High-Power(SNVS-HP) module.

The SNVS_HP is in the chip's power-supply domain and thus receives the power along with the rest of the chip. The SNVS_HP provides an interface between the SNVS_LP and the rest of the system; there is no way to access the SNVS_LP registers except through the SNVS_HP. For access to the SNVS_LP registers, the SNVS_HP must be powered up. It uses a register access permission policy to determine whether the access to the particular registers is permitted.

SNVS_HP Driver Initialization and Configuration

SNVS_HP Driver Examples

Data Structures

struct  snvs_hp_rtc_datetime_t
 Structure is used to hold the date and time. More...
 
struct  snvs_hp_rtc_config_t
 SNVS config structure. More...
 

Enumerations

enum  snvs_hp_interrupt_enable_t {
  kSNVS_RTC_PeriodicInterruptEnable = 1U,
  kSNVS_RTC_AlarmInterruptEnable = 2U
}
 List of SNVS interrupts. More...
 
enum  snvs_hp_status_flags_t {
  kSNVS_RTC_PeriodicInterruptFlag = 1U,
  kSNVS_RTC_AlarmInterruptFlag = 2U
}
 List of SNVS flags. More...
 

Variables

uint16_t snvs_hp_rtc_datetime_t::year
 Range from 1970 to 2099. More...
 
uint8_t snvs_hp_rtc_datetime_t::month
 Range from 1 to 12. More...
 
uint8_t snvs_hp_rtc_datetime_t::day
 Range from 1 to 31 (depending on month). More...
 
uint8_t snvs_hp_rtc_datetime_t::hour
 Range from 0 to 23. More...
 
uint8_t snvs_hp_rtc_datetime_t::minute
 Range from 0 to 59. More...
 
uint8_t snvs_hp_rtc_datetime_t::second
 Range from 0 to 59. More...
 
bool snvs_hp_rtc_config_t::rtcCalEnable
 true: RTC calibration mechanism is enabled; false:No calibration is used
 
uint32_t snvs_hp_rtc_config_t::rtcCalValue
 Defines signed calibration value for nonsecure RTC; This is a 5-bit 2's complement value, range from -16 to +15.
 
uint32_t snvs_hp_rtc_config_t::periodicInterruptFreq
 Defines frequency of the periodic interrupt; Range from 0 to 15.
 

Driver version

#define FSL_SNVS_HP_DRIVER_VERSION   (MAKE_VERSION(2, 0, 0))
 Version 2.0.0.
 

Initialization and deinitialization

void SNVS_HP_RTC_Init (SNVS_Type *base, const snvs_hp_rtc_config_t *config)
 Ungates the SNVS clock and configures the peripheral for basic operation. More...
 
void SNVS_HP_RTC_Deinit (SNVS_Type *base)
 Stops the RTC and SRTC timers. More...
 
void SNVS_HP_RTC_GetDefaultConfig (snvs_hp_rtc_config_t *config)
 Fills in the SNVS config struct with the default settings. More...
 

Non secure RTC current Time & Alarm

status_t SNVS_HP_RTC_SetDatetime (SNVS_Type *base, const snvs_hp_rtc_datetime_t *datetime)
 Sets the SNVS RTC date and time according to the given time structure. More...
 
void SNVS_HP_RTC_GetDatetime (SNVS_Type *base, snvs_hp_rtc_datetime_t *datetime)
 Gets the SNVS RTC time and stores it in the given time structure. More...
 
status_t SNVS_HP_RTC_SetAlarm (SNVS_Type *base, const snvs_hp_rtc_datetime_t *alarmTime)
 Sets the SNVS RTC alarm time. More...
 
void SNVS_HP_RTC_GetAlarm (SNVS_Type *base, snvs_hp_rtc_datetime_t *datetime)
 Returns the SNVS RTC alarm time. More...
 
void SNVS_HP_RTC_TimeSynchronize (SNVS_Type *base)
 The function synchronizes RTC counter value with SRTC. More...
 

Interrupt Interface

void SNVS_HP_RTC_EnableInterrupts (SNVS_Type *base, uint32_t mask)
 Enables the selected SNVS interrupts. More...
 
void SNVS_HP_RTC_DisableInterrupts (SNVS_Type *base, uint32_t mask)
 Disables the selected SNVS interrupts. More...
 
uint32_t SNVS_HP_RTC_GetEnabledInterrupts (SNVS_Type *base)
 Gets the enabled SNVS interrupts. More...
 

Status Interface

uint32_t SNVS_HP_RTC_GetStatusFlags (SNVS_Type *base)
 Gets the SNVS status flags. More...
 
void SNVS_HP_RTC_ClearStatusFlags (SNVS_Type *base, uint32_t mask)
 Clears the SNVS status flags. More...
 

Timer Start and Stop

static void SNVS_HP_RTC_StartTimer (SNVS_Type *base)
 Starts the SNVS RTC time counter. More...
 
static void SNVS_HP_RTC_StopTimer (SNVS_Type *base)
 Stops the SNVS RTC time counter. More...
 

Data Structure Documentation

struct snvs_hp_rtc_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...
 
struct snvs_hp_rtc_config_t

This structure holds the configuration settings for the SNVS peripheral. To initialize this structure to reasonable defaults, call the SNVS_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 rtcCalEnable
 true: RTC calibration mechanism is enabled; false:No calibration is used
 
uint32_t rtcCalValue
 Defines signed calibration value for nonsecure RTC; This is a 5-bit 2's complement value, range from -16 to +15.
 
uint32_t periodicInterruptFreq
 Defines frequency of the periodic interrupt; Range from 0 to 15.
 

Enumeration Type Documentation

Enumerator
kSNVS_RTC_PeriodicInterruptEnable 

RTC periodic interrupt.

kSNVS_RTC_AlarmInterruptEnable 

RTC time alarm.

Enumerator
kSNVS_RTC_PeriodicInterruptFlag 

RTC periodic interrupt flag.

kSNVS_RTC_AlarmInterruptFlag 

RTC time alarm flag.

Function Documentation

void SNVS_HP_RTC_Init ( SNVS_Type *  base,
const snvs_hp_rtc_config_t config 
)
Note
This API should be called at the beginning of the application using the SNVS driver.
Parameters
baseSNVS peripheral base address
configPointer to the user's SNVS configuration structure.
void SNVS_HP_RTC_Deinit ( SNVS_Type *  base)
Parameters
baseSNVS peripheral base address
void SNVS_HP_RTC_GetDefaultConfig ( snvs_hp_rtc_config_t config)

The default values are as follows.

* config->rtccalenable = false;
* config->rtccalvalue = 0U;
* config->PIFreq = 0U;
*
Parameters
configPointer to the user's SNVS configuration structure.
status_t SNVS_HP_RTC_SetDatetime ( SNVS_Type *  base,
const snvs_hp_rtc_datetime_t datetime 
)
Parameters
baseSNVS peripheral base address
datetimePointer to the structure where the date and time details are stored.
Returns
kStatus_Success: Success in setting the time and starting the SNVS RTC kStatus_InvalidArgument: Error because the datetime format is incorrect
void SNVS_HP_RTC_GetDatetime ( SNVS_Type *  base,
snvs_hp_rtc_datetime_t datetime 
)
Parameters
baseSNVS peripheral base address
datetimePointer to the structure where the date and time details are stored.
status_t SNVS_HP_RTC_SetAlarm ( SNVS_Type *  base,
const snvs_hp_rtc_datetime_t alarmTime 
)

The function sets the RTC 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.

Parameters
baseSNVS peripheral base address
alarmTimePointer to the structure where the alarm time is stored.
Returns
kStatus_Success: success in setting the SNVS RTC alarm kStatus_InvalidArgument: Error because the alarm datetime format is incorrect kStatus_Fail: Error because the alarm time has already passed
void SNVS_HP_RTC_GetAlarm ( SNVS_Type *  base,
snvs_hp_rtc_datetime_t datetime 
)
Parameters
baseSNVS peripheral base address
datetimePointer to the structure where the alarm date and time details are stored.
void SNVS_HP_RTC_TimeSynchronize ( SNVS_Type *  base)
Parameters
baseSNVS peripheral base address
void SNVS_HP_RTC_EnableInterrupts ( SNVS_Type *  base,
uint32_t  mask 
)
Parameters
baseSNVS peripheral base address
maskThe interrupts to enable. This is a logical OR of members of the enumeration ::snvs_interrupt_enable_t
void SNVS_HP_RTC_DisableInterrupts ( SNVS_Type *  base,
uint32_t  mask 
)
Parameters
baseSNVS peripheral base address
maskThe interrupts to enable. This is a logical OR of members of the enumeration ::snvs_interrupt_enable_t
uint32_t SNVS_HP_RTC_GetEnabledInterrupts ( SNVS_Type *  base)
Parameters
baseSNVS peripheral base address
Returns
The enabled interrupts. This is the logical OR of members of the enumeration ::snvs_interrupt_enable_t
uint32_t SNVS_HP_RTC_GetStatusFlags ( SNVS_Type *  base)
Parameters
baseSNVS peripheral base address
Returns
The status flags. This is the logical OR of members of the enumeration ::snvs_status_flags_t
void SNVS_HP_RTC_ClearStatusFlags ( SNVS_Type *  base,
uint32_t  mask 
)
Parameters
baseSNVS peripheral base address
maskThe status flags to clear. This is a logical OR of members of the enumeration ::snvs_status_flags_t
static void SNVS_HP_RTC_StartTimer ( SNVS_Type *  base)
inlinestatic
Parameters
baseSNVS peripheral base address
static void SNVS_HP_RTC_StopTimer ( SNVS_Type *  base)
inlinestatic
Parameters
baseSNVS peripheral base address

Variable Documentation

uint16_t snvs_hp_rtc_datetime_t::year
uint8_t snvs_hp_rtc_datetime_t::month
uint8_t snvs_hp_rtc_datetime_t::day
uint8_t snvs_hp_rtc_datetime_t::hour
uint8_t snvs_hp_rtc_datetime_t::minute
uint8_t snvs_hp_rtc_datetime_t::second