k66/cau/
cau_str_casr.rs

1#[doc = r" Value read from the register"]
2pub struct R {
3    bits: u32,
4}
5impl super::CAU_STR_CASR {
6    #[doc = r" Reads the contents of the register"]
7    #[inline]
8    pub fn read(&self) -> R {
9        R {
10            bits: self.register.get(),
11        }
12    }
13}
14#[doc = "Possible values of the field `IC`"]
15#[derive(Clone, Copy, Debug, PartialEq)]
16pub enum ICR {
17    #[doc = "No illegal commands issued"]
18    _0,
19    #[doc = "Illegal command issued"]
20    _1,
21}
22impl ICR {
23    #[doc = r" Returns `true` if the bit is clear (0)"]
24    #[inline]
25    pub fn bit_is_clear(&self) -> bool {
26        !self.bit()
27    }
28    #[doc = r" Returns `true` if the bit is set (1)"]
29    #[inline]
30    pub fn bit_is_set(&self) -> bool {
31        self.bit()
32    }
33    #[doc = r" Value of the field as raw bits"]
34    #[inline]
35    pub fn bit(&self) -> bool {
36        match *self {
37            ICR::_0 => false,
38            ICR::_1 => true,
39        }
40    }
41    #[allow(missing_docs)]
42    #[doc(hidden)]
43    #[inline]
44    pub fn _from(value: bool) -> ICR {
45        match value {
46            false => ICR::_0,
47            true => ICR::_1,
48        }
49    }
50    #[doc = "Checks if the value of the field is `_0`"]
51    #[inline]
52    pub fn is_0(&self) -> bool {
53        *self == ICR::_0
54    }
55    #[doc = "Checks if the value of the field is `_1`"]
56    #[inline]
57    pub fn is_1(&self) -> bool {
58        *self == ICR::_1
59    }
60}
61#[doc = "Possible values of the field `DPE`"]
62#[derive(Clone, Copy, Debug, PartialEq)]
63pub enum DPER {
64    #[doc = "No error detected"]
65    _0,
66    #[doc = "DES key parity error detected"]
67    _1,
68}
69impl DPER {
70    #[doc = r" Returns `true` if the bit is clear (0)"]
71    #[inline]
72    pub fn bit_is_clear(&self) -> bool {
73        !self.bit()
74    }
75    #[doc = r" Returns `true` if the bit is set (1)"]
76    #[inline]
77    pub fn bit_is_set(&self) -> bool {
78        self.bit()
79    }
80    #[doc = r" Value of the field as raw bits"]
81    #[inline]
82    pub fn bit(&self) -> bool {
83        match *self {
84            DPER::_0 => false,
85            DPER::_1 => true,
86        }
87    }
88    #[allow(missing_docs)]
89    #[doc(hidden)]
90    #[inline]
91    pub fn _from(value: bool) -> DPER {
92        match value {
93            false => DPER::_0,
94            true => DPER::_1,
95        }
96    }
97    #[doc = "Checks if the value of the field is `_0`"]
98    #[inline]
99    pub fn is_0(&self) -> bool {
100        *self == DPER::_0
101    }
102    #[doc = "Checks if the value of the field is `_1`"]
103    #[inline]
104    pub fn is_1(&self) -> bool {
105        *self == DPER::_1
106    }
107}
108#[doc = "Possible values of the field `VER`"]
109#[derive(Clone, Copy, Debug, PartialEq)]
110pub enum VERR {
111    #[doc = "Initial CAU version"]
112    _0001,
113    #[doc = "Second version, added support for SHA-256 algorithm.(This is the value on this device)"]
114    _0010,
115    #[doc = r" Reserved"]
116    _Reserved(u8),
117}
118impl VERR {
119    #[doc = r" Value of the field as raw bits"]
120    #[inline]
121    pub fn bits(&self) -> u8 {
122        match *self {
123            VERR::_0001 => 1,
124            VERR::_0010 => 2,
125            VERR::_Reserved(bits) => bits,
126        }
127    }
128    #[allow(missing_docs)]
129    #[doc(hidden)]
130    #[inline]
131    pub fn _from(value: u8) -> VERR {
132        match value {
133            1 => VERR::_0001,
134            2 => VERR::_0010,
135            i => VERR::_Reserved(i),
136        }
137    }
138    #[doc = "Checks if the value of the field is `_0001`"]
139    #[inline]
140    pub fn is_0001(&self) -> bool {
141        *self == VERR::_0001
142    }
143    #[doc = "Checks if the value of the field is `_0010`"]
144    #[inline]
145    pub fn is_0010(&self) -> bool {
146        *self == VERR::_0010
147    }
148}
149impl R {
150    #[doc = r" Value of the register as raw bits"]
151    #[inline]
152    pub fn bits(&self) -> u32 {
153        self.bits
154    }
155    #[doc = "Bit 0 - no description available"]
156    #[inline]
157    pub fn ic(&self) -> ICR {
158        ICR::_from({
159            const MASK: bool = true;
160            const OFFSET: u8 = 0;
161            ((self.bits >> OFFSET) & MASK as u32) != 0
162        })
163    }
164    #[doc = "Bit 1 - no description available"]
165    #[inline]
166    pub fn dpe(&self) -> DPER {
167        DPER::_from({
168            const MASK: bool = true;
169            const OFFSET: u8 = 1;
170            ((self.bits >> OFFSET) & MASK as u32) != 0
171        })
172    }
173    #[doc = "Bits 28:31 - CAU version"]
174    #[inline]
175    pub fn ver(&self) -> VERR {
176        VERR::_from({
177            const MASK: u8 = 15;
178            const OFFSET: u8 = 28;
179            ((self.bits >> OFFSET) & MASK as u32) as u8
180        })
181    }
182}