esp32s3/rtc_cntl/
retention_ctrl.rs

1#[doc = "Register `RETENTION_CTRL` reader"]
2pub type R = crate::R<RETENTION_CTRL_SPEC>;
3#[doc = "Register `RETENTION_CTRL` writer"]
4pub type W = crate::W<RETENTION_CTRL_SPEC>;
5#[doc = "Field `RETENTION_TAG_MODE` reader - No public"]
6pub type RETENTION_TAG_MODE_R = crate::FieldReader;
7#[doc = "Field `RETENTION_TAG_MODE` writer - No public"]
8pub type RETENTION_TAG_MODE_W<'a, REG> = crate::FieldWriter<'a, REG, 4>;
9#[doc = "Field `RETENTION_TARGET` reader - congfigure retention target cpu and/or tag"]
10pub type RETENTION_TARGET_R = crate::FieldReader;
11#[doc = "Field `RETENTION_TARGET` writer - congfigure retention target cpu and/or tag"]
12pub type RETENTION_TARGET_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
13#[doc = "Field `RETENTION_CLK_SEL` reader - No public"]
14pub type RETENTION_CLK_SEL_R = crate::BitReader;
15#[doc = "Field `RETENTION_CLK_SEL` writer - No public"]
16pub type RETENTION_CLK_SEL_W<'a, REG> = crate::BitWriter<'a, REG>;
17#[doc = "Field `RETENTION_DONE_WAIT` reader - wait retention done cycle"]
18pub type RETENTION_DONE_WAIT_R = crate::FieldReader;
19#[doc = "Field `RETENTION_DONE_WAIT` writer - wait retention done cycle"]
20pub type RETENTION_DONE_WAIT_W<'a, REG> = crate::FieldWriter<'a, REG, 3>;
21#[doc = "Field `RETENTION_CLKOFF_WAIT` reader - wait clk off cycle"]
22pub type RETENTION_CLKOFF_WAIT_R = crate::FieldReader;
23#[doc = "Field `RETENTION_CLKOFF_WAIT` writer - wait clk off cycle"]
24pub type RETENTION_CLKOFF_WAIT_W<'a, REG> = crate::FieldWriter<'a, REG, 4>;
25#[doc = "Field `RETENTION_EN` reader - enable retention"]
26pub type RETENTION_EN_R = crate::BitReader;
27#[doc = "Field `RETENTION_EN` writer - enable retention"]
28pub type RETENTION_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
29#[doc = "Field `RETENTION_WAIT` reader - wait cycles for rention operation"]
30pub type RETENTION_WAIT_R = crate::FieldReader;
31#[doc = "Field `RETENTION_WAIT` writer - wait cycles for rention operation"]
32pub type RETENTION_WAIT_W<'a, REG> = crate::FieldWriter<'a, REG, 7>;
33impl R {
34    #[doc = "Bits 10:13 - No public"]
35    #[inline(always)]
36    pub fn retention_tag_mode(&self) -> RETENTION_TAG_MODE_R {
37        RETENTION_TAG_MODE_R::new(((self.bits >> 10) & 0x0f) as u8)
38    }
39    #[doc = "Bits 14:15 - congfigure retention target cpu and/or tag"]
40    #[inline(always)]
41    pub fn retention_target(&self) -> RETENTION_TARGET_R {
42        RETENTION_TARGET_R::new(((self.bits >> 14) & 3) as u8)
43    }
44    #[doc = "Bit 16 - No public"]
45    #[inline(always)]
46    pub fn retention_clk_sel(&self) -> RETENTION_CLK_SEL_R {
47        RETENTION_CLK_SEL_R::new(((self.bits >> 16) & 1) != 0)
48    }
49    #[doc = "Bits 17:19 - wait retention done cycle"]
50    #[inline(always)]
51    pub fn retention_done_wait(&self) -> RETENTION_DONE_WAIT_R {
52        RETENTION_DONE_WAIT_R::new(((self.bits >> 17) & 7) as u8)
53    }
54    #[doc = "Bits 20:23 - wait clk off cycle"]
55    #[inline(always)]
56    pub fn retention_clkoff_wait(&self) -> RETENTION_CLKOFF_WAIT_R {
57        RETENTION_CLKOFF_WAIT_R::new(((self.bits >> 20) & 0x0f) as u8)
58    }
59    #[doc = "Bit 24 - enable retention"]
60    #[inline(always)]
61    pub fn retention_en(&self) -> RETENTION_EN_R {
62        RETENTION_EN_R::new(((self.bits >> 24) & 1) != 0)
63    }
64    #[doc = "Bits 25:31 - wait cycles for rention operation"]
65    #[inline(always)]
66    pub fn retention_wait(&self) -> RETENTION_WAIT_R {
67        RETENTION_WAIT_R::new(((self.bits >> 25) & 0x7f) as u8)
68    }
69}
70#[cfg(feature = "impl-register-debug")]
71impl core::fmt::Debug for R {
72    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
73        f.debug_struct("RETENTION_CTRL")
74            .field("retention_tag_mode", &self.retention_tag_mode())
75            .field("retention_target", &self.retention_target())
76            .field("retention_clk_sel", &self.retention_clk_sel())
77            .field("retention_done_wait", &self.retention_done_wait())
78            .field("retention_clkoff_wait", &self.retention_clkoff_wait())
79            .field("retention_en", &self.retention_en())
80            .field("retention_wait", &self.retention_wait())
81            .finish()
82    }
83}
84impl W {
85    #[doc = "Bits 10:13 - No public"]
86    #[inline(always)]
87    pub fn retention_tag_mode(&mut self) -> RETENTION_TAG_MODE_W<RETENTION_CTRL_SPEC> {
88        RETENTION_TAG_MODE_W::new(self, 10)
89    }
90    #[doc = "Bits 14:15 - congfigure retention target cpu and/or tag"]
91    #[inline(always)]
92    pub fn retention_target(&mut self) -> RETENTION_TARGET_W<RETENTION_CTRL_SPEC> {
93        RETENTION_TARGET_W::new(self, 14)
94    }
95    #[doc = "Bit 16 - No public"]
96    #[inline(always)]
97    pub fn retention_clk_sel(&mut self) -> RETENTION_CLK_SEL_W<RETENTION_CTRL_SPEC> {
98        RETENTION_CLK_SEL_W::new(self, 16)
99    }
100    #[doc = "Bits 17:19 - wait retention done cycle"]
101    #[inline(always)]
102    pub fn retention_done_wait(&mut self) -> RETENTION_DONE_WAIT_W<RETENTION_CTRL_SPEC> {
103        RETENTION_DONE_WAIT_W::new(self, 17)
104    }
105    #[doc = "Bits 20:23 - wait clk off cycle"]
106    #[inline(always)]
107    pub fn retention_clkoff_wait(&mut self) -> RETENTION_CLKOFF_WAIT_W<RETENTION_CTRL_SPEC> {
108        RETENTION_CLKOFF_WAIT_W::new(self, 20)
109    }
110    #[doc = "Bit 24 - enable retention"]
111    #[inline(always)]
112    pub fn retention_en(&mut self) -> RETENTION_EN_W<RETENTION_CTRL_SPEC> {
113        RETENTION_EN_W::new(self, 24)
114    }
115    #[doc = "Bits 25:31 - wait cycles for rention operation"]
116    #[inline(always)]
117    pub fn retention_wait(&mut self) -> RETENTION_WAIT_W<RETENTION_CTRL_SPEC> {
118        RETENTION_WAIT_W::new(self, 25)
119    }
120}
121#[doc = "configure retention\n\nYou can [`read`](crate::Reg::read) this register and get [`retention_ctrl::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`retention_ctrl::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
122pub struct RETENTION_CTRL_SPEC;
123impl crate::RegisterSpec for RETENTION_CTRL_SPEC {
124    type Ux = u32;
125}
126#[doc = "`read()` method returns [`retention_ctrl::R`](R) reader structure"]
127impl crate::Readable for RETENTION_CTRL_SPEC {}
128#[doc = "`write(|w| ..)` method takes [`retention_ctrl::W`](W) writer structure"]
129impl crate::Writable for RETENTION_CTRL_SPEC {
130    type Safety = crate::Unsafe;
131}
132#[doc = "`reset()` method sets RETENTION_CTRL to value 0x2834_0000"]
133impl crate::Resettable for RETENTION_CTRL_SPEC {
134    const RESET_VALUE: u32 = 0x2834_0000;
135}