xmc4500/ppb/
cpuid.rs

1#[doc = "Register `CPUID` reader"]
2pub type R = crate::R<CPUID_SPEC>;
3#[doc = "Revision number\n\nValue on reset: 1"]
4#[derive(Clone, Copy, Debug, PartialEq, Eq)]
5#[repr(u8)]
6pub enum REVISION_A {
7    #[doc = "1: Patch 1"]
8    VALUE1 = 1,
9}
10impl From<REVISION_A> for u8 {
11    #[inline(always)]
12    fn from(variant: REVISION_A) -> Self {
13        variant as _
14    }
15}
16impl crate::FieldSpec for REVISION_A {
17    type Ux = u8;
18}
19impl crate::IsEnum for REVISION_A {}
20#[doc = "Field `Revision` reader - Revision number"]
21pub type REVISION_R = crate::FieldReader<REVISION_A>;
22impl REVISION_R {
23    #[doc = "Get enumerated values variant"]
24    #[inline(always)]
25    pub const fn variant(&self) -> Option<REVISION_A> {
26        match self.bits {
27            1 => Some(REVISION_A::VALUE1),
28            _ => None,
29        }
30    }
31    #[doc = "Patch 1"]
32    #[inline(always)]
33    pub fn is_value1(&self) -> bool {
34        *self == REVISION_A::VALUE1
35    }
36}
37#[doc = "Part number of the processor\n\nValue on reset: 3108"]
38#[derive(Clone, Copy, Debug, PartialEq, Eq)]
39#[repr(u16)]
40pub enum PART_NO_A {
41    #[doc = "3108: Cortex-M4"]
42    VALUE1 = 3108,
43}
44impl From<PART_NO_A> for u16 {
45    #[inline(always)]
46    fn from(variant: PART_NO_A) -> Self {
47        variant as _
48    }
49}
50impl crate::FieldSpec for PART_NO_A {
51    type Ux = u16;
52}
53impl crate::IsEnum for PART_NO_A {}
54#[doc = "Field `PartNo` reader - Part number of the processor"]
55pub type PART_NO_R = crate::FieldReader<PART_NO_A>;
56impl PART_NO_R {
57    #[doc = "Get enumerated values variant"]
58    #[inline(always)]
59    pub const fn variant(&self) -> Option<PART_NO_A> {
60        match self.bits {
61            3108 => Some(PART_NO_A::VALUE1),
62            _ => None,
63        }
64    }
65    #[doc = "Cortex-M4"]
66    #[inline(always)]
67    pub fn is_value1(&self) -> bool {
68        *self == PART_NO_A::VALUE1
69    }
70}
71#[doc = "Field `Constant` reader - Reads as 0xF"]
72pub type CONSTANT_R = crate::FieldReader;
73#[doc = "Variant number\n\nValue on reset: 0"]
74#[derive(Clone, Copy, Debug, PartialEq, Eq)]
75#[repr(u8)]
76pub enum VARIANT_A {
77    #[doc = "0: Revision 0"]
78    VALUE1 = 0,
79}
80impl From<VARIANT_A> for u8 {
81    #[inline(always)]
82    fn from(variant: VARIANT_A) -> Self {
83        variant as _
84    }
85}
86impl crate::FieldSpec for VARIANT_A {
87    type Ux = u8;
88}
89impl crate::IsEnum for VARIANT_A {}
90#[doc = "Field `Variant` reader - Variant number"]
91pub type VARIANT_R = crate::FieldReader<VARIANT_A>;
92impl VARIANT_R {
93    #[doc = "Get enumerated values variant"]
94    #[inline(always)]
95    pub const fn variant(&self) -> Option<VARIANT_A> {
96        match self.bits {
97            0 => Some(VARIANT_A::VALUE1),
98            _ => None,
99        }
100    }
101    #[doc = "Revision 0"]
102    #[inline(always)]
103    pub fn is_value1(&self) -> bool {
104        *self == VARIANT_A::VALUE1
105    }
106}
107#[doc = "Implementer code\n\nValue on reset: 65"]
108#[derive(Clone, Copy, Debug, PartialEq, Eq)]
109#[repr(u8)]
110pub enum IMPLEMENTER_A {
111    #[doc = "65: ARM"]
112    VALUE1 = 65,
113}
114impl From<IMPLEMENTER_A> for u8 {
115    #[inline(always)]
116    fn from(variant: IMPLEMENTER_A) -> Self {
117        variant as _
118    }
119}
120impl crate::FieldSpec for IMPLEMENTER_A {
121    type Ux = u8;
122}
123impl crate::IsEnum for IMPLEMENTER_A {}
124#[doc = "Field `Implementer` reader - Implementer code"]
125pub type IMPLEMENTER_R = crate::FieldReader<IMPLEMENTER_A>;
126impl IMPLEMENTER_R {
127    #[doc = "Get enumerated values variant"]
128    #[inline(always)]
129    pub const fn variant(&self) -> Option<IMPLEMENTER_A> {
130        match self.bits {
131            65 => Some(IMPLEMENTER_A::VALUE1),
132            _ => None,
133        }
134    }
135    #[doc = "ARM"]
136    #[inline(always)]
137    pub fn is_value1(&self) -> bool {
138        *self == IMPLEMENTER_A::VALUE1
139    }
140}
141impl R {
142    #[doc = "Bits 0:3 - Revision number"]
143    #[inline(always)]
144    pub fn revision(&self) -> REVISION_R {
145        REVISION_R::new((self.bits & 0x0f) as u8)
146    }
147    #[doc = "Bits 4:15 - Part number of the processor"]
148    #[inline(always)]
149    pub fn part_no(&self) -> PART_NO_R {
150        PART_NO_R::new(((self.bits >> 4) & 0x0fff) as u16)
151    }
152    #[doc = "Bits 16:19 - Reads as 0xF"]
153    #[inline(always)]
154    pub fn constant(&self) -> CONSTANT_R {
155        CONSTANT_R::new(((self.bits >> 16) & 0x0f) as u8)
156    }
157    #[doc = "Bits 20:23 - Variant number"]
158    #[inline(always)]
159    pub fn variant(&self) -> VARIANT_R {
160        VARIANT_R::new(((self.bits >> 20) & 0x0f) as u8)
161    }
162    #[doc = "Bits 24:31 - Implementer code"]
163    #[inline(always)]
164    pub fn implementer(&self) -> IMPLEMENTER_R {
165        IMPLEMENTER_R::new(((self.bits >> 24) & 0xff) as u8)
166    }
167}
168#[doc = "CPUID Base Register\n\nYou can [`read`](crate::Reg::read) this register and get [`cpuid::R`](R). See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
169pub struct CPUID_SPEC;
170impl crate::RegisterSpec for CPUID_SPEC {
171    type Ux = u32;
172}
173#[doc = "`read()` method returns [`cpuid::R`](R) reader structure"]
174impl crate::Readable for CPUID_SPEC {}
175#[doc = "`reset()` method sets CPUID to value 0x410f_c241"]
176impl crate::Resettable for CPUID_SPEC {
177    const RESET_VALUE: u32 = 0x410f_c241;
178}