atsamd51p/sdhc0/
nistr_emmc_mode.rs

1#[doc = "Register `NISTR_EMMC_MODE` reader"]
2pub type R = crate::R<NistrEmmcModeSpec>;
3#[doc = "Register `NISTR_EMMC_MODE` writer"]
4pub type W = crate::W<NistrEmmcModeSpec>;
5#[doc = "Command Complete\n\nValue on reset: 0"]
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7pub enum Cmdcselect {
8    #[doc = "0: No command complete"]
9    No = 0,
10    #[doc = "1: Command complete"]
11    Yes = 1,
12}
13impl From<Cmdcselect> for bool {
14    #[inline(always)]
15    fn from(variant: Cmdcselect) -> Self {
16        variant as u8 != 0
17    }
18}
19#[doc = "Field `CMDC` reader - Command Complete"]
20pub type CmdcR = crate::BitReader<Cmdcselect>;
21impl CmdcR {
22    #[doc = "Get enumerated values variant"]
23    #[inline(always)]
24    pub const fn variant(&self) -> Cmdcselect {
25        match self.bits {
26            false => Cmdcselect::No,
27            true => Cmdcselect::Yes,
28        }
29    }
30    #[doc = "No command complete"]
31    #[inline(always)]
32    pub fn is_no(&self) -> bool {
33        *self == Cmdcselect::No
34    }
35    #[doc = "Command complete"]
36    #[inline(always)]
37    pub fn is_yes(&self) -> bool {
38        *self == Cmdcselect::Yes
39    }
40}
41#[doc = "Field `CMDC` writer - Command Complete"]
42pub type CmdcW<'a, REG> = crate::BitWriter<'a, REG, Cmdcselect>;
43impl<'a, REG> CmdcW<'a, REG>
44where
45    REG: crate::Writable + crate::RegisterSpec,
46{
47    #[doc = "No command complete"]
48    #[inline(always)]
49    pub fn no(self) -> &'a mut crate::W<REG> {
50        self.variant(Cmdcselect::No)
51    }
52    #[doc = "Command complete"]
53    #[inline(always)]
54    pub fn yes(self) -> &'a mut crate::W<REG> {
55        self.variant(Cmdcselect::Yes)
56    }
57}
58#[doc = "Transfer Complete\n\nValue on reset: 0"]
59#[derive(Clone, Copy, Debug, PartialEq, Eq)]
60pub enum Trfcselect {
61    #[doc = "0: Not complete"]
62    No = 0,
63    #[doc = "1: Command execution is completed"]
64    Yes = 1,
65}
66impl From<Trfcselect> for bool {
67    #[inline(always)]
68    fn from(variant: Trfcselect) -> Self {
69        variant as u8 != 0
70    }
71}
72#[doc = "Field `TRFC` reader - Transfer Complete"]
73pub type TrfcR = crate::BitReader<Trfcselect>;
74impl TrfcR {
75    #[doc = "Get enumerated values variant"]
76    #[inline(always)]
77    pub const fn variant(&self) -> Trfcselect {
78        match self.bits {
79            false => Trfcselect::No,
80            true => Trfcselect::Yes,
81        }
82    }
83    #[doc = "Not complete"]
84    #[inline(always)]
85    pub fn is_no(&self) -> bool {
86        *self == Trfcselect::No
87    }
88    #[doc = "Command execution is completed"]
89    #[inline(always)]
90    pub fn is_yes(&self) -> bool {
91        *self == Trfcselect::Yes
92    }
93}
94#[doc = "Field `TRFC` writer - Transfer Complete"]
95pub type TrfcW<'a, REG> = crate::BitWriter<'a, REG, Trfcselect>;
96impl<'a, REG> TrfcW<'a, REG>
97where
98    REG: crate::Writable + crate::RegisterSpec,
99{
100    #[doc = "Not complete"]
101    #[inline(always)]
102    pub fn no(self) -> &'a mut crate::W<REG> {
103        self.variant(Trfcselect::No)
104    }
105    #[doc = "Command execution is completed"]
106    #[inline(always)]
107    pub fn yes(self) -> &'a mut crate::W<REG> {
108        self.variant(Trfcselect::Yes)
109    }
110}
111#[doc = "Block Gap Event\n\nValue on reset: 0"]
112#[derive(Clone, Copy, Debug, PartialEq, Eq)]
113pub enum Blkgeselect {
114    #[doc = "0: No Block Gap Event"]
115    No = 0,
116    #[doc = "1: Transaction stopped at block gap"]
117    Stop = 1,
118}
119impl From<Blkgeselect> for bool {
120    #[inline(always)]
121    fn from(variant: Blkgeselect) -> Self {
122        variant as u8 != 0
123    }
124}
125#[doc = "Field `BLKGE` reader - Block Gap Event"]
126pub type BlkgeR = crate::BitReader<Blkgeselect>;
127impl BlkgeR {
128    #[doc = "Get enumerated values variant"]
129    #[inline(always)]
130    pub const fn variant(&self) -> Blkgeselect {
131        match self.bits {
132            false => Blkgeselect::No,
133            true => Blkgeselect::Stop,
134        }
135    }
136    #[doc = "No Block Gap Event"]
137    #[inline(always)]
138    pub fn is_no(&self) -> bool {
139        *self == Blkgeselect::No
140    }
141    #[doc = "Transaction stopped at block gap"]
142    #[inline(always)]
143    pub fn is_stop(&self) -> bool {
144        *self == Blkgeselect::Stop
145    }
146}
147#[doc = "Field `BLKGE` writer - Block Gap Event"]
148pub type BlkgeW<'a, REG> = crate::BitWriter<'a, REG, Blkgeselect>;
149impl<'a, REG> BlkgeW<'a, REG>
150where
151    REG: crate::Writable + crate::RegisterSpec,
152{
153    #[doc = "No Block Gap Event"]
154    #[inline(always)]
155    pub fn no(self) -> &'a mut crate::W<REG> {
156        self.variant(Blkgeselect::No)
157    }
158    #[doc = "Transaction stopped at block gap"]
159    #[inline(always)]
160    pub fn stop(self) -> &'a mut crate::W<REG> {
161        self.variant(Blkgeselect::Stop)
162    }
163}
164#[doc = "DMA Interrupt\n\nValue on reset: 0"]
165#[derive(Clone, Copy, Debug, PartialEq, Eq)]
166pub enum Dmaintselect {
167    #[doc = "0: No DMA Interrupt"]
168    No = 0,
169    #[doc = "1: DMA Interrupt is generated"]
170    Yes = 1,
171}
172impl From<Dmaintselect> for bool {
173    #[inline(always)]
174    fn from(variant: Dmaintselect) -> Self {
175        variant as u8 != 0
176    }
177}
178#[doc = "Field `DMAINT` reader - DMA Interrupt"]
179pub type DmaintR = crate::BitReader<Dmaintselect>;
180impl DmaintR {
181    #[doc = "Get enumerated values variant"]
182    #[inline(always)]
183    pub const fn variant(&self) -> Dmaintselect {
184        match self.bits {
185            false => Dmaintselect::No,
186            true => Dmaintselect::Yes,
187        }
188    }
189    #[doc = "No DMA Interrupt"]
190    #[inline(always)]
191    pub fn is_no(&self) -> bool {
192        *self == Dmaintselect::No
193    }
194    #[doc = "DMA Interrupt is generated"]
195    #[inline(always)]
196    pub fn is_yes(&self) -> bool {
197        *self == Dmaintselect::Yes
198    }
199}
200#[doc = "Field `DMAINT` writer - DMA Interrupt"]
201pub type DmaintW<'a, REG> = crate::BitWriter<'a, REG, Dmaintselect>;
202impl<'a, REG> DmaintW<'a, REG>
203where
204    REG: crate::Writable + crate::RegisterSpec,
205{
206    #[doc = "No DMA Interrupt"]
207    #[inline(always)]
208    pub fn no(self) -> &'a mut crate::W<REG> {
209        self.variant(Dmaintselect::No)
210    }
211    #[doc = "DMA Interrupt is generated"]
212    #[inline(always)]
213    pub fn yes(self) -> &'a mut crate::W<REG> {
214        self.variant(Dmaintselect::Yes)
215    }
216}
217#[doc = "Buffer Write Ready\n\nValue on reset: 0"]
218#[derive(Clone, Copy, Debug, PartialEq, Eq)]
219pub enum Bwrrdyselect {
220    #[doc = "0: Not ready to write buffer"]
221    No = 0,
222    #[doc = "1: Ready to write buffer"]
223    Yes = 1,
224}
225impl From<Bwrrdyselect> for bool {
226    #[inline(always)]
227    fn from(variant: Bwrrdyselect) -> Self {
228        variant as u8 != 0
229    }
230}
231#[doc = "Field `BWRRDY` reader - Buffer Write Ready"]
232pub type BwrrdyR = crate::BitReader<Bwrrdyselect>;
233impl BwrrdyR {
234    #[doc = "Get enumerated values variant"]
235    #[inline(always)]
236    pub const fn variant(&self) -> Bwrrdyselect {
237        match self.bits {
238            false => Bwrrdyselect::No,
239            true => Bwrrdyselect::Yes,
240        }
241    }
242    #[doc = "Not ready to write buffer"]
243    #[inline(always)]
244    pub fn is_no(&self) -> bool {
245        *self == Bwrrdyselect::No
246    }
247    #[doc = "Ready to write buffer"]
248    #[inline(always)]
249    pub fn is_yes(&self) -> bool {
250        *self == Bwrrdyselect::Yes
251    }
252}
253#[doc = "Field `BWRRDY` writer - Buffer Write Ready"]
254pub type BwrrdyW<'a, REG> = crate::BitWriter<'a, REG, Bwrrdyselect>;
255impl<'a, REG> BwrrdyW<'a, REG>
256where
257    REG: crate::Writable + crate::RegisterSpec,
258{
259    #[doc = "Not ready to write buffer"]
260    #[inline(always)]
261    pub fn no(self) -> &'a mut crate::W<REG> {
262        self.variant(Bwrrdyselect::No)
263    }
264    #[doc = "Ready to write buffer"]
265    #[inline(always)]
266    pub fn yes(self) -> &'a mut crate::W<REG> {
267        self.variant(Bwrrdyselect::Yes)
268    }
269}
270#[doc = "Buffer Read Ready\n\nValue on reset: 0"]
271#[derive(Clone, Copy, Debug, PartialEq, Eq)]
272pub enum Brdrdyselect {
273    #[doc = "0: Not ready to read buffer"]
274    No = 0,
275    #[doc = "1: Ready to read buffer"]
276    Yes = 1,
277}
278impl From<Brdrdyselect> for bool {
279    #[inline(always)]
280    fn from(variant: Brdrdyselect) -> Self {
281        variant as u8 != 0
282    }
283}
284#[doc = "Field `BRDRDY` reader - Buffer Read Ready"]
285pub type BrdrdyR = crate::BitReader<Brdrdyselect>;
286impl BrdrdyR {
287    #[doc = "Get enumerated values variant"]
288    #[inline(always)]
289    pub const fn variant(&self) -> Brdrdyselect {
290        match self.bits {
291            false => Brdrdyselect::No,
292            true => Brdrdyselect::Yes,
293        }
294    }
295    #[doc = "Not ready to read buffer"]
296    #[inline(always)]
297    pub fn is_no(&self) -> bool {
298        *self == Brdrdyselect::No
299    }
300    #[doc = "Ready to read buffer"]
301    #[inline(always)]
302    pub fn is_yes(&self) -> bool {
303        *self == Brdrdyselect::Yes
304    }
305}
306#[doc = "Field `BRDRDY` writer - Buffer Read Ready"]
307pub type BrdrdyW<'a, REG> = crate::BitWriter<'a, REG, Brdrdyselect>;
308impl<'a, REG> BrdrdyW<'a, REG>
309where
310    REG: crate::Writable + crate::RegisterSpec,
311{
312    #[doc = "Not ready to read buffer"]
313    #[inline(always)]
314    pub fn no(self) -> &'a mut crate::W<REG> {
315        self.variant(Brdrdyselect::No)
316    }
317    #[doc = "Ready to read buffer"]
318    #[inline(always)]
319    pub fn yes(self) -> &'a mut crate::W<REG> {
320        self.variant(Brdrdyselect::Yes)
321    }
322}
323#[doc = "Field `BOOTAR` reader - Boot Acknowledge Received"]
324pub type BootarR = crate::BitReader;
325#[doc = "Field `BOOTAR` writer - Boot Acknowledge Received"]
326pub type BootarW<'a, REG> = crate::BitWriter<'a, REG>;
327#[doc = "Error Interrupt\n\nValue on reset: 0"]
328#[derive(Clone, Copy, Debug, PartialEq, Eq)]
329pub enum Errintselect {
330    #[doc = "0: No Error"]
331    No = 0,
332    #[doc = "1: Error"]
333    Yes = 1,
334}
335impl From<Errintselect> for bool {
336    #[inline(always)]
337    fn from(variant: Errintselect) -> Self {
338        variant as u8 != 0
339    }
340}
341#[doc = "Field `ERRINT` reader - Error Interrupt"]
342pub type ErrintR = crate::BitReader<Errintselect>;
343impl ErrintR {
344    #[doc = "Get enumerated values variant"]
345    #[inline(always)]
346    pub const fn variant(&self) -> Errintselect {
347        match self.bits {
348            false => Errintselect::No,
349            true => Errintselect::Yes,
350        }
351    }
352    #[doc = "No Error"]
353    #[inline(always)]
354    pub fn is_no(&self) -> bool {
355        *self == Errintselect::No
356    }
357    #[doc = "Error"]
358    #[inline(always)]
359    pub fn is_yes(&self) -> bool {
360        *self == Errintselect::Yes
361    }
362}
363#[doc = "Field `ERRINT` writer - Error Interrupt"]
364pub type ErrintW<'a, REG> = crate::BitWriter<'a, REG, Errintselect>;
365impl<'a, REG> ErrintW<'a, REG>
366where
367    REG: crate::Writable + crate::RegisterSpec,
368{
369    #[doc = "No Error"]
370    #[inline(always)]
371    pub fn no(self) -> &'a mut crate::W<REG> {
372        self.variant(Errintselect::No)
373    }
374    #[doc = "Error"]
375    #[inline(always)]
376    pub fn yes(self) -> &'a mut crate::W<REG> {
377        self.variant(Errintselect::Yes)
378    }
379}
380impl R {
381    #[doc = "Bit 0 - Command Complete"]
382    #[inline(always)]
383    pub fn cmdc(&self) -> CmdcR {
384        CmdcR::new((self.bits & 1) != 0)
385    }
386    #[doc = "Bit 1 - Transfer Complete"]
387    #[inline(always)]
388    pub fn trfc(&self) -> TrfcR {
389        TrfcR::new(((self.bits >> 1) & 1) != 0)
390    }
391    #[doc = "Bit 2 - Block Gap Event"]
392    #[inline(always)]
393    pub fn blkge(&self) -> BlkgeR {
394        BlkgeR::new(((self.bits >> 2) & 1) != 0)
395    }
396    #[doc = "Bit 3 - DMA Interrupt"]
397    #[inline(always)]
398    pub fn dmaint(&self) -> DmaintR {
399        DmaintR::new(((self.bits >> 3) & 1) != 0)
400    }
401    #[doc = "Bit 4 - Buffer Write Ready"]
402    #[inline(always)]
403    pub fn bwrrdy(&self) -> BwrrdyR {
404        BwrrdyR::new(((self.bits >> 4) & 1) != 0)
405    }
406    #[doc = "Bit 5 - Buffer Read Ready"]
407    #[inline(always)]
408    pub fn brdrdy(&self) -> BrdrdyR {
409        BrdrdyR::new(((self.bits >> 5) & 1) != 0)
410    }
411    #[doc = "Bit 14 - Boot Acknowledge Received"]
412    #[inline(always)]
413    pub fn bootar(&self) -> BootarR {
414        BootarR::new(((self.bits >> 14) & 1) != 0)
415    }
416    #[doc = "Bit 15 - Error Interrupt"]
417    #[inline(always)]
418    pub fn errint(&self) -> ErrintR {
419        ErrintR::new(((self.bits >> 15) & 1) != 0)
420    }
421}
422impl W {
423    #[doc = "Bit 0 - Command Complete"]
424    #[inline(always)]
425    #[must_use]
426    pub fn cmdc(&mut self) -> CmdcW<NistrEmmcModeSpec> {
427        CmdcW::new(self, 0)
428    }
429    #[doc = "Bit 1 - Transfer Complete"]
430    #[inline(always)]
431    #[must_use]
432    pub fn trfc(&mut self) -> TrfcW<NistrEmmcModeSpec> {
433        TrfcW::new(self, 1)
434    }
435    #[doc = "Bit 2 - Block Gap Event"]
436    #[inline(always)]
437    #[must_use]
438    pub fn blkge(&mut self) -> BlkgeW<NistrEmmcModeSpec> {
439        BlkgeW::new(self, 2)
440    }
441    #[doc = "Bit 3 - DMA Interrupt"]
442    #[inline(always)]
443    #[must_use]
444    pub fn dmaint(&mut self) -> DmaintW<NistrEmmcModeSpec> {
445        DmaintW::new(self, 3)
446    }
447    #[doc = "Bit 4 - Buffer Write Ready"]
448    #[inline(always)]
449    #[must_use]
450    pub fn bwrrdy(&mut self) -> BwrrdyW<NistrEmmcModeSpec> {
451        BwrrdyW::new(self, 4)
452    }
453    #[doc = "Bit 5 - Buffer Read Ready"]
454    #[inline(always)]
455    #[must_use]
456    pub fn brdrdy(&mut self) -> BrdrdyW<NistrEmmcModeSpec> {
457        BrdrdyW::new(self, 5)
458    }
459    #[doc = "Bit 14 - Boot Acknowledge Received"]
460    #[inline(always)]
461    #[must_use]
462    pub fn bootar(&mut self) -> BootarW<NistrEmmcModeSpec> {
463        BootarW::new(self, 14)
464    }
465    #[doc = "Bit 15 - Error Interrupt"]
466    #[inline(always)]
467    #[must_use]
468    pub fn errint(&mut self) -> ErrintW<NistrEmmcModeSpec> {
469        ErrintW::new(self, 15)
470    }
471}
472#[doc = "Normal Interrupt Status\n\nYou can [`read`](crate::Reg::read) this register and get [`nistr_emmc_mode::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`nistr_emmc_mode::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
473pub struct NistrEmmcModeSpec;
474impl crate::RegisterSpec for NistrEmmcModeSpec {
475    type Ux = u16;
476}
477#[doc = "`read()` method returns [`nistr_emmc_mode::R`](R) reader structure"]
478impl crate::Readable for NistrEmmcModeSpec {}
479#[doc = "`write(|w| ..)` method takes [`nistr_emmc_mode::W`](W) writer structure"]
480impl crate::Writable for NistrEmmcModeSpec {
481    type Safety = crate::Unsafe;
482    const ZERO_TO_MODIFY_FIELDS_BITMAP: u16 = 0;
483    const ONE_TO_MODIFY_FIELDS_BITMAP: u16 = 0;
484}
485#[doc = "`reset()` method sets NISTR_EMMC_MODE to value 0"]
486impl crate::Resettable for NistrEmmcModeSpec {
487    const RESET_VALUE: u16 = 0;
488}