fsl_snvs_hp.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573
  1. /*
  2. * Copyright (c) 2016, Freescale Semiconductor, Inc.
  3. * Copyright 2017-2019, 2021 NXP
  4. * All rights reserved.
  5. *
  6. * SPDX-License-Identifier: BSD-3-Clause
  7. */
  8. #include "fsl_snvs_hp.h"
  9. /*******************************************************************************
  10. * Definitions
  11. ******************************************************************************/
  12. /* Component ID definition, used by tools. */
  13. #ifndef FSL_COMPONENT_ID
  14. #define FSL_COMPONENT_ID "platform.drivers.snvs_hp"
  15. #endif
  16. #define SECONDS_IN_A_DAY (86400U)
  17. #define SECONDS_IN_A_HOUR (3600U)
  18. #define SECONDS_IN_A_MINUTE (60U)
  19. #define DAYS_IN_A_YEAR (365U)
  20. #define YEAR_RANGE_START (1970U)
  21. #define YEAR_RANGE_END (2099U)
  22. #if !(defined(SNVS_HPSR_PI_MASK))
  23. #define SNVS_HPSR_PI_MASK (0x2U)
  24. #endif
  25. #if !(defined(SNVS_HPSR_HPTA_MASK))
  26. #define SNVS_HPSR_HPTA_MASK (0x1U)
  27. #endif
  28. /*******************************************************************************
  29. * Prototypes
  30. ******************************************************************************/
  31. /*!
  32. * @brief Checks whether the date and time passed in is valid
  33. *
  34. * @param datetime Pointer to structure where the date and time details are stored
  35. *
  36. * @return Returns false if the date & time details are out of range; true if in range
  37. */
  38. static bool SNVS_HP_CheckDatetimeFormat(const snvs_hp_rtc_datetime_t *datetime);
  39. /*!
  40. * @brief Converts time data from datetime to seconds
  41. *
  42. * @param datetime Pointer to datetime structure where the date and time details are stored
  43. *
  44. * @return The result of the conversion in seconds
  45. */
  46. static uint32_t SNVS_HP_ConvertDatetimeToSeconds(const snvs_hp_rtc_datetime_t *datetime);
  47. /*!
  48. * @brief Converts time data from seconds to a datetime structure
  49. *
  50. * @param seconds Seconds value that needs to be converted to datetime format
  51. * @param datetime Pointer to the datetime structure where the result of the conversion is stored
  52. */
  53. static void SNVS_HP_ConvertSecondsToDatetime(uint32_t seconds, snvs_hp_rtc_datetime_t *datetime);
  54. /*!
  55. * @brief Returns RTC time in seconds.
  56. *
  57. * This function is used internally to get actual RTC time in seconds.
  58. *
  59. * @param base SNVS peripheral base address
  60. *
  61. * @return RTC time in seconds
  62. */
  63. static uint32_t SNVS_HP_RTC_GetSeconds(SNVS_Type *base);
  64. #if (!(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && \
  65. defined(SNVS_HP_CLOCKS))
  66. /*!
  67. * @brief Get the SNVS instance from peripheral base address.
  68. *
  69. * @param base SNVS peripheral base address.
  70. *
  71. * @return SNVS instance.
  72. */
  73. static uint32_t SNVS_HP_GetInstance(SNVS_Type *base);
  74. #endif /* FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL */
  75. /*******************************************************************************
  76. * Variables
  77. ******************************************************************************/
  78. #if (!(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && \
  79. defined(SNVS_HP_CLOCKS))
  80. /*! @brief Pointer to snvs_hp clock. */
  81. static const clock_ip_name_t s_snvsHpClock[] = SNVS_HP_CLOCKS;
  82. #endif /* FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL */
  83. /*******************************************************************************
  84. * Code
  85. ******************************************************************************/
  86. static bool SNVS_HP_CheckDatetimeFormat(const snvs_hp_rtc_datetime_t *datetime)
  87. {
  88. assert(datetime != NULL);
  89. /* Table of days in a month for a non leap year. First entry in the table is not used,
  90. * valid months start from 1
  91. */
  92. uint8_t daysPerMonth[] = {0U, 31U, 28U, 31U, 30U, 31U, 30U, 31U, 31U, 30U, 31U, 30U, 31U};
  93. /* Check year, month, hour, minute, seconds */
  94. if ((datetime->year < YEAR_RANGE_START) || (datetime->year > YEAR_RANGE_END) || (datetime->month > 12U) ||
  95. (datetime->month < 1U) || (datetime->hour >= 24U) || (datetime->minute >= 60U) || (datetime->second >= 60U))
  96. {
  97. /* If not correct then error*/
  98. return false;
  99. }
  100. /* Adjust the days in February for a leap year */
  101. if ((((datetime->year & 3U) == 0U) && (datetime->year % 100U != 0U)) || (datetime->year % 400U == 0U))
  102. {
  103. daysPerMonth[2] = 29U;
  104. }
  105. /* Check the validity of the day */
  106. if ((datetime->day > daysPerMonth[datetime->month]) || (datetime->day < 1U))
  107. {
  108. return false;
  109. }
  110. return true;
  111. }
  112. static uint32_t SNVS_HP_ConvertDatetimeToSeconds(const snvs_hp_rtc_datetime_t *datetime)
  113. {
  114. assert(datetime != NULL);
  115. /* Number of days from begin of the non Leap-year*/
  116. /* Number of days from begin of the non Leap-year*/
  117. uint16_t monthDays[] = {0U, 0U, 31U, 59U, 90U, 120U, 151U, 181U, 212U, 243U, 273U, 304U, 334U};
  118. uint32_t seconds;
  119. /* Compute number of days from 1970 till given year*/
  120. seconds = (((uint32_t)datetime->year - 1970U) * DAYS_IN_A_YEAR);
  121. /* Add leap year days */
  122. seconds += (((uint32_t)datetime->year / 4U) - (1970U / 4U));
  123. /* Add number of days till given month*/
  124. seconds += monthDays[datetime->month];
  125. /* Add days in given month. We subtract the current day as it is
  126. * represented in the hours, minutes and seconds field*/
  127. seconds += ((uint32_t)datetime->day - 1U);
  128. /* For leap year if month less than or equal to Febraury, decrement day counter*/
  129. if ((0U == (datetime->year & 3U)) && (datetime->month <= 2U))
  130. {
  131. seconds--;
  132. }
  133. seconds = (seconds * SECONDS_IN_A_DAY) + (datetime->hour * SECONDS_IN_A_HOUR) +
  134. (datetime->minute * SECONDS_IN_A_MINUTE) + datetime->second;
  135. return seconds;
  136. }
  137. static void SNVS_HP_ConvertSecondsToDatetime(uint32_t seconds, snvs_hp_rtc_datetime_t *datetime)
  138. {
  139. assert(datetime != NULL);
  140. uint32_t x;
  141. uint32_t secondsRemaining, days;
  142. uint16_t daysInYear;
  143. /* Table of days in a month for a non leap year. First entry in the table is not used,
  144. * valid months start from 1
  145. */
  146. uint8_t daysPerMonth[] = {0U, 31U, 28U, 31U, 30U, 31U, 30U, 31U, 31U, 30U, 31U, 30U, 31U};
  147. /* Start with the seconds value that is passed in to be converted to date time format */
  148. secondsRemaining = seconds;
  149. /* Calcuate the number of days, we add 1 for the current day which is represented in the
  150. * hours and seconds field
  151. */
  152. days = secondsRemaining / SECONDS_IN_A_DAY + 1U;
  153. /* Update seconds left*/
  154. secondsRemaining = secondsRemaining % SECONDS_IN_A_DAY;
  155. /* Calculate the datetime hour, minute and second fields */
  156. datetime->hour = (uint8_t)(secondsRemaining / SECONDS_IN_A_HOUR);
  157. secondsRemaining = secondsRemaining % SECONDS_IN_A_HOUR;
  158. datetime->minute = (uint8_t)(secondsRemaining / 60U);
  159. datetime->second = (uint8_t)(secondsRemaining % SECONDS_IN_A_MINUTE);
  160. /* Calculate year */
  161. daysInYear = DAYS_IN_A_YEAR;
  162. datetime->year = YEAR_RANGE_START;
  163. while (days > daysInYear)
  164. {
  165. /* Decrease day count by a year and increment year by 1 */
  166. days -= daysInYear;
  167. datetime->year++;
  168. /* Adjust the number of days for a leap year */
  169. if ((datetime->year & 3U) != 0U)
  170. {
  171. daysInYear = DAYS_IN_A_YEAR;
  172. }
  173. else
  174. {
  175. daysInYear = DAYS_IN_A_YEAR + 1U;
  176. }
  177. }
  178. /* Adjust the days in February for a leap year */
  179. if (0U == (datetime->year & 3U))
  180. {
  181. daysPerMonth[2] = 29U;
  182. }
  183. for (x = 1U; x <= 12U; x++)
  184. {
  185. if (days <= daysPerMonth[x])
  186. {
  187. datetime->month = (uint8_t)x;
  188. break;
  189. }
  190. else
  191. {
  192. days -= daysPerMonth[x];
  193. }
  194. }
  195. datetime->day = (uint8_t)days;
  196. }
  197. #if (!(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && \
  198. defined(SNVS_HP_CLOCKS))
  199. static uint32_t SNVS_HP_GetInstance(SNVS_Type *base)
  200. {
  201. return 0U;
  202. }
  203. #endif /* FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL */
  204. /*!
  205. * brief Initialize the SNVS.
  206. *
  207. * note This API should be called at the beginning of the application using the SNVS driver.
  208. *
  209. * param base SNVS peripheral base address
  210. */
  211. void SNVS_HP_Init(SNVS_Type *base)
  212. {
  213. #if (!(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && \
  214. defined(SNVS_HP_CLOCKS))
  215. uint32_t instance = SNVS_HP_GetInstance(base);
  216. CLOCK_EnableClock(s_snvsHpClock[instance]);
  217. #endif /* FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL */
  218. }
  219. /*!
  220. * brief Deinitialize the SNVS.
  221. *
  222. * param base SNVS peripheral base address
  223. */
  224. void SNVS_HP_Deinit(SNVS_Type *base)
  225. {
  226. #if (!(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && \
  227. defined(SNVS_HP_CLOCKS))
  228. uint32_t instance = SNVS_HP_GetInstance(base);
  229. CLOCK_DisableClock(s_snvsHpClock[instance]);
  230. #endif /* FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL */
  231. }
  232. /*!
  233. * brief Ungates the SNVS clock and configures the peripheral for basic operation.
  234. *
  235. * note This API should be called at the beginning of the application using the SNVS driver.
  236. *
  237. * param base SNVS peripheral base address
  238. * param config Pointer to the user's SNVS configuration structure.
  239. */
  240. void SNVS_HP_RTC_Init(SNVS_Type *base, const snvs_hp_rtc_config_t *config)
  241. {
  242. assert(config != NULL);
  243. #if (!(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && \
  244. defined(SNVS_HP_CLOCKS))
  245. uint32_t instance = SNVS_HP_GetInstance(base);
  246. CLOCK_EnableClock(s_snvsHpClock[instance]);
  247. #endif /* FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL */
  248. base->HPCOMR |= SNVS_HPCOMR_NPSWA_EN_MASK;
  249. base->HPCR = (base->HPCR & ~SNVS_HPCR_PI_FREQ_MASK) | SNVS_HPCR_PI_FREQ(config->periodicInterruptFreq);
  250. if (config->rtcCalEnable)
  251. {
  252. base->HPCR = (base->HPCR & ~SNVS_HPCR_HPCALB_VAL_MASK) | SNVS_HPCR_HPCALB_VAL(config->rtcCalValue);
  253. base->HPCR |= SNVS_HPCR_HPCALB_EN_MASK;
  254. }
  255. }
  256. /*!
  257. * brief Stops the RTC and SRTC timers.
  258. *
  259. * param base SNVS peripheral base address
  260. */
  261. void SNVS_HP_RTC_Deinit(SNVS_Type *base)
  262. {
  263. base->HPCR &= ~SNVS_HPCR_RTC_EN_MASK;
  264. #if (!(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && \
  265. defined(SNVS_HP_CLOCKS))
  266. uint32_t instance = SNVS_HP_GetInstance(base);
  267. CLOCK_DisableClock(s_snvsHpClock[instance]);
  268. #endif /* FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL */
  269. }
  270. /*!
  271. * brief Fills in the SNVS config struct with the default settings.
  272. *
  273. * The default values are as follows.
  274. * code
  275. * config->rtccalenable = false;
  276. * config->rtccalvalue = 0U;
  277. * config->PIFreq = 0U;
  278. * endcode
  279. * param config Pointer to the user's SNVS configuration structure.
  280. */
  281. void SNVS_HP_RTC_GetDefaultConfig(snvs_hp_rtc_config_t *config)
  282. {
  283. assert(config != NULL);
  284. /* Initializes the configure structure to zero. */
  285. (void)memset(config, 0, sizeof(*config));
  286. config->rtcCalEnable = false;
  287. config->rtcCalValue = 0U;
  288. config->periodicInterruptFreq = 0U;
  289. }
  290. static uint32_t SNVS_HP_RTC_GetSeconds(SNVS_Type *base)
  291. {
  292. uint32_t seconds = 0;
  293. uint32_t tmp = 0;
  294. /* Do consecutive reads until value is correct */
  295. do
  296. {
  297. seconds = tmp;
  298. tmp = (base->HPRTCMR << 17U);
  299. tmp |= (base->HPRTCLR >> 15U);
  300. } while (tmp != seconds);
  301. return seconds;
  302. }
  303. /*!
  304. * brief Sets the SNVS RTC date and time according to the given time structure.
  305. *
  306. * param base SNVS peripheral base address
  307. * param datetime Pointer to the structure where the date and time details are stored.
  308. *
  309. * return kStatus_Success: Success in setting the time and starting the SNVS RTC
  310. * kStatus_InvalidArgument: Error because the datetime format is incorrect
  311. */
  312. status_t SNVS_HP_RTC_SetDatetime(SNVS_Type *base, const snvs_hp_rtc_datetime_t *datetime)
  313. {
  314. assert(datetime != NULL);
  315. uint32_t seconds = 0U;
  316. uint32_t tmp = base->HPCR;
  317. /* disable RTC */
  318. SNVS_HP_RTC_StopTimer(base);
  319. /* Return error if the time provided is not valid */
  320. if (!(SNVS_HP_CheckDatetimeFormat(datetime)))
  321. {
  322. return kStatus_InvalidArgument;
  323. }
  324. /* Set time in seconds */
  325. seconds = SNVS_HP_ConvertDatetimeToSeconds(datetime);
  326. base->HPRTCMR = (uint32_t)(seconds >> 17U);
  327. base->HPRTCLR = (uint32_t)(seconds << 15U);
  328. /* reenable RTC in case that it was enabled before */
  329. if ((tmp & SNVS_HPCR_RTC_EN_MASK) != 0U)
  330. {
  331. SNVS_HP_RTC_StartTimer(base);
  332. }
  333. return kStatus_Success;
  334. }
  335. /*!
  336. * brief Gets the SNVS RTC time and stores it in the given time structure.
  337. *
  338. * param base SNVS peripheral base address
  339. * param datetime Pointer to the structure where the date and time details are stored.
  340. */
  341. void SNVS_HP_RTC_GetDatetime(SNVS_Type *base, snvs_hp_rtc_datetime_t *datetime)
  342. {
  343. assert(datetime != NULL);
  344. SNVS_HP_ConvertSecondsToDatetime(SNVS_HP_RTC_GetSeconds(base), datetime);
  345. }
  346. /*!
  347. * brief Sets the SNVS RTC alarm time.
  348. *
  349. * The function sets the RTC alarm. It also checks whether the specified alarm time
  350. * is greater than the present time. If not, the function does not set the alarm
  351. * and returns an error.
  352. *
  353. * param base SNVS peripheral base address
  354. * param alarmTime Pointer to the structure where the alarm time is stored.
  355. *
  356. * return kStatus_Success: success in setting the SNVS RTC alarm
  357. * kStatus_InvalidArgument: Error because the alarm datetime format is incorrect
  358. * kStatus_Fail: Error because the alarm time has already passed
  359. */
  360. status_t SNVS_HP_RTC_SetAlarm(SNVS_Type *base, const snvs_hp_rtc_datetime_t *alarmTime)
  361. {
  362. assert(alarmTime != NULL);
  363. uint32_t alarmSeconds = 0U;
  364. uint32_t currSeconds = 0U;
  365. uint32_t tmp = base->HPCR;
  366. /* Return error if the alarm time provided is not valid */
  367. if (!(SNVS_HP_CheckDatetimeFormat(alarmTime)))
  368. {
  369. return kStatus_InvalidArgument;
  370. }
  371. alarmSeconds = SNVS_HP_ConvertDatetimeToSeconds(alarmTime);
  372. currSeconds = SNVS_HP_RTC_GetSeconds(base);
  373. /* Return error if the alarm time has passed */
  374. if (alarmSeconds < currSeconds)
  375. {
  376. return kStatus_Fail;
  377. }
  378. /* disable RTC alarm interrupt */
  379. base->HPCR &= ~SNVS_HPCR_HPTA_EN_MASK;
  380. while ((base->HPCR & SNVS_HPCR_HPTA_EN_MASK) != 0U)
  381. {
  382. }
  383. /* Set alarm in seconds*/
  384. base->HPTAMR = (uint32_t)(alarmSeconds >> 17U);
  385. base->HPTALR = (uint32_t)(alarmSeconds << 15U);
  386. /* reenable RTC alarm interrupt in case that it was enabled before */
  387. base->HPCR = tmp;
  388. return kStatus_Success;
  389. }
  390. /*!
  391. * brief Returns the SNVS RTC alarm time.
  392. *
  393. * param base SNVS peripheral base address
  394. * param datetime Pointer to the structure where the alarm date and time details are stored.
  395. */
  396. void SNVS_HP_RTC_GetAlarm(SNVS_Type *base, snvs_hp_rtc_datetime_t *datetime)
  397. {
  398. assert(datetime != NULL);
  399. uint32_t alarmSeconds = 0U;
  400. /* Get alarm in seconds */
  401. alarmSeconds = (base->HPTAMR << 17U);
  402. alarmSeconds |= (base->HPTALR >> 15U);
  403. SNVS_HP_ConvertSecondsToDatetime(alarmSeconds, datetime);
  404. }
  405. #if (defined(FSL_FEATURE_SNVS_HAS_SRTC) && (FSL_FEATURE_SNVS_HAS_SRTC > 0))
  406. /*!
  407. * brief The function synchronizes RTC counter value with SRTC.
  408. *
  409. * param base SNVS peripheral base address
  410. */
  411. void SNVS_HP_RTC_TimeSynchronize(SNVS_Type *base)
  412. {
  413. uint32_t tmp = base->HPCR;
  414. /* disable RTC */
  415. SNVS_HP_RTC_StopTimer(base);
  416. base->HPCR |= SNVS_HPCR_HP_TS_MASK;
  417. /* reenable RTC in case that it was enabled before */
  418. if ((tmp & SNVS_HPCR_RTC_EN_MASK) != 0U)
  419. {
  420. SNVS_HP_RTC_StartTimer(base);
  421. }
  422. }
  423. #endif /* FSL_FEATURE_SNVS_HAS_SRTC */
  424. /*!
  425. * brief Gets the SNVS status flags.
  426. *
  427. * param base SNVS peripheral base address
  428. *
  429. * return The status flags. This is the logical OR of members of the
  430. * enumeration ::snvs_status_flags_t
  431. */
  432. uint32_t SNVS_HP_RTC_GetStatusFlags(SNVS_Type *base)
  433. {
  434. uint32_t flags = 0U;
  435. if ((base->HPSR & SNVS_HPSR_PI_MASK) != 0U)
  436. {
  437. flags |= (uint32_t)kSNVS_RTC_PeriodicInterruptFlag;
  438. }
  439. if ((base->HPSR & SNVS_HPSR_HPTA_MASK) != 0U)
  440. {
  441. flags |= (uint32_t)kSNVS_RTC_AlarmInterruptFlag;
  442. }
  443. return flags;
  444. }
  445. /*!
  446. * brief Gets the enabled SNVS interrupts.
  447. *
  448. * param base SNVS peripheral base address
  449. *
  450. * return The enabled interrupts. This is the logical OR of members of the
  451. * enumeration ::snvs_interrupt_enable_t
  452. */
  453. uint32_t SNVS_HP_RTC_GetEnabledInterrupts(SNVS_Type *base)
  454. {
  455. uint32_t val = 0U;
  456. if ((base->HPCR & SNVS_HPCR_PI_EN_MASK) != 0U)
  457. {
  458. val |= (uint32_t)kSNVS_RTC_PeriodicInterrupt;
  459. }
  460. if ((base->HPCR & SNVS_HPCR_HPTA_EN_MASK) != 0U)
  461. {
  462. val |= (uint32_t)kSNVS_RTC_AlarmInterrupt;
  463. }
  464. return val;
  465. }
  466. #if defined(FSL_FEATURE_SNVS_HAS_SET_LOCK) && (FSL_FEATURE_SNVS_HAS_SET_LOCK > 0)
  467. /*!
  468. * brief Set SNVS HP Set locks.
  469. *
  470. * param base SNVS peripheral base address
  471. *
  472. */
  473. void SNVS_HP_SetLocks(SNVS_Type *base)
  474. {
  475. uint32_t sec_config = ((OCOTP_CTRL->HW_OCOTP_OTFAD_CFG3 & OCOTP_CTRL_HW_OCOTP_SEC_CONFIG1_MASK) >>
  476. OCOTP_CTRL_HW_OCOTP_SEC_CONFIG1_SHIFT);
  477. if (sec_config == SEC_CONFIG_OPEN)
  478. {
  479. /* Enable non-secure SW access */
  480. base->HPCOMR |= SNVS_HPCOMR_NPSWA_EN(1);
  481. }
  482. /* Set LP Software Reset Disable lock and ZMK Write Soft Lock */
  483. base->HPCOMR |= SNVS_HPCOMR_LP_SWR_DIS(1);
  484. base->HPLR |= SNVS_HPLR_ZMK_WSL(1);
  485. }
  486. #endif /* FSL_FEATURE_SNVS_HAS_SET_LOCK */