mimxrt685s_pac/usdhc0/
mmc_boot.rs

1#[doc = "Register `MMC_BOOT` reader"]
2pub type R = crate::R<MmcBootSpec>;
3#[doc = "Register `MMC_BOOT` writer"]
4pub type W = crate::W<MmcBootSpec>;
5#[doc = "DTOCV_ACK\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8#[repr(u8)]
9pub enum DtocvAck {
10    #[doc = "0: SDCLK x 2^14"]
11    DtocvAck0 = 0,
12    #[doc = "1: SDCLK x 2^15"]
13    DtocvAck1 = 1,
14    #[doc = "2: SDCLK x 2^16"]
15    DtocvAck2 = 2,
16    #[doc = "3: SDCLK x 2^17"]
17    DtocvAck3 = 3,
18    #[doc = "4: SDCLK x 2^18"]
19    DtocvAck4 = 4,
20    #[doc = "5: SDCLK x 2^19"]
21    DtocvAck5 = 5,
22    #[doc = "6: SDCLK x 2^20"]
23    DtocvAck6 = 6,
24    #[doc = "7: SDCLK x 2^21"]
25    DtocvAck7 = 7,
26    #[doc = "14: SDCLK x 2^28"]
27    DtocvAck14 = 14,
28    #[doc = "15: SDCLK x 2^29"]
29    DtocvAck15 = 15,
30}
31impl From<DtocvAck> for u8 {
32    #[inline(always)]
33    fn from(variant: DtocvAck) -> Self {
34        variant as _
35    }
36}
37impl crate::FieldSpec for DtocvAck {
38    type Ux = u8;
39}
40impl crate::IsEnum for DtocvAck {}
41#[doc = "Field `DTOCV_ACK` reader - DTOCV_ACK"]
42pub type DtocvAckR = crate::FieldReader<DtocvAck>;
43impl DtocvAckR {
44    #[doc = "Get enumerated values variant"]
45    #[inline(always)]
46    pub const fn variant(&self) -> Option<DtocvAck> {
47        match self.bits {
48            0 => Some(DtocvAck::DtocvAck0),
49            1 => Some(DtocvAck::DtocvAck1),
50            2 => Some(DtocvAck::DtocvAck2),
51            3 => Some(DtocvAck::DtocvAck3),
52            4 => Some(DtocvAck::DtocvAck4),
53            5 => Some(DtocvAck::DtocvAck5),
54            6 => Some(DtocvAck::DtocvAck6),
55            7 => Some(DtocvAck::DtocvAck7),
56            14 => Some(DtocvAck::DtocvAck14),
57            15 => Some(DtocvAck::DtocvAck15),
58            _ => None,
59        }
60    }
61    #[doc = "SDCLK x 2^14"]
62    #[inline(always)]
63    pub fn is_dtocv_ack_0(&self) -> bool {
64        *self == DtocvAck::DtocvAck0
65    }
66    #[doc = "SDCLK x 2^15"]
67    #[inline(always)]
68    pub fn is_dtocv_ack_1(&self) -> bool {
69        *self == DtocvAck::DtocvAck1
70    }
71    #[doc = "SDCLK x 2^16"]
72    #[inline(always)]
73    pub fn is_dtocv_ack_2(&self) -> bool {
74        *self == DtocvAck::DtocvAck2
75    }
76    #[doc = "SDCLK x 2^17"]
77    #[inline(always)]
78    pub fn is_dtocv_ack_3(&self) -> bool {
79        *self == DtocvAck::DtocvAck3
80    }
81    #[doc = "SDCLK x 2^18"]
82    #[inline(always)]
83    pub fn is_dtocv_ack_4(&self) -> bool {
84        *self == DtocvAck::DtocvAck4
85    }
86    #[doc = "SDCLK x 2^19"]
87    #[inline(always)]
88    pub fn is_dtocv_ack_5(&self) -> bool {
89        *self == DtocvAck::DtocvAck5
90    }
91    #[doc = "SDCLK x 2^20"]
92    #[inline(always)]
93    pub fn is_dtocv_ack_6(&self) -> bool {
94        *self == DtocvAck::DtocvAck6
95    }
96    #[doc = "SDCLK x 2^21"]
97    #[inline(always)]
98    pub fn is_dtocv_ack_7(&self) -> bool {
99        *self == DtocvAck::DtocvAck7
100    }
101    #[doc = "SDCLK x 2^28"]
102    #[inline(always)]
103    pub fn is_dtocv_ack_14(&self) -> bool {
104        *self == DtocvAck::DtocvAck14
105    }
106    #[doc = "SDCLK x 2^29"]
107    #[inline(always)]
108    pub fn is_dtocv_ack_15(&self) -> bool {
109        *self == DtocvAck::DtocvAck15
110    }
111}
112#[doc = "Field `DTOCV_ACK` writer - DTOCV_ACK"]
113pub type DtocvAckW<'a, REG> = crate::FieldWriter<'a, REG, 4, DtocvAck>;
114impl<'a, REG> DtocvAckW<'a, REG>
115where
116    REG: crate::Writable + crate::RegisterSpec,
117    REG::Ux: From<u8>,
118{
119    #[doc = "SDCLK x 2^14"]
120    #[inline(always)]
121    pub fn dtocv_ack_0(self) -> &'a mut crate::W<REG> {
122        self.variant(DtocvAck::DtocvAck0)
123    }
124    #[doc = "SDCLK x 2^15"]
125    #[inline(always)]
126    pub fn dtocv_ack_1(self) -> &'a mut crate::W<REG> {
127        self.variant(DtocvAck::DtocvAck1)
128    }
129    #[doc = "SDCLK x 2^16"]
130    #[inline(always)]
131    pub fn dtocv_ack_2(self) -> &'a mut crate::W<REG> {
132        self.variant(DtocvAck::DtocvAck2)
133    }
134    #[doc = "SDCLK x 2^17"]
135    #[inline(always)]
136    pub fn dtocv_ack_3(self) -> &'a mut crate::W<REG> {
137        self.variant(DtocvAck::DtocvAck3)
138    }
139    #[doc = "SDCLK x 2^18"]
140    #[inline(always)]
141    pub fn dtocv_ack_4(self) -> &'a mut crate::W<REG> {
142        self.variant(DtocvAck::DtocvAck4)
143    }
144    #[doc = "SDCLK x 2^19"]
145    #[inline(always)]
146    pub fn dtocv_ack_5(self) -> &'a mut crate::W<REG> {
147        self.variant(DtocvAck::DtocvAck5)
148    }
149    #[doc = "SDCLK x 2^20"]
150    #[inline(always)]
151    pub fn dtocv_ack_6(self) -> &'a mut crate::W<REG> {
152        self.variant(DtocvAck::DtocvAck6)
153    }
154    #[doc = "SDCLK x 2^21"]
155    #[inline(always)]
156    pub fn dtocv_ack_7(self) -> &'a mut crate::W<REG> {
157        self.variant(DtocvAck::DtocvAck7)
158    }
159    #[doc = "SDCLK x 2^28"]
160    #[inline(always)]
161    pub fn dtocv_ack_14(self) -> &'a mut crate::W<REG> {
162        self.variant(DtocvAck::DtocvAck14)
163    }
164    #[doc = "SDCLK x 2^29"]
165    #[inline(always)]
166    pub fn dtocv_ack_15(self) -> &'a mut crate::W<REG> {
167        self.variant(DtocvAck::DtocvAck15)
168    }
169}
170#[doc = "BOOT_ACK\n\nValue on reset: 0"]
171#[cfg_attr(feature = "defmt", derive(defmt::Format))]
172#[derive(Clone, Copy, Debug, PartialEq, Eq)]
173pub enum BootAck {
174    #[doc = "0: No ack"]
175    BootAck0 = 0,
176    #[doc = "1: Ack"]
177    BootAck1 = 1,
178}
179impl From<BootAck> for bool {
180    #[inline(always)]
181    fn from(variant: BootAck) -> Self {
182        variant as u8 != 0
183    }
184}
185#[doc = "Field `BOOT_ACK` reader - BOOT_ACK"]
186pub type BootAckR = crate::BitReader<BootAck>;
187impl BootAckR {
188    #[doc = "Get enumerated values variant"]
189    #[inline(always)]
190    pub const fn variant(&self) -> BootAck {
191        match self.bits {
192            false => BootAck::BootAck0,
193            true => BootAck::BootAck1,
194        }
195    }
196    #[doc = "No ack"]
197    #[inline(always)]
198    pub fn is_boot_ack_0(&self) -> bool {
199        *self == BootAck::BootAck0
200    }
201    #[doc = "Ack"]
202    #[inline(always)]
203    pub fn is_boot_ack_1(&self) -> bool {
204        *self == BootAck::BootAck1
205    }
206}
207#[doc = "Field `BOOT_ACK` writer - BOOT_ACK"]
208pub type BootAckW<'a, REG> = crate::BitWriter<'a, REG, BootAck>;
209impl<'a, REG> BootAckW<'a, REG>
210where
211    REG: crate::Writable + crate::RegisterSpec,
212{
213    #[doc = "No ack"]
214    #[inline(always)]
215    pub fn boot_ack_0(self) -> &'a mut crate::W<REG> {
216        self.variant(BootAck::BootAck0)
217    }
218    #[doc = "Ack"]
219    #[inline(always)]
220    pub fn boot_ack_1(self) -> &'a mut crate::W<REG> {
221        self.variant(BootAck::BootAck1)
222    }
223}
224#[doc = "BOOT_MODE\n\nValue on reset: 0"]
225#[cfg_attr(feature = "defmt", derive(defmt::Format))]
226#[derive(Clone, Copy, Debug, PartialEq, Eq)]
227pub enum BootMode {
228    #[doc = "0: Normal boot"]
229    BootMode0 = 0,
230    #[doc = "1: Alternative boot"]
231    BootMode1 = 1,
232}
233impl From<BootMode> for bool {
234    #[inline(always)]
235    fn from(variant: BootMode) -> Self {
236        variant as u8 != 0
237    }
238}
239#[doc = "Field `BOOT_MODE` reader - BOOT_MODE"]
240pub type BootModeR = crate::BitReader<BootMode>;
241impl BootModeR {
242    #[doc = "Get enumerated values variant"]
243    #[inline(always)]
244    pub const fn variant(&self) -> BootMode {
245        match self.bits {
246            false => BootMode::BootMode0,
247            true => BootMode::BootMode1,
248        }
249    }
250    #[doc = "Normal boot"]
251    #[inline(always)]
252    pub fn is_boot_mode_0(&self) -> bool {
253        *self == BootMode::BootMode0
254    }
255    #[doc = "Alternative boot"]
256    #[inline(always)]
257    pub fn is_boot_mode_1(&self) -> bool {
258        *self == BootMode::BootMode1
259    }
260}
261#[doc = "Field `BOOT_MODE` writer - BOOT_MODE"]
262pub type BootModeW<'a, REG> = crate::BitWriter<'a, REG, BootMode>;
263impl<'a, REG> BootModeW<'a, REG>
264where
265    REG: crate::Writable + crate::RegisterSpec,
266{
267    #[doc = "Normal boot"]
268    #[inline(always)]
269    pub fn boot_mode_0(self) -> &'a mut crate::W<REG> {
270        self.variant(BootMode::BootMode0)
271    }
272    #[doc = "Alternative boot"]
273    #[inline(always)]
274    pub fn boot_mode_1(self) -> &'a mut crate::W<REG> {
275        self.variant(BootMode::BootMode1)
276    }
277}
278#[doc = "BOOT_EN\n\nValue on reset: 0"]
279#[cfg_attr(feature = "defmt", derive(defmt::Format))]
280#[derive(Clone, Copy, Debug, PartialEq, Eq)]
281pub enum BootEn {
282    #[doc = "0: Fast boot disable"]
283    BootEn0 = 0,
284    #[doc = "1: Fast boot enable"]
285    BootEn1 = 1,
286}
287impl From<BootEn> for bool {
288    #[inline(always)]
289    fn from(variant: BootEn) -> Self {
290        variant as u8 != 0
291    }
292}
293#[doc = "Field `BOOT_EN` reader - BOOT_EN"]
294pub type BootEnR = crate::BitReader<BootEn>;
295impl BootEnR {
296    #[doc = "Get enumerated values variant"]
297    #[inline(always)]
298    pub const fn variant(&self) -> BootEn {
299        match self.bits {
300            false => BootEn::BootEn0,
301            true => BootEn::BootEn1,
302        }
303    }
304    #[doc = "Fast boot disable"]
305    #[inline(always)]
306    pub fn is_boot_en_0(&self) -> bool {
307        *self == BootEn::BootEn0
308    }
309    #[doc = "Fast boot enable"]
310    #[inline(always)]
311    pub fn is_boot_en_1(&self) -> bool {
312        *self == BootEn::BootEn1
313    }
314}
315#[doc = "Field `BOOT_EN` writer - BOOT_EN"]
316pub type BootEnW<'a, REG> = crate::BitWriter<'a, REG, BootEn>;
317impl<'a, REG> BootEnW<'a, REG>
318where
319    REG: crate::Writable + crate::RegisterSpec,
320{
321    #[doc = "Fast boot disable"]
322    #[inline(always)]
323    pub fn boot_en_0(self) -> &'a mut crate::W<REG> {
324        self.variant(BootEn::BootEn0)
325    }
326    #[doc = "Fast boot enable"]
327    #[inline(always)]
328    pub fn boot_en_1(self) -> &'a mut crate::W<REG> {
329        self.variant(BootEn::BootEn1)
330    }
331}
332#[doc = "Field `AUTO_SABG_EN` reader - AUTO_SABG_EN"]
333pub type AutoSabgEnR = crate::BitReader;
334#[doc = "Field `AUTO_SABG_EN` writer - AUTO_SABG_EN"]
335pub type AutoSabgEnW<'a, REG> = crate::BitWriter<'a, REG>;
336#[doc = "Disable Time Out\n\nValue on reset: 0"]
337#[cfg_attr(feature = "defmt", derive(defmt::Format))]
338#[derive(Clone, Copy, Debug, PartialEq, Eq)]
339pub enum DisableTimeOut {
340    #[doc = "0: Enable time out"]
341    DisableTimeOut0 = 0,
342    #[doc = "1: Disable time out"]
343    DisableTimeOut1 = 1,
344}
345impl From<DisableTimeOut> for bool {
346    #[inline(always)]
347    fn from(variant: DisableTimeOut) -> Self {
348        variant as u8 != 0
349    }
350}
351#[doc = "Field `DISABLE_TIME_OUT` reader - Disable Time Out"]
352pub type DisableTimeOutR = crate::BitReader<DisableTimeOut>;
353impl DisableTimeOutR {
354    #[doc = "Get enumerated values variant"]
355    #[inline(always)]
356    pub const fn variant(&self) -> DisableTimeOut {
357        match self.bits {
358            false => DisableTimeOut::DisableTimeOut0,
359            true => DisableTimeOut::DisableTimeOut1,
360        }
361    }
362    #[doc = "Enable time out"]
363    #[inline(always)]
364    pub fn is_disable_time_out_0(&self) -> bool {
365        *self == DisableTimeOut::DisableTimeOut0
366    }
367    #[doc = "Disable time out"]
368    #[inline(always)]
369    pub fn is_disable_time_out_1(&self) -> bool {
370        *self == DisableTimeOut::DisableTimeOut1
371    }
372}
373#[doc = "Field `DISABLE_TIME_OUT` writer - Disable Time Out"]
374pub type DisableTimeOutW<'a, REG> = crate::BitWriter<'a, REG, DisableTimeOut>;
375impl<'a, REG> DisableTimeOutW<'a, REG>
376where
377    REG: crate::Writable + crate::RegisterSpec,
378{
379    #[doc = "Enable time out"]
380    #[inline(always)]
381    pub fn disable_time_out_0(self) -> &'a mut crate::W<REG> {
382        self.variant(DisableTimeOut::DisableTimeOut0)
383    }
384    #[doc = "Disable time out"]
385    #[inline(always)]
386    pub fn disable_time_out_1(self) -> &'a mut crate::W<REG> {
387        self.variant(DisableTimeOut::DisableTimeOut1)
388    }
389}
390#[doc = "Field `BOOT_BLK_CNT` reader - BOOT_BLK_CNT"]
391pub type BootBlkCntR = crate::FieldReader<u16>;
392#[doc = "Field `BOOT_BLK_CNT` writer - BOOT_BLK_CNT"]
393pub type BootBlkCntW<'a, REG> = crate::FieldWriter<'a, REG, 16, u16>;
394impl R {
395    #[doc = "Bits 0:3 - DTOCV_ACK"]
396    #[inline(always)]
397    pub fn dtocv_ack(&self) -> DtocvAckR {
398        DtocvAckR::new((self.bits & 0x0f) as u8)
399    }
400    #[doc = "Bit 4 - BOOT_ACK"]
401    #[inline(always)]
402    pub fn boot_ack(&self) -> BootAckR {
403        BootAckR::new(((self.bits >> 4) & 1) != 0)
404    }
405    #[doc = "Bit 5 - BOOT_MODE"]
406    #[inline(always)]
407    pub fn boot_mode(&self) -> BootModeR {
408        BootModeR::new(((self.bits >> 5) & 1) != 0)
409    }
410    #[doc = "Bit 6 - BOOT_EN"]
411    #[inline(always)]
412    pub fn boot_en(&self) -> BootEnR {
413        BootEnR::new(((self.bits >> 6) & 1) != 0)
414    }
415    #[doc = "Bit 7 - AUTO_SABG_EN"]
416    #[inline(always)]
417    pub fn auto_sabg_en(&self) -> AutoSabgEnR {
418        AutoSabgEnR::new(((self.bits >> 7) & 1) != 0)
419    }
420    #[doc = "Bit 8 - Disable Time Out"]
421    #[inline(always)]
422    pub fn disable_time_out(&self) -> DisableTimeOutR {
423        DisableTimeOutR::new(((self.bits >> 8) & 1) != 0)
424    }
425    #[doc = "Bits 16:31 - BOOT_BLK_CNT"]
426    #[inline(always)]
427    pub fn boot_blk_cnt(&self) -> BootBlkCntR {
428        BootBlkCntR::new(((self.bits >> 16) & 0xffff) as u16)
429    }
430}
431#[cfg(feature = "debug")]
432impl core::fmt::Debug for R {
433    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
434        f.debug_struct("MMC_BOOT")
435            .field("dtocv_ack", &self.dtocv_ack())
436            .field("boot_ack", &self.boot_ack())
437            .field("boot_mode", &self.boot_mode())
438            .field("boot_en", &self.boot_en())
439            .field("auto_sabg_en", &self.auto_sabg_en())
440            .field("disable_time_out", &self.disable_time_out())
441            .field("boot_blk_cnt", &self.boot_blk_cnt())
442            .finish()
443    }
444}
445impl W {
446    #[doc = "Bits 0:3 - DTOCV_ACK"]
447    #[inline(always)]
448    pub fn dtocv_ack(&mut self) -> DtocvAckW<MmcBootSpec> {
449        DtocvAckW::new(self, 0)
450    }
451    #[doc = "Bit 4 - BOOT_ACK"]
452    #[inline(always)]
453    pub fn boot_ack(&mut self) -> BootAckW<MmcBootSpec> {
454        BootAckW::new(self, 4)
455    }
456    #[doc = "Bit 5 - BOOT_MODE"]
457    #[inline(always)]
458    pub fn boot_mode(&mut self) -> BootModeW<MmcBootSpec> {
459        BootModeW::new(self, 5)
460    }
461    #[doc = "Bit 6 - BOOT_EN"]
462    #[inline(always)]
463    pub fn boot_en(&mut self) -> BootEnW<MmcBootSpec> {
464        BootEnW::new(self, 6)
465    }
466    #[doc = "Bit 7 - AUTO_SABG_EN"]
467    #[inline(always)]
468    pub fn auto_sabg_en(&mut self) -> AutoSabgEnW<MmcBootSpec> {
469        AutoSabgEnW::new(self, 7)
470    }
471    #[doc = "Bit 8 - Disable Time Out"]
472    #[inline(always)]
473    pub fn disable_time_out(&mut self) -> DisableTimeOutW<MmcBootSpec> {
474        DisableTimeOutW::new(self, 8)
475    }
476    #[doc = "Bits 16:31 - BOOT_BLK_CNT"]
477    #[inline(always)]
478    pub fn boot_blk_cnt(&mut self) -> BootBlkCntW<MmcBootSpec> {
479        BootBlkCntW::new(self, 16)
480    }
481}
482#[doc = "MMC Boot Register\n\nYou can [`read`](crate::Reg::read) this register and get [`mmc_boot::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`mmc_boot::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
483pub struct MmcBootSpec;
484impl crate::RegisterSpec for MmcBootSpec {
485    type Ux = u32;
486}
487#[doc = "`read()` method returns [`mmc_boot::R`](R) reader structure"]
488impl crate::Readable for MmcBootSpec {}
489#[doc = "`write(|w| ..)` method takes [`mmc_boot::W`](W) writer structure"]
490impl crate::Writable for MmcBootSpec {
491    type Safety = crate::Unsafe;
492    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
493    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
494}
495#[doc = "`reset()` method sets MMC_BOOT to value 0"]
496impl crate::Resettable for MmcBootSpec {
497    const RESET_VALUE: u32 = 0;
498}