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
#[doc = "Reader of register BLK_ATT"]
pub type R = crate::R<u32, super::BLK_ATT>;
#[doc = "Writer for register BLK_ATT"]
pub type W = crate::W<u32, super::BLK_ATT>;
#[doc = "Register BLK_ATT `reset()`'s with value 0"]
impl crate::ResetValue for super::BLK_ATT {
    type Type = u32;
    #[inline(always)]
    fn reset_value() -> Self::Type {
        0
    }
}
#[doc = "Block Size\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u16)]
pub enum BLKSIZE_A {
    #[doc = "0: No data transfer"]
    BLKSIZE_0 = 0,
    #[doc = "1: 1 Byte"]
    BLKSIZE_1 = 1,
    #[doc = "2: 2 Bytes"]
    BLKSIZE_2 = 2,
    #[doc = "3: 3 Bytes"]
    BLKSIZE_3 = 3,
    #[doc = "4: 4 Bytes"]
    BLKSIZE_4 = 4,
    #[doc = "511: 511 Bytes"]
    BLKSIZE_511 = 511,
    #[doc = "512: 512 Bytes"]
    BLKSIZE_512 = 512,
    #[doc = "2048: 2048 Bytes"]
    BLKSIZE_2048 = 2048,
    #[doc = "4096: 4096 Bytes"]
    BLKSIZE_4096 = 4096,
}
impl From<BLKSIZE_A> for u16 {
    #[inline(always)]
    fn from(variant: BLKSIZE_A) -> Self {
        variant as _
    }
}
#[doc = "Reader of field `BLKSIZE`"]
pub type BLKSIZE_R = crate::R<u16, BLKSIZE_A>;
impl BLKSIZE_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> crate::Variant<u16, BLKSIZE_A> {
        use crate::Variant::*;
        match self.bits {
            0 => Val(BLKSIZE_A::BLKSIZE_0),
            1 => Val(BLKSIZE_A::BLKSIZE_1),
            2 => Val(BLKSIZE_A::BLKSIZE_2),
            3 => Val(BLKSIZE_A::BLKSIZE_3),
            4 => Val(BLKSIZE_A::BLKSIZE_4),
            511 => Val(BLKSIZE_A::BLKSIZE_511),
            512 => Val(BLKSIZE_A::BLKSIZE_512),
            2048 => Val(BLKSIZE_A::BLKSIZE_2048),
            4096 => Val(BLKSIZE_A::BLKSIZE_4096),
            i => Res(i),
        }
    }
    #[doc = "Checks if the value of the field is `BLKSIZE_0`"]
    #[inline(always)]
    pub fn is_blksize_0(&self) -> bool {
        *self == BLKSIZE_A::BLKSIZE_0
    }
    #[doc = "Checks if the value of the field is `BLKSIZE_1`"]
    #[inline(always)]
    pub fn is_blksize_1(&self) -> bool {
        *self == BLKSIZE_A::BLKSIZE_1
    }
    #[doc = "Checks if the value of the field is `BLKSIZE_2`"]
    #[inline(always)]
    pub fn is_blksize_2(&self) -> bool {
        *self == BLKSIZE_A::BLKSIZE_2
    }
    #[doc = "Checks if the value of the field is `BLKSIZE_3`"]
    #[inline(always)]
    pub fn is_blksize_3(&self) -> bool {
        *self == BLKSIZE_A::BLKSIZE_3
    }
    #[doc = "Checks if the value of the field is `BLKSIZE_4`"]
    #[inline(always)]
    pub fn is_blksize_4(&self) -> bool {
        *self == BLKSIZE_A::BLKSIZE_4
    }
    #[doc = "Checks if the value of the field is `BLKSIZE_511`"]
    #[inline(always)]
    pub fn is_blksize_511(&self) -> bool {
        *self == BLKSIZE_A::BLKSIZE_511
    }
    #[doc = "Checks if the value of the field is `BLKSIZE_512`"]
    #[inline(always)]
    pub fn is_blksize_512(&self) -> bool {
        *self == BLKSIZE_A::BLKSIZE_512
    }
    #[doc = "Checks if the value of the field is `BLKSIZE_2048`"]
    #[inline(always)]
    pub fn is_blksize_2048(&self) -> bool {
        *self == BLKSIZE_A::BLKSIZE_2048
    }
    #[doc = "Checks if the value of the field is `BLKSIZE_4096`"]
    #[inline(always)]
    pub fn is_blksize_4096(&self) -> bool {
        *self == BLKSIZE_A::BLKSIZE_4096
    }
}
#[doc = "Write proxy for field `BLKSIZE`"]
pub struct BLKSIZE_W<'a> {
    w: &'a mut W,
}
impl<'a> BLKSIZE_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: BLKSIZE_A) -> &'a mut W {
        unsafe { self.bits(variant.into()) }
    }
    #[doc = "No data transfer"]
    #[inline(always)]
    pub fn blksize_0(self) -> &'a mut W {
        self.variant(BLKSIZE_A::BLKSIZE_0)
    }
    #[doc = "1 Byte"]
    #[inline(always)]
    pub fn blksize_1(self) -> &'a mut W {
        self.variant(BLKSIZE_A::BLKSIZE_1)
    }
    #[doc = "2 Bytes"]
    #[inline(always)]
    pub fn blksize_2(self) -> &'a mut W {
        self.variant(BLKSIZE_A::BLKSIZE_2)
    }
    #[doc = "3 Bytes"]
    #[inline(always)]
    pub fn blksize_3(self) -> &'a mut W {
        self.variant(BLKSIZE_A::BLKSIZE_3)
    }
    #[doc = "4 Bytes"]
    #[inline(always)]
    pub fn blksize_4(self) -> &'a mut W {
        self.variant(BLKSIZE_A::BLKSIZE_4)
    }
    #[doc = "511 Bytes"]
    #[inline(always)]
    pub fn blksize_511(self) -> &'a mut W {
        self.variant(BLKSIZE_A::BLKSIZE_511)
    }
    #[doc = "512 Bytes"]
    #[inline(always)]
    pub fn blksize_512(self) -> &'a mut W {
        self.variant(BLKSIZE_A::BLKSIZE_512)
    }
    #[doc = "2048 Bytes"]
    #[inline(always)]
    pub fn blksize_2048(self) -> &'a mut W {
        self.variant(BLKSIZE_A::BLKSIZE_2048)
    }
    #[doc = "4096 Bytes"]
    #[inline(always)]
    pub fn blksize_4096(self) -> &'a mut W {
        self.variant(BLKSIZE_A::BLKSIZE_4096)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub unsafe fn bits(self, value: u16) -> &'a mut W {
        self.w.bits = (self.w.bits & !0x1fff) | ((value as u32) & 0x1fff);
        self.w
    }
}
#[doc = "Block Count\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u16)]
pub enum BLKCNT_A {
    #[doc = "0: Stop Count"]
    BLKCNT_0 = 0,
    #[doc = "1: 1 block"]
    BLKCNT_1 = 1,
    #[doc = "2: 2 blocks"]
    BLKCNT_2 = 2,
    #[doc = "65535: 65535 blocks"]
    BLKCNT_65535 = 65535,
}
impl From<BLKCNT_A> for u16 {
    #[inline(always)]
    fn from(variant: BLKCNT_A) -> Self {
        variant as _
    }
}
#[doc = "Reader of field `BLKCNT`"]
pub type BLKCNT_R = crate::R<u16, BLKCNT_A>;
impl BLKCNT_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> crate::Variant<u16, BLKCNT_A> {
        use crate::Variant::*;
        match self.bits {
            0 => Val(BLKCNT_A::BLKCNT_0),
            1 => Val(BLKCNT_A::BLKCNT_1),
            2 => Val(BLKCNT_A::BLKCNT_2),
            65535 => Val(BLKCNT_A::BLKCNT_65535),
            i => Res(i),
        }
    }
    #[doc = "Checks if the value of the field is `BLKCNT_0`"]
    #[inline(always)]
    pub fn is_blkcnt_0(&self) -> bool {
        *self == BLKCNT_A::BLKCNT_0
    }
    #[doc = "Checks if the value of the field is `BLKCNT_1`"]
    #[inline(always)]
    pub fn is_blkcnt_1(&self) -> bool {
        *self == BLKCNT_A::BLKCNT_1
    }
    #[doc = "Checks if the value of the field is `BLKCNT_2`"]
    #[inline(always)]
    pub fn is_blkcnt_2(&self) -> bool {
        *self == BLKCNT_A::BLKCNT_2
    }
    #[doc = "Checks if the value of the field is `BLKCNT_65535`"]
    #[inline(always)]
    pub fn is_blkcnt_65535(&self) -> bool {
        *self == BLKCNT_A::BLKCNT_65535
    }
}
#[doc = "Write proxy for field `BLKCNT`"]
pub struct BLKCNT_W<'a> {
    w: &'a mut W,
}
impl<'a> BLKCNT_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: BLKCNT_A) -> &'a mut W {
        unsafe { self.bits(variant.into()) }
    }
    #[doc = "Stop Count"]
    #[inline(always)]
    pub fn blkcnt_0(self) -> &'a mut W {
        self.variant(BLKCNT_A::BLKCNT_0)
    }
    #[doc = "1 block"]
    #[inline(always)]
    pub fn blkcnt_1(self) -> &'a mut W {
        self.variant(BLKCNT_A::BLKCNT_1)
    }
    #[doc = "2 blocks"]
    #[inline(always)]
    pub fn blkcnt_2(self) -> &'a mut W {
        self.variant(BLKCNT_A::BLKCNT_2)
    }
    #[doc = "65535 blocks"]
    #[inline(always)]
    pub fn blkcnt_65535(self) -> &'a mut W {
        self.variant(BLKCNT_A::BLKCNT_65535)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub unsafe fn bits(self, value: u16) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0xffff << 16)) | (((value as u32) & 0xffff) << 16);
        self.w
    }
}
impl R {
    #[doc = "Bits 0:12 - Block Size"]
    #[inline(always)]
    pub fn blksize(&self) -> BLKSIZE_R {
        BLKSIZE_R::new((self.bits & 0x1fff) as u16)
    }
    #[doc = "Bits 16:31 - Block Count"]
    #[inline(always)]
    pub fn blkcnt(&self) -> BLKCNT_R {
        BLKCNT_R::new(((self.bits >> 16) & 0xffff) as u16)
    }
}
impl W {
    #[doc = "Bits 0:12 - Block Size"]
    #[inline(always)]
    pub fn blksize(&mut self) -> BLKSIZE_W {
        BLKSIZE_W { w: self }
    }
    #[doc = "Bits 16:31 - Block Count"]
    #[inline(always)]
    pub fn blkcnt(&mut self) -> BLKCNT_W {
        BLKCNT_W { w: self }
    }
}