mk20d7/crc/ctrl/
mod.rs

1#[doc = r" Value read from the register"]
2pub struct R {
3    bits: u32,
4}
5#[doc = r" Value to write to the register"]
6pub struct W {
7    bits: u32,
8}
9impl super::CTRL {
10    #[doc = r" Modifies the contents of the register"]
11    #[inline]
12    pub fn modify<F>(&self, f: F)
13    where
14        for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
15    {
16        let bits = self.register.get();
17        let r = R { bits: bits };
18        let mut w = W { bits: bits };
19        f(&r, &mut w);
20        self.register.set(w.bits);
21    }
22    #[doc = r" Reads the contents of the register"]
23    #[inline]
24    pub fn read(&self) -> R {
25        R {
26            bits: self.register.get(),
27        }
28    }
29    #[doc = r" Writes to the register"]
30    #[inline]
31    pub fn write<F>(&self, f: F)
32    where
33        F: FnOnce(&mut W) -> &mut W,
34    {
35        let mut w = W::reset_value();
36        f(&mut w);
37        self.register.set(w.bits);
38    }
39    #[doc = r" Writes the reset value to the register"]
40    #[inline]
41    pub fn reset(&self) {
42        self.write(|w| w)
43    }
44}
45#[doc = "Possible values of the field `TCRC`"]
46#[derive(Clone, Copy, Debug, PartialEq)]
47pub enum TCRCR {
48    #[doc = "16-bit CRC protocol."]
49    _0,
50    #[doc = "32-bit CRC protocol."]
51    _1,
52}
53impl TCRCR {
54    #[doc = r" Returns `true` if the bit is clear (0)"]
55    #[inline]
56    pub fn bit_is_clear(&self) -> bool {
57        !self.bit()
58    }
59    #[doc = r" Returns `true` if the bit is set (1)"]
60    #[inline]
61    pub fn bit_is_set(&self) -> bool {
62        self.bit()
63    }
64    #[doc = r" Value of the field as raw bits"]
65    #[inline]
66    pub fn bit(&self) -> bool {
67        match *self {
68            TCRCR::_0 => false,
69            TCRCR::_1 => true,
70        }
71    }
72    #[allow(missing_docs)]
73    #[doc(hidden)]
74    #[inline]
75    pub fn _from(value: bool) -> TCRCR {
76        match value {
77            false => TCRCR::_0,
78            true => TCRCR::_1,
79        }
80    }
81    #[doc = "Checks if the value of the field is `_0`"]
82    #[inline]
83    pub fn is_0(&self) -> bool {
84        *self == TCRCR::_0
85    }
86    #[doc = "Checks if the value of the field is `_1`"]
87    #[inline]
88    pub fn is_1(&self) -> bool {
89        *self == TCRCR::_1
90    }
91}
92#[doc = "Possible values of the field `WAS`"]
93#[derive(Clone, Copy, Debug, PartialEq)]
94pub enum WASR {
95    #[doc = "Writes to the CRC data register are data values."]
96    _0,
97    #[doc = "Writes to the CRC data register are seed values."]
98    _1,
99}
100impl WASR {
101    #[doc = r" Returns `true` if the bit is clear (0)"]
102    #[inline]
103    pub fn bit_is_clear(&self) -> bool {
104        !self.bit()
105    }
106    #[doc = r" Returns `true` if the bit is set (1)"]
107    #[inline]
108    pub fn bit_is_set(&self) -> bool {
109        self.bit()
110    }
111    #[doc = r" Value of the field as raw bits"]
112    #[inline]
113    pub fn bit(&self) -> bool {
114        match *self {
115            WASR::_0 => false,
116            WASR::_1 => true,
117        }
118    }
119    #[allow(missing_docs)]
120    #[doc(hidden)]
121    #[inline]
122    pub fn _from(value: bool) -> WASR {
123        match value {
124            false => WASR::_0,
125            true => WASR::_1,
126        }
127    }
128    #[doc = "Checks if the value of the field is `_0`"]
129    #[inline]
130    pub fn is_0(&self) -> bool {
131        *self == WASR::_0
132    }
133    #[doc = "Checks if the value of the field is `_1`"]
134    #[inline]
135    pub fn is_1(&self) -> bool {
136        *self == WASR::_1
137    }
138}
139#[doc = "Possible values of the field `FXOR`"]
140#[derive(Clone, Copy, Debug, PartialEq)]
141pub enum FXORR {
142    #[doc = "No XOR on reading."]
143    _0,
144    #[doc = "Invert or complement the read value of the CRC data register."]
145    _1,
146}
147impl FXORR {
148    #[doc = r" Returns `true` if the bit is clear (0)"]
149    #[inline]
150    pub fn bit_is_clear(&self) -> bool {
151        !self.bit()
152    }
153    #[doc = r" Returns `true` if the bit is set (1)"]
154    #[inline]
155    pub fn bit_is_set(&self) -> bool {
156        self.bit()
157    }
158    #[doc = r" Value of the field as raw bits"]
159    #[inline]
160    pub fn bit(&self) -> bool {
161        match *self {
162            FXORR::_0 => false,
163            FXORR::_1 => true,
164        }
165    }
166    #[allow(missing_docs)]
167    #[doc(hidden)]
168    #[inline]
169    pub fn _from(value: bool) -> FXORR {
170        match value {
171            false => FXORR::_0,
172            true => FXORR::_1,
173        }
174    }
175    #[doc = "Checks if the value of the field is `_0`"]
176    #[inline]
177    pub fn is_0(&self) -> bool {
178        *self == FXORR::_0
179    }
180    #[doc = "Checks if the value of the field is `_1`"]
181    #[inline]
182    pub fn is_1(&self) -> bool {
183        *self == FXORR::_1
184    }
185}
186#[doc = "Possible values of the field `TOTR`"]
187#[derive(Clone, Copy, Debug, PartialEq)]
188pub enum TOTRR {
189    #[doc = "No transposition."]
190    _00,
191    #[doc = "Bits in bytes are transposed; bytes are not transposed."]
192    _01,
193    #[doc = "Both bits in bytes and bytes are transposed."]
194    _10,
195    #[doc = "Only bytes are transposed; no bits in a byte are transposed."]
196    _11,
197}
198impl TOTRR {
199    #[doc = r" Value of the field as raw bits"]
200    #[inline]
201    pub fn bits(&self) -> u8 {
202        match *self {
203            TOTRR::_00 => 0,
204            TOTRR::_01 => 1,
205            TOTRR::_10 => 2,
206            TOTRR::_11 => 3,
207        }
208    }
209    #[allow(missing_docs)]
210    #[doc(hidden)]
211    #[inline]
212    pub fn _from(value: u8) -> TOTRR {
213        match value {
214            0 => TOTRR::_00,
215            1 => TOTRR::_01,
216            2 => TOTRR::_10,
217            3 => TOTRR::_11,
218            _ => unreachable!(),
219        }
220    }
221    #[doc = "Checks if the value of the field is `_00`"]
222    #[inline]
223    pub fn is_00(&self) -> bool {
224        *self == TOTRR::_00
225    }
226    #[doc = "Checks if the value of the field is `_01`"]
227    #[inline]
228    pub fn is_01(&self) -> bool {
229        *self == TOTRR::_01
230    }
231    #[doc = "Checks if the value of the field is `_10`"]
232    #[inline]
233    pub fn is_10(&self) -> bool {
234        *self == TOTRR::_10
235    }
236    #[doc = "Checks if the value of the field is `_11`"]
237    #[inline]
238    pub fn is_11(&self) -> bool {
239        *self == TOTRR::_11
240    }
241}
242#[doc = "Possible values of the field `TOT`"]
243#[derive(Clone, Copy, Debug, PartialEq)]
244pub enum TOTR {
245    #[doc = "No transposition."]
246    _00,
247    #[doc = "Bits in bytes are transposed; bytes are not transposed."]
248    _01,
249    #[doc = "Both bits in bytes and bytes are transposed."]
250    _10,
251    #[doc = "Only bytes are transposed; no bits in a byte are transposed."]
252    _11,
253}
254impl TOTR {
255    #[doc = r" Value of the field as raw bits"]
256    #[inline]
257    pub fn bits(&self) -> u8 {
258        match *self {
259            TOTR::_00 => 0,
260            TOTR::_01 => 1,
261            TOTR::_10 => 2,
262            TOTR::_11 => 3,
263        }
264    }
265    #[allow(missing_docs)]
266    #[doc(hidden)]
267    #[inline]
268    pub fn _from(value: u8) -> TOTR {
269        match value {
270            0 => TOTR::_00,
271            1 => TOTR::_01,
272            2 => TOTR::_10,
273            3 => TOTR::_11,
274            _ => unreachable!(),
275        }
276    }
277    #[doc = "Checks if the value of the field is `_00`"]
278    #[inline]
279    pub fn is_00(&self) -> bool {
280        *self == TOTR::_00
281    }
282    #[doc = "Checks if the value of the field is `_01`"]
283    #[inline]
284    pub fn is_01(&self) -> bool {
285        *self == TOTR::_01
286    }
287    #[doc = "Checks if the value of the field is `_10`"]
288    #[inline]
289    pub fn is_10(&self) -> bool {
290        *self == TOTR::_10
291    }
292    #[doc = "Checks if the value of the field is `_11`"]
293    #[inline]
294    pub fn is_11(&self) -> bool {
295        *self == TOTR::_11
296    }
297}
298#[doc = "Values that can be written to the field `TCRC`"]
299pub enum TCRCW {
300    #[doc = "16-bit CRC protocol."]
301    _0,
302    #[doc = "32-bit CRC protocol."]
303    _1,
304}
305impl TCRCW {
306    #[allow(missing_docs)]
307    #[doc(hidden)]
308    #[inline]
309    pub fn _bits(&self) -> bool {
310        match *self {
311            TCRCW::_0 => false,
312            TCRCW::_1 => true,
313        }
314    }
315}
316#[doc = r" Proxy"]
317pub struct _TCRCW<'a> {
318    w: &'a mut W,
319}
320impl<'a> _TCRCW<'a> {
321    #[doc = r" Writes `variant` to the field"]
322    #[inline]
323    pub fn variant(self, variant: TCRCW) -> &'a mut W {
324        {
325            self.bit(variant._bits())
326        }
327    }
328    #[doc = "16-bit CRC protocol."]
329    #[inline]
330    pub fn _0(self) -> &'a mut W {
331        self.variant(TCRCW::_0)
332    }
333    #[doc = "32-bit CRC protocol."]
334    #[inline]
335    pub fn _1(self) -> &'a mut W {
336        self.variant(TCRCW::_1)
337    }
338    #[doc = r" Sets the field bit"]
339    pub fn set_bit(self) -> &'a mut W {
340        self.bit(true)
341    }
342    #[doc = r" Clears the field bit"]
343    pub fn clear_bit(self) -> &'a mut W {
344        self.bit(false)
345    }
346    #[doc = r" Writes raw bits to the field"]
347    #[inline]
348    pub fn bit(self, value: bool) -> &'a mut W {
349        const MASK: bool = true;
350        const OFFSET: u8 = 24;
351        self.w.bits &= !((MASK as u32) << OFFSET);
352        self.w.bits |= ((value & MASK) as u32) << OFFSET;
353        self.w
354    }
355}
356#[doc = "Values that can be written to the field `WAS`"]
357pub enum WASW {
358    #[doc = "Writes to the CRC data register are data values."]
359    _0,
360    #[doc = "Writes to the CRC data register are seed values."]
361    _1,
362}
363impl WASW {
364    #[allow(missing_docs)]
365    #[doc(hidden)]
366    #[inline]
367    pub fn _bits(&self) -> bool {
368        match *self {
369            WASW::_0 => false,
370            WASW::_1 => true,
371        }
372    }
373}
374#[doc = r" Proxy"]
375pub struct _WASW<'a> {
376    w: &'a mut W,
377}
378impl<'a> _WASW<'a> {
379    #[doc = r" Writes `variant` to the field"]
380    #[inline]
381    pub fn variant(self, variant: WASW) -> &'a mut W {
382        {
383            self.bit(variant._bits())
384        }
385    }
386    #[doc = "Writes to the CRC data register are data values."]
387    #[inline]
388    pub fn _0(self) -> &'a mut W {
389        self.variant(WASW::_0)
390    }
391    #[doc = "Writes to the CRC data register are seed values."]
392    #[inline]
393    pub fn _1(self) -> &'a mut W {
394        self.variant(WASW::_1)
395    }
396    #[doc = r" Sets the field bit"]
397    pub fn set_bit(self) -> &'a mut W {
398        self.bit(true)
399    }
400    #[doc = r" Clears the field bit"]
401    pub fn clear_bit(self) -> &'a mut W {
402        self.bit(false)
403    }
404    #[doc = r" Writes raw bits to the field"]
405    #[inline]
406    pub fn bit(self, value: bool) -> &'a mut W {
407        const MASK: bool = true;
408        const OFFSET: u8 = 25;
409        self.w.bits &= !((MASK as u32) << OFFSET);
410        self.w.bits |= ((value & MASK) as u32) << OFFSET;
411        self.w
412    }
413}
414#[doc = "Values that can be written to the field `FXOR`"]
415pub enum FXORW {
416    #[doc = "No XOR on reading."]
417    _0,
418    #[doc = "Invert or complement the read value of the CRC data register."]
419    _1,
420}
421impl FXORW {
422    #[allow(missing_docs)]
423    #[doc(hidden)]
424    #[inline]
425    pub fn _bits(&self) -> bool {
426        match *self {
427            FXORW::_0 => false,
428            FXORW::_1 => true,
429        }
430    }
431}
432#[doc = r" Proxy"]
433pub struct _FXORW<'a> {
434    w: &'a mut W,
435}
436impl<'a> _FXORW<'a> {
437    #[doc = r" Writes `variant` to the field"]
438    #[inline]
439    pub fn variant(self, variant: FXORW) -> &'a mut W {
440        {
441            self.bit(variant._bits())
442        }
443    }
444    #[doc = "No XOR on reading."]
445    #[inline]
446    pub fn _0(self) -> &'a mut W {
447        self.variant(FXORW::_0)
448    }
449    #[doc = "Invert or complement the read value of the CRC data register."]
450    #[inline]
451    pub fn _1(self) -> &'a mut W {
452        self.variant(FXORW::_1)
453    }
454    #[doc = r" Sets the field bit"]
455    pub fn set_bit(self) -> &'a mut W {
456        self.bit(true)
457    }
458    #[doc = r" Clears the field bit"]
459    pub fn clear_bit(self) -> &'a mut W {
460        self.bit(false)
461    }
462    #[doc = r" Writes raw bits to the field"]
463    #[inline]
464    pub fn bit(self, value: bool) -> &'a mut W {
465        const MASK: bool = true;
466        const OFFSET: u8 = 26;
467        self.w.bits &= !((MASK as u32) << OFFSET);
468        self.w.bits |= ((value & MASK) as u32) << OFFSET;
469        self.w
470    }
471}
472#[doc = "Values that can be written to the field `TOTR`"]
473pub enum TOTRW {
474    #[doc = "No transposition."]
475    _00,
476    #[doc = "Bits in bytes are transposed; bytes are not transposed."]
477    _01,
478    #[doc = "Both bits in bytes and bytes are transposed."]
479    _10,
480    #[doc = "Only bytes are transposed; no bits in a byte are transposed."]
481    _11,
482}
483impl TOTRW {
484    #[allow(missing_docs)]
485    #[doc(hidden)]
486    #[inline]
487    pub fn _bits(&self) -> u8 {
488        match *self {
489            TOTRW::_00 => 0,
490            TOTRW::_01 => 1,
491            TOTRW::_10 => 2,
492            TOTRW::_11 => 3,
493        }
494    }
495}
496#[doc = r" Proxy"]
497pub struct _TOTRW<'a> {
498    w: &'a mut W,
499}
500impl<'a> _TOTRW<'a> {
501    #[doc = r" Writes `variant` to the field"]
502    #[inline]
503    pub fn variant(self, variant: TOTRW) -> &'a mut W {
504        {
505            self.bits(variant._bits())
506        }
507    }
508    #[doc = "No transposition."]
509    #[inline]
510    pub fn _00(self) -> &'a mut W {
511        self.variant(TOTRW::_00)
512    }
513    #[doc = "Bits in bytes are transposed; bytes are not transposed."]
514    #[inline]
515    pub fn _01(self) -> &'a mut W {
516        self.variant(TOTRW::_01)
517    }
518    #[doc = "Both bits in bytes and bytes are transposed."]
519    #[inline]
520    pub fn _10(self) -> &'a mut W {
521        self.variant(TOTRW::_10)
522    }
523    #[doc = "Only bytes are transposed; no bits in a byte are transposed."]
524    #[inline]
525    pub fn _11(self) -> &'a mut W {
526        self.variant(TOTRW::_11)
527    }
528    #[doc = r" Writes raw bits to the field"]
529    #[inline]
530    pub fn bits(self, value: u8) -> &'a mut W {
531        const MASK: u8 = 3;
532        const OFFSET: u8 = 28;
533        self.w.bits &= !((MASK as u32) << OFFSET);
534        self.w.bits |= ((value & MASK) as u32) << OFFSET;
535        self.w
536    }
537}
538#[doc = "Values that can be written to the field `TOT`"]
539pub enum TOTW {
540    #[doc = "No transposition."]
541    _00,
542    #[doc = "Bits in bytes are transposed; bytes are not transposed."]
543    _01,
544    #[doc = "Both bits in bytes and bytes are transposed."]
545    _10,
546    #[doc = "Only bytes are transposed; no bits in a byte are transposed."]
547    _11,
548}
549impl TOTW {
550    #[allow(missing_docs)]
551    #[doc(hidden)]
552    #[inline]
553    pub fn _bits(&self) -> u8 {
554        match *self {
555            TOTW::_00 => 0,
556            TOTW::_01 => 1,
557            TOTW::_10 => 2,
558            TOTW::_11 => 3,
559        }
560    }
561}
562#[doc = r" Proxy"]
563pub struct _TOTW<'a> {
564    w: &'a mut W,
565}
566impl<'a> _TOTW<'a> {
567    #[doc = r" Writes `variant` to the field"]
568    #[inline]
569    pub fn variant(self, variant: TOTW) -> &'a mut W {
570        {
571            self.bits(variant._bits())
572        }
573    }
574    #[doc = "No transposition."]
575    #[inline]
576    pub fn _00(self) -> &'a mut W {
577        self.variant(TOTW::_00)
578    }
579    #[doc = "Bits in bytes are transposed; bytes are not transposed."]
580    #[inline]
581    pub fn _01(self) -> &'a mut W {
582        self.variant(TOTW::_01)
583    }
584    #[doc = "Both bits in bytes and bytes are transposed."]
585    #[inline]
586    pub fn _10(self) -> &'a mut W {
587        self.variant(TOTW::_10)
588    }
589    #[doc = "Only bytes are transposed; no bits in a byte are transposed."]
590    #[inline]
591    pub fn _11(self) -> &'a mut W {
592        self.variant(TOTW::_11)
593    }
594    #[doc = r" Writes raw bits to the field"]
595    #[inline]
596    pub fn bits(self, value: u8) -> &'a mut W {
597        const MASK: u8 = 3;
598        const OFFSET: u8 = 30;
599        self.w.bits &= !((MASK as u32) << OFFSET);
600        self.w.bits |= ((value & MASK) as u32) << OFFSET;
601        self.w
602    }
603}
604impl R {
605    #[doc = r" Value of the register as raw bits"]
606    #[inline]
607    pub fn bits(&self) -> u32 {
608        self.bits
609    }
610    #[doc = "Bit 24 - no description available"]
611    #[inline]
612    pub fn tcrc(&self) -> TCRCR {
613        TCRCR::_from({
614            const MASK: bool = true;
615            const OFFSET: u8 = 24;
616            ((self.bits >> OFFSET) & MASK as u32) != 0
617        })
618    }
619    #[doc = "Bit 25 - Write CRC data register as seed"]
620    #[inline]
621    pub fn was(&self) -> WASR {
622        WASR::_from({
623            const MASK: bool = true;
624            const OFFSET: u8 = 25;
625            ((self.bits >> OFFSET) & MASK as u32) != 0
626        })
627    }
628    #[doc = "Bit 26 - Complement Read of CRC data register"]
629    #[inline]
630    pub fn fxor(&self) -> FXORR {
631        FXORR::_from({
632            const MASK: bool = true;
633            const OFFSET: u8 = 26;
634            ((self.bits >> OFFSET) & MASK as u32) != 0
635        })
636    }
637    #[doc = "Bits 28:29 - Type of Transpose for Read"]
638    #[inline]
639    pub fn totr(&self) -> TOTRR {
640        TOTRR::_from({
641            const MASK: u8 = 3;
642            const OFFSET: u8 = 28;
643            ((self.bits >> OFFSET) & MASK as u32) as u8
644        })
645    }
646    #[doc = "Bits 30:31 - Type of Transpose for Writes"]
647    #[inline]
648    pub fn tot(&self) -> TOTR {
649        TOTR::_from({
650            const MASK: u8 = 3;
651            const OFFSET: u8 = 30;
652            ((self.bits >> OFFSET) & MASK as u32) as u8
653        })
654    }
655}
656impl W {
657    #[doc = r" Reset value of the register"]
658    #[inline]
659    pub fn reset_value() -> W {
660        W { bits: 0 }
661    }
662    #[doc = r" Writes raw bits to the register"]
663    #[inline]
664    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
665        self.bits = bits;
666        self
667    }
668    #[doc = "Bit 24 - no description available"]
669    #[inline]
670    pub fn tcrc(&mut self) -> _TCRCW {
671        _TCRCW { w: self }
672    }
673    #[doc = "Bit 25 - Write CRC data register as seed"]
674    #[inline]
675    pub fn was(&mut self) -> _WASW {
676        _WASW { w: self }
677    }
678    #[doc = "Bit 26 - Complement Read of CRC data register"]
679    #[inline]
680    pub fn fxor(&mut self) -> _FXORW {
681        _FXORW { w: self }
682    }
683    #[doc = "Bits 28:29 - Type of Transpose for Read"]
684    #[inline]
685    pub fn totr(&mut self) -> _TOTRW {
686        _TOTRW { w: self }
687    }
688    #[doc = "Bits 30:31 - Type of Transpose for Writes"]
689    #[inline]
690    pub fn tot(&mut self) -> _TOTW {
691        _TOTW { w: self }
692    }
693}