atsamd51p/sdhc0/
cr.rs

1#[doc = "Register `CR` reader"]
2pub type R = crate::R<CrSpec>;
3#[doc = "Register `CR` writer"]
4pub type W = crate::W<CrSpec>;
5#[doc = "Response Type\n\nValue on reset: 0"]
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7#[repr(u8)]
8pub enum Resptypselect {
9    #[doc = "0: No response"]
10    None = 0,
11    #[doc = "1: 136-bit response"]
12    _136Bit = 1,
13    #[doc = "2: 48-bit response"]
14    _48Bit = 2,
15    #[doc = "3: 48-bit response check busy after response"]
16    _48BitBusy = 3,
17}
18impl From<Resptypselect> for u8 {
19    #[inline(always)]
20    fn from(variant: Resptypselect) -> Self {
21        variant as _
22    }
23}
24impl crate::FieldSpec for Resptypselect {
25    type Ux = u8;
26}
27impl crate::IsEnum for Resptypselect {}
28#[doc = "Field `RESPTYP` reader - Response Type"]
29pub type ResptypR = crate::FieldReader<Resptypselect>;
30impl ResptypR {
31    #[doc = "Get enumerated values variant"]
32    #[inline(always)]
33    pub const fn variant(&self) -> Resptypselect {
34        match self.bits {
35            0 => Resptypselect::None,
36            1 => Resptypselect::_136Bit,
37            2 => Resptypselect::_48Bit,
38            3 => Resptypselect::_48BitBusy,
39            _ => unreachable!(),
40        }
41    }
42    #[doc = "No response"]
43    #[inline(always)]
44    pub fn is_none(&self) -> bool {
45        *self == Resptypselect::None
46    }
47    #[doc = "136-bit response"]
48    #[inline(always)]
49    pub fn is_136_bit(&self) -> bool {
50        *self == Resptypselect::_136Bit
51    }
52    #[doc = "48-bit response"]
53    #[inline(always)]
54    pub fn is_48_bit(&self) -> bool {
55        *self == Resptypselect::_48Bit
56    }
57    #[doc = "48-bit response check busy after response"]
58    #[inline(always)]
59    pub fn is_48_bit_busy(&self) -> bool {
60        *self == Resptypselect::_48BitBusy
61    }
62}
63#[doc = "Field `RESPTYP` writer - Response Type"]
64pub type ResptypW<'a, REG> = crate::FieldWriter<'a, REG, 2, Resptypselect, crate::Safe>;
65impl<'a, REG> ResptypW<'a, REG>
66where
67    REG: crate::Writable + crate::RegisterSpec,
68    REG::Ux: From<u8>,
69{
70    #[doc = "No response"]
71    #[inline(always)]
72    pub fn none(self) -> &'a mut crate::W<REG> {
73        self.variant(Resptypselect::None)
74    }
75    #[doc = "136-bit response"]
76    #[inline(always)]
77    pub fn _136_bit(self) -> &'a mut crate::W<REG> {
78        self.variant(Resptypselect::_136Bit)
79    }
80    #[doc = "48-bit response"]
81    #[inline(always)]
82    pub fn _48_bit(self) -> &'a mut crate::W<REG> {
83        self.variant(Resptypselect::_48Bit)
84    }
85    #[doc = "48-bit response check busy after response"]
86    #[inline(always)]
87    pub fn _48_bit_busy(self) -> &'a mut crate::W<REG> {
88        self.variant(Resptypselect::_48BitBusy)
89    }
90}
91#[doc = "Command CRC Check Enable\n\nValue on reset: 0"]
92#[derive(Clone, Copy, Debug, PartialEq, Eq)]
93pub enum Cmdccenselect {
94    #[doc = "0: Disable"]
95    Disable = 0,
96    #[doc = "1: Enable"]
97    Enable = 1,
98}
99impl From<Cmdccenselect> for bool {
100    #[inline(always)]
101    fn from(variant: Cmdccenselect) -> Self {
102        variant as u8 != 0
103    }
104}
105#[doc = "Field `CMDCCEN` reader - Command CRC Check Enable"]
106pub type CmdccenR = crate::BitReader<Cmdccenselect>;
107impl CmdccenR {
108    #[doc = "Get enumerated values variant"]
109    #[inline(always)]
110    pub const fn variant(&self) -> Cmdccenselect {
111        match self.bits {
112            false => Cmdccenselect::Disable,
113            true => Cmdccenselect::Enable,
114        }
115    }
116    #[doc = "Disable"]
117    #[inline(always)]
118    pub fn is_disable(&self) -> bool {
119        *self == Cmdccenselect::Disable
120    }
121    #[doc = "Enable"]
122    #[inline(always)]
123    pub fn is_enable(&self) -> bool {
124        *self == Cmdccenselect::Enable
125    }
126}
127#[doc = "Field `CMDCCEN` writer - Command CRC Check Enable"]
128pub type CmdccenW<'a, REG> = crate::BitWriter<'a, REG, Cmdccenselect>;
129impl<'a, REG> CmdccenW<'a, REG>
130where
131    REG: crate::Writable + crate::RegisterSpec,
132{
133    #[doc = "Disable"]
134    #[inline(always)]
135    pub fn disable(self) -> &'a mut crate::W<REG> {
136        self.variant(Cmdccenselect::Disable)
137    }
138    #[doc = "Enable"]
139    #[inline(always)]
140    pub fn enable(self) -> &'a mut crate::W<REG> {
141        self.variant(Cmdccenselect::Enable)
142    }
143}
144#[doc = "Command Index Check Enable\n\nValue on reset: 0"]
145#[derive(Clone, Copy, Debug, PartialEq, Eq)]
146pub enum Cmdicenselect {
147    #[doc = "0: Disable"]
148    Disable = 0,
149    #[doc = "1: Enable"]
150    Enable = 1,
151}
152impl From<Cmdicenselect> for bool {
153    #[inline(always)]
154    fn from(variant: Cmdicenselect) -> Self {
155        variant as u8 != 0
156    }
157}
158#[doc = "Field `CMDICEN` reader - Command Index Check Enable"]
159pub type CmdicenR = crate::BitReader<Cmdicenselect>;
160impl CmdicenR {
161    #[doc = "Get enumerated values variant"]
162    #[inline(always)]
163    pub const fn variant(&self) -> Cmdicenselect {
164        match self.bits {
165            false => Cmdicenselect::Disable,
166            true => Cmdicenselect::Enable,
167        }
168    }
169    #[doc = "Disable"]
170    #[inline(always)]
171    pub fn is_disable(&self) -> bool {
172        *self == Cmdicenselect::Disable
173    }
174    #[doc = "Enable"]
175    #[inline(always)]
176    pub fn is_enable(&self) -> bool {
177        *self == Cmdicenselect::Enable
178    }
179}
180#[doc = "Field `CMDICEN` writer - Command Index Check Enable"]
181pub type CmdicenW<'a, REG> = crate::BitWriter<'a, REG, Cmdicenselect>;
182impl<'a, REG> CmdicenW<'a, REG>
183where
184    REG: crate::Writable + crate::RegisterSpec,
185{
186    #[doc = "Disable"]
187    #[inline(always)]
188    pub fn disable(self) -> &'a mut crate::W<REG> {
189        self.variant(Cmdicenselect::Disable)
190    }
191    #[doc = "Enable"]
192    #[inline(always)]
193    pub fn enable(self) -> &'a mut crate::W<REG> {
194        self.variant(Cmdicenselect::Enable)
195    }
196}
197#[doc = "Data Present Select\n\nValue on reset: 0"]
198#[derive(Clone, Copy, Debug, PartialEq, Eq)]
199pub enum Dpselselect {
200    #[doc = "0: No Data Present"]
201    NoData = 0,
202    #[doc = "1: Data Present"]
203    Data = 1,
204}
205impl From<Dpselselect> for bool {
206    #[inline(always)]
207    fn from(variant: Dpselselect) -> Self {
208        variant as u8 != 0
209    }
210}
211#[doc = "Field `DPSEL` reader - Data Present Select"]
212pub type DpselR = crate::BitReader<Dpselselect>;
213impl DpselR {
214    #[doc = "Get enumerated values variant"]
215    #[inline(always)]
216    pub const fn variant(&self) -> Dpselselect {
217        match self.bits {
218            false => Dpselselect::NoData,
219            true => Dpselselect::Data,
220        }
221    }
222    #[doc = "No Data Present"]
223    #[inline(always)]
224    pub fn is_no_data(&self) -> bool {
225        *self == Dpselselect::NoData
226    }
227    #[doc = "Data Present"]
228    #[inline(always)]
229    pub fn is_data(&self) -> bool {
230        *self == Dpselselect::Data
231    }
232}
233#[doc = "Field `DPSEL` writer - Data Present Select"]
234pub type DpselW<'a, REG> = crate::BitWriter<'a, REG, Dpselselect>;
235impl<'a, REG> DpselW<'a, REG>
236where
237    REG: crate::Writable + crate::RegisterSpec,
238{
239    #[doc = "No Data Present"]
240    #[inline(always)]
241    pub fn no_data(self) -> &'a mut crate::W<REG> {
242        self.variant(Dpselselect::NoData)
243    }
244    #[doc = "Data Present"]
245    #[inline(always)]
246    pub fn data(self) -> &'a mut crate::W<REG> {
247        self.variant(Dpselselect::Data)
248    }
249}
250#[doc = "Command Type\n\nValue on reset: 0"]
251#[derive(Clone, Copy, Debug, PartialEq, Eq)]
252#[repr(u8)]
253pub enum Cmdtypselect {
254    #[doc = "0: Other commands"]
255    Normal = 0,
256    #[doc = "1: CMD52 for writing Bus Suspend in CCCR"]
257    Suspend = 1,
258    #[doc = "2: CMD52 for writing Function Select in CCCR"]
259    Resume = 2,
260    #[doc = "3: CMD12, CMD52 for writing I/O Abort in CCCR"]
261    Abort = 3,
262}
263impl From<Cmdtypselect> for u8 {
264    #[inline(always)]
265    fn from(variant: Cmdtypselect) -> Self {
266        variant as _
267    }
268}
269impl crate::FieldSpec for Cmdtypselect {
270    type Ux = u8;
271}
272impl crate::IsEnum for Cmdtypselect {}
273#[doc = "Field `CMDTYP` reader - Command Type"]
274pub type CmdtypR = crate::FieldReader<Cmdtypselect>;
275impl CmdtypR {
276    #[doc = "Get enumerated values variant"]
277    #[inline(always)]
278    pub const fn variant(&self) -> Cmdtypselect {
279        match self.bits {
280            0 => Cmdtypselect::Normal,
281            1 => Cmdtypselect::Suspend,
282            2 => Cmdtypselect::Resume,
283            3 => Cmdtypselect::Abort,
284            _ => unreachable!(),
285        }
286    }
287    #[doc = "Other commands"]
288    #[inline(always)]
289    pub fn is_normal(&self) -> bool {
290        *self == Cmdtypselect::Normal
291    }
292    #[doc = "CMD52 for writing Bus Suspend in CCCR"]
293    #[inline(always)]
294    pub fn is_suspend(&self) -> bool {
295        *self == Cmdtypselect::Suspend
296    }
297    #[doc = "CMD52 for writing Function Select in CCCR"]
298    #[inline(always)]
299    pub fn is_resume(&self) -> bool {
300        *self == Cmdtypselect::Resume
301    }
302    #[doc = "CMD12, CMD52 for writing I/O Abort in CCCR"]
303    #[inline(always)]
304    pub fn is_abort(&self) -> bool {
305        *self == Cmdtypselect::Abort
306    }
307}
308#[doc = "Field `CMDTYP` writer - Command Type"]
309pub type CmdtypW<'a, REG> = crate::FieldWriter<'a, REG, 2, Cmdtypselect, crate::Safe>;
310impl<'a, REG> CmdtypW<'a, REG>
311where
312    REG: crate::Writable + crate::RegisterSpec,
313    REG::Ux: From<u8>,
314{
315    #[doc = "Other commands"]
316    #[inline(always)]
317    pub fn normal(self) -> &'a mut crate::W<REG> {
318        self.variant(Cmdtypselect::Normal)
319    }
320    #[doc = "CMD52 for writing Bus Suspend in CCCR"]
321    #[inline(always)]
322    pub fn suspend(self) -> &'a mut crate::W<REG> {
323        self.variant(Cmdtypselect::Suspend)
324    }
325    #[doc = "CMD52 for writing Function Select in CCCR"]
326    #[inline(always)]
327    pub fn resume(self) -> &'a mut crate::W<REG> {
328        self.variant(Cmdtypselect::Resume)
329    }
330    #[doc = "CMD12, CMD52 for writing I/O Abort in CCCR"]
331    #[inline(always)]
332    pub fn abort(self) -> &'a mut crate::W<REG> {
333        self.variant(Cmdtypselect::Abort)
334    }
335}
336#[doc = "Field `CMDIDX` reader - Command Index"]
337pub type CmdidxR = crate::FieldReader;
338#[doc = "Field `CMDIDX` writer - Command Index"]
339pub type CmdidxW<'a, REG> = crate::FieldWriter<'a, REG, 6>;
340impl R {
341    #[doc = "Bits 0:1 - Response Type"]
342    #[inline(always)]
343    pub fn resptyp(&self) -> ResptypR {
344        ResptypR::new((self.bits & 3) as u8)
345    }
346    #[doc = "Bit 3 - Command CRC Check Enable"]
347    #[inline(always)]
348    pub fn cmdccen(&self) -> CmdccenR {
349        CmdccenR::new(((self.bits >> 3) & 1) != 0)
350    }
351    #[doc = "Bit 4 - Command Index Check Enable"]
352    #[inline(always)]
353    pub fn cmdicen(&self) -> CmdicenR {
354        CmdicenR::new(((self.bits >> 4) & 1) != 0)
355    }
356    #[doc = "Bit 5 - Data Present Select"]
357    #[inline(always)]
358    pub fn dpsel(&self) -> DpselR {
359        DpselR::new(((self.bits >> 5) & 1) != 0)
360    }
361    #[doc = "Bits 6:7 - Command Type"]
362    #[inline(always)]
363    pub fn cmdtyp(&self) -> CmdtypR {
364        CmdtypR::new(((self.bits >> 6) & 3) as u8)
365    }
366    #[doc = "Bits 8:13 - Command Index"]
367    #[inline(always)]
368    pub fn cmdidx(&self) -> CmdidxR {
369        CmdidxR::new(((self.bits >> 8) & 0x3f) as u8)
370    }
371}
372impl W {
373    #[doc = "Bits 0:1 - Response Type"]
374    #[inline(always)]
375    #[must_use]
376    pub fn resptyp(&mut self) -> ResptypW<CrSpec> {
377        ResptypW::new(self, 0)
378    }
379    #[doc = "Bit 3 - Command CRC Check Enable"]
380    #[inline(always)]
381    #[must_use]
382    pub fn cmdccen(&mut self) -> CmdccenW<CrSpec> {
383        CmdccenW::new(self, 3)
384    }
385    #[doc = "Bit 4 - Command Index Check Enable"]
386    #[inline(always)]
387    #[must_use]
388    pub fn cmdicen(&mut self) -> CmdicenW<CrSpec> {
389        CmdicenW::new(self, 4)
390    }
391    #[doc = "Bit 5 - Data Present Select"]
392    #[inline(always)]
393    #[must_use]
394    pub fn dpsel(&mut self) -> DpselW<CrSpec> {
395        DpselW::new(self, 5)
396    }
397    #[doc = "Bits 6:7 - Command Type"]
398    #[inline(always)]
399    #[must_use]
400    pub fn cmdtyp(&mut self) -> CmdtypW<CrSpec> {
401        CmdtypW::new(self, 6)
402    }
403    #[doc = "Bits 8:13 - Command Index"]
404    #[inline(always)]
405    #[must_use]
406    pub fn cmdidx(&mut self) -> CmdidxW<CrSpec> {
407        CmdidxW::new(self, 8)
408    }
409}
410#[doc = "Command\n\nYou can [`read`](crate::Reg::read) this register and get [`cr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`cr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
411pub struct CrSpec;
412impl crate::RegisterSpec for CrSpec {
413    type Ux = u16;
414}
415#[doc = "`read()` method returns [`cr::R`](R) reader structure"]
416impl crate::Readable for CrSpec {}
417#[doc = "`write(|w| ..)` method takes [`cr::W`](W) writer structure"]
418impl crate::Writable for CrSpec {
419    type Safety = crate::Unsafe;
420    const ZERO_TO_MODIFY_FIELDS_BITMAP: u16 = 0;
421    const ONE_TO_MODIFY_FIELDS_BITMAP: u16 = 0;
422}
423#[doc = "`reset()` method sets CR to value 0"]
424impl crate::Resettable for CrSpec {
425    const RESET_VALUE: u16 = 0;
426}