ra6m3/usbfs/
cfifoctr.rs

1#[doc = "Register `CFIFOCTR` reader"]
2pub struct R(crate::R<CFIFOCTR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<CFIFOCTR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<CFIFOCTR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<CFIFOCTR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `CFIFOCTR` writer"]
17pub struct W(crate::W<CFIFOCTR_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<CFIFOCTR_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<CFIFOCTR_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<CFIFOCTR_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `DTLN` reader - Receive Data LengthIndicates the length of the receive data."]
38pub type DTLN_R = crate::FieldReader<u16, u16>;
39#[doc = "Field `FRDY` reader - FIFO Port Ready"]
40pub type FRDY_R = crate::BitReader<FRDY_A>;
41#[doc = "FIFO Port Ready\n\nValue on reset: 0"]
42#[derive(Clone, Copy, Debug, PartialEq, Eq)]
43pub enum FRDY_A {
44    #[doc = "0: FIFO port access is disabled."]
45    _0 = 0,
46    #[doc = "1: FIFO port access is enabled."]
47    _1 = 1,
48}
49impl From<FRDY_A> for bool {
50    #[inline(always)]
51    fn from(variant: FRDY_A) -> Self {
52        variant as u8 != 0
53    }
54}
55impl FRDY_R {
56    #[doc = "Get enumerated values variant"]
57    #[inline(always)]
58    pub fn variant(&self) -> FRDY_A {
59        match self.bits {
60            false => FRDY_A::_0,
61            true => FRDY_A::_1,
62        }
63    }
64    #[doc = "Checks if the value of the field is `_0`"]
65    #[inline(always)]
66    pub fn is_0(&self) -> bool {
67        *self == FRDY_A::_0
68    }
69    #[doc = "Checks if the value of the field is `_1`"]
70    #[inline(always)]
71    pub fn is_1(&self) -> bool {
72        *self == FRDY_A::_1
73    }
74}
75#[doc = "Field `BCLR` reader - CPU Buffer Clear"]
76pub type BCLR_R = crate::BitReader<BCLR_A>;
77#[doc = "CPU Buffer Clear\n\nValue on reset: 0"]
78#[derive(Clone, Copy, Debug, PartialEq, Eq)]
79pub enum BCLR_A {
80    #[doc = "0: Invalid"]
81    _0 = 0,
82    #[doc = "1: Clears the buffer memory on the CPU side"]
83    _1 = 1,
84}
85impl From<BCLR_A> for bool {
86    #[inline(always)]
87    fn from(variant: BCLR_A) -> Self {
88        variant as u8 != 0
89    }
90}
91impl BCLR_R {
92    #[doc = "Get enumerated values variant"]
93    #[inline(always)]
94    pub fn variant(&self) -> BCLR_A {
95        match self.bits {
96            false => BCLR_A::_0,
97            true => BCLR_A::_1,
98        }
99    }
100    #[doc = "Checks if the value of the field is `_0`"]
101    #[inline(always)]
102    pub fn is_0(&self) -> bool {
103        *self == BCLR_A::_0
104    }
105    #[doc = "Checks if the value of the field is `_1`"]
106    #[inline(always)]
107    pub fn is_1(&self) -> bool {
108        *self == BCLR_A::_1
109    }
110}
111#[doc = "Field `BVAL` reader - Buffer Memory Valid Flag"]
112pub type BVAL_R = crate::BitReader<BVAL_A>;
113#[doc = "Buffer Memory Valid Flag\n\nValue on reset: 0"]
114#[derive(Clone, Copy, Debug, PartialEq, Eq)]
115pub enum BVAL_A {
116    #[doc = "0: Invalid"]
117    _0 = 0,
118    #[doc = "1: Writing ended"]
119    _1 = 1,
120}
121impl From<BVAL_A> for bool {
122    #[inline(always)]
123    fn from(variant: BVAL_A) -> Self {
124        variant as u8 != 0
125    }
126}
127impl BVAL_R {
128    #[doc = "Get enumerated values variant"]
129    #[inline(always)]
130    pub fn variant(&self) -> BVAL_A {
131        match self.bits {
132            false => BVAL_A::_0,
133            true => BVAL_A::_1,
134        }
135    }
136    #[doc = "Checks if the value of the field is `_0`"]
137    #[inline(always)]
138    pub fn is_0(&self) -> bool {
139        *self == BVAL_A::_0
140    }
141    #[doc = "Checks if the value of the field is `_1`"]
142    #[inline(always)]
143    pub fn is_1(&self) -> bool {
144        *self == BVAL_A::_1
145    }
146}
147#[doc = "Field `BVAL` writer - Buffer Memory Valid Flag"]
148pub type BVAL_W<'a, const O: u8> = crate::BitWriter<'a, u16, CFIFOCTR_SPEC, BVAL_A, O>;
149impl<'a, const O: u8> BVAL_W<'a, O> {
150    #[doc = "Invalid"]
151    #[inline(always)]
152    pub fn _0(self) -> &'a mut W {
153        self.variant(BVAL_A::_0)
154    }
155    #[doc = "Writing ended"]
156    #[inline(always)]
157    pub fn _1(self) -> &'a mut W {
158        self.variant(BVAL_A::_1)
159    }
160}
161impl R {
162    #[doc = "Bits 0:8 - Receive Data LengthIndicates the length of the receive data."]
163    #[inline(always)]
164    pub fn dtln(&self) -> DTLN_R {
165        DTLN_R::new(self.bits & 0x01ff)
166    }
167    #[doc = "Bit 13 - FIFO Port Ready"]
168    #[inline(always)]
169    pub fn frdy(&self) -> FRDY_R {
170        FRDY_R::new(((self.bits >> 13) & 1) != 0)
171    }
172    #[doc = "Bit 14 - CPU Buffer Clear"]
173    #[inline(always)]
174    pub fn bclr(&self) -> BCLR_R {
175        BCLR_R::new(((self.bits >> 14) & 1) != 0)
176    }
177    #[doc = "Bit 15 - Buffer Memory Valid Flag"]
178    #[inline(always)]
179    pub fn bval(&self) -> BVAL_R {
180        BVAL_R::new(((self.bits >> 15) & 1) != 0)
181    }
182}
183impl W {
184    #[doc = "Bit 15 - Buffer Memory Valid Flag"]
185    #[inline(always)]
186    #[must_use]
187    pub fn bval(&mut self) -> BVAL_W<15> {
188        BVAL_W::new(self)
189    }
190    #[doc = "Writes raw bits to the register."]
191    #[inline(always)]
192    pub unsafe fn bits(&mut self, bits: u16) -> &mut Self {
193        self.0.bits(bits);
194        self
195    }
196}
197#[doc = "CFIFO Port Control 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 [cfifoctr](index.html) module"]
198pub struct CFIFOCTR_SPEC;
199impl crate::RegisterSpec for CFIFOCTR_SPEC {
200    type Ux = u16;
201}
202#[doc = "`read()` method returns [cfifoctr::R](R) reader structure"]
203impl crate::Readable for CFIFOCTR_SPEC {
204    type Reader = R;
205}
206#[doc = "`write(|w| ..)` method takes [cfifoctr::W](W) writer structure"]
207impl crate::Writable for CFIFOCTR_SPEC {
208    type Writer = W;
209    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
210    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
211}
212#[doc = "`reset()` method sets CFIFOCTR to value 0"]
213impl crate::Resettable for CFIFOCTR_SPEC {
214    const RESET_VALUE: Self::Ux = 0;
215}