mcxa_pac/trng0/
int_status.rs

1#[doc = "Register `INT_STATUS` reader"]
2pub type R = crate::R<IntStatusSpec>;
3#[doc = "Read: TRNG Error. Any error in the TRNG will trigger this interrupt.\n\nValue on reset: 0"]
4#[cfg_attr(feature = "defmt", derive(defmt::Format))]
5#[derive(Clone, Copy, Debug, PartialEq, Eq)]
6pub enum HwErr {
7    #[doc = "0: No error."]
8    HwErrNo = 0,
9    #[doc = "1: Error detected."]
10    HwErrYes = 1,
11}
12impl From<HwErr> for bool {
13    #[inline(always)]
14    fn from(variant: HwErr) -> Self {
15        variant as u8 != 0
16    }
17}
18#[doc = "Field `HW_ERR` reader - Read: TRNG Error. Any error in the TRNG will trigger this interrupt."]
19pub type HwErrR = crate::BitReader<HwErr>;
20impl HwErrR {
21    #[doc = "Get enumerated values variant"]
22    #[inline(always)]
23    pub const fn variant(&self) -> HwErr {
24        match self.bits {
25            false => HwErr::HwErrNo,
26            true => HwErr::HwErrYes,
27        }
28    }
29    #[doc = "No error."]
30    #[inline(always)]
31    pub fn is_hw_err_no(&self) -> bool {
32        *self == HwErr::HwErrNo
33    }
34    #[doc = "Error detected."]
35    #[inline(always)]
36    pub fn is_hw_err_yes(&self) -> bool {
37        *self == HwErr::HwErrYes
38    }
39}
40#[doc = "Entropy Valid\n\nValue on reset: 0"]
41#[cfg_attr(feature = "defmt", derive(defmt::Format))]
42#[derive(Clone, Copy, Debug, PartialEq, Eq)]
43pub enum EntVal {
44    #[doc = "0: Busy generating entropy. Any value read from the Entropy registers is invalid."]
45    EntValInvalid = 0,
46    #[doc = "1: Values read from the Entropy registers are valid."]
47    EntValValid = 1,
48}
49impl From<EntVal> for bool {
50    #[inline(always)]
51    fn from(variant: EntVal) -> Self {
52        variant as u8 != 0
53    }
54}
55#[doc = "Field `ENT_VAL` reader - Entropy Valid"]
56pub type EntValR = crate::BitReader<EntVal>;
57impl EntValR {
58    #[doc = "Get enumerated values variant"]
59    #[inline(always)]
60    pub const fn variant(&self) -> EntVal {
61        match self.bits {
62            false => EntVal::EntValInvalid,
63            true => EntVal::EntValValid,
64        }
65    }
66    #[doc = "Busy generating entropy. Any value read from the Entropy registers is invalid."]
67    #[inline(always)]
68    pub fn is_ent_val_invalid(&self) -> bool {
69        *self == EntVal::EntValInvalid
70    }
71    #[doc = "Values read from the Entropy registers are valid."]
72    #[inline(always)]
73    pub fn is_ent_val_valid(&self) -> bool {
74        *self == EntVal::EntValValid
75    }
76}
77#[doc = "Frequency Count Fail\n\nValue on reset: 0"]
78#[cfg_attr(feature = "defmt", derive(defmt::Format))]
79#[derive(Clone, Copy, Debug, PartialEq, Eq)]
80pub enum FrqCtFail {
81    #[doc = "0: No hardware nor self test frequency errors."]
82    FrqCtFailNoErr = 0,
83    #[doc = "1: The frequency counter has detected a failure."]
84    FrqCtFailErr = 1,
85}
86impl From<FrqCtFail> for bool {
87    #[inline(always)]
88    fn from(variant: FrqCtFail) -> Self {
89        variant as u8 != 0
90    }
91}
92#[doc = "Field `FRQ_CT_FAIL` reader - Frequency Count Fail"]
93pub type FrqCtFailR = crate::BitReader<FrqCtFail>;
94impl FrqCtFailR {
95    #[doc = "Get enumerated values variant"]
96    #[inline(always)]
97    pub const fn variant(&self) -> FrqCtFail {
98        match self.bits {
99            false => FrqCtFail::FrqCtFailNoErr,
100            true => FrqCtFail::FrqCtFailErr,
101        }
102    }
103    #[doc = "No hardware nor self test frequency errors."]
104    #[inline(always)]
105    pub fn is_frq_ct_fail_no_err(&self) -> bool {
106        *self == FrqCtFail::FrqCtFailNoErr
107    }
108    #[doc = "The frequency counter has detected a failure."]
109    #[inline(always)]
110    pub fn is_frq_ct_fail_err(&self) -> bool {
111        *self == FrqCtFail::FrqCtFailErr
112    }
113}
114#[doc = "Integrity Fault. An internal fault has occurred.\n\nValue on reset: 0"]
115#[cfg_attr(feature = "defmt", derive(defmt::Format))]
116#[derive(Clone, Copy, Debug, PartialEq, Eq)]
117pub enum IntgFlt {
118    #[doc = "0: No internal fault has been detected."]
119    IntgFltNoErr = 0,
120    #[doc = "1: TRNG has detected internal fault."]
121    IntgFltErr = 1,
122}
123impl From<IntgFlt> for bool {
124    #[inline(always)]
125    fn from(variant: IntgFlt) -> Self {
126        variant as u8 != 0
127    }
128}
129#[doc = "Field `INTG_FLT` reader - Integrity Fault. An internal fault has occurred."]
130pub type IntgFltR = crate::BitReader<IntgFlt>;
131impl IntgFltR {
132    #[doc = "Get enumerated values variant"]
133    #[inline(always)]
134    pub const fn variant(&self) -> IntgFlt {
135        match self.bits {
136            false => IntgFlt::IntgFltNoErr,
137            true => IntgFlt::IntgFltErr,
138        }
139    }
140    #[doc = "No internal fault has been detected."]
141    #[inline(always)]
142    pub fn is_intg_flt_no_err(&self) -> bool {
143        *self == IntgFlt::IntgFltNoErr
144    }
145    #[doc = "TRNG has detected internal fault."]
146    #[inline(always)]
147    pub fn is_intg_flt_err(&self) -> bool {
148        *self == IntgFlt::IntgFltErr
149    }
150}
151impl R {
152    #[doc = "Bit 0 - Read: TRNG Error. Any error in the TRNG will trigger this interrupt."]
153    #[inline(always)]
154    pub fn hw_err(&self) -> HwErrR {
155        HwErrR::new((self.bits & 1) != 0)
156    }
157    #[doc = "Bit 1 - Entropy Valid"]
158    #[inline(always)]
159    pub fn ent_val(&self) -> EntValR {
160        EntValR::new(((self.bits >> 1) & 1) != 0)
161    }
162    #[doc = "Bit 2 - Frequency Count Fail"]
163    #[inline(always)]
164    pub fn frq_ct_fail(&self) -> FrqCtFailR {
165        FrqCtFailR::new(((self.bits >> 2) & 1) != 0)
166    }
167    #[doc = "Bit 3 - Integrity Fault. An internal fault has occurred."]
168    #[inline(always)]
169    pub fn intg_flt(&self) -> IntgFltR {
170        IntgFltR::new(((self.bits >> 3) & 1) != 0)
171    }
172}
173#[cfg(feature = "debug")]
174impl core::fmt::Debug for R {
175    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
176        f.debug_struct("INT_STATUS")
177            .field("hw_err", &self.hw_err())
178            .field("ent_val", &self.ent_val())
179            .field("frq_ct_fail", &self.frq_ct_fail())
180            .field("intg_flt", &self.intg_flt())
181            .finish()
182    }
183}
184#[doc = "Interrupt Status Register\n\nYou can [`read`](crate::Reg::read) this register and get [`int_status::R`](R). See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
185pub struct IntStatusSpec;
186impl crate::RegisterSpec for IntStatusSpec {
187    type Ux = u32;
188}
189#[doc = "`read()` method returns [`int_status::R`](R) reader structure"]
190impl crate::Readable for IntStatusSpec {}
191#[doc = "`reset()` method sets INT_STATUS to value 0"]
192impl crate::Resettable for IntStatusSpec {}