s32k142w_pac/aips/
pacrd.rs

1#[doc = "Register `PACRD` reader"]
2pub struct R(crate::R<PACRD_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<PACRD_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<PACRD_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<PACRD_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `PACRD` writer"]
17pub struct W(crate::W<PACRD_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<PACRD_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<PACRD_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<PACRD_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Trusted Protect\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39pub enum TP1_A {
40    #[doc = "0: Accesses from an untrusted master are allowed."]
41    TP1_0 = 0,
42    #[doc = "1: Accesses from an untrusted master are not allowed."]
43    TP1_1 = 1,
44}
45impl From<TP1_A> for bool {
46    #[inline(always)]
47    fn from(variant: TP1_A) -> Self {
48        variant as u8 != 0
49    }
50}
51#[doc = "Field `TP1` reader - Trusted Protect"]
52pub struct TP1_R(crate::FieldReader<bool, TP1_A>);
53impl TP1_R {
54    #[inline(always)]
55    pub(crate) fn new(bits: bool) -> Self {
56        TP1_R(crate::FieldReader::new(bits))
57    }
58    #[doc = r"Get enumerated values variant"]
59    #[inline(always)]
60    pub fn variant(&self) -> TP1_A {
61        match self.bits {
62            false => TP1_A::TP1_0,
63            true => TP1_A::TP1_1,
64        }
65    }
66    #[doc = "Checks if the value of the field is `TP1_0`"]
67    #[inline(always)]
68    pub fn is_tp1_0(&self) -> bool {
69        **self == TP1_A::TP1_0
70    }
71    #[doc = "Checks if the value of the field is `TP1_1`"]
72    #[inline(always)]
73    pub fn is_tp1_1(&self) -> bool {
74        **self == TP1_A::TP1_1
75    }
76}
77impl core::ops::Deref for TP1_R {
78    type Target = crate::FieldReader<bool, TP1_A>;
79    #[inline(always)]
80    fn deref(&self) -> &Self::Target {
81        &self.0
82    }
83}
84#[doc = "Field `TP1` writer - Trusted Protect"]
85pub struct TP1_W<'a> {
86    w: &'a mut W,
87}
88impl<'a> TP1_W<'a> {
89    #[doc = r"Writes `variant` to the field"]
90    #[inline(always)]
91    pub fn variant(self, variant: TP1_A) -> &'a mut W {
92        self.bit(variant.into())
93    }
94    #[doc = "Accesses from an untrusted master are allowed."]
95    #[inline(always)]
96    pub fn tp1_0(self) -> &'a mut W {
97        self.variant(TP1_A::TP1_0)
98    }
99    #[doc = "Accesses from an untrusted master are not allowed."]
100    #[inline(always)]
101    pub fn tp1_1(self) -> &'a mut W {
102        self.variant(TP1_A::TP1_1)
103    }
104    #[doc = r"Sets the field bit"]
105    #[inline(always)]
106    pub fn set_bit(self) -> &'a mut W {
107        self.bit(true)
108    }
109    #[doc = r"Clears the field bit"]
110    #[inline(always)]
111    pub fn clear_bit(self) -> &'a mut W {
112        self.bit(false)
113    }
114    #[doc = r"Writes raw bits to the field"]
115    #[inline(always)]
116    pub fn bit(self, value: bool) -> &'a mut W {
117        self.w.bits = (self.w.bits & !(0x01 << 24)) | ((value as u32 & 0x01) << 24);
118        self.w
119    }
120}
121#[doc = "Write Protect\n\nValue on reset: 0"]
122#[derive(Clone, Copy, Debug, PartialEq)]
123pub enum WP1_A {
124    #[doc = "0: This peripheral allows write accesses."]
125    WP1_0 = 0,
126    #[doc = "1: This peripheral is write protected."]
127    WP1_1 = 1,
128}
129impl From<WP1_A> for bool {
130    #[inline(always)]
131    fn from(variant: WP1_A) -> Self {
132        variant as u8 != 0
133    }
134}
135#[doc = "Field `WP1` reader - Write Protect"]
136pub struct WP1_R(crate::FieldReader<bool, WP1_A>);
137impl WP1_R {
138    #[inline(always)]
139    pub(crate) fn new(bits: bool) -> Self {
140        WP1_R(crate::FieldReader::new(bits))
141    }
142    #[doc = r"Get enumerated values variant"]
143    #[inline(always)]
144    pub fn variant(&self) -> WP1_A {
145        match self.bits {
146            false => WP1_A::WP1_0,
147            true => WP1_A::WP1_1,
148        }
149    }
150    #[doc = "Checks if the value of the field is `WP1_0`"]
151    #[inline(always)]
152    pub fn is_wp1_0(&self) -> bool {
153        **self == WP1_A::WP1_0
154    }
155    #[doc = "Checks if the value of the field is `WP1_1`"]
156    #[inline(always)]
157    pub fn is_wp1_1(&self) -> bool {
158        **self == WP1_A::WP1_1
159    }
160}
161impl core::ops::Deref for WP1_R {
162    type Target = crate::FieldReader<bool, WP1_A>;
163    #[inline(always)]
164    fn deref(&self) -> &Self::Target {
165        &self.0
166    }
167}
168#[doc = "Field `WP1` writer - Write Protect"]
169pub struct WP1_W<'a> {
170    w: &'a mut W,
171}
172impl<'a> WP1_W<'a> {
173    #[doc = r"Writes `variant` to the field"]
174    #[inline(always)]
175    pub fn variant(self, variant: WP1_A) -> &'a mut W {
176        self.bit(variant.into())
177    }
178    #[doc = "This peripheral allows write accesses."]
179    #[inline(always)]
180    pub fn wp1_0(self) -> &'a mut W {
181        self.variant(WP1_A::WP1_0)
182    }
183    #[doc = "This peripheral is write protected."]
184    #[inline(always)]
185    pub fn wp1_1(self) -> &'a mut W {
186        self.variant(WP1_A::WP1_1)
187    }
188    #[doc = r"Sets the field bit"]
189    #[inline(always)]
190    pub fn set_bit(self) -> &'a mut W {
191        self.bit(true)
192    }
193    #[doc = r"Clears the field bit"]
194    #[inline(always)]
195    pub fn clear_bit(self) -> &'a mut W {
196        self.bit(false)
197    }
198    #[doc = r"Writes raw bits to the field"]
199    #[inline(always)]
200    pub fn bit(self, value: bool) -> &'a mut W {
201        self.w.bits = (self.w.bits & !(0x01 << 25)) | ((value as u32 & 0x01) << 25);
202        self.w
203    }
204}
205#[doc = "Supervisor Protect\n\nValue on reset: 1"]
206#[derive(Clone, Copy, Debug, PartialEq)]
207pub enum SP1_A {
208    #[doc = "0: This peripheral does not require supervisor privilege level for accesses."]
209    SP1_0 = 0,
210    #[doc = "1: This peripheral requires supervisor privilege level for accesses."]
211    SP1_1 = 1,
212}
213impl From<SP1_A> for bool {
214    #[inline(always)]
215    fn from(variant: SP1_A) -> Self {
216        variant as u8 != 0
217    }
218}
219#[doc = "Field `SP1` reader - Supervisor Protect"]
220pub struct SP1_R(crate::FieldReader<bool, SP1_A>);
221impl SP1_R {
222    #[inline(always)]
223    pub(crate) fn new(bits: bool) -> Self {
224        SP1_R(crate::FieldReader::new(bits))
225    }
226    #[doc = r"Get enumerated values variant"]
227    #[inline(always)]
228    pub fn variant(&self) -> SP1_A {
229        match self.bits {
230            false => SP1_A::SP1_0,
231            true => SP1_A::SP1_1,
232        }
233    }
234    #[doc = "Checks if the value of the field is `SP1_0`"]
235    #[inline(always)]
236    pub fn is_sp1_0(&self) -> bool {
237        **self == SP1_A::SP1_0
238    }
239    #[doc = "Checks if the value of the field is `SP1_1`"]
240    #[inline(always)]
241    pub fn is_sp1_1(&self) -> bool {
242        **self == SP1_A::SP1_1
243    }
244}
245impl core::ops::Deref for SP1_R {
246    type Target = crate::FieldReader<bool, SP1_A>;
247    #[inline(always)]
248    fn deref(&self) -> &Self::Target {
249        &self.0
250    }
251}
252#[doc = "Field `SP1` writer - Supervisor Protect"]
253pub struct SP1_W<'a> {
254    w: &'a mut W,
255}
256impl<'a> SP1_W<'a> {
257    #[doc = r"Writes `variant` to the field"]
258    #[inline(always)]
259    pub fn variant(self, variant: SP1_A) -> &'a mut W {
260        self.bit(variant.into())
261    }
262    #[doc = "This peripheral does not require supervisor privilege level for accesses."]
263    #[inline(always)]
264    pub fn sp1_0(self) -> &'a mut W {
265        self.variant(SP1_A::SP1_0)
266    }
267    #[doc = "This peripheral requires supervisor privilege level for accesses."]
268    #[inline(always)]
269    pub fn sp1_1(self) -> &'a mut W {
270        self.variant(SP1_A::SP1_1)
271    }
272    #[doc = r"Sets the field bit"]
273    #[inline(always)]
274    pub fn set_bit(self) -> &'a mut W {
275        self.bit(true)
276    }
277    #[doc = r"Clears the field bit"]
278    #[inline(always)]
279    pub fn clear_bit(self) -> &'a mut W {
280        self.bit(false)
281    }
282    #[doc = r"Writes raw bits to the field"]
283    #[inline(always)]
284    pub fn bit(self, value: bool) -> &'a mut W {
285        self.w.bits = (self.w.bits & !(0x01 << 26)) | ((value as u32 & 0x01) << 26);
286        self.w
287    }
288}
289#[doc = "Trusted Protect\n\nValue on reset: 0"]
290#[derive(Clone, Copy, Debug, PartialEq)]
291pub enum TP0_A {
292    #[doc = "0: Accesses from an untrusted master are allowed."]
293    TP0_0 = 0,
294    #[doc = "1: Accesses from an untrusted master are not allowed."]
295    TP0_1 = 1,
296}
297impl From<TP0_A> for bool {
298    #[inline(always)]
299    fn from(variant: TP0_A) -> Self {
300        variant as u8 != 0
301    }
302}
303#[doc = "Field `TP0` reader - Trusted Protect"]
304pub struct TP0_R(crate::FieldReader<bool, TP0_A>);
305impl TP0_R {
306    #[inline(always)]
307    pub(crate) fn new(bits: bool) -> Self {
308        TP0_R(crate::FieldReader::new(bits))
309    }
310    #[doc = r"Get enumerated values variant"]
311    #[inline(always)]
312    pub fn variant(&self) -> TP0_A {
313        match self.bits {
314            false => TP0_A::TP0_0,
315            true => TP0_A::TP0_1,
316        }
317    }
318    #[doc = "Checks if the value of the field is `TP0_0`"]
319    #[inline(always)]
320    pub fn is_tp0_0(&self) -> bool {
321        **self == TP0_A::TP0_0
322    }
323    #[doc = "Checks if the value of the field is `TP0_1`"]
324    #[inline(always)]
325    pub fn is_tp0_1(&self) -> bool {
326        **self == TP0_A::TP0_1
327    }
328}
329impl core::ops::Deref for TP0_R {
330    type Target = crate::FieldReader<bool, TP0_A>;
331    #[inline(always)]
332    fn deref(&self) -> &Self::Target {
333        &self.0
334    }
335}
336#[doc = "Field `TP0` writer - Trusted Protect"]
337pub struct TP0_W<'a> {
338    w: &'a mut W,
339}
340impl<'a> TP0_W<'a> {
341    #[doc = r"Writes `variant` to the field"]
342    #[inline(always)]
343    pub fn variant(self, variant: TP0_A) -> &'a mut W {
344        self.bit(variant.into())
345    }
346    #[doc = "Accesses from an untrusted master are allowed."]
347    #[inline(always)]
348    pub fn tp0_0(self) -> &'a mut W {
349        self.variant(TP0_A::TP0_0)
350    }
351    #[doc = "Accesses from an untrusted master are not allowed."]
352    #[inline(always)]
353    pub fn tp0_1(self) -> &'a mut W {
354        self.variant(TP0_A::TP0_1)
355    }
356    #[doc = r"Sets the field bit"]
357    #[inline(always)]
358    pub fn set_bit(self) -> &'a mut W {
359        self.bit(true)
360    }
361    #[doc = r"Clears the field bit"]
362    #[inline(always)]
363    pub fn clear_bit(self) -> &'a mut W {
364        self.bit(false)
365    }
366    #[doc = r"Writes raw bits to the field"]
367    #[inline(always)]
368    pub fn bit(self, value: bool) -> &'a mut W {
369        self.w.bits = (self.w.bits & !(0x01 << 28)) | ((value as u32 & 0x01) << 28);
370        self.w
371    }
372}
373#[doc = "Write Protect\n\nValue on reset: 0"]
374#[derive(Clone, Copy, Debug, PartialEq)]
375pub enum WP0_A {
376    #[doc = "0: This peripheral allows write accesses."]
377    WP0_0 = 0,
378    #[doc = "1: This peripheral is write protected."]
379    WP0_1 = 1,
380}
381impl From<WP0_A> for bool {
382    #[inline(always)]
383    fn from(variant: WP0_A) -> Self {
384        variant as u8 != 0
385    }
386}
387#[doc = "Field `WP0` reader - Write Protect"]
388pub struct WP0_R(crate::FieldReader<bool, WP0_A>);
389impl WP0_R {
390    #[inline(always)]
391    pub(crate) fn new(bits: bool) -> Self {
392        WP0_R(crate::FieldReader::new(bits))
393    }
394    #[doc = r"Get enumerated values variant"]
395    #[inline(always)]
396    pub fn variant(&self) -> WP0_A {
397        match self.bits {
398            false => WP0_A::WP0_0,
399            true => WP0_A::WP0_1,
400        }
401    }
402    #[doc = "Checks if the value of the field is `WP0_0`"]
403    #[inline(always)]
404    pub fn is_wp0_0(&self) -> bool {
405        **self == WP0_A::WP0_0
406    }
407    #[doc = "Checks if the value of the field is `WP0_1`"]
408    #[inline(always)]
409    pub fn is_wp0_1(&self) -> bool {
410        **self == WP0_A::WP0_1
411    }
412}
413impl core::ops::Deref for WP0_R {
414    type Target = crate::FieldReader<bool, WP0_A>;
415    #[inline(always)]
416    fn deref(&self) -> &Self::Target {
417        &self.0
418    }
419}
420#[doc = "Field `WP0` writer - Write Protect"]
421pub struct WP0_W<'a> {
422    w: &'a mut W,
423}
424impl<'a> WP0_W<'a> {
425    #[doc = r"Writes `variant` to the field"]
426    #[inline(always)]
427    pub fn variant(self, variant: WP0_A) -> &'a mut W {
428        self.bit(variant.into())
429    }
430    #[doc = "This peripheral allows write accesses."]
431    #[inline(always)]
432    pub fn wp0_0(self) -> &'a mut W {
433        self.variant(WP0_A::WP0_0)
434    }
435    #[doc = "This peripheral is write protected."]
436    #[inline(always)]
437    pub fn wp0_1(self) -> &'a mut W {
438        self.variant(WP0_A::WP0_1)
439    }
440    #[doc = r"Sets the field bit"]
441    #[inline(always)]
442    pub fn set_bit(self) -> &'a mut W {
443        self.bit(true)
444    }
445    #[doc = r"Clears the field bit"]
446    #[inline(always)]
447    pub fn clear_bit(self) -> &'a mut W {
448        self.bit(false)
449    }
450    #[doc = r"Writes raw bits to the field"]
451    #[inline(always)]
452    pub fn bit(self, value: bool) -> &'a mut W {
453        self.w.bits = (self.w.bits & !(0x01 << 29)) | ((value as u32 & 0x01) << 29);
454        self.w
455    }
456}
457#[doc = "Supervisor Protect\n\nValue on reset: 1"]
458#[derive(Clone, Copy, Debug, PartialEq)]
459pub enum SP0_A {
460    #[doc = "0: This peripheral does not require supervisor privilege level for accesses."]
461    SP0_0 = 0,
462    #[doc = "1: This peripheral requires supervisor privilege level for accesses."]
463    SP0_1 = 1,
464}
465impl From<SP0_A> for bool {
466    #[inline(always)]
467    fn from(variant: SP0_A) -> Self {
468        variant as u8 != 0
469    }
470}
471#[doc = "Field `SP0` reader - Supervisor Protect"]
472pub struct SP0_R(crate::FieldReader<bool, SP0_A>);
473impl SP0_R {
474    #[inline(always)]
475    pub(crate) fn new(bits: bool) -> Self {
476        SP0_R(crate::FieldReader::new(bits))
477    }
478    #[doc = r"Get enumerated values variant"]
479    #[inline(always)]
480    pub fn variant(&self) -> SP0_A {
481        match self.bits {
482            false => SP0_A::SP0_0,
483            true => SP0_A::SP0_1,
484        }
485    }
486    #[doc = "Checks if the value of the field is `SP0_0`"]
487    #[inline(always)]
488    pub fn is_sp0_0(&self) -> bool {
489        **self == SP0_A::SP0_0
490    }
491    #[doc = "Checks if the value of the field is `SP0_1`"]
492    #[inline(always)]
493    pub fn is_sp0_1(&self) -> bool {
494        **self == SP0_A::SP0_1
495    }
496}
497impl core::ops::Deref for SP0_R {
498    type Target = crate::FieldReader<bool, SP0_A>;
499    #[inline(always)]
500    fn deref(&self) -> &Self::Target {
501        &self.0
502    }
503}
504#[doc = "Field `SP0` writer - Supervisor Protect"]
505pub struct SP0_W<'a> {
506    w: &'a mut W,
507}
508impl<'a> SP0_W<'a> {
509    #[doc = r"Writes `variant` to the field"]
510    #[inline(always)]
511    pub fn variant(self, variant: SP0_A) -> &'a mut W {
512        self.bit(variant.into())
513    }
514    #[doc = "This peripheral does not require supervisor privilege level for accesses."]
515    #[inline(always)]
516    pub fn sp0_0(self) -> &'a mut W {
517        self.variant(SP0_A::SP0_0)
518    }
519    #[doc = "This peripheral requires supervisor privilege level for accesses."]
520    #[inline(always)]
521    pub fn sp0_1(self) -> &'a mut W {
522        self.variant(SP0_A::SP0_1)
523    }
524    #[doc = r"Sets the field bit"]
525    #[inline(always)]
526    pub fn set_bit(self) -> &'a mut W {
527        self.bit(true)
528    }
529    #[doc = r"Clears the field bit"]
530    #[inline(always)]
531    pub fn clear_bit(self) -> &'a mut W {
532        self.bit(false)
533    }
534    #[doc = r"Writes raw bits to the field"]
535    #[inline(always)]
536    pub fn bit(self, value: bool) -> &'a mut W {
537        self.w.bits = (self.w.bits & !(0x01 << 30)) | ((value as u32 & 0x01) << 30);
538        self.w
539    }
540}
541impl R {
542    #[doc = "Bit 24 - Trusted Protect"]
543    #[inline(always)]
544    pub fn tp1(&self) -> TP1_R {
545        TP1_R::new(((self.bits >> 24) & 0x01) != 0)
546    }
547    #[doc = "Bit 25 - Write Protect"]
548    #[inline(always)]
549    pub fn wp1(&self) -> WP1_R {
550        WP1_R::new(((self.bits >> 25) & 0x01) != 0)
551    }
552    #[doc = "Bit 26 - Supervisor Protect"]
553    #[inline(always)]
554    pub fn sp1(&self) -> SP1_R {
555        SP1_R::new(((self.bits >> 26) & 0x01) != 0)
556    }
557    #[doc = "Bit 28 - Trusted Protect"]
558    #[inline(always)]
559    pub fn tp0(&self) -> TP0_R {
560        TP0_R::new(((self.bits >> 28) & 0x01) != 0)
561    }
562    #[doc = "Bit 29 - Write Protect"]
563    #[inline(always)]
564    pub fn wp0(&self) -> WP0_R {
565        WP0_R::new(((self.bits >> 29) & 0x01) != 0)
566    }
567    #[doc = "Bit 30 - Supervisor Protect"]
568    #[inline(always)]
569    pub fn sp0(&self) -> SP0_R {
570        SP0_R::new(((self.bits >> 30) & 0x01) != 0)
571    }
572}
573impl W {
574    #[doc = "Bit 24 - Trusted Protect"]
575    #[inline(always)]
576    pub fn tp1(&mut self) -> TP1_W {
577        TP1_W { w: self }
578    }
579    #[doc = "Bit 25 - Write Protect"]
580    #[inline(always)]
581    pub fn wp1(&mut self) -> WP1_W {
582        WP1_W { w: self }
583    }
584    #[doc = "Bit 26 - Supervisor Protect"]
585    #[inline(always)]
586    pub fn sp1(&mut self) -> SP1_W {
587        SP1_W { w: self }
588    }
589    #[doc = "Bit 28 - Trusted Protect"]
590    #[inline(always)]
591    pub fn tp0(&mut self) -> TP0_W {
592        TP0_W { w: self }
593    }
594    #[doc = "Bit 29 - Write Protect"]
595    #[inline(always)]
596    pub fn wp0(&mut self) -> WP0_W {
597        WP0_W { w: self }
598    }
599    #[doc = "Bit 30 - Supervisor Protect"]
600    #[inline(always)]
601    pub fn sp0(&mut self) -> SP0_W {
602        SP0_W { w: self }
603    }
604    #[doc = "Writes raw bits to the register."]
605    #[inline(always)]
606    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
607        self.0.bits(bits);
608        self
609    }
610}
611#[doc = "Peripheral Access 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 [pacrd](index.html) module"]
612pub struct PACRD_SPEC;
613impl crate::RegisterSpec for PACRD_SPEC {
614    type Ux = u32;
615}
616#[doc = "`read()` method returns [pacrd::R](R) reader structure"]
617impl crate::Readable for PACRD_SPEC {
618    type Reader = R;
619}
620#[doc = "`write(|w| ..)` method takes [pacrd::W](W) writer structure"]
621impl crate::Writable for PACRD_SPEC {
622    type Writer = W;
623}
624#[doc = "`reset()` method sets PACRD to value 0x4400_0000"]
625impl crate::Resettable for PACRD_SPEC {
626    #[inline(always)]
627    fn reset_value() -> Self::Ux {
628        0x4400_0000
629    }
630}