mcxa_pac/fmu0/
fcnfg.rs

1#[doc = "Register `FCNFG` reader"]
2pub type R = crate::R<FcnfgSpec>;
3#[doc = "Register `FCNFG` writer"]
4pub type W = crate::W<FcnfgSpec>;
5#[doc = "Command Complete Interrupt Enable\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8pub enum Ccie {
9    #[doc = "0: Command complete interrupt disabled"]
10    Ccie0 = 0,
11    #[doc = "1: Command complete interrupt enabled"]
12    Ccie1 = 1,
13}
14impl From<Ccie> for bool {
15    #[inline(always)]
16    fn from(variant: Ccie) -> Self {
17        variant as u8 != 0
18    }
19}
20#[doc = "Field `CCIE` reader - Command Complete Interrupt Enable"]
21pub type CcieR = crate::BitReader<Ccie>;
22impl CcieR {
23    #[doc = "Get enumerated values variant"]
24    #[inline(always)]
25    pub const fn variant(&self) -> Ccie {
26        match self.bits {
27            false => Ccie::Ccie0,
28            true => Ccie::Ccie1,
29        }
30    }
31    #[doc = "Command complete interrupt disabled"]
32    #[inline(always)]
33    pub fn is_ccie0(&self) -> bool {
34        *self == Ccie::Ccie0
35    }
36    #[doc = "Command complete interrupt enabled"]
37    #[inline(always)]
38    pub fn is_ccie1(&self) -> bool {
39        *self == Ccie::Ccie1
40    }
41}
42#[doc = "Field `CCIE` writer - Command Complete Interrupt Enable"]
43pub type CcieW<'a, REG> = crate::BitWriter<'a, REG, Ccie>;
44impl<'a, REG> CcieW<'a, REG>
45where
46    REG: crate::Writable + crate::RegisterSpec,
47{
48    #[doc = "Command complete interrupt disabled"]
49    #[inline(always)]
50    pub fn ccie0(self) -> &'a mut crate::W<REG> {
51        self.variant(Ccie::Ccie0)
52    }
53    #[doc = "Command complete interrupt enabled"]
54    #[inline(always)]
55    pub fn ccie1(self) -> &'a mut crate::W<REG> {
56        self.variant(Ccie::Ccie1)
57    }
58}
59#[doc = "Mass Erase Request\n\nValue on reset: 0"]
60#[cfg_attr(feature = "defmt", derive(defmt::Format))]
61#[derive(Clone, Copy, Debug, PartialEq, Eq)]
62pub enum Ersreq {
63    #[doc = "0: No request or request complete"]
64    Ersreq0 = 0,
65    #[doc = "1: Request to run the Mass Erase operation"]
66    Ersreq1 = 1,
67}
68impl From<Ersreq> for bool {
69    #[inline(always)]
70    fn from(variant: Ersreq) -> Self {
71        variant as u8 != 0
72    }
73}
74#[doc = "Field `ERSREQ` reader - Mass Erase Request"]
75pub type ErsreqR = crate::BitReader<Ersreq>;
76impl ErsreqR {
77    #[doc = "Get enumerated values variant"]
78    #[inline(always)]
79    pub const fn variant(&self) -> Ersreq {
80        match self.bits {
81            false => Ersreq::Ersreq0,
82            true => Ersreq::Ersreq1,
83        }
84    }
85    #[doc = "No request or request complete"]
86    #[inline(always)]
87    pub fn is_ersreq0(&self) -> bool {
88        *self == Ersreq::Ersreq0
89    }
90    #[doc = "Request to run the Mass Erase operation"]
91    #[inline(always)]
92    pub fn is_ersreq1(&self) -> bool {
93        *self == Ersreq::Ersreq1
94    }
95}
96#[doc = "Double Bit Fault Detect Interrupt Enable\n\nValue on reset: 0"]
97#[cfg_attr(feature = "defmt", derive(defmt::Format))]
98#[derive(Clone, Copy, Debug, PartialEq, Eq)]
99pub enum Dfdie {
100    #[doc = "0: Double bit fault detect interrupt disabled"]
101    Dfdie0 = 0,
102    #[doc = "1: Double bit fault detect interrupt enabled"]
103    Dfdie1 = 1,
104}
105impl From<Dfdie> for bool {
106    #[inline(always)]
107    fn from(variant: Dfdie) -> Self {
108        variant as u8 != 0
109    }
110}
111#[doc = "Field `DFDIE` reader - Double Bit Fault Detect Interrupt Enable"]
112pub type DfdieR = crate::BitReader<Dfdie>;
113impl DfdieR {
114    #[doc = "Get enumerated values variant"]
115    #[inline(always)]
116    pub const fn variant(&self) -> Dfdie {
117        match self.bits {
118            false => Dfdie::Dfdie0,
119            true => Dfdie::Dfdie1,
120        }
121    }
122    #[doc = "Double bit fault detect interrupt disabled"]
123    #[inline(always)]
124    pub fn is_dfdie0(&self) -> bool {
125        *self == Dfdie::Dfdie0
126    }
127    #[doc = "Double bit fault detect interrupt enabled"]
128    #[inline(always)]
129    pub fn is_dfdie1(&self) -> bool {
130        *self == Dfdie::Dfdie1
131    }
132}
133#[doc = "Field `DFDIE` writer - Double Bit Fault Detect Interrupt Enable"]
134pub type DfdieW<'a, REG> = crate::BitWriter<'a, REG, Dfdie>;
135impl<'a, REG> DfdieW<'a, REG>
136where
137    REG: crate::Writable + crate::RegisterSpec,
138{
139    #[doc = "Double bit fault detect interrupt disabled"]
140    #[inline(always)]
141    pub fn dfdie0(self) -> &'a mut crate::W<REG> {
142        self.variant(Dfdie::Dfdie0)
143    }
144    #[doc = "Double bit fault detect interrupt enabled"]
145    #[inline(always)]
146    pub fn dfdie1(self) -> &'a mut crate::W<REG> {
147        self.variant(Dfdie::Dfdie1)
148    }
149}
150#[doc = "Erase IFR Sector Enable - Block 0\n\nValue on reset: 0"]
151#[cfg_attr(feature = "defmt", derive(defmt::Format))]
152#[derive(Clone, Copy, Debug, PartialEq, Eq)]
153#[repr(u8)]
154pub enum Ersien0 {
155    #[doc = "0: Block 0 IFR Sector X is protected from erase by ERSSCR command"]
156    Ersien00 = 0,
157    #[doc = "1: Block 0 IFR Sector X is not protected from erase by ERSSCR command"]
158    Ersien01 = 1,
159}
160impl From<Ersien0> for u8 {
161    #[inline(always)]
162    fn from(variant: Ersien0) -> Self {
163        variant as _
164    }
165}
166impl crate::FieldSpec for Ersien0 {
167    type Ux = u8;
168}
169impl crate::IsEnum for Ersien0 {}
170#[doc = "Field `ERSIEN0` reader - Erase IFR Sector Enable - Block 0"]
171pub type Ersien0R = crate::FieldReader<Ersien0>;
172impl Ersien0R {
173    #[doc = "Get enumerated values variant"]
174    #[inline(always)]
175    pub const fn variant(&self) -> Option<Ersien0> {
176        match self.bits {
177            0 => Some(Ersien0::Ersien00),
178            1 => Some(Ersien0::Ersien01),
179            _ => None,
180        }
181    }
182    #[doc = "Block 0 IFR Sector X is protected from erase by ERSSCR command"]
183    #[inline(always)]
184    pub fn is_ersien00(&self) -> bool {
185        *self == Ersien0::Ersien00
186    }
187    #[doc = "Block 0 IFR Sector X is not protected from erase by ERSSCR command"]
188    #[inline(always)]
189    pub fn is_ersien01(&self) -> bool {
190        *self == Ersien0::Ersien01
191    }
192}
193#[doc = "Erase IFR Sector Enable - Block 1 (for dual block configs)\n\nValue on reset: 0"]
194#[cfg_attr(feature = "defmt", derive(defmt::Format))]
195#[derive(Clone, Copy, Debug, PartialEq, Eq)]
196#[repr(u8)]
197pub enum Ersien1 {
198    #[doc = "0: Block 1 IFR Sector X is protected from erase by ERSSCR command"]
199    Ersien10 = 0,
200    #[doc = "1: Block 1 IFR Sector X is not protected from erase by ERSSCR command"]
201    Ersien11 = 1,
202}
203impl From<Ersien1> for u8 {
204    #[inline(always)]
205    fn from(variant: Ersien1) -> Self {
206        variant as _
207    }
208}
209impl crate::FieldSpec for Ersien1 {
210    type Ux = u8;
211}
212impl crate::IsEnum for Ersien1 {}
213#[doc = "Field `ERSIEN1` reader - Erase IFR Sector Enable - Block 1 (for dual block configs)"]
214pub type Ersien1R = crate::FieldReader<Ersien1>;
215impl Ersien1R {
216    #[doc = "Get enumerated values variant"]
217    #[inline(always)]
218    pub const fn variant(&self) -> Option<Ersien1> {
219        match self.bits {
220            0 => Some(Ersien1::Ersien10),
221            1 => Some(Ersien1::Ersien11),
222            _ => None,
223        }
224    }
225    #[doc = "Block 1 IFR Sector X is protected from erase by ERSSCR command"]
226    #[inline(always)]
227    pub fn is_ersien10(&self) -> bool {
228        *self == Ersien1::Ersien10
229    }
230    #[doc = "Block 1 IFR Sector X is not protected from erase by ERSSCR command"]
231    #[inline(always)]
232    pub fn is_ersien11(&self) -> bool {
233        *self == Ersien1::Ersien11
234    }
235}
236impl R {
237    #[doc = "Bit 7 - Command Complete Interrupt Enable"]
238    #[inline(always)]
239    pub fn ccie(&self) -> CcieR {
240        CcieR::new(((self.bits >> 7) & 1) != 0)
241    }
242    #[doc = "Bit 8 - Mass Erase Request"]
243    #[inline(always)]
244    pub fn ersreq(&self) -> ErsreqR {
245        ErsreqR::new(((self.bits >> 8) & 1) != 0)
246    }
247    #[doc = "Bit 16 - Double Bit Fault Detect Interrupt Enable"]
248    #[inline(always)]
249    pub fn dfdie(&self) -> DfdieR {
250        DfdieR::new(((self.bits >> 16) & 1) != 0)
251    }
252    #[doc = "Bits 24:27 - Erase IFR Sector Enable - Block 0"]
253    #[inline(always)]
254    pub fn ersien0(&self) -> Ersien0R {
255        Ersien0R::new(((self.bits >> 24) & 0x0f) as u8)
256    }
257    #[doc = "Bits 28:31 - Erase IFR Sector Enable - Block 1 (for dual block configs)"]
258    #[inline(always)]
259    pub fn ersien1(&self) -> Ersien1R {
260        Ersien1R::new(((self.bits >> 28) & 0x0f) as u8)
261    }
262}
263#[cfg(feature = "debug")]
264impl core::fmt::Debug for R {
265    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
266        f.debug_struct("FCNFG")
267            .field("ccie", &self.ccie())
268            .field("ersreq", &self.ersreq())
269            .field("dfdie", &self.dfdie())
270            .field("ersien0", &self.ersien0())
271            .field("ersien1", &self.ersien1())
272            .finish()
273    }
274}
275impl W {
276    #[doc = "Bit 7 - Command Complete Interrupt Enable"]
277    #[inline(always)]
278    pub fn ccie(&mut self) -> CcieW<'_, FcnfgSpec> {
279        CcieW::new(self, 7)
280    }
281    #[doc = "Bit 16 - Double Bit Fault Detect Interrupt Enable"]
282    #[inline(always)]
283    pub fn dfdie(&mut self) -> DfdieW<'_, FcnfgSpec> {
284        DfdieW::new(self, 16)
285    }
286}
287#[doc = "Flash Configuration Register\n\nYou can [`read`](crate::Reg::read) this register and get [`fcnfg::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`fcnfg::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
288pub struct FcnfgSpec;
289impl crate::RegisterSpec for FcnfgSpec {
290    type Ux = u32;
291}
292#[doc = "`read()` method returns [`fcnfg::R`](R) reader structure"]
293impl crate::Readable for FcnfgSpec {}
294#[doc = "`write(|w| ..)` method takes [`fcnfg::W`](W) writer structure"]
295impl crate::Writable for FcnfgSpec {
296    type Safety = crate::Unsafe;
297}
298#[doc = "`reset()` method sets FCNFG to value 0"]
299impl crate::Resettable for FcnfgSpec {}