mimxrt685s_pac/usdhc0/
cmd_xfr_typ.rs

1#[doc = "Register `CMD_XFR_TYP` reader"]
2pub type R = crate::R<CmdXfrTypSpec>;
3#[doc = "Register `CMD_XFR_TYP` writer"]
4pub type W = crate::W<CmdXfrTypSpec>;
5#[doc = "Response Type Select\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 Rsptyp {
10    #[doc = "0: No Response"]
11    Rsptyp0 = 0,
12    #[doc = "1: Response Length 136"]
13    Rsptyp1 = 1,
14    #[doc = "2: Response Length 48"]
15    Rsptyp2 = 2,
16    #[doc = "3: Response Length 48, check Busy after response"]
17    Rsptyp3 = 3,
18}
19impl From<Rsptyp> for u8 {
20    #[inline(always)]
21    fn from(variant: Rsptyp) -> Self {
22        variant as _
23    }
24}
25impl crate::FieldSpec for Rsptyp {
26    type Ux = u8;
27}
28impl crate::IsEnum for Rsptyp {}
29#[doc = "Field `RSPTYP` reader - Response Type Select"]
30pub type RsptypR = crate::FieldReader<Rsptyp>;
31impl RsptypR {
32    #[doc = "Get enumerated values variant"]
33    #[inline(always)]
34    pub const fn variant(&self) -> Rsptyp {
35        match self.bits {
36            0 => Rsptyp::Rsptyp0,
37            1 => Rsptyp::Rsptyp1,
38            2 => Rsptyp::Rsptyp2,
39            3 => Rsptyp::Rsptyp3,
40            _ => unreachable!(),
41        }
42    }
43    #[doc = "No Response"]
44    #[inline(always)]
45    pub fn is_rsptyp_0(&self) -> bool {
46        *self == Rsptyp::Rsptyp0
47    }
48    #[doc = "Response Length 136"]
49    #[inline(always)]
50    pub fn is_rsptyp_1(&self) -> bool {
51        *self == Rsptyp::Rsptyp1
52    }
53    #[doc = "Response Length 48"]
54    #[inline(always)]
55    pub fn is_rsptyp_2(&self) -> bool {
56        *self == Rsptyp::Rsptyp2
57    }
58    #[doc = "Response Length 48, check Busy after response"]
59    #[inline(always)]
60    pub fn is_rsptyp_3(&self) -> bool {
61        *self == Rsptyp::Rsptyp3
62    }
63}
64#[doc = "Field `RSPTYP` writer - Response Type Select"]
65pub type RsptypW<'a, REG> = crate::FieldWriter<'a, REG, 2, Rsptyp, crate::Safe>;
66impl<'a, REG> RsptypW<'a, REG>
67where
68    REG: crate::Writable + crate::RegisterSpec,
69    REG::Ux: From<u8>,
70{
71    #[doc = "No Response"]
72    #[inline(always)]
73    pub fn rsptyp_0(self) -> &'a mut crate::W<REG> {
74        self.variant(Rsptyp::Rsptyp0)
75    }
76    #[doc = "Response Length 136"]
77    #[inline(always)]
78    pub fn rsptyp_1(self) -> &'a mut crate::W<REG> {
79        self.variant(Rsptyp::Rsptyp1)
80    }
81    #[doc = "Response Length 48"]
82    #[inline(always)]
83    pub fn rsptyp_2(self) -> &'a mut crate::W<REG> {
84        self.variant(Rsptyp::Rsptyp2)
85    }
86    #[doc = "Response Length 48, check Busy after response"]
87    #[inline(always)]
88    pub fn rsptyp_3(self) -> &'a mut crate::W<REG> {
89        self.variant(Rsptyp::Rsptyp3)
90    }
91}
92#[doc = "Command CRC Check Enable\n\nValue on reset: 0"]
93#[cfg_attr(feature = "defmt", derive(defmt::Format))]
94#[derive(Clone, Copy, Debug, PartialEq, Eq)]
95pub enum Cccen {
96    #[doc = "0: Disable"]
97    Cccen0 = 0,
98    #[doc = "1: Enable"]
99    Cccen1 = 1,
100}
101impl From<Cccen> for bool {
102    #[inline(always)]
103    fn from(variant: Cccen) -> Self {
104        variant as u8 != 0
105    }
106}
107#[doc = "Field `CCCEN` reader - Command CRC Check Enable"]
108pub type CccenR = crate::BitReader<Cccen>;
109impl CccenR {
110    #[doc = "Get enumerated values variant"]
111    #[inline(always)]
112    pub const fn variant(&self) -> Cccen {
113        match self.bits {
114            false => Cccen::Cccen0,
115            true => Cccen::Cccen1,
116        }
117    }
118    #[doc = "Disable"]
119    #[inline(always)]
120    pub fn is_cccen_0(&self) -> bool {
121        *self == Cccen::Cccen0
122    }
123    #[doc = "Enable"]
124    #[inline(always)]
125    pub fn is_cccen_1(&self) -> bool {
126        *self == Cccen::Cccen1
127    }
128}
129#[doc = "Field `CCCEN` writer - Command CRC Check Enable"]
130pub type CccenW<'a, REG> = crate::BitWriter<'a, REG, Cccen>;
131impl<'a, REG> CccenW<'a, REG>
132where
133    REG: crate::Writable + crate::RegisterSpec,
134{
135    #[doc = "Disable"]
136    #[inline(always)]
137    pub fn cccen_0(self) -> &'a mut crate::W<REG> {
138        self.variant(Cccen::Cccen0)
139    }
140    #[doc = "Enable"]
141    #[inline(always)]
142    pub fn cccen_1(self) -> &'a mut crate::W<REG> {
143        self.variant(Cccen::Cccen1)
144    }
145}
146#[doc = "Command Index Check Enable\n\nValue on reset: 0"]
147#[cfg_attr(feature = "defmt", derive(defmt::Format))]
148#[derive(Clone, Copy, Debug, PartialEq, Eq)]
149pub enum Cicen {
150    #[doc = "0: Disable"]
151    Cicen0 = 0,
152    #[doc = "1: Enable"]
153    Cicen1 = 1,
154}
155impl From<Cicen> for bool {
156    #[inline(always)]
157    fn from(variant: Cicen) -> Self {
158        variant as u8 != 0
159    }
160}
161#[doc = "Field `CICEN` reader - Command Index Check Enable"]
162pub type CicenR = crate::BitReader<Cicen>;
163impl CicenR {
164    #[doc = "Get enumerated values variant"]
165    #[inline(always)]
166    pub const fn variant(&self) -> Cicen {
167        match self.bits {
168            false => Cicen::Cicen0,
169            true => Cicen::Cicen1,
170        }
171    }
172    #[doc = "Disable"]
173    #[inline(always)]
174    pub fn is_cicen_0(&self) -> bool {
175        *self == Cicen::Cicen0
176    }
177    #[doc = "Enable"]
178    #[inline(always)]
179    pub fn is_cicen_1(&self) -> bool {
180        *self == Cicen::Cicen1
181    }
182}
183#[doc = "Field `CICEN` writer - Command Index Check Enable"]
184pub type CicenW<'a, REG> = crate::BitWriter<'a, REG, Cicen>;
185impl<'a, REG> CicenW<'a, REG>
186where
187    REG: crate::Writable + crate::RegisterSpec,
188{
189    #[doc = "Disable"]
190    #[inline(always)]
191    pub fn cicen_0(self) -> &'a mut crate::W<REG> {
192        self.variant(Cicen::Cicen0)
193    }
194    #[doc = "Enable"]
195    #[inline(always)]
196    pub fn cicen_1(self) -> &'a mut crate::W<REG> {
197        self.variant(Cicen::Cicen1)
198    }
199}
200#[doc = "Data Present Select\n\nValue on reset: 0"]
201#[cfg_attr(feature = "defmt", derive(defmt::Format))]
202#[derive(Clone, Copy, Debug, PartialEq, Eq)]
203pub enum Dpsel {
204    #[doc = "0: No Data Present"]
205    Dpsel0 = 0,
206    #[doc = "1: Data Present"]
207    Dpsel1 = 1,
208}
209impl From<Dpsel> for bool {
210    #[inline(always)]
211    fn from(variant: Dpsel) -> Self {
212        variant as u8 != 0
213    }
214}
215#[doc = "Field `DPSEL` reader - Data Present Select"]
216pub type DpselR = crate::BitReader<Dpsel>;
217impl DpselR {
218    #[doc = "Get enumerated values variant"]
219    #[inline(always)]
220    pub const fn variant(&self) -> Dpsel {
221        match self.bits {
222            false => Dpsel::Dpsel0,
223            true => Dpsel::Dpsel1,
224        }
225    }
226    #[doc = "No Data Present"]
227    #[inline(always)]
228    pub fn is_dpsel_0(&self) -> bool {
229        *self == Dpsel::Dpsel0
230    }
231    #[doc = "Data Present"]
232    #[inline(always)]
233    pub fn is_dpsel_1(&self) -> bool {
234        *self == Dpsel::Dpsel1
235    }
236}
237#[doc = "Field `DPSEL` writer - Data Present Select"]
238pub type DpselW<'a, REG> = crate::BitWriter<'a, REG, Dpsel>;
239impl<'a, REG> DpselW<'a, REG>
240where
241    REG: crate::Writable + crate::RegisterSpec,
242{
243    #[doc = "No Data Present"]
244    #[inline(always)]
245    pub fn dpsel_0(self) -> &'a mut crate::W<REG> {
246        self.variant(Dpsel::Dpsel0)
247    }
248    #[doc = "Data Present"]
249    #[inline(always)]
250    pub fn dpsel_1(self) -> &'a mut crate::W<REG> {
251        self.variant(Dpsel::Dpsel1)
252    }
253}
254#[doc = "Command Type\n\nValue on reset: 0"]
255#[cfg_attr(feature = "defmt", derive(defmt::Format))]
256#[derive(Clone, Copy, Debug, PartialEq, Eq)]
257#[repr(u8)]
258pub enum Cmdtyp {
259    #[doc = "0: Normal Other commands"]
260    Cmdtyp0 = 0,
261    #[doc = "1: Suspend CMD52 for writing Bus Suspend in CCCR"]
262    Cmdtyp1 = 1,
263    #[doc = "2: Resume CMD52 for writing Function Select in CCCR"]
264    Cmdtyp2 = 2,
265    #[doc = "3: Abort CMD12, CMD52 for writing I/O Abort in CCCR"]
266    Cmdtyp3 = 3,
267}
268impl From<Cmdtyp> for u8 {
269    #[inline(always)]
270    fn from(variant: Cmdtyp) -> Self {
271        variant as _
272    }
273}
274impl crate::FieldSpec for Cmdtyp {
275    type Ux = u8;
276}
277impl crate::IsEnum for Cmdtyp {}
278#[doc = "Field `CMDTYP` reader - Command Type"]
279pub type CmdtypR = crate::FieldReader<Cmdtyp>;
280impl CmdtypR {
281    #[doc = "Get enumerated values variant"]
282    #[inline(always)]
283    pub const fn variant(&self) -> Cmdtyp {
284        match self.bits {
285            0 => Cmdtyp::Cmdtyp0,
286            1 => Cmdtyp::Cmdtyp1,
287            2 => Cmdtyp::Cmdtyp2,
288            3 => Cmdtyp::Cmdtyp3,
289            _ => unreachable!(),
290        }
291    }
292    #[doc = "Normal Other commands"]
293    #[inline(always)]
294    pub fn is_cmdtyp_0(&self) -> bool {
295        *self == Cmdtyp::Cmdtyp0
296    }
297    #[doc = "Suspend CMD52 for writing Bus Suspend in CCCR"]
298    #[inline(always)]
299    pub fn is_cmdtyp_1(&self) -> bool {
300        *self == Cmdtyp::Cmdtyp1
301    }
302    #[doc = "Resume CMD52 for writing Function Select in CCCR"]
303    #[inline(always)]
304    pub fn is_cmdtyp_2(&self) -> bool {
305        *self == Cmdtyp::Cmdtyp2
306    }
307    #[doc = "Abort CMD12, CMD52 for writing I/O Abort in CCCR"]
308    #[inline(always)]
309    pub fn is_cmdtyp_3(&self) -> bool {
310        *self == Cmdtyp::Cmdtyp3
311    }
312}
313#[doc = "Field `CMDTYP` writer - Command Type"]
314pub type CmdtypW<'a, REG> = crate::FieldWriter<'a, REG, 2, Cmdtyp, crate::Safe>;
315impl<'a, REG> CmdtypW<'a, REG>
316where
317    REG: crate::Writable + crate::RegisterSpec,
318    REG::Ux: From<u8>,
319{
320    #[doc = "Normal Other commands"]
321    #[inline(always)]
322    pub fn cmdtyp_0(self) -> &'a mut crate::W<REG> {
323        self.variant(Cmdtyp::Cmdtyp0)
324    }
325    #[doc = "Suspend CMD52 for writing Bus Suspend in CCCR"]
326    #[inline(always)]
327    pub fn cmdtyp_1(self) -> &'a mut crate::W<REG> {
328        self.variant(Cmdtyp::Cmdtyp1)
329    }
330    #[doc = "Resume CMD52 for writing Function Select in CCCR"]
331    #[inline(always)]
332    pub fn cmdtyp_2(self) -> &'a mut crate::W<REG> {
333        self.variant(Cmdtyp::Cmdtyp2)
334    }
335    #[doc = "Abort CMD12, CMD52 for writing I/O Abort in CCCR"]
336    #[inline(always)]
337    pub fn cmdtyp_3(self) -> &'a mut crate::W<REG> {
338        self.variant(Cmdtyp::Cmdtyp3)
339    }
340}
341#[doc = "Field `CMDINX` reader - Command Index"]
342pub type CmdinxR = crate::FieldReader;
343#[doc = "Field `CMDINX` writer - Command Index"]
344pub type CmdinxW<'a, REG> = crate::FieldWriter<'a, REG, 6>;
345impl R {
346    #[doc = "Bits 16:17 - Response Type Select"]
347    #[inline(always)]
348    pub fn rsptyp(&self) -> RsptypR {
349        RsptypR::new(((self.bits >> 16) & 3) as u8)
350    }
351    #[doc = "Bit 19 - Command CRC Check Enable"]
352    #[inline(always)]
353    pub fn cccen(&self) -> CccenR {
354        CccenR::new(((self.bits >> 19) & 1) != 0)
355    }
356    #[doc = "Bit 20 - Command Index Check Enable"]
357    #[inline(always)]
358    pub fn cicen(&self) -> CicenR {
359        CicenR::new(((self.bits >> 20) & 1) != 0)
360    }
361    #[doc = "Bit 21 - Data Present Select"]
362    #[inline(always)]
363    pub fn dpsel(&self) -> DpselR {
364        DpselR::new(((self.bits >> 21) & 1) != 0)
365    }
366    #[doc = "Bits 22:23 - Command Type"]
367    #[inline(always)]
368    pub fn cmdtyp(&self) -> CmdtypR {
369        CmdtypR::new(((self.bits >> 22) & 3) as u8)
370    }
371    #[doc = "Bits 24:29 - Command Index"]
372    #[inline(always)]
373    pub fn cmdinx(&self) -> CmdinxR {
374        CmdinxR::new(((self.bits >> 24) & 0x3f) as u8)
375    }
376}
377#[cfg(feature = "debug")]
378impl core::fmt::Debug for R {
379    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
380        f.debug_struct("CMD_XFR_TYP")
381            .field("rsptyp", &self.rsptyp())
382            .field("cccen", &self.cccen())
383            .field("cicen", &self.cicen())
384            .field("dpsel", &self.dpsel())
385            .field("cmdtyp", &self.cmdtyp())
386            .field("cmdinx", &self.cmdinx())
387            .finish()
388    }
389}
390impl W {
391    #[doc = "Bits 16:17 - Response Type Select"]
392    #[inline(always)]
393    pub fn rsptyp(&mut self) -> RsptypW<CmdXfrTypSpec> {
394        RsptypW::new(self, 16)
395    }
396    #[doc = "Bit 19 - Command CRC Check Enable"]
397    #[inline(always)]
398    pub fn cccen(&mut self) -> CccenW<CmdXfrTypSpec> {
399        CccenW::new(self, 19)
400    }
401    #[doc = "Bit 20 - Command Index Check Enable"]
402    #[inline(always)]
403    pub fn cicen(&mut self) -> CicenW<CmdXfrTypSpec> {
404        CicenW::new(self, 20)
405    }
406    #[doc = "Bit 21 - Data Present Select"]
407    #[inline(always)]
408    pub fn dpsel(&mut self) -> DpselW<CmdXfrTypSpec> {
409        DpselW::new(self, 21)
410    }
411    #[doc = "Bits 22:23 - Command Type"]
412    #[inline(always)]
413    pub fn cmdtyp(&mut self) -> CmdtypW<CmdXfrTypSpec> {
414        CmdtypW::new(self, 22)
415    }
416    #[doc = "Bits 24:29 - Command Index"]
417    #[inline(always)]
418    pub fn cmdinx(&mut self) -> CmdinxW<CmdXfrTypSpec> {
419        CmdinxW::new(self, 24)
420    }
421}
422#[doc = "Command Transfer Type\n\nYou can [`read`](crate::Reg::read) this register and get [`cmd_xfr_typ::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`cmd_xfr_typ::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
423pub struct CmdXfrTypSpec;
424impl crate::RegisterSpec for CmdXfrTypSpec {
425    type Ux = u32;
426}
427#[doc = "`read()` method returns [`cmd_xfr_typ::R`](R) reader structure"]
428impl crate::Readable for CmdXfrTypSpec {}
429#[doc = "`write(|w| ..)` method takes [`cmd_xfr_typ::W`](W) writer structure"]
430impl crate::Writable for CmdXfrTypSpec {
431    type Safety = crate::Unsafe;
432    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
433    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
434}
435#[doc = "`reset()` method sets CMD_XFR_TYP to value 0"]
436impl crate::Resettable for CmdXfrTypSpec {
437    const RESET_VALUE: u32 = 0;
438}