avr_device/devices/atmega2560/cpu/
xmcra.rs1#[doc = "Register `XMCRA` reader"]
2pub struct R(crate::R<XMCRA_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<XMCRA_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<XMCRA_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<XMCRA_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `XMCRA` writer"]
17pub struct W(crate::W<XMCRA_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<XMCRA_SPEC>;
20 #[inline(always)]
21 fn deref(&self) -> &Self::Target {
22 &self.0
23 }
24}
25impl core::ops::DerefMut for W {
26 #[inline(always)]
27 fn deref_mut(&mut self) -> &mut Self::Target {
28 &mut self.0
29 }
30}
31impl From<crate::W<XMCRA_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<XMCRA_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `SRW0` reader - Wait state select bit lower page"]
38pub type SRW0_R = crate::FieldReader<u8, SRW0_A>;
39#[doc = "Wait state select bit lower page\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum SRW0_A {
43 #[doc = "0: No wait-states"]
44 VAL_0X00 = 0,
45 #[doc = "1: Wait one cycle during read/write strobe"]
46 VAL_0X01 = 1,
47 #[doc = "2: Wait two cycles during read/write strobe"]
48 VAL_0X02 = 2,
49 #[doc = "3: Wait two cycles during read/write and wait one cycle before driving out new address"]
50 VAL_0X03 = 3,
51}
52impl From<SRW0_A> for u8 {
53 #[inline(always)]
54 fn from(variant: SRW0_A) -> Self {
55 variant as _
56 }
57}
58impl SRW0_R {
59 #[doc = "Get enumerated values variant"]
60 #[inline(always)]
61 pub fn variant(&self) -> SRW0_A {
62 match self.bits {
63 0 => SRW0_A::VAL_0X00,
64 1 => SRW0_A::VAL_0X01,
65 2 => SRW0_A::VAL_0X02,
66 3 => SRW0_A::VAL_0X03,
67 _ => unreachable!(),
68 }
69 }
70 #[doc = "Checks if the value of the field is `VAL_0X00`"]
71 #[inline(always)]
72 pub fn is_val_0x00(&self) -> bool {
73 *self == SRW0_A::VAL_0X00
74 }
75 #[doc = "Checks if the value of the field is `VAL_0X01`"]
76 #[inline(always)]
77 pub fn is_val_0x01(&self) -> bool {
78 *self == SRW0_A::VAL_0X01
79 }
80 #[doc = "Checks if the value of the field is `VAL_0X02`"]
81 #[inline(always)]
82 pub fn is_val_0x02(&self) -> bool {
83 *self == SRW0_A::VAL_0X02
84 }
85 #[doc = "Checks if the value of the field is `VAL_0X03`"]
86 #[inline(always)]
87 pub fn is_val_0x03(&self) -> bool {
88 *self == SRW0_A::VAL_0X03
89 }
90}
91#[doc = "Field `SRW0` writer - Wait state select bit lower page"]
92pub type SRW0_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u8, XMCRA_SPEC, u8, SRW0_A, 2, O>;
93impl<'a, const O: u8> SRW0_W<'a, O> {
94 #[doc = "No wait-states"]
95 #[inline(always)]
96 pub fn val_0x00(self) -> &'a mut W {
97 self.variant(SRW0_A::VAL_0X00)
98 }
99 #[doc = "Wait one cycle during read/write strobe"]
100 #[inline(always)]
101 pub fn val_0x01(self) -> &'a mut W {
102 self.variant(SRW0_A::VAL_0X01)
103 }
104 #[doc = "Wait two cycles during read/write strobe"]
105 #[inline(always)]
106 pub fn val_0x02(self) -> &'a mut W {
107 self.variant(SRW0_A::VAL_0X02)
108 }
109 #[doc = "Wait two cycles during read/write and wait one cycle before driving out new address"]
110 #[inline(always)]
111 pub fn val_0x03(self) -> &'a mut W {
112 self.variant(SRW0_A::VAL_0X03)
113 }
114}
115#[doc = "Field `SRW1` reader - Wait state select bit upper page"]
116pub type SRW1_R = crate::FieldReader<u8, SRW1_A>;
117#[doc = "Wait state select bit upper page\n\nValue on reset: 0"]
118#[derive(Clone, Copy, Debug, PartialEq, Eq)]
119#[repr(u8)]
120pub enum SRW1_A {
121 #[doc = "0: No wait-states"]
122 VAL_0X00 = 0,
123 #[doc = "1: Wait one cycle during read/write strobe"]
124 VAL_0X01 = 1,
125 #[doc = "2: Wait two cycles during read/write strobe"]
126 VAL_0X02 = 2,
127 #[doc = "3: Wait two cycles during read/write and wait one cycle before driving out new address"]
128 VAL_0X03 = 3,
129}
130impl From<SRW1_A> for u8 {
131 #[inline(always)]
132 fn from(variant: SRW1_A) -> Self {
133 variant as _
134 }
135}
136impl SRW1_R {
137 #[doc = "Get enumerated values variant"]
138 #[inline(always)]
139 pub fn variant(&self) -> SRW1_A {
140 match self.bits {
141 0 => SRW1_A::VAL_0X00,
142 1 => SRW1_A::VAL_0X01,
143 2 => SRW1_A::VAL_0X02,
144 3 => SRW1_A::VAL_0X03,
145 _ => unreachable!(),
146 }
147 }
148 #[doc = "Checks if the value of the field is `VAL_0X00`"]
149 #[inline(always)]
150 pub fn is_val_0x00(&self) -> bool {
151 *self == SRW1_A::VAL_0X00
152 }
153 #[doc = "Checks if the value of the field is `VAL_0X01`"]
154 #[inline(always)]
155 pub fn is_val_0x01(&self) -> bool {
156 *self == SRW1_A::VAL_0X01
157 }
158 #[doc = "Checks if the value of the field is `VAL_0X02`"]
159 #[inline(always)]
160 pub fn is_val_0x02(&self) -> bool {
161 *self == SRW1_A::VAL_0X02
162 }
163 #[doc = "Checks if the value of the field is `VAL_0X03`"]
164 #[inline(always)]
165 pub fn is_val_0x03(&self) -> bool {
166 *self == SRW1_A::VAL_0X03
167 }
168}
169#[doc = "Field `SRW1` writer - Wait state select bit upper page"]
170pub type SRW1_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u8, XMCRA_SPEC, u8, SRW1_A, 2, O>;
171impl<'a, const O: u8> SRW1_W<'a, O> {
172 #[doc = "No wait-states"]
173 #[inline(always)]
174 pub fn val_0x00(self) -> &'a mut W {
175 self.variant(SRW1_A::VAL_0X00)
176 }
177 #[doc = "Wait one cycle during read/write strobe"]
178 #[inline(always)]
179 pub fn val_0x01(self) -> &'a mut W {
180 self.variant(SRW1_A::VAL_0X01)
181 }
182 #[doc = "Wait two cycles during read/write strobe"]
183 #[inline(always)]
184 pub fn val_0x02(self) -> &'a mut W {
185 self.variant(SRW1_A::VAL_0X02)
186 }
187 #[doc = "Wait two cycles during read/write and wait one cycle before driving out new address"]
188 #[inline(always)]
189 pub fn val_0x03(self) -> &'a mut W {
190 self.variant(SRW1_A::VAL_0X03)
191 }
192}
193#[doc = "Field `SRL` reader - Wait state page limit"]
194pub type SRL_R = crate::FieldReader<u8, SRL_A>;
195#[doc = "Wait state page limit\n\nValue on reset: 0"]
196#[derive(Clone, Copy, Debug, PartialEq, Eq)]
197#[repr(u8)]
198pub enum SRL_A {
199 #[doc = "0: LS = N/A, US = 0x1100 - 0xFFFF"]
200 VAL_0X00 = 0,
201 #[doc = "1: LS = 0x2200 - 0x1FFF, US = 0x2000 - 0xFFFF"]
202 VAL_0X01 = 1,
203 #[doc = "2: LS = 0x2200 - 0x3FFF, US = 0x4000 - 0xFFFF"]
204 VAL_0X02 = 2,
205 #[doc = "3: LS = 0x2200 - 0x5FFF, US = 0x6000 - 0xFFFF"]
206 VAL_0X03 = 3,
207 #[doc = "4: LS = 0x2200 - 0x7FFF, US = 0x8000 - 0xFFFF"]
208 VAL_0X04 = 4,
209 #[doc = "5: LS = 0x2200 - 0x9FFF, US = 0xA000 - 0xFFFF"]
210 VAL_0X05 = 5,
211 #[doc = "6: LS = 0x2200 - 0xBFFF, US = 0xC000 - 0xFFFF"]
212 VAL_0X06 = 6,
213 #[doc = "7: LS = 0x2200 - 0xDFFF, US = 0xE000 - 0xFFFF"]
214 VAL_0X07 = 7,
215}
216impl From<SRL_A> for u8 {
217 #[inline(always)]
218 fn from(variant: SRL_A) -> Self {
219 variant as _
220 }
221}
222impl SRL_R {
223 #[doc = "Get enumerated values variant"]
224 #[inline(always)]
225 pub fn variant(&self) -> SRL_A {
226 match self.bits {
227 0 => SRL_A::VAL_0X00,
228 1 => SRL_A::VAL_0X01,
229 2 => SRL_A::VAL_0X02,
230 3 => SRL_A::VAL_0X03,
231 4 => SRL_A::VAL_0X04,
232 5 => SRL_A::VAL_0X05,
233 6 => SRL_A::VAL_0X06,
234 7 => SRL_A::VAL_0X07,
235 _ => unreachable!(),
236 }
237 }
238 #[doc = "Checks if the value of the field is `VAL_0X00`"]
239 #[inline(always)]
240 pub fn is_val_0x00(&self) -> bool {
241 *self == SRL_A::VAL_0X00
242 }
243 #[doc = "Checks if the value of the field is `VAL_0X01`"]
244 #[inline(always)]
245 pub fn is_val_0x01(&self) -> bool {
246 *self == SRL_A::VAL_0X01
247 }
248 #[doc = "Checks if the value of the field is `VAL_0X02`"]
249 #[inline(always)]
250 pub fn is_val_0x02(&self) -> bool {
251 *self == SRL_A::VAL_0X02
252 }
253 #[doc = "Checks if the value of the field is `VAL_0X03`"]
254 #[inline(always)]
255 pub fn is_val_0x03(&self) -> bool {
256 *self == SRL_A::VAL_0X03
257 }
258 #[doc = "Checks if the value of the field is `VAL_0X04`"]
259 #[inline(always)]
260 pub fn is_val_0x04(&self) -> bool {
261 *self == SRL_A::VAL_0X04
262 }
263 #[doc = "Checks if the value of the field is `VAL_0X05`"]
264 #[inline(always)]
265 pub fn is_val_0x05(&self) -> bool {
266 *self == SRL_A::VAL_0X05
267 }
268 #[doc = "Checks if the value of the field is `VAL_0X06`"]
269 #[inline(always)]
270 pub fn is_val_0x06(&self) -> bool {
271 *self == SRL_A::VAL_0X06
272 }
273 #[doc = "Checks if the value of the field is `VAL_0X07`"]
274 #[inline(always)]
275 pub fn is_val_0x07(&self) -> bool {
276 *self == SRL_A::VAL_0X07
277 }
278}
279#[doc = "Field `SRL` writer - Wait state page limit"]
280pub type SRL_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u8, XMCRA_SPEC, u8, SRL_A, 3, O>;
281impl<'a, const O: u8> SRL_W<'a, O> {
282 #[doc = "LS = N/A, US = 0x1100 - 0xFFFF"]
283 #[inline(always)]
284 pub fn val_0x00(self) -> &'a mut W {
285 self.variant(SRL_A::VAL_0X00)
286 }
287 #[doc = "LS = 0x2200 - 0x1FFF, US = 0x2000 - 0xFFFF"]
288 #[inline(always)]
289 pub fn val_0x01(self) -> &'a mut W {
290 self.variant(SRL_A::VAL_0X01)
291 }
292 #[doc = "LS = 0x2200 - 0x3FFF, US = 0x4000 - 0xFFFF"]
293 #[inline(always)]
294 pub fn val_0x02(self) -> &'a mut W {
295 self.variant(SRL_A::VAL_0X02)
296 }
297 #[doc = "LS = 0x2200 - 0x5FFF, US = 0x6000 - 0xFFFF"]
298 #[inline(always)]
299 pub fn val_0x03(self) -> &'a mut W {
300 self.variant(SRL_A::VAL_0X03)
301 }
302 #[doc = "LS = 0x2200 - 0x7FFF, US = 0x8000 - 0xFFFF"]
303 #[inline(always)]
304 pub fn val_0x04(self) -> &'a mut W {
305 self.variant(SRL_A::VAL_0X04)
306 }
307 #[doc = "LS = 0x2200 - 0x9FFF, US = 0xA000 - 0xFFFF"]
308 #[inline(always)]
309 pub fn val_0x05(self) -> &'a mut W {
310 self.variant(SRL_A::VAL_0X05)
311 }
312 #[doc = "LS = 0x2200 - 0xBFFF, US = 0xC000 - 0xFFFF"]
313 #[inline(always)]
314 pub fn val_0x06(self) -> &'a mut W {
315 self.variant(SRL_A::VAL_0X06)
316 }
317 #[doc = "LS = 0x2200 - 0xDFFF, US = 0xE000 - 0xFFFF"]
318 #[inline(always)]
319 pub fn val_0x07(self) -> &'a mut W {
320 self.variant(SRL_A::VAL_0X07)
321 }
322}
323#[doc = "Field `SRE` reader - External SRAM Enable"]
324pub type SRE_R = crate::BitReader<bool>;
325#[doc = "Field `SRE` writer - External SRAM Enable"]
326pub type SRE_W<'a, const O: u8> = crate::BitWriter<'a, u8, XMCRA_SPEC, bool, O>;
327impl R {
328 #[doc = "Bits 0:1 - Wait state select bit lower page"]
329 #[inline(always)]
330 pub fn srw0(&self) -> SRW0_R {
331 SRW0_R::new(self.bits & 3)
332 }
333 #[doc = "Bits 2:3 - Wait state select bit upper page"]
334 #[inline(always)]
335 pub fn srw1(&self) -> SRW1_R {
336 SRW1_R::new((self.bits >> 2) & 3)
337 }
338 #[doc = "Bits 4:6 - Wait state page limit"]
339 #[inline(always)]
340 pub fn srl(&self) -> SRL_R {
341 SRL_R::new((self.bits >> 4) & 7)
342 }
343 #[doc = "Bit 7 - External SRAM Enable"]
344 #[inline(always)]
345 pub fn sre(&self) -> SRE_R {
346 SRE_R::new(((self.bits >> 7) & 1) != 0)
347 }
348}
349impl W {
350 #[doc = "Bits 0:1 - Wait state select bit lower page"]
351 #[inline(always)]
352 #[must_use]
353 pub fn srw0(&mut self) -> SRW0_W<0> {
354 SRW0_W::new(self)
355 }
356 #[doc = "Bits 2:3 - Wait state select bit upper page"]
357 #[inline(always)]
358 #[must_use]
359 pub fn srw1(&mut self) -> SRW1_W<2> {
360 SRW1_W::new(self)
361 }
362 #[doc = "Bits 4:6 - Wait state page limit"]
363 #[inline(always)]
364 #[must_use]
365 pub fn srl(&mut self) -> SRL_W<4> {
366 SRL_W::new(self)
367 }
368 #[doc = "Bit 7 - External SRAM Enable"]
369 #[inline(always)]
370 #[must_use]
371 pub fn sre(&mut self) -> SRE_W<7> {
372 SRE_W::new(self)
373 }
374 #[doc = "Writes raw bits to the register."]
375 #[inline(always)]
376 pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
377 self.0.bits(bits);
378 self
379 }
380}
381#[doc = "External Memory Control Register A\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [xmcra](index.html) module"]
382pub struct XMCRA_SPEC;
383impl crate::RegisterSpec for XMCRA_SPEC {
384 type Ux = u8;
385}
386#[doc = "`read()` method returns [xmcra::R](R) reader structure"]
387impl crate::Readable for XMCRA_SPEC {
388 type Reader = R;
389}
390#[doc = "`write(|w| ..)` method takes [xmcra::W](W) writer structure"]
391impl crate::Writable for XMCRA_SPEC {
392 type Writer = W;
393 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
394 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
395}
396#[doc = "`reset()` method sets XMCRA to value 0"]
397impl crate::Resettable for XMCRA_SPEC {
398 const RESET_VALUE: Self::Ux = 0;
399}