1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
#[doc = "Register `CFG0` reader"]
pub struct R(crate::R<CFG0_SPEC>);
impl core::ops::Deref for R {
    type Target = crate::R<CFG0_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl From<crate::R<CFG0_SPEC>> for R {
    #[inline(always)]
    fn from(reader: crate::R<CFG0_SPEC>) -> Self {
        R(reader)
    }
}
#[doc = "Register `CFG0` writer"]
pub struct W(crate::W<CFG0_SPEC>);
impl core::ops::Deref for W {
    type Target = crate::W<CFG0_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::ops::DerefMut for W {
    #[inline(always)]
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl From<crate::W<CFG0_SPEC>> for W {
    #[inline(always)]
    fn from(writer: crate::W<CFG0_SPEC>) -> Self {
        W(writer)
    }
}
#[doc = "Field `TUNINGCNT` reader - Tuning Counter Value"]
pub type TUNINGCNT_R = crate::FieldReader<u8, u8>;
#[doc = "Field `TUNINGCNT` writer - Tuning Counter Value"]
pub type TUNINGCNT_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CFG0_SPEC, u8, u8, 6, O>;
#[doc = "Field `TOUTCLKFREQ` reader - Timeout Clock Frequency"]
pub type TOUTCLKFREQ_R = crate::FieldReader<u8, u8>;
#[doc = "Field `TOUTCLKFREQ` writer - Timeout Clock Frequency"]
pub type TOUTCLKFREQ_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CFG0_SPEC, u8, u8, 6, O>;
#[doc = "Field `TOUTCLKUNIT` reader - Timeout Clock Unit in kHz or MHz"]
pub type TOUTCLKUNIT_R = crate::BitReader<bool>;
#[doc = "Field `TOUTCLKUNIT` writer - Timeout Clock Unit in kHz or MHz"]
pub type TOUTCLKUNIT_W<'a, const O: u8> = crate::BitWriter<'a, u32, CFG0_SPEC, bool, O>;
#[doc = "Field `BASECLKFREQ` reader - Base Clock Frequency for SD_CLK"]
pub type BASECLKFREQ_R = crate::FieldReader<u8, u8>;
#[doc = "Field `BASECLKFREQ` writer - Base Clock Frequency for SD_CLK"]
pub type BASECLKFREQ_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CFG0_SPEC, u8, u8, 8, O>;
#[doc = "Field `MAXBLKLEN` reader - MAX Block Length of Transfer"]
pub type MAXBLKLEN_R = crate::FieldReader<u8, MAXBLKLEN_A>;
#[doc = "MAX Block Length of Transfer\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum MAXBLKLEN_A {
    #[doc = "0: 512 Bytes are Selected"]
    _512B = 0,
    #[doc = "1: 1024 Bytes are Selected"]
    _1024B = 1,
    #[doc = "2: 2048 Bytes are Selected"]
    _2048B = 2,
}
impl From<MAXBLKLEN_A> for u8 {
    #[inline(always)]
    fn from(variant: MAXBLKLEN_A) -> Self {
        variant as _
    }
}
impl MAXBLKLEN_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> Option<MAXBLKLEN_A> {
        match self.bits {
            0 => Some(MAXBLKLEN_A::_512B),
            1 => Some(MAXBLKLEN_A::_1024B),
            2 => Some(MAXBLKLEN_A::_2048B),
            _ => None,
        }
    }
    #[doc = "Checks if the value of the field is `_512B`"]
    #[inline(always)]
    pub fn is_512b(&self) -> bool {
        *self == MAXBLKLEN_A::_512B
    }
    #[doc = "Checks if the value of the field is `_1024B`"]
    #[inline(always)]
    pub fn is_1024b(&self) -> bool {
        *self == MAXBLKLEN_A::_1024B
    }
    #[doc = "Checks if the value of the field is `_2048B`"]
    #[inline(always)]
    pub fn is_2048b(&self) -> bool {
        *self == MAXBLKLEN_A::_2048B
    }
}
#[doc = "Field `MAXBLKLEN` writer - MAX Block Length of Transfer"]
pub type MAXBLKLEN_W<'a, const O: u8> =
    crate::FieldWriter<'a, u32, CFG0_SPEC, u8, MAXBLKLEN_A, 2, O>;
impl<'a, const O: u8> MAXBLKLEN_W<'a, O> {
    #[doc = "512 Bytes are Selected"]
    #[inline(always)]
    pub fn _512b(self) -> &'a mut W {
        self.variant(MAXBLKLEN_A::_512B)
    }
    #[doc = "1024 Bytes are Selected"]
    #[inline(always)]
    pub fn _1024b(self) -> &'a mut W {
        self.variant(MAXBLKLEN_A::_1024B)
    }
    #[doc = "2048 Bytes are Selected"]
    #[inline(always)]
    pub fn _2048b(self) -> &'a mut W {
        self.variant(MAXBLKLEN_A::_2048B)
    }
}
#[doc = "Field `C8BITSUP` reader - 8-bit Interface Support"]
pub type C8BITSUP_R = crate::BitReader<bool>;
#[doc = "Field `C8BITSUP` writer - 8-bit Interface Support"]
pub type C8BITSUP_W<'a, const O: u8> = crate::BitWriter<'a, u32, CFG0_SPEC, bool, O>;
#[doc = "Field `CADMA2SUP` reader - ADMA2 Mode Support"]
pub type CADMA2SUP_R = crate::BitReader<bool>;
#[doc = "Field `CADMA2SUP` writer - ADMA2 Mode Support"]
pub type CADMA2SUP_W<'a, const O: u8> = crate::BitWriter<'a, u32, CFG0_SPEC, bool, O>;
#[doc = "Field `CHSSUP` reader - High Speed Mode Support"]
pub type CHSSUP_R = crate::BitReader<bool>;
#[doc = "Field `CHSSUP` writer - High Speed Mode Support"]
pub type CHSSUP_W<'a, const O: u8> = crate::BitWriter<'a, u32, CFG0_SPEC, bool, O>;
#[doc = "Field `CSDMASUP` reader - SDMA Mode Support"]
pub type CSDMASUP_R = crate::BitReader<bool>;
#[doc = "Field `CSDMASUP` writer - SDMA Mode Support"]
pub type CSDMASUP_W<'a, const O: u8> = crate::BitWriter<'a, u32, CFG0_SPEC, bool, O>;
#[doc = "Field `CSUSPRESSUP` reader - Suspend/Resume Support"]
pub type CSUSPRESSUP_R = crate::BitReader<bool>;
#[doc = "Field `CSUSPRESSUP` writer - Suspend/Resume Support"]
pub type CSUSPRESSUP_W<'a, const O: u8> = crate::BitWriter<'a, u32, CFG0_SPEC, bool, O>;
#[doc = "Field `C3P3VSUP` reader - Core 3P3V Support"]
pub type C3P3VSUP_R = crate::BitReader<bool>;
#[doc = "Field `C3P3VSUP` writer - Core 3P3V Support"]
pub type C3P3VSUP_W<'a, const O: u8> = crate::BitWriter<'a, u32, CFG0_SPEC, bool, O>;
#[doc = "Field `C3P0VSUP` reader - 3P0V Support"]
pub type C3P0VSUP_R = crate::BitReader<bool>;
#[doc = "Field `C3P0VSUP` writer - 3P0V Support"]
pub type C3P0VSUP_W<'a, const O: u8> = crate::BitWriter<'a, u32, CFG0_SPEC, bool, O>;
#[doc = "Field `C1P8VSUP` reader - 1P8V Support"]
pub type C1P8VSUP_R = crate::BitReader<bool>;
#[doc = "Field `C1P8VSUP` writer - 1P8V Support"]
pub type C1P8VSUP_W<'a, const O: u8> = crate::BitWriter<'a, u32, CFG0_SPEC, bool, O>;
impl R {
    #[doc = "Bits 0:5 - Tuning Counter Value"]
    #[inline(always)]
    pub fn tuningcnt(&self) -> TUNINGCNT_R {
        TUNINGCNT_R::new((self.bits & 0x3f) as u8)
    }
    #[doc = "Bits 6:11 - Timeout Clock Frequency"]
    #[inline(always)]
    pub fn toutclkfreq(&self) -> TOUTCLKFREQ_R {
        TOUTCLKFREQ_R::new(((self.bits >> 6) & 0x3f) as u8)
    }
    #[doc = "Bit 12 - Timeout Clock Unit in kHz or MHz"]
    #[inline(always)]
    pub fn toutclkunit(&self) -> TOUTCLKUNIT_R {
        TOUTCLKUNIT_R::new(((self.bits >> 12) & 1) != 0)
    }
    #[doc = "Bits 13:20 - Base Clock Frequency for SD_CLK"]
    #[inline(always)]
    pub fn baseclkfreq(&self) -> BASECLKFREQ_R {
        BASECLKFREQ_R::new(((self.bits >> 13) & 0xff) as u8)
    }
    #[doc = "Bits 21:22 - MAX Block Length of Transfer"]
    #[inline(always)]
    pub fn maxblklen(&self) -> MAXBLKLEN_R {
        MAXBLKLEN_R::new(((self.bits >> 21) & 3) as u8)
    }
    #[doc = "Bit 23 - 8-bit Interface Support"]
    #[inline(always)]
    pub fn c8bitsup(&self) -> C8BITSUP_R {
        C8BITSUP_R::new(((self.bits >> 23) & 1) != 0)
    }
    #[doc = "Bit 24 - ADMA2 Mode Support"]
    #[inline(always)]
    pub fn cadma2sup(&self) -> CADMA2SUP_R {
        CADMA2SUP_R::new(((self.bits >> 24) & 1) != 0)
    }
    #[doc = "Bit 25 - High Speed Mode Support"]
    #[inline(always)]
    pub fn chssup(&self) -> CHSSUP_R {
        CHSSUP_R::new(((self.bits >> 25) & 1) != 0)
    }
    #[doc = "Bit 26 - SDMA Mode Support"]
    #[inline(always)]
    pub fn csdmasup(&self) -> CSDMASUP_R {
        CSDMASUP_R::new(((self.bits >> 26) & 1) != 0)
    }
    #[doc = "Bit 27 - Suspend/Resume Support"]
    #[inline(always)]
    pub fn csuspressup(&self) -> CSUSPRESSUP_R {
        CSUSPRESSUP_R::new(((self.bits >> 27) & 1) != 0)
    }
    #[doc = "Bit 28 - Core 3P3V Support"]
    #[inline(always)]
    pub fn c3p3vsup(&self) -> C3P3VSUP_R {
        C3P3VSUP_R::new(((self.bits >> 28) & 1) != 0)
    }
    #[doc = "Bit 29 - 3P0V Support"]
    #[inline(always)]
    pub fn c3p0vsup(&self) -> C3P0VSUP_R {
        C3P0VSUP_R::new(((self.bits >> 29) & 1) != 0)
    }
    #[doc = "Bit 30 - 1P8V Support"]
    #[inline(always)]
    pub fn c1p8vsup(&self) -> C1P8VSUP_R {
        C1P8VSUP_R::new(((self.bits >> 30) & 1) != 0)
    }
}
impl W {
    #[doc = "Bits 0:5 - Tuning Counter Value"]
    #[inline(always)]
    #[must_use]
    pub fn tuningcnt(&mut self) -> TUNINGCNT_W<0> {
        TUNINGCNT_W::new(self)
    }
    #[doc = "Bits 6:11 - Timeout Clock Frequency"]
    #[inline(always)]
    #[must_use]
    pub fn toutclkfreq(&mut self) -> TOUTCLKFREQ_W<6> {
        TOUTCLKFREQ_W::new(self)
    }
    #[doc = "Bit 12 - Timeout Clock Unit in kHz or MHz"]
    #[inline(always)]
    #[must_use]
    pub fn toutclkunit(&mut self) -> TOUTCLKUNIT_W<12> {
        TOUTCLKUNIT_W::new(self)
    }
    #[doc = "Bits 13:20 - Base Clock Frequency for SD_CLK"]
    #[inline(always)]
    #[must_use]
    pub fn baseclkfreq(&mut self) -> BASECLKFREQ_W<13> {
        BASECLKFREQ_W::new(self)
    }
    #[doc = "Bits 21:22 - MAX Block Length of Transfer"]
    #[inline(always)]
    #[must_use]
    pub fn maxblklen(&mut self) -> MAXBLKLEN_W<21> {
        MAXBLKLEN_W::new(self)
    }
    #[doc = "Bit 23 - 8-bit Interface Support"]
    #[inline(always)]
    #[must_use]
    pub fn c8bitsup(&mut self) -> C8BITSUP_W<23> {
        C8BITSUP_W::new(self)
    }
    #[doc = "Bit 24 - ADMA2 Mode Support"]
    #[inline(always)]
    #[must_use]
    pub fn cadma2sup(&mut self) -> CADMA2SUP_W<24> {
        CADMA2SUP_W::new(self)
    }
    #[doc = "Bit 25 - High Speed Mode Support"]
    #[inline(always)]
    #[must_use]
    pub fn chssup(&mut self) -> CHSSUP_W<25> {
        CHSSUP_W::new(self)
    }
    #[doc = "Bit 26 - SDMA Mode Support"]
    #[inline(always)]
    #[must_use]
    pub fn csdmasup(&mut self) -> CSDMASUP_W<26> {
        CSDMASUP_W::new(self)
    }
    #[doc = "Bit 27 - Suspend/Resume Support"]
    #[inline(always)]
    #[must_use]
    pub fn csuspressup(&mut self) -> CSUSPRESSUP_W<27> {
        CSUSPRESSUP_W::new(self)
    }
    #[doc = "Bit 28 - Core 3P3V Support"]
    #[inline(always)]
    #[must_use]
    pub fn c3p3vsup(&mut self) -> C3P3VSUP_W<28> {
        C3P3VSUP_W::new(self)
    }
    #[doc = "Bit 29 - 3P0V Support"]
    #[inline(always)]
    #[must_use]
    pub fn c3p0vsup(&mut self) -> C3P0VSUP_W<29> {
        C3P0VSUP_W::new(self)
    }
    #[doc = "Bit 30 - 1P8V Support"]
    #[inline(always)]
    #[must_use]
    pub fn c1p8vsup(&mut self) -> C1P8VSUP_W<30> {
        C1P8VSUP_W::new(self)
    }
    #[doc = "Writes raw bits to the register."]
    #[inline(always)]
    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
        self.0.bits(bits);
        self
    }
}
#[doc = "Core Configuration 0\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [cfg0](index.html) module"]
pub struct CFG0_SPEC;
impl crate::RegisterSpec for CFG0_SPEC {
    type Ux = u32;
}
#[doc = "`read()` method returns [cfg0::R](R) reader structure"]
impl crate::Readable for CFG0_SPEC {
    type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [cfg0::W](W) writer structure"]
impl crate::Writable for CFG0_SPEC {
    type Writer = W;
    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
}
#[doc = "`reset()` method sets CFG0 to value 0"]
impl crate::Resettable for CFG0_SPEC {
    const RESET_VALUE: Self::Ux = 0;
}