xmc4200/flash0/
procon0.rs

1#[doc = "Register `PROCON0` reader"]
2pub type R = crate::R<PROCON0_SPEC>;
3#[doc = "Sector 0 Locked for Write Protection by User 0\n\nValue on reset: 0"]
4#[derive(Clone, Copy, Debug, PartialEq, Eq)]
5pub enum S0L_A {
6    #[doc = "0: No write protection is configured for sector n."]
7    VALUE1 = 0,
8    #[doc = "1: Write protection is configured for sector n."]
9    VALUE2 = 1,
10}
11impl From<S0L_A> for bool {
12    #[inline(always)]
13    fn from(variant: S0L_A) -> Self {
14        variant as u8 != 0
15    }
16}
17#[doc = "Field `S0L` reader - Sector 0 Locked for Write Protection by User 0"]
18pub type S0L_R = crate::BitReader<S0L_A>;
19impl S0L_R {
20    #[doc = "Get enumerated values variant"]
21    #[inline(always)]
22    pub const fn variant(&self) -> S0L_A {
23        match self.bits {
24            false => S0L_A::VALUE1,
25            true => S0L_A::VALUE2,
26        }
27    }
28    #[doc = "No write protection is configured for sector n."]
29    #[inline(always)]
30    pub fn is_value1(&self) -> bool {
31        *self == S0L_A::VALUE1
32    }
33    #[doc = "Write protection is configured for sector n."]
34    #[inline(always)]
35    pub fn is_value2(&self) -> bool {
36        *self == S0L_A::VALUE2
37    }
38}
39#[doc = "Sector 1 Locked for Write Protection by User 0\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub enum S1L_A {
42    #[doc = "0: No write protection is configured for sector n."]
43    VALUE1 = 0,
44    #[doc = "1: Write protection is configured for sector n."]
45    VALUE2 = 1,
46}
47impl From<S1L_A> for bool {
48    #[inline(always)]
49    fn from(variant: S1L_A) -> Self {
50        variant as u8 != 0
51    }
52}
53#[doc = "Field `S1L` reader - Sector 1 Locked for Write Protection by User 0"]
54pub type S1L_R = crate::BitReader<S1L_A>;
55impl S1L_R {
56    #[doc = "Get enumerated values variant"]
57    #[inline(always)]
58    pub const fn variant(&self) -> S1L_A {
59        match self.bits {
60            false => S1L_A::VALUE1,
61            true => S1L_A::VALUE2,
62        }
63    }
64    #[doc = "No write protection is configured for sector n."]
65    #[inline(always)]
66    pub fn is_value1(&self) -> bool {
67        *self == S1L_A::VALUE1
68    }
69    #[doc = "Write protection is configured for sector n."]
70    #[inline(always)]
71    pub fn is_value2(&self) -> bool {
72        *self == S1L_A::VALUE2
73    }
74}
75#[doc = "Sector 2 Locked for Write Protection by User 0\n\nValue on reset: 0"]
76#[derive(Clone, Copy, Debug, PartialEq, Eq)]
77pub enum S2L_A {
78    #[doc = "0: No write protection is configured for sector n."]
79    VALUE1 = 0,
80    #[doc = "1: Write protection is configured for sector n."]
81    VALUE2 = 1,
82}
83impl From<S2L_A> for bool {
84    #[inline(always)]
85    fn from(variant: S2L_A) -> Self {
86        variant as u8 != 0
87    }
88}
89#[doc = "Field `S2L` reader - Sector 2 Locked for Write Protection by User 0"]
90pub type S2L_R = crate::BitReader<S2L_A>;
91impl S2L_R {
92    #[doc = "Get enumerated values variant"]
93    #[inline(always)]
94    pub const fn variant(&self) -> S2L_A {
95        match self.bits {
96            false => S2L_A::VALUE1,
97            true => S2L_A::VALUE2,
98        }
99    }
100    #[doc = "No write protection is configured for sector n."]
101    #[inline(always)]
102    pub fn is_value1(&self) -> bool {
103        *self == S2L_A::VALUE1
104    }
105    #[doc = "Write protection is configured for sector n."]
106    #[inline(always)]
107    pub fn is_value2(&self) -> bool {
108        *self == S2L_A::VALUE2
109    }
110}
111#[doc = "Sector 3 Locked for Write Protection by User 0\n\nValue on reset: 0"]
112#[derive(Clone, Copy, Debug, PartialEq, Eq)]
113pub enum S3L_A {
114    #[doc = "0: No write protection is configured for sector n."]
115    VALUE1 = 0,
116    #[doc = "1: Write protection is configured for sector n."]
117    VALUE2 = 1,
118}
119impl From<S3L_A> for bool {
120    #[inline(always)]
121    fn from(variant: S3L_A) -> Self {
122        variant as u8 != 0
123    }
124}
125#[doc = "Field `S3L` reader - Sector 3 Locked for Write Protection by User 0"]
126pub type S3L_R = crate::BitReader<S3L_A>;
127impl S3L_R {
128    #[doc = "Get enumerated values variant"]
129    #[inline(always)]
130    pub const fn variant(&self) -> S3L_A {
131        match self.bits {
132            false => S3L_A::VALUE1,
133            true => S3L_A::VALUE2,
134        }
135    }
136    #[doc = "No write protection is configured for sector n."]
137    #[inline(always)]
138    pub fn is_value1(&self) -> bool {
139        *self == S3L_A::VALUE1
140    }
141    #[doc = "Write protection is configured for sector n."]
142    #[inline(always)]
143    pub fn is_value2(&self) -> bool {
144        *self == S3L_A::VALUE2
145    }
146}
147#[doc = "Sector 4 Locked for Write Protection by User 0\n\nValue on reset: 0"]
148#[derive(Clone, Copy, Debug, PartialEq, Eq)]
149pub enum S4L_A {
150    #[doc = "0: No write protection is configured for sector n."]
151    VALUE1 = 0,
152    #[doc = "1: Write protection is configured for sector n."]
153    VALUE2 = 1,
154}
155impl From<S4L_A> for bool {
156    #[inline(always)]
157    fn from(variant: S4L_A) -> Self {
158        variant as u8 != 0
159    }
160}
161#[doc = "Field `S4L` reader - Sector 4 Locked for Write Protection by User 0"]
162pub type S4L_R = crate::BitReader<S4L_A>;
163impl S4L_R {
164    #[doc = "Get enumerated values variant"]
165    #[inline(always)]
166    pub const fn variant(&self) -> S4L_A {
167        match self.bits {
168            false => S4L_A::VALUE1,
169            true => S4L_A::VALUE2,
170        }
171    }
172    #[doc = "No write protection is configured for sector n."]
173    #[inline(always)]
174    pub fn is_value1(&self) -> bool {
175        *self == S4L_A::VALUE1
176    }
177    #[doc = "Write protection is configured for sector n."]
178    #[inline(always)]
179    pub fn is_value2(&self) -> bool {
180        *self == S4L_A::VALUE2
181    }
182}
183#[doc = "Sector 5 Locked for Write Protection by User 0\n\nValue on reset: 0"]
184#[derive(Clone, Copy, Debug, PartialEq, Eq)]
185pub enum S5L_A {
186    #[doc = "0: No write protection is configured for sector n."]
187    VALUE1 = 0,
188    #[doc = "1: Write protection is configured for sector n."]
189    VALUE2 = 1,
190}
191impl From<S5L_A> for bool {
192    #[inline(always)]
193    fn from(variant: S5L_A) -> Self {
194        variant as u8 != 0
195    }
196}
197#[doc = "Field `S5L` reader - Sector 5 Locked for Write Protection by User 0"]
198pub type S5L_R = crate::BitReader<S5L_A>;
199impl S5L_R {
200    #[doc = "Get enumerated values variant"]
201    #[inline(always)]
202    pub const fn variant(&self) -> S5L_A {
203        match self.bits {
204            false => S5L_A::VALUE1,
205            true => S5L_A::VALUE2,
206        }
207    }
208    #[doc = "No write protection is configured for sector n."]
209    #[inline(always)]
210    pub fn is_value1(&self) -> bool {
211        *self == S5L_A::VALUE1
212    }
213    #[doc = "Write protection is configured for sector n."]
214    #[inline(always)]
215    pub fn is_value2(&self) -> bool {
216        *self == S5L_A::VALUE2
217    }
218}
219#[doc = "Sector 6 Locked for Write Protection by User 0\n\nValue on reset: 0"]
220#[derive(Clone, Copy, Debug, PartialEq, Eq)]
221pub enum S6L_A {
222    #[doc = "0: No write protection is configured for sector n."]
223    VALUE1 = 0,
224    #[doc = "1: Write protection is configured for sector n."]
225    VALUE2 = 1,
226}
227impl From<S6L_A> for bool {
228    #[inline(always)]
229    fn from(variant: S6L_A) -> Self {
230        variant as u8 != 0
231    }
232}
233#[doc = "Field `S6L` reader - Sector 6 Locked for Write Protection by User 0"]
234pub type S6L_R = crate::BitReader<S6L_A>;
235impl S6L_R {
236    #[doc = "Get enumerated values variant"]
237    #[inline(always)]
238    pub const fn variant(&self) -> S6L_A {
239        match self.bits {
240            false => S6L_A::VALUE1,
241            true => S6L_A::VALUE2,
242        }
243    }
244    #[doc = "No write protection is configured for sector n."]
245    #[inline(always)]
246    pub fn is_value1(&self) -> bool {
247        *self == S6L_A::VALUE1
248    }
249    #[doc = "Write protection is configured for sector n."]
250    #[inline(always)]
251    pub fn is_value2(&self) -> bool {
252        *self == S6L_A::VALUE2
253    }
254}
255#[doc = "Sector 7 Locked for Write Protection by User 0\n\nValue on reset: 0"]
256#[derive(Clone, Copy, Debug, PartialEq, Eq)]
257pub enum S7L_A {
258    #[doc = "0: No write protection is configured for sector n."]
259    VALUE1 = 0,
260    #[doc = "1: Write protection is configured for sector n."]
261    VALUE2 = 1,
262}
263impl From<S7L_A> for bool {
264    #[inline(always)]
265    fn from(variant: S7L_A) -> Self {
266        variant as u8 != 0
267    }
268}
269#[doc = "Field `S7L` reader - Sector 7 Locked for Write Protection by User 0"]
270pub type S7L_R = crate::BitReader<S7L_A>;
271impl S7L_R {
272    #[doc = "Get enumerated values variant"]
273    #[inline(always)]
274    pub const fn variant(&self) -> S7L_A {
275        match self.bits {
276            false => S7L_A::VALUE1,
277            true => S7L_A::VALUE2,
278        }
279    }
280    #[doc = "No write protection is configured for sector n."]
281    #[inline(always)]
282    pub fn is_value1(&self) -> bool {
283        *self == S7L_A::VALUE1
284    }
285    #[doc = "Write protection is configured for sector n."]
286    #[inline(always)]
287    pub fn is_value2(&self) -> bool {
288        *self == S7L_A::VALUE2
289    }
290}
291#[doc = "Sector 8 Locked for Write Protection by User 0\n\nValue on reset: 0"]
292#[derive(Clone, Copy, Debug, PartialEq, Eq)]
293pub enum S8L_A {
294    #[doc = "0: No write protection is configured for sector n."]
295    VALUE1 = 0,
296    #[doc = "1: Write protection is configured for sector n."]
297    VALUE2 = 1,
298}
299impl From<S8L_A> for bool {
300    #[inline(always)]
301    fn from(variant: S8L_A) -> Self {
302        variant as u8 != 0
303    }
304}
305#[doc = "Field `S8L` reader - Sector 8 Locked for Write Protection by User 0"]
306pub type S8L_R = crate::BitReader<S8L_A>;
307impl S8L_R {
308    #[doc = "Get enumerated values variant"]
309    #[inline(always)]
310    pub const fn variant(&self) -> S8L_A {
311        match self.bits {
312            false => S8L_A::VALUE1,
313            true => S8L_A::VALUE2,
314        }
315    }
316    #[doc = "No write protection is configured for sector n."]
317    #[inline(always)]
318    pub fn is_value1(&self) -> bool {
319        *self == S8L_A::VALUE1
320    }
321    #[doc = "Write protection is configured for sector n."]
322    #[inline(always)]
323    pub fn is_value2(&self) -> bool {
324        *self == S8L_A::VALUE2
325    }
326}
327#[doc = "Read Protection Configuration\n\nValue on reset: 0"]
328#[derive(Clone, Copy, Debug, PartialEq, Eq)]
329pub enum RPRO_A {
330    #[doc = "0: No read protection configured"]
331    VALUE1 = 0,
332    #[doc = "1: Read protection and global write protection is configured by user 0 (master user)"]
333    VALUE2 = 1,
334}
335impl From<RPRO_A> for bool {
336    #[inline(always)]
337    fn from(variant: RPRO_A) -> Self {
338        variant as u8 != 0
339    }
340}
341#[doc = "Field `RPRO` reader - Read Protection Configuration"]
342pub type RPRO_R = crate::BitReader<RPRO_A>;
343impl RPRO_R {
344    #[doc = "Get enumerated values variant"]
345    #[inline(always)]
346    pub const fn variant(&self) -> RPRO_A {
347        match self.bits {
348            false => RPRO_A::VALUE1,
349            true => RPRO_A::VALUE2,
350        }
351    }
352    #[doc = "No read protection configured"]
353    #[inline(always)]
354    pub fn is_value1(&self) -> bool {
355        *self == RPRO_A::VALUE1
356    }
357    #[doc = "Read protection and global write protection is configured by user 0 (master user)"]
358    #[inline(always)]
359    pub fn is_value2(&self) -> bool {
360        *self == RPRO_A::VALUE2
361    }
362}
363impl R {
364    #[doc = "Bit 0 - Sector 0 Locked for Write Protection by User 0"]
365    #[inline(always)]
366    pub fn s0l(&self) -> S0L_R {
367        S0L_R::new((self.bits & 1) != 0)
368    }
369    #[doc = "Bit 1 - Sector 1 Locked for Write Protection by User 0"]
370    #[inline(always)]
371    pub fn s1l(&self) -> S1L_R {
372        S1L_R::new(((self.bits >> 1) & 1) != 0)
373    }
374    #[doc = "Bit 2 - Sector 2 Locked for Write Protection by User 0"]
375    #[inline(always)]
376    pub fn s2l(&self) -> S2L_R {
377        S2L_R::new(((self.bits >> 2) & 1) != 0)
378    }
379    #[doc = "Bit 3 - Sector 3 Locked for Write Protection by User 0"]
380    #[inline(always)]
381    pub fn s3l(&self) -> S3L_R {
382        S3L_R::new(((self.bits >> 3) & 1) != 0)
383    }
384    #[doc = "Bit 4 - Sector 4 Locked for Write Protection by User 0"]
385    #[inline(always)]
386    pub fn s4l(&self) -> S4L_R {
387        S4L_R::new(((self.bits >> 4) & 1) != 0)
388    }
389    #[doc = "Bit 5 - Sector 5 Locked for Write Protection by User 0"]
390    #[inline(always)]
391    pub fn s5l(&self) -> S5L_R {
392        S5L_R::new(((self.bits >> 5) & 1) != 0)
393    }
394    #[doc = "Bit 6 - Sector 6 Locked for Write Protection by User 0"]
395    #[inline(always)]
396    pub fn s6l(&self) -> S6L_R {
397        S6L_R::new(((self.bits >> 6) & 1) != 0)
398    }
399    #[doc = "Bit 7 - Sector 7 Locked for Write Protection by User 0"]
400    #[inline(always)]
401    pub fn s7l(&self) -> S7L_R {
402        S7L_R::new(((self.bits >> 7) & 1) != 0)
403    }
404    #[doc = "Bit 8 - Sector 8 Locked for Write Protection by User 0"]
405    #[inline(always)]
406    pub fn s8l(&self) -> S8L_R {
407        S8L_R::new(((self.bits >> 8) & 1) != 0)
408    }
409    #[doc = "Bit 15 - Read Protection Configuration"]
410    #[inline(always)]
411    pub fn rpro(&self) -> RPRO_R {
412        RPRO_R::new(((self.bits >> 15) & 1) != 0)
413    }
414}
415#[doc = "Flash Protection Configuration Register User 0\n\nYou can [`read`](crate::Reg::read) this register and get [`procon0::R`](R). See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
416pub struct PROCON0_SPEC;
417impl crate::RegisterSpec for PROCON0_SPEC {
418    type Ux = u32;
419}
420#[doc = "`read()` method returns [`procon0::R`](R) reader structure"]
421impl crate::Readable for PROCON0_SPEC {}
422#[doc = "`reset()` method sets PROCON0 to value 0"]
423impl crate::Resettable for PROCON0_SPEC {
424    const RESET_VALUE: u32 = 0;
425}