1#[doc = "Register `TFRMODE` reader"]
2pub struct R(crate::R<TFRMODE_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<TFRMODE_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<TFRMODE_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<TFRMODE_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `TFRMODE` writer"]
17pub struct W(crate::W<TFRMODE_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<TFRMODE_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<TFRMODE_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<TFRMODE_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `DMAEN` reader - DMA Enable"]
38pub type DMAEN_R = crate::BitReader<bool>;
39#[doc = "Field `DMAEN` writer - DMA Enable"]
40pub type DMAEN_W<'a> = crate::BitWriter<'a, u32, TFRMODE_SPEC, bool, 0>;
41#[doc = "Field `BLKCNTEN` reader - Block Count Enable"]
42pub type BLKCNTEN_R = crate::BitReader<bool>;
43#[doc = "Field `BLKCNTEN` writer - Block Count Enable"]
44pub type BLKCNTEN_W<'a> = crate::BitWriter<'a, u32, TFRMODE_SPEC, bool, 1>;
45#[doc = "Auto Command Enable\n\nValue on reset: 0"]
46#[derive(Clone, Copy, Debug, PartialEq)]
47#[repr(u8)]
48pub enum AUTOCMDEN_A {
49 #[doc = "0: Auto CMD Disabled"]
50 ACMDDISABLED = 0,
51 #[doc = "1: Auto CMD12 Enable"]
52 ACMD12EN = 1,
53 #[doc = "2: Auto CMD23 Enable"]
54 ACMD23EN = 2,
55}
56impl From<AUTOCMDEN_A> for u8 {
57 #[inline(always)]
58 fn from(variant: AUTOCMDEN_A) -> Self {
59 variant as _
60 }
61}
62#[doc = "Field `AUTOCMDEN` reader - Auto Command Enable"]
63pub type AUTOCMDEN_R = crate::FieldReader<u8, AUTOCMDEN_A>;
64impl AUTOCMDEN_R {
65 #[doc = "Get enumerated values variant"]
66 #[inline(always)]
67 pub fn variant(&self) -> Option<AUTOCMDEN_A> {
68 match self.bits {
69 0 => Some(AUTOCMDEN_A::ACMDDISABLED),
70 1 => Some(AUTOCMDEN_A::ACMD12EN),
71 2 => Some(AUTOCMDEN_A::ACMD23EN),
72 _ => None,
73 }
74 }
75 #[doc = "Checks if the value of the field is `ACMDDISABLED`"]
76 #[inline(always)]
77 pub fn is_acmddisabled(&self) -> bool {
78 *self == AUTOCMDEN_A::ACMDDISABLED
79 }
80 #[doc = "Checks if the value of the field is `ACMD12EN`"]
81 #[inline(always)]
82 pub fn is_acmd12en(&self) -> bool {
83 *self == AUTOCMDEN_A::ACMD12EN
84 }
85 #[doc = "Checks if the value of the field is `ACMD23EN`"]
86 #[inline(always)]
87 pub fn is_acmd23en(&self) -> bool {
88 *self == AUTOCMDEN_A::ACMD23EN
89 }
90}
91#[doc = "Field `AUTOCMDEN` writer - Auto Command Enable"]
92pub type AUTOCMDEN_W<'a> = crate::FieldWriter<'a, u32, TFRMODE_SPEC, u8, AUTOCMDEN_A, 2, 2>;
93impl<'a> AUTOCMDEN_W<'a> {
94 #[doc = "Auto CMD Disabled"]
95 #[inline(always)]
96 pub fn acmddisabled(self) -> &'a mut W {
97 self.variant(AUTOCMDEN_A::ACMDDISABLED)
98 }
99 #[doc = "Auto CMD12 Enable"]
100 #[inline(always)]
101 pub fn acmd12en(self) -> &'a mut W {
102 self.variant(AUTOCMDEN_A::ACMD12EN)
103 }
104 #[doc = "Auto CMD23 Enable"]
105 #[inline(always)]
106 pub fn acmd23en(self) -> &'a mut W {
107 self.variant(AUTOCMDEN_A::ACMD23EN)
108 }
109}
110#[doc = "Field `DATDIRSEL` reader - Data Transfer Direction Select"]
111pub type DATDIRSEL_R = crate::BitReader<bool>;
112#[doc = "Field `DATDIRSEL` writer - Data Transfer Direction Select"]
113pub type DATDIRSEL_W<'a> = crate::BitWriter<'a, u32, TFRMODE_SPEC, bool, 4>;
114#[doc = "Field `MULTSINGBLKSEL` reader - Multiple or Single Block Data Transfer Selection"]
115pub type MULTSINGBLKSEL_R = crate::BitReader<bool>;
116#[doc = "Field `MULTSINGBLKSEL` writer - Multiple or Single Block Data Transfer Selection"]
117pub type MULTSINGBLKSEL_W<'a> = crate::BitWriter<'a, u32, TFRMODE_SPEC, bool, 5>;
118#[doc = "Response Type Select\n\nValue on reset: 0"]
119#[derive(Clone, Copy, Debug, PartialEq)]
120#[repr(u8)]
121pub enum RESPTYPESEL_A {
122 #[doc = "0: No RESP"]
123 NORESP = 0,
124 #[doc = "1: RESP Length 136"]
125 RESP136 = 1,
126 #[doc = "2: RESP Length 48"]
127 RESP48 = 2,
128 #[doc = "3: RESP Length 48 check busy after RESP"]
129 BUSYAFTRESP = 3,
130}
131impl From<RESPTYPESEL_A> for u8 {
132 #[inline(always)]
133 fn from(variant: RESPTYPESEL_A) -> Self {
134 variant as _
135 }
136}
137#[doc = "Field `RESPTYPESEL` reader - Response Type Select"]
138pub type RESPTYPESEL_R = crate::FieldReader<u8, RESPTYPESEL_A>;
139impl RESPTYPESEL_R {
140 #[doc = "Get enumerated values variant"]
141 #[inline(always)]
142 pub fn variant(&self) -> RESPTYPESEL_A {
143 match self.bits {
144 0 => RESPTYPESEL_A::NORESP,
145 1 => RESPTYPESEL_A::RESP136,
146 2 => RESPTYPESEL_A::RESP48,
147 3 => RESPTYPESEL_A::BUSYAFTRESP,
148 _ => unreachable!(),
149 }
150 }
151 #[doc = "Checks if the value of the field is `NORESP`"]
152 #[inline(always)]
153 pub fn is_noresp(&self) -> bool {
154 *self == RESPTYPESEL_A::NORESP
155 }
156 #[doc = "Checks if the value of the field is `RESP136`"]
157 #[inline(always)]
158 pub fn is_resp136(&self) -> bool {
159 *self == RESPTYPESEL_A::RESP136
160 }
161 #[doc = "Checks if the value of the field is `RESP48`"]
162 #[inline(always)]
163 pub fn is_resp48(&self) -> bool {
164 *self == RESPTYPESEL_A::RESP48
165 }
166 #[doc = "Checks if the value of the field is `BUSYAFTRESP`"]
167 #[inline(always)]
168 pub fn is_busyaftresp(&self) -> bool {
169 *self == RESPTYPESEL_A::BUSYAFTRESP
170 }
171}
172#[doc = "Field `RESPTYPESEL` writer - Response Type Select"]
173pub type RESPTYPESEL_W<'a> =
174 crate::FieldWriterSafe<'a, u32, TFRMODE_SPEC, u8, RESPTYPESEL_A, 2, 16>;
175impl<'a> RESPTYPESEL_W<'a> {
176 #[doc = "No RESP"]
177 #[inline(always)]
178 pub fn noresp(self) -> &'a mut W {
179 self.variant(RESPTYPESEL_A::NORESP)
180 }
181 #[doc = "RESP Length 136"]
182 #[inline(always)]
183 pub fn resp136(self) -> &'a mut W {
184 self.variant(RESPTYPESEL_A::RESP136)
185 }
186 #[doc = "RESP Length 48"]
187 #[inline(always)]
188 pub fn resp48(self) -> &'a mut W {
189 self.variant(RESPTYPESEL_A::RESP48)
190 }
191 #[doc = "RESP Length 48 check busy after RESP"]
192 #[inline(always)]
193 pub fn busyaftresp(self) -> &'a mut W {
194 self.variant(RESPTYPESEL_A::BUSYAFTRESP)
195 }
196}
197#[doc = "Field `CMDCRCCHKEN` reader - Command CRC Check Enable"]
198pub type CMDCRCCHKEN_R = crate::BitReader<bool>;
199#[doc = "Field `CMDCRCCHKEN` writer - Command CRC Check Enable"]
200pub type CMDCRCCHKEN_W<'a> = crate::BitWriter<'a, u32, TFRMODE_SPEC, bool, 19>;
201#[doc = "Field `CMDINDXCHKEN` reader - Command Index Check Enable"]
202pub type CMDINDXCHKEN_R = crate::BitReader<bool>;
203#[doc = "Field `CMDINDXCHKEN` writer - Command Index Check Enable"]
204pub type CMDINDXCHKEN_W<'a> = crate::BitWriter<'a, u32, TFRMODE_SPEC, bool, 20>;
205#[doc = "Field `DATPRESSEL` reader - Data Present Select"]
206pub type DATPRESSEL_R = crate::BitReader<bool>;
207#[doc = "Field `DATPRESSEL` writer - Data Present Select"]
208pub type DATPRESSEL_W<'a> = crate::BitWriter<'a, u32, TFRMODE_SPEC, bool, 21>;
209#[doc = "Command Type\n\nValue on reset: 0"]
210#[derive(Clone, Copy, Debug, PartialEq)]
211#[repr(u8)]
212pub enum CMDTYPE_A {
213 #[doc = "0: Normal Command"]
214 NORMAL = 0,
215 #[doc = "1: Suspend command"]
216 SUSPEND = 1,
217 #[doc = "2: Resume command"]
218 RESUME = 2,
219 #[doc = "3: Abort command"]
220 ABORT = 3,
221}
222impl From<CMDTYPE_A> for u8 {
223 #[inline(always)]
224 fn from(variant: CMDTYPE_A) -> Self {
225 variant as _
226 }
227}
228#[doc = "Field `CMDTYPE` reader - Command Type"]
229pub type CMDTYPE_R = crate::FieldReader<u8, CMDTYPE_A>;
230impl CMDTYPE_R {
231 #[doc = "Get enumerated values variant"]
232 #[inline(always)]
233 pub fn variant(&self) -> CMDTYPE_A {
234 match self.bits {
235 0 => CMDTYPE_A::NORMAL,
236 1 => CMDTYPE_A::SUSPEND,
237 2 => CMDTYPE_A::RESUME,
238 3 => CMDTYPE_A::ABORT,
239 _ => unreachable!(),
240 }
241 }
242 #[doc = "Checks if the value of the field is `NORMAL`"]
243 #[inline(always)]
244 pub fn is_normal(&self) -> bool {
245 *self == CMDTYPE_A::NORMAL
246 }
247 #[doc = "Checks if the value of the field is `SUSPEND`"]
248 #[inline(always)]
249 pub fn is_suspend(&self) -> bool {
250 *self == CMDTYPE_A::SUSPEND
251 }
252 #[doc = "Checks if the value of the field is `RESUME`"]
253 #[inline(always)]
254 pub fn is_resume(&self) -> bool {
255 *self == CMDTYPE_A::RESUME
256 }
257 #[doc = "Checks if the value of the field is `ABORT`"]
258 #[inline(always)]
259 pub fn is_abort(&self) -> bool {
260 *self == CMDTYPE_A::ABORT
261 }
262}
263#[doc = "Field `CMDTYPE` writer - Command Type"]
264pub type CMDTYPE_W<'a> = crate::FieldWriterSafe<'a, u32, TFRMODE_SPEC, u8, CMDTYPE_A, 2, 22>;
265impl<'a> CMDTYPE_W<'a> {
266 #[doc = "Normal Command"]
267 #[inline(always)]
268 pub fn normal(self) -> &'a mut W {
269 self.variant(CMDTYPE_A::NORMAL)
270 }
271 #[doc = "Suspend command"]
272 #[inline(always)]
273 pub fn suspend(self) -> &'a mut W {
274 self.variant(CMDTYPE_A::SUSPEND)
275 }
276 #[doc = "Resume command"]
277 #[inline(always)]
278 pub fn resume(self) -> &'a mut W {
279 self.variant(CMDTYPE_A::RESUME)
280 }
281 #[doc = "Abort command"]
282 #[inline(always)]
283 pub fn abort(self) -> &'a mut W {
284 self.variant(CMDTYPE_A::ABORT)
285 }
286}
287#[doc = "Field `CMDINDEX` reader - Command Index"]
288pub type CMDINDEX_R = crate::FieldReader<u8, u8>;
289#[doc = "Field `CMDINDEX` writer - Command Index"]
290pub type CMDINDEX_W<'a> = crate::FieldWriter<'a, u32, TFRMODE_SPEC, u8, u8, 6, 24>;
291impl R {
292 #[doc = "Bit 0 - DMA Enable"]
293 #[inline(always)]
294 pub fn dmaen(&self) -> DMAEN_R {
295 DMAEN_R::new((self.bits & 1) != 0)
296 }
297 #[doc = "Bit 1 - Block Count Enable"]
298 #[inline(always)]
299 pub fn blkcnten(&self) -> BLKCNTEN_R {
300 BLKCNTEN_R::new(((self.bits >> 1) & 1) != 0)
301 }
302 #[doc = "Bits 2:3 - Auto Command Enable"]
303 #[inline(always)]
304 pub fn autocmden(&self) -> AUTOCMDEN_R {
305 AUTOCMDEN_R::new(((self.bits >> 2) & 3) as u8)
306 }
307 #[doc = "Bit 4 - Data Transfer Direction Select"]
308 #[inline(always)]
309 pub fn datdirsel(&self) -> DATDIRSEL_R {
310 DATDIRSEL_R::new(((self.bits >> 4) & 1) != 0)
311 }
312 #[doc = "Bit 5 - Multiple or Single Block Data Transfer Selection"]
313 #[inline(always)]
314 pub fn multsingblksel(&self) -> MULTSINGBLKSEL_R {
315 MULTSINGBLKSEL_R::new(((self.bits >> 5) & 1) != 0)
316 }
317 #[doc = "Bits 16:17 - Response Type Select"]
318 #[inline(always)]
319 pub fn resptypesel(&self) -> RESPTYPESEL_R {
320 RESPTYPESEL_R::new(((self.bits >> 16) & 3) as u8)
321 }
322 #[doc = "Bit 19 - Command CRC Check Enable"]
323 #[inline(always)]
324 pub fn cmdcrcchken(&self) -> CMDCRCCHKEN_R {
325 CMDCRCCHKEN_R::new(((self.bits >> 19) & 1) != 0)
326 }
327 #[doc = "Bit 20 - Command Index Check Enable"]
328 #[inline(always)]
329 pub fn cmdindxchken(&self) -> CMDINDXCHKEN_R {
330 CMDINDXCHKEN_R::new(((self.bits >> 20) & 1) != 0)
331 }
332 #[doc = "Bit 21 - Data Present Select"]
333 #[inline(always)]
334 pub fn datpressel(&self) -> DATPRESSEL_R {
335 DATPRESSEL_R::new(((self.bits >> 21) & 1) != 0)
336 }
337 #[doc = "Bits 22:23 - Command Type"]
338 #[inline(always)]
339 pub fn cmdtype(&self) -> CMDTYPE_R {
340 CMDTYPE_R::new(((self.bits >> 22) & 3) as u8)
341 }
342 #[doc = "Bits 24:29 - Command Index"]
343 #[inline(always)]
344 pub fn cmdindex(&self) -> CMDINDEX_R {
345 CMDINDEX_R::new(((self.bits >> 24) & 0x3f) as u8)
346 }
347}
348impl W {
349 #[doc = "Bit 0 - DMA Enable"]
350 #[inline(always)]
351 pub fn dmaen(&mut self) -> DMAEN_W {
352 DMAEN_W::new(self)
353 }
354 #[doc = "Bit 1 - Block Count Enable"]
355 #[inline(always)]
356 pub fn blkcnten(&mut self) -> BLKCNTEN_W {
357 BLKCNTEN_W::new(self)
358 }
359 #[doc = "Bits 2:3 - Auto Command Enable"]
360 #[inline(always)]
361 pub fn autocmden(&mut self) -> AUTOCMDEN_W {
362 AUTOCMDEN_W::new(self)
363 }
364 #[doc = "Bit 4 - Data Transfer Direction Select"]
365 #[inline(always)]
366 pub fn datdirsel(&mut self) -> DATDIRSEL_W {
367 DATDIRSEL_W::new(self)
368 }
369 #[doc = "Bit 5 - Multiple or Single Block Data Transfer Selection"]
370 #[inline(always)]
371 pub fn multsingblksel(&mut self) -> MULTSINGBLKSEL_W {
372 MULTSINGBLKSEL_W::new(self)
373 }
374 #[doc = "Bits 16:17 - Response Type Select"]
375 #[inline(always)]
376 pub fn resptypesel(&mut self) -> RESPTYPESEL_W {
377 RESPTYPESEL_W::new(self)
378 }
379 #[doc = "Bit 19 - Command CRC Check Enable"]
380 #[inline(always)]
381 pub fn cmdcrcchken(&mut self) -> CMDCRCCHKEN_W {
382 CMDCRCCHKEN_W::new(self)
383 }
384 #[doc = "Bit 20 - Command Index Check Enable"]
385 #[inline(always)]
386 pub fn cmdindxchken(&mut self) -> CMDINDXCHKEN_W {
387 CMDINDXCHKEN_W::new(self)
388 }
389 #[doc = "Bit 21 - Data Present Select"]
390 #[inline(always)]
391 pub fn datpressel(&mut self) -> DATPRESSEL_W {
392 DATPRESSEL_W::new(self)
393 }
394 #[doc = "Bits 22:23 - Command Type"]
395 #[inline(always)]
396 pub fn cmdtype(&mut self) -> CMDTYPE_W {
397 CMDTYPE_W::new(self)
398 }
399 #[doc = "Bits 24:29 - Command Index"]
400 #[inline(always)]
401 pub fn cmdindex(&mut self) -> CMDINDEX_W {
402 CMDINDEX_W::new(self)
403 }
404 #[doc = "Writes raw bits to the register."]
405 #[inline(always)]
406 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
407 self.0.bits(bits);
408 self
409 }
410}
411#[doc = "Transfer Mode and Command 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 [tfrmode](index.html) module"]
412pub struct TFRMODE_SPEC;
413impl crate::RegisterSpec for TFRMODE_SPEC {
414 type Ux = u32;
415}
416#[doc = "`read()` method returns [tfrmode::R](R) reader structure"]
417impl crate::Readable for TFRMODE_SPEC {
418 type Reader = R;
419}
420#[doc = "`write(|w| ..)` method takes [tfrmode::W](W) writer structure"]
421impl crate::Writable for TFRMODE_SPEC {
422 type Writer = W;
423}
424#[doc = "`reset()` method sets TFRMODE to value 0"]
425impl crate::Resettable for TFRMODE_SPEC {
426 #[inline(always)]
427 fn reset_value() -> Self::Ux {
428 0
429 }
430}