1use super::SleepKind;
2use crate::{
3 peripherals::{APB_CTRL, EXTMEM, LPWR, SPI0, SPI1, SYSTEM},
4 rtc_cntl::Rtc,
5 soc::regi2c,
6};
7
8pub const RTC_CNTL_DBIAS_0V90: u8 = 13;
13pub const RTC_CNTL_DBIAS_0V95: u8 = 16;
15pub const RTC_CNTL_DBIAS_1V00: u8 = 18;
17pub const RTC_CNTL_DBIAS_1V05: u8 = 20;
19pub const RTC_CNTL_DBIAS_1V10: u8 = 23;
21pub const RTC_CNTL_DBIAS_1V15: u8 = 25;
23pub const RTC_CNTL_DBIAS_1V20: u8 = 28;
25pub const RTC_CNTL_DBIAS_1V25: u8 = 30;
27pub const RTC_CNTL_DBIAS_1V30: u8 = 31;
29pub const RTC_CNTL_DBG_ATTEN_MONITOR_DEFAULT: u8 = 0;
31const RTC_CNTL_DBG_ATTEN_LIGHTSLEEP_NODROP: u8 = 0;
33pub const RTC_CNTL_ULPCP_TOUCH_START_WAIT_IN_SLEEP: u16 = 0xFF;
35pub const RTC_CNTL_ULPCP_TOUCH_START_WAIT_DEFAULT: u16 = 0x10;
37pub const RTC_CNTL_PLL_BUF_WAIT_DEFAULT: u8 = 20;
39pub const RTC_CNTL_CK8M_WAIT_DEFAULT: u8 = 20;
41pub const RTC_CNTL_MIN_SLP_VAL_MIN: u8 = 2;
43pub const RTC_CNTL_DBG_ATTEN_DEEPSLEEP_ULTRA_LOW: u8 = 15;
45pub const OTHER_BLOCKS_POWERUP: u8 = 1;
47pub const OTHER_BLOCKS_WAIT: u16 = 1;
49pub const WIFI_POWERUP_CYCLES: u8 = OTHER_BLOCKS_POWERUP;
51pub const WIFI_WAIT_CYCLES: u16 = OTHER_BLOCKS_WAIT;
53pub const BT_POWERUP_CYCLES: u8 = OTHER_BLOCKS_POWERUP;
55pub const BT_WAIT_CYCLES: u16 = OTHER_BLOCKS_WAIT;
57pub const RTC_POWERUP_CYCLES: u8 = OTHER_BLOCKS_POWERUP;
59pub const RTC_WAIT_CYCLES: u16 = OTHER_BLOCKS_WAIT;
61pub const CPU_TOP_POWERUP_CYCLES: u8 = OTHER_BLOCKS_POWERUP;
63pub const CPU_TOP_WAIT_CYCLES: u16 = OTHER_BLOCKS_WAIT;
65pub const DG_WRAP_POWERUP_CYCLES: u8 = OTHER_BLOCKS_POWERUP;
67pub const DG_WRAP_WAIT_CYCLES: u16 = OTHER_BLOCKS_WAIT;
69pub const DG_PERI_POWERUP_CYCLES: u8 = OTHER_BLOCKS_POWERUP;
71pub const DG_PERI_WAIT_CYCLES: u16 = OTHER_BLOCKS_WAIT;
73pub const RTC_MEM_POWERUP_CYCLES: u8 = OTHER_BLOCKS_POWERUP;
75pub const RTC_MEM_WAIT_CYCLES: u16 = OTHER_BLOCKS_WAIT;
77
78bitfield::bitfield! {
79 #[derive(Clone, Copy)]
81 pub struct RtcSleepConfig(u64);
82 impl Debug;
83 pub lslp_mem_inf_fpu, set_lslp_mem_inf_fpu: 0;
85 pub rtc_mem_inf_follow_cpu, set_rtc_mem_inf_follow_cpu: 1;
87 pub rtc_fastmem_pd_en, set_rtc_fastmem_pd_en: 2;
89 pub rtc_slowmem_pd_en, set_rtc_slowmem_pd_en: 3;
91 pub rtc_peri_pd_en, set_rtc_peri_pd_en: 4;
93 pub modem_pd_en, set_modem_pd_en: 5;
95 pub(crate) cpu_pd_en, set_cpu_pd_en: 6;
100 pub int_8m_pd_en, set_int_8m_pd_en: 7;
102 pub dig_peri_pd_en, set_dig_peri_pd_en: 8;
104 pub deep_slp, set_deep_slp: 9;
106 pub wdt_flashboot_mod_en, set_wdt_flashboot_mod_en: 10;
108 pub u8, dig_dbias_slp, set_dig_dbias_slp: 15, 11;
110 pub u8, rtc_dbias_slp, set_rtc_dbias_slp: 20, 16;
112 pub bias_sleep_monitor, set_bias_sleep_monitor: 21;
114 pub u8, dbg_atten_slp, set_dbg_atten_slp: 25, 22;
116 pub bias_sleep_slp, set_bias_sleep_slp: 26;
118 pub pd_cur_monitor, set_pd_cur_monitor: 27;
120 pub pd_cur_slp, set_pd_cur_slp: 28;
122 pub vddsdio_pd_en, set_vddsdio_pd_en: 29;
124 pub xtal_fpu, set_xtal_fpu: 30;
126 pub rtc_regulator_fpu, set_rtc_regulator_fpu: 31;
128 pub deep_slp_reject, set_deep_slp_reject: 32;
130 pub light_slp_reject, set_light_slp_reject: 33;
132}
133
134impl Default for RtcSleepConfig {
135 fn default() -> Self {
136 let mut cfg = Self(Default::default());
137 cfg.set_deep_slp_reject(true);
138 cfg.set_light_slp_reject(true);
139 cfg.set_rtc_dbias_slp(RTC_CNTL_DBIAS_1V10);
140 cfg.set_dig_dbias_slp(RTC_CNTL_DBIAS_1V10);
141
142 cfg.set_rtc_regulator_fpu(true);
146 cfg.set_bias_sleep_monitor(true);
147 cfg.set_pd_cur_monitor(true);
148 cfg.set_bias_sleep_slp(true);
149 cfg.set_pd_cur_slp(true);
150 cfg
151 }
152}
153
154const SYSCON_SRAM_POWER_UP: u16 = 0x7FF;
155const SYSCON_ROM_POWER_UP: u8 = 0x7;
156
157fn rtc_sleep_pu(val: bool) {
158 let rtc_cntl = LPWR::regs();
159 let syscon = APB_CTRL::regs();
160 let bb = unsafe { &*esp32s3::BB::ptr() };
161 let nrx = unsafe { &*esp32s3::NRX::ptr() };
162 let fe = unsafe { &*esp32s3::FE::ptr() };
163 let fe2 = unsafe { &*esp32s3::FE2::ptr() };
164
165 rtc_cntl
166 .dig_pwc()
167 .modify(|_, w| w.lslp_mem_force_pu().bit(val));
168
169 rtc_cntl
170 .pwc()
171 .modify(|_, w| w.slowmem_force_lpu().bit(val).fastmem_force_lpu().bit(val));
172
173 syscon.front_end_mem_pd().modify(|_r, w| {
174 w.dc_mem_force_pu().bit(val);
175 w.pbus_mem_force_pu().bit(val);
176 w.agc_mem_force_pu().bit(val)
177 });
178
179 bb.bbpd_ctrl()
180 .modify(|_r, w| w.fft_force_pu().bit(val).dc_est_force_pu().bit(val));
181
182 nrx.nrxpd_ctrl().modify(|_, w| {
183 w.rx_rot_force_pu().bit(val);
184 w.vit_force_pu().bit(val);
185 w.demap_force_pu().bit(val)
186 });
187
188 fe.gen_ctrl().modify(|_, w| w.iq_est_force_pu().bit(val));
189
190 fe2.tx_interp_ctrl()
191 .modify(|_, w| w.tx_inf_force_pu().bit(val));
192
193 syscon.mem_power_up().modify(|_r, w| unsafe {
194 w.sram_power_up()
195 .bits(if val { SYSCON_SRAM_POWER_UP } else { 0 });
196 w.rom_power_up()
197 .bits(if val { SYSCON_ROM_POWER_UP } else { 0 })
198 });
199}
200
201impl RtcSleepConfig {
202 pub fn deep() -> Self {
206 let mut cfg = Self::default();
213
214 cfg.set_lslp_mem_inf_fpu(false);
215 cfg.set_rtc_mem_inf_follow_cpu(true); cfg.set_rtc_fastmem_pd_en(true);
217 cfg.set_rtc_slowmem_pd_en(true);
218 cfg.set_rtc_peri_pd_en(true);
219 cfg.set_modem_pd_en(true);
220 cfg.set_cpu_pd_en(true);
221 cfg.set_int_8m_pd_en(true);
222
223 cfg.set_dig_peri_pd_en(true);
224 cfg.set_dig_dbias_slp(0); cfg.set_deep_slp(true);
227 cfg.set_wdt_flashboot_mod_en(false);
228 cfg.set_vddsdio_pd_en(true);
229 cfg.set_xtal_fpu(false);
230 cfg.set_deep_slp_reject(true);
231 cfg.set_light_slp_reject(true);
232 cfg.set_rtc_dbias_slp(RTC_CNTL_DBIAS_1V10);
233
234 cfg.set_rtc_regulator_fpu(false);
236 cfg.set_dbg_atten_slp(RTC_CNTL_DBG_ATTEN_DEEPSLEEP_ULTRA_LOW);
237
238 cfg.set_bias_sleep_monitor(true);
240 cfg.set_pd_cur_monitor(true);
241 cfg.set_bias_sleep_slp(true);
242 cfg.set_pd_cur_slp(true);
243
244 cfg
245 }
246
247 pub(crate) fn is_deep_sleep(&self) -> bool {
248 self.deep_slp()
249 }
250
251 pub(crate) fn set_sleep_kind(&mut self, kind: SleepKind) {
252 self.set_deep_slp(kind == SleepKind::Deep);
253 }
254
255 pub(crate) fn base_settings(_rtc: &Rtc<'_>) {
256 unsafe {
258 let rtc_cntl = LPWR::regs();
259 let syscon = APB_CTRL::regs();
260 let extmem = EXTMEM::regs();
261 let system = SYSTEM::regs();
262
263 rtc_cntl
264 .dig_pwc()
265 .modify(|_, w| w.wifi_force_pd().clear_bit());
266 rtc_cntl
267 .dig_iso()
268 .modify(|_, w| w.wifi_force_iso().clear_bit());
269
270 regi2c::I2C_DIG_REG_XPD_RTC_REG.write_field(0);
271 regi2c::I2C_DIG_REG_XPD_DIG_REG.write_field(0);
272
273 rtc_cntl.ana_conf().modify(|_, w| w.pvtmon_pu().clear_bit());
274
275 rtc_cntl.timer1().modify(|_, w| {
276 w.pll_buf_wait().bits(RTC_CNTL_PLL_BUF_WAIT_DEFAULT);
277 w.ck8m_wait().bits(RTC_CNTL_CK8M_WAIT_DEFAULT)
278 });
279
280 rtc_cntl
284 .timer5()
285 .modify(|_, w| w.min_slp_val().bits(RTC_CNTL_MIN_SLP_VAL_MIN));
286
287 rtc_cntl.timer3().modify(|_, w| {
288 w.wifi_powerup_timer().bits(WIFI_POWERUP_CYCLES);
290 w.wifi_wait_timer().bits(WIFI_WAIT_CYCLES);
292 w.bt_powerup_timer().bits(BT_POWERUP_CYCLES);
293 w.bt_wait_timer().bits(BT_WAIT_CYCLES)
294 });
295
296 rtc_cntl.timer6().modify(|_, w| {
297 w.cpu_top_powerup_timer().bits(CPU_TOP_POWERUP_CYCLES);
298 w.cpu_top_wait_timer().bits(CPU_TOP_WAIT_CYCLES)
299 });
300
301 rtc_cntl.timer4().modify(|_, w| {
302 w.powerup_timer().bits(RTC_POWERUP_CYCLES);
304 w.wait_timer().bits(RTC_WAIT_CYCLES);
306 w.dg_wrap_powerup_timer().bits(DG_WRAP_POWERUP_CYCLES);
307 w.dg_wrap_wait_timer().bits(DG_WRAP_WAIT_CYCLES)
308 });
309
310 rtc_cntl.timer6().modify(|_, w| {
311 w.dg_peri_powerup_timer().bits(DG_PERI_POWERUP_CYCLES);
312 w.dg_peri_wait_timer().bits(DG_PERI_WAIT_CYCLES)
313 });
314
315 regi2c::I2C_DIG_REG_EXT_RTC_DREG_SLEEP.write_field(RTC_CNTL_DBIAS_1V10);
317 regi2c::I2C_DIG_REG_EXT_RTC_DREG.write_field(RTC_CNTL_DBIAS_1V10);
318
319 rtc_cntl.timer2().modify(|_, w| {
322 w.ulpcp_touch_start_wait()
323 .bits(RTC_CNTL_ULPCP_TOUCH_START_WAIT_DEFAULT)
324 });
325
326 regi2c::I2C_DIG_REG_EXT_RTC_DREG.write_field(RTC_CNTL_DBIAS_1V25);
332 regi2c::I2C_DIG_REG_EXT_DIG_DREG.write_field(RTC_CNTL_DBIAS_1V25);
333
334 extmem
337 .cache_mmu_power_ctrl()
338 .modify(|_, w| w.cache_mmu_mem_force_on().clear_bit());
339
340 syscon.clkgate_force_on().write(|w| w.bits(0));
342
343 extmem
346 .dcache_tag_power_ctrl()
347 .modify(|_, w| w.dcache_tag_mem_force_on().clear_bit());
348
349 extmem
350 .icache_tag_power_ctrl()
351 .modify(|_, w| w.icache_tag_mem_force_on().clear_bit());
352
353 SPI0::regs()
355 .clock_gate()
356 .modify(|_, w| w.clk_en().clear_bit());
357 SPI1::regs()
358 .clock_gate()
359 .modify(|_, w| w.clk_en().clear_bit());
360
361 rtc_cntl
362 .clk_conf()
363 .modify(|_, w| w.ck8m_force_pu().clear_bit());
364
365 rtc_cntl
366 .options0()
367 .modify(|_, w| w.xtl_force_pu().clear_bit());
368
369 rtc_cntl.ana_conf().modify(|_, w| {
370 w.i2c_reset_por_force_pd().clear_bit()
374 });
375
376 rtc_cntl.options0().modify(|_, w| {
379 w.bbpll_force_pu().clear_bit();
380 w.bbpll_i2c_force_pu().clear_bit();
381 w.bb_i2c_force_pu().clear_bit()
382 });
383
384 rtc_cntl.pwc().modify(|_, w| w.force_pu().clear_bit());
387
388 rtc_cntl.rtc().modify(|_, w| {
389 w.regulator_force_pu().clear_bit();
390 w.dboost_force_pu().clear_bit()
391 });
392
393 rtc_cntl.pwc().modify(|_, w| {
394 w.slowmem_force_noiso().clear_bit();
395 w.fastmem_force_noiso().clear_bit()
396 });
397
398 rtc_cntl.rtc().modify(|_, w| w.dboost_force_pd().set_bit());
399
400 system
405 .mem_pd_mask()
406 .modify(|_, w| w.lslp_mem_pd_mask().clear_bit());
407
408 rtc_sleep_pu(false);
412
413 rtc_cntl
414 .dig_pwc()
415 .modify(|_, w| w.dg_wrap_force_pu().clear_bit());
416
417 rtc_cntl.dig_iso().modify(|_, w| {
418 w.dg_wrap_force_noiso().clear_bit();
419 w.dg_wrap_force_iso().clear_bit()
420 });
421
422 rtc_cntl.dig_iso().modify(|_, w| {
423 w.wifi_force_noiso().clear_bit();
424 w.wifi_force_iso().clear_bit()
425 });
426
427 rtc_cntl
428 .dig_pwc()
429 .modify(|_, w| w.wifi_force_pu().clear_bit());
430
431 rtc_cntl.dig_iso().modify(|_, w| {
432 w.bt_force_noiso().clear_bit();
433 w.bt_force_iso().clear_bit()
434 });
435
436 rtc_cntl
437 .dig_pwc()
438 .modify(|_, w| w.bt_force_pu().clear_bit());
439
440 rtc_cntl.dig_iso().modify(|_, w| {
441 w.cpu_top_force_noiso().clear_bit();
442 w.cpu_top_force_iso().clear_bit()
443 });
444
445 rtc_cntl
446 .dig_pwc()
447 .modify(|_, w| w.cpu_top_force_pu().clear_bit());
448
449 rtc_cntl.dig_iso().modify(|_, w| {
450 w.dg_peri_force_noiso().clear_bit();
451 w.dg_peri_force_iso().clear_bit()
452 });
453
454 rtc_cntl
455 .dig_pwc()
456 .modify(|_, w| w.dg_peri_force_pu().clear_bit());
457
458 rtc_cntl.pwc().modify(|_, w| {
459 w.force_noiso().clear_bit();
460 w.force_iso().clear_bit();
461 w.force_pu().clear_bit()
462 });
463
464 system
468 .cpu_per_conf()
469 .modify(|_, w| w.cpu_wait_mode_force_on().clear_bit());
470
471 rtc_cntl.dig_iso().modify(|_, w| {
474 w.dg_pad_force_unhold().clear_bit();
475 w.dg_pad_force_noiso().clear_bit()
476 });
477
478 rtc_cntl
481 .dig_iso()
482 .modify(|_, w| w.wifi_force_iso().set_bit());
483
484 rtc_cntl
485 .dig_pwc()
486 .modify(|_, w| w.wifi_force_pd().set_bit());
487
488 rtc_cntl.int_ena().write(|w| w.bits(0));
489 rtc_cntl.int_clr().write(|w| w.bits(u32::MAX));
490 }
491 }
492
493 pub(crate) fn apply(&self) {
494 let rtc_cntl = LPWR::regs();
496
497 if self.lslp_mem_inf_fpu() {
498 rtc_sleep_pu(true);
499 }
500
501 if self.modem_pd_en() {
503 rtc_cntl
504 .dig_iso()
505 .modify(|_, w| w.wifi_force_noiso().clear_bit());
506 }
507
508 rtc_cntl.dig_pwc().modify(|_, w| {
509 if self.modem_pd_en() {
510 w.wifi_force_pu().clear_bit();
511 }
512 w.wifi_pd_en().bit(self.modem_pd_en())
513 });
514
515 if self.cpu_pd_en() {
516 rtc_cntl.dig_iso().modify(|_, w| {
517 w.cpu_top_force_noiso().clear_bit();
518 w.cpu_top_force_iso().clear_bit()
519 });
520
521 rtc_cntl.dig_pwc().modify(|_, w| {
522 w.cpu_top_force_pu().clear_bit();
523 w.cpu_top_pd_en().set_bit()
524 });
525 } else {
526 rtc_cntl
527 .dig_pwc()
528 .modify(|_, w| w.cpu_top_pd_en().clear_bit());
529 }
530
531 if self.dig_peri_pd_en() {
532 rtc_cntl.dig_iso().modify(|_, w| {
533 w.dg_peri_force_noiso().clear_bit();
534 w.dg_peri_force_iso().clear_bit()
535 });
536
537 rtc_cntl.dig_pwc().modify(|_, w| {
538 w.dg_peri_force_pu().clear_bit();
539 w.dg_peri_pd_en().set_bit()
540 });
541 } else {
542 rtc_cntl
543 .dig_pwc()
544 .modify(|_, w| w.dg_peri_pd_en().clear_bit());
545 }
546
547 if self.rtc_peri_pd_en() {
548 rtc_cntl.pwc().modify(|_, w| {
549 w.force_noiso().clear_bit();
550 w.force_iso().clear_bit();
551 w.force_pu().clear_bit();
552 w.pd_en().set_bit()
553 });
554 } else {
555 rtc_cntl.pwc().modify(|_, w| w.pd_en().clear_bit());
556 }
557
558 let xtal_on = self.xtal_fpu() && !self.deep_slp();
561 let bias_sleep_slp = self.bias_sleep_slp() && !xtal_on;
562 let pd_cur_slp = self.pd_cur_slp() && !xtal_on;
563 let dbg_atten_slp = if xtal_on {
564 RTC_CNTL_DBG_ATTEN_LIGHTSLEEP_NODROP
565 } else {
566 self.dbg_atten_slp()
567 };
568
569 unsafe {
570 regi2c::I2C_DIG_REG_EXT_RTC_DREG_SLEEP.write_field(self.rtc_dbias_slp());
571 regi2c::I2C_DIG_REG_EXT_DIG_DREG_SLEEP.write_field(self.dig_dbias_slp());
572
573 rtc_cntl.bias_conf().modify(|_, w| {
574 w.dbg_atten_deep_slp().bits(dbg_atten_slp);
575 w.bias_sleep_deep_slp().bit(bias_sleep_slp);
576 w.pd_cur_deep_slp().bit(pd_cur_slp);
577 w.dbg_atten_monitor()
578 .bits(RTC_CNTL_DBG_ATTEN_MONITOR_DEFAULT);
579 w.bias_sleep_monitor().bit(self.bias_sleep_monitor());
580 w.pd_cur_monitor().bit(self.pd_cur_monitor())
581 });
582
583 if self.deep_slp() {
584 rtc_cntl
585 .dig_pwc()
586 .modify(|_, w| w.dg_wrap_pd_en().set_bit());
587
588 rtc_cntl.ana_conf().modify(|_, w| {
589 w.ckgen_i2c_pu().clear_bit();
590 w.pll_i2c_pu().clear_bit();
591 w.rfrx_pbus_pu().clear_bit();
592 w.txrf_i2c_pu().clear_bit()
593 });
594
595 rtc_cntl
596 .options0()
597 .modify(|_, w| w.bb_i2c_force_pu().clear_bit());
598 } else {
599 rtc_cntl
600 .regulator_drv_ctrl()
601 .modify(|_, w| w.dg_vdd_drv_b_slp().bits(0xF));
602
603 rtc_cntl
604 .dig_pwc()
605 .modify(|_, w| w.dg_wrap_pd_en().clear_bit());
606 }
607
608 rtc_cntl
611 .dig_pwc()
612 .modify(|_, w| w.lslp_mem_force_pu().set_bit());
613
614 rtc_cntl
615 .rtc()
616 .modify(|_, w| w.regulator_force_pu().bit(self.rtc_regulator_fpu()));
617
618 rtc_cntl
619 .clk_conf()
620 .modify(|_, w| w.ck8m_force_pu().bit(!self.int_8m_pd_en()));
621
622 rtc_cntl.sdio_conf().modify(|_, w| {
625 w.sdio_force().clear_bit();
626 w.sdio_reg_pd_en().bit(self.vddsdio_pd_en())
627 });
628
629 rtc_cntl.slp_reject_conf().modify(|_, w| {
630 w.deep_slp_reject_en().bit(self.deep_slp_reject());
631 w.light_slp_reject_en().bit(self.light_slp_reject())
632 });
633
634 rtc_cntl.timer2().modify(|_, w| {
638 w.ulpcp_touch_start_wait()
639 .bits(RTC_CNTL_ULPCP_TOUCH_START_WAIT_IN_SLEEP)
640 });
641
642 rtc_cntl
643 .options0()
644 .modify(|_, w| w.xtl_force_pu().bit(self.xtal_fpu()));
645
646 rtc_cntl
647 .clk_conf()
648 .modify(|_, w| w.xtal_global_force_nogating().bit(self.xtal_fpu()));
649 }
650 }
651
652 #[crate::ram]
657 pub(crate) fn start_sleep(&self, wakeup_mask: u32, reject_mask: u32) -> SavedState {
658 let cpu_clk = super::SleepCpuClock::switch_to_xtal();
659
660 unsafe {
661 LPWR::regs()
662 .reset_state()
663 .modify(|_, w| w.procpu_stat_vector_sel().set_bit());
664
665 LPWR::regs()
667 .wakeup_state()
668 .modify(|_, w| w.wakeup_ena().bits(wakeup_mask));
669
670 LPWR::regs()
673 .slp_reject_conf()
674 .modify(|_, w| w.sleep_reject_ena().bits(reject_mask));
675 }
676
677 SavedState { cpu_clk }
678 }
679
680 #[inline(always)]
684 pub(crate) fn enter_sleep(&self) -> bool {
685 LPWR::regs().state0().modify(|_, w| w.sleep_en().set_bit());
686 super::wait_for_sleep_result()
687 }
688
689 pub(crate) fn finish_sleep(&self) {
690 unsafe {
692 LPWR::regs().int_clr().write(|w| {
693 w.slp_reject().clear_bit_by_one();
694 w.slp_wakeup().clear_bit_by_one()
695 });
696
697 if self.lslp_mem_inf_fpu() {
699 rtc_sleep_pu(true);
700 }
701
702 LPWR::regs().timer2().modify(|_, w| {
705 w.ulpcp_touch_start_wait()
706 .bits(RTC_CNTL_ULPCP_TOUCH_START_WAIT_DEFAULT)
707 });
708 }
709 }
710}
711
712#[must_use]
714pub(crate) struct SavedState {
715 cpu_clk: super::SleepCpuClock,
716}
717
718impl SavedState {
719 pub(crate) fn restore(self) {
721 self.cpu_clk.restore();
722 }
723}