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