ra4w1/usbfs/
cfifosel.rs

1#[doc = "Register `CFIFOSEL` reader"]
2pub struct R(crate::R<CFIFOSEL_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<CFIFOSEL_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<CFIFOSEL_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<CFIFOSEL_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `CFIFOSEL` writer"]
17pub struct W(crate::W<CFIFOSEL_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<CFIFOSEL_SPEC>;
20    #[inline(always)]
21    fn deref(&self) -> &Self::Target {
22        &self.0
23    }
24}
25impl core::ops::DerefMut for W {
26    #[inline(always)]
27    fn deref_mut(&mut self) -> &mut Self::Target {
28        &mut self.0
29    }
30}
31impl From<crate::W<CFIFOSEL_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<CFIFOSEL_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `CURPIPE` reader - CFIFO Port Access Pipe Specification"]
38pub type CURPIPE_R = crate::FieldReader<u8, CURPIPE_A>;
39#[doc = "CFIFO Port Access Pipe Specification\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum CURPIPE_A {
43    #[doc = "0: DCP (Default control pipe)"]
44    _0000 = 0,
45    #[doc = "1: Pipe 1"]
46    _0001 = 1,
47    #[doc = "2: Pipe 2"]
48    _0010 = 2,
49    #[doc = "3: Pipe 3"]
50    _0011 = 3,
51    #[doc = "4: Pipe 4"]
52    _0100 = 4,
53    #[doc = "5: Pipe 5"]
54    _0101 = 5,
55    #[doc = "6: Pipe 6"]
56    _0110 = 6,
57    #[doc = "7: Pipe 7"]
58    _0111 = 7,
59    #[doc = "8: Pipe 8"]
60    _1000 = 8,
61    #[doc = "9: Pipe 9"]
62    _1001 = 9,
63}
64impl From<CURPIPE_A> for u8 {
65    #[inline(always)]
66    fn from(variant: CURPIPE_A) -> Self {
67        variant as _
68    }
69}
70impl CURPIPE_R {
71    #[doc = "Get enumerated values variant"]
72    #[inline(always)]
73    pub fn variant(&self) -> Option<CURPIPE_A> {
74        match self.bits {
75            0 => Some(CURPIPE_A::_0000),
76            1 => Some(CURPIPE_A::_0001),
77            2 => Some(CURPIPE_A::_0010),
78            3 => Some(CURPIPE_A::_0011),
79            4 => Some(CURPIPE_A::_0100),
80            5 => Some(CURPIPE_A::_0101),
81            6 => Some(CURPIPE_A::_0110),
82            7 => Some(CURPIPE_A::_0111),
83            8 => Some(CURPIPE_A::_1000),
84            9 => Some(CURPIPE_A::_1001),
85            _ => None,
86        }
87    }
88    #[doc = "Checks if the value of the field is `_0000`"]
89    #[inline(always)]
90    pub fn is_0000(&self) -> bool {
91        *self == CURPIPE_A::_0000
92    }
93    #[doc = "Checks if the value of the field is `_0001`"]
94    #[inline(always)]
95    pub fn is_0001(&self) -> bool {
96        *self == CURPIPE_A::_0001
97    }
98    #[doc = "Checks if the value of the field is `_0010`"]
99    #[inline(always)]
100    pub fn is_0010(&self) -> bool {
101        *self == CURPIPE_A::_0010
102    }
103    #[doc = "Checks if the value of the field is `_0011`"]
104    #[inline(always)]
105    pub fn is_0011(&self) -> bool {
106        *self == CURPIPE_A::_0011
107    }
108    #[doc = "Checks if the value of the field is `_0100`"]
109    #[inline(always)]
110    pub fn is_0100(&self) -> bool {
111        *self == CURPIPE_A::_0100
112    }
113    #[doc = "Checks if the value of the field is `_0101`"]
114    #[inline(always)]
115    pub fn is_0101(&self) -> bool {
116        *self == CURPIPE_A::_0101
117    }
118    #[doc = "Checks if the value of the field is `_0110`"]
119    #[inline(always)]
120    pub fn is_0110(&self) -> bool {
121        *self == CURPIPE_A::_0110
122    }
123    #[doc = "Checks if the value of the field is `_0111`"]
124    #[inline(always)]
125    pub fn is_0111(&self) -> bool {
126        *self == CURPIPE_A::_0111
127    }
128    #[doc = "Checks if the value of the field is `_1000`"]
129    #[inline(always)]
130    pub fn is_1000(&self) -> bool {
131        *self == CURPIPE_A::_1000
132    }
133    #[doc = "Checks if the value of the field is `_1001`"]
134    #[inline(always)]
135    pub fn is_1001(&self) -> bool {
136        *self == CURPIPE_A::_1001
137    }
138}
139#[doc = "Field `CURPIPE` writer - CFIFO Port Access Pipe Specification"]
140pub type CURPIPE_W<'a, const O: u8> =
141    crate::FieldWriter<'a, u16, CFIFOSEL_SPEC, u8, CURPIPE_A, 4, O>;
142impl<'a, const O: u8> CURPIPE_W<'a, O> {
143    #[doc = "DCP (Default control pipe)"]
144    #[inline(always)]
145    pub fn _0000(self) -> &'a mut W {
146        self.variant(CURPIPE_A::_0000)
147    }
148    #[doc = "Pipe 1"]
149    #[inline(always)]
150    pub fn _0001(self) -> &'a mut W {
151        self.variant(CURPIPE_A::_0001)
152    }
153    #[doc = "Pipe 2"]
154    #[inline(always)]
155    pub fn _0010(self) -> &'a mut W {
156        self.variant(CURPIPE_A::_0010)
157    }
158    #[doc = "Pipe 3"]
159    #[inline(always)]
160    pub fn _0011(self) -> &'a mut W {
161        self.variant(CURPIPE_A::_0011)
162    }
163    #[doc = "Pipe 4"]
164    #[inline(always)]
165    pub fn _0100(self) -> &'a mut W {
166        self.variant(CURPIPE_A::_0100)
167    }
168    #[doc = "Pipe 5"]
169    #[inline(always)]
170    pub fn _0101(self) -> &'a mut W {
171        self.variant(CURPIPE_A::_0101)
172    }
173    #[doc = "Pipe 6"]
174    #[inline(always)]
175    pub fn _0110(self) -> &'a mut W {
176        self.variant(CURPIPE_A::_0110)
177    }
178    #[doc = "Pipe 7"]
179    #[inline(always)]
180    pub fn _0111(self) -> &'a mut W {
181        self.variant(CURPIPE_A::_0111)
182    }
183    #[doc = "Pipe 8"]
184    #[inline(always)]
185    pub fn _1000(self) -> &'a mut W {
186        self.variant(CURPIPE_A::_1000)
187    }
188    #[doc = "Pipe 9"]
189    #[inline(always)]
190    pub fn _1001(self) -> &'a mut W {
191        self.variant(CURPIPE_A::_1001)
192    }
193}
194#[doc = "Field `ISEL` reader - CFIFO Port Access Direction When DCP is Selected"]
195pub type ISEL_R = crate::BitReader<ISEL_A>;
196#[doc = "CFIFO Port Access Direction When DCP is Selected\n\nValue on reset: 0"]
197#[derive(Clone, Copy, Debug, PartialEq, Eq)]
198pub enum ISEL_A {
199    #[doc = "0: Reading from the buffer memory is selected"]
200    _0 = 0,
201    #[doc = "1: Writing to the buffer memory is selected"]
202    _1 = 1,
203}
204impl From<ISEL_A> for bool {
205    #[inline(always)]
206    fn from(variant: ISEL_A) -> Self {
207        variant as u8 != 0
208    }
209}
210impl ISEL_R {
211    #[doc = "Get enumerated values variant"]
212    #[inline(always)]
213    pub fn variant(&self) -> ISEL_A {
214        match self.bits {
215            false => ISEL_A::_0,
216            true => ISEL_A::_1,
217        }
218    }
219    #[doc = "Checks if the value of the field is `_0`"]
220    #[inline(always)]
221    pub fn is_0(&self) -> bool {
222        *self == ISEL_A::_0
223    }
224    #[doc = "Checks if the value of the field is `_1`"]
225    #[inline(always)]
226    pub fn is_1(&self) -> bool {
227        *self == ISEL_A::_1
228    }
229}
230#[doc = "Field `ISEL` writer - CFIFO Port Access Direction When DCP is Selected"]
231pub type ISEL_W<'a, const O: u8> = crate::BitWriter<'a, u16, CFIFOSEL_SPEC, ISEL_A, O>;
232impl<'a, const O: u8> ISEL_W<'a, O> {
233    #[doc = "Reading from the buffer memory is selected"]
234    #[inline(always)]
235    pub fn _0(self) -> &'a mut W {
236        self.variant(ISEL_A::_0)
237    }
238    #[doc = "Writing to the buffer memory is selected"]
239    #[inline(always)]
240    pub fn _1(self) -> &'a mut W {
241        self.variant(ISEL_A::_1)
242    }
243}
244#[doc = "Field `BIGEND` reader - CFIFO Port Endian Control"]
245pub type BIGEND_R = crate::BitReader<BIGEND_A>;
246#[doc = "CFIFO Port Endian Control\n\nValue on reset: 0"]
247#[derive(Clone, Copy, Debug, PartialEq, Eq)]
248pub enum BIGEND_A {
249    #[doc = "0: Little endian"]
250    _0 = 0,
251    #[doc = "1: Big endian"]
252    _1 = 1,
253}
254impl From<BIGEND_A> for bool {
255    #[inline(always)]
256    fn from(variant: BIGEND_A) -> Self {
257        variant as u8 != 0
258    }
259}
260impl BIGEND_R {
261    #[doc = "Get enumerated values variant"]
262    #[inline(always)]
263    pub fn variant(&self) -> BIGEND_A {
264        match self.bits {
265            false => BIGEND_A::_0,
266            true => BIGEND_A::_1,
267        }
268    }
269    #[doc = "Checks if the value of the field is `_0`"]
270    #[inline(always)]
271    pub fn is_0(&self) -> bool {
272        *self == BIGEND_A::_0
273    }
274    #[doc = "Checks if the value of the field is `_1`"]
275    #[inline(always)]
276    pub fn is_1(&self) -> bool {
277        *self == BIGEND_A::_1
278    }
279}
280#[doc = "Field `BIGEND` writer - CFIFO Port Endian Control"]
281pub type BIGEND_W<'a, const O: u8> = crate::BitWriter<'a, u16, CFIFOSEL_SPEC, BIGEND_A, O>;
282impl<'a, const O: u8> BIGEND_W<'a, O> {
283    #[doc = "Little endian"]
284    #[inline(always)]
285    pub fn _0(self) -> &'a mut W {
286        self.variant(BIGEND_A::_0)
287    }
288    #[doc = "Big endian"]
289    #[inline(always)]
290    pub fn _1(self) -> &'a mut W {
291        self.variant(BIGEND_A::_1)
292    }
293}
294#[doc = "Field `MBW` reader - CFIFO Port Access Bit Width"]
295pub type MBW_R = crate::BitReader<MBW_A>;
296#[doc = "CFIFO Port Access Bit Width\n\nValue on reset: 0"]
297#[derive(Clone, Copy, Debug, PartialEq, Eq)]
298pub enum MBW_A {
299    #[doc = "0: 8-bit width"]
300    _0 = 0,
301    #[doc = "1: 16-bit width"]
302    _1 = 1,
303}
304impl From<MBW_A> for bool {
305    #[inline(always)]
306    fn from(variant: MBW_A) -> Self {
307        variant as u8 != 0
308    }
309}
310impl MBW_R {
311    #[doc = "Get enumerated values variant"]
312    #[inline(always)]
313    pub fn variant(&self) -> MBW_A {
314        match self.bits {
315            false => MBW_A::_0,
316            true => MBW_A::_1,
317        }
318    }
319    #[doc = "Checks if the value of the field is `_0`"]
320    #[inline(always)]
321    pub fn is_0(&self) -> bool {
322        *self == MBW_A::_0
323    }
324    #[doc = "Checks if the value of the field is `_1`"]
325    #[inline(always)]
326    pub fn is_1(&self) -> bool {
327        *self == MBW_A::_1
328    }
329}
330#[doc = "Field `MBW` writer - CFIFO Port Access Bit Width"]
331pub type MBW_W<'a, const O: u8> = crate::BitWriter<'a, u16, CFIFOSEL_SPEC, MBW_A, O>;
332impl<'a, const O: u8> MBW_W<'a, O> {
333    #[doc = "8-bit width"]
334    #[inline(always)]
335    pub fn _0(self) -> &'a mut W {
336        self.variant(MBW_A::_0)
337    }
338    #[doc = "16-bit width"]
339    #[inline(always)]
340    pub fn _1(self) -> &'a mut W {
341        self.variant(MBW_A::_1)
342    }
343}
344#[doc = "Field `REW` reader - Buffer Pointer Rewind"]
345pub type REW_R = crate::BitReader<REW_A>;
346#[doc = "Buffer Pointer Rewind\n\nValue on reset: 0"]
347#[derive(Clone, Copy, Debug, PartialEq, Eq)]
348pub enum REW_A {
349    #[doc = "0: The buffer pointer is not rewound."]
350    _0 = 0,
351    #[doc = "1: The buffer pointer is rewound."]
352    _1 = 1,
353}
354impl From<REW_A> for bool {
355    #[inline(always)]
356    fn from(variant: REW_A) -> Self {
357        variant as u8 != 0
358    }
359}
360impl REW_R {
361    #[doc = "Get enumerated values variant"]
362    #[inline(always)]
363    pub fn variant(&self) -> REW_A {
364        match self.bits {
365            false => REW_A::_0,
366            true => REW_A::_1,
367        }
368    }
369    #[doc = "Checks if the value of the field is `_0`"]
370    #[inline(always)]
371    pub fn is_0(&self) -> bool {
372        *self == REW_A::_0
373    }
374    #[doc = "Checks if the value of the field is `_1`"]
375    #[inline(always)]
376    pub fn is_1(&self) -> bool {
377        *self == REW_A::_1
378    }
379}
380#[doc = "Field `REW` writer - Buffer Pointer Rewind"]
381pub type REW_W<'a, const O: u8> = crate::BitWriter<'a, u16, CFIFOSEL_SPEC, REW_A, O>;
382impl<'a, const O: u8> REW_W<'a, O> {
383    #[doc = "The buffer pointer is not rewound."]
384    #[inline(always)]
385    pub fn _0(self) -> &'a mut W {
386        self.variant(REW_A::_0)
387    }
388    #[doc = "The buffer pointer is rewound."]
389    #[inline(always)]
390    pub fn _1(self) -> &'a mut W {
391        self.variant(REW_A::_1)
392    }
393}
394#[doc = "Field `RCNT` reader - Read Count Mode"]
395pub type RCNT_R = crate::BitReader<RCNT_A>;
396#[doc = "Read Count Mode\n\nValue on reset: 0"]
397#[derive(Clone, Copy, Debug, PartialEq, Eq)]
398pub enum RCNT_A {
399    #[doc = "0: The DTLN\\[8:0\\]
400bits (CFIFOCRT.DTLN\\[8:0\\], D0FIFOCRT.DTLN\\[8:0\\], D1FIFOCRT.DTLN\\[8:0\\]) are cleared when all of the receive data has been read from the CFIFO.(In double buffer mode, the DTLN\\[8:0\\]
401bit value is cleared when all the data has been read from only a single plane.)"]
402    _0 = 0,
403    #[doc = "1: The DTLN\\[8:0\\]
404bits are decremented each time the receive data is read from the CFIFO."]
405    _1 = 1,
406}
407impl From<RCNT_A> for bool {
408    #[inline(always)]
409    fn from(variant: RCNT_A) -> Self {
410        variant as u8 != 0
411    }
412}
413impl RCNT_R {
414    #[doc = "Get enumerated values variant"]
415    #[inline(always)]
416    pub fn variant(&self) -> RCNT_A {
417        match self.bits {
418            false => RCNT_A::_0,
419            true => RCNT_A::_1,
420        }
421    }
422    #[doc = "Checks if the value of the field is `_0`"]
423    #[inline(always)]
424    pub fn is_0(&self) -> bool {
425        *self == RCNT_A::_0
426    }
427    #[doc = "Checks if the value of the field is `_1`"]
428    #[inline(always)]
429    pub fn is_1(&self) -> bool {
430        *self == RCNT_A::_1
431    }
432}
433#[doc = "Field `RCNT` writer - Read Count Mode"]
434pub type RCNT_W<'a, const O: u8> = crate::BitWriter<'a, u16, CFIFOSEL_SPEC, RCNT_A, O>;
435impl<'a, const O: u8> RCNT_W<'a, O> {
436    #[doc = "The DTLN\\[8:0\\]
437bits (CFIFOCRT.DTLN\\[8:0\\], D0FIFOCRT.DTLN\\[8:0\\], D1FIFOCRT.DTLN\\[8:0\\]) are cleared when all of the receive data has been read from the CFIFO.(In double buffer mode, the DTLN\\[8:0\\]
438bit value is cleared when all the data has been read from only a single plane.)"]
439    #[inline(always)]
440    pub fn _0(self) -> &'a mut W {
441        self.variant(RCNT_A::_0)
442    }
443    #[doc = "The DTLN\\[8:0\\]
444bits are decremented each time the receive data is read from the CFIFO."]
445    #[inline(always)]
446    pub fn _1(self) -> &'a mut W {
447        self.variant(RCNT_A::_1)
448    }
449}
450impl R {
451    #[doc = "Bits 0:3 - CFIFO Port Access Pipe Specification"]
452    #[inline(always)]
453    pub fn curpipe(&self) -> CURPIPE_R {
454        CURPIPE_R::new((self.bits & 0x0f) as u8)
455    }
456    #[doc = "Bit 5 - CFIFO Port Access Direction When DCP is Selected"]
457    #[inline(always)]
458    pub fn isel(&self) -> ISEL_R {
459        ISEL_R::new(((self.bits >> 5) & 1) != 0)
460    }
461    #[doc = "Bit 8 - CFIFO Port Endian Control"]
462    #[inline(always)]
463    pub fn bigend(&self) -> BIGEND_R {
464        BIGEND_R::new(((self.bits >> 8) & 1) != 0)
465    }
466    #[doc = "Bit 10 - CFIFO Port Access Bit Width"]
467    #[inline(always)]
468    pub fn mbw(&self) -> MBW_R {
469        MBW_R::new(((self.bits >> 10) & 1) != 0)
470    }
471    #[doc = "Bit 14 - Buffer Pointer Rewind"]
472    #[inline(always)]
473    pub fn rew(&self) -> REW_R {
474        REW_R::new(((self.bits >> 14) & 1) != 0)
475    }
476    #[doc = "Bit 15 - Read Count Mode"]
477    #[inline(always)]
478    pub fn rcnt(&self) -> RCNT_R {
479        RCNT_R::new(((self.bits >> 15) & 1) != 0)
480    }
481}
482impl W {
483    #[doc = "Bits 0:3 - CFIFO Port Access Pipe Specification"]
484    #[inline(always)]
485    #[must_use]
486    pub fn curpipe(&mut self) -> CURPIPE_W<0> {
487        CURPIPE_W::new(self)
488    }
489    #[doc = "Bit 5 - CFIFO Port Access Direction When DCP is Selected"]
490    #[inline(always)]
491    #[must_use]
492    pub fn isel(&mut self) -> ISEL_W<5> {
493        ISEL_W::new(self)
494    }
495    #[doc = "Bit 8 - CFIFO Port Endian Control"]
496    #[inline(always)]
497    #[must_use]
498    pub fn bigend(&mut self) -> BIGEND_W<8> {
499        BIGEND_W::new(self)
500    }
501    #[doc = "Bit 10 - CFIFO Port Access Bit Width"]
502    #[inline(always)]
503    #[must_use]
504    pub fn mbw(&mut self) -> MBW_W<10> {
505        MBW_W::new(self)
506    }
507    #[doc = "Bit 14 - Buffer Pointer Rewind"]
508    #[inline(always)]
509    #[must_use]
510    pub fn rew(&mut self) -> REW_W<14> {
511        REW_W::new(self)
512    }
513    #[doc = "Bit 15 - Read Count Mode"]
514    #[inline(always)]
515    #[must_use]
516    pub fn rcnt(&mut self) -> RCNT_W<15> {
517        RCNT_W::new(self)
518    }
519    #[doc = "Writes raw bits to the register."]
520    #[inline(always)]
521    pub unsafe fn bits(&mut self, bits: u16) -> &mut Self {
522        self.0.bits(bits);
523        self
524    }
525}
526#[doc = "CFIFO Port Select Register\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 [cfifosel](index.html) module"]
527pub struct CFIFOSEL_SPEC;
528impl crate::RegisterSpec for CFIFOSEL_SPEC {
529    type Ux = u16;
530}
531#[doc = "`read()` method returns [cfifosel::R](R) reader structure"]
532impl crate::Readable for CFIFOSEL_SPEC {
533    type Reader = R;
534}
535#[doc = "`write(|w| ..)` method takes [cfifosel::W](W) writer structure"]
536impl crate::Writable for CFIFOSEL_SPEC {
537    type Writer = W;
538    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
539    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
540}
541#[doc = "`reset()` method sets CFIFOSEL to value 0"]
542impl crate::Resettable for CFIFOSEL_SPEC {
543    const RESET_VALUE: Self::Ux = 0;
544}