efm32pg22_pac/efm32pg22c200/emu_s/
rstctrl.rs

1#[doc = "Register `RSTCTRL` reader"]
2pub struct R(crate::R<RSTCTRL_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<RSTCTRL_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<RSTCTRL_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<RSTCTRL_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `RSTCTRL` writer"]
17pub struct W(crate::W<RSTCTRL_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<RSTCTRL_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<RSTCTRL_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<RSTCTRL_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `WDOG0RMODE` reader - Enable WDOG0 reset"]
38pub type WDOG0RMODE_R = crate::BitReader<WDOG0RMODE_A>;
39#[doc = "Enable WDOG0 reset\n\nValue on reset: 1"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub enum WDOG0RMODE_A {
42    #[doc = "0: Reset request is blocked"]
43    DISABLED = 0,
44    #[doc = "1: The entire device is reset except some EMU registers"]
45    ENABLED = 1,
46}
47impl From<WDOG0RMODE_A> for bool {
48    #[inline(always)]
49    fn from(variant: WDOG0RMODE_A) -> Self {
50        variant as u8 != 0
51    }
52}
53impl WDOG0RMODE_R {
54    #[doc = "Get enumerated values variant"]
55    #[inline(always)]
56    pub fn variant(&self) -> WDOG0RMODE_A {
57        match self.bits {
58            false => WDOG0RMODE_A::DISABLED,
59            true => WDOG0RMODE_A::ENABLED,
60        }
61    }
62    #[doc = "Checks if the value of the field is `DISABLED`"]
63    #[inline(always)]
64    pub fn is_disabled(&self) -> bool {
65        *self == WDOG0RMODE_A::DISABLED
66    }
67    #[doc = "Checks if the value of the field is `ENABLED`"]
68    #[inline(always)]
69    pub fn is_enabled(&self) -> bool {
70        *self == WDOG0RMODE_A::ENABLED
71    }
72}
73#[doc = "Field `WDOG0RMODE` writer - Enable WDOG0 reset"]
74pub type WDOG0RMODE_W<'a, const O: u8> = crate::BitWriter<'a, u32, RSTCTRL_SPEC, WDOG0RMODE_A, O>;
75impl<'a, const O: u8> WDOG0RMODE_W<'a, O> {
76    #[doc = "Reset request is blocked"]
77    #[inline(always)]
78    pub fn disabled(self) -> &'a mut W {
79        self.variant(WDOG0RMODE_A::DISABLED)
80    }
81    #[doc = "The entire device is reset except some EMU registers"]
82    #[inline(always)]
83    pub fn enabled(self) -> &'a mut W {
84        self.variant(WDOG0RMODE_A::ENABLED)
85    }
86}
87#[doc = "Field `SYSRMODE` reader - Enable M33 System reset"]
88pub type SYSRMODE_R = crate::BitReader<SYSRMODE_A>;
89#[doc = "Enable M33 System reset\n\nValue on reset: 1"]
90#[derive(Clone, Copy, Debug, PartialEq, Eq)]
91pub enum SYSRMODE_A {
92    #[doc = "0: Reset request is blocked"]
93    DISABLED = 0,
94    #[doc = "1: Device is reset except some EMU registers"]
95    ENABLED = 1,
96}
97impl From<SYSRMODE_A> for bool {
98    #[inline(always)]
99    fn from(variant: SYSRMODE_A) -> Self {
100        variant as u8 != 0
101    }
102}
103impl SYSRMODE_R {
104    #[doc = "Get enumerated values variant"]
105    #[inline(always)]
106    pub fn variant(&self) -> SYSRMODE_A {
107        match self.bits {
108            false => SYSRMODE_A::DISABLED,
109            true => SYSRMODE_A::ENABLED,
110        }
111    }
112    #[doc = "Checks if the value of the field is `DISABLED`"]
113    #[inline(always)]
114    pub fn is_disabled(&self) -> bool {
115        *self == SYSRMODE_A::DISABLED
116    }
117    #[doc = "Checks if the value of the field is `ENABLED`"]
118    #[inline(always)]
119    pub fn is_enabled(&self) -> bool {
120        *self == SYSRMODE_A::ENABLED
121    }
122}
123#[doc = "Field `SYSRMODE` writer - Enable M33 System reset"]
124pub type SYSRMODE_W<'a, const O: u8> = crate::BitWriter<'a, u32, RSTCTRL_SPEC, SYSRMODE_A, O>;
125impl<'a, const O: u8> SYSRMODE_W<'a, O> {
126    #[doc = "Reset request is blocked"]
127    #[inline(always)]
128    pub fn disabled(self) -> &'a mut W {
129        self.variant(SYSRMODE_A::DISABLED)
130    }
131    #[doc = "Device is reset except some EMU registers"]
132    #[inline(always)]
133    pub fn enabled(self) -> &'a mut W {
134        self.variant(SYSRMODE_A::ENABLED)
135    }
136}
137#[doc = "Field `LOCKUPRMODE` reader - Enable M33 Lockup reset"]
138pub type LOCKUPRMODE_R = crate::BitReader<LOCKUPRMODE_A>;
139#[doc = "Enable M33 Lockup reset\n\nValue on reset: 0"]
140#[derive(Clone, Copy, Debug, PartialEq, Eq)]
141pub enum LOCKUPRMODE_A {
142    #[doc = "0: Reset Request is Block"]
143    DISABLED = 0,
144    #[doc = "1: The entire device is reset except some EMU registers"]
145    ENABLED = 1,
146}
147impl From<LOCKUPRMODE_A> for bool {
148    #[inline(always)]
149    fn from(variant: LOCKUPRMODE_A) -> Self {
150        variant as u8 != 0
151    }
152}
153impl LOCKUPRMODE_R {
154    #[doc = "Get enumerated values variant"]
155    #[inline(always)]
156    pub fn variant(&self) -> LOCKUPRMODE_A {
157        match self.bits {
158            false => LOCKUPRMODE_A::DISABLED,
159            true => LOCKUPRMODE_A::ENABLED,
160        }
161    }
162    #[doc = "Checks if the value of the field is `DISABLED`"]
163    #[inline(always)]
164    pub fn is_disabled(&self) -> bool {
165        *self == LOCKUPRMODE_A::DISABLED
166    }
167    #[doc = "Checks if the value of the field is `ENABLED`"]
168    #[inline(always)]
169    pub fn is_enabled(&self) -> bool {
170        *self == LOCKUPRMODE_A::ENABLED
171    }
172}
173#[doc = "Field `LOCKUPRMODE` writer - Enable M33 Lockup reset"]
174pub type LOCKUPRMODE_W<'a, const O: u8> = crate::BitWriter<'a, u32, RSTCTRL_SPEC, LOCKUPRMODE_A, O>;
175impl<'a, const O: u8> LOCKUPRMODE_W<'a, O> {
176    #[doc = "Reset Request is Block"]
177    #[inline(always)]
178    pub fn disabled(self) -> &'a mut W {
179        self.variant(LOCKUPRMODE_A::DISABLED)
180    }
181    #[doc = "The entire device is reset except some EMU registers"]
182    #[inline(always)]
183    pub fn enabled(self) -> &'a mut W {
184        self.variant(LOCKUPRMODE_A::ENABLED)
185    }
186}
187#[doc = "Field `AVDDBODRMODE` reader - Enable AVDD BOD reset"]
188pub type AVDDBODRMODE_R = crate::BitReader<AVDDBODRMODE_A>;
189#[doc = "Enable AVDD BOD reset\n\nValue on reset: 0"]
190#[derive(Clone, Copy, Debug, PartialEq, Eq)]
191pub enum AVDDBODRMODE_A {
192    #[doc = "0: Reset Request is block"]
193    DISABLED = 0,
194    #[doc = "1: The entire device is reset except some EMU registers"]
195    ENABLED = 1,
196}
197impl From<AVDDBODRMODE_A> for bool {
198    #[inline(always)]
199    fn from(variant: AVDDBODRMODE_A) -> Self {
200        variant as u8 != 0
201    }
202}
203impl AVDDBODRMODE_R {
204    #[doc = "Get enumerated values variant"]
205    #[inline(always)]
206    pub fn variant(&self) -> AVDDBODRMODE_A {
207        match self.bits {
208            false => AVDDBODRMODE_A::DISABLED,
209            true => AVDDBODRMODE_A::ENABLED,
210        }
211    }
212    #[doc = "Checks if the value of the field is `DISABLED`"]
213    #[inline(always)]
214    pub fn is_disabled(&self) -> bool {
215        *self == AVDDBODRMODE_A::DISABLED
216    }
217    #[doc = "Checks if the value of the field is `ENABLED`"]
218    #[inline(always)]
219    pub fn is_enabled(&self) -> bool {
220        *self == AVDDBODRMODE_A::ENABLED
221    }
222}
223#[doc = "Field `AVDDBODRMODE` writer - Enable AVDD BOD reset"]
224pub type AVDDBODRMODE_W<'a, const O: u8> =
225    crate::BitWriter<'a, u32, RSTCTRL_SPEC, AVDDBODRMODE_A, O>;
226impl<'a, const O: u8> AVDDBODRMODE_W<'a, O> {
227    #[doc = "Reset Request is block"]
228    #[inline(always)]
229    pub fn disabled(self) -> &'a mut W {
230        self.variant(AVDDBODRMODE_A::DISABLED)
231    }
232    #[doc = "The entire device is reset except some EMU registers"]
233    #[inline(always)]
234    pub fn enabled(self) -> &'a mut W {
235        self.variant(AVDDBODRMODE_A::ENABLED)
236    }
237}
238#[doc = "Field `IOVDD0BODRMODE` reader - Enable VDDIO0 BOD reset"]
239pub type IOVDD0BODRMODE_R = crate::BitReader<IOVDD0BODRMODE_A>;
240#[doc = "Enable VDDIO0 BOD reset\n\nValue on reset: 0"]
241#[derive(Clone, Copy, Debug, PartialEq, Eq)]
242pub enum IOVDD0BODRMODE_A {
243    #[doc = "0: Reset request is blocked"]
244    DISABLED = 0,
245    #[doc = "1: The entire device is reset except some EMU registers"]
246    ENABLED = 1,
247}
248impl From<IOVDD0BODRMODE_A> for bool {
249    #[inline(always)]
250    fn from(variant: IOVDD0BODRMODE_A) -> Self {
251        variant as u8 != 0
252    }
253}
254impl IOVDD0BODRMODE_R {
255    #[doc = "Get enumerated values variant"]
256    #[inline(always)]
257    pub fn variant(&self) -> IOVDD0BODRMODE_A {
258        match self.bits {
259            false => IOVDD0BODRMODE_A::DISABLED,
260            true => IOVDD0BODRMODE_A::ENABLED,
261        }
262    }
263    #[doc = "Checks if the value of the field is `DISABLED`"]
264    #[inline(always)]
265    pub fn is_disabled(&self) -> bool {
266        *self == IOVDD0BODRMODE_A::DISABLED
267    }
268    #[doc = "Checks if the value of the field is `ENABLED`"]
269    #[inline(always)]
270    pub fn is_enabled(&self) -> bool {
271        *self == IOVDD0BODRMODE_A::ENABLED
272    }
273}
274#[doc = "Field `IOVDD0BODRMODE` writer - Enable VDDIO0 BOD reset"]
275pub type IOVDD0BODRMODE_W<'a, const O: u8> =
276    crate::BitWriter<'a, u32, RSTCTRL_SPEC, IOVDD0BODRMODE_A, O>;
277impl<'a, const O: u8> IOVDD0BODRMODE_W<'a, O> {
278    #[doc = "Reset request is blocked"]
279    #[inline(always)]
280    pub fn disabled(self) -> &'a mut W {
281        self.variant(IOVDD0BODRMODE_A::DISABLED)
282    }
283    #[doc = "The entire device is reset except some EMU registers"]
284    #[inline(always)]
285    pub fn enabled(self) -> &'a mut W {
286        self.variant(IOVDD0BODRMODE_A::ENABLED)
287    }
288}
289#[doc = "Field `DECBODRMODE` reader - Enable DECBOD reset"]
290pub type DECBODRMODE_R = crate::BitReader<DECBODRMODE_A>;
291#[doc = "Enable DECBOD reset\n\nValue on reset: 1"]
292#[derive(Clone, Copy, Debug, PartialEq, Eq)]
293pub enum DECBODRMODE_A {
294    #[doc = "0: Reset request is blocked"]
295    DISABLED = 0,
296    #[doc = "1: The entire device is reset"]
297    ENABLED = 1,
298}
299impl From<DECBODRMODE_A> for bool {
300    #[inline(always)]
301    fn from(variant: DECBODRMODE_A) -> Self {
302        variant as u8 != 0
303    }
304}
305impl DECBODRMODE_R {
306    #[doc = "Get enumerated values variant"]
307    #[inline(always)]
308    pub fn variant(&self) -> DECBODRMODE_A {
309        match self.bits {
310            false => DECBODRMODE_A::DISABLED,
311            true => DECBODRMODE_A::ENABLED,
312        }
313    }
314    #[doc = "Checks if the value of the field is `DISABLED`"]
315    #[inline(always)]
316    pub fn is_disabled(&self) -> bool {
317        *self == DECBODRMODE_A::DISABLED
318    }
319    #[doc = "Checks if the value of the field is `ENABLED`"]
320    #[inline(always)]
321    pub fn is_enabled(&self) -> bool {
322        *self == DECBODRMODE_A::ENABLED
323    }
324}
325#[doc = "Field `DECBODRMODE` writer - Enable DECBOD reset"]
326pub type DECBODRMODE_W<'a, const O: u8> = crate::BitWriter<'a, u32, RSTCTRL_SPEC, DECBODRMODE_A, O>;
327impl<'a, const O: u8> DECBODRMODE_W<'a, O> {
328    #[doc = "Reset request is blocked"]
329    #[inline(always)]
330    pub fn disabled(self) -> &'a mut W {
331        self.variant(DECBODRMODE_A::DISABLED)
332    }
333    #[doc = "The entire device is reset"]
334    #[inline(always)]
335    pub fn enabled(self) -> &'a mut W {
336        self.variant(DECBODRMODE_A::ENABLED)
337    }
338}
339#[doc = "Field `DCIRMODE` reader - DCI System reset"]
340pub type DCIRMODE_R = crate::BitReader<DCIRMODE_A>;
341#[doc = "DCI System reset\n\nValue on reset: 1"]
342#[derive(Clone, Copy, Debug, PartialEq, Eq)]
343pub enum DCIRMODE_A {
344    #[doc = "0: Reset request blocked"]
345    DISABLED = 0,
346    #[doc = "1: The entire device is reset except some EMU registers"]
347    ENABLED = 1,
348}
349impl From<DCIRMODE_A> for bool {
350    #[inline(always)]
351    fn from(variant: DCIRMODE_A) -> Self {
352        variant as u8 != 0
353    }
354}
355impl DCIRMODE_R {
356    #[doc = "Get enumerated values variant"]
357    #[inline(always)]
358    pub fn variant(&self) -> DCIRMODE_A {
359        match self.bits {
360            false => DCIRMODE_A::DISABLED,
361            true => DCIRMODE_A::ENABLED,
362        }
363    }
364    #[doc = "Checks if the value of the field is `DISABLED`"]
365    #[inline(always)]
366    pub fn is_disabled(&self) -> bool {
367        *self == DCIRMODE_A::DISABLED
368    }
369    #[doc = "Checks if the value of the field is `ENABLED`"]
370    #[inline(always)]
371    pub fn is_enabled(&self) -> bool {
372        *self == DCIRMODE_A::ENABLED
373    }
374}
375#[doc = "Field `DCIRMODE` writer - DCI System reset"]
376pub type DCIRMODE_W<'a, const O: u8> = crate::BitWriter<'a, u32, RSTCTRL_SPEC, DCIRMODE_A, O>;
377impl<'a, const O: u8> DCIRMODE_W<'a, O> {
378    #[doc = "Reset request blocked"]
379    #[inline(always)]
380    pub fn disabled(self) -> &'a mut W {
381        self.variant(DCIRMODE_A::DISABLED)
382    }
383    #[doc = "The entire device is reset except some EMU registers"]
384    #[inline(always)]
385    pub fn enabled(self) -> &'a mut W {
386        self.variant(DCIRMODE_A::ENABLED)
387    }
388}
389impl R {
390    #[doc = "Bit 0 - Enable WDOG0 reset"]
391    #[inline(always)]
392    pub fn wdog0rmode(&self) -> WDOG0RMODE_R {
393        WDOG0RMODE_R::new((self.bits & 1) != 0)
394    }
395    #[doc = "Bit 2 - Enable M33 System reset"]
396    #[inline(always)]
397    pub fn sysrmode(&self) -> SYSRMODE_R {
398        SYSRMODE_R::new(((self.bits >> 2) & 1) != 0)
399    }
400    #[doc = "Bit 3 - Enable M33 Lockup reset"]
401    #[inline(always)]
402    pub fn lockuprmode(&self) -> LOCKUPRMODE_R {
403        LOCKUPRMODE_R::new(((self.bits >> 3) & 1) != 0)
404    }
405    #[doc = "Bit 6 - Enable AVDD BOD reset"]
406    #[inline(always)]
407    pub fn avddbodrmode(&self) -> AVDDBODRMODE_R {
408        AVDDBODRMODE_R::new(((self.bits >> 6) & 1) != 0)
409    }
410    #[doc = "Bit 7 - Enable VDDIO0 BOD reset"]
411    #[inline(always)]
412    pub fn iovdd0bodrmode(&self) -> IOVDD0BODRMODE_R {
413        IOVDD0BODRMODE_R::new(((self.bits >> 7) & 1) != 0)
414    }
415    #[doc = "Bit 10 - Enable DECBOD reset"]
416    #[inline(always)]
417    pub fn decbodrmode(&self) -> DECBODRMODE_R {
418        DECBODRMODE_R::new(((self.bits >> 10) & 1) != 0)
419    }
420    #[doc = "Bit 16 - DCI System reset"]
421    #[inline(always)]
422    pub fn dcirmode(&self) -> DCIRMODE_R {
423        DCIRMODE_R::new(((self.bits >> 16) & 1) != 0)
424    }
425}
426impl W {
427    #[doc = "Bit 0 - Enable WDOG0 reset"]
428    #[inline(always)]
429    #[must_use]
430    pub fn wdog0rmode(&mut self) -> WDOG0RMODE_W<0> {
431        WDOG0RMODE_W::new(self)
432    }
433    #[doc = "Bit 2 - Enable M33 System reset"]
434    #[inline(always)]
435    #[must_use]
436    pub fn sysrmode(&mut self) -> SYSRMODE_W<2> {
437        SYSRMODE_W::new(self)
438    }
439    #[doc = "Bit 3 - Enable M33 Lockup reset"]
440    #[inline(always)]
441    #[must_use]
442    pub fn lockuprmode(&mut self) -> LOCKUPRMODE_W<3> {
443        LOCKUPRMODE_W::new(self)
444    }
445    #[doc = "Bit 6 - Enable AVDD BOD reset"]
446    #[inline(always)]
447    #[must_use]
448    pub fn avddbodrmode(&mut self) -> AVDDBODRMODE_W<6> {
449        AVDDBODRMODE_W::new(self)
450    }
451    #[doc = "Bit 7 - Enable VDDIO0 BOD reset"]
452    #[inline(always)]
453    #[must_use]
454    pub fn iovdd0bodrmode(&mut self) -> IOVDD0BODRMODE_W<7> {
455        IOVDD0BODRMODE_W::new(self)
456    }
457    #[doc = "Bit 10 - Enable DECBOD reset"]
458    #[inline(always)]
459    #[must_use]
460    pub fn decbodrmode(&mut self) -> DECBODRMODE_W<10> {
461        DECBODRMODE_W::new(self)
462    }
463    #[doc = "Bit 16 - DCI System reset"]
464    #[inline(always)]
465    #[must_use]
466    pub fn dcirmode(&mut self) -> DCIRMODE_W<16> {
467        DCIRMODE_W::new(self)
468    }
469    #[doc = "Writes raw bits to the register."]
470    #[inline(always)]
471    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
472        self.0.bits(bits);
473        self
474    }
475}
476#[doc = "No Description\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 [rstctrl](index.html) module"]
477pub struct RSTCTRL_SPEC;
478impl crate::RegisterSpec for RSTCTRL_SPEC {
479    type Ux = u32;
480}
481#[doc = "`read()` method returns [rstctrl::R](R) reader structure"]
482impl crate::Readable for RSTCTRL_SPEC {
483    type Reader = R;
484}
485#[doc = "`write(|w| ..)` method takes [rstctrl::W](W) writer structure"]
486impl crate::Writable for RSTCTRL_SPEC {
487    type Writer = W;
488    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
489    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
490}
491#[doc = "`reset()` method sets RSTCTRL to value 0x4001_0407"]
492impl crate::Resettable for RSTCTRL_SPEC {
493    const RESET_VALUE: Self::Ux = 0x4001_0407;
494}