efm32gg12b810_pac/sdio/
capab0.rs

1#[doc = "Register `CAPAB0` reader"]
2pub struct R(crate::R<CAPAB0_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<CAPAB0_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<CAPAB0_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<CAPAB0_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Field `TMOUTCLKFREQ` reader - Timeout Clock Frequency"]
17pub type TMOUTCLKFREQ_R = crate::FieldReader<u8, u8>;
18#[doc = "Field `TMOUTCLKUNIT` reader - Timeout Clock Unit"]
19pub type TMOUTCLKUNIT_R = crate::BitReader<bool>;
20#[doc = "Field `BASECLKFREQSD` reader - Base Clock Frequency for SD_CLK"]
21pub type BASECLKFREQSD_R = crate::FieldReader<u8, u8>;
22#[doc = "Field `MAXBLOCKLEN` reader - Maximum Block Length"]
23pub type MAXBLOCKLEN_R = crate::FieldReader<u8, u8>;
24#[doc = "Field `EXTMEDIABUSSUP` reader - Extended Media Bus Support"]
25pub type EXTMEDIABUSSUP_R = crate::BitReader<bool>;
26#[doc = "Field `ADMA2SUP` reader - ADMA2 Support"]
27pub type ADMA2SUP_R = crate::BitReader<bool>;
28#[doc = "Field `HSSUP` reader - High Speed Support"]
29pub type HSSUP_R = crate::BitReader<bool>;
30#[doc = "Field `SDMASUP` reader - SDMA Support"]
31pub type SDMASUP_R = crate::BitReader<bool>;
32#[doc = "Field `SUSRESSUP` reader - Suspend / Resume Support"]
33pub type SUSRESSUP_R = crate::BitReader<bool>;
34#[doc = "Field `VOLTSUP3P3V` reader - Voltage Support 3.3V"]
35pub type VOLTSUP3P3V_R = crate::BitReader<bool>;
36#[doc = "Field `VOLTSUP3P0V` reader - Voltage Support 3.0V"]
37pub type VOLTSUP3P0V_R = crate::BitReader<bool>;
38#[doc = "Field `VOLTSUP1P8V` reader - Voltage Support 1.8V"]
39pub type VOLTSUP1P8V_R = crate::BitReader<bool>;
40#[doc = "Field `SYSBUS64BSUP` reader - System Bus 64-bit Support"]
41pub type SYSBUS64BSUP_R = crate::BitReader<bool>;
42#[doc = "Field `ASYNCINTSUP` reader - Asynchronous Interrupt Support"]
43pub type ASYNCINTSUP_R = crate::BitReader<bool>;
44#[doc = "Interface Card Slot Type\n\nValue on reset: 0"]
45#[derive(Clone, Copy, Debug, PartialEq)]
46#[repr(u8)]
47pub enum IFSLOTTYPE_A {
48    #[doc = "0: Removable Card Slot"]
49    REMOVABLE = 0,
50    #[doc = "1: Only one non-removable device is conected to a SD bus slot"]
51    EMBEDDED = 1,
52    #[doc = "2: Can be set if Host controller supports Shared Bus CTRL register"]
53    SHARED = 2,
54}
55impl From<IFSLOTTYPE_A> for u8 {
56    #[inline(always)]
57    fn from(variant: IFSLOTTYPE_A) -> Self {
58        variant as _
59    }
60}
61#[doc = "Field `IFSLOTTYPE` reader - Interface Card Slot Type"]
62pub type IFSLOTTYPE_R = crate::FieldReader<u8, IFSLOTTYPE_A>;
63impl IFSLOTTYPE_R {
64    #[doc = "Get enumerated values variant"]
65    #[inline(always)]
66    pub fn variant(&self) -> Option<IFSLOTTYPE_A> {
67        match self.bits {
68            0 => Some(IFSLOTTYPE_A::REMOVABLE),
69            1 => Some(IFSLOTTYPE_A::EMBEDDED),
70            2 => Some(IFSLOTTYPE_A::SHARED),
71            _ => None,
72        }
73    }
74    #[doc = "Checks if the value of the field is `REMOVABLE`"]
75    #[inline(always)]
76    pub fn is_removable(&self) -> bool {
77        *self == IFSLOTTYPE_A::REMOVABLE
78    }
79    #[doc = "Checks if the value of the field is `EMBEDDED`"]
80    #[inline(always)]
81    pub fn is_embedded(&self) -> bool {
82        *self == IFSLOTTYPE_A::EMBEDDED
83    }
84    #[doc = "Checks if the value of the field is `SHARED`"]
85    #[inline(always)]
86    pub fn is_shared(&self) -> bool {
87        *self == IFSLOTTYPE_A::SHARED
88    }
89}
90impl R {
91    #[doc = "Bits 0:5 - Timeout Clock Frequency"]
92    #[inline(always)]
93    pub fn tmoutclkfreq(&self) -> TMOUTCLKFREQ_R {
94        TMOUTCLKFREQ_R::new((self.bits & 0x3f) as u8)
95    }
96    #[doc = "Bit 7 - Timeout Clock Unit"]
97    #[inline(always)]
98    pub fn tmoutclkunit(&self) -> TMOUTCLKUNIT_R {
99        TMOUTCLKUNIT_R::new(((self.bits >> 7) & 1) != 0)
100    }
101    #[doc = "Bits 8:15 - Base Clock Frequency for SD_CLK"]
102    #[inline(always)]
103    pub fn baseclkfreqsd(&self) -> BASECLKFREQSD_R {
104        BASECLKFREQSD_R::new(((self.bits >> 8) & 0xff) as u8)
105    }
106    #[doc = "Bits 16:17 - Maximum Block Length"]
107    #[inline(always)]
108    pub fn maxblocklen(&self) -> MAXBLOCKLEN_R {
109        MAXBLOCKLEN_R::new(((self.bits >> 16) & 3) as u8)
110    }
111    #[doc = "Bit 18 - Extended Media Bus Support"]
112    #[inline(always)]
113    pub fn extmediabussup(&self) -> EXTMEDIABUSSUP_R {
114        EXTMEDIABUSSUP_R::new(((self.bits >> 18) & 1) != 0)
115    }
116    #[doc = "Bit 19 - ADMA2 Support"]
117    #[inline(always)]
118    pub fn adma2sup(&self) -> ADMA2SUP_R {
119        ADMA2SUP_R::new(((self.bits >> 19) & 1) != 0)
120    }
121    #[doc = "Bit 21 - High Speed Support"]
122    #[inline(always)]
123    pub fn hssup(&self) -> HSSUP_R {
124        HSSUP_R::new(((self.bits >> 21) & 1) != 0)
125    }
126    #[doc = "Bit 22 - SDMA Support"]
127    #[inline(always)]
128    pub fn sdmasup(&self) -> SDMASUP_R {
129        SDMASUP_R::new(((self.bits >> 22) & 1) != 0)
130    }
131    #[doc = "Bit 23 - Suspend / Resume Support"]
132    #[inline(always)]
133    pub fn susressup(&self) -> SUSRESSUP_R {
134        SUSRESSUP_R::new(((self.bits >> 23) & 1) != 0)
135    }
136    #[doc = "Bit 24 - Voltage Support 3.3V"]
137    #[inline(always)]
138    pub fn voltsup3p3v(&self) -> VOLTSUP3P3V_R {
139        VOLTSUP3P3V_R::new(((self.bits >> 24) & 1) != 0)
140    }
141    #[doc = "Bit 25 - Voltage Support 3.0V"]
142    #[inline(always)]
143    pub fn voltsup3p0v(&self) -> VOLTSUP3P0V_R {
144        VOLTSUP3P0V_R::new(((self.bits >> 25) & 1) != 0)
145    }
146    #[doc = "Bit 26 - Voltage Support 1.8V"]
147    #[inline(always)]
148    pub fn voltsup1p8v(&self) -> VOLTSUP1P8V_R {
149        VOLTSUP1P8V_R::new(((self.bits >> 26) & 1) != 0)
150    }
151    #[doc = "Bit 28 - System Bus 64-bit Support"]
152    #[inline(always)]
153    pub fn sysbus64bsup(&self) -> SYSBUS64BSUP_R {
154        SYSBUS64BSUP_R::new(((self.bits >> 28) & 1) != 0)
155    }
156    #[doc = "Bit 29 - Asynchronous Interrupt Support"]
157    #[inline(always)]
158    pub fn asyncintsup(&self) -> ASYNCINTSUP_R {
159        ASYNCINTSUP_R::new(((self.bits >> 29) & 1) != 0)
160    }
161    #[doc = "Bits 30:31 - Interface Card Slot Type"]
162    #[inline(always)]
163    pub fn ifslottype(&self) -> IFSLOTTYPE_R {
164        IFSLOTTYPE_R::new(((self.bits >> 30) & 3) as u8)
165    }
166}
167#[doc = "Capabilities Register to Hold Bits 31~0\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [capab0](index.html) module"]
168pub struct CAPAB0_SPEC;
169impl crate::RegisterSpec for CAPAB0_SPEC {
170    type Ux = u32;
171}
172#[doc = "`read()` method returns [capab0::R](R) reader structure"]
173impl crate::Readable for CAPAB0_SPEC {
174    type Reader = R;
175}
176#[doc = "`reset()` method sets CAPAB0 to value 0"]
177impl crate::Resettable for CAPAB0_SPEC {
178    #[inline(always)]
179    fn reset_value() -> Self::Ux {
180        0
181    }
182}