efm32gg12b830_pac/sdio/
blksize.rs1#[doc = "Register `BLKSIZE` reader"]
2pub struct R(crate::R<BLKSIZE_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<BLKSIZE_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<BLKSIZE_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<BLKSIZE_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `BLKSIZE` writer"]
17pub struct W(crate::W<BLKSIZE_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<BLKSIZE_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<BLKSIZE_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<BLKSIZE_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Transfer Block Size, Specifies the Block Size for Block Data Transfers for CMD17, CMD18, CMD24, CMD25, and CMD53\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39#[repr(u16)]
40pub enum TFRBLKSIZE_A {
41 #[doc = "0: `0`"]
42 NOXFER = 0,
43}
44impl From<TFRBLKSIZE_A> for u16 {
45 #[inline(always)]
46 fn from(variant: TFRBLKSIZE_A) -> Self {
47 variant as _
48 }
49}
50#[doc = "Field `TFRBLKSIZE` reader - Transfer Block Size, Specifies the Block Size for Block Data Transfers for CMD17, CMD18, CMD24, CMD25, and CMD53"]
51pub type TFRBLKSIZE_R = crate::FieldReader<u16, TFRBLKSIZE_A>;
52impl TFRBLKSIZE_R {
53 #[doc = "Get enumerated values variant"]
54 #[inline(always)]
55 pub fn variant(&self) -> Option<TFRBLKSIZE_A> {
56 match self.bits {
57 0 => Some(TFRBLKSIZE_A::NOXFER),
58 _ => None,
59 }
60 }
61 #[doc = "Checks if the value of the field is `NOXFER`"]
62 #[inline(always)]
63 pub fn is_noxfer(&self) -> bool {
64 *self == TFRBLKSIZE_A::NOXFER
65 }
66}
67#[doc = "Field `TFRBLKSIZE` writer - Transfer Block Size, Specifies the Block Size for Block Data Transfers for CMD17, CMD18, CMD24, CMD25, and CMD53"]
68pub type TFRBLKSIZE_W<'a> = crate::FieldWriter<'a, u32, BLKSIZE_SPEC, u16, TFRBLKSIZE_A, 12, 0>;
69impl<'a> TFRBLKSIZE_W<'a> {
70 #[doc = "`0`"]
71 #[inline(always)]
72 pub fn noxfer(self) -> &'a mut W {
73 self.variant(TFRBLKSIZE_A::NOXFER)
74 }
75}
76#[doc = "Host SDMA Buffer Size\n\nValue on reset: 0"]
77#[derive(Clone, Copy, Debug, PartialEq)]
78#[repr(u8)]
79pub enum HSTSDMABUFSIZE_A {
80 #[doc = "0: 4KB(Detects A11 Carry out)"]
81 SIZE4 = 0,
82 #[doc = "1: 8KB(Detects A12 Carry out)"]
83 SIZE8 = 1,
84 #[doc = "2: 16KB(Detects A13 Carry out)"]
85 SIZE16 = 2,
86 #[doc = "3: 32KB(Detects A14 Carry out)"]
87 SIZE32 = 3,
88 #[doc = "4: 64KB(Detects A15 Carry out)"]
89 SIZE64 = 4,
90 #[doc = "5: 128KB(Detects A16 Carry out)"]
91 SIZE128 = 5,
92 #[doc = "6: 256KB(Detects A17 Carry out)"]
93 SIZE256 = 6,
94 #[doc = "7: 512KB(Detects A18 Carry out)"]
95 SIZE512 = 7,
96}
97impl From<HSTSDMABUFSIZE_A> for u8 {
98 #[inline(always)]
99 fn from(variant: HSTSDMABUFSIZE_A) -> Self {
100 variant as _
101 }
102}
103#[doc = "Field `HSTSDMABUFSIZE` reader - Host SDMA Buffer Size"]
104pub type HSTSDMABUFSIZE_R = crate::FieldReader<u8, HSTSDMABUFSIZE_A>;
105impl HSTSDMABUFSIZE_R {
106 #[doc = "Get enumerated values variant"]
107 #[inline(always)]
108 pub fn variant(&self) -> HSTSDMABUFSIZE_A {
109 match self.bits {
110 0 => HSTSDMABUFSIZE_A::SIZE4,
111 1 => HSTSDMABUFSIZE_A::SIZE8,
112 2 => HSTSDMABUFSIZE_A::SIZE16,
113 3 => HSTSDMABUFSIZE_A::SIZE32,
114 4 => HSTSDMABUFSIZE_A::SIZE64,
115 5 => HSTSDMABUFSIZE_A::SIZE128,
116 6 => HSTSDMABUFSIZE_A::SIZE256,
117 7 => HSTSDMABUFSIZE_A::SIZE512,
118 _ => unreachable!(),
119 }
120 }
121 #[doc = "Checks if the value of the field is `SIZE4`"]
122 #[inline(always)]
123 pub fn is_size4(&self) -> bool {
124 *self == HSTSDMABUFSIZE_A::SIZE4
125 }
126 #[doc = "Checks if the value of the field is `SIZE8`"]
127 #[inline(always)]
128 pub fn is_size8(&self) -> bool {
129 *self == HSTSDMABUFSIZE_A::SIZE8
130 }
131 #[doc = "Checks if the value of the field is `SIZE16`"]
132 #[inline(always)]
133 pub fn is_size16(&self) -> bool {
134 *self == HSTSDMABUFSIZE_A::SIZE16
135 }
136 #[doc = "Checks if the value of the field is `SIZE32`"]
137 #[inline(always)]
138 pub fn is_size32(&self) -> bool {
139 *self == HSTSDMABUFSIZE_A::SIZE32
140 }
141 #[doc = "Checks if the value of the field is `SIZE64`"]
142 #[inline(always)]
143 pub fn is_size64(&self) -> bool {
144 *self == HSTSDMABUFSIZE_A::SIZE64
145 }
146 #[doc = "Checks if the value of the field is `SIZE128`"]
147 #[inline(always)]
148 pub fn is_size128(&self) -> bool {
149 *self == HSTSDMABUFSIZE_A::SIZE128
150 }
151 #[doc = "Checks if the value of the field is `SIZE256`"]
152 #[inline(always)]
153 pub fn is_size256(&self) -> bool {
154 *self == HSTSDMABUFSIZE_A::SIZE256
155 }
156 #[doc = "Checks if the value of the field is `SIZE512`"]
157 #[inline(always)]
158 pub fn is_size512(&self) -> bool {
159 *self == HSTSDMABUFSIZE_A::SIZE512
160 }
161}
162#[doc = "Field `HSTSDMABUFSIZE` writer - Host SDMA Buffer Size"]
163pub type HSTSDMABUFSIZE_W<'a> =
164 crate::FieldWriterSafe<'a, u32, BLKSIZE_SPEC, u8, HSTSDMABUFSIZE_A, 3, 12>;
165impl<'a> HSTSDMABUFSIZE_W<'a> {
166 #[doc = "4KB(Detects A11 Carry out)"]
167 #[inline(always)]
168 pub fn size4(self) -> &'a mut W {
169 self.variant(HSTSDMABUFSIZE_A::SIZE4)
170 }
171 #[doc = "8KB(Detects A12 Carry out)"]
172 #[inline(always)]
173 pub fn size8(self) -> &'a mut W {
174 self.variant(HSTSDMABUFSIZE_A::SIZE8)
175 }
176 #[doc = "16KB(Detects A13 Carry out)"]
177 #[inline(always)]
178 pub fn size16(self) -> &'a mut W {
179 self.variant(HSTSDMABUFSIZE_A::SIZE16)
180 }
181 #[doc = "32KB(Detects A14 Carry out)"]
182 #[inline(always)]
183 pub fn size32(self) -> &'a mut W {
184 self.variant(HSTSDMABUFSIZE_A::SIZE32)
185 }
186 #[doc = "64KB(Detects A15 Carry out)"]
187 #[inline(always)]
188 pub fn size64(self) -> &'a mut W {
189 self.variant(HSTSDMABUFSIZE_A::SIZE64)
190 }
191 #[doc = "128KB(Detects A16 Carry out)"]
192 #[inline(always)]
193 pub fn size128(self) -> &'a mut W {
194 self.variant(HSTSDMABUFSIZE_A::SIZE128)
195 }
196 #[doc = "256KB(Detects A17 Carry out)"]
197 #[inline(always)]
198 pub fn size256(self) -> &'a mut W {
199 self.variant(HSTSDMABUFSIZE_A::SIZE256)
200 }
201 #[doc = "512KB(Detects A18 Carry out)"]
202 #[inline(always)]
203 pub fn size512(self) -> &'a mut W {
204 self.variant(HSTSDMABUFSIZE_A::SIZE512)
205 }
206}
207#[doc = "Blocks Count for Current Transfer\n\nValue on reset: 0"]
208#[derive(Clone, Copy, Debug, PartialEq)]
209#[repr(u16)]
210pub enum BLKSCNTFORCURRTFR_A {
211 #[doc = "0: `0`"]
212 STOPCNT = 0,
213}
214impl From<BLKSCNTFORCURRTFR_A> for u16 {
215 #[inline(always)]
216 fn from(variant: BLKSCNTFORCURRTFR_A) -> Self {
217 variant as _
218 }
219}
220#[doc = "Field `BLKSCNTFORCURRTFR` reader - Blocks Count for Current Transfer"]
221pub type BLKSCNTFORCURRTFR_R = crate::FieldReader<u16, BLKSCNTFORCURRTFR_A>;
222impl BLKSCNTFORCURRTFR_R {
223 #[doc = "Get enumerated values variant"]
224 #[inline(always)]
225 pub fn variant(&self) -> Option<BLKSCNTFORCURRTFR_A> {
226 match self.bits {
227 0 => Some(BLKSCNTFORCURRTFR_A::STOPCNT),
228 _ => None,
229 }
230 }
231 #[doc = "Checks if the value of the field is `STOPCNT`"]
232 #[inline(always)]
233 pub fn is_stopcnt(&self) -> bool {
234 *self == BLKSCNTFORCURRTFR_A::STOPCNT
235 }
236}
237#[doc = "Field `BLKSCNTFORCURRTFR` writer - Blocks Count for Current Transfer"]
238pub type BLKSCNTFORCURRTFR_W<'a> =
239 crate::FieldWriter<'a, u32, BLKSIZE_SPEC, u16, BLKSCNTFORCURRTFR_A, 16, 16>;
240impl<'a> BLKSCNTFORCURRTFR_W<'a> {
241 #[doc = "`0`"]
242 #[inline(always)]
243 pub fn stopcnt(self) -> &'a mut W {
244 self.variant(BLKSCNTFORCURRTFR_A::STOPCNT)
245 }
246}
247impl R {
248 #[doc = "Bits 0:11 - Transfer Block Size, Specifies the Block Size for Block Data Transfers for CMD17, CMD18, CMD24, CMD25, and CMD53"]
249 #[inline(always)]
250 pub fn tfrblksize(&self) -> TFRBLKSIZE_R {
251 TFRBLKSIZE_R::new((self.bits & 0x0fff) as u16)
252 }
253 #[doc = "Bits 12:14 - Host SDMA Buffer Size"]
254 #[inline(always)]
255 pub fn hstsdmabufsize(&self) -> HSTSDMABUFSIZE_R {
256 HSTSDMABUFSIZE_R::new(((self.bits >> 12) & 7) as u8)
257 }
258 #[doc = "Bits 16:31 - Blocks Count for Current Transfer"]
259 #[inline(always)]
260 pub fn blkscntforcurrtfr(&self) -> BLKSCNTFORCURRTFR_R {
261 BLKSCNTFORCURRTFR_R::new(((self.bits >> 16) & 0xffff) as u16)
262 }
263}
264impl W {
265 #[doc = "Bits 0:11 - Transfer Block Size, Specifies the Block Size for Block Data Transfers for CMD17, CMD18, CMD24, CMD25, and CMD53"]
266 #[inline(always)]
267 pub fn tfrblksize(&mut self) -> TFRBLKSIZE_W {
268 TFRBLKSIZE_W::new(self)
269 }
270 #[doc = "Bits 12:14 - Host SDMA Buffer Size"]
271 #[inline(always)]
272 pub fn hstsdmabufsize(&mut self) -> HSTSDMABUFSIZE_W {
273 HSTSDMABUFSIZE_W::new(self)
274 }
275 #[doc = "Bits 16:31 - Blocks Count for Current Transfer"]
276 #[inline(always)]
277 pub fn blkscntforcurrtfr(&mut self) -> BLKSCNTFORCURRTFR_W {
278 BLKSCNTFORCURRTFR_W::new(self)
279 }
280 #[doc = "Writes raw bits to the register."]
281 #[inline(always)]
282 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
283 self.0.bits(bits);
284 self
285 }
286}
287#[doc = "Block Size and Block Count Register\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 [blksize](index.html) module"]
288pub struct BLKSIZE_SPEC;
289impl crate::RegisterSpec for BLKSIZE_SPEC {
290 type Ux = u32;
291}
292#[doc = "`read()` method returns [blksize::R](R) reader structure"]
293impl crate::Readable for BLKSIZE_SPEC {
294 type Reader = R;
295}
296#[doc = "`write(|w| ..)` method takes [blksize::W](W) writer structure"]
297impl crate::Writable for BLKSIZE_SPEC {
298 type Writer = W;
299}
300#[doc = "`reset()` method sets BLKSIZE to value 0"]
301impl crate::Resettable for BLKSIZE_SPEC {
302 #[inline(always)]
303 fn reset_value() -> Self::Ux {
304 0
305 }
306}