mcxa_pac/syscon/
els_udf.rs

1#[doc = "Register `ELS_UDF` reader"]
2pub type R = crate::R<ElsUdfSpec>;
3#[doc = "Register `ELS_UDF` writer"]
4pub type W = crate::W<ElsUdfSpec>;
5#[doc = "UDF KEY Select\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8#[repr(u8)]
9pub enum KeySel {
10    #[doc = "0: DUK: UID\\[127:0\\]^RTL_CONST1\\[127:0\\]"]
11    Duk0 = 0,
12    #[doc = "1: DUK: UID\\[127:0\\]^RTL_CONST1\\[127:0\\]"]
13    Duk1 = 1,
14    #[doc = "2: DeviceHSM"]
15    DeviceHsm = 2,
16    #[doc = "3: NXP_mRoT"]
17    NxpMRoT = 3,
18}
19impl From<KeySel> for u8 {
20    #[inline(always)]
21    fn from(variant: KeySel) -> Self {
22        variant as _
23    }
24}
25impl crate::FieldSpec for KeySel {
26    type Ux = u8;
27}
28impl crate::IsEnum for KeySel {}
29#[doc = "Field `KEY_SEL` reader - UDF KEY Select"]
30pub type KeySelR = crate::FieldReader<KeySel>;
31impl KeySelR {
32    #[doc = "Get enumerated values variant"]
33    #[inline(always)]
34    pub const fn variant(&self) -> KeySel {
35        match self.bits {
36            0 => KeySel::Duk0,
37            1 => KeySel::Duk1,
38            2 => KeySel::DeviceHsm,
39            3 => KeySel::NxpMRoT,
40            _ => unreachable!(),
41        }
42    }
43    #[doc = "DUK: UID\\[127:0\\]^RTL_CONST1\\[127:0\\]"]
44    #[inline(always)]
45    pub fn is_duk_0(&self) -> bool {
46        *self == KeySel::Duk0
47    }
48    #[doc = "DUK: UID\\[127:0\\]^RTL_CONST1\\[127:0\\]"]
49    #[inline(always)]
50    pub fn is_duk_1(&self) -> bool {
51        *self == KeySel::Duk1
52    }
53    #[doc = "DeviceHSM"]
54    #[inline(always)]
55    pub fn is_device_hsm(&self) -> bool {
56        *self == KeySel::DeviceHsm
57    }
58    #[doc = "NXP_mRoT"]
59    #[inline(always)]
60    pub fn is_nxp_m_ro_t(&self) -> bool {
61        *self == KeySel::NxpMRoT
62    }
63}
64#[doc = "Field `KEY_SEL` writer - UDF KEY Select"]
65pub type KeySelW<'a, REG> = crate::FieldWriter<'a, REG, 2, KeySel, crate::Safe>;
66impl<'a, REG> KeySelW<'a, REG>
67where
68    REG: crate::Writable + crate::RegisterSpec,
69    REG::Ux: From<u8>,
70{
71    #[doc = "DUK: UID\\[127:0\\]^RTL_CONST1\\[127:0\\]"]
72    #[inline(always)]
73    pub fn duk_0(self) -> &'a mut crate::W<REG> {
74        self.variant(KeySel::Duk0)
75    }
76    #[doc = "DUK: UID\\[127:0\\]^RTL_CONST1\\[127:0\\]"]
77    #[inline(always)]
78    pub fn duk_1(self) -> &'a mut crate::W<REG> {
79        self.variant(KeySel::Duk1)
80    }
81    #[doc = "DeviceHSM"]
82    #[inline(always)]
83    pub fn device_hsm(self) -> &'a mut crate::W<REG> {
84        self.variant(KeySel::DeviceHsm)
85    }
86    #[doc = "NXP_mRoT"]
87    #[inline(always)]
88    pub fn nxp_m_ro_t(self) -> &'a mut crate::W<REG> {
89        self.variant(KeySel::NxpMRoT)
90    }
91}
92#[doc = "UID register hidden control. Write values other than 1010b, locked the write of UID_HIDDEN until a system reset.\n\nValue on reset: 0"]
93#[cfg_attr(feature = "defmt", derive(defmt::Format))]
94#[derive(Clone, Copy, Debug, PartialEq, Eq)]
95#[repr(u8)]
96pub enum UidHidden {
97    #[doc = "10: Enable the access of UID\\[127:0\\] register. All other value, disable the read/write of UID\\[127:0\\] register."]
98    UidHidden = 10,
99}
100impl From<UidHidden> for u8 {
101    #[inline(always)]
102    fn from(variant: UidHidden) -> Self {
103        variant as _
104    }
105}
106impl crate::FieldSpec for UidHidden {
107    type Ux = u8;
108}
109impl crate::IsEnum for UidHidden {}
110#[doc = "Field `UID_HIDDEN` reader - UID register hidden control. Write values other than 1010b, locked the write of UID_HIDDEN until a system reset."]
111pub type UidHiddenR = crate::FieldReader<UidHidden>;
112impl UidHiddenR {
113    #[doc = "Get enumerated values variant"]
114    #[inline(always)]
115    pub const fn variant(&self) -> Option<UidHidden> {
116        match self.bits {
117            10 => Some(UidHidden::UidHidden),
118            _ => None,
119        }
120    }
121    #[doc = "Enable the access of UID\\[127:0\\] register. All other value, disable the read/write of UID\\[127:0\\] register."]
122    #[inline(always)]
123    pub fn is_uid_hidden(&self) -> bool {
124        *self == UidHidden::UidHidden
125    }
126}
127#[doc = "Field `UID_HIDDEN` writer - UID register hidden control. Write values other than 1010b, locked the write of UID_HIDDEN until a system reset."]
128pub type UidHiddenW<'a, REG> = crate::FieldWriter<'a, REG, 4, UidHidden>;
129impl<'a, REG> UidHiddenW<'a, REG>
130where
131    REG: crate::Writable + crate::RegisterSpec,
132    REG::Ux: From<u8>,
133{
134    #[doc = "Enable the access of UID\\[127:0\\] register. All other value, disable the read/write of UID\\[127:0\\] register."]
135    #[inline(always)]
136    pub fn uid_hidden(self) -> &'a mut crate::W<REG> {
137        self.variant(UidHidden::UidHidden)
138    }
139}
140#[doc = "UDF register hidden control. Write values other than 1010b, locked the write of UDF_HIDDEN until a system reset.\n\nValue on reset: 0"]
141#[cfg_attr(feature = "defmt", derive(defmt::Format))]
142#[derive(Clone, Copy, Debug, PartialEq, Eq)]
143#[repr(u8)]
144pub enum UdfHidden {
145    #[doc = "10: Enable the access of UDF register from APB bus. All other value, disable the read/write of UDF register from UDF APB bus."]
146    UdfHidden = 10,
147}
148impl From<UdfHidden> for u8 {
149    #[inline(always)]
150    fn from(variant: UdfHidden) -> Self {
151        variant as _
152    }
153}
154impl crate::FieldSpec for UdfHidden {
155    type Ux = u8;
156}
157impl crate::IsEnum for UdfHidden {}
158#[doc = "Field `UDF_HIDDEN` reader - UDF register hidden control. Write values other than 1010b, locked the write of UDF_HIDDEN until a system reset."]
159pub type UdfHiddenR = crate::FieldReader<UdfHidden>;
160impl UdfHiddenR {
161    #[doc = "Get enumerated values variant"]
162    #[inline(always)]
163    pub const fn variant(&self) -> Option<UdfHidden> {
164        match self.bits {
165            10 => Some(UdfHidden::UdfHidden),
166            _ => None,
167        }
168    }
169    #[doc = "Enable the access of UDF register from APB bus. All other value, disable the read/write of UDF register from UDF APB bus."]
170    #[inline(always)]
171    pub fn is_udf_hidden(&self) -> bool {
172        *self == UdfHidden::UdfHidden
173    }
174}
175#[doc = "Field `UDF_HIDDEN` writer - UDF register hidden control. Write values other than 1010b, locked the write of UDF_HIDDEN until a system reset."]
176pub type UdfHiddenW<'a, REG> = crate::FieldWriter<'a, REG, 4, UdfHidden>;
177impl<'a, REG> UdfHiddenW<'a, REG>
178where
179    REG: crate::Writable + crate::RegisterSpec,
180    REG::Ux: From<u8>,
181{
182    #[doc = "Enable the access of UDF register from APB bus. All other value, disable the read/write of UDF register from UDF APB bus."]
183    #[inline(always)]
184    pub fn udf_hidden(self) -> &'a mut crate::W<REG> {
185        self.variant(UdfHidden::UdfHidden)
186    }
187}
188impl R {
189    #[doc = "Bits 0:1 - UDF KEY Select"]
190    #[inline(always)]
191    pub fn key_sel(&self) -> KeySelR {
192        KeySelR::new((self.bits & 3) as u8)
193    }
194    #[doc = "Bits 24:27 - UID register hidden control. Write values other than 1010b, locked the write of UID_HIDDEN until a system reset."]
195    #[inline(always)]
196    pub fn uid_hidden(&self) -> UidHiddenR {
197        UidHiddenR::new(((self.bits >> 24) & 0x0f) as u8)
198    }
199    #[doc = "Bits 28:31 - UDF register hidden control. Write values other than 1010b, locked the write of UDF_HIDDEN until a system reset."]
200    #[inline(always)]
201    pub fn udf_hidden(&self) -> UdfHiddenR {
202        UdfHiddenR::new(((self.bits >> 28) & 0x0f) as u8)
203    }
204}
205#[cfg(feature = "debug")]
206impl core::fmt::Debug for R {
207    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
208        f.debug_struct("ELS_UDF")
209            .field("key_sel", &self.key_sel())
210            .field("uid_hidden", &self.uid_hidden())
211            .field("udf_hidden", &self.udf_hidden())
212            .finish()
213    }
214}
215impl W {
216    #[doc = "Bits 0:1 - UDF KEY Select"]
217    #[inline(always)]
218    pub fn key_sel(&mut self) -> KeySelW<'_, ElsUdfSpec> {
219        KeySelW::new(self, 0)
220    }
221    #[doc = "Bits 24:27 - UID register hidden control. Write values other than 1010b, locked the write of UID_HIDDEN until a system reset."]
222    #[inline(always)]
223    pub fn uid_hidden(&mut self) -> UidHiddenW<'_, ElsUdfSpec> {
224        UidHiddenW::new(self, 24)
225    }
226    #[doc = "Bits 28:31 - UDF register hidden control. Write values other than 1010b, locked the write of UDF_HIDDEN until a system reset."]
227    #[inline(always)]
228    pub fn udf_hidden(&mut self) -> UdfHiddenW<'_, ElsUdfSpec> {
229        UdfHiddenW::new(self, 28)
230    }
231}
232#[doc = "UDF Control\n\nYou can [`read`](crate::Reg::read) this register and get [`els_udf::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`els_udf::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
233pub struct ElsUdfSpec;
234impl crate::RegisterSpec for ElsUdfSpec {
235    type Ux = u32;
236}
237#[doc = "`read()` method returns [`els_udf::R`](R) reader structure"]
238impl crate::Readable for ElsUdfSpec {}
239#[doc = "`write(|w| ..)` method takes [`els_udf::W`](W) writer structure"]
240impl crate::Writable for ElsUdfSpec {
241    type Safety = crate::Unsafe;
242}
243#[doc = "`reset()` method sets ELS_UDF to value 0"]
244impl crate::Resettable for ElsUdfSpec {}