atsams70n21/efc/
eefc_fcr.rs1#[doc = "Register `EEFC_FCR` writer"]
2pub struct W(crate::W<EEFC_FCR_SPEC>);
3impl core::ops::Deref for W {
4 type Target = crate::W<EEFC_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<EEFC_FCR_SPEC>> for W {
17 #[inline(always)]
18 fn from(writer: crate::W<EEFC_FCR_SPEC>) -> Self {
19 W(writer)
20 }
21}
22#[doc = "Flash Command\n\nValue on reset: 0"]
23#[derive(Clone, Copy, Debug, PartialEq)]
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 struct FCMD_W<'a> {
77 w: &'a mut W,
78}
79impl<'a> FCMD_W<'a> {
80 #[doc = r"Writes `variant` to the field"]
81 #[inline(always)]
82 pub fn variant(self, variant: FCMD_AW) -> &'a mut W {
83 unsafe { self.bits(variant.into()) }
84 }
85 #[doc = "Get Flash descriptor"]
86 #[inline(always)]
87 pub fn getd(self) -> &'a mut W {
88 self.variant(FCMD_AW::GETD)
89 }
90 #[doc = "Write page"]
91 #[inline(always)]
92 pub fn wp(self) -> &'a mut W {
93 self.variant(FCMD_AW::WP)
94 }
95 #[doc = "Write page and lock"]
96 #[inline(always)]
97 pub fn wpl(self) -> &'a mut W {
98 self.variant(FCMD_AW::WPL)
99 }
100 #[doc = "Erase page and write page"]
101 #[inline(always)]
102 pub fn ewp(self) -> &'a mut W {
103 self.variant(FCMD_AW::EWP)
104 }
105 #[doc = "Erase page and write page then lock"]
106 #[inline(always)]
107 pub fn ewpl(self) -> &'a mut W {
108 self.variant(FCMD_AW::EWPL)
109 }
110 #[doc = "Erase all"]
111 #[inline(always)]
112 pub fn ea(self) -> &'a mut W {
113 self.variant(FCMD_AW::EA)
114 }
115 #[doc = "Erase pages"]
116 #[inline(always)]
117 pub fn epa(self) -> &'a mut W {
118 self.variant(FCMD_AW::EPA)
119 }
120 #[doc = "Set lock bit"]
121 #[inline(always)]
122 pub fn slb(self) -> &'a mut W {
123 self.variant(FCMD_AW::SLB)
124 }
125 #[doc = "Clear lock bit"]
126 #[inline(always)]
127 pub fn clb(self) -> &'a mut W {
128 self.variant(FCMD_AW::CLB)
129 }
130 #[doc = "Get lock bit"]
131 #[inline(always)]
132 pub fn glb(self) -> &'a mut W {
133 self.variant(FCMD_AW::GLB)
134 }
135 #[doc = "Set GPNVM bit"]
136 #[inline(always)]
137 pub fn sgpb(self) -> &'a mut W {
138 self.variant(FCMD_AW::SGPB)
139 }
140 #[doc = "Clear GPNVM bit"]
141 #[inline(always)]
142 pub fn cgpb(self) -> &'a mut W {
143 self.variant(FCMD_AW::CGPB)
144 }
145 #[doc = "Get GPNVM bit"]
146 #[inline(always)]
147 pub fn ggpb(self) -> &'a mut W {
148 self.variant(FCMD_AW::GGPB)
149 }
150 #[doc = "Start read unique identifier"]
151 #[inline(always)]
152 pub fn stui(self) -> &'a mut W {
153 self.variant(FCMD_AW::STUI)
154 }
155 #[doc = "Stop read unique identifier"]
156 #[inline(always)]
157 pub fn spui(self) -> &'a mut W {
158 self.variant(FCMD_AW::SPUI)
159 }
160 #[doc = "Get CALIB bit"]
161 #[inline(always)]
162 pub fn gcalb(self) -> &'a mut W {
163 self.variant(FCMD_AW::GCALB)
164 }
165 #[doc = "Erase sector"]
166 #[inline(always)]
167 pub fn es(self) -> &'a mut W {
168 self.variant(FCMD_AW::ES)
169 }
170 #[doc = "Write user signature"]
171 #[inline(always)]
172 pub fn wus(self) -> &'a mut W {
173 self.variant(FCMD_AW::WUS)
174 }
175 #[doc = "Erase user signature"]
176 #[inline(always)]
177 pub fn eus(self) -> &'a mut W {
178 self.variant(FCMD_AW::EUS)
179 }
180 #[doc = "Start read user signature"]
181 #[inline(always)]
182 pub fn stus(self) -> &'a mut W {
183 self.variant(FCMD_AW::STUS)
184 }
185 #[doc = "Stop read user signature"]
186 #[inline(always)]
187 pub fn spus(self) -> &'a mut W {
188 self.variant(FCMD_AW::SPUS)
189 }
190 #[doc = r"Writes raw bits to the field"]
191 #[inline(always)]
192 pub unsafe fn bits(self, value: u8) -> &'a mut W {
193 self.w.bits = (self.w.bits & !0xff) | (value as u32 & 0xff);
194 self.w
195 }
196}
197#[doc = "Field `FARG` writer - Flash Command Argument"]
198pub struct FARG_W<'a> {
199 w: &'a mut W,
200}
201impl<'a> FARG_W<'a> {
202 #[doc = r"Writes raw bits to the field"]
203 #[inline(always)]
204 pub unsafe fn bits(self, value: u16) -> &'a mut W {
205 self.w.bits = (self.w.bits & !(0xffff << 8)) | ((value as u32 & 0xffff) << 8);
206 self.w
207 }
208}
209#[doc = "Flash Writing Protection Key\n\nValue on reset: 0"]
210#[derive(Clone, Copy, Debug, PartialEq)]
211#[repr(u8)]
212pub enum FKEY_AW {
213 #[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."]
214 PASSWD = 90,
215}
216impl From<FKEY_AW> for u8 {
217 #[inline(always)]
218 fn from(variant: FKEY_AW) -> Self {
219 variant as _
220 }
221}
222#[doc = "Field `FKEY` writer - Flash Writing Protection Key"]
223pub struct FKEY_W<'a> {
224 w: &'a mut W,
225}
226impl<'a> FKEY_W<'a> {
227 #[doc = r"Writes `variant` to the field"]
228 #[inline(always)]
229 pub fn variant(self, variant: FKEY_AW) -> &'a mut W {
230 unsafe { self.bits(variant.into()) }
231 }
232 #[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."]
233 #[inline(always)]
234 pub fn passwd(self) -> &'a mut W {
235 self.variant(FKEY_AW::PASSWD)
236 }
237 #[doc = r"Writes raw bits to the field"]
238 #[inline(always)]
239 pub unsafe fn bits(self, value: u8) -> &'a mut W {
240 self.w.bits = (self.w.bits & !(0xff << 24)) | ((value as u32 & 0xff) << 24);
241 self.w
242 }
243}
244impl W {
245 #[doc = "Bits 0:7 - Flash Command"]
246 #[inline(always)]
247 pub fn fcmd(&mut self) -> FCMD_W {
248 FCMD_W { w: self }
249 }
250 #[doc = "Bits 8:23 - Flash Command Argument"]
251 #[inline(always)]
252 pub fn farg(&mut self) -> FARG_W {
253 FARG_W { w: self }
254 }
255 #[doc = "Bits 24:31 - Flash Writing Protection Key"]
256 #[inline(always)]
257 pub fn fkey(&mut self) -> FKEY_W {
258 FKEY_W { w: self }
259 }
260 #[doc = "Writes raw bits to the register."]
261 #[inline(always)]
262 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
263 self.0.bits(bits);
264 self
265 }
266}
267#[doc = "EEFC Flash Command Register\n\nThis register you can [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [eefc_fcr](index.html) module"]
268pub struct EEFC_FCR_SPEC;
269impl crate::RegisterSpec for EEFC_FCR_SPEC {
270 type Ux = u32;
271}
272#[doc = "`write(|w| ..)` method takes [eefc_fcr::W](W) writer structure"]
273impl crate::Writable for EEFC_FCR_SPEC {
274 type Writer = W;
275}
276#[doc = "`reset()` method sets EEFC_FCR to value 0"]
277impl crate::Resettable for EEFC_FCR_SPEC {
278 #[inline(always)]
279 fn reset_value() -> Self::Ux {
280 0
281 }
282}