efm32pg12_pac/rmu/
ctrl.rs

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