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
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
#[doc = "Reader of register CFG0"]
pub type R = crate::R<u32, super::CFG0>;
#[doc = "Writer for register CFG0"]
pub type W = crate::W<u32, super::CFG0>;
#[doc = "Register CFG0 `reset()`'s with value 0"]
impl crate::ResetValue for super::CFG0 {
    type Type = u32;
    #[inline(always)]
    fn reset_value() -> Self::Type { 0 }
}
#[doc = "Reader of field `TUNINGCNT`"]
pub type TUNINGCNT_R = crate::R<u8, u8>;
#[doc = "Write proxy for field `TUNINGCNT`"]
pub struct TUNINGCNT_W<'a> {
    w: &'a mut W,
}
impl<'a> TUNINGCNT_W<'a> {
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub unsafe fn bits(self, value: u8) -> &'a mut W {
        self.w.bits = (self.w.bits & !0x3f) | ((value as u32) & 0x3f);
        self.w
    }
}
#[doc = "Reader of field `TOUTCLKFREQ`"]
pub type TOUTCLKFREQ_R = crate::R<u8, u8>;
#[doc = "Write proxy for field `TOUTCLKFREQ`"]
pub struct TOUTCLKFREQ_W<'a> {
    w: &'a mut W,
}
impl<'a> TOUTCLKFREQ_W<'a> {
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub unsafe fn bits(self, value: u8) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x3f << 6)) | (((value as u32) & 0x3f) << 6);
        self.w
    }
}
#[doc = "Reader of field `TOUTCLKUNIT`"]
pub type TOUTCLKUNIT_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `TOUTCLKUNIT`"]
pub struct TOUTCLKUNIT_W<'a> {
    w: &'a mut W,
}
impl<'a> TOUTCLKUNIT_W<'a> {
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W { self.bit(true) }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W { self.bit(false) }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 12)) | (((value as u32) & 0x01) << 12);
        self.w
    }
}
#[doc = "Reader of field `BASECLKFREQ`"]
pub type BASECLKFREQ_R = crate::R<u8, u8>;
#[doc = "Write proxy for field `BASECLKFREQ`"]
pub struct BASECLKFREQ_W<'a> {
    w: &'a mut W,
}
impl<'a> BASECLKFREQ_W<'a> {
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub unsafe fn bits(self, value: u8) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0xff << 13)) | (((value as u32) & 0xff) << 13);
        self.w
    }
}
#[doc = "MAX Block Length of Transfer\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[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 _ }
}
#[doc = "Reader of field `MAXBLKLEN`"]
pub type MAXBLKLEN_R = crate::R<u8, MAXBLKLEN_A>;
impl MAXBLKLEN_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> crate::Variant<u8, MAXBLKLEN_A> {
        use crate::Variant::*;
        match self.bits {
            0 => Val(MAXBLKLEN_A::_512B),
            1 => Val(MAXBLKLEN_A::_1024B),
            2 => Val(MAXBLKLEN_A::_2048B),
            i => Res(i),
        }
    }
    #[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 = "Write proxy for field `MAXBLKLEN`"]
pub struct MAXBLKLEN_W<'a> {
    w: &'a mut W,
}
impl<'a> MAXBLKLEN_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: MAXBLKLEN_A) -> &'a mut W { unsafe { self.bits(variant.into()) } }
    #[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 = r"Writes raw bits to the field"]
    #[inline(always)]
    pub unsafe fn bits(self, value: u8) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x03 << 21)) | (((value as u32) & 0x03) << 21);
        self.w
    }
}
#[doc = "Reader of field `C8BITSUP`"]
pub type C8BITSUP_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `C8BITSUP`"]
pub struct C8BITSUP_W<'a> {
    w: &'a mut W,
}
impl<'a> C8BITSUP_W<'a> {
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W { self.bit(true) }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W { self.bit(false) }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 23)) | (((value as u32) & 0x01) << 23);
        self.w
    }
}
#[doc = "Reader of field `CADMA2SUP`"]
pub type CADMA2SUP_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `CADMA2SUP`"]
pub struct CADMA2SUP_W<'a> {
    w: &'a mut W,
}
impl<'a> CADMA2SUP_W<'a> {
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W { self.bit(true) }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W { self.bit(false) }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 24)) | (((value as u32) & 0x01) << 24);
        self.w
    }
}
#[doc = "Reader of field `CHSSUP`"]
pub type CHSSUP_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `CHSSUP`"]
pub struct CHSSUP_W<'a> {
    w: &'a mut W,
}
impl<'a> CHSSUP_W<'a> {
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W { self.bit(true) }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W { self.bit(false) }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 25)) | (((value as u32) & 0x01) << 25);
        self.w
    }
}
#[doc = "Reader of field `CSDMASUP`"]
pub type CSDMASUP_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `CSDMASUP`"]
pub struct CSDMASUP_W<'a> {
    w: &'a mut W,
}
impl<'a> CSDMASUP_W<'a> {
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W { self.bit(true) }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W { self.bit(false) }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 26)) | (((value as u32) & 0x01) << 26);
        self.w
    }
}
#[doc = "Reader of field `CSUSPRESSUP`"]
pub type CSUSPRESSUP_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `CSUSPRESSUP`"]
pub struct CSUSPRESSUP_W<'a> {
    w: &'a mut W,
}
impl<'a> CSUSPRESSUP_W<'a> {
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W { self.bit(true) }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W { self.bit(false) }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 27)) | (((value as u32) & 0x01) << 27);
        self.w
    }
}
#[doc = "Reader of field `C3P3VSUP`"]
pub type C3P3VSUP_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `C3P3VSUP`"]
pub struct C3P3VSUP_W<'a> {
    w: &'a mut W,
}
impl<'a> C3P3VSUP_W<'a> {
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W { self.bit(true) }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W { self.bit(false) }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 28)) | (((value as u32) & 0x01) << 28);
        self.w
    }
}
#[doc = "Reader of field `C3P0VSUP`"]
pub type C3P0VSUP_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `C3P0VSUP`"]
pub struct C3P0VSUP_W<'a> {
    w: &'a mut W,
}
impl<'a> C3P0VSUP_W<'a> {
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W { self.bit(true) }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W { self.bit(false) }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 29)) | (((value as u32) & 0x01) << 29);
        self.w
    }
}
#[doc = "Reader of field `C1P8VSUP`"]
pub type C1P8VSUP_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `C1P8VSUP`"]
pub struct C1P8VSUP_W<'a> {
    w: &'a mut W,
}
impl<'a> C1P8VSUP_W<'a> {
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W { self.bit(true) }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W { self.bit(false) }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 30)) | (((value as u32) & 0x01) << 30);
        self.w
    }
}
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) & 0x01) != 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) & 0x03) as u8) }
    #[doc = "Bit 23 - 8-bit Interface Support"]
    #[inline(always)]
    pub fn c8bitsup(&self) -> C8BITSUP_R { C8BITSUP_R::new(((self.bits >> 23) & 0x01) != 0) }
    #[doc = "Bit 24 - ADMA2 Mode Support"]
    #[inline(always)]
    pub fn cadma2sup(&self) -> CADMA2SUP_R { CADMA2SUP_R::new(((self.bits >> 24) & 0x01) != 0) }
    #[doc = "Bit 25 - High Speed Mode Support"]
    #[inline(always)]
    pub fn chssup(&self) -> CHSSUP_R { CHSSUP_R::new(((self.bits >> 25) & 0x01) != 0) }
    #[doc = "Bit 26 - SDMA Mode Support"]
    #[inline(always)]
    pub fn csdmasup(&self) -> CSDMASUP_R { CSDMASUP_R::new(((self.bits >> 26) & 0x01) != 0) }
    #[doc = "Bit 27 - Suspend/Resume Support"]
    #[inline(always)]
    pub fn csuspressup(&self) -> CSUSPRESSUP_R {
        CSUSPRESSUP_R::new(((self.bits >> 27) & 0x01) != 0)
    }
    #[doc = "Bit 28 - Core 3P3V Support"]
    #[inline(always)]
    pub fn c3p3vsup(&self) -> C3P3VSUP_R { C3P3VSUP_R::new(((self.bits >> 28) & 0x01) != 0) }
    #[doc = "Bit 29 - 3P0V Support"]
    #[inline(always)]
    pub fn c3p0vsup(&self) -> C3P0VSUP_R { C3P0VSUP_R::new(((self.bits >> 29) & 0x01) != 0) }
    #[doc = "Bit 30 - 1P8V Support"]
    #[inline(always)]
    pub fn c1p8vsup(&self) -> C1P8VSUP_R { C1P8VSUP_R::new(((self.bits >> 30) & 0x01) != 0) }
}
impl W {
    #[doc = "Bits 0:5 - Tuning Counter Value"]
    #[inline(always)]
    pub fn tuningcnt(&mut self) -> TUNINGCNT_W { TUNINGCNT_W { w: self } }
    #[doc = "Bits 6:11 - Timeout Clock Frequency"]
    #[inline(always)]
    pub fn toutclkfreq(&mut self) -> TOUTCLKFREQ_W { TOUTCLKFREQ_W { w: self } }
    #[doc = "Bit 12 - Timeout Clock Unit in kHz or MHz"]
    #[inline(always)]
    pub fn toutclkunit(&mut self) -> TOUTCLKUNIT_W { TOUTCLKUNIT_W { w: self } }
    #[doc = "Bits 13:20 - Base Clock Frequency for SD_CLK"]
    #[inline(always)]
    pub fn baseclkfreq(&mut self) -> BASECLKFREQ_W { BASECLKFREQ_W { w: self } }
    #[doc = "Bits 21:22 - MAX Block Length of Transfer"]
    #[inline(always)]
    pub fn maxblklen(&mut self) -> MAXBLKLEN_W { MAXBLKLEN_W { w: self } }
    #[doc = "Bit 23 - 8-bit Interface Support"]
    #[inline(always)]
    pub fn c8bitsup(&mut self) -> C8BITSUP_W { C8BITSUP_W { w: self } }
    #[doc = "Bit 24 - ADMA2 Mode Support"]
    #[inline(always)]
    pub fn cadma2sup(&mut self) -> CADMA2SUP_W { CADMA2SUP_W { w: self } }
    #[doc = "Bit 25 - High Speed Mode Support"]
    #[inline(always)]
    pub fn chssup(&mut self) -> CHSSUP_W { CHSSUP_W { w: self } }
    #[doc = "Bit 26 - SDMA Mode Support"]
    #[inline(always)]
    pub fn csdmasup(&mut self) -> CSDMASUP_W { CSDMASUP_W { w: self } }
    #[doc = "Bit 27 - Suspend/Resume Support"]
    #[inline(always)]
    pub fn csuspressup(&mut self) -> CSUSPRESSUP_W { CSUSPRESSUP_W { w: self } }
    #[doc = "Bit 28 - Core 3P3V Support"]
    #[inline(always)]
    pub fn c3p3vsup(&mut self) -> C3P3VSUP_W { C3P3VSUP_W { w: self } }
    #[doc = "Bit 29 - 3P0V Support"]
    #[inline(always)]
    pub fn c3p0vsup(&mut self) -> C3P0VSUP_W { C3P0VSUP_W { w: self } }
    #[doc = "Bit 30 - 1P8V Support"]
    #[inline(always)]
    pub fn c1p8vsup(&mut self) -> C1P8VSUP_W { C1P8VSUP_W { w: self } }
}