s32k142_pac/crc/
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 = "TCRC\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39pub enum TCRC_A {
40    #[doc = "0: 16-bit CRC protocol."]
41    _0 = 0,
42    #[doc = "1: 32-bit CRC protocol."]
43    _1 = 1,
44}
45impl From<TCRC_A> for bool {
46    #[inline(always)]
47    fn from(variant: TCRC_A) -> Self {
48        variant as u8 != 0
49    }
50}
51#[doc = "Field `TCRC` reader - TCRC"]
52pub struct TCRC_R(crate::FieldReader<bool, TCRC_A>);
53impl TCRC_R {
54    #[inline(always)]
55    pub(crate) fn new(bits: bool) -> Self {
56        TCRC_R(crate::FieldReader::new(bits))
57    }
58    #[doc = r"Get enumerated values variant"]
59    #[inline(always)]
60    pub fn variant(&self) -> TCRC_A {
61        match self.bits {
62            false => TCRC_A::_0,
63            true => TCRC_A::_1,
64        }
65    }
66    #[doc = "Checks if the value of the field is `_0`"]
67    #[inline(always)]
68    pub fn is_0(&self) -> bool {
69        **self == TCRC_A::_0
70    }
71    #[doc = "Checks if the value of the field is `_1`"]
72    #[inline(always)]
73    pub fn is_1(&self) -> bool {
74        **self == TCRC_A::_1
75    }
76}
77impl core::ops::Deref for TCRC_R {
78    type Target = crate::FieldReader<bool, TCRC_A>;
79    #[inline(always)]
80    fn deref(&self) -> &Self::Target {
81        &self.0
82    }
83}
84#[doc = "Field `TCRC` writer - TCRC"]
85pub struct TCRC_W<'a> {
86    w: &'a mut W,
87}
88impl<'a> TCRC_W<'a> {
89    #[doc = r"Writes `variant` to the field"]
90    #[inline(always)]
91    pub fn variant(self, variant: TCRC_A) -> &'a mut W {
92        self.bit(variant.into())
93    }
94    #[doc = "16-bit CRC protocol."]
95    #[inline(always)]
96    pub fn _0(self) -> &'a mut W {
97        self.variant(TCRC_A::_0)
98    }
99    #[doc = "32-bit CRC protocol."]
100    #[inline(always)]
101    pub fn _1(self) -> &'a mut W {
102        self.variant(TCRC_A::_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 CRC Data Register As Seed\n\nValue on reset: 0"]
122#[derive(Clone, Copy, Debug, PartialEq)]
123pub enum WAS_A {
124    #[doc = "0: Writes to the CRC data register are data values."]
125    _0 = 0,
126    #[doc = "1: Writes to the CRC data register are seed values."]
127    _1 = 1,
128}
129impl From<WAS_A> for bool {
130    #[inline(always)]
131    fn from(variant: WAS_A) -> Self {
132        variant as u8 != 0
133    }
134}
135#[doc = "Field `WAS` reader - Write CRC Data Register As Seed"]
136pub struct WAS_R(crate::FieldReader<bool, WAS_A>);
137impl WAS_R {
138    #[inline(always)]
139    pub(crate) fn new(bits: bool) -> Self {
140        WAS_R(crate::FieldReader::new(bits))
141    }
142    #[doc = r"Get enumerated values variant"]
143    #[inline(always)]
144    pub fn variant(&self) -> WAS_A {
145        match self.bits {
146            false => WAS_A::_0,
147            true => WAS_A::_1,
148        }
149    }
150    #[doc = "Checks if the value of the field is `_0`"]
151    #[inline(always)]
152    pub fn is_0(&self) -> bool {
153        **self == WAS_A::_0
154    }
155    #[doc = "Checks if the value of the field is `_1`"]
156    #[inline(always)]
157    pub fn is_1(&self) -> bool {
158        **self == WAS_A::_1
159    }
160}
161impl core::ops::Deref for WAS_R {
162    type Target = crate::FieldReader<bool, WAS_A>;
163    #[inline(always)]
164    fn deref(&self) -> &Self::Target {
165        &self.0
166    }
167}
168#[doc = "Field `WAS` writer - Write CRC Data Register As Seed"]
169pub struct WAS_W<'a> {
170    w: &'a mut W,
171}
172impl<'a> WAS_W<'a> {
173    #[doc = r"Writes `variant` to the field"]
174    #[inline(always)]
175    pub fn variant(self, variant: WAS_A) -> &'a mut W {
176        self.bit(variant.into())
177    }
178    #[doc = "Writes to the CRC data register are data values."]
179    #[inline(always)]
180    pub fn _0(self) -> &'a mut W {
181        self.variant(WAS_A::_0)
182    }
183    #[doc = "Writes to the CRC data register are seed values."]
184    #[inline(always)]
185    pub fn _1(self) -> &'a mut W {
186        self.variant(WAS_A::_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 = "Complement Read Of CRC Data Register\n\nValue on reset: 0"]
206#[derive(Clone, Copy, Debug, PartialEq)]
207pub enum FXOR_A {
208    #[doc = "0: No XOR on reading."]
209    _0 = 0,
210    #[doc = "1: Invert or complement the read value of the CRC Data register."]
211    _1 = 1,
212}
213impl From<FXOR_A> for bool {
214    #[inline(always)]
215    fn from(variant: FXOR_A) -> Self {
216        variant as u8 != 0
217    }
218}
219#[doc = "Field `FXOR` reader - Complement Read Of CRC Data Register"]
220pub struct FXOR_R(crate::FieldReader<bool, FXOR_A>);
221impl FXOR_R {
222    #[inline(always)]
223    pub(crate) fn new(bits: bool) -> Self {
224        FXOR_R(crate::FieldReader::new(bits))
225    }
226    #[doc = r"Get enumerated values variant"]
227    #[inline(always)]
228    pub fn variant(&self) -> FXOR_A {
229        match self.bits {
230            false => FXOR_A::_0,
231            true => FXOR_A::_1,
232        }
233    }
234    #[doc = "Checks if the value of the field is `_0`"]
235    #[inline(always)]
236    pub fn is_0(&self) -> bool {
237        **self == FXOR_A::_0
238    }
239    #[doc = "Checks if the value of the field is `_1`"]
240    #[inline(always)]
241    pub fn is_1(&self) -> bool {
242        **self == FXOR_A::_1
243    }
244}
245impl core::ops::Deref for FXOR_R {
246    type Target = crate::FieldReader<bool, FXOR_A>;
247    #[inline(always)]
248    fn deref(&self) -> &Self::Target {
249        &self.0
250    }
251}
252#[doc = "Field `FXOR` writer - Complement Read Of CRC Data Register"]
253pub struct FXOR_W<'a> {
254    w: &'a mut W,
255}
256impl<'a> FXOR_W<'a> {
257    #[doc = r"Writes `variant` to the field"]
258    #[inline(always)]
259    pub fn variant(self, variant: FXOR_A) -> &'a mut W {
260        self.bit(variant.into())
261    }
262    #[doc = "No XOR on reading."]
263    #[inline(always)]
264    pub fn _0(self) -> &'a mut W {
265        self.variant(FXOR_A::_0)
266    }
267    #[doc = "Invert or complement the read value of the CRC Data register."]
268    #[inline(always)]
269    pub fn _1(self) -> &'a mut W {
270        self.variant(FXOR_A::_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 = "Type Of Transpose For Read\n\nValue on reset: 0"]
290#[derive(Clone, Copy, Debug, PartialEq)]
291#[repr(u8)]
292pub enum TOTR_A {
293    #[doc = "0: No transposition."]
294    _00 = 0,
295    #[doc = "1: Bits in bytes are transposed; bytes are not transposed."]
296    _01 = 1,
297    #[doc = "2: Both bits in bytes and bytes are transposed."]
298    _10 = 2,
299    #[doc = "3: Only bytes are transposed; no bits in a byte are transposed."]
300    _11 = 3,
301}
302impl From<TOTR_A> for u8 {
303    #[inline(always)]
304    fn from(variant: TOTR_A) -> Self {
305        variant as _
306    }
307}
308#[doc = "Field `TOTR` reader - Type Of Transpose For Read"]
309pub struct TOTR_R(crate::FieldReader<u8, TOTR_A>);
310impl TOTR_R {
311    #[inline(always)]
312    pub(crate) fn new(bits: u8) -> Self {
313        TOTR_R(crate::FieldReader::new(bits))
314    }
315    #[doc = r"Get enumerated values variant"]
316    #[inline(always)]
317    pub fn variant(&self) -> TOTR_A {
318        match self.bits {
319            0 => TOTR_A::_00,
320            1 => TOTR_A::_01,
321            2 => TOTR_A::_10,
322            3 => TOTR_A::_11,
323            _ => unreachable!(),
324        }
325    }
326    #[doc = "Checks if the value of the field is `_00`"]
327    #[inline(always)]
328    pub fn is_00(&self) -> bool {
329        **self == TOTR_A::_00
330    }
331    #[doc = "Checks if the value of the field is `_01`"]
332    #[inline(always)]
333    pub fn is_01(&self) -> bool {
334        **self == TOTR_A::_01
335    }
336    #[doc = "Checks if the value of the field is `_10`"]
337    #[inline(always)]
338    pub fn is_10(&self) -> bool {
339        **self == TOTR_A::_10
340    }
341    #[doc = "Checks if the value of the field is `_11`"]
342    #[inline(always)]
343    pub fn is_11(&self) -> bool {
344        **self == TOTR_A::_11
345    }
346}
347impl core::ops::Deref for TOTR_R {
348    type Target = crate::FieldReader<u8, TOTR_A>;
349    #[inline(always)]
350    fn deref(&self) -> &Self::Target {
351        &self.0
352    }
353}
354#[doc = "Field `TOTR` writer - Type Of Transpose For Read"]
355pub struct TOTR_W<'a> {
356    w: &'a mut W,
357}
358impl<'a> TOTR_W<'a> {
359    #[doc = r"Writes `variant` to the field"]
360    #[inline(always)]
361    pub fn variant(self, variant: TOTR_A) -> &'a mut W {
362        self.bits(variant.into())
363    }
364    #[doc = "No transposition."]
365    #[inline(always)]
366    pub fn _00(self) -> &'a mut W {
367        self.variant(TOTR_A::_00)
368    }
369    #[doc = "Bits in bytes are transposed; bytes are not transposed."]
370    #[inline(always)]
371    pub fn _01(self) -> &'a mut W {
372        self.variant(TOTR_A::_01)
373    }
374    #[doc = "Both bits in bytes and bytes are transposed."]
375    #[inline(always)]
376    pub fn _10(self) -> &'a mut W {
377        self.variant(TOTR_A::_10)
378    }
379    #[doc = "Only bytes are transposed; no bits in a byte are transposed."]
380    #[inline(always)]
381    pub fn _11(self) -> &'a mut W {
382        self.variant(TOTR_A::_11)
383    }
384    #[doc = r"Writes raw bits to the field"]
385    #[inline(always)]
386    pub fn bits(self, value: u8) -> &'a mut W {
387        self.w.bits = (self.w.bits & !(0x03 << 28)) | ((value as u32 & 0x03) << 28);
388        self.w
389    }
390}
391#[doc = "Type Of Transpose For Writes\n\nValue on reset: 0"]
392#[derive(Clone, Copy, Debug, PartialEq)]
393#[repr(u8)]
394pub enum TOT_A {
395    #[doc = "0: No transposition."]
396    _00 = 0,
397    #[doc = "1: Bits in bytes are transposed; bytes are not transposed."]
398    _01 = 1,
399    #[doc = "2: Both bits in bytes and bytes are transposed."]
400    _10 = 2,
401    #[doc = "3: Only bytes are transposed; no bits in a byte are transposed."]
402    _11 = 3,
403}
404impl From<TOT_A> for u8 {
405    #[inline(always)]
406    fn from(variant: TOT_A) -> Self {
407        variant as _
408    }
409}
410#[doc = "Field `TOT` reader - Type Of Transpose For Writes"]
411pub struct TOT_R(crate::FieldReader<u8, TOT_A>);
412impl TOT_R {
413    #[inline(always)]
414    pub(crate) fn new(bits: u8) -> Self {
415        TOT_R(crate::FieldReader::new(bits))
416    }
417    #[doc = r"Get enumerated values variant"]
418    #[inline(always)]
419    pub fn variant(&self) -> TOT_A {
420        match self.bits {
421            0 => TOT_A::_00,
422            1 => TOT_A::_01,
423            2 => TOT_A::_10,
424            3 => TOT_A::_11,
425            _ => unreachable!(),
426        }
427    }
428    #[doc = "Checks if the value of the field is `_00`"]
429    #[inline(always)]
430    pub fn is_00(&self) -> bool {
431        **self == TOT_A::_00
432    }
433    #[doc = "Checks if the value of the field is `_01`"]
434    #[inline(always)]
435    pub fn is_01(&self) -> bool {
436        **self == TOT_A::_01
437    }
438    #[doc = "Checks if the value of the field is `_10`"]
439    #[inline(always)]
440    pub fn is_10(&self) -> bool {
441        **self == TOT_A::_10
442    }
443    #[doc = "Checks if the value of the field is `_11`"]
444    #[inline(always)]
445    pub fn is_11(&self) -> bool {
446        **self == TOT_A::_11
447    }
448}
449impl core::ops::Deref for TOT_R {
450    type Target = crate::FieldReader<u8, TOT_A>;
451    #[inline(always)]
452    fn deref(&self) -> &Self::Target {
453        &self.0
454    }
455}
456#[doc = "Field `TOT` writer - Type Of Transpose For Writes"]
457pub struct TOT_W<'a> {
458    w: &'a mut W,
459}
460impl<'a> TOT_W<'a> {
461    #[doc = r"Writes `variant` to the field"]
462    #[inline(always)]
463    pub fn variant(self, variant: TOT_A) -> &'a mut W {
464        self.bits(variant.into())
465    }
466    #[doc = "No transposition."]
467    #[inline(always)]
468    pub fn _00(self) -> &'a mut W {
469        self.variant(TOT_A::_00)
470    }
471    #[doc = "Bits in bytes are transposed; bytes are not transposed."]
472    #[inline(always)]
473    pub fn _01(self) -> &'a mut W {
474        self.variant(TOT_A::_01)
475    }
476    #[doc = "Both bits in bytes and bytes are transposed."]
477    #[inline(always)]
478    pub fn _10(self) -> &'a mut W {
479        self.variant(TOT_A::_10)
480    }
481    #[doc = "Only bytes are transposed; no bits in a byte are transposed."]
482    #[inline(always)]
483    pub fn _11(self) -> &'a mut W {
484        self.variant(TOT_A::_11)
485    }
486    #[doc = r"Writes raw bits to the field"]
487    #[inline(always)]
488    pub fn bits(self, value: u8) -> &'a mut W {
489        self.w.bits = (self.w.bits & !(0x03 << 30)) | ((value as u32 & 0x03) << 30);
490        self.w
491    }
492}
493impl R {
494    #[doc = "Bit 24 - TCRC"]
495    #[inline(always)]
496    pub fn tcrc(&self) -> TCRC_R {
497        TCRC_R::new(((self.bits >> 24) & 0x01) != 0)
498    }
499    #[doc = "Bit 25 - Write CRC Data Register As Seed"]
500    #[inline(always)]
501    pub fn was(&self) -> WAS_R {
502        WAS_R::new(((self.bits >> 25) & 0x01) != 0)
503    }
504    #[doc = "Bit 26 - Complement Read Of CRC Data Register"]
505    #[inline(always)]
506    pub fn fxor(&self) -> FXOR_R {
507        FXOR_R::new(((self.bits >> 26) & 0x01) != 0)
508    }
509    #[doc = "Bits 28:29 - Type Of Transpose For Read"]
510    #[inline(always)]
511    pub fn totr(&self) -> TOTR_R {
512        TOTR_R::new(((self.bits >> 28) & 0x03) as u8)
513    }
514    #[doc = "Bits 30:31 - Type Of Transpose For Writes"]
515    #[inline(always)]
516    pub fn tot(&self) -> TOT_R {
517        TOT_R::new(((self.bits >> 30) & 0x03) as u8)
518    }
519}
520impl W {
521    #[doc = "Bit 24 - TCRC"]
522    #[inline(always)]
523    pub fn tcrc(&mut self) -> TCRC_W {
524        TCRC_W { w: self }
525    }
526    #[doc = "Bit 25 - Write CRC Data Register As Seed"]
527    #[inline(always)]
528    pub fn was(&mut self) -> WAS_W {
529        WAS_W { w: self }
530    }
531    #[doc = "Bit 26 - Complement Read Of CRC Data Register"]
532    #[inline(always)]
533    pub fn fxor(&mut self) -> FXOR_W {
534        FXOR_W { w: self }
535    }
536    #[doc = "Bits 28:29 - Type Of Transpose For Read"]
537    #[inline(always)]
538    pub fn totr(&mut self) -> TOTR_W {
539        TOTR_W { w: self }
540    }
541    #[doc = "Bits 30:31 - Type Of Transpose For Writes"]
542    #[inline(always)]
543    pub fn tot(&mut self) -> TOT_W {
544        TOT_W { w: self }
545    }
546    #[doc = "Writes raw bits to the register."]
547    #[inline(always)]
548    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
549        self.0.bits(bits);
550        self
551    }
552}
553#[doc = "CRC 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"]
554pub struct CTRL_SPEC;
555impl crate::RegisterSpec for CTRL_SPEC {
556    type Ux = u32;
557}
558#[doc = "`read()` method returns [ctrl::R](R) reader structure"]
559impl crate::Readable for CTRL_SPEC {
560    type Reader = R;
561}
562#[doc = "`write(|w| ..)` method takes [ctrl::W](W) writer structure"]
563impl crate::Writable for CTRL_SPEC {
564    type Writer = W;
565}
566#[doc = "`reset()` method sets CTRL to value 0"]
567impl crate::Resettable for CTRL_SPEC {
568    #[inline(always)]
569    fn reset_value() -> Self::Ux {
570        0
571    }
572}