Skip to main content

mcxa_pac/sau/
sfsr.rs

1#[doc = "Register `SFSR` reader"]
2pub type R = crate::R<SfsrSpec>;
3#[doc = "Register `SFSR` writer"]
4pub type W = crate::W<SfsrSpec>;
5#[doc = "Invalid entry point.\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8pub enum Invep {
9    #[doc = "0: Error has not occurred."]
10    NoError = 0,
11    #[doc = "1: Error has occurred."]
12    Error = 1,
13}
14impl From<Invep> for bool {
15    #[inline(always)]
16    fn from(variant: Invep) -> Self {
17        variant as u8 != 0
18    }
19}
20#[doc = "Field `INVEP` reader - Invalid entry point."]
21pub type InvepR = crate::BitReader<Invep>;
22impl InvepR {
23    #[doc = "Get enumerated values variant"]
24    #[inline(always)]
25    pub const fn variant(&self) -> Invep {
26        match self.bits {
27            false => Invep::NoError,
28            true => Invep::Error,
29        }
30    }
31    #[doc = "Error has not occurred."]
32    #[inline(always)]
33    pub fn is_no_error(&self) -> bool {
34        *self == Invep::NoError
35    }
36    #[doc = "Error has occurred."]
37    #[inline(always)]
38    pub fn is_error(&self) -> bool {
39        *self == Invep::Error
40    }
41}
42#[doc = "Field `INVEP` writer - Invalid entry point."]
43pub type InvepW<'a, REG> = crate::BitWriter<'a, REG, Invep>;
44impl<'a, REG> InvepW<'a, REG>
45where
46    REG: crate::Writable + crate::RegisterSpec,
47{
48    #[doc = "Error has not occurred."]
49    #[inline(always)]
50    pub fn no_error(self) -> &'a mut crate::W<REG> {
51        self.variant(Invep::NoError)
52    }
53    #[doc = "Error has occurred."]
54    #[inline(always)]
55    pub fn error(self) -> &'a mut crate::W<REG> {
56        self.variant(Invep::Error)
57    }
58}
59#[doc = "Invalid integrity signature flag.\n\nValue on reset: 0"]
60#[cfg_attr(feature = "defmt", derive(defmt::Format))]
61#[derive(Clone, Copy, Debug, PartialEq, Eq)]
62pub enum Invis {
63    #[doc = "0: Error has not occurred."]
64    NoError = 0,
65    #[doc = "1: Error has occurred."]
66    Error = 1,
67}
68impl From<Invis> for bool {
69    #[inline(always)]
70    fn from(variant: Invis) -> Self {
71        variant as u8 != 0
72    }
73}
74#[doc = "Field `INVIS` reader - Invalid integrity signature flag."]
75pub type InvisR = crate::BitReader<Invis>;
76impl InvisR {
77    #[doc = "Get enumerated values variant"]
78    #[inline(always)]
79    pub const fn variant(&self) -> Invis {
80        match self.bits {
81            false => Invis::NoError,
82            true => Invis::Error,
83        }
84    }
85    #[doc = "Error has not occurred."]
86    #[inline(always)]
87    pub fn is_no_error(&self) -> bool {
88        *self == Invis::NoError
89    }
90    #[doc = "Error has occurred."]
91    #[inline(always)]
92    pub fn is_error(&self) -> bool {
93        *self == Invis::Error
94    }
95}
96#[doc = "Field `INVIS` writer - Invalid integrity signature flag."]
97pub type InvisW<'a, REG> = crate::BitWriter<'a, REG, Invis>;
98impl<'a, REG> InvisW<'a, REG>
99where
100    REG: crate::Writable + crate::RegisterSpec,
101{
102    #[doc = "Error has not occurred."]
103    #[inline(always)]
104    pub fn no_error(self) -> &'a mut crate::W<REG> {
105        self.variant(Invis::NoError)
106    }
107    #[doc = "Error has occurred."]
108    #[inline(always)]
109    pub fn error(self) -> &'a mut crate::W<REG> {
110        self.variant(Invis::Error)
111    }
112}
113#[doc = "Invalid exception return flag.\n\nValue on reset: 0"]
114#[cfg_attr(feature = "defmt", derive(defmt::Format))]
115#[derive(Clone, Copy, Debug, PartialEq, Eq)]
116pub enum Inver {
117    #[doc = "0: Error has not occurred."]
118    NoError = 0,
119    #[doc = "1: Error has occurred."]
120    Error = 1,
121}
122impl From<Inver> for bool {
123    #[inline(always)]
124    fn from(variant: Inver) -> Self {
125        variant as u8 != 0
126    }
127}
128#[doc = "Field `INVER` reader - Invalid exception return flag."]
129pub type InverR = crate::BitReader<Inver>;
130impl InverR {
131    #[doc = "Get enumerated values variant"]
132    #[inline(always)]
133    pub const fn variant(&self) -> Inver {
134        match self.bits {
135            false => Inver::NoError,
136            true => Inver::Error,
137        }
138    }
139    #[doc = "Error has not occurred."]
140    #[inline(always)]
141    pub fn is_no_error(&self) -> bool {
142        *self == Inver::NoError
143    }
144    #[doc = "Error has occurred."]
145    #[inline(always)]
146    pub fn is_error(&self) -> bool {
147        *self == Inver::Error
148    }
149}
150#[doc = "Field `INVER` writer - Invalid exception return flag."]
151pub type InverW<'a, REG> = crate::BitWriter<'a, REG, Inver>;
152impl<'a, REG> InverW<'a, REG>
153where
154    REG: crate::Writable + crate::RegisterSpec,
155{
156    #[doc = "Error has not occurred."]
157    #[inline(always)]
158    pub fn no_error(self) -> &'a mut crate::W<REG> {
159        self.variant(Inver::NoError)
160    }
161    #[doc = "Error has occurred."]
162    #[inline(always)]
163    pub fn error(self) -> &'a mut crate::W<REG> {
164        self.variant(Inver::Error)
165    }
166}
167#[doc = "Attribution unit violation flag.\n\nValue on reset: 0"]
168#[cfg_attr(feature = "defmt", derive(defmt::Format))]
169#[derive(Clone, Copy, Debug, PartialEq, Eq)]
170pub enum Auviol {
171    #[doc = "0: Error has not occurred."]
172    NoError = 0,
173    #[doc = "1: Error has occurred."]
174    Error = 1,
175}
176impl From<Auviol> for bool {
177    #[inline(always)]
178    fn from(variant: Auviol) -> Self {
179        variant as u8 != 0
180    }
181}
182#[doc = "Field `AUVIOL` reader - Attribution unit violation flag."]
183pub type AuviolR = crate::BitReader<Auviol>;
184impl AuviolR {
185    #[doc = "Get enumerated values variant"]
186    #[inline(always)]
187    pub const fn variant(&self) -> Auviol {
188        match self.bits {
189            false => Auviol::NoError,
190            true => Auviol::Error,
191        }
192    }
193    #[doc = "Error has not occurred."]
194    #[inline(always)]
195    pub fn is_no_error(&self) -> bool {
196        *self == Auviol::NoError
197    }
198    #[doc = "Error has occurred."]
199    #[inline(always)]
200    pub fn is_error(&self) -> bool {
201        *self == Auviol::Error
202    }
203}
204#[doc = "Field `AUVIOL` writer - Attribution unit violation flag."]
205pub type AuviolW<'a, REG> = crate::BitWriter<'a, REG, Auviol>;
206impl<'a, REG> AuviolW<'a, REG>
207where
208    REG: crate::Writable + crate::RegisterSpec,
209{
210    #[doc = "Error has not occurred."]
211    #[inline(always)]
212    pub fn no_error(self) -> &'a mut crate::W<REG> {
213        self.variant(Auviol::NoError)
214    }
215    #[doc = "Error has occurred."]
216    #[inline(always)]
217    pub fn error(self) -> &'a mut crate::W<REG> {
218        self.variant(Auviol::Error)
219    }
220}
221#[doc = "Invalid transition flag.\n\nValue on reset: 0"]
222#[cfg_attr(feature = "defmt", derive(defmt::Format))]
223#[derive(Clone, Copy, Debug, PartialEq, Eq)]
224pub enum Invtran {
225    #[doc = "0: Error has not occurred."]
226    NoError = 0,
227    #[doc = "1: Error has occurred."]
228    Error = 1,
229}
230impl From<Invtran> for bool {
231    #[inline(always)]
232    fn from(variant: Invtran) -> Self {
233        variant as u8 != 0
234    }
235}
236#[doc = "Field `INVTRAN` reader - Invalid transition flag."]
237pub type InvtranR = crate::BitReader<Invtran>;
238impl InvtranR {
239    #[doc = "Get enumerated values variant"]
240    #[inline(always)]
241    pub const fn variant(&self) -> Invtran {
242        match self.bits {
243            false => Invtran::NoError,
244            true => Invtran::Error,
245        }
246    }
247    #[doc = "Error has not occurred."]
248    #[inline(always)]
249    pub fn is_no_error(&self) -> bool {
250        *self == Invtran::NoError
251    }
252    #[doc = "Error has occurred."]
253    #[inline(always)]
254    pub fn is_error(&self) -> bool {
255        *self == Invtran::Error
256    }
257}
258#[doc = "Field `INVTRAN` writer - Invalid transition flag."]
259pub type InvtranW<'a, REG> = crate::BitWriter<'a, REG, Invtran>;
260impl<'a, REG> InvtranW<'a, REG>
261where
262    REG: crate::Writable + crate::RegisterSpec,
263{
264    #[doc = "Error has not occurred."]
265    #[inline(always)]
266    pub fn no_error(self) -> &'a mut crate::W<REG> {
267        self.variant(Invtran::NoError)
268    }
269    #[doc = "Error has occurred."]
270    #[inline(always)]
271    pub fn error(self) -> &'a mut crate::W<REG> {
272        self.variant(Invtran::Error)
273    }
274}
275#[doc = "Lazy state preservation error flag.\n\nValue on reset: 0"]
276#[cfg_attr(feature = "defmt", derive(defmt::Format))]
277#[derive(Clone, Copy, Debug, PartialEq, Eq)]
278pub enum Lsperr {
279    #[doc = "0: Error has not occurred."]
280    NoError = 0,
281    #[doc = "1: Error has occurred."]
282    Error = 1,
283}
284impl From<Lsperr> for bool {
285    #[inline(always)]
286    fn from(variant: Lsperr) -> Self {
287        variant as u8 != 0
288    }
289}
290#[doc = "Field `LSPERR` reader - Lazy state preservation error flag."]
291pub type LsperrR = crate::BitReader<Lsperr>;
292impl LsperrR {
293    #[doc = "Get enumerated values variant"]
294    #[inline(always)]
295    pub const fn variant(&self) -> Lsperr {
296        match self.bits {
297            false => Lsperr::NoError,
298            true => Lsperr::Error,
299        }
300    }
301    #[doc = "Error has not occurred."]
302    #[inline(always)]
303    pub fn is_no_error(&self) -> bool {
304        *self == Lsperr::NoError
305    }
306    #[doc = "Error has occurred."]
307    #[inline(always)]
308    pub fn is_error(&self) -> bool {
309        *self == Lsperr::Error
310    }
311}
312#[doc = "Field `LSPERR` writer - Lazy state preservation error flag."]
313pub type LsperrW<'a, REG> = crate::BitWriter<'a, REG, Lsperr>;
314impl<'a, REG> LsperrW<'a, REG>
315where
316    REG: crate::Writable + crate::RegisterSpec,
317{
318    #[doc = "Error has not occurred."]
319    #[inline(always)]
320    pub fn no_error(self) -> &'a mut crate::W<REG> {
321        self.variant(Lsperr::NoError)
322    }
323    #[doc = "Error has occurred."]
324    #[inline(always)]
325    pub fn error(self) -> &'a mut crate::W<REG> {
326        self.variant(Lsperr::Error)
327    }
328}
329#[doc = "Secure fault address valid.\n\nValue on reset: 0"]
330#[cfg_attr(feature = "defmt", derive(defmt::Format))]
331#[derive(Clone, Copy, Debug, PartialEq, Eq)]
332pub enum Sfarvalid {
333    #[doc = "0: SFAR content not valid."]
334    NotValid = 0,
335    #[doc = "1: SFAR content valid."]
336    Valid = 1,
337}
338impl From<Sfarvalid> for bool {
339    #[inline(always)]
340    fn from(variant: Sfarvalid) -> Self {
341        variant as u8 != 0
342    }
343}
344#[doc = "Field `SFARVALID` reader - Secure fault address valid."]
345pub type SfarvalidR = crate::BitReader<Sfarvalid>;
346impl SfarvalidR {
347    #[doc = "Get enumerated values variant"]
348    #[inline(always)]
349    pub const fn variant(&self) -> Sfarvalid {
350        match self.bits {
351            false => Sfarvalid::NotValid,
352            true => Sfarvalid::Valid,
353        }
354    }
355    #[doc = "SFAR content not valid."]
356    #[inline(always)]
357    pub fn is_not_valid(&self) -> bool {
358        *self == Sfarvalid::NotValid
359    }
360    #[doc = "SFAR content valid."]
361    #[inline(always)]
362    pub fn is_valid(&self) -> bool {
363        *self == Sfarvalid::Valid
364    }
365}
366#[doc = "Field `SFARVALID` writer - Secure fault address valid."]
367pub type SfarvalidW<'a, REG> = crate::BitWriter<'a, REG, Sfarvalid>;
368impl<'a, REG> SfarvalidW<'a, REG>
369where
370    REG: crate::Writable + crate::RegisterSpec,
371{
372    #[doc = "SFAR content not valid."]
373    #[inline(always)]
374    pub fn not_valid(self) -> &'a mut crate::W<REG> {
375        self.variant(Sfarvalid::NotValid)
376    }
377    #[doc = "SFAR content valid."]
378    #[inline(always)]
379    pub fn valid(self) -> &'a mut crate::W<REG> {
380        self.variant(Sfarvalid::Valid)
381    }
382}
383#[doc = "Lazy state error flag.\n\nValue on reset: 0"]
384#[cfg_attr(feature = "defmt", derive(defmt::Format))]
385#[derive(Clone, Copy, Debug, PartialEq, Eq)]
386pub enum Lserr {
387    #[doc = "0: Error has not occurred"]
388    NoError = 0,
389    #[doc = "1: Error has occurred."]
390    Error = 1,
391}
392impl From<Lserr> for bool {
393    #[inline(always)]
394    fn from(variant: Lserr) -> Self {
395        variant as u8 != 0
396    }
397}
398#[doc = "Field `LSERR` reader - Lazy state error flag."]
399pub type LserrR = crate::BitReader<Lserr>;
400impl LserrR {
401    #[doc = "Get enumerated values variant"]
402    #[inline(always)]
403    pub const fn variant(&self) -> Lserr {
404        match self.bits {
405            false => Lserr::NoError,
406            true => Lserr::Error,
407        }
408    }
409    #[doc = "Error has not occurred"]
410    #[inline(always)]
411    pub fn is_no_error(&self) -> bool {
412        *self == Lserr::NoError
413    }
414    #[doc = "Error has occurred."]
415    #[inline(always)]
416    pub fn is_error(&self) -> bool {
417        *self == Lserr::Error
418    }
419}
420#[doc = "Field `LSERR` writer - Lazy state error flag."]
421pub type LserrW<'a, REG> = crate::BitWriter<'a, REG, Lserr>;
422impl<'a, REG> LserrW<'a, REG>
423where
424    REG: crate::Writable + crate::RegisterSpec,
425{
426    #[doc = "Error has not occurred"]
427    #[inline(always)]
428    pub fn no_error(self) -> &'a mut crate::W<REG> {
429        self.variant(Lserr::NoError)
430    }
431    #[doc = "Error has occurred."]
432    #[inline(always)]
433    pub fn error(self) -> &'a mut crate::W<REG> {
434        self.variant(Lserr::Error)
435    }
436}
437impl R {
438    #[doc = "Bit 0 - Invalid entry point."]
439    #[inline(always)]
440    pub fn invep(&self) -> InvepR {
441        InvepR::new((self.bits & 1) != 0)
442    }
443    #[doc = "Bit 1 - Invalid integrity signature flag."]
444    #[inline(always)]
445    pub fn invis(&self) -> InvisR {
446        InvisR::new(((self.bits >> 1) & 1) != 0)
447    }
448    #[doc = "Bit 2 - Invalid exception return flag."]
449    #[inline(always)]
450    pub fn inver(&self) -> InverR {
451        InverR::new(((self.bits >> 2) & 1) != 0)
452    }
453    #[doc = "Bit 3 - Attribution unit violation flag."]
454    #[inline(always)]
455    pub fn auviol(&self) -> AuviolR {
456        AuviolR::new(((self.bits >> 3) & 1) != 0)
457    }
458    #[doc = "Bit 4 - Invalid transition flag."]
459    #[inline(always)]
460    pub fn invtran(&self) -> InvtranR {
461        InvtranR::new(((self.bits >> 4) & 1) != 0)
462    }
463    #[doc = "Bit 5 - Lazy state preservation error flag."]
464    #[inline(always)]
465    pub fn lsperr(&self) -> LsperrR {
466        LsperrR::new(((self.bits >> 5) & 1) != 0)
467    }
468    #[doc = "Bit 6 - Secure fault address valid."]
469    #[inline(always)]
470    pub fn sfarvalid(&self) -> SfarvalidR {
471        SfarvalidR::new(((self.bits >> 6) & 1) != 0)
472    }
473    #[doc = "Bit 7 - Lazy state error flag."]
474    #[inline(always)]
475    pub fn lserr(&self) -> LserrR {
476        LserrR::new(((self.bits >> 7) & 1) != 0)
477    }
478}
479#[cfg(feature = "debug")]
480impl core::fmt::Debug for R {
481    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
482        f.debug_struct("SFSR")
483            .field("invep", &self.invep())
484            .field("invis", &self.invis())
485            .field("inver", &self.inver())
486            .field("auviol", &self.auviol())
487            .field("invtran", &self.invtran())
488            .field("lsperr", &self.lsperr())
489            .field("sfarvalid", &self.sfarvalid())
490            .field("lserr", &self.lserr())
491            .finish()
492    }
493}
494impl W {
495    #[doc = "Bit 0 - Invalid entry point."]
496    #[inline(always)]
497    pub fn invep(&mut self) -> InvepW<'_, SfsrSpec> {
498        InvepW::new(self, 0)
499    }
500    #[doc = "Bit 1 - Invalid integrity signature flag."]
501    #[inline(always)]
502    pub fn invis(&mut self) -> InvisW<'_, SfsrSpec> {
503        InvisW::new(self, 1)
504    }
505    #[doc = "Bit 2 - Invalid exception return flag."]
506    #[inline(always)]
507    pub fn inver(&mut self) -> InverW<'_, SfsrSpec> {
508        InverW::new(self, 2)
509    }
510    #[doc = "Bit 3 - Attribution unit violation flag."]
511    #[inline(always)]
512    pub fn auviol(&mut self) -> AuviolW<'_, SfsrSpec> {
513        AuviolW::new(self, 3)
514    }
515    #[doc = "Bit 4 - Invalid transition flag."]
516    #[inline(always)]
517    pub fn invtran(&mut self) -> InvtranW<'_, SfsrSpec> {
518        InvtranW::new(self, 4)
519    }
520    #[doc = "Bit 5 - Lazy state preservation error flag."]
521    #[inline(always)]
522    pub fn lsperr(&mut self) -> LsperrW<'_, SfsrSpec> {
523        LsperrW::new(self, 5)
524    }
525    #[doc = "Bit 6 - Secure fault address valid."]
526    #[inline(always)]
527    pub fn sfarvalid(&mut self) -> SfarvalidW<'_, SfsrSpec> {
528        SfarvalidW::new(self, 6)
529    }
530    #[doc = "Bit 7 - Lazy state error flag."]
531    #[inline(always)]
532    pub fn lserr(&mut self) -> LserrW<'_, SfsrSpec> {
533        LserrW::new(self, 7)
534    }
535}
536#[doc = "Secure Fault Status Register\n\nYou can [`read`](crate::Reg::read) this register and get [`sfsr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`sfsr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
537pub struct SfsrSpec;
538impl crate::RegisterSpec for SfsrSpec {
539    type Ux = u32;
540}
541#[doc = "`read()` method returns [`sfsr::R`](R) reader structure"]
542impl crate::Readable for SfsrSpec {}
543#[doc = "`write(|w| ..)` method takes [`sfsr::W`](W) writer structure"]
544impl crate::Writable for SfsrSpec {
545    type Safety = crate::Unsafe;
546}
547#[doc = "`reset()` method sets SFSR to value 0"]
548impl crate::Resettable for SfsrSpec {}