stm32l4x2_pac/sdmmc/
dctrl.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::DCTRL {
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 SDIOENR {
47    bits: bool,
48}
49impl SDIOENR {
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 RWMODR {
68    bits: bool,
69}
70impl RWMODR {
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 RWSTOPR {
89    bits: bool,
90}
91impl RWSTOPR {
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 RWSTARTR {
110    bits: bool,
111}
112impl RWSTARTR {
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 DBLOCKSIZER {
131    bits: u8,
132}
133impl DBLOCKSIZER {
134    #[doc = r" Value of the field as raw bits"]
135    #[inline]
136    pub fn bits(&self) -> u8 {
137        self.bits
138    }
139}
140#[doc = r" Value of the field"]
141pub struct DMAENR {
142    bits: bool,
143}
144impl DMAENR {
145    #[doc = r" Value of the field as raw bits"]
146    #[inline]
147    pub fn bit(&self) -> bool {
148        self.bits
149    }
150    #[doc = r" Returns `true` if the bit is clear (0)"]
151    #[inline]
152    pub fn bit_is_clear(&self) -> bool {
153        !self.bit()
154    }
155    #[doc = r" Returns `true` if the bit is set (1)"]
156    #[inline]
157    pub fn bit_is_set(&self) -> bool {
158        self.bit()
159    }
160}
161#[doc = r" Value of the field"]
162pub struct DTMODER {
163    bits: bool,
164}
165impl DTMODER {
166    #[doc = r" Value of the field as raw bits"]
167    #[inline]
168    pub fn bit(&self) -> bool {
169        self.bits
170    }
171    #[doc = r" Returns `true` if the bit is clear (0)"]
172    #[inline]
173    pub fn bit_is_clear(&self) -> bool {
174        !self.bit()
175    }
176    #[doc = r" Returns `true` if the bit is set (1)"]
177    #[inline]
178    pub fn bit_is_set(&self) -> bool {
179        self.bit()
180    }
181}
182#[doc = r" Value of the field"]
183pub struct DTDIRR {
184    bits: bool,
185}
186impl DTDIRR {
187    #[doc = r" Value of the field as raw bits"]
188    #[inline]
189    pub fn bit(&self) -> bool {
190        self.bits
191    }
192    #[doc = r" Returns `true` if the bit is clear (0)"]
193    #[inline]
194    pub fn bit_is_clear(&self) -> bool {
195        !self.bit()
196    }
197    #[doc = r" Returns `true` if the bit is set (1)"]
198    #[inline]
199    pub fn bit_is_set(&self) -> bool {
200        self.bit()
201    }
202}
203#[doc = r" Value of the field"]
204pub struct DTENR {
205    bits: bool,
206}
207impl DTENR {
208    #[doc = r" Value of the field as raw bits"]
209    #[inline]
210    pub fn bit(&self) -> bool {
211        self.bits
212    }
213    #[doc = r" Returns `true` if the bit is clear (0)"]
214    #[inline]
215    pub fn bit_is_clear(&self) -> bool {
216        !self.bit()
217    }
218    #[doc = r" Returns `true` if the bit is set (1)"]
219    #[inline]
220    pub fn bit_is_set(&self) -> bool {
221        self.bit()
222    }
223}
224#[doc = r" Proxy"]
225pub struct _SDIOENW<'a> {
226    w: &'a mut W,
227}
228impl<'a> _SDIOENW<'a> {
229    #[doc = r" Sets the field bit"]
230    pub fn set_bit(self) -> &'a mut W {
231        self.bit(true)
232    }
233    #[doc = r" Clears the field bit"]
234    pub fn clear_bit(self) -> &'a mut W {
235        self.bit(false)
236    }
237    #[doc = r" Writes raw bits to the field"]
238    #[inline]
239    pub fn bit(self, value: bool) -> &'a mut W {
240        const MASK: bool = true;
241        const OFFSET: u8 = 11;
242        self.w.bits &= !((MASK as u32) << OFFSET);
243        self.w.bits |= ((value & MASK) as u32) << OFFSET;
244        self.w
245    }
246}
247#[doc = r" Proxy"]
248pub struct _RWMODW<'a> {
249    w: &'a mut W,
250}
251impl<'a> _RWMODW<'a> {
252    #[doc = r" Sets the field bit"]
253    pub fn set_bit(self) -> &'a mut W {
254        self.bit(true)
255    }
256    #[doc = r" Clears the field bit"]
257    pub fn clear_bit(self) -> &'a mut W {
258        self.bit(false)
259    }
260    #[doc = r" Writes raw bits to the field"]
261    #[inline]
262    pub fn bit(self, value: bool) -> &'a mut W {
263        const MASK: bool = true;
264        const OFFSET: u8 = 10;
265        self.w.bits &= !((MASK as u32) << OFFSET);
266        self.w.bits |= ((value & MASK) as u32) << OFFSET;
267        self.w
268    }
269}
270#[doc = r" Proxy"]
271pub struct _RWSTOPW<'a> {
272    w: &'a mut W,
273}
274impl<'a> _RWSTOPW<'a> {
275    #[doc = r" Sets the field bit"]
276    pub fn set_bit(self) -> &'a mut W {
277        self.bit(true)
278    }
279    #[doc = r" Clears the field bit"]
280    pub fn clear_bit(self) -> &'a mut W {
281        self.bit(false)
282    }
283    #[doc = r" Writes raw bits to the field"]
284    #[inline]
285    pub fn bit(self, value: bool) -> &'a mut W {
286        const MASK: bool = true;
287        const OFFSET: u8 = 9;
288        self.w.bits &= !((MASK as u32) << OFFSET);
289        self.w.bits |= ((value & MASK) as u32) << OFFSET;
290        self.w
291    }
292}
293#[doc = r" Proxy"]
294pub struct _RWSTARTW<'a> {
295    w: &'a mut W,
296}
297impl<'a> _RWSTARTW<'a> {
298    #[doc = r" Sets the field bit"]
299    pub fn set_bit(self) -> &'a mut W {
300        self.bit(true)
301    }
302    #[doc = r" Clears the field bit"]
303    pub fn clear_bit(self) -> &'a mut W {
304        self.bit(false)
305    }
306    #[doc = r" Writes raw bits to the field"]
307    #[inline]
308    pub fn bit(self, value: bool) -> &'a mut W {
309        const MASK: bool = true;
310        const OFFSET: u8 = 8;
311        self.w.bits &= !((MASK as u32) << OFFSET);
312        self.w.bits |= ((value & MASK) as u32) << OFFSET;
313        self.w
314    }
315}
316#[doc = r" Proxy"]
317pub struct _DBLOCKSIZEW<'a> {
318    w: &'a mut W,
319}
320impl<'a> _DBLOCKSIZEW<'a> {
321    #[doc = r" Writes raw bits to the field"]
322    #[inline]
323    pub unsafe fn bits(self, value: u8) -> &'a mut W {
324        const MASK: u8 = 15;
325        const OFFSET: u8 = 4;
326        self.w.bits &= !((MASK as u32) << OFFSET);
327        self.w.bits |= ((value & MASK) as u32) << OFFSET;
328        self.w
329    }
330}
331#[doc = r" Proxy"]
332pub struct _DMAENW<'a> {
333    w: &'a mut W,
334}
335impl<'a> _DMAENW<'a> {
336    #[doc = r" Sets the field bit"]
337    pub fn set_bit(self) -> &'a mut W {
338        self.bit(true)
339    }
340    #[doc = r" Clears the field bit"]
341    pub fn clear_bit(self) -> &'a mut W {
342        self.bit(false)
343    }
344    #[doc = r" Writes raw bits to the field"]
345    #[inline]
346    pub fn bit(self, value: bool) -> &'a mut W {
347        const MASK: bool = true;
348        const OFFSET: u8 = 3;
349        self.w.bits &= !((MASK as u32) << OFFSET);
350        self.w.bits |= ((value & MASK) as u32) << OFFSET;
351        self.w
352    }
353}
354#[doc = r" Proxy"]
355pub struct _DTMODEW<'a> {
356    w: &'a mut W,
357}
358impl<'a> _DTMODEW<'a> {
359    #[doc = r" Sets the field bit"]
360    pub fn set_bit(self) -> &'a mut W {
361        self.bit(true)
362    }
363    #[doc = r" Clears the field bit"]
364    pub fn clear_bit(self) -> &'a mut W {
365        self.bit(false)
366    }
367    #[doc = r" Writes raw bits to the field"]
368    #[inline]
369    pub fn bit(self, value: bool) -> &'a mut W {
370        const MASK: bool = true;
371        const OFFSET: u8 = 2;
372        self.w.bits &= !((MASK as u32) << OFFSET);
373        self.w.bits |= ((value & MASK) as u32) << OFFSET;
374        self.w
375    }
376}
377#[doc = r" Proxy"]
378pub struct _DTDIRW<'a> {
379    w: &'a mut W,
380}
381impl<'a> _DTDIRW<'a> {
382    #[doc = r" Sets the field bit"]
383    pub fn set_bit(self) -> &'a mut W {
384        self.bit(true)
385    }
386    #[doc = r" Clears the field bit"]
387    pub fn clear_bit(self) -> &'a mut W {
388        self.bit(false)
389    }
390    #[doc = r" Writes raw bits to the field"]
391    #[inline]
392    pub fn bit(self, value: bool) -> &'a mut W {
393        const MASK: bool = true;
394        const OFFSET: u8 = 1;
395        self.w.bits &= !((MASK as u32) << OFFSET);
396        self.w.bits |= ((value & MASK) as u32) << OFFSET;
397        self.w
398    }
399}
400#[doc = r" Proxy"]
401pub struct _DTENW<'a> {
402    w: &'a mut W,
403}
404impl<'a> _DTENW<'a> {
405    #[doc = r" Sets the field bit"]
406    pub fn set_bit(self) -> &'a mut W {
407        self.bit(true)
408    }
409    #[doc = r" Clears the field bit"]
410    pub fn clear_bit(self) -> &'a mut W {
411        self.bit(false)
412    }
413    #[doc = r" Writes raw bits to the field"]
414    #[inline]
415    pub fn bit(self, value: bool) -> &'a mut W {
416        const MASK: bool = true;
417        const OFFSET: u8 = 0;
418        self.w.bits &= !((MASK as u32) << OFFSET);
419        self.w.bits |= ((value & MASK) as u32) << OFFSET;
420        self.w
421    }
422}
423impl R {
424    #[doc = r" Value of the register as raw bits"]
425    #[inline]
426    pub fn bits(&self) -> u32 {
427        self.bits
428    }
429    #[doc = "Bit 11 - SD I/O enable functions"]
430    #[inline]
431    pub fn sdioen(&self) -> SDIOENR {
432        let bits = {
433            const MASK: bool = true;
434            const OFFSET: u8 = 11;
435            ((self.bits >> OFFSET) & MASK as u32) != 0
436        };
437        SDIOENR { bits }
438    }
439    #[doc = "Bit 10 - Read wait mode"]
440    #[inline]
441    pub fn rwmod(&self) -> RWMODR {
442        let bits = {
443            const MASK: bool = true;
444            const OFFSET: u8 = 10;
445            ((self.bits >> OFFSET) & MASK as u32) != 0
446        };
447        RWMODR { bits }
448    }
449    #[doc = "Bit 9 - Read wait stop"]
450    #[inline]
451    pub fn rwstop(&self) -> RWSTOPR {
452        let bits = {
453            const MASK: bool = true;
454            const OFFSET: u8 = 9;
455            ((self.bits >> OFFSET) & MASK as u32) != 0
456        };
457        RWSTOPR { bits }
458    }
459    #[doc = "Bit 8 - Read wait start"]
460    #[inline]
461    pub fn rwstart(&self) -> RWSTARTR {
462        let bits = {
463            const MASK: bool = true;
464            const OFFSET: u8 = 8;
465            ((self.bits >> OFFSET) & MASK as u32) != 0
466        };
467        RWSTARTR { bits }
468    }
469    #[doc = "Bits 4:7 - Data block size"]
470    #[inline]
471    pub fn dblocksize(&self) -> DBLOCKSIZER {
472        let bits = {
473            const MASK: u8 = 15;
474            const OFFSET: u8 = 4;
475            ((self.bits >> OFFSET) & MASK as u32) as u8
476        };
477        DBLOCKSIZER { bits }
478    }
479    #[doc = "Bit 3 - DMA enable bit"]
480    #[inline]
481    pub fn dmaen(&self) -> DMAENR {
482        let bits = {
483            const MASK: bool = true;
484            const OFFSET: u8 = 3;
485            ((self.bits >> OFFSET) & MASK as u32) != 0
486        };
487        DMAENR { bits }
488    }
489    #[doc = "Bit 2 - Data transfer mode selection 1: Stream or SDIO multibyte data transfer"]
490    #[inline]
491    pub fn dtmode(&self) -> DTMODER {
492        let bits = {
493            const MASK: bool = true;
494            const OFFSET: u8 = 2;
495            ((self.bits >> OFFSET) & MASK as u32) != 0
496        };
497        DTMODER { bits }
498    }
499    #[doc = "Bit 1 - Data transfer direction selection"]
500    #[inline]
501    pub fn dtdir(&self) -> DTDIRR {
502        let bits = {
503            const MASK: bool = true;
504            const OFFSET: u8 = 1;
505            ((self.bits >> OFFSET) & MASK as u32) != 0
506        };
507        DTDIRR { bits }
508    }
509    #[doc = "Bit 0 - DTEN"]
510    #[inline]
511    pub fn dten(&self) -> DTENR {
512        let bits = {
513            const MASK: bool = true;
514            const OFFSET: u8 = 0;
515            ((self.bits >> OFFSET) & MASK as u32) != 0
516        };
517        DTENR { bits }
518    }
519}
520impl W {
521    #[doc = r" Reset value of the register"]
522    #[inline]
523    pub fn reset_value() -> W {
524        W { bits: 0 }
525    }
526    #[doc = r" Writes raw bits to the register"]
527    #[inline]
528    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
529        self.bits = bits;
530        self
531    }
532    #[doc = "Bit 11 - SD I/O enable functions"]
533    #[inline]
534    pub fn sdioen(&mut self) -> _SDIOENW {
535        _SDIOENW { w: self }
536    }
537    #[doc = "Bit 10 - Read wait mode"]
538    #[inline]
539    pub fn rwmod(&mut self) -> _RWMODW {
540        _RWMODW { w: self }
541    }
542    #[doc = "Bit 9 - Read wait stop"]
543    #[inline]
544    pub fn rwstop(&mut self) -> _RWSTOPW {
545        _RWSTOPW { w: self }
546    }
547    #[doc = "Bit 8 - Read wait start"]
548    #[inline]
549    pub fn rwstart(&mut self) -> _RWSTARTW {
550        _RWSTARTW { w: self }
551    }
552    #[doc = "Bits 4:7 - Data block size"]
553    #[inline]
554    pub fn dblocksize(&mut self) -> _DBLOCKSIZEW {
555        _DBLOCKSIZEW { w: self }
556    }
557    #[doc = "Bit 3 - DMA enable bit"]
558    #[inline]
559    pub fn dmaen(&mut self) -> _DMAENW {
560        _DMAENW { w: self }
561    }
562    #[doc = "Bit 2 - Data transfer mode selection 1: Stream or SDIO multibyte data transfer"]
563    #[inline]
564    pub fn dtmode(&mut self) -> _DTMODEW {
565        _DTMODEW { w: self }
566    }
567    #[doc = "Bit 1 - Data transfer direction selection"]
568    #[inline]
569    pub fn dtdir(&mut self) -> _DTDIRW {
570        _DTDIRW { w: self }
571    }
572    #[doc = "Bit 0 - DTEN"]
573    #[inline]
574    pub fn dten(&mut self) -> _DTENW {
575        _DTENW { w: self }
576    }
577}