xmc4300/sdmmc/
command.rs

1#[doc = "Register `COMMAND` reader"]
2pub type R = crate::R<COMMAND_SPEC>;
3#[doc = "Register `COMMAND` writer"]
4pub type W = crate::W<COMMAND_SPEC>;
5#[doc = "Response Type Select\n\nValue on reset: 0"]
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7#[repr(u8)]
8pub enum RESP_TYPE_SELECT_A {
9    #[doc = "0: No Response"]
10    VALUE1 = 0,
11    #[doc = "1: Response length 136"]
12    VALUE2 = 1,
13    #[doc = "2: Response length 48"]
14    VALUE3 = 2,
15    #[doc = "3: Response length 48 check Busy after response"]
16    VALUE4 = 3,
17}
18impl From<RESP_TYPE_SELECT_A> for u8 {
19    #[inline(always)]
20    fn from(variant: RESP_TYPE_SELECT_A) -> Self {
21        variant as _
22    }
23}
24impl crate::FieldSpec for RESP_TYPE_SELECT_A {
25    type Ux = u8;
26}
27impl crate::IsEnum for RESP_TYPE_SELECT_A {}
28#[doc = "Field `RESP_TYPE_SELECT` reader - Response Type Select"]
29pub type RESP_TYPE_SELECT_R = crate::FieldReader<RESP_TYPE_SELECT_A>;
30impl RESP_TYPE_SELECT_R {
31    #[doc = "Get enumerated values variant"]
32    #[inline(always)]
33    pub const fn variant(&self) -> RESP_TYPE_SELECT_A {
34        match self.bits {
35            0 => RESP_TYPE_SELECT_A::VALUE1,
36            1 => RESP_TYPE_SELECT_A::VALUE2,
37            2 => RESP_TYPE_SELECT_A::VALUE3,
38            3 => RESP_TYPE_SELECT_A::VALUE4,
39            _ => unreachable!(),
40        }
41    }
42    #[doc = "No Response"]
43    #[inline(always)]
44    pub fn is_value1(&self) -> bool {
45        *self == RESP_TYPE_SELECT_A::VALUE1
46    }
47    #[doc = "Response length 136"]
48    #[inline(always)]
49    pub fn is_value2(&self) -> bool {
50        *self == RESP_TYPE_SELECT_A::VALUE2
51    }
52    #[doc = "Response length 48"]
53    #[inline(always)]
54    pub fn is_value3(&self) -> bool {
55        *self == RESP_TYPE_SELECT_A::VALUE3
56    }
57    #[doc = "Response length 48 check Busy after response"]
58    #[inline(always)]
59    pub fn is_value4(&self) -> bool {
60        *self == RESP_TYPE_SELECT_A::VALUE4
61    }
62}
63#[doc = "Field `RESP_TYPE_SELECT` writer - Response Type Select"]
64pub type RESP_TYPE_SELECT_W<'a, REG> = crate::FieldWriter<'a, REG, 2, RESP_TYPE_SELECT_A, crate::Safe>;
65impl<'a, REG> RESP_TYPE_SELECT_W<'a, REG>
66where
67    REG: crate::Writable + crate::RegisterSpec,
68    REG::Ux: From<u8>,
69{
70    #[doc = "No Response"]
71    #[inline(always)]
72    pub fn value1(self) -> &'a mut crate::W<REG> {
73        self.variant(RESP_TYPE_SELECT_A::VALUE1)
74    }
75    #[doc = "Response length 136"]
76    #[inline(always)]
77    pub fn value2(self) -> &'a mut crate::W<REG> {
78        self.variant(RESP_TYPE_SELECT_A::VALUE2)
79    }
80    #[doc = "Response length 48"]
81    #[inline(always)]
82    pub fn value3(self) -> &'a mut crate::W<REG> {
83        self.variant(RESP_TYPE_SELECT_A::VALUE3)
84    }
85    #[doc = "Response length 48 check Busy after response"]
86    #[inline(always)]
87    pub fn value4(self) -> &'a mut crate::W<REG> {
88        self.variant(RESP_TYPE_SELECT_A::VALUE4)
89    }
90}
91#[doc = "Command CRC Check Enable\n\nValue on reset: 0"]
92#[derive(Clone, Copy, Debug, PartialEq, Eq)]
93pub enum CMD_CRC_CHECK_EN_A {
94    #[doc = "0: Disable"]
95    VALUE1 = 0,
96    #[doc = "1: Enable"]
97    VALUE2 = 1,
98}
99impl From<CMD_CRC_CHECK_EN_A> for bool {
100    #[inline(always)]
101    fn from(variant: CMD_CRC_CHECK_EN_A) -> Self {
102        variant as u8 != 0
103    }
104}
105#[doc = "Field `CMD_CRC_CHECK_EN` reader - Command CRC Check Enable"]
106pub type CMD_CRC_CHECK_EN_R = crate::BitReader<CMD_CRC_CHECK_EN_A>;
107impl CMD_CRC_CHECK_EN_R {
108    #[doc = "Get enumerated values variant"]
109    #[inline(always)]
110    pub const fn variant(&self) -> CMD_CRC_CHECK_EN_A {
111        match self.bits {
112            false => CMD_CRC_CHECK_EN_A::VALUE1,
113            true => CMD_CRC_CHECK_EN_A::VALUE2,
114        }
115    }
116    #[doc = "Disable"]
117    #[inline(always)]
118    pub fn is_value1(&self) -> bool {
119        *self == CMD_CRC_CHECK_EN_A::VALUE1
120    }
121    #[doc = "Enable"]
122    #[inline(always)]
123    pub fn is_value2(&self) -> bool {
124        *self == CMD_CRC_CHECK_EN_A::VALUE2
125    }
126}
127#[doc = "Field `CMD_CRC_CHECK_EN` writer - Command CRC Check Enable"]
128pub type CMD_CRC_CHECK_EN_W<'a, REG> = crate::BitWriter<'a, REG, CMD_CRC_CHECK_EN_A>;
129impl<'a, REG> CMD_CRC_CHECK_EN_W<'a, REG>
130where
131    REG: crate::Writable + crate::RegisterSpec,
132{
133    #[doc = "Disable"]
134    #[inline(always)]
135    pub fn value1(self) -> &'a mut crate::W<REG> {
136        self.variant(CMD_CRC_CHECK_EN_A::VALUE1)
137    }
138    #[doc = "Enable"]
139    #[inline(always)]
140    pub fn value2(self) -> &'a mut crate::W<REG> {
141        self.variant(CMD_CRC_CHECK_EN_A::VALUE2)
142    }
143}
144#[doc = "Command Index Check Enable\n\nValue on reset: 0"]
145#[derive(Clone, Copy, Debug, PartialEq, Eq)]
146pub enum CMD_IND_CHECK_EN_A {
147    #[doc = "0: Disable"]
148    VALUE1 = 0,
149    #[doc = "1: Enable"]
150    VALUE2 = 1,
151}
152impl From<CMD_IND_CHECK_EN_A> for bool {
153    #[inline(always)]
154    fn from(variant: CMD_IND_CHECK_EN_A) -> Self {
155        variant as u8 != 0
156    }
157}
158#[doc = "Field `CMD_IND_CHECK_EN` reader - Command Index Check Enable"]
159pub type CMD_IND_CHECK_EN_R = crate::BitReader<CMD_IND_CHECK_EN_A>;
160impl CMD_IND_CHECK_EN_R {
161    #[doc = "Get enumerated values variant"]
162    #[inline(always)]
163    pub const fn variant(&self) -> CMD_IND_CHECK_EN_A {
164        match self.bits {
165            false => CMD_IND_CHECK_EN_A::VALUE1,
166            true => CMD_IND_CHECK_EN_A::VALUE2,
167        }
168    }
169    #[doc = "Disable"]
170    #[inline(always)]
171    pub fn is_value1(&self) -> bool {
172        *self == CMD_IND_CHECK_EN_A::VALUE1
173    }
174    #[doc = "Enable"]
175    #[inline(always)]
176    pub fn is_value2(&self) -> bool {
177        *self == CMD_IND_CHECK_EN_A::VALUE2
178    }
179}
180#[doc = "Field `CMD_IND_CHECK_EN` writer - Command Index Check Enable"]
181pub type CMD_IND_CHECK_EN_W<'a, REG> = crate::BitWriter<'a, REG, CMD_IND_CHECK_EN_A>;
182impl<'a, REG> CMD_IND_CHECK_EN_W<'a, REG>
183where
184    REG: crate::Writable + crate::RegisterSpec,
185{
186    #[doc = "Disable"]
187    #[inline(always)]
188    pub fn value1(self) -> &'a mut crate::W<REG> {
189        self.variant(CMD_IND_CHECK_EN_A::VALUE1)
190    }
191    #[doc = "Enable"]
192    #[inline(always)]
193    pub fn value2(self) -> &'a mut crate::W<REG> {
194        self.variant(CMD_IND_CHECK_EN_A::VALUE2)
195    }
196}
197#[doc = "Data Present Select\n\nValue on reset: 0"]
198#[derive(Clone, Copy, Debug, PartialEq, Eq)]
199pub enum DATA_PRESENT_SELECT_A {
200    #[doc = "0: No Data Present"]
201    VALUE1 = 0,
202    #[doc = "1: Data Present"]
203    VALUE2 = 1,
204}
205impl From<DATA_PRESENT_SELECT_A> for bool {
206    #[inline(always)]
207    fn from(variant: DATA_PRESENT_SELECT_A) -> Self {
208        variant as u8 != 0
209    }
210}
211#[doc = "Field `DATA_PRESENT_SELECT` reader - Data Present Select"]
212pub type DATA_PRESENT_SELECT_R = crate::BitReader<DATA_PRESENT_SELECT_A>;
213impl DATA_PRESENT_SELECT_R {
214    #[doc = "Get enumerated values variant"]
215    #[inline(always)]
216    pub const fn variant(&self) -> DATA_PRESENT_SELECT_A {
217        match self.bits {
218            false => DATA_PRESENT_SELECT_A::VALUE1,
219            true => DATA_PRESENT_SELECT_A::VALUE2,
220        }
221    }
222    #[doc = "No Data Present"]
223    #[inline(always)]
224    pub fn is_value1(&self) -> bool {
225        *self == DATA_PRESENT_SELECT_A::VALUE1
226    }
227    #[doc = "Data Present"]
228    #[inline(always)]
229    pub fn is_value2(&self) -> bool {
230        *self == DATA_PRESENT_SELECT_A::VALUE2
231    }
232}
233#[doc = "Field `DATA_PRESENT_SELECT` writer - Data Present Select"]
234pub type DATA_PRESENT_SELECT_W<'a, REG> = crate::BitWriter<'a, REG, DATA_PRESENT_SELECT_A>;
235impl<'a, REG> DATA_PRESENT_SELECT_W<'a, REG>
236where
237    REG: crate::Writable + crate::RegisterSpec,
238{
239    #[doc = "No Data Present"]
240    #[inline(always)]
241    pub fn value1(self) -> &'a mut crate::W<REG> {
242        self.variant(DATA_PRESENT_SELECT_A::VALUE1)
243    }
244    #[doc = "Data Present"]
245    #[inline(always)]
246    pub fn value2(self) -> &'a mut crate::W<REG> {
247        self.variant(DATA_PRESENT_SELECT_A::VALUE2)
248    }
249}
250#[doc = "Command Type\n\nValue on reset: 0"]
251#[derive(Clone, Copy, Debug, PartialEq, Eq)]
252#[repr(u8)]
253pub enum CMD_TYPE_A {
254    #[doc = "0: Normal"]
255    VALUE1 = 0,
256    #[doc = "1: Suspend"]
257    VALUE2 = 1,
258    #[doc = "2: Resume"]
259    VALUE3 = 2,
260    #[doc = "3: Abort"]
261    VALUE4 = 3,
262}
263impl From<CMD_TYPE_A> for u8 {
264    #[inline(always)]
265    fn from(variant: CMD_TYPE_A) -> Self {
266        variant as _
267    }
268}
269impl crate::FieldSpec for CMD_TYPE_A {
270    type Ux = u8;
271}
272impl crate::IsEnum for CMD_TYPE_A {}
273#[doc = "Field `CMD_TYPE` reader - Command Type"]
274pub type CMD_TYPE_R = crate::FieldReader<CMD_TYPE_A>;
275impl CMD_TYPE_R {
276    #[doc = "Get enumerated values variant"]
277    #[inline(always)]
278    pub const fn variant(&self) -> CMD_TYPE_A {
279        match self.bits {
280            0 => CMD_TYPE_A::VALUE1,
281            1 => CMD_TYPE_A::VALUE2,
282            2 => CMD_TYPE_A::VALUE3,
283            3 => CMD_TYPE_A::VALUE4,
284            _ => unreachable!(),
285        }
286    }
287    #[doc = "Normal"]
288    #[inline(always)]
289    pub fn is_value1(&self) -> bool {
290        *self == CMD_TYPE_A::VALUE1
291    }
292    #[doc = "Suspend"]
293    #[inline(always)]
294    pub fn is_value2(&self) -> bool {
295        *self == CMD_TYPE_A::VALUE2
296    }
297    #[doc = "Resume"]
298    #[inline(always)]
299    pub fn is_value3(&self) -> bool {
300        *self == CMD_TYPE_A::VALUE3
301    }
302    #[doc = "Abort"]
303    #[inline(always)]
304    pub fn is_value4(&self) -> bool {
305        *self == CMD_TYPE_A::VALUE4
306    }
307}
308#[doc = "Field `CMD_TYPE` writer - Command Type"]
309pub type CMD_TYPE_W<'a, REG> = crate::FieldWriter<'a, REG, 2, CMD_TYPE_A, crate::Safe>;
310impl<'a, REG> CMD_TYPE_W<'a, REG>
311where
312    REG: crate::Writable + crate::RegisterSpec,
313    REG::Ux: From<u8>,
314{
315    #[doc = "Normal"]
316    #[inline(always)]
317    pub fn value1(self) -> &'a mut crate::W<REG> {
318        self.variant(CMD_TYPE_A::VALUE1)
319    }
320    #[doc = "Suspend"]
321    #[inline(always)]
322    pub fn value2(self) -> &'a mut crate::W<REG> {
323        self.variant(CMD_TYPE_A::VALUE2)
324    }
325    #[doc = "Resume"]
326    #[inline(always)]
327    pub fn value3(self) -> &'a mut crate::W<REG> {
328        self.variant(CMD_TYPE_A::VALUE3)
329    }
330    #[doc = "Abort"]
331    #[inline(always)]
332    pub fn value4(self) -> &'a mut crate::W<REG> {
333        self.variant(CMD_TYPE_A::VALUE4)
334    }
335}
336#[doc = "Field `CMD_IND` reader - Command Index"]
337pub type CMD_IND_R = crate::FieldReader;
338#[doc = "Field `CMD_IND` writer - Command Index"]
339pub type CMD_IND_W<'a, REG> = crate::FieldWriter<'a, REG, 6>;
340impl R {
341    #[doc = "Bits 0:1 - Response Type Select"]
342    #[inline(always)]
343    pub fn resp_type_select(&self) -> RESP_TYPE_SELECT_R {
344        RESP_TYPE_SELECT_R::new((self.bits & 3) as u8)
345    }
346    #[doc = "Bit 3 - Command CRC Check Enable"]
347    #[inline(always)]
348    pub fn cmd_crc_check_en(&self) -> CMD_CRC_CHECK_EN_R {
349        CMD_CRC_CHECK_EN_R::new(((self.bits >> 3) & 1) != 0)
350    }
351    #[doc = "Bit 4 - Command Index Check Enable"]
352    #[inline(always)]
353    pub fn cmd_ind_check_en(&self) -> CMD_IND_CHECK_EN_R {
354        CMD_IND_CHECK_EN_R::new(((self.bits >> 4) & 1) != 0)
355    }
356    #[doc = "Bit 5 - Data Present Select"]
357    #[inline(always)]
358    pub fn data_present_select(&self) -> DATA_PRESENT_SELECT_R {
359        DATA_PRESENT_SELECT_R::new(((self.bits >> 5) & 1) != 0)
360    }
361    #[doc = "Bits 6:7 - Command Type"]
362    #[inline(always)]
363    pub fn cmd_type(&self) -> CMD_TYPE_R {
364        CMD_TYPE_R::new(((self.bits >> 6) & 3) as u8)
365    }
366    #[doc = "Bits 8:13 - Command Index"]
367    #[inline(always)]
368    pub fn cmd_ind(&self) -> CMD_IND_R {
369        CMD_IND_R::new(((self.bits >> 8) & 0x3f) as u8)
370    }
371}
372impl W {
373    #[doc = "Bits 0:1 - Response Type Select"]
374    #[inline(always)]
375    pub fn resp_type_select(&mut self) -> RESP_TYPE_SELECT_W<COMMAND_SPEC> {
376        RESP_TYPE_SELECT_W::new(self, 0)
377    }
378    #[doc = "Bit 3 - Command CRC Check Enable"]
379    #[inline(always)]
380    pub fn cmd_crc_check_en(&mut self) -> CMD_CRC_CHECK_EN_W<COMMAND_SPEC> {
381        CMD_CRC_CHECK_EN_W::new(self, 3)
382    }
383    #[doc = "Bit 4 - Command Index Check Enable"]
384    #[inline(always)]
385    pub fn cmd_ind_check_en(&mut self) -> CMD_IND_CHECK_EN_W<COMMAND_SPEC> {
386        CMD_IND_CHECK_EN_W::new(self, 4)
387    }
388    #[doc = "Bit 5 - Data Present Select"]
389    #[inline(always)]
390    pub fn data_present_select(&mut self) -> DATA_PRESENT_SELECT_W<COMMAND_SPEC> {
391        DATA_PRESENT_SELECT_W::new(self, 5)
392    }
393    #[doc = "Bits 6:7 - Command Type"]
394    #[inline(always)]
395    pub fn cmd_type(&mut self) -> CMD_TYPE_W<COMMAND_SPEC> {
396        CMD_TYPE_W::new(self, 6)
397    }
398    #[doc = "Bits 8:13 - Command Index"]
399    #[inline(always)]
400    pub fn cmd_ind(&mut self) -> CMD_IND_W<COMMAND_SPEC> {
401        CMD_IND_W::new(self, 8)
402    }
403}
404#[doc = "Command Register\n\nYou can [`read`](crate::Reg::read) this register and get [`command::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`command::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
405pub struct COMMAND_SPEC;
406impl crate::RegisterSpec for COMMAND_SPEC {
407    type Ux = u16;
408}
409#[doc = "`read()` method returns [`command::R`](R) reader structure"]
410impl crate::Readable for COMMAND_SPEC {}
411#[doc = "`write(|w| ..)` method takes [`command::W`](W) writer structure"]
412impl crate::Writable for COMMAND_SPEC {
413    type Safety = crate::Unsafe;
414    const ZERO_TO_MODIFY_FIELDS_BITMAP: u16 = 0;
415    const ONE_TO_MODIFY_FIELDS_BITMAP: u16 = 0;
416}
417#[doc = "`reset()` method sets COMMAND to value 0"]
418impl crate::Resettable for COMMAND_SPEC {
419    const RESET_VALUE: u16 = 0;
420}