atsam4sd16b_pac/efc1/
fcr.rs

1#[doc = "Register `FCR` writer"]
2pub struct W(crate::W<FCR_SPEC>);
3impl core::ops::Deref for W {
4    type Target = crate::W<FCR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl core::ops::DerefMut for W {
11    #[inline(always)]
12    fn deref_mut(&mut self) -> &mut Self::Target {
13        &mut self.0
14    }
15}
16impl From<crate::W<FCR_SPEC>> for W {
17    #[inline(always)]
18    fn from(writer: crate::W<FCR_SPEC>) -> Self {
19        W(writer)
20    }
21}
22#[doc = "Flash Command"]
23#[derive(Clone, Copy, Debug, PartialEq, Eq)]
24#[repr(u8)]
25pub enum FCMD_AW {
26    #[doc = "0: Get Flash descriptor"]
27    GETD = 0,
28    #[doc = "1: Write page"]
29    WP = 1,
30    #[doc = "2: Write page and lock"]
31    WPL = 2,
32    #[doc = "3: Erase page and write page"]
33    EWP = 3,
34    #[doc = "4: Erase page and write page then lock"]
35    EWPL = 4,
36    #[doc = "5: Erase all"]
37    EA = 5,
38    #[doc = "7: Erase pages"]
39    EPA = 7,
40    #[doc = "8: Set lock bit"]
41    SLB = 8,
42    #[doc = "9: Clear lock bit"]
43    CLB = 9,
44    #[doc = "10: Get lock bit"]
45    GLB = 10,
46    #[doc = "11: Set GPNVM bit"]
47    SGPB = 11,
48    #[doc = "12: Clear GPNVM bit"]
49    CGPB = 12,
50    #[doc = "13: Get GPNVM bit"]
51    GGPB = 13,
52    #[doc = "14: Start read unique identifier"]
53    STUI = 14,
54    #[doc = "15: Stop read unique identifier"]
55    SPUI = 15,
56    #[doc = "16: Get CALIB bit"]
57    GCALB = 16,
58    #[doc = "17: Erase sector"]
59    ES = 17,
60    #[doc = "18: Write user signature"]
61    WUS = 18,
62    #[doc = "19: Erase user signature"]
63    EUS = 19,
64    #[doc = "20: Start read user signature"]
65    STUS = 20,
66    #[doc = "21: Stop read user signature"]
67    SPUS = 21,
68}
69impl From<FCMD_AW> for u8 {
70    #[inline(always)]
71    fn from(variant: FCMD_AW) -> Self {
72        variant as _
73    }
74}
75#[doc = "Field `FCMD` writer - Flash Command"]
76pub type FCMD_W<'a, const O: u8> = crate::FieldWriter<'a, u32, FCR_SPEC, u8, FCMD_AW, 8, O>;
77impl<'a, const O: u8> FCMD_W<'a, O> {
78    #[doc = "Get Flash descriptor"]
79    #[inline(always)]
80    pub fn getd(self) -> &'a mut W {
81        self.variant(FCMD_AW::GETD)
82    }
83    #[doc = "Write page"]
84    #[inline(always)]
85    pub fn wp(self) -> &'a mut W {
86        self.variant(FCMD_AW::WP)
87    }
88    #[doc = "Write page and lock"]
89    #[inline(always)]
90    pub fn wpl(self) -> &'a mut W {
91        self.variant(FCMD_AW::WPL)
92    }
93    #[doc = "Erase page and write page"]
94    #[inline(always)]
95    pub fn ewp(self) -> &'a mut W {
96        self.variant(FCMD_AW::EWP)
97    }
98    #[doc = "Erase page and write page then lock"]
99    #[inline(always)]
100    pub fn ewpl(self) -> &'a mut W {
101        self.variant(FCMD_AW::EWPL)
102    }
103    #[doc = "Erase all"]
104    #[inline(always)]
105    pub fn ea(self) -> &'a mut W {
106        self.variant(FCMD_AW::EA)
107    }
108    #[doc = "Erase pages"]
109    #[inline(always)]
110    pub fn epa(self) -> &'a mut W {
111        self.variant(FCMD_AW::EPA)
112    }
113    #[doc = "Set lock bit"]
114    #[inline(always)]
115    pub fn slb(self) -> &'a mut W {
116        self.variant(FCMD_AW::SLB)
117    }
118    #[doc = "Clear lock bit"]
119    #[inline(always)]
120    pub fn clb(self) -> &'a mut W {
121        self.variant(FCMD_AW::CLB)
122    }
123    #[doc = "Get lock bit"]
124    #[inline(always)]
125    pub fn glb(self) -> &'a mut W {
126        self.variant(FCMD_AW::GLB)
127    }
128    #[doc = "Set GPNVM bit"]
129    #[inline(always)]
130    pub fn sgpb(self) -> &'a mut W {
131        self.variant(FCMD_AW::SGPB)
132    }
133    #[doc = "Clear GPNVM bit"]
134    #[inline(always)]
135    pub fn cgpb(self) -> &'a mut W {
136        self.variant(FCMD_AW::CGPB)
137    }
138    #[doc = "Get GPNVM bit"]
139    #[inline(always)]
140    pub fn ggpb(self) -> &'a mut W {
141        self.variant(FCMD_AW::GGPB)
142    }
143    #[doc = "Start read unique identifier"]
144    #[inline(always)]
145    pub fn stui(self) -> &'a mut W {
146        self.variant(FCMD_AW::STUI)
147    }
148    #[doc = "Stop read unique identifier"]
149    #[inline(always)]
150    pub fn spui(self) -> &'a mut W {
151        self.variant(FCMD_AW::SPUI)
152    }
153    #[doc = "Get CALIB bit"]
154    #[inline(always)]
155    pub fn gcalb(self) -> &'a mut W {
156        self.variant(FCMD_AW::GCALB)
157    }
158    #[doc = "Erase sector"]
159    #[inline(always)]
160    pub fn es(self) -> &'a mut W {
161        self.variant(FCMD_AW::ES)
162    }
163    #[doc = "Write user signature"]
164    #[inline(always)]
165    pub fn wus(self) -> &'a mut W {
166        self.variant(FCMD_AW::WUS)
167    }
168    #[doc = "Erase user signature"]
169    #[inline(always)]
170    pub fn eus(self) -> &'a mut W {
171        self.variant(FCMD_AW::EUS)
172    }
173    #[doc = "Start read user signature"]
174    #[inline(always)]
175    pub fn stus(self) -> &'a mut W {
176        self.variant(FCMD_AW::STUS)
177    }
178    #[doc = "Stop read user signature"]
179    #[inline(always)]
180    pub fn spus(self) -> &'a mut W {
181        self.variant(FCMD_AW::SPUS)
182    }
183}
184#[doc = "Field `FARG` writer - Flash Command Argument"]
185pub type FARG_W<'a, const O: u8> = crate::FieldWriter<'a, u32, FCR_SPEC, u16, u16, 16, O>;
186#[doc = "Flash Writing Protection Key"]
187#[derive(Clone, Copy, Debug, PartialEq, Eq)]
188#[repr(u8)]
189pub enum FKEY_AW {
190    #[doc = "90: The 0x5A value enables the command defined by the bits of the register. If the field is written with a different value, the write is not performed and no action is started."]
191    PASSWD = 90,
192}
193impl From<FKEY_AW> for u8 {
194    #[inline(always)]
195    fn from(variant: FKEY_AW) -> Self {
196        variant as _
197    }
198}
199#[doc = "Field `FKEY` writer - Flash Writing Protection Key"]
200pub type FKEY_W<'a, const O: u8> = crate::FieldWriter<'a, u32, FCR_SPEC, u8, FKEY_AW, 8, O>;
201impl<'a, const O: u8> FKEY_W<'a, O> {
202    #[doc = "The 0x5A value enables the command defined by the bits of the register. If the field is written with a different value, the write is not performed and no action is started."]
203    #[inline(always)]
204    pub fn passwd(self) -> &'a mut W {
205        self.variant(FKEY_AW::PASSWD)
206    }
207}
208impl W {
209    #[doc = "Bits 0:7 - Flash Command"]
210    #[inline(always)]
211    #[must_use]
212    pub fn fcmd(&mut self) -> FCMD_W<0> {
213        FCMD_W::new(self)
214    }
215    #[doc = "Bits 8:23 - Flash Command Argument"]
216    #[inline(always)]
217    #[must_use]
218    pub fn farg(&mut self) -> FARG_W<8> {
219        FARG_W::new(self)
220    }
221    #[doc = "Bits 24:31 - Flash Writing Protection Key"]
222    #[inline(always)]
223    #[must_use]
224    pub fn fkey(&mut self) -> FKEY_W<24> {
225        FKEY_W::new(self)
226    }
227    #[doc = "Writes raw bits to the register."]
228    #[inline(always)]
229    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
230        self.0.bits(bits);
231        self
232    }
233}
234#[doc = "EEFC Flash Command Register\n\nThis register you can [`write_with_zero`](crate::generic::Reg::write_with_zero). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [fcr](index.html) module"]
235pub struct FCR_SPEC;
236impl crate::RegisterSpec for FCR_SPEC {
237    type Ux = u32;
238}
239#[doc = "`write(|w| ..)` method takes [fcr::W](W) writer structure"]
240impl crate::Writable for FCR_SPEC {
241    type Writer = W;
242    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
243    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
244}