atsamd51p/sdhc0/
psr.rs

1#[doc = "Register `PSR` reader"]
2pub type R = crate::R<PsrSpec>;
3#[doc = "Command Inhibit (CMD)\n\nValue on reset: 0"]
4#[derive(Clone, Copy, Debug, PartialEq, Eq)]
5pub enum Cmdinhcselect {
6    #[doc = "0: Can issue command using only CMD line"]
7    Can = 0,
8    #[doc = "1: Cannot issue command"]
9    Cannot = 1,
10}
11impl From<Cmdinhcselect> for bool {
12    #[inline(always)]
13    fn from(variant: Cmdinhcselect) -> Self {
14        variant as u8 != 0
15    }
16}
17#[doc = "Field `CMDINHC` reader - Command Inhibit (CMD)"]
18pub type CmdinhcR = crate::BitReader<Cmdinhcselect>;
19impl CmdinhcR {
20    #[doc = "Get enumerated values variant"]
21    #[inline(always)]
22    pub const fn variant(&self) -> Cmdinhcselect {
23        match self.bits {
24            false => Cmdinhcselect::Can,
25            true => Cmdinhcselect::Cannot,
26        }
27    }
28    #[doc = "Can issue command using only CMD line"]
29    #[inline(always)]
30    pub fn is_can(&self) -> bool {
31        *self == Cmdinhcselect::Can
32    }
33    #[doc = "Cannot issue command"]
34    #[inline(always)]
35    pub fn is_cannot(&self) -> bool {
36        *self == Cmdinhcselect::Cannot
37    }
38}
39#[doc = "Command Inhibit (DAT)\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub enum Cmdinhdselect {
42    #[doc = "0: Can issue command which uses the DAT line"]
43    Can = 0,
44    #[doc = "1: Cannot issue command which uses the DAT line"]
45    Cannot = 1,
46}
47impl From<Cmdinhdselect> for bool {
48    #[inline(always)]
49    fn from(variant: Cmdinhdselect) -> Self {
50        variant as u8 != 0
51    }
52}
53#[doc = "Field `CMDINHD` reader - Command Inhibit (DAT)"]
54pub type CmdinhdR = crate::BitReader<Cmdinhdselect>;
55impl CmdinhdR {
56    #[doc = "Get enumerated values variant"]
57    #[inline(always)]
58    pub const fn variant(&self) -> Cmdinhdselect {
59        match self.bits {
60            false => Cmdinhdselect::Can,
61            true => Cmdinhdselect::Cannot,
62        }
63    }
64    #[doc = "Can issue command which uses the DAT line"]
65    #[inline(always)]
66    pub fn is_can(&self) -> bool {
67        *self == Cmdinhdselect::Can
68    }
69    #[doc = "Cannot issue command which uses the DAT line"]
70    #[inline(always)]
71    pub fn is_cannot(&self) -> bool {
72        *self == Cmdinhdselect::Cannot
73    }
74}
75#[doc = "DAT Line Active\n\nValue on reset: 0"]
76#[derive(Clone, Copy, Debug, PartialEq, Eq)]
77pub enum Dlactselect {
78    #[doc = "0: DAT Line Inactive"]
79    Inactive = 0,
80    #[doc = "1: DAT Line Active"]
81    Active = 1,
82}
83impl From<Dlactselect> for bool {
84    #[inline(always)]
85    fn from(variant: Dlactselect) -> Self {
86        variant as u8 != 0
87    }
88}
89#[doc = "Field `DLACT` reader - DAT Line Active"]
90pub type DlactR = crate::BitReader<Dlactselect>;
91impl DlactR {
92    #[doc = "Get enumerated values variant"]
93    #[inline(always)]
94    pub const fn variant(&self) -> Dlactselect {
95        match self.bits {
96            false => Dlactselect::Inactive,
97            true => Dlactselect::Active,
98        }
99    }
100    #[doc = "DAT Line Inactive"]
101    #[inline(always)]
102    pub fn is_inactive(&self) -> bool {
103        *self == Dlactselect::Inactive
104    }
105    #[doc = "DAT Line Active"]
106    #[inline(always)]
107    pub fn is_active(&self) -> bool {
108        *self == Dlactselect::Active
109    }
110}
111#[doc = "Re-Tuning Request\n\nValue on reset: 0"]
112#[derive(Clone, Copy, Debug, PartialEq, Eq)]
113pub enum Rtreqselect {
114    #[doc = "0: Fixed or well-tuned sampling clock"]
115    Ok = 0,
116    #[doc = "1: Sampling clock needs re-tuning"]
117    Required = 1,
118}
119impl From<Rtreqselect> for bool {
120    #[inline(always)]
121    fn from(variant: Rtreqselect) -> Self {
122        variant as u8 != 0
123    }
124}
125#[doc = "Field `RTREQ` reader - Re-Tuning Request"]
126pub type RtreqR = crate::BitReader<Rtreqselect>;
127impl RtreqR {
128    #[doc = "Get enumerated values variant"]
129    #[inline(always)]
130    pub const fn variant(&self) -> Rtreqselect {
131        match self.bits {
132            false => Rtreqselect::Ok,
133            true => Rtreqselect::Required,
134        }
135    }
136    #[doc = "Fixed or well-tuned sampling clock"]
137    #[inline(always)]
138    pub fn is_ok(&self) -> bool {
139        *self == Rtreqselect::Ok
140    }
141    #[doc = "Sampling clock needs re-tuning"]
142    #[inline(always)]
143    pub fn is_required(&self) -> bool {
144        *self == Rtreqselect::Required
145    }
146}
147#[doc = "Write Transfer Active\n\nValue on reset: 0"]
148#[derive(Clone, Copy, Debug, PartialEq, Eq)]
149pub enum Wtactselect {
150    #[doc = "0: No valid data"]
151    No = 0,
152    #[doc = "1: Transferring data"]
153    Yes = 1,
154}
155impl From<Wtactselect> for bool {
156    #[inline(always)]
157    fn from(variant: Wtactselect) -> Self {
158        variant as u8 != 0
159    }
160}
161#[doc = "Field `WTACT` reader - Write Transfer Active"]
162pub type WtactR = crate::BitReader<Wtactselect>;
163impl WtactR {
164    #[doc = "Get enumerated values variant"]
165    #[inline(always)]
166    pub const fn variant(&self) -> Wtactselect {
167        match self.bits {
168            false => Wtactselect::No,
169            true => Wtactselect::Yes,
170        }
171    }
172    #[doc = "No valid data"]
173    #[inline(always)]
174    pub fn is_no(&self) -> bool {
175        *self == Wtactselect::No
176    }
177    #[doc = "Transferring data"]
178    #[inline(always)]
179    pub fn is_yes(&self) -> bool {
180        *self == Wtactselect::Yes
181    }
182}
183#[doc = "Read Transfer Active\n\nValue on reset: 0"]
184#[derive(Clone, Copy, Debug, PartialEq, Eq)]
185pub enum Rtactselect {
186    #[doc = "0: No valid data"]
187    No = 0,
188    #[doc = "1: Transferring data"]
189    Yes = 1,
190}
191impl From<Rtactselect> for bool {
192    #[inline(always)]
193    fn from(variant: Rtactselect) -> Self {
194        variant as u8 != 0
195    }
196}
197#[doc = "Field `RTACT` reader - Read Transfer Active"]
198pub type RtactR = crate::BitReader<Rtactselect>;
199impl RtactR {
200    #[doc = "Get enumerated values variant"]
201    #[inline(always)]
202    pub const fn variant(&self) -> Rtactselect {
203        match self.bits {
204            false => Rtactselect::No,
205            true => Rtactselect::Yes,
206        }
207    }
208    #[doc = "No valid data"]
209    #[inline(always)]
210    pub fn is_no(&self) -> bool {
211        *self == Rtactselect::No
212    }
213    #[doc = "Transferring data"]
214    #[inline(always)]
215    pub fn is_yes(&self) -> bool {
216        *self == Rtactselect::Yes
217    }
218}
219#[doc = "Buffer Write Enable\n\nValue on reset: 0"]
220#[derive(Clone, Copy, Debug, PartialEq, Eq)]
221pub enum Bufwrenselect {
222    #[doc = "0: Write disable"]
223    Disable = 0,
224    #[doc = "1: Write enable"]
225    Enable = 1,
226}
227impl From<Bufwrenselect> for bool {
228    #[inline(always)]
229    fn from(variant: Bufwrenselect) -> Self {
230        variant as u8 != 0
231    }
232}
233#[doc = "Field `BUFWREN` reader - Buffer Write Enable"]
234pub type BufwrenR = crate::BitReader<Bufwrenselect>;
235impl BufwrenR {
236    #[doc = "Get enumerated values variant"]
237    #[inline(always)]
238    pub const fn variant(&self) -> Bufwrenselect {
239        match self.bits {
240            false => Bufwrenselect::Disable,
241            true => Bufwrenselect::Enable,
242        }
243    }
244    #[doc = "Write disable"]
245    #[inline(always)]
246    pub fn is_disable(&self) -> bool {
247        *self == Bufwrenselect::Disable
248    }
249    #[doc = "Write enable"]
250    #[inline(always)]
251    pub fn is_enable(&self) -> bool {
252        *self == Bufwrenselect::Enable
253    }
254}
255#[doc = "Buffer Read Enable\n\nValue on reset: 0"]
256#[derive(Clone, Copy, Debug, PartialEq, Eq)]
257pub enum Bufrdenselect {
258    #[doc = "0: Read disable"]
259    Disable = 0,
260    #[doc = "1: Read enable"]
261    Enable = 1,
262}
263impl From<Bufrdenselect> for bool {
264    #[inline(always)]
265    fn from(variant: Bufrdenselect) -> Self {
266        variant as u8 != 0
267    }
268}
269#[doc = "Field `BUFRDEN` reader - Buffer Read Enable"]
270pub type BufrdenR = crate::BitReader<Bufrdenselect>;
271impl BufrdenR {
272    #[doc = "Get enumerated values variant"]
273    #[inline(always)]
274    pub const fn variant(&self) -> Bufrdenselect {
275        match self.bits {
276            false => Bufrdenselect::Disable,
277            true => Bufrdenselect::Enable,
278        }
279    }
280    #[doc = "Read disable"]
281    #[inline(always)]
282    pub fn is_disable(&self) -> bool {
283        *self == Bufrdenselect::Disable
284    }
285    #[doc = "Read enable"]
286    #[inline(always)]
287    pub fn is_enable(&self) -> bool {
288        *self == Bufrdenselect::Enable
289    }
290}
291#[doc = "Card Inserted\n\nValue on reset: 0"]
292#[derive(Clone, Copy, Debug, PartialEq, Eq)]
293pub enum Cardinsselect {
294    #[doc = "0: Reset or Debouncing or No Card"]
295    No = 0,
296    #[doc = "1: Card inserted"]
297    Yes = 1,
298}
299impl From<Cardinsselect> for bool {
300    #[inline(always)]
301    fn from(variant: Cardinsselect) -> Self {
302        variant as u8 != 0
303    }
304}
305#[doc = "Field `CARDINS` reader - Card Inserted"]
306pub type CardinsR = crate::BitReader<Cardinsselect>;
307impl CardinsR {
308    #[doc = "Get enumerated values variant"]
309    #[inline(always)]
310    pub const fn variant(&self) -> Cardinsselect {
311        match self.bits {
312            false => Cardinsselect::No,
313            true => Cardinsselect::Yes,
314        }
315    }
316    #[doc = "Reset or Debouncing or No Card"]
317    #[inline(always)]
318    pub fn is_no(&self) -> bool {
319        *self == Cardinsselect::No
320    }
321    #[doc = "Card inserted"]
322    #[inline(always)]
323    pub fn is_yes(&self) -> bool {
324        *self == Cardinsselect::Yes
325    }
326}
327#[doc = "Card State Stable\n\nValue on reset: 0"]
328#[derive(Clone, Copy, Debug, PartialEq, Eq)]
329pub enum Cardssselect {
330    #[doc = "0: Reset or Debouncing"]
331    No = 0,
332    #[doc = "1: No Card or Insered"]
333    Yes = 1,
334}
335impl From<Cardssselect> for bool {
336    #[inline(always)]
337    fn from(variant: Cardssselect) -> Self {
338        variant as u8 != 0
339    }
340}
341#[doc = "Field `CARDSS` reader - Card State Stable"]
342pub type CardssR = crate::BitReader<Cardssselect>;
343impl CardssR {
344    #[doc = "Get enumerated values variant"]
345    #[inline(always)]
346    pub const fn variant(&self) -> Cardssselect {
347        match self.bits {
348            false => Cardssselect::No,
349            true => Cardssselect::Yes,
350        }
351    }
352    #[doc = "Reset or Debouncing"]
353    #[inline(always)]
354    pub fn is_no(&self) -> bool {
355        *self == Cardssselect::No
356    }
357    #[doc = "No Card or Insered"]
358    #[inline(always)]
359    pub fn is_yes(&self) -> bool {
360        *self == Cardssselect::Yes
361    }
362}
363#[doc = "Card Detect Pin Level\n\nValue on reset: 0"]
364#[derive(Clone, Copy, Debug, PartialEq, Eq)]
365pub enum Carddplselect {
366    #[doc = "0: No card present (SDCD#=1)"]
367    No = 0,
368    #[doc = "1: Card present (SDCD#=0)"]
369    Yes = 1,
370}
371impl From<Carddplselect> for bool {
372    #[inline(always)]
373    fn from(variant: Carddplselect) -> Self {
374        variant as u8 != 0
375    }
376}
377#[doc = "Field `CARDDPL` reader - Card Detect Pin Level"]
378pub type CarddplR = crate::BitReader<Carddplselect>;
379impl CarddplR {
380    #[doc = "Get enumerated values variant"]
381    #[inline(always)]
382    pub const fn variant(&self) -> Carddplselect {
383        match self.bits {
384            false => Carddplselect::No,
385            true => Carddplselect::Yes,
386        }
387    }
388    #[doc = "No card present (SDCD#=1)"]
389    #[inline(always)]
390    pub fn is_no(&self) -> bool {
391        *self == Carddplselect::No
392    }
393    #[doc = "Card present (SDCD#=0)"]
394    #[inline(always)]
395    pub fn is_yes(&self) -> bool {
396        *self == Carddplselect::Yes
397    }
398}
399#[doc = "Write Protect Pin Level\n\nValue on reset: 1"]
400#[derive(Clone, Copy, Debug, PartialEq, Eq)]
401pub enum Wrpplselect {
402    #[doc = "0: Write protected (SDWP#=0)"]
403    Protected = 0,
404    #[doc = "1: Write enabled (SDWP#=1)"]
405    Enabled = 1,
406}
407impl From<Wrpplselect> for bool {
408    #[inline(always)]
409    fn from(variant: Wrpplselect) -> Self {
410        variant as u8 != 0
411    }
412}
413#[doc = "Field `WRPPL` reader - Write Protect Pin Level"]
414pub type WrpplR = crate::BitReader<Wrpplselect>;
415impl WrpplR {
416    #[doc = "Get enumerated values variant"]
417    #[inline(always)]
418    pub const fn variant(&self) -> Wrpplselect {
419        match self.bits {
420            false => Wrpplselect::Protected,
421            true => Wrpplselect::Enabled,
422        }
423    }
424    #[doc = "Write protected (SDWP#=0)"]
425    #[inline(always)]
426    pub fn is_protected(&self) -> bool {
427        *self == Wrpplselect::Protected
428    }
429    #[doc = "Write enabled (SDWP#=1)"]
430    #[inline(always)]
431    pub fn is_enabled(&self) -> bool {
432        *self == Wrpplselect::Enabled
433    }
434}
435#[doc = "Field `DATLL` reader - DAT\\[3:0\\]
436Line Level"]
437pub type DatllR = crate::FieldReader;
438#[doc = "Field `CMDLL` reader - CMD Line Level"]
439pub type CmdllR = crate::BitReader;
440impl R {
441    #[doc = "Bit 0 - Command Inhibit (CMD)"]
442    #[inline(always)]
443    pub fn cmdinhc(&self) -> CmdinhcR {
444        CmdinhcR::new((self.bits & 1) != 0)
445    }
446    #[doc = "Bit 1 - Command Inhibit (DAT)"]
447    #[inline(always)]
448    pub fn cmdinhd(&self) -> CmdinhdR {
449        CmdinhdR::new(((self.bits >> 1) & 1) != 0)
450    }
451    #[doc = "Bit 2 - DAT Line Active"]
452    #[inline(always)]
453    pub fn dlact(&self) -> DlactR {
454        DlactR::new(((self.bits >> 2) & 1) != 0)
455    }
456    #[doc = "Bit 3 - Re-Tuning Request"]
457    #[inline(always)]
458    pub fn rtreq(&self) -> RtreqR {
459        RtreqR::new(((self.bits >> 3) & 1) != 0)
460    }
461    #[doc = "Bit 8 - Write Transfer Active"]
462    #[inline(always)]
463    pub fn wtact(&self) -> WtactR {
464        WtactR::new(((self.bits >> 8) & 1) != 0)
465    }
466    #[doc = "Bit 9 - Read Transfer Active"]
467    #[inline(always)]
468    pub fn rtact(&self) -> RtactR {
469        RtactR::new(((self.bits >> 9) & 1) != 0)
470    }
471    #[doc = "Bit 10 - Buffer Write Enable"]
472    #[inline(always)]
473    pub fn bufwren(&self) -> BufwrenR {
474        BufwrenR::new(((self.bits >> 10) & 1) != 0)
475    }
476    #[doc = "Bit 11 - Buffer Read Enable"]
477    #[inline(always)]
478    pub fn bufrden(&self) -> BufrdenR {
479        BufrdenR::new(((self.bits >> 11) & 1) != 0)
480    }
481    #[doc = "Bit 16 - Card Inserted"]
482    #[inline(always)]
483    pub fn cardins(&self) -> CardinsR {
484        CardinsR::new(((self.bits >> 16) & 1) != 0)
485    }
486    #[doc = "Bit 17 - Card State Stable"]
487    #[inline(always)]
488    pub fn cardss(&self) -> CardssR {
489        CardssR::new(((self.bits >> 17) & 1) != 0)
490    }
491    #[doc = "Bit 18 - Card Detect Pin Level"]
492    #[inline(always)]
493    pub fn carddpl(&self) -> CarddplR {
494        CarddplR::new(((self.bits >> 18) & 1) != 0)
495    }
496    #[doc = "Bit 19 - Write Protect Pin Level"]
497    #[inline(always)]
498    pub fn wrppl(&self) -> WrpplR {
499        WrpplR::new(((self.bits >> 19) & 1) != 0)
500    }
501    #[doc = "Bits 20:23 - DAT\\[3:0\\]
502Line Level"]
503    #[inline(always)]
504    pub fn datll(&self) -> DatllR {
505        DatllR::new(((self.bits >> 20) & 0x0f) as u8)
506    }
507    #[doc = "Bit 24 - CMD Line Level"]
508    #[inline(always)]
509    pub fn cmdll(&self) -> CmdllR {
510        CmdllR::new(((self.bits >> 24) & 1) != 0)
511    }
512}
513#[doc = "Present State\n\nYou can [`read`](crate::Reg::read) this register and get [`psr::R`](R). See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
514pub struct PsrSpec;
515impl crate::RegisterSpec for PsrSpec {
516    type Ux = u32;
517}
518#[doc = "`read()` method returns [`psr::R`](R) reader structure"]
519impl crate::Readable for PsrSpec {}
520#[doc = "`reset()` method sets PSR to value 0x00f8_0000"]
521impl crate::Resettable for PsrSpec {
522    const RESET_VALUE: u32 = 0x00f8_0000;
523}