atsamd51p20a/cmcc/
type_.rs

1#[doc = "Reader of register TYPE"]
2pub type R = crate::R<u32, super::TYPE>;
3#[doc = "Reader of field `GCLK`"]
4pub type GCLK_R = crate::R<bool, bool>;
5#[doc = "Reader of field `RRP`"]
6pub type RRP_R = crate::R<bool, bool>;
7#[doc = "Number of Way\n\nValue on reset: 2"]
8#[derive(Clone, Copy, Debug, PartialEq)]
9#[repr(u8)]
10pub enum WAYNUM_A {
11    #[doc = "0: Direct Mapped Cache"]
12    DMAPPED = 0,
13    #[doc = "1: 2-WAY set associative"]
14    ARCH2WAY = 1,
15    #[doc = "2: 4-WAY set associative"]
16    ARCH4WAY = 2,
17}
18impl From<WAYNUM_A> for u8 {
19    #[inline(always)]
20    fn from(variant: WAYNUM_A) -> Self {
21        variant as _
22    }
23}
24#[doc = "Reader of field `WAYNUM`"]
25pub type WAYNUM_R = crate::R<u8, WAYNUM_A>;
26impl WAYNUM_R {
27    #[doc = r"Get enumerated values variant"]
28    #[inline(always)]
29    pub fn variant(&self) -> crate::Variant<u8, WAYNUM_A> {
30        use crate::Variant::*;
31        match self.bits {
32            0 => Val(WAYNUM_A::DMAPPED),
33            1 => Val(WAYNUM_A::ARCH2WAY),
34            2 => Val(WAYNUM_A::ARCH4WAY),
35            i => Res(i),
36        }
37    }
38    #[doc = "Checks if the value of the field is `DMAPPED`"]
39    #[inline(always)]
40    pub fn is_dmapped(&self) -> bool {
41        *self == WAYNUM_A::DMAPPED
42    }
43    #[doc = "Checks if the value of the field is `ARCH2WAY`"]
44    #[inline(always)]
45    pub fn is_arch2way(&self) -> bool {
46        *self == WAYNUM_A::ARCH2WAY
47    }
48    #[doc = "Checks if the value of the field is `ARCH4WAY`"]
49    #[inline(always)]
50    pub fn is_arch4way(&self) -> bool {
51        *self == WAYNUM_A::ARCH4WAY
52    }
53}
54#[doc = "Reader of field `LCKDOWN`"]
55pub type LCKDOWN_R = crate::R<bool, bool>;
56#[doc = "Cache Size\n\nValue on reset: 2"]
57#[derive(Clone, Copy, Debug, PartialEq)]
58#[repr(u8)]
59pub enum CSIZE_A {
60    #[doc = "0: Cache Size is 1 KB"]
61    CSIZE_1KB = 0,
62    #[doc = "1: Cache Size is 2 KB"]
63    CSIZE_2KB = 1,
64    #[doc = "2: Cache Size is 4 KB"]
65    CSIZE_4KB = 2,
66    #[doc = "3: Cache Size is 8 KB"]
67    CSIZE_8KB = 3,
68    #[doc = "4: Cache Size is 16 KB"]
69    CSIZE_16KB = 4,
70    #[doc = "5: Cache Size is 32 KB"]
71    CSIZE_32KB = 5,
72    #[doc = "6: Cache Size is 64 KB"]
73    CSIZE_64KB = 6,
74}
75impl From<CSIZE_A> for u8 {
76    #[inline(always)]
77    fn from(variant: CSIZE_A) -> Self {
78        variant as _
79    }
80}
81#[doc = "Reader of field `CSIZE`"]
82pub type CSIZE_R = crate::R<u8, CSIZE_A>;
83impl CSIZE_R {
84    #[doc = r"Get enumerated values variant"]
85    #[inline(always)]
86    pub fn variant(&self) -> crate::Variant<u8, CSIZE_A> {
87        use crate::Variant::*;
88        match self.bits {
89            0 => Val(CSIZE_A::CSIZE_1KB),
90            1 => Val(CSIZE_A::CSIZE_2KB),
91            2 => Val(CSIZE_A::CSIZE_4KB),
92            3 => Val(CSIZE_A::CSIZE_8KB),
93            4 => Val(CSIZE_A::CSIZE_16KB),
94            5 => Val(CSIZE_A::CSIZE_32KB),
95            6 => Val(CSIZE_A::CSIZE_64KB),
96            i => Res(i),
97        }
98    }
99    #[doc = "Checks if the value of the field is `CSIZE_1KB`"]
100    #[inline(always)]
101    pub fn is_csize_1kb(&self) -> bool {
102        *self == CSIZE_A::CSIZE_1KB
103    }
104    #[doc = "Checks if the value of the field is `CSIZE_2KB`"]
105    #[inline(always)]
106    pub fn is_csize_2kb(&self) -> bool {
107        *self == CSIZE_A::CSIZE_2KB
108    }
109    #[doc = "Checks if the value of the field is `CSIZE_4KB`"]
110    #[inline(always)]
111    pub fn is_csize_4kb(&self) -> bool {
112        *self == CSIZE_A::CSIZE_4KB
113    }
114    #[doc = "Checks if the value of the field is `CSIZE_8KB`"]
115    #[inline(always)]
116    pub fn is_csize_8kb(&self) -> bool {
117        *self == CSIZE_A::CSIZE_8KB
118    }
119    #[doc = "Checks if the value of the field is `CSIZE_16KB`"]
120    #[inline(always)]
121    pub fn is_csize_16kb(&self) -> bool {
122        *self == CSIZE_A::CSIZE_16KB
123    }
124    #[doc = "Checks if the value of the field is `CSIZE_32KB`"]
125    #[inline(always)]
126    pub fn is_csize_32kb(&self) -> bool {
127        *self == CSIZE_A::CSIZE_32KB
128    }
129    #[doc = "Checks if the value of the field is `CSIZE_64KB`"]
130    #[inline(always)]
131    pub fn is_csize_64kb(&self) -> bool {
132        *self == CSIZE_A::CSIZE_64KB
133    }
134}
135#[doc = "Cache Line Size\n\nValue on reset: 2"]
136#[derive(Clone, Copy, Debug, PartialEq)]
137#[repr(u8)]
138pub enum CLSIZE_A {
139    #[doc = "0: Cache Line Size is 4 bytes"]
140    CLSIZE_4B = 0,
141    #[doc = "1: Cache Line Size is 8 bytes"]
142    CLSIZE_8B = 1,
143    #[doc = "2: Cache Line Size is 16 bytes"]
144    CLSIZE_16B = 2,
145    #[doc = "3: Cache Line Size is 32 bytes"]
146    CLSIZE_32B = 3,
147    #[doc = "4: Cache Line Size is 64 bytes"]
148    CLSIZE_64B = 4,
149    #[doc = "5: Cache Line Size is 128 bytes"]
150    CLSIZE_128B = 5,
151}
152impl From<CLSIZE_A> for u8 {
153    #[inline(always)]
154    fn from(variant: CLSIZE_A) -> Self {
155        variant as _
156    }
157}
158#[doc = "Reader of field `CLSIZE`"]
159pub type CLSIZE_R = crate::R<u8, CLSIZE_A>;
160impl CLSIZE_R {
161    #[doc = r"Get enumerated values variant"]
162    #[inline(always)]
163    pub fn variant(&self) -> crate::Variant<u8, CLSIZE_A> {
164        use crate::Variant::*;
165        match self.bits {
166            0 => Val(CLSIZE_A::CLSIZE_4B),
167            1 => Val(CLSIZE_A::CLSIZE_8B),
168            2 => Val(CLSIZE_A::CLSIZE_16B),
169            3 => Val(CLSIZE_A::CLSIZE_32B),
170            4 => Val(CLSIZE_A::CLSIZE_64B),
171            5 => Val(CLSIZE_A::CLSIZE_128B),
172            i => Res(i),
173        }
174    }
175    #[doc = "Checks if the value of the field is `CLSIZE_4B`"]
176    #[inline(always)]
177    pub fn is_clsize_4b(&self) -> bool {
178        *self == CLSIZE_A::CLSIZE_4B
179    }
180    #[doc = "Checks if the value of the field is `CLSIZE_8B`"]
181    #[inline(always)]
182    pub fn is_clsize_8b(&self) -> bool {
183        *self == CLSIZE_A::CLSIZE_8B
184    }
185    #[doc = "Checks if the value of the field is `CLSIZE_16B`"]
186    #[inline(always)]
187    pub fn is_clsize_16b(&self) -> bool {
188        *self == CLSIZE_A::CLSIZE_16B
189    }
190    #[doc = "Checks if the value of the field is `CLSIZE_32B`"]
191    #[inline(always)]
192    pub fn is_clsize_32b(&self) -> bool {
193        *self == CLSIZE_A::CLSIZE_32B
194    }
195    #[doc = "Checks if the value of the field is `CLSIZE_64B`"]
196    #[inline(always)]
197    pub fn is_clsize_64b(&self) -> bool {
198        *self == CLSIZE_A::CLSIZE_64B
199    }
200    #[doc = "Checks if the value of the field is `CLSIZE_128B`"]
201    #[inline(always)]
202    pub fn is_clsize_128b(&self) -> bool {
203        *self == CLSIZE_A::CLSIZE_128B
204    }
205}
206impl R {
207    #[doc = "Bit 1 - dynamic Clock Gating supported"]
208    #[inline(always)]
209    pub fn gclk(&self) -> GCLK_R {
210        GCLK_R::new(((self.bits >> 1) & 0x01) != 0)
211    }
212    #[doc = "Bit 4 - Round Robin Policy supported"]
213    #[inline(always)]
214    pub fn rrp(&self) -> RRP_R {
215        RRP_R::new(((self.bits >> 4) & 0x01) != 0)
216    }
217    #[doc = "Bits 5:6 - Number of Way"]
218    #[inline(always)]
219    pub fn waynum(&self) -> WAYNUM_R {
220        WAYNUM_R::new(((self.bits >> 5) & 0x03) as u8)
221    }
222    #[doc = "Bit 7 - Lock Down supported"]
223    #[inline(always)]
224    pub fn lckdown(&self) -> LCKDOWN_R {
225        LCKDOWN_R::new(((self.bits >> 7) & 0x01) != 0)
226    }
227    #[doc = "Bits 8:10 - Cache Size"]
228    #[inline(always)]
229    pub fn csize(&self) -> CSIZE_R {
230        CSIZE_R::new(((self.bits >> 8) & 0x07) as u8)
231    }
232    #[doc = "Bits 11:13 - Cache Line Size"]
233    #[inline(always)]
234    pub fn clsize(&self) -> CLSIZE_R {
235        CLSIZE_R::new(((self.bits >> 11) & 0x07) as u8)
236    }
237}