efm32tg11b_pac/efm32tg11b540/rmu/
ctrl.rs

1#[doc = "Register `CTRL` reader"]
2pub struct R(crate::R<CTRL_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<CTRL_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<CTRL_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<CTRL_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `CTRL` writer"]
17pub struct W(crate::W<CTRL_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<CTRL_SPEC>;
20    #[inline(always)]
21    fn deref(&self) -> &Self::Target {
22        &self.0
23    }
24}
25impl core::ops::DerefMut for W {
26    #[inline(always)]
27    fn deref_mut(&mut self) -> &mut Self::Target {
28        &mut self.0
29    }
30}
31impl From<crate::W<CTRL_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<CTRL_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `WDOGRMODE` reader - WDOG Reset Mode"]
38pub type WDOGRMODE_R = crate::FieldReader<u8, WDOGRMODE_A>;
39#[doc = "WDOG Reset Mode\n\nValue on reset: 4"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum WDOGRMODE_A {
43    #[doc = "0: Reset request is blocked. This disable bit is redundant with enable/disable bit in WDOG"]
44    DISABLED = 0,
45    #[doc = "1: The CRYOTIMER, DEBUGGER, RTCC, are not reset."]
46    LIMITED = 1,
47    #[doc = "2: The CRYOTIMER, DEBUGGER are not reset. RTCC is reset."]
48    EXTENDED = 2,
49    #[doc = "4: The entire device is reset except some EMU and RMU registers."]
50    FULL = 4,
51}
52impl From<WDOGRMODE_A> for u8 {
53    #[inline(always)]
54    fn from(variant: WDOGRMODE_A) -> Self {
55        variant as _
56    }
57}
58impl WDOGRMODE_R {
59    #[doc = "Get enumerated values variant"]
60    #[inline(always)]
61    pub fn variant(&self) -> Option<WDOGRMODE_A> {
62        match self.bits {
63            0 => Some(WDOGRMODE_A::DISABLED),
64            1 => Some(WDOGRMODE_A::LIMITED),
65            2 => Some(WDOGRMODE_A::EXTENDED),
66            4 => Some(WDOGRMODE_A::FULL),
67            _ => None,
68        }
69    }
70    #[doc = "Checks if the value of the field is `DISABLED`"]
71    #[inline(always)]
72    pub fn is_disabled(&self) -> bool {
73        *self == WDOGRMODE_A::DISABLED
74    }
75    #[doc = "Checks if the value of the field is `LIMITED`"]
76    #[inline(always)]
77    pub fn is_limited(&self) -> bool {
78        *self == WDOGRMODE_A::LIMITED
79    }
80    #[doc = "Checks if the value of the field is `EXTENDED`"]
81    #[inline(always)]
82    pub fn is_extended(&self) -> bool {
83        *self == WDOGRMODE_A::EXTENDED
84    }
85    #[doc = "Checks if the value of the field is `FULL`"]
86    #[inline(always)]
87    pub fn is_full(&self) -> bool {
88        *self == WDOGRMODE_A::FULL
89    }
90}
91#[doc = "Field `WDOGRMODE` writer - WDOG Reset Mode"]
92pub type WDOGRMODE_W<'a, const O: u8> =
93    crate::FieldWriter<'a, u32, CTRL_SPEC, u8, WDOGRMODE_A, 3, O>;
94impl<'a, const O: u8> WDOGRMODE_W<'a, O> {
95    #[doc = "Reset request is blocked. This disable bit is redundant with enable/disable bit in WDOG"]
96    #[inline(always)]
97    pub fn disabled(self) -> &'a mut W {
98        self.variant(WDOGRMODE_A::DISABLED)
99    }
100    #[doc = "The CRYOTIMER, DEBUGGER, RTCC, are not reset."]
101    #[inline(always)]
102    pub fn limited(self) -> &'a mut W {
103        self.variant(WDOGRMODE_A::LIMITED)
104    }
105    #[doc = "The CRYOTIMER, DEBUGGER are not reset. RTCC is reset."]
106    #[inline(always)]
107    pub fn extended(self) -> &'a mut W {
108        self.variant(WDOGRMODE_A::EXTENDED)
109    }
110    #[doc = "The entire device is reset except some EMU and RMU registers."]
111    #[inline(always)]
112    pub fn full(self) -> &'a mut W {
113        self.variant(WDOGRMODE_A::FULL)
114    }
115}
116#[doc = "Field `LOCKUPRMODE` reader - Core LOCKUP Reset Mode"]
117pub type LOCKUPRMODE_R = crate::FieldReader<u8, LOCKUPRMODE_A>;
118#[doc = "Core LOCKUP Reset Mode\n\nValue on reset: 0"]
119#[derive(Clone, Copy, Debug, PartialEq, Eq)]
120#[repr(u8)]
121pub enum LOCKUPRMODE_A {
122    #[doc = "0: Reset request is blocked."]
123    DISABLED = 0,
124    #[doc = "1: The CRYOTIMER, DEBUGGER, RTCC, are not reset."]
125    LIMITED = 1,
126    #[doc = "2: The CRYOTIMER, DEBUGGER are not reset. RTCC is reset."]
127    EXTENDED = 2,
128    #[doc = "4: The entire device is reset except some EMU and RMU registers."]
129    FULL = 4,
130}
131impl From<LOCKUPRMODE_A> for u8 {
132    #[inline(always)]
133    fn from(variant: LOCKUPRMODE_A) -> Self {
134        variant as _
135    }
136}
137impl LOCKUPRMODE_R {
138    #[doc = "Get enumerated values variant"]
139    #[inline(always)]
140    pub fn variant(&self) -> Option<LOCKUPRMODE_A> {
141        match self.bits {
142            0 => Some(LOCKUPRMODE_A::DISABLED),
143            1 => Some(LOCKUPRMODE_A::LIMITED),
144            2 => Some(LOCKUPRMODE_A::EXTENDED),
145            4 => Some(LOCKUPRMODE_A::FULL),
146            _ => None,
147        }
148    }
149    #[doc = "Checks if the value of the field is `DISABLED`"]
150    #[inline(always)]
151    pub fn is_disabled(&self) -> bool {
152        *self == LOCKUPRMODE_A::DISABLED
153    }
154    #[doc = "Checks if the value of the field is `LIMITED`"]
155    #[inline(always)]
156    pub fn is_limited(&self) -> bool {
157        *self == LOCKUPRMODE_A::LIMITED
158    }
159    #[doc = "Checks if the value of the field is `EXTENDED`"]
160    #[inline(always)]
161    pub fn is_extended(&self) -> bool {
162        *self == LOCKUPRMODE_A::EXTENDED
163    }
164    #[doc = "Checks if the value of the field is `FULL`"]
165    #[inline(always)]
166    pub fn is_full(&self) -> bool {
167        *self == LOCKUPRMODE_A::FULL
168    }
169}
170#[doc = "Field `LOCKUPRMODE` writer - Core LOCKUP Reset Mode"]
171pub type LOCKUPRMODE_W<'a, const O: u8> =
172    crate::FieldWriter<'a, u32, CTRL_SPEC, u8, LOCKUPRMODE_A, 3, O>;
173impl<'a, const O: u8> LOCKUPRMODE_W<'a, O> {
174    #[doc = "Reset request is blocked."]
175    #[inline(always)]
176    pub fn disabled(self) -> &'a mut W {
177        self.variant(LOCKUPRMODE_A::DISABLED)
178    }
179    #[doc = "The CRYOTIMER, DEBUGGER, RTCC, are not reset."]
180    #[inline(always)]
181    pub fn limited(self) -> &'a mut W {
182        self.variant(LOCKUPRMODE_A::LIMITED)
183    }
184    #[doc = "The CRYOTIMER, DEBUGGER are not reset. RTCC is reset."]
185    #[inline(always)]
186    pub fn extended(self) -> &'a mut W {
187        self.variant(LOCKUPRMODE_A::EXTENDED)
188    }
189    #[doc = "The entire device is reset except some EMU and RMU registers."]
190    #[inline(always)]
191    pub fn full(self) -> &'a mut W {
192        self.variant(LOCKUPRMODE_A::FULL)
193    }
194}
195#[doc = "Field `SYSRMODE` reader - Core Sysreset Reset Mode"]
196pub type SYSRMODE_R = crate::FieldReader<u8, SYSRMODE_A>;
197#[doc = "Core Sysreset Reset Mode\n\nValue on reset: 2"]
198#[derive(Clone, Copy, Debug, PartialEq, Eq)]
199#[repr(u8)]
200pub enum SYSRMODE_A {
201    #[doc = "0: Reset request is blocked."]
202    DISABLED = 0,
203    #[doc = "1: The CRYOTIMER, DEBUGGER, RTCC, are not reset."]
204    LIMITED = 1,
205    #[doc = "2: The CRYOTIMER, DEBUGGER are not reset. RTCC is reset."]
206    EXTENDED = 2,
207    #[doc = "4: The entire device is reset except some EMU and RMU registers."]
208    FULL = 4,
209}
210impl From<SYSRMODE_A> for u8 {
211    #[inline(always)]
212    fn from(variant: SYSRMODE_A) -> Self {
213        variant as _
214    }
215}
216impl SYSRMODE_R {
217    #[doc = "Get enumerated values variant"]
218    #[inline(always)]
219    pub fn variant(&self) -> Option<SYSRMODE_A> {
220        match self.bits {
221            0 => Some(SYSRMODE_A::DISABLED),
222            1 => Some(SYSRMODE_A::LIMITED),
223            2 => Some(SYSRMODE_A::EXTENDED),
224            4 => Some(SYSRMODE_A::FULL),
225            _ => None,
226        }
227    }
228    #[doc = "Checks if the value of the field is `DISABLED`"]
229    #[inline(always)]
230    pub fn is_disabled(&self) -> bool {
231        *self == SYSRMODE_A::DISABLED
232    }
233    #[doc = "Checks if the value of the field is `LIMITED`"]
234    #[inline(always)]
235    pub fn is_limited(&self) -> bool {
236        *self == SYSRMODE_A::LIMITED
237    }
238    #[doc = "Checks if the value of the field is `EXTENDED`"]
239    #[inline(always)]
240    pub fn is_extended(&self) -> bool {
241        *self == SYSRMODE_A::EXTENDED
242    }
243    #[doc = "Checks if the value of the field is `FULL`"]
244    #[inline(always)]
245    pub fn is_full(&self) -> bool {
246        *self == SYSRMODE_A::FULL
247    }
248}
249#[doc = "Field `SYSRMODE` writer - Core Sysreset Reset Mode"]
250pub type SYSRMODE_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CTRL_SPEC, u8, SYSRMODE_A, 3, O>;
251impl<'a, const O: u8> SYSRMODE_W<'a, O> {
252    #[doc = "Reset request is blocked."]
253    #[inline(always)]
254    pub fn disabled(self) -> &'a mut W {
255        self.variant(SYSRMODE_A::DISABLED)
256    }
257    #[doc = "The CRYOTIMER, DEBUGGER, RTCC, are not reset."]
258    #[inline(always)]
259    pub fn limited(self) -> &'a mut W {
260        self.variant(SYSRMODE_A::LIMITED)
261    }
262    #[doc = "The CRYOTIMER, DEBUGGER are not reset. RTCC is reset."]
263    #[inline(always)]
264    pub fn extended(self) -> &'a mut W {
265        self.variant(SYSRMODE_A::EXTENDED)
266    }
267    #[doc = "The entire device is reset except some EMU and RMU registers."]
268    #[inline(always)]
269    pub fn full(self) -> &'a mut W {
270        self.variant(SYSRMODE_A::FULL)
271    }
272}
273#[doc = "Field `PINRMODE` reader - PIN Reset Mode"]
274pub type PINRMODE_R = crate::FieldReader<u8, PINRMODE_A>;
275#[doc = "PIN Reset Mode\n\nValue on reset: 4"]
276#[derive(Clone, Copy, Debug, PartialEq, Eq)]
277#[repr(u8)]
278pub enum PINRMODE_A {
279    #[doc = "0: Reset request is blocked."]
280    DISABLED = 0,
281    #[doc = "1: The CRYOTIMER, DEBUGGER, RTCC, are not reset."]
282    LIMITED = 1,
283    #[doc = "2: The CRYOTIMER, DEBUGGER are not reset. RTCC is reset."]
284    EXTENDED = 2,
285    #[doc = "4: The entire device is reset except some EMU and RMU registers."]
286    FULL = 4,
287}
288impl From<PINRMODE_A> for u8 {
289    #[inline(always)]
290    fn from(variant: PINRMODE_A) -> Self {
291        variant as _
292    }
293}
294impl PINRMODE_R {
295    #[doc = "Get enumerated values variant"]
296    #[inline(always)]
297    pub fn variant(&self) -> Option<PINRMODE_A> {
298        match self.bits {
299            0 => Some(PINRMODE_A::DISABLED),
300            1 => Some(PINRMODE_A::LIMITED),
301            2 => Some(PINRMODE_A::EXTENDED),
302            4 => Some(PINRMODE_A::FULL),
303            _ => None,
304        }
305    }
306    #[doc = "Checks if the value of the field is `DISABLED`"]
307    #[inline(always)]
308    pub fn is_disabled(&self) -> bool {
309        *self == PINRMODE_A::DISABLED
310    }
311    #[doc = "Checks if the value of the field is `LIMITED`"]
312    #[inline(always)]
313    pub fn is_limited(&self) -> bool {
314        *self == PINRMODE_A::LIMITED
315    }
316    #[doc = "Checks if the value of the field is `EXTENDED`"]
317    #[inline(always)]
318    pub fn is_extended(&self) -> bool {
319        *self == PINRMODE_A::EXTENDED
320    }
321    #[doc = "Checks if the value of the field is `FULL`"]
322    #[inline(always)]
323    pub fn is_full(&self) -> bool {
324        *self == PINRMODE_A::FULL
325    }
326}
327#[doc = "Field `PINRMODE` writer - PIN Reset Mode"]
328pub type PINRMODE_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CTRL_SPEC, u8, PINRMODE_A, 3, O>;
329impl<'a, const O: u8> PINRMODE_W<'a, O> {
330    #[doc = "Reset request is blocked."]
331    #[inline(always)]
332    pub fn disabled(self) -> &'a mut W {
333        self.variant(PINRMODE_A::DISABLED)
334    }
335    #[doc = "The CRYOTIMER, DEBUGGER, RTCC, are not reset."]
336    #[inline(always)]
337    pub fn limited(self) -> &'a mut W {
338        self.variant(PINRMODE_A::LIMITED)
339    }
340    #[doc = "The CRYOTIMER, DEBUGGER are not reset. RTCC is reset."]
341    #[inline(always)]
342    pub fn extended(self) -> &'a mut W {
343        self.variant(PINRMODE_A::EXTENDED)
344    }
345    #[doc = "The entire device is reset except some EMU and RMU registers."]
346    #[inline(always)]
347    pub fn full(self) -> &'a mut W {
348        self.variant(PINRMODE_A::FULL)
349    }
350}
351#[doc = "Field `RESETSTATE` reader - System Software Reset State"]
352pub type RESETSTATE_R = crate::FieldReader<u8, u8>;
353#[doc = "Field `RESETSTATE` writer - System Software Reset State"]
354pub type RESETSTATE_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CTRL_SPEC, u8, u8, 2, O>;
355impl R {
356    #[doc = "Bits 0:2 - WDOG Reset Mode"]
357    #[inline(always)]
358    pub fn wdogrmode(&self) -> WDOGRMODE_R {
359        WDOGRMODE_R::new((self.bits & 7) as u8)
360    }
361    #[doc = "Bits 4:6 - Core LOCKUP Reset Mode"]
362    #[inline(always)]
363    pub fn lockuprmode(&self) -> LOCKUPRMODE_R {
364        LOCKUPRMODE_R::new(((self.bits >> 4) & 7) as u8)
365    }
366    #[doc = "Bits 8:10 - Core Sysreset Reset Mode"]
367    #[inline(always)]
368    pub fn sysrmode(&self) -> SYSRMODE_R {
369        SYSRMODE_R::new(((self.bits >> 8) & 7) as u8)
370    }
371    #[doc = "Bits 12:14 - PIN Reset Mode"]
372    #[inline(always)]
373    pub fn pinrmode(&self) -> PINRMODE_R {
374        PINRMODE_R::new(((self.bits >> 12) & 7) as u8)
375    }
376    #[doc = "Bits 24:25 - System Software Reset State"]
377    #[inline(always)]
378    pub fn resetstate(&self) -> RESETSTATE_R {
379        RESETSTATE_R::new(((self.bits >> 24) & 3) as u8)
380    }
381}
382impl W {
383    #[doc = "Bits 0:2 - WDOG Reset Mode"]
384    #[inline(always)]
385    #[must_use]
386    pub fn wdogrmode(&mut self) -> WDOGRMODE_W<0> {
387        WDOGRMODE_W::new(self)
388    }
389    #[doc = "Bits 4:6 - Core LOCKUP Reset Mode"]
390    #[inline(always)]
391    #[must_use]
392    pub fn lockuprmode(&mut self) -> LOCKUPRMODE_W<4> {
393        LOCKUPRMODE_W::new(self)
394    }
395    #[doc = "Bits 8:10 - Core Sysreset Reset Mode"]
396    #[inline(always)]
397    #[must_use]
398    pub fn sysrmode(&mut self) -> SYSRMODE_W<8> {
399        SYSRMODE_W::new(self)
400    }
401    #[doc = "Bits 12:14 - PIN Reset Mode"]
402    #[inline(always)]
403    #[must_use]
404    pub fn pinrmode(&mut self) -> PINRMODE_W<12> {
405        PINRMODE_W::new(self)
406    }
407    #[doc = "Bits 24:25 - System Software Reset State"]
408    #[inline(always)]
409    #[must_use]
410    pub fn resetstate(&mut self) -> RESETSTATE_W<24> {
411        RESETSTATE_W::new(self)
412    }
413    #[doc = "Writes raw bits to the register."]
414    #[inline(always)]
415    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
416        self.0.bits(bits);
417        self
418    }
419}
420#[doc = "Control Register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [ctrl](index.html) module"]
421pub struct CTRL_SPEC;
422impl crate::RegisterSpec for CTRL_SPEC {
423    type Ux = u32;
424}
425#[doc = "`read()` method returns [ctrl::R](R) reader structure"]
426impl crate::Readable for CTRL_SPEC {
427    type Reader = R;
428}
429#[doc = "`write(|w| ..)` method takes [ctrl::W](W) writer structure"]
430impl crate::Writable for CTRL_SPEC {
431    type Writer = W;
432    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
433    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
434}
435#[doc = "`reset()` method sets CTRL to value 0x4204"]
436impl crate::Resettable for CTRL_SPEC {
437    const RESET_VALUE: Self::Ux = 0x4204;
438}