mimxrt685s_pac/puf/
keyenable.rs

1#[doc = "Register `KEYENABLE` reader"]
2pub type R = crate::R<KeyenableSpec>;
3#[doc = "Register `KEYENABLE` writer"]
4pub type W = crate::W<KeyenableSpec>;
5#[doc = "Key 0\n\nValue on reset: 1"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8#[repr(u8)]
9pub enum Key0 {
10    #[doc = "0: Data coming from the PUF Index 0 interface are NOT shifted in the KEY0 register."]
11    Disabled0 = 0,
12    #[doc = "1: Data coming from the PUF Index 0 interface are NOT shifted in the KEY0 register."]
13    Disabled1 = 1,
14    #[doc = "2: Data coming from the PUF Index 0 interface are shifted in the KEY0 register."]
15    Enabled = 2,
16    #[doc = "3: Data coming from the PUF Index 0 interface are NOT shifted in the KEY0 register."]
17    Disabled3 = 3,
18}
19impl From<Key0> for u8 {
20    #[inline(always)]
21    fn from(variant: Key0) -> Self {
22        variant as _
23    }
24}
25impl crate::FieldSpec for Key0 {
26    type Ux = u8;
27}
28impl crate::IsEnum for Key0 {}
29#[doc = "Field `KEY0` reader - Key 0"]
30pub type Key0R = crate::FieldReader<Key0>;
31impl Key0R {
32    #[doc = "Get enumerated values variant"]
33    #[inline(always)]
34    pub const fn variant(&self) -> Key0 {
35        match self.bits {
36            0 => Key0::Disabled0,
37            1 => Key0::Disabled1,
38            2 => Key0::Enabled,
39            3 => Key0::Disabled3,
40            _ => unreachable!(),
41        }
42    }
43    #[doc = "Data coming from the PUF Index 0 interface are NOT shifted in the KEY0 register."]
44    #[inline(always)]
45    pub fn is_disabled_0(&self) -> bool {
46        *self == Key0::Disabled0
47    }
48    #[doc = "Data coming from the PUF Index 0 interface are NOT shifted in the KEY0 register."]
49    #[inline(always)]
50    pub fn is_disabled_1(&self) -> bool {
51        *self == Key0::Disabled1
52    }
53    #[doc = "Data coming from the PUF Index 0 interface are shifted in the KEY0 register."]
54    #[inline(always)]
55    pub fn is_enabled(&self) -> bool {
56        *self == Key0::Enabled
57    }
58    #[doc = "Data coming from the PUF Index 0 interface are NOT shifted in the KEY0 register."]
59    #[inline(always)]
60    pub fn is_disabled_3(&self) -> bool {
61        *self == Key0::Disabled3
62    }
63}
64#[doc = "Field `KEY0` writer - Key 0"]
65pub type Key0W<'a, REG> = crate::FieldWriter<'a, REG, 2, Key0, crate::Safe>;
66impl<'a, REG> Key0W<'a, REG>
67where
68    REG: crate::Writable + crate::RegisterSpec,
69    REG::Ux: From<u8>,
70{
71    #[doc = "Data coming from the PUF Index 0 interface are NOT shifted in the KEY0 register."]
72    #[inline(always)]
73    pub fn disabled_0(self) -> &'a mut crate::W<REG> {
74        self.variant(Key0::Disabled0)
75    }
76    #[doc = "Data coming from the PUF Index 0 interface are NOT shifted in the KEY0 register."]
77    #[inline(always)]
78    pub fn disabled_1(self) -> &'a mut crate::W<REG> {
79        self.variant(Key0::Disabled1)
80    }
81    #[doc = "Data coming from the PUF Index 0 interface are shifted in the KEY0 register."]
82    #[inline(always)]
83    pub fn enabled(self) -> &'a mut crate::W<REG> {
84        self.variant(Key0::Enabled)
85    }
86    #[doc = "Data coming from the PUF Index 0 interface are NOT shifted in the KEY0 register."]
87    #[inline(always)]
88    pub fn disabled_3(self) -> &'a mut crate::W<REG> {
89        self.variant(Key0::Disabled3)
90    }
91}
92#[doc = "Key 1\n\nValue on reset: 1"]
93#[cfg_attr(feature = "defmt", derive(defmt::Format))]
94#[derive(Clone, Copy, Debug, PartialEq, Eq)]
95#[repr(u8)]
96pub enum Key1 {
97    #[doc = "0: Data coming from the PUF Index 0 interface are NOT shifted in the KEY1 register."]
98    Disabled0 = 0,
99    #[doc = "1: Data coming from the PUF Index 0 interface are NOT shifted in the KEY1 register."]
100    Disabled1 = 1,
101    #[doc = "2: Data coming from the PUF Index 0 interface are shifted in the KEY1 register."]
102    Enabled = 2,
103    #[doc = "3: Data coming from the PUF Index 0 interface are NOT shifted in the KEY1 register."]
104    Disabled3 = 3,
105}
106impl From<Key1> for u8 {
107    #[inline(always)]
108    fn from(variant: Key1) -> Self {
109        variant as _
110    }
111}
112impl crate::FieldSpec for Key1 {
113    type Ux = u8;
114}
115impl crate::IsEnum for Key1 {}
116#[doc = "Field `KEY1` reader - Key 1"]
117pub type Key1R = crate::FieldReader<Key1>;
118impl Key1R {
119    #[doc = "Get enumerated values variant"]
120    #[inline(always)]
121    pub const fn variant(&self) -> Key1 {
122        match self.bits {
123            0 => Key1::Disabled0,
124            1 => Key1::Disabled1,
125            2 => Key1::Enabled,
126            3 => Key1::Disabled3,
127            _ => unreachable!(),
128        }
129    }
130    #[doc = "Data coming from the PUF Index 0 interface are NOT shifted in the KEY1 register."]
131    #[inline(always)]
132    pub fn is_disabled_0(&self) -> bool {
133        *self == Key1::Disabled0
134    }
135    #[doc = "Data coming from the PUF Index 0 interface are NOT shifted in the KEY1 register."]
136    #[inline(always)]
137    pub fn is_disabled_1(&self) -> bool {
138        *self == Key1::Disabled1
139    }
140    #[doc = "Data coming from the PUF Index 0 interface are shifted in the KEY1 register."]
141    #[inline(always)]
142    pub fn is_enabled(&self) -> bool {
143        *self == Key1::Enabled
144    }
145    #[doc = "Data coming from the PUF Index 0 interface are NOT shifted in the KEY1 register."]
146    #[inline(always)]
147    pub fn is_disabled_3(&self) -> bool {
148        *self == Key1::Disabled3
149    }
150}
151#[doc = "Field `KEY1` writer - Key 1"]
152pub type Key1W<'a, REG> = crate::FieldWriter<'a, REG, 2, Key1, crate::Safe>;
153impl<'a, REG> Key1W<'a, REG>
154where
155    REG: crate::Writable + crate::RegisterSpec,
156    REG::Ux: From<u8>,
157{
158    #[doc = "Data coming from the PUF Index 0 interface are NOT shifted in the KEY1 register."]
159    #[inline(always)]
160    pub fn disabled_0(self) -> &'a mut crate::W<REG> {
161        self.variant(Key1::Disabled0)
162    }
163    #[doc = "Data coming from the PUF Index 0 interface are NOT shifted in the KEY1 register."]
164    #[inline(always)]
165    pub fn disabled_1(self) -> &'a mut crate::W<REG> {
166        self.variant(Key1::Disabled1)
167    }
168    #[doc = "Data coming from the PUF Index 0 interface are shifted in the KEY1 register."]
169    #[inline(always)]
170    pub fn enabled(self) -> &'a mut crate::W<REG> {
171        self.variant(Key1::Enabled)
172    }
173    #[doc = "Data coming from the PUF Index 0 interface are NOT shifted in the KEY1 register."]
174    #[inline(always)]
175    pub fn disabled_3(self) -> &'a mut crate::W<REG> {
176        self.variant(Key1::Disabled3)
177    }
178}
179#[doc = "Key 2\n\nValue on reset: 1"]
180#[cfg_attr(feature = "defmt", derive(defmt::Format))]
181#[derive(Clone, Copy, Debug, PartialEq, Eq)]
182#[repr(u8)]
183pub enum Key2 {
184    #[doc = "0: Data coming from the PUF Index 0 interface are NOT shifted in the KEY2 register."]
185    Disabled0 = 0,
186    #[doc = "1: Data coming from the PUF Index 0 interface are NOT shifted in the KEY2 register."]
187    Disabled1 = 1,
188    #[doc = "2: Data coming from the PUF Index 0 interface are shifted in the KEY2 register."]
189    Enabled = 2,
190    #[doc = "3: Data coming from the PUF Index 0 interface are NOT shifted in the KEY2 register."]
191    Disabled3 = 3,
192}
193impl From<Key2> for u8 {
194    #[inline(always)]
195    fn from(variant: Key2) -> Self {
196        variant as _
197    }
198}
199impl crate::FieldSpec for Key2 {
200    type Ux = u8;
201}
202impl crate::IsEnum for Key2 {}
203#[doc = "Field `KEY2` reader - Key 2"]
204pub type Key2R = crate::FieldReader<Key2>;
205impl Key2R {
206    #[doc = "Get enumerated values variant"]
207    #[inline(always)]
208    pub const fn variant(&self) -> Key2 {
209        match self.bits {
210            0 => Key2::Disabled0,
211            1 => Key2::Disabled1,
212            2 => Key2::Enabled,
213            3 => Key2::Disabled3,
214            _ => unreachable!(),
215        }
216    }
217    #[doc = "Data coming from the PUF Index 0 interface are NOT shifted in the KEY2 register."]
218    #[inline(always)]
219    pub fn is_disabled_0(&self) -> bool {
220        *self == Key2::Disabled0
221    }
222    #[doc = "Data coming from the PUF Index 0 interface are NOT shifted in the KEY2 register."]
223    #[inline(always)]
224    pub fn is_disabled_1(&self) -> bool {
225        *self == Key2::Disabled1
226    }
227    #[doc = "Data coming from the PUF Index 0 interface are shifted in the KEY2 register."]
228    #[inline(always)]
229    pub fn is_enabled(&self) -> bool {
230        *self == Key2::Enabled
231    }
232    #[doc = "Data coming from the PUF Index 0 interface are NOT shifted in the KEY2 register."]
233    #[inline(always)]
234    pub fn is_disabled_3(&self) -> bool {
235        *self == Key2::Disabled3
236    }
237}
238#[doc = "Field `KEY2` writer - Key 2"]
239pub type Key2W<'a, REG> = crate::FieldWriter<'a, REG, 2, Key2, crate::Safe>;
240impl<'a, REG> Key2W<'a, REG>
241where
242    REG: crate::Writable + crate::RegisterSpec,
243    REG::Ux: From<u8>,
244{
245    #[doc = "Data coming from the PUF Index 0 interface are NOT shifted in the KEY2 register."]
246    #[inline(always)]
247    pub fn disabled_0(self) -> &'a mut crate::W<REG> {
248        self.variant(Key2::Disabled0)
249    }
250    #[doc = "Data coming from the PUF Index 0 interface are NOT shifted in the KEY2 register."]
251    #[inline(always)]
252    pub fn disabled_1(self) -> &'a mut crate::W<REG> {
253        self.variant(Key2::Disabled1)
254    }
255    #[doc = "Data coming from the PUF Index 0 interface are shifted in the KEY2 register."]
256    #[inline(always)]
257    pub fn enabled(self) -> &'a mut crate::W<REG> {
258        self.variant(Key2::Enabled)
259    }
260    #[doc = "Data coming from the PUF Index 0 interface are NOT shifted in the KEY2 register."]
261    #[inline(always)]
262    pub fn disabled_3(self) -> &'a mut crate::W<REG> {
263        self.variant(Key2::Disabled3)
264    }
265}
266#[doc = "Key 3\n\nValue on reset: 1"]
267#[cfg_attr(feature = "defmt", derive(defmt::Format))]
268#[derive(Clone, Copy, Debug, PartialEq, Eq)]
269#[repr(u8)]
270pub enum Key3 {
271    #[doc = "0: Data coming from the PUF Index 0 interface are NOT shifted in the KEY3 register."]
272    Disabled0 = 0,
273    #[doc = "1: Data coming from the PUF Index 0 interface are NOT shifted in the KEY3 register."]
274    Disabled1 = 1,
275    #[doc = "2: Data coming from the PUF Index 0 interface are shifted in the KEY3 register."]
276    Enabled = 2,
277    #[doc = "3: Data coming from the PUF Index 0 interface are NOT shifted in the KEY3 register."]
278    Disabled3 = 3,
279}
280impl From<Key3> for u8 {
281    #[inline(always)]
282    fn from(variant: Key3) -> Self {
283        variant as _
284    }
285}
286impl crate::FieldSpec for Key3 {
287    type Ux = u8;
288}
289impl crate::IsEnum for Key3 {}
290#[doc = "Field `KEY3` reader - Key 3"]
291pub type Key3R = crate::FieldReader<Key3>;
292impl Key3R {
293    #[doc = "Get enumerated values variant"]
294    #[inline(always)]
295    pub const fn variant(&self) -> Key3 {
296        match self.bits {
297            0 => Key3::Disabled0,
298            1 => Key3::Disabled1,
299            2 => Key3::Enabled,
300            3 => Key3::Disabled3,
301            _ => unreachable!(),
302        }
303    }
304    #[doc = "Data coming from the PUF Index 0 interface are NOT shifted in the KEY3 register."]
305    #[inline(always)]
306    pub fn is_disabled_0(&self) -> bool {
307        *self == Key3::Disabled0
308    }
309    #[doc = "Data coming from the PUF Index 0 interface are NOT shifted in the KEY3 register."]
310    #[inline(always)]
311    pub fn is_disabled_1(&self) -> bool {
312        *self == Key3::Disabled1
313    }
314    #[doc = "Data coming from the PUF Index 0 interface are shifted in the KEY3 register."]
315    #[inline(always)]
316    pub fn is_enabled(&self) -> bool {
317        *self == Key3::Enabled
318    }
319    #[doc = "Data coming from the PUF Index 0 interface are NOT shifted in the KEY3 register."]
320    #[inline(always)]
321    pub fn is_disabled_3(&self) -> bool {
322        *self == Key3::Disabled3
323    }
324}
325#[doc = "Field `KEY3` writer - Key 3"]
326pub type Key3W<'a, REG> = crate::FieldWriter<'a, REG, 2, Key3, crate::Safe>;
327impl<'a, REG> Key3W<'a, REG>
328where
329    REG: crate::Writable + crate::RegisterSpec,
330    REG::Ux: From<u8>,
331{
332    #[doc = "Data coming from the PUF Index 0 interface are NOT shifted in the KEY3 register."]
333    #[inline(always)]
334    pub fn disabled_0(self) -> &'a mut crate::W<REG> {
335        self.variant(Key3::Disabled0)
336    }
337    #[doc = "Data coming from the PUF Index 0 interface are NOT shifted in the KEY3 register."]
338    #[inline(always)]
339    pub fn disabled_1(self) -> &'a mut crate::W<REG> {
340        self.variant(Key3::Disabled1)
341    }
342    #[doc = "Data coming from the PUF Index 0 interface are shifted in the KEY3 register."]
343    #[inline(always)]
344    pub fn enabled(self) -> &'a mut crate::W<REG> {
345        self.variant(Key3::Enabled)
346    }
347    #[doc = "Data coming from the PUF Index 0 interface are NOT shifted in the KEY3 register."]
348    #[inline(always)]
349    pub fn disabled_3(self) -> &'a mut crate::W<REG> {
350        self.variant(Key3::Disabled3)
351    }
352}
353impl R {
354    #[doc = "Bits 0:1 - Key 0"]
355    #[inline(always)]
356    pub fn key0(&self) -> Key0R {
357        Key0R::new((self.bits & 3) as u8)
358    }
359    #[doc = "Bits 2:3 - Key 1"]
360    #[inline(always)]
361    pub fn key1(&self) -> Key1R {
362        Key1R::new(((self.bits >> 2) & 3) as u8)
363    }
364    #[doc = "Bits 4:5 - Key 2"]
365    #[inline(always)]
366    pub fn key2(&self) -> Key2R {
367        Key2R::new(((self.bits >> 4) & 3) as u8)
368    }
369    #[doc = "Bits 6:7 - Key 3"]
370    #[inline(always)]
371    pub fn key3(&self) -> Key3R {
372        Key3R::new(((self.bits >> 6) & 3) as u8)
373    }
374}
375#[cfg(feature = "debug")]
376impl core::fmt::Debug for R {
377    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
378        f.debug_struct("KEYENABLE")
379            .field("key0", &self.key0())
380            .field("key1", &self.key1())
381            .field("key2", &self.key2())
382            .field("key3", &self.key3())
383            .finish()
384    }
385}
386impl W {
387    #[doc = "Bits 0:1 - Key 0"]
388    #[inline(always)]
389    pub fn key0(&mut self) -> Key0W<KeyenableSpec> {
390        Key0W::new(self, 0)
391    }
392    #[doc = "Bits 2:3 - Key 1"]
393    #[inline(always)]
394    pub fn key1(&mut self) -> Key1W<KeyenableSpec> {
395        Key1W::new(self, 2)
396    }
397    #[doc = "Bits 4:5 - Key 2"]
398    #[inline(always)]
399    pub fn key2(&mut self) -> Key2W<KeyenableSpec> {
400        Key2W::new(self, 4)
401    }
402    #[doc = "Bits 6:7 - Key 3"]
403    #[inline(always)]
404    pub fn key3(&mut self) -> Key3W<KeyenableSpec> {
405        Key3W::new(self, 6)
406    }
407}
408#[doc = "Key Enable\n\nYou can [`read`](crate::Reg::read) this register and get [`keyenable::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`keyenable::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
409pub struct KeyenableSpec;
410impl crate::RegisterSpec for KeyenableSpec {
411    type Ux = u32;
412}
413#[doc = "`read()` method returns [`keyenable::R`](R) reader structure"]
414impl crate::Readable for KeyenableSpec {}
415#[doc = "`write(|w| ..)` method takes [`keyenable::W`](W) writer structure"]
416impl crate::Writable for KeyenableSpec {
417    type Safety = crate::Unsafe;
418    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
419    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
420}
421#[doc = "`reset()` method sets KEYENABLE to value 0x55"]
422impl crate::Resettable for KeyenableSpec {
423    const RESET_VALUE: u32 = 0x55;
424}