10#define _FSL_SNVS_HP_H_
12#include "fsl_common.h"
25#define FSL_SNVS_HP_DRIVER_VERSION (MAKE_VERSION(2, 3, 2))
45#ifndef SNVS_HPSVSR_SV0_MASK
46#define SNVS_HPSVSR_SV0_MASK SNVS_HPSVSR_CAAM_MASK
49#ifndef SNVS_HPSVSR_SV1_MASK
50#define SNVS_HPSVSR_SV1_MASK SNVS_HPSVSR_JTAGC_MASK
53#ifndef SNVS_HPSVSR_SV2_MASK
54#define SNVS_HPSVSR_SV2_MASK SNVS_HPSVSR_WDOG2_MASK
57#ifndef SNVS_HPSVSR_SV4_MASK
58#define SNVS_HPSVSR_SV4_MASK SNVS_HPSVSR_SRC_MASK
61#ifndef SNVS_HPSVSR_SV5_MASK
62#define SNVS_HPSVSR_SV5_MASK SNVS_HPSVSR_OCOTP_MASK
77#if defined(SNVS_HPSVSR_SV3_MASK)
78 kSNVS_Violation3Flag = SNVS_HPSVSR_SV3_MASK,
90#define SNVS_MAKE_HP_SV_FLAG(x) (1U << (SNVS_HPSVSR_SV0_SHIFT + (x)))
139#if defined(__cplusplus)
244#if (defined(FSL_FEATURE_SNVS_HAS_SRTC) && (FSL_FEATURE_SNVS_HAS_SRTC > 0))
250void SNVS_HP_RTC_TimeSynchronize(
SNVS_Type *base);
267static inline void SNVS_HP_RTC_EnableInterrupts(
SNVS_Type *base, uint32_t mask)
279static inline void SNVS_HP_RTC_DisableInterrupts(
SNVS_Type *base, uint32_t mask)
318static inline void SNVS_HP_RTC_ClearStatusFlags(
SNVS_Type *base, uint32_t mask)
335static inline void SNVS_HP_RTC_StartTimer(
SNVS_Type *base)
337 base->HPCR |= SNVS_HPCR_RTC_EN_MASK;
338 while (0U == (base->HPCR & SNVS_HPCR_RTC_EN_MASK))
348static inline void SNVS_HP_RTC_StopTimer(
SNVS_Type *base)
350 base->HPCR &= ~SNVS_HPCR_RTC_EN_MASK;
351 while ((base->HPCR & SNVS_HPCR_RTC_EN_MASK) != 0U)
364static inline void SNVS_HP_EnableMasterKeySelection(
SNVS_Type *base,
bool enable)
368 base->HPCOMR |= SNVS_HPCOMR_MKS_EN_MASK;
372 base->HPCOMR &= (~SNVS_HPCOMR_MKS_EN_MASK);
381static inline void SNVS_HP_ProgramZeroizableMasterKey(
SNVS_Type *base)
383 base->HPCOMR |= SNVS_HPCOMR_PROG_ZMK_MASK;
399static inline void SNVS_HP_ChangeSSMState(
SNVS_Type *base)
401 base->HPCOMR |= SNVS_HPCOMR_SSM_ST_MASK;
415static inline void SNVS_HP_SetSoftwareFatalSecurityViolation(
SNVS_Type *base)
417 base->HPCOMR |= SNVS_HPCOMR_SW_FSV_MASK;
430static inline void SNVS_HP_SetSoftwareSecurityViolation(
SNVS_Type *base)
432 base->HPCOMR |= SNVS_HPCOMR_SW_SV_MASK;
443 return (
snvs_hp_ssm_state_t)((uint32_t)((base->HPSR & SNVS_HPSR_SSM_STATE_MASK) >> SNVS_HPSR_SSM_STATE_SHIFT));
453static inline void SNVS_HP_ResetLP(
SNVS_Type *base)
455 base->HPCOMR |= SNVS_HPCOMR_LP_SWR_MASK;
469static inline void SNVS_HP_EnableHighAssuranceCounter(
SNVS_Type *base,
bool enable)
473 base->HPCOMR |= SNVS_HPCOMR_HAC_EN_MASK;
477 base->HPCOMR &= (~SNVS_HPCOMR_HAC_EN_MASK);
487static inline void SNVS_HP_StartHighAssuranceCounter(
SNVS_Type *base,
bool start)
491 base->HPCOMR &= (~SNVS_HPCOMR_HAC_STOP_MASK);
495 base->HPCOMR |= SNVS_HPCOMR_HAC_STOP_MASK;
505static inline void SNVS_HP_SetHighAssuranceCounterInitialValue(
SNVS_Type *base, uint32_t value)
507 base->HPHACIVR = value;
517static inline void SNVS_HP_LoadHighAssuranceCounter(
SNVS_Type *base)
519 base->HPCOMR |= SNVS_HPCOMR_HAC_LOAD_MASK;
528static inline uint32_t SNVS_HP_GetHighAssuranceCounter(
SNVS_Type *base)
545static inline void SNVS_HP_ClearHighAssuranceCounter(
SNVS_Type *base)
547 base->HPCOMR |= SNVS_HPCOMR_HAC_CLEAR_MASK;
558static inline void SNVS_HP_LockHighAssuranceCounter(
SNVS_Type *base)
560 base->HPLR |= SNVS_HPLR_HAC_L_MASK;
574static inline uint32_t SNVS_HP_GetStatusFlags(
SNVS_Type *base)
591static inline void SNVS_HP_ClearStatusFlags(
SNVS_Type *base, uint32_t mask)
605static inline uint32_t SNVS_HP_GetSecurityViolationStatusFlags(
SNVS_Type *base)
628static inline void SNVS_HP_ClearSecurityViolationStatusFlags(
SNVS_Type *base, uint32_t mask)
633#if defined(FSL_FEATURE_SNVS_HAS_SET_LOCK) && (FSL_FEATURE_SNVS_HAS_SET_LOCK > 0)
643#if defined(__cplusplus)
int32_t status_t
Type used for all status and error return values.
Definition: fsl_common.h:225
struct _snvs_hp_rtc_datetime snvs_hp_rtc_datetime_t
Structure is used to hold the date and time.
struct _snvs_hp_rtc_config snvs_hp_rtc_config_t
SNVS config structure.
status_t SNVS_HP_RTC_SetAlarm(SNVS_Type *base, const snvs_hp_rtc_datetime_t *alarmTime)
Sets the SNVS RTC alarm time.
Definition: fsl_snvs_hp.c:412
enum _snvs_hp_status_flags snvs_hp_status_flags_t
List of SNVS flags.
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.
Definition: fsl_snvs_hp.c:354
enum _snvs_hp_sv_status_flags snvs_hp_sv_status_flags_t
List of SNVS security violation flags.
_snvs_hp_interrupts
List of SNVS interrupts.
Definition: fsl_snvs_hp.h:30
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.
Definition: fsl_snvs_hp.c:277
void SNVS_HP_RTC_GetAlarm(SNVS_Type *base, snvs_hp_rtc_datetime_t *datetime)
Returns the SNVS RTC alarm time.
Definition: fsl_snvs_hp.c:457
void SNVS_HP_Deinit(SNVS_Type *base)
Deinitialize the SNVS.
Definition: fsl_snvs_hp.c:260
_snvs_hp_status_flags
List of SNVS flags.
Definition: fsl_snvs_hp.h:37
enum _snvs_hp_interrupts snvs_hp_interrupts_t
List of SNVS interrupts.
uint32_t SNVS_HP_RTC_GetEnabledInterrupts(SNVS_Type *base)
Gets the enabled SNVS interrupts.
Definition: fsl_snvs_hp.c:526
_snvs_hp_ssm_state
List of SNVS Security State Machine State.
Definition: fsl_snvs_hp.h:124
void SNVS_HP_RTC_Deinit(SNVS_Type *base)
Stops the RTC and SRTC timers.
Definition: fsl_snvs_hp.c:299
void SNVS_HP_RTC_GetDefaultConfig(snvs_hp_rtc_config_t *config)
Fills in the SNVS config struct with the default settings.
Definition: fsl_snvs_hp.c:317
void SNVS_HP_Init(SNVS_Type *base)
Initialize the SNVS.
Definition: fsl_snvs_hp.c:246
_snvs_hp_sv_status_flags
List of SNVS security violation flags.
Definition: fsl_snvs_hp.h:67
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.
Definition: fsl_snvs_hp.c:391
enum _snvs_hp_ssm_state snvs_hp_ssm_state_t
List of SNVS Security State Machine State.
uint32_t SNVS_HP_RTC_GetStatusFlags(SNVS_Type *base)
Gets the SNVS status flags.
Definition: fsl_snvs_hp.c:501
@ kSNVS_RTC_AlarmInterrupt
Definition: fsl_snvs_hp.h:31
@ kSNVS_RTC_PeriodicInterrupt
Definition: fsl_snvs_hp.h:32
@ kSNVS_RTC_PeriodicInterruptFlag
Definition: fsl_snvs_hp.h:39
@ kSNVS_RTC_AlarmInterruptFlag
Definition: fsl_snvs_hp.h:38
@ kSNVS_ZMK_ZeroFlag
Definition: fsl_snvs_hp.h:40
@ kSNVS_OTPMK_ZeroFlag
Definition: fsl_snvs_hp.h:41
@ kSNVS_SSMSoftFail
Definition: fsl_snvs_hp.h:127
@ kSNVS_SSMSecure
Definition: fsl_snvs_hp.h:132
@ kSNVS_SSMInitInter
Definition: fsl_snvs_hp.h:128
@ kSNVS_SSMNonSecure
Definition: fsl_snvs_hp.h:130
@ kSNVS_SSMTrusted
Definition: fsl_snvs_hp.h:131
@ kSNVS_SSMCheck
Definition: fsl_snvs_hp.h:129
@ kSNVS_SSMInit
Definition: fsl_snvs_hp.h:125
@ kSNVS_SSMHardFail
Definition: fsl_snvs_hp.h:126
@ kSNVS_Violation4Flag
Definition: fsl_snvs_hp.h:80
@ kSNVS_Violation0Flag
Definition: fsl_snvs_hp.h:74
@ kSNVS_Violation1Flag
Definition: fsl_snvs_hp.h:75
@ kSNVS_SoftwareViolationFlag
Definition: fsl_snvs_hp.h:73
@ kSNVS_ZMK_EccFailFlag
Definition: fsl_snvs_hp.h:69
@ kSNVS_LP_ViolationFlag
Definition: fsl_snvs_hp.h:68
@ kSNVS_FatalSoftwareViolationFlag
Definition: fsl_snvs_hp.h:72
@ kSNVS_LP_SoftwareViolationFlag
Definition: fsl_snvs_hp.h:71
@ kSNVS_Violation5Flag
Definition: fsl_snvs_hp.h:81
@ kSNVS_Violation2Flag
Definition: fsl_snvs_hp.h:76
Definition: MIMXRT1052.h:41032
SNVS config structure.
Definition: fsl_snvs_hp.h:113
uint32_t rtcCalValue
Definition: fsl_snvs_hp.h:116
bool rtcCalEnable
Definition: fsl_snvs_hp.h:114
uint32_t periodicInterruptFreq
Definition: fsl_snvs_hp.h:118
Structure is used to hold the date and time.
Definition: fsl_snvs_hp.h:94
uint8_t hour
Definition: fsl_snvs_hp.h:98
uint8_t minute
Definition: fsl_snvs_hp.h:99
uint8_t day
Definition: fsl_snvs_hp.h:97
uint8_t month
Definition: fsl_snvs_hp.h:96
uint16_t year
Definition: fsl_snvs_hp.h:95
uint8_t second
Definition: fsl_snvs_hp.h:100
Definition: deflate.c:114