atsam4e8e_pac/chipid/
cidr.rs

1#[doc = "Register `CIDR` reader"]
2pub struct R(crate::R<CIDR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<CIDR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<CIDR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<CIDR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Field `VERSION` reader - Version of the Device"]
17pub type VERSION_R = crate::FieldReader<u8, u8>;
18#[doc = "Field `EPROC` reader - Embedded Processor"]
19pub type EPROC_R = crate::FieldReader<u8, EPROC_A>;
20#[doc = "Embedded Processor"]
21#[derive(Clone, Copy, Debug, PartialEq, Eq)]
22#[repr(u8)]
23pub enum EPROC_A {
24    #[doc = "1: ARM946ES"]
25    ARM946ES = 1,
26    #[doc = "2: ARM7TDMI"]
27    ARM7TDMI = 2,
28    #[doc = "3: Cortex-M3"]
29    CM3 = 3,
30    #[doc = "4: ARM920T"]
31    ARM920T = 4,
32    #[doc = "5: ARM926EJS"]
33    ARM926EJS = 5,
34    #[doc = "6: Cortex-A5"]
35    CA5 = 6,
36    #[doc = "7: Cortex-M4"]
37    CM4 = 7,
38}
39impl From<EPROC_A> for u8 {
40    #[inline(always)]
41    fn from(variant: EPROC_A) -> Self {
42        variant as _
43    }
44}
45impl EPROC_R {
46    #[doc = "Get enumerated values variant"]
47    #[inline(always)]
48    pub fn variant(&self) -> Option<EPROC_A> {
49        match self.bits {
50            1 => Some(EPROC_A::ARM946ES),
51            2 => Some(EPROC_A::ARM7TDMI),
52            3 => Some(EPROC_A::CM3),
53            4 => Some(EPROC_A::ARM920T),
54            5 => Some(EPROC_A::ARM926EJS),
55            6 => Some(EPROC_A::CA5),
56            7 => Some(EPROC_A::CM4),
57            _ => None,
58        }
59    }
60    #[doc = "Checks if the value of the field is `ARM946ES`"]
61    #[inline(always)]
62    pub fn is_arm946es(&self) -> bool {
63        *self == EPROC_A::ARM946ES
64    }
65    #[doc = "Checks if the value of the field is `ARM7TDMI`"]
66    #[inline(always)]
67    pub fn is_arm7tdmi(&self) -> bool {
68        *self == EPROC_A::ARM7TDMI
69    }
70    #[doc = "Checks if the value of the field is `CM3`"]
71    #[inline(always)]
72    pub fn is_cm3(&self) -> bool {
73        *self == EPROC_A::CM3
74    }
75    #[doc = "Checks if the value of the field is `ARM920T`"]
76    #[inline(always)]
77    pub fn is_arm920t(&self) -> bool {
78        *self == EPROC_A::ARM920T
79    }
80    #[doc = "Checks if the value of the field is `ARM926EJS`"]
81    #[inline(always)]
82    pub fn is_arm926ejs(&self) -> bool {
83        *self == EPROC_A::ARM926EJS
84    }
85    #[doc = "Checks if the value of the field is `CA5`"]
86    #[inline(always)]
87    pub fn is_ca5(&self) -> bool {
88        *self == EPROC_A::CA5
89    }
90    #[doc = "Checks if the value of the field is `CM4`"]
91    #[inline(always)]
92    pub fn is_cm4(&self) -> bool {
93        *self == EPROC_A::CM4
94    }
95}
96#[doc = "Field `NVPSIZ` reader - Nonvolatile Program Memory Size"]
97pub type NVPSIZ_R = crate::FieldReader<u8, NVPSIZ_A>;
98#[doc = "Nonvolatile Program Memory Size"]
99#[derive(Clone, Copy, Debug, PartialEq, Eq)]
100#[repr(u8)]
101pub enum NVPSIZ_A {
102    #[doc = "0: None"]
103    NONE = 0,
104    #[doc = "1: 8 Kbytes"]
105    _8K = 1,
106    #[doc = "2: 16 Kbytes"]
107    _16K = 2,
108    #[doc = "3: 32 Kbytes"]
109    _32K = 3,
110    #[doc = "5: 64 Kbytes"]
111    _64K = 5,
112    #[doc = "7: 128 Kbytes"]
113    _128K = 7,
114    #[doc = "9: 256 Kbytes"]
115    _256K = 9,
116    #[doc = "10: 512 Kbytes"]
117    _512K = 10,
118    #[doc = "12: 1024 Kbytes"]
119    _1024K = 12,
120    #[doc = "14: 2048 Kbytes"]
121    _2048K = 14,
122}
123impl From<NVPSIZ_A> for u8 {
124    #[inline(always)]
125    fn from(variant: NVPSIZ_A) -> Self {
126        variant as _
127    }
128}
129impl NVPSIZ_R {
130    #[doc = "Get enumerated values variant"]
131    #[inline(always)]
132    pub fn variant(&self) -> Option<NVPSIZ_A> {
133        match self.bits {
134            0 => Some(NVPSIZ_A::NONE),
135            1 => Some(NVPSIZ_A::_8K),
136            2 => Some(NVPSIZ_A::_16K),
137            3 => Some(NVPSIZ_A::_32K),
138            5 => Some(NVPSIZ_A::_64K),
139            7 => Some(NVPSIZ_A::_128K),
140            9 => Some(NVPSIZ_A::_256K),
141            10 => Some(NVPSIZ_A::_512K),
142            12 => Some(NVPSIZ_A::_1024K),
143            14 => Some(NVPSIZ_A::_2048K),
144            _ => None,
145        }
146    }
147    #[doc = "Checks if the value of the field is `NONE`"]
148    #[inline(always)]
149    pub fn is_none(&self) -> bool {
150        *self == NVPSIZ_A::NONE
151    }
152    #[doc = "Checks if the value of the field is `_8K`"]
153    #[inline(always)]
154    pub fn is_8k(&self) -> bool {
155        *self == NVPSIZ_A::_8K
156    }
157    #[doc = "Checks if the value of the field is `_16K`"]
158    #[inline(always)]
159    pub fn is_16k(&self) -> bool {
160        *self == NVPSIZ_A::_16K
161    }
162    #[doc = "Checks if the value of the field is `_32K`"]
163    #[inline(always)]
164    pub fn is_32k(&self) -> bool {
165        *self == NVPSIZ_A::_32K
166    }
167    #[doc = "Checks if the value of the field is `_64K`"]
168    #[inline(always)]
169    pub fn is_64k(&self) -> bool {
170        *self == NVPSIZ_A::_64K
171    }
172    #[doc = "Checks if the value of the field is `_128K`"]
173    #[inline(always)]
174    pub fn is_128k(&self) -> bool {
175        *self == NVPSIZ_A::_128K
176    }
177    #[doc = "Checks if the value of the field is `_256K`"]
178    #[inline(always)]
179    pub fn is_256k(&self) -> bool {
180        *self == NVPSIZ_A::_256K
181    }
182    #[doc = "Checks if the value of the field is `_512K`"]
183    #[inline(always)]
184    pub fn is_512k(&self) -> bool {
185        *self == NVPSIZ_A::_512K
186    }
187    #[doc = "Checks if the value of the field is `_1024K`"]
188    #[inline(always)]
189    pub fn is_1024k(&self) -> bool {
190        *self == NVPSIZ_A::_1024K
191    }
192    #[doc = "Checks if the value of the field is `_2048K`"]
193    #[inline(always)]
194    pub fn is_2048k(&self) -> bool {
195        *self == NVPSIZ_A::_2048K
196    }
197}
198#[doc = "Field `NVPSIZ2` reader - Second Nonvolatile Program Memory Size"]
199pub type NVPSIZ2_R = crate::FieldReader<u8, NVPSIZ2_A>;
200#[doc = "Second Nonvolatile Program Memory Size"]
201#[derive(Clone, Copy, Debug, PartialEq, Eq)]
202#[repr(u8)]
203pub enum NVPSIZ2_A {
204    #[doc = "0: None"]
205    NONE = 0,
206    #[doc = "1: 8 Kbytes"]
207    _8K = 1,
208    #[doc = "2: 16 Kbytes"]
209    _16K = 2,
210    #[doc = "3: 32 Kbytes"]
211    _32K = 3,
212    #[doc = "5: 64 Kbytes"]
213    _64K = 5,
214    #[doc = "7: 128 Kbytes"]
215    _128K = 7,
216    #[doc = "9: 256 Kbytes"]
217    _256K = 9,
218    #[doc = "10: 512 Kbytes"]
219    _512K = 10,
220    #[doc = "12: 1024 Kbytes"]
221    _1024K = 12,
222    #[doc = "14: 2048 Kbytes"]
223    _2048K = 14,
224}
225impl From<NVPSIZ2_A> for u8 {
226    #[inline(always)]
227    fn from(variant: NVPSIZ2_A) -> Self {
228        variant as _
229    }
230}
231impl NVPSIZ2_R {
232    #[doc = "Get enumerated values variant"]
233    #[inline(always)]
234    pub fn variant(&self) -> Option<NVPSIZ2_A> {
235        match self.bits {
236            0 => Some(NVPSIZ2_A::NONE),
237            1 => Some(NVPSIZ2_A::_8K),
238            2 => Some(NVPSIZ2_A::_16K),
239            3 => Some(NVPSIZ2_A::_32K),
240            5 => Some(NVPSIZ2_A::_64K),
241            7 => Some(NVPSIZ2_A::_128K),
242            9 => Some(NVPSIZ2_A::_256K),
243            10 => Some(NVPSIZ2_A::_512K),
244            12 => Some(NVPSIZ2_A::_1024K),
245            14 => Some(NVPSIZ2_A::_2048K),
246            _ => None,
247        }
248    }
249    #[doc = "Checks if the value of the field is `NONE`"]
250    #[inline(always)]
251    pub fn is_none(&self) -> bool {
252        *self == NVPSIZ2_A::NONE
253    }
254    #[doc = "Checks if the value of the field is `_8K`"]
255    #[inline(always)]
256    pub fn is_8k(&self) -> bool {
257        *self == NVPSIZ2_A::_8K
258    }
259    #[doc = "Checks if the value of the field is `_16K`"]
260    #[inline(always)]
261    pub fn is_16k(&self) -> bool {
262        *self == NVPSIZ2_A::_16K
263    }
264    #[doc = "Checks if the value of the field is `_32K`"]
265    #[inline(always)]
266    pub fn is_32k(&self) -> bool {
267        *self == NVPSIZ2_A::_32K
268    }
269    #[doc = "Checks if the value of the field is `_64K`"]
270    #[inline(always)]
271    pub fn is_64k(&self) -> bool {
272        *self == NVPSIZ2_A::_64K
273    }
274    #[doc = "Checks if the value of the field is `_128K`"]
275    #[inline(always)]
276    pub fn is_128k(&self) -> bool {
277        *self == NVPSIZ2_A::_128K
278    }
279    #[doc = "Checks if the value of the field is `_256K`"]
280    #[inline(always)]
281    pub fn is_256k(&self) -> bool {
282        *self == NVPSIZ2_A::_256K
283    }
284    #[doc = "Checks if the value of the field is `_512K`"]
285    #[inline(always)]
286    pub fn is_512k(&self) -> bool {
287        *self == NVPSIZ2_A::_512K
288    }
289    #[doc = "Checks if the value of the field is `_1024K`"]
290    #[inline(always)]
291    pub fn is_1024k(&self) -> bool {
292        *self == NVPSIZ2_A::_1024K
293    }
294    #[doc = "Checks if the value of the field is `_2048K`"]
295    #[inline(always)]
296    pub fn is_2048k(&self) -> bool {
297        *self == NVPSIZ2_A::_2048K
298    }
299}
300#[doc = "Field `SRAMSIZ` reader - Internal SRAM Size"]
301pub type SRAMSIZ_R = crate::FieldReader<u8, SRAMSIZ_A>;
302#[doc = "Internal SRAM Size"]
303#[derive(Clone, Copy, Debug, PartialEq, Eq)]
304#[repr(u8)]
305pub enum SRAMSIZ_A {
306    #[doc = "0: 48 Kbytes"]
307    _48K = 0,
308    #[doc = "1: 192 Kbytes"]
309    _192K = 1,
310    #[doc = "2: 2 Kbytes"]
311    _2K = 2,
312    #[doc = "3: 6 Kbytes"]
313    _6K = 3,
314    #[doc = "4: 24 Kbytes"]
315    _24K = 4,
316    #[doc = "5: 4 Kbytes"]
317    _4K = 5,
318    #[doc = "6: 80 Kbytes"]
319    _80K = 6,
320    #[doc = "7: 160 Kbytes"]
321    _160K = 7,
322    #[doc = "8: 8 Kbytes"]
323    _8K = 8,
324    #[doc = "9: 16 Kbytes"]
325    _16K = 9,
326    #[doc = "10: 32 Kbytes"]
327    _32K = 10,
328    #[doc = "11: 64 Kbytes"]
329    _64K = 11,
330    #[doc = "12: 128 Kbytes"]
331    _128K = 12,
332    #[doc = "13: 256 Kbytes"]
333    _256K = 13,
334    #[doc = "14: 96 Kbytes"]
335    _96K = 14,
336    #[doc = "15: 512 Kbytes"]
337    _512K = 15,
338}
339impl From<SRAMSIZ_A> for u8 {
340    #[inline(always)]
341    fn from(variant: SRAMSIZ_A) -> Self {
342        variant as _
343    }
344}
345impl SRAMSIZ_R {
346    #[doc = "Get enumerated values variant"]
347    #[inline(always)]
348    pub fn variant(&self) -> SRAMSIZ_A {
349        match self.bits {
350            0 => SRAMSIZ_A::_48K,
351            1 => SRAMSIZ_A::_192K,
352            2 => SRAMSIZ_A::_2K,
353            3 => SRAMSIZ_A::_6K,
354            4 => SRAMSIZ_A::_24K,
355            5 => SRAMSIZ_A::_4K,
356            6 => SRAMSIZ_A::_80K,
357            7 => SRAMSIZ_A::_160K,
358            8 => SRAMSIZ_A::_8K,
359            9 => SRAMSIZ_A::_16K,
360            10 => SRAMSIZ_A::_32K,
361            11 => SRAMSIZ_A::_64K,
362            12 => SRAMSIZ_A::_128K,
363            13 => SRAMSIZ_A::_256K,
364            14 => SRAMSIZ_A::_96K,
365            15 => SRAMSIZ_A::_512K,
366            _ => unreachable!(),
367        }
368    }
369    #[doc = "Checks if the value of the field is `_48K`"]
370    #[inline(always)]
371    pub fn is_48k(&self) -> bool {
372        *self == SRAMSIZ_A::_48K
373    }
374    #[doc = "Checks if the value of the field is `_192K`"]
375    #[inline(always)]
376    pub fn is_192k(&self) -> bool {
377        *self == SRAMSIZ_A::_192K
378    }
379    #[doc = "Checks if the value of the field is `_2K`"]
380    #[inline(always)]
381    pub fn is_2k(&self) -> bool {
382        *self == SRAMSIZ_A::_2K
383    }
384    #[doc = "Checks if the value of the field is `_6K`"]
385    #[inline(always)]
386    pub fn is_6k(&self) -> bool {
387        *self == SRAMSIZ_A::_6K
388    }
389    #[doc = "Checks if the value of the field is `_24K`"]
390    #[inline(always)]
391    pub fn is_24k(&self) -> bool {
392        *self == SRAMSIZ_A::_24K
393    }
394    #[doc = "Checks if the value of the field is `_4K`"]
395    #[inline(always)]
396    pub fn is_4k(&self) -> bool {
397        *self == SRAMSIZ_A::_4K
398    }
399    #[doc = "Checks if the value of the field is `_80K`"]
400    #[inline(always)]
401    pub fn is_80k(&self) -> bool {
402        *self == SRAMSIZ_A::_80K
403    }
404    #[doc = "Checks if the value of the field is `_160K`"]
405    #[inline(always)]
406    pub fn is_160k(&self) -> bool {
407        *self == SRAMSIZ_A::_160K
408    }
409    #[doc = "Checks if the value of the field is `_8K`"]
410    #[inline(always)]
411    pub fn is_8k(&self) -> bool {
412        *self == SRAMSIZ_A::_8K
413    }
414    #[doc = "Checks if the value of the field is `_16K`"]
415    #[inline(always)]
416    pub fn is_16k(&self) -> bool {
417        *self == SRAMSIZ_A::_16K
418    }
419    #[doc = "Checks if the value of the field is `_32K`"]
420    #[inline(always)]
421    pub fn is_32k(&self) -> bool {
422        *self == SRAMSIZ_A::_32K
423    }
424    #[doc = "Checks if the value of the field is `_64K`"]
425    #[inline(always)]
426    pub fn is_64k(&self) -> bool {
427        *self == SRAMSIZ_A::_64K
428    }
429    #[doc = "Checks if the value of the field is `_128K`"]
430    #[inline(always)]
431    pub fn is_128k(&self) -> bool {
432        *self == SRAMSIZ_A::_128K
433    }
434    #[doc = "Checks if the value of the field is `_256K`"]
435    #[inline(always)]
436    pub fn is_256k(&self) -> bool {
437        *self == SRAMSIZ_A::_256K
438    }
439    #[doc = "Checks if the value of the field is `_96K`"]
440    #[inline(always)]
441    pub fn is_96k(&self) -> bool {
442        *self == SRAMSIZ_A::_96K
443    }
444    #[doc = "Checks if the value of the field is `_512K`"]
445    #[inline(always)]
446    pub fn is_512k(&self) -> bool {
447        *self == SRAMSIZ_A::_512K
448    }
449}
450#[doc = "Field `ARCH` reader - Architecture Identifier"]
451pub type ARCH_R = crate::FieldReader<u8, ARCH_A>;
452#[doc = "Architecture Identifier"]
453#[derive(Clone, Copy, Debug, PartialEq, Eq)]
454#[repr(u8)]
455pub enum ARCH_A {
456    #[doc = "60: SAM4E Series"]
457    SAM4E = 60,
458}
459impl From<ARCH_A> for u8 {
460    #[inline(always)]
461    fn from(variant: ARCH_A) -> Self {
462        variant as _
463    }
464}
465impl ARCH_R {
466    #[doc = "Get enumerated values variant"]
467    #[inline(always)]
468    pub fn variant(&self) -> Option<ARCH_A> {
469        match self.bits {
470            60 => Some(ARCH_A::SAM4E),
471            _ => None,
472        }
473    }
474    #[doc = "Checks if the value of the field is `SAM4E`"]
475    #[inline(always)]
476    pub fn is_sam4e(&self) -> bool {
477        *self == ARCH_A::SAM4E
478    }
479}
480#[doc = "Field `NVPTYP` reader - Nonvolatile Program Memory Type"]
481pub type NVPTYP_R = crate::FieldReader<u8, NVPTYP_A>;
482#[doc = "Nonvolatile Program Memory Type"]
483#[derive(Clone, Copy, Debug, PartialEq, Eq)]
484#[repr(u8)]
485pub enum NVPTYP_A {
486    #[doc = "0: ROM"]
487    ROM = 0,
488    #[doc = "1: ROMless or on-chip Flash"]
489    ROMLESS = 1,
490    #[doc = "2: Embedded Flash Memory"]
491    FLASH = 2,
492    #[doc = "3: ROM and Embedded Flash Memory- NVPSIZ is ROM size- NVPSIZ2 is Flash size"]
493    ROM_FLASH = 3,
494    #[doc = "4: SRAM emulating ROM"]
495    SRAM = 4,
496}
497impl From<NVPTYP_A> for u8 {
498    #[inline(always)]
499    fn from(variant: NVPTYP_A) -> Self {
500        variant as _
501    }
502}
503impl NVPTYP_R {
504    #[doc = "Get enumerated values variant"]
505    #[inline(always)]
506    pub fn variant(&self) -> Option<NVPTYP_A> {
507        match self.bits {
508            0 => Some(NVPTYP_A::ROM),
509            1 => Some(NVPTYP_A::ROMLESS),
510            2 => Some(NVPTYP_A::FLASH),
511            3 => Some(NVPTYP_A::ROM_FLASH),
512            4 => Some(NVPTYP_A::SRAM),
513            _ => None,
514        }
515    }
516    #[doc = "Checks if the value of the field is `ROM`"]
517    #[inline(always)]
518    pub fn is_rom(&self) -> bool {
519        *self == NVPTYP_A::ROM
520    }
521    #[doc = "Checks if the value of the field is `ROMLESS`"]
522    #[inline(always)]
523    pub fn is_romless(&self) -> bool {
524        *self == NVPTYP_A::ROMLESS
525    }
526    #[doc = "Checks if the value of the field is `FLASH`"]
527    #[inline(always)]
528    pub fn is_flash(&self) -> bool {
529        *self == NVPTYP_A::FLASH
530    }
531    #[doc = "Checks if the value of the field is `ROM_FLASH`"]
532    #[inline(always)]
533    pub fn is_rom_flash(&self) -> bool {
534        *self == NVPTYP_A::ROM_FLASH
535    }
536    #[doc = "Checks if the value of the field is `SRAM`"]
537    #[inline(always)]
538    pub fn is_sram(&self) -> bool {
539        *self == NVPTYP_A::SRAM
540    }
541}
542#[doc = "Field `EXT` reader - Extension Flag"]
543pub type EXT_R = crate::BitReader<bool>;
544impl R {
545    #[doc = "Bits 0:4 - Version of the Device"]
546    #[inline(always)]
547    pub fn version(&self) -> VERSION_R {
548        VERSION_R::new((self.bits & 0x1f) as u8)
549    }
550    #[doc = "Bits 5:7 - Embedded Processor"]
551    #[inline(always)]
552    pub fn eproc(&self) -> EPROC_R {
553        EPROC_R::new(((self.bits >> 5) & 7) as u8)
554    }
555    #[doc = "Bits 8:11 - Nonvolatile Program Memory Size"]
556    #[inline(always)]
557    pub fn nvpsiz(&self) -> NVPSIZ_R {
558        NVPSIZ_R::new(((self.bits >> 8) & 0x0f) as u8)
559    }
560    #[doc = "Bits 12:15 - Second Nonvolatile Program Memory Size"]
561    #[inline(always)]
562    pub fn nvpsiz2(&self) -> NVPSIZ2_R {
563        NVPSIZ2_R::new(((self.bits >> 12) & 0x0f) as u8)
564    }
565    #[doc = "Bits 16:19 - Internal SRAM Size"]
566    #[inline(always)]
567    pub fn sramsiz(&self) -> SRAMSIZ_R {
568        SRAMSIZ_R::new(((self.bits >> 16) & 0x0f) as u8)
569    }
570    #[doc = "Bits 20:27 - Architecture Identifier"]
571    #[inline(always)]
572    pub fn arch(&self) -> ARCH_R {
573        ARCH_R::new(((self.bits >> 20) & 0xff) as u8)
574    }
575    #[doc = "Bits 28:30 - Nonvolatile Program Memory Type"]
576    #[inline(always)]
577    pub fn nvptyp(&self) -> NVPTYP_R {
578        NVPTYP_R::new(((self.bits >> 28) & 7) as u8)
579    }
580    #[doc = "Bit 31 - Extension Flag"]
581    #[inline(always)]
582    pub fn ext(&self) -> EXT_R {
583        EXT_R::new(((self.bits >> 31) & 1) != 0)
584    }
585}
586#[doc = "Chip ID Register\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [cidr](index.html) module"]
587pub struct CIDR_SPEC;
588impl crate::RegisterSpec for CIDR_SPEC {
589    type Ux = u32;
590}
591#[doc = "`read()` method returns [cidr::R](R) reader structure"]
592impl crate::Readable for CIDR_SPEC {
593    type Reader = R;
594}