1 /*
2 * Copyright (c) 2016, Freescale Semiconductor, Inc.
3 * Copyright 2017-2020, NXP
4 * All rights reserved.
5 *
6 * SPDX-License-Identifier: BSD-3-Clause
7 */
8
9 #ifndef _FSL_SNVS_HP_H_
10 #define _FSL_SNVS_HP_H_
11
12 #include "fsl_common.h"
13
14 /*!
15 * @addtogroup snvs_hp
16 * @{
17 */
18
19 /*******************************************************************************
20 * Definitions
21 ******************************************************************************/
22
23 /*! @name Driver version */
24 /*@{*/
25 #define FSL_SNVS_HP_DRIVER_VERSION (MAKE_VERSION(2, 3, 0)) /*!< Version 2.3.0 */
26 /*@}*/
27
28 /*! @brief List of SNVS interrupts */
29 typedef enum _snvs_hp_interrupts
30 {
31 kSNVS_RTC_AlarmInterrupt = SNVS_HPCR_HPTA_EN_MASK, /*!< RTC time alarm */
32 kSNVS_RTC_PeriodicInterrupt = SNVS_HPCR_PI_EN_MASK, /*!< RTC periodic interrupt */
33 } snvs_hp_interrupts_t;
34
35 /*! @brief List of SNVS flags */
36 typedef enum _snvs_hp_status_flags
37 {
38 kSNVS_RTC_AlarmInterruptFlag = SNVS_HPSR_HPTA_MASK, /*!< RTC time alarm flag */
39 kSNVS_RTC_PeriodicInterruptFlag = SNVS_HPSR_PI_MASK, /*!< RTC periodic interrupt flag */
40 kSNVS_ZMK_ZeroFlag = (int)SNVS_HPSR_ZMK_ZERO_MASK, /*!< The ZMK is zero */
41 kSNVS_OTPMK_ZeroFlag = SNVS_HPSR_OTPMK_ZERO_MASK, /*!< The OTPMK is zero */
42 } snvs_hp_status_flags_t;
43
44 /* Re-map Security Violation for RT11xx specific violation*/
45 #ifndef SNVS_HPSVSR_SV0_MASK
46 #define SNVS_HPSVSR_SV0_MASK SNVS_HPSVSR_CAAM_MASK
47 #endif
48
49 #ifndef SNVS_HPSVSR_SV1_MASK
50 #define SNVS_HPSVSR_SV1_MASK SNVS_HPSVSR_JTAGC_MASK
51 #endif
52
53 #ifndef SNVS_HPSVSR_SV2_MASK
54 #define SNVS_HPSVSR_SV2_MASK SNVS_HPSVSR_WDOG2_MASK
55 #endif
56
57 #ifndef SNVS_HPSVSR_SV4_MASK
58 #define SNVS_HPSVSR_SV4_MASK SNVS_HPSVSR_SRC_MASK
59 #endif
60
61 #ifndef SNVS_HPSVSR_SV5_MASK
62 #define SNVS_HPSVSR_SV5_MASK SNVS_HPSVSR_OCOTP_MASK
63 #endif
64
65 /*! @brief List of SNVS security violation flags */
66 typedef enum _snvs_hp_sv_status_flags
67 {
68 kSNVS_LP_ViolationFlag = SNVS_HPSVSR_SW_LPSV_MASK, /*!< Low Power section Security Violation */
69 kSNVS_ZMK_EccFailFlag = SNVS_HPSVSR_ZMK_ECC_FAIL_MASK, /*!< Zeroizable Master Key Error Correcting Code Check
70 Failure */
71 kSNVS_LP_SoftwareViolationFlag = SNVS_HPSVSR_SW_LPSV_MASK, /*!< LP Software Security Violation */
72 kSNVS_FatalSoftwareViolationFlag = SNVS_HPSVSR_SW_FSV_MASK, /*!< Software Fatal Security Violation */
73 kSNVS_SoftwareViolationFlag = SNVS_HPSVSR_SW_SV_MASK, /*!< Software Security Violation */
74 kSNVS_Violation0Flag = SNVS_HPSVSR_SV0_MASK, /*!< Security Violation 0 */
75 kSNVS_Violation1Flag = SNVS_HPSVSR_SV1_MASK, /*!< Security Violation 1 */
76 kSNVS_Violation2Flag = SNVS_HPSVSR_SV2_MASK, /*!< Security Violation 2 */
77 #if defined(SNVS_HPSVSR_SV3_MASK)
78 kSNVS_Violation3Flag = SNVS_HPSVSR_SV3_MASK, /*!< Security Violation 3 */
79 #endif /* SNVS_HPSVSR_SV3_MASK */
80 kSNVS_Violation4Flag = SNVS_HPSVSR_SV4_MASK, /*!< Security Violation 4 */
81 kSNVS_Violation5Flag = SNVS_HPSVSR_SV5_MASK, /*!< Security Violation 5 */
82 } snvs_hp_sv_status_flags_t;
83
84 /*!
85 * @brief Macro to make security violation flag
86 *
87 * Macro help to make security violation flag kSNVS_Violation0Flag to kSNVS_Violation5Flag,
88 * For example, SNVS_MAKE_HP_SV_FLAG(0) is kSNVS_Violation0Flag.
89 */
90 #define SNVS_MAKE_HP_SV_FLAG(x) (1U << (SNVS_HPSVSR_SV0_SHIFT + (x)))
91
92 /*! @brief Structure is used to hold the date and time */
93 typedef struct _snvs_hp_rtc_datetime
94 {
95 uint16_t year; /*!< Range from 1970 to 2099.*/
96 uint8_t month; /*!< Range from 1 to 12.*/
97 uint8_t day; /*!< Range from 1 to 31 (depending on month).*/
98 uint8_t hour; /*!< Range from 0 to 23.*/
99 uint8_t minute; /*!< Range from 0 to 59.*/
100 uint8_t second; /*!< Range from 0 to 59.*/
101 } snvs_hp_rtc_datetime_t;
102
103 /*!
104 * @brief SNVS config structure
105 *
106 * This structure holds the configuration settings for the SNVS peripheral. To initialize this
107 * structure to reasonable defaults, call the SNVS_GetDefaultConfig() function and pass a
108 * pointer to your config structure instance.
109 *
110 * The config struct can be made const so it resides in flash
111 */
112 typedef struct _snvs_hp_rtc_config
113 {
114 bool rtcCalEnable; /*!< true: RTC calibration mechanism is enabled;
115 false:No calibration is used */
116 uint32_t rtcCalValue; /*!< Defines signed calibration value for nonsecure RTC;
117 This is a 5-bit 2's complement value, range from -16 to +15 */
118 uint32_t periodicInterruptFreq; /*!< Defines frequency of the periodic interrupt;
119 Range from 0 to 15 */
120 } snvs_hp_rtc_config_t;
121
122 /*! @brief List of SNVS Security State Machine State */
123 typedef enum _snvs_hp_ssm_state
124 {
125 kSNVS_SSMInit = 0x00, /*!< Init */
126 kSNVS_SSMHardFail = 0x01, /*!< Hard Fail */
127 kSNVS_SSMSoftFail = 0x03, /*!< Soft Fail */
128 kSNVS_SSMInitInter = 0x08, /*!< Init Intermediate (transition state between Init and Check) */
129 kSNVS_SSMCheck = 0x09, /*!< Check */
130 kSNVS_SSMNonSecure = 0x0B, /*!< Non-Secure */
131 kSNVS_SSMTrusted = 0x0D, /*!< Trusted */
132 kSNVS_SSMSecure = 0x0F, /*!< Secure */
133 } snvs_hp_ssm_state_t;
134
135 /*******************************************************************************
136 * API
137 ******************************************************************************/
138
139 #if defined(__cplusplus)
140 extern "C" {
141 #endif
142
143 /*!
144 * @name Initialization and deinitialization
145 * @{
146 */
147
148 /*!
149 * @brief Initialize the SNVS.
150 *
151 * @note This API should be called at the beginning of the application using the SNVS driver.
152 *
153 * @param base SNVS peripheral base address
154 */
155 void SNVS_HP_Init(SNVS_Type *base);
156
157 /*!
158 * @brief Deinitialize the SNVS.
159 *
160 * @param base SNVS peripheral base address
161 */
162 void SNVS_HP_Deinit(SNVS_Type *base);
163
164 /*!
165 * @brief Ungates the SNVS clock and configures the peripheral for basic operation.
166 *
167 * @note This API should be called at the beginning of the application using the SNVS driver.
168 *
169 * @param base SNVS peripheral base address
170 * @param config Pointer to the user's SNVS configuration structure.
171 */
172 void SNVS_HP_RTC_Init(SNVS_Type *base, const snvs_hp_rtc_config_t *config);
173
174 /*!
175 * @brief Stops the RTC and SRTC timers.
176 *
177 * @param base SNVS peripheral base address
178 */
179 void SNVS_HP_RTC_Deinit(SNVS_Type *base);
180
181 /*!
182 * @brief Fills in the SNVS config struct with the default settings.
183 *
184 * The default values are as follows.
185 * @code
186 * config->rtccalenable = false;
187 * config->rtccalvalue = 0U;
188 * config->PIFreq = 0U;
189 * @endcode
190 * @param config Pointer to the user's SNVS configuration structure.
191 */
192 void SNVS_HP_RTC_GetDefaultConfig(snvs_hp_rtc_config_t *config);
193
194 /*! @}*/
195
196 /*!
197 * @name Non secure RTC current Time & Alarm
198 * @{
199 */
200
201 /*!
202 * @brief Sets the SNVS RTC date and time according to the given time structure.
203 *
204 * @param base SNVS peripheral base address
205 * @param datetime Pointer to the structure where the date and time details are stored.
206 *
207 * @return kStatus_Success: Success in setting the time and starting the SNVS RTC
208 * kStatus_InvalidArgument: Error because the datetime format is incorrect
209 */
210 status_t SNVS_HP_RTC_SetDatetime(SNVS_Type *base, const snvs_hp_rtc_datetime_t *datetime);
211
212 /*!
213 * @brief Gets the SNVS RTC time and stores it in the given time structure.
214 *
215 * @param base SNVS peripheral base address
216 * @param datetime Pointer to the structure where the date and time details are stored.
217 */
218 void SNVS_HP_RTC_GetDatetime(SNVS_Type *base, snvs_hp_rtc_datetime_t *datetime);
219
220 /*!
221 * @brief Sets the SNVS RTC alarm time.
222 *
223 * The function sets the RTC alarm. It also checks whether the specified alarm time
224 * is greater than the present time. If not, the function does not set the alarm
225 * and returns an error.
226 *
227 * @param base SNVS peripheral base address
228 * @param alarmTime Pointer to the structure where the alarm time is stored.
229 *
230 * @return kStatus_Success: success in setting the SNVS RTC alarm
231 * kStatus_InvalidArgument: Error because the alarm datetime format is incorrect
232 * kStatus_Fail: Error because the alarm time has already passed
233 */
234 status_t SNVS_HP_RTC_SetAlarm(SNVS_Type *base, const snvs_hp_rtc_datetime_t *alarmTime);
235
236 /*!
237 * @brief Returns the SNVS RTC alarm time.
238 *
239 * @param base SNVS peripheral base address
240 * @param datetime Pointer to the structure where the alarm date and time details are stored.
241 */
242 void SNVS_HP_RTC_GetAlarm(SNVS_Type *base, snvs_hp_rtc_datetime_t *datetime);
243
244 #if (defined(FSL_FEATURE_SNVS_HAS_SRTC) && (FSL_FEATURE_SNVS_HAS_SRTC > 0))
245 /*!
246 * @brief The function synchronizes RTC counter value with SRTC.
247 *
248 * @param base SNVS peripheral base address
249 */
250 void SNVS_HP_RTC_TimeSynchronize(SNVS_Type *base);
251 #endif /* FSL_FEATURE_SNVS_HAS_SRTC */
252
253 /*! @}*/
254
255 /*!
256 * @name Interrupt Interface
257 * @{
258 */
259
260 /*!
261 * @brief Enables the selected SNVS interrupts.
262 *
263 * @param base SNVS peripheral base address
264 * @param mask The interrupts to enable. This is a logical OR of members of the
265 * enumeration :: _snvs_hp_interrupts_t
266 */
SNVS_HP_RTC_EnableInterrupts(SNVS_Type * base,uint32_t mask)267 static inline void SNVS_HP_RTC_EnableInterrupts(SNVS_Type *base, uint32_t mask)
268 {
269 base->HPCR |= mask;
270 }
271
272 /*!
273 * @brief Disables the selected SNVS interrupts.
274 *
275 * @param base SNVS peripheral base address
276 * @param mask The interrupts to disable. This is a logical OR of members of the
277 * enumeration :: _snvs_hp_interrupts_t
278 */
SNVS_HP_RTC_DisableInterrupts(SNVS_Type * base,uint32_t mask)279 static inline void SNVS_HP_RTC_DisableInterrupts(SNVS_Type *base, uint32_t mask)
280 {
281 base->HPCR &= ~mask;
282 }
283
284 /*!
285 * @brief Gets the enabled SNVS interrupts.
286 *
287 * @param base SNVS peripheral base address
288 *
289 * @return The enabled interrupts. This is the logical OR of members of the
290 * enumeration :: _snvs_hp_interrupts_t
291 */
292 uint32_t SNVS_HP_RTC_GetEnabledInterrupts(SNVS_Type *base);
293
294 /*! @}*/
295
296 /*!
297 * @name Status Interface
298 * @{
299 */
300
301 /*!
302 * @brief Gets the SNVS status flags.
303 *
304 * @param base SNVS peripheral base address
305 *
306 * @return The status flags. This is the logical OR of members of the
307 * enumeration :: _snvs_hp_status_flags_t
308 */
309 uint32_t SNVS_HP_RTC_GetStatusFlags(SNVS_Type *base);
310
311 /*!
312 * @brief Clears the SNVS status flags.
313 *
314 * @param base SNVS peripheral base address
315 * @param mask The status flags to clear. This is a logical OR of members of the
316 * enumeration :: _snvs_hp_status_flags_t
317 */
SNVS_HP_RTC_ClearStatusFlags(SNVS_Type * base,uint32_t mask)318 static inline void SNVS_HP_RTC_ClearStatusFlags(SNVS_Type *base, uint32_t mask)
319 {
320 base->HPSR |= mask;
321 }
322
323 /*! @}*/
324
325 /*!
326 * @name Timer Start and Stop
327 * @{
328 */
329
330 /*!
331 * @brief Starts the SNVS RTC time counter.
332 *
333 * @param base SNVS peripheral base address
334 */
SNVS_HP_RTC_StartTimer(SNVS_Type * base)335 static inline void SNVS_HP_RTC_StartTimer(SNVS_Type *base)
336 {
337 base->HPCR |= SNVS_HPCR_RTC_EN_MASK;
338 while (0U == (base->HPCR & SNVS_HPCR_RTC_EN_MASK))
339 {
340 }
341 }
342
343 /*!
344 * @brief Stops the SNVS RTC time counter.
345 *
346 * @param base SNVS peripheral base address
347 */
SNVS_HP_RTC_StopTimer(SNVS_Type * base)348 static inline void SNVS_HP_RTC_StopTimer(SNVS_Type *base)
349 {
350 base->HPCR &= ~SNVS_HPCR_RTC_EN_MASK;
351 while ((base->HPCR & SNVS_HPCR_RTC_EN_MASK) != 0U)
352 {
353 }
354 }
355
356 /*! @}*/
357
358 /*!
359 * @brief Enable or disable master key selection.
360 *
361 * @param base SNVS peripheral base address
362 * @param enable Pass true to enable, false to disable.
363 */
SNVS_HP_EnableMasterKeySelection(SNVS_Type * base,bool enable)364 static inline void SNVS_HP_EnableMasterKeySelection(SNVS_Type *base, bool enable)
365 {
366 if (enable)
367 {
368 base->HPCOMR |= SNVS_HPCOMR_MKS_EN_MASK;
369 }
370 else
371 {
372 base->HPCOMR &= (~SNVS_HPCOMR_MKS_EN_MASK);
373 }
374 }
375
376 /*!
377 * @brief Trigger to program Zeroizable Master Key.
378 *
379 * @param base SNVS peripheral base address
380 */
SNVS_HP_ProgramZeroizableMasterKey(SNVS_Type * base)381 static inline void SNVS_HP_ProgramZeroizableMasterKey(SNVS_Type *base)
382 {
383 base->HPCOMR |= SNVS_HPCOMR_PROG_ZMK_MASK;
384 }
385
386 /*!
387 * @brief Trigger SSM State Transition
388 *
389 * Trigger state transition of the system security monitor (SSM). It results only
390 * the following transitions of the SSM:
391 * - Check State -> Non-Secure (when Non-Secure Boot and not in Fab Configuration)
392 * - Check State --> Trusted (when Secure Boot or in Fab Configuration )
393 * - Trusted State --> Secure
394 * - Secure State --> Trusted
395 * - Soft Fail --> Non-Secure
396 *
397 * @param base SNVS peripheral base address
398 */
SNVS_HP_ChangeSSMState(SNVS_Type * base)399 static inline void SNVS_HP_ChangeSSMState(SNVS_Type *base)
400 {
401 base->HPCOMR |= SNVS_HPCOMR_SSM_ST_MASK;
402 }
403
404 /*!
405 * @brief Trigger Software Fatal Security Violation
406 *
407 * The result SSM state transition is:
408 * - Check State -> Soft Fail
409 * - Non-Secure State -> Soft Fail
410 * - Trusted State -> Soft Fail
411 * - Secure State -> Soft Fail
412 *
413 * @param base SNVS peripheral base address
414 */
SNVS_HP_SetSoftwareFatalSecurityViolation(SNVS_Type * base)415 static inline void SNVS_HP_SetSoftwareFatalSecurityViolation(SNVS_Type *base)
416 {
417 base->HPCOMR |= SNVS_HPCOMR_SW_FSV_MASK;
418 }
419
420 /*!
421 * @brief Trigger Software Security Violation
422 *
423 * The result SSM state transition is:
424 * - Check -> Non-Secure
425 * - Trusted -> Soft Fail
426 * - Secure -> Soft Fail
427 *
428 * @param base SNVS peripheral base address
429 */
SNVS_HP_SetSoftwareSecurityViolation(SNVS_Type * base)430 static inline void SNVS_HP_SetSoftwareSecurityViolation(SNVS_Type *base)
431 {
432 base->HPCOMR |= SNVS_HPCOMR_SW_SV_MASK;
433 }
434
435 /*!
436 * @brief Get current SSM State
437 *
438 * @param base SNVS peripheral base address
439 * @return Current SSM state
440 */
SNVS_HP_GetSSMState(SNVS_Type * base)441 static inline snvs_hp_ssm_state_t SNVS_HP_GetSSMState(SNVS_Type *base)
442 {
443 return (snvs_hp_ssm_state_t)((uint32_t)((base->HPSR & SNVS_HPSR_SSM_STATE_MASK) >> SNVS_HPSR_SSM_STATE_SHIFT));
444 }
445
446 /*!
447 * @brief Reset the SNVS LP section.
448 *
449 * Reset the LP section except SRTC and Time alarm.
450 *
451 * @param base SNVS peripheral base address
452 */
SNVS_HP_ResetLP(SNVS_Type * base)453 static inline void SNVS_HP_ResetLP(SNVS_Type *base)
454 {
455 base->HPCOMR |= SNVS_HPCOMR_LP_SWR_MASK;
456 }
457
458 /*!
459 * @name High Assurance Counter (HAC)
460 * @{
461 */
462
463 /*!
464 * @brief Enable or disable the High Assurance Counter (HAC)
465 *
466 * @param base SNVS peripheral base address
467 * @param enable Pass true to enable, false to disable.
468 */
SNVS_HP_EnableHighAssuranceCounter(SNVS_Type * base,bool enable)469 static inline void SNVS_HP_EnableHighAssuranceCounter(SNVS_Type *base, bool enable)
470 {
471 if (enable)
472 {
473 base->HPCOMR |= SNVS_HPCOMR_HAC_EN_MASK;
474 }
475 else
476 {
477 base->HPCOMR &= (~SNVS_HPCOMR_HAC_EN_MASK);
478 }
479 }
480
481 /*!
482 * @brief Start or stop the High Assurance Counter (HAC)
483 *
484 * @param base SNVS peripheral base address
485 * @param start Pass true to start, false to stop.
486 */
SNVS_HP_StartHighAssuranceCounter(SNVS_Type * base,bool start)487 static inline void SNVS_HP_StartHighAssuranceCounter(SNVS_Type *base, bool start)
488 {
489 if (start)
490 {
491 base->HPCOMR &= (~SNVS_HPCOMR_HAC_STOP_MASK);
492 }
493 else
494 {
495 base->HPCOMR |= SNVS_HPCOMR_HAC_STOP_MASK;
496 }
497 }
498
499 /*!
500 * @brief Set the High Assurance Counter (HAC) initialize value.
501 *
502 * @param base SNVS peripheral base address
503 * @param value The initial value to set.
504 */
SNVS_HP_SetHighAssuranceCounterInitialValue(SNVS_Type * base,uint32_t value)505 static inline void SNVS_HP_SetHighAssuranceCounterInitialValue(SNVS_Type *base, uint32_t value)
506 {
507 base->HPHACIVR = value;
508 }
509
510 /*!
511 * @brief Load the High Assurance Counter (HAC)
512 *
513 * This function loads the HAC initialize value to counter register.
514 *
515 * @param base SNVS peripheral base address
516 */
SNVS_HP_LoadHighAssuranceCounter(SNVS_Type * base)517 static inline void SNVS_HP_LoadHighAssuranceCounter(SNVS_Type *base)
518 {
519 base->HPCOMR |= SNVS_HPCOMR_HAC_LOAD_MASK;
520 }
521
522 /*!
523 * @brief Get the current High Assurance Counter (HAC) value
524 *
525 * @param base SNVS peripheral base address
526 * @return HAC currnet value.
527 */
SNVS_HP_GetHighAssuranceCounter(SNVS_Type * base)528 static inline uint32_t SNVS_HP_GetHighAssuranceCounter(SNVS_Type *base)
529 {
530 return base->HPHACR;
531 }
532
533 /*!
534 * @brief Clear the High Assurance Counter (HAC)
535 *
536 * This function can be called in a functional or soft fail state. When the HAC
537 * is enabled:
538 * - If the HAC is cleared in the soft fail state, the SSM transitions to the
539 * hard fail state immediately;
540 * - If the HAC is cleared in functional state, the SSM will transition to
541 * hard fail immediately after transitioning to soft fail.
542 *
543 * @param base SNVS peripheral base address
544 */
SNVS_HP_ClearHighAssuranceCounter(SNVS_Type * base)545 static inline void SNVS_HP_ClearHighAssuranceCounter(SNVS_Type *base)
546 {
547 base->HPCOMR |= SNVS_HPCOMR_HAC_CLEAR_MASK;
548 }
549
550 /*!
551 * @brief Lock the High Assurance Counter (HAC)
552 *
553 * Once locked, the HAC initialize value could not be changed, the HAC enable
554 * status could not be changed. This could only be unlocked by system reset.
555 *
556 * @param base SNVS peripheral base address
557 */
SNVS_HP_LockHighAssuranceCounter(SNVS_Type * base)558 static inline void SNVS_HP_LockHighAssuranceCounter(SNVS_Type *base)
559 {
560 base->HPLR |= SNVS_HPLR_HAC_L_MASK;
561 }
562
563 /*! @}*/
564
565 /*!
566 * @brief Get the SNVS HP status flags.
567 *
568 * The flags are returned as the OR'ed value f the
569 * enumeration :: _snvs_hp_status_flags_t.
570 *
571 * @param base SNVS peripheral base address
572 * @return The OR'ed value of status flags.
573 */
SNVS_HP_GetStatusFlags(SNVS_Type * base)574 static inline uint32_t SNVS_HP_GetStatusFlags(SNVS_Type *base)
575 {
576 return base->HPSR;
577 }
578
579 /*!
580 * @brief Clear the SNVS HP status flags.
581 *
582 * The flags to clear are passed in as the OR'ed value of the
583 * enumeration :: _snvs_hp_status_flags_t.
584 * Only these flags could be cleared using this API.
585 * - @ref kSNVS_RTC_PeriodicInterruptFlag
586 * - @ref kSNVS_RTC_AlarmInterruptFlag
587 *
588 * @param base SNVS peripheral base address
589 * @param mask OR'ed value of the flags to clear.
590 */
SNVS_HP_ClearStatusFlags(SNVS_Type * base,uint32_t mask)591 static inline void SNVS_HP_ClearStatusFlags(SNVS_Type *base, uint32_t mask)
592 {
593 base->HPSR = mask;
594 }
595
596 /*!
597 * @brief Get the SNVS HP security violation status flags.
598 *
599 * The flags are returned as the OR'ed value of the
600 * enumeration :: _snvs_hp_sv_status_flags_t.
601 *
602 * @param base SNVS peripheral base address
603 * @return The OR'ed value of security violation status flags.
604 */
SNVS_HP_GetSecurityViolationStatusFlags(SNVS_Type * base)605 static inline uint32_t SNVS_HP_GetSecurityViolationStatusFlags(SNVS_Type *base)
606 {
607 return base->HPSVSR;
608 }
609
610 /*!
611 * @brief Clear the SNVS HP security violation status flags.
612 *
613 * The flags to clear are passed in as the OR'ed value of the
614 * enumeration :: _snvs_hp_sv_status_flags_t.
615 * Only these flags could be cleared using this API.
616 *
617 * - @ref kSNVS_ZMK_EccFailFlag
618 * - @ref kSNVS_Violation0Flag
619 * - @ref kSNVS_Violation1Flag
620 * - @ref kSNVS_Violation2Flag
621 * - kSNVS_Violation3Flag
622 * - @ref kSNVS_Violation4Flag
623 * - @ref kSNVS_Violation5Flag
624 *
625 * @param base SNVS peripheral base address
626 * @param mask OR'ed value of the flags to clear.
627 */
SNVS_HP_ClearSecurityViolationStatusFlags(SNVS_Type * base,uint32_t mask)628 static inline void SNVS_HP_ClearSecurityViolationStatusFlags(SNVS_Type *base, uint32_t mask)
629 {
630 base->HPSVSR = mask;
631 }
632
633 #if defined(FSL_FEATURE_SNVS_HAS_SET_LOCK) && (FSL_FEATURE_SNVS_HAS_SET_LOCK > 0)
634 /*!
635 * brief Set SNVS HP Set locks.
636 *
637 * param base SNVS peripheral base address
638 *
639 */
640 void SNVS_HP_SetLocks(SNVS_Type *base);
641 #endif /* FSL_FEATURE_SNVS_HAS_SET_LOCK */
642
643 #if defined(__cplusplus)
644 }
645 #endif
646
647 /*! @}*/
648
649 #endif /* _FSL_SNVS_HP_H_ */
650