stm32l4x2_pac/sdmmc/
cmd.rs

1#[doc = r" Value read from the register"]
2pub struct R {
3    bits: u32,
4}
5#[doc = r" Value to write to the register"]
6pub struct W {
7    bits: u32,
8}
9impl super::CMD {
10    #[doc = r" Modifies the contents of the register"]
11    #[inline]
12    pub fn modify<F>(&self, f: F)
13    where
14        for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
15    {
16        let bits = self.register.get();
17        let r = R { bits: bits };
18        let mut w = W { bits: bits };
19        f(&r, &mut w);
20        self.register.set(w.bits);
21    }
22    #[doc = r" Reads the contents of the register"]
23    #[inline]
24    pub fn read(&self) -> R {
25        R {
26            bits: self.register.get(),
27        }
28    }
29    #[doc = r" Writes to the register"]
30    #[inline]
31    pub fn write<F>(&self, f: F)
32    where
33        F: FnOnce(&mut W) -> &mut W,
34    {
35        let mut w = W::reset_value();
36        f(&mut w);
37        self.register.set(w.bits);
38    }
39    #[doc = r" Writes the reset value to the register"]
40    #[inline]
41    pub fn reset(&self) {
42        self.write(|w| w)
43    }
44}
45#[doc = r" Value of the field"]
46pub struct CE_ATACMDR {
47    bits: bool,
48}
49impl CE_ATACMDR {
50    #[doc = r" Value of the field as raw bits"]
51    #[inline]
52    pub fn bit(&self) -> bool {
53        self.bits
54    }
55    #[doc = r" Returns `true` if the bit is clear (0)"]
56    #[inline]
57    pub fn bit_is_clear(&self) -> bool {
58        !self.bit()
59    }
60    #[doc = r" Returns `true` if the bit is set (1)"]
61    #[inline]
62    pub fn bit_is_set(&self) -> bool {
63        self.bit()
64    }
65}
66#[doc = r" Value of the field"]
67pub struct NIENR {
68    bits: bool,
69}
70impl NIENR {
71    #[doc = r" Value of the field as raw bits"]
72    #[inline]
73    pub fn bit(&self) -> bool {
74        self.bits
75    }
76    #[doc = r" Returns `true` if the bit is clear (0)"]
77    #[inline]
78    pub fn bit_is_clear(&self) -> bool {
79        !self.bit()
80    }
81    #[doc = r" Returns `true` if the bit is set (1)"]
82    #[inline]
83    pub fn bit_is_set(&self) -> bool {
84        self.bit()
85    }
86}
87#[doc = r" Value of the field"]
88pub struct ENCMDCOMPLR {
89    bits: bool,
90}
91impl ENCMDCOMPLR {
92    #[doc = r" Value of the field as raw bits"]
93    #[inline]
94    pub fn bit(&self) -> bool {
95        self.bits
96    }
97    #[doc = r" Returns `true` if the bit is clear (0)"]
98    #[inline]
99    pub fn bit_is_clear(&self) -> bool {
100        !self.bit()
101    }
102    #[doc = r" Returns `true` if the bit is set (1)"]
103    #[inline]
104    pub fn bit_is_set(&self) -> bool {
105        self.bit()
106    }
107}
108#[doc = r" Value of the field"]
109pub struct SDIOSUSPENDR {
110    bits: bool,
111}
112impl SDIOSUSPENDR {
113    #[doc = r" Value of the field as raw bits"]
114    #[inline]
115    pub fn bit(&self) -> bool {
116        self.bits
117    }
118    #[doc = r" Returns `true` if the bit is clear (0)"]
119    #[inline]
120    pub fn bit_is_clear(&self) -> bool {
121        !self.bit()
122    }
123    #[doc = r" Returns `true` if the bit is set (1)"]
124    #[inline]
125    pub fn bit_is_set(&self) -> bool {
126        self.bit()
127    }
128}
129#[doc = r" Value of the field"]
130pub struct CPSMENR {
131    bits: bool,
132}
133impl CPSMENR {
134    #[doc = r" Value of the field as raw bits"]
135    #[inline]
136    pub fn bit(&self) -> bool {
137        self.bits
138    }
139    #[doc = r" Returns `true` if the bit is clear (0)"]
140    #[inline]
141    pub fn bit_is_clear(&self) -> bool {
142        !self.bit()
143    }
144    #[doc = r" Returns `true` if the bit is set (1)"]
145    #[inline]
146    pub fn bit_is_set(&self) -> bool {
147        self.bit()
148    }
149}
150#[doc = r" Value of the field"]
151pub struct WAITPENDR {
152    bits: bool,
153}
154impl WAITPENDR {
155    #[doc = r" Value of the field as raw bits"]
156    #[inline]
157    pub fn bit(&self) -> bool {
158        self.bits
159    }
160    #[doc = r" Returns `true` if the bit is clear (0)"]
161    #[inline]
162    pub fn bit_is_clear(&self) -> bool {
163        !self.bit()
164    }
165    #[doc = r" Returns `true` if the bit is set (1)"]
166    #[inline]
167    pub fn bit_is_set(&self) -> bool {
168        self.bit()
169    }
170}
171#[doc = r" Value of the field"]
172pub struct WAITINTR {
173    bits: bool,
174}
175impl WAITINTR {
176    #[doc = r" Value of the field as raw bits"]
177    #[inline]
178    pub fn bit(&self) -> bool {
179        self.bits
180    }
181    #[doc = r" Returns `true` if the bit is clear (0)"]
182    #[inline]
183    pub fn bit_is_clear(&self) -> bool {
184        !self.bit()
185    }
186    #[doc = r" Returns `true` if the bit is set (1)"]
187    #[inline]
188    pub fn bit_is_set(&self) -> bool {
189        self.bit()
190    }
191}
192#[doc = r" Value of the field"]
193pub struct WAITRESPR {
194    bits: u8,
195}
196impl WAITRESPR {
197    #[doc = r" Value of the field as raw bits"]
198    #[inline]
199    pub fn bits(&self) -> u8 {
200        self.bits
201    }
202}
203#[doc = r" Value of the field"]
204pub struct CMDINDEXR {
205    bits: u8,
206}
207impl CMDINDEXR {
208    #[doc = r" Value of the field as raw bits"]
209    #[inline]
210    pub fn bits(&self) -> u8 {
211        self.bits
212    }
213}
214#[doc = r" Proxy"]
215pub struct _CE_ATACMDW<'a> {
216    w: &'a mut W,
217}
218impl<'a> _CE_ATACMDW<'a> {
219    #[doc = r" Sets the field bit"]
220    pub fn set_bit(self) -> &'a mut W {
221        self.bit(true)
222    }
223    #[doc = r" Clears the field bit"]
224    pub fn clear_bit(self) -> &'a mut W {
225        self.bit(false)
226    }
227    #[doc = r" Writes raw bits to the field"]
228    #[inline]
229    pub fn bit(self, value: bool) -> &'a mut W {
230        const MASK: bool = true;
231        const OFFSET: u8 = 14;
232        self.w.bits &= !((MASK as u32) << OFFSET);
233        self.w.bits |= ((value & MASK) as u32) << OFFSET;
234        self.w
235    }
236}
237#[doc = r" Proxy"]
238pub struct _NIENW<'a> {
239    w: &'a mut W,
240}
241impl<'a> _NIENW<'a> {
242    #[doc = r" Sets the field bit"]
243    pub fn set_bit(self) -> &'a mut W {
244        self.bit(true)
245    }
246    #[doc = r" Clears the field bit"]
247    pub fn clear_bit(self) -> &'a mut W {
248        self.bit(false)
249    }
250    #[doc = r" Writes raw bits to the field"]
251    #[inline]
252    pub fn bit(self, value: bool) -> &'a mut W {
253        const MASK: bool = true;
254        const OFFSET: u8 = 13;
255        self.w.bits &= !((MASK as u32) << OFFSET);
256        self.w.bits |= ((value & MASK) as u32) << OFFSET;
257        self.w
258    }
259}
260#[doc = r" Proxy"]
261pub struct _ENCMDCOMPLW<'a> {
262    w: &'a mut W,
263}
264impl<'a> _ENCMDCOMPLW<'a> {
265    #[doc = r" Sets the field bit"]
266    pub fn set_bit(self) -> &'a mut W {
267        self.bit(true)
268    }
269    #[doc = r" Clears the field bit"]
270    pub fn clear_bit(self) -> &'a mut W {
271        self.bit(false)
272    }
273    #[doc = r" Writes raw bits to the field"]
274    #[inline]
275    pub fn bit(self, value: bool) -> &'a mut W {
276        const MASK: bool = true;
277        const OFFSET: u8 = 12;
278        self.w.bits &= !((MASK as u32) << OFFSET);
279        self.w.bits |= ((value & MASK) as u32) << OFFSET;
280        self.w
281    }
282}
283#[doc = r" Proxy"]
284pub struct _SDIOSUSPENDW<'a> {
285    w: &'a mut W,
286}
287impl<'a> _SDIOSUSPENDW<'a> {
288    #[doc = r" Sets the field bit"]
289    pub fn set_bit(self) -> &'a mut W {
290        self.bit(true)
291    }
292    #[doc = r" Clears the field bit"]
293    pub fn clear_bit(self) -> &'a mut W {
294        self.bit(false)
295    }
296    #[doc = r" Writes raw bits to the field"]
297    #[inline]
298    pub fn bit(self, value: bool) -> &'a mut W {
299        const MASK: bool = true;
300        const OFFSET: u8 = 11;
301        self.w.bits &= !((MASK as u32) << OFFSET);
302        self.w.bits |= ((value & MASK) as u32) << OFFSET;
303        self.w
304    }
305}
306#[doc = r" Proxy"]
307pub struct _CPSMENW<'a> {
308    w: &'a mut W,
309}
310impl<'a> _CPSMENW<'a> {
311    #[doc = r" Sets the field bit"]
312    pub fn set_bit(self) -> &'a mut W {
313        self.bit(true)
314    }
315    #[doc = r" Clears the field bit"]
316    pub fn clear_bit(self) -> &'a mut W {
317        self.bit(false)
318    }
319    #[doc = r" Writes raw bits to the field"]
320    #[inline]
321    pub fn bit(self, value: bool) -> &'a mut W {
322        const MASK: bool = true;
323        const OFFSET: u8 = 10;
324        self.w.bits &= !((MASK as u32) << OFFSET);
325        self.w.bits |= ((value & MASK) as u32) << OFFSET;
326        self.w
327    }
328}
329#[doc = r" Proxy"]
330pub struct _WAITPENDW<'a> {
331    w: &'a mut W,
332}
333impl<'a> _WAITPENDW<'a> {
334    #[doc = r" Sets the field bit"]
335    pub fn set_bit(self) -> &'a mut W {
336        self.bit(true)
337    }
338    #[doc = r" Clears the field bit"]
339    pub fn clear_bit(self) -> &'a mut W {
340        self.bit(false)
341    }
342    #[doc = r" Writes raw bits to the field"]
343    #[inline]
344    pub fn bit(self, value: bool) -> &'a mut W {
345        const MASK: bool = true;
346        const OFFSET: u8 = 9;
347        self.w.bits &= !((MASK as u32) << OFFSET);
348        self.w.bits |= ((value & MASK) as u32) << OFFSET;
349        self.w
350    }
351}
352#[doc = r" Proxy"]
353pub struct _WAITINTW<'a> {
354    w: &'a mut W,
355}
356impl<'a> _WAITINTW<'a> {
357    #[doc = r" Sets the field bit"]
358    pub fn set_bit(self) -> &'a mut W {
359        self.bit(true)
360    }
361    #[doc = r" Clears the field bit"]
362    pub fn clear_bit(self) -> &'a mut W {
363        self.bit(false)
364    }
365    #[doc = r" Writes raw bits to the field"]
366    #[inline]
367    pub fn bit(self, value: bool) -> &'a mut W {
368        const MASK: bool = true;
369        const OFFSET: u8 = 8;
370        self.w.bits &= !((MASK as u32) << OFFSET);
371        self.w.bits |= ((value & MASK) as u32) << OFFSET;
372        self.w
373    }
374}
375#[doc = r" Proxy"]
376pub struct _WAITRESPW<'a> {
377    w: &'a mut W,
378}
379impl<'a> _WAITRESPW<'a> {
380    #[doc = r" Writes raw bits to the field"]
381    #[inline]
382    pub unsafe fn bits(self, value: u8) -> &'a mut W {
383        const MASK: u8 = 3;
384        const OFFSET: u8 = 6;
385        self.w.bits &= !((MASK as u32) << OFFSET);
386        self.w.bits |= ((value & MASK) as u32) << OFFSET;
387        self.w
388    }
389}
390#[doc = r" Proxy"]
391pub struct _CMDINDEXW<'a> {
392    w: &'a mut W,
393}
394impl<'a> _CMDINDEXW<'a> {
395    #[doc = r" Writes raw bits to the field"]
396    #[inline]
397    pub unsafe fn bits(self, value: u8) -> &'a mut W {
398        const MASK: u8 = 63;
399        const OFFSET: u8 = 0;
400        self.w.bits &= !((MASK as u32) << OFFSET);
401        self.w.bits |= ((value & MASK) as u32) << OFFSET;
402        self.w
403    }
404}
405impl R {
406    #[doc = r" Value of the register as raw bits"]
407    #[inline]
408    pub fn bits(&self) -> u32 {
409        self.bits
410    }
411    #[doc = "Bit 14 - CE-ATA command"]
412    #[inline]
413    pub fn ce_atacmd(&self) -> CE_ATACMDR {
414        let bits = {
415            const MASK: bool = true;
416            const OFFSET: u8 = 14;
417            ((self.bits >> OFFSET) & MASK as u32) != 0
418        };
419        CE_ATACMDR { bits }
420    }
421    #[doc = "Bit 13 - not Interrupt Enable"]
422    #[inline]
423    pub fn n_ien(&self) -> NIENR {
424        let bits = {
425            const MASK: bool = true;
426            const OFFSET: u8 = 13;
427            ((self.bits >> OFFSET) & MASK as u32) != 0
428        };
429        NIENR { bits }
430    }
431    #[doc = "Bit 12 - Enable CMD completion"]
432    #[inline]
433    pub fn encmdcompl(&self) -> ENCMDCOMPLR {
434        let bits = {
435            const MASK: bool = true;
436            const OFFSET: u8 = 12;
437            ((self.bits >> OFFSET) & MASK as u32) != 0
438        };
439        ENCMDCOMPLR { bits }
440    }
441    #[doc = "Bit 11 - SD I/O suspend command"]
442    #[inline]
443    pub fn sdiosuspend(&self) -> SDIOSUSPENDR {
444        let bits = {
445            const MASK: bool = true;
446            const OFFSET: u8 = 11;
447            ((self.bits >> OFFSET) & MASK as u32) != 0
448        };
449        SDIOSUSPENDR { bits }
450    }
451    #[doc = "Bit 10 - Command path state machine (CPSM) Enable bit"]
452    #[inline]
453    pub fn cpsmen(&self) -> CPSMENR {
454        let bits = {
455            const MASK: bool = true;
456            const OFFSET: u8 = 10;
457            ((self.bits >> OFFSET) & MASK as u32) != 0
458        };
459        CPSMENR { bits }
460    }
461    #[doc = "Bit 9 - CPSM Waits for ends of data transfer (CmdPend internal signal)"]
462    #[inline]
463    pub fn waitpend(&self) -> WAITPENDR {
464        let bits = {
465            const MASK: bool = true;
466            const OFFSET: u8 = 9;
467            ((self.bits >> OFFSET) & MASK as u32) != 0
468        };
469        WAITPENDR { bits }
470    }
471    #[doc = "Bit 8 - CPSM waits for interrupt request"]
472    #[inline]
473    pub fn waitint(&self) -> WAITINTR {
474        let bits = {
475            const MASK: bool = true;
476            const OFFSET: u8 = 8;
477            ((self.bits >> OFFSET) & MASK as u32) != 0
478        };
479        WAITINTR { bits }
480    }
481    #[doc = "Bits 6:7 - Wait for response bits"]
482    #[inline]
483    pub fn waitresp(&self) -> WAITRESPR {
484        let bits = {
485            const MASK: u8 = 3;
486            const OFFSET: u8 = 6;
487            ((self.bits >> OFFSET) & MASK as u32) as u8
488        };
489        WAITRESPR { bits }
490    }
491    #[doc = "Bits 0:5 - Command index"]
492    #[inline]
493    pub fn cmdindex(&self) -> CMDINDEXR {
494        let bits = {
495            const MASK: u8 = 63;
496            const OFFSET: u8 = 0;
497            ((self.bits >> OFFSET) & MASK as u32) as u8
498        };
499        CMDINDEXR { bits }
500    }
501}
502impl W {
503    #[doc = r" Reset value of the register"]
504    #[inline]
505    pub fn reset_value() -> W {
506        W { bits: 0 }
507    }
508    #[doc = r" Writes raw bits to the register"]
509    #[inline]
510    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
511        self.bits = bits;
512        self
513    }
514    #[doc = "Bit 14 - CE-ATA command"]
515    #[inline]
516    pub fn ce_atacmd(&mut self) -> _CE_ATACMDW {
517        _CE_ATACMDW { w: self }
518    }
519    #[doc = "Bit 13 - not Interrupt Enable"]
520    #[inline]
521    pub fn n_ien(&mut self) -> _NIENW {
522        _NIENW { w: self }
523    }
524    #[doc = "Bit 12 - Enable CMD completion"]
525    #[inline]
526    pub fn encmdcompl(&mut self) -> _ENCMDCOMPLW {
527        _ENCMDCOMPLW { w: self }
528    }
529    #[doc = "Bit 11 - SD I/O suspend command"]
530    #[inline]
531    pub fn sdiosuspend(&mut self) -> _SDIOSUSPENDW {
532        _SDIOSUSPENDW { w: self }
533    }
534    #[doc = "Bit 10 - Command path state machine (CPSM) Enable bit"]
535    #[inline]
536    pub fn cpsmen(&mut self) -> _CPSMENW {
537        _CPSMENW { w: self }
538    }
539    #[doc = "Bit 9 - CPSM Waits for ends of data transfer (CmdPend internal signal)"]
540    #[inline]
541    pub fn waitpend(&mut self) -> _WAITPENDW {
542        _WAITPENDW { w: self }
543    }
544    #[doc = "Bit 8 - CPSM waits for interrupt request"]
545    #[inline]
546    pub fn waitint(&mut self) -> _WAITINTW {
547        _WAITINTW { w: self }
548    }
549    #[doc = "Bits 6:7 - Wait for response bits"]
550    #[inline]
551    pub fn waitresp(&mut self) -> _WAITRESPW {
552        _WAITRESPW { w: self }
553    }
554    #[doc = "Bits 0:5 - Command index"]
555    #[inline]
556    pub fn cmdindex(&mut self) -> _CMDINDEXW {
557        _CMDINDEXW { w: self }
558    }
559}