efm32gg_pac/efm32gg995/usb/
grstctl.rs1#[doc = "Register `GRSTCTL` reader"]
2pub struct R(crate::R<GRSTCTL_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<GRSTCTL_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<GRSTCTL_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<GRSTCTL_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `GRSTCTL` writer"]
17pub struct W(crate::W<GRSTCTL_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<GRSTCTL_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<GRSTCTL_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<GRSTCTL_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `CSFTRST` reader - Core Soft Reset host and device"]
38pub type CSFTRST_R = crate::BitReader<bool>;
39#[doc = "Field `CSFTRST` writer - Core Soft Reset host and device"]
40pub type CSFTRST_W<'a, const O: u8> = crate::BitWriter<'a, u32, GRSTCTL_SPEC, bool, O>;
41#[doc = "Field `FRMCNTRRST` reader - Host Frame Counter Reset host only"]
42pub type FRMCNTRRST_R = crate::BitReader<bool>;
43#[doc = "Field `FRMCNTRRST` writer - Host Frame Counter Reset host only"]
44pub type FRMCNTRRST_W<'a, const O: u8> = crate::BitWriter<'a, u32, GRSTCTL_SPEC, bool, O>;
45#[doc = "Field `RXFFLSH` reader - RxFIFO Flush host and device"]
46pub type RXFFLSH_R = crate::BitReader<bool>;
47#[doc = "Field `RXFFLSH` writer - RxFIFO Flush host and device"]
48pub type RXFFLSH_W<'a, const O: u8> = crate::BitWriter<'a, u32, GRSTCTL_SPEC, bool, O>;
49#[doc = "Field `TXFFLSH` reader - TxFIFO Flush host and device"]
50pub type TXFFLSH_R = crate::BitReader<bool>;
51#[doc = "Field `TXFFLSH` writer - TxFIFO Flush host and device"]
52pub type TXFFLSH_W<'a, const O: u8> = crate::BitWriter<'a, u32, GRSTCTL_SPEC, bool, O>;
53#[doc = "Field `TXFNUM` reader - TxFIFO Number host and device"]
54pub type TXFNUM_R = crate::FieldReader<u8, TXFNUM_A>;
55#[doc = "TxFIFO Number host and device\n\nValue on reset: 0"]
56#[derive(Clone, Copy, Debug, PartialEq, Eq)]
57#[repr(u8)]
58pub enum TXFNUM_A {
59 #[doc = "0: Host mode: Non-periodic TxFIFO flush. Device: Tx FIFO 0 flush"]
60 F0 = 0,
61 #[doc = "1: Host mode: Periodic TxFIFO flush. Device: TXFIFO 1 flush."]
62 F1 = 1,
63 #[doc = "2: Device mode: TXFIFO 2 flush."]
64 F2 = 2,
65 #[doc = "3: Device mode: TXFIFO 3 flush."]
66 F3 = 3,
67 #[doc = "4: Device mode: TXFIFO 4 flush."]
68 F4 = 4,
69 #[doc = "5: Device mode: TXFIFO 5 flush."]
70 F5 = 5,
71 #[doc = "6: Device mode: TXFIFO 6 flush."]
72 F6 = 6,
73 #[doc = "16: Flush all the transmit FIFOs in device or host mode."]
74 FALL = 16,
75}
76impl From<TXFNUM_A> for u8 {
77 #[inline(always)]
78 fn from(variant: TXFNUM_A) -> Self {
79 variant as _
80 }
81}
82impl TXFNUM_R {
83 #[doc = "Get enumerated values variant"]
84 #[inline(always)]
85 pub fn variant(&self) -> Option<TXFNUM_A> {
86 match self.bits {
87 0 => Some(TXFNUM_A::F0),
88 1 => Some(TXFNUM_A::F1),
89 2 => Some(TXFNUM_A::F2),
90 3 => Some(TXFNUM_A::F3),
91 4 => Some(TXFNUM_A::F4),
92 5 => Some(TXFNUM_A::F5),
93 6 => Some(TXFNUM_A::F6),
94 16 => Some(TXFNUM_A::FALL),
95 _ => None,
96 }
97 }
98 #[doc = "Checks if the value of the field is `F0`"]
99 #[inline(always)]
100 pub fn is_f0(&self) -> bool {
101 *self == TXFNUM_A::F0
102 }
103 #[doc = "Checks if the value of the field is `F1`"]
104 #[inline(always)]
105 pub fn is_f1(&self) -> bool {
106 *self == TXFNUM_A::F1
107 }
108 #[doc = "Checks if the value of the field is `F2`"]
109 #[inline(always)]
110 pub fn is_f2(&self) -> bool {
111 *self == TXFNUM_A::F2
112 }
113 #[doc = "Checks if the value of the field is `F3`"]
114 #[inline(always)]
115 pub fn is_f3(&self) -> bool {
116 *self == TXFNUM_A::F3
117 }
118 #[doc = "Checks if the value of the field is `F4`"]
119 #[inline(always)]
120 pub fn is_f4(&self) -> bool {
121 *self == TXFNUM_A::F4
122 }
123 #[doc = "Checks if the value of the field is `F5`"]
124 #[inline(always)]
125 pub fn is_f5(&self) -> bool {
126 *self == TXFNUM_A::F5
127 }
128 #[doc = "Checks if the value of the field is `F6`"]
129 #[inline(always)]
130 pub fn is_f6(&self) -> bool {
131 *self == TXFNUM_A::F6
132 }
133 #[doc = "Checks if the value of the field is `FALL`"]
134 #[inline(always)]
135 pub fn is_fall(&self) -> bool {
136 *self == TXFNUM_A::FALL
137 }
138}
139#[doc = "Field `TXFNUM` writer - TxFIFO Number host and device"]
140pub type TXFNUM_W<'a, const O: u8> = crate::FieldWriter<'a, u32, GRSTCTL_SPEC, u8, TXFNUM_A, 5, O>;
141impl<'a, const O: u8> TXFNUM_W<'a, O> {
142 #[doc = "Host mode: Non-periodic TxFIFO flush. Device: Tx FIFO 0 flush"]
143 #[inline(always)]
144 pub fn f0(self) -> &'a mut W {
145 self.variant(TXFNUM_A::F0)
146 }
147 #[doc = "Host mode: Periodic TxFIFO flush. Device: TXFIFO 1 flush."]
148 #[inline(always)]
149 pub fn f1(self) -> &'a mut W {
150 self.variant(TXFNUM_A::F1)
151 }
152 #[doc = "Device mode: TXFIFO 2 flush."]
153 #[inline(always)]
154 pub fn f2(self) -> &'a mut W {
155 self.variant(TXFNUM_A::F2)
156 }
157 #[doc = "Device mode: TXFIFO 3 flush."]
158 #[inline(always)]
159 pub fn f3(self) -> &'a mut W {
160 self.variant(TXFNUM_A::F3)
161 }
162 #[doc = "Device mode: TXFIFO 4 flush."]
163 #[inline(always)]
164 pub fn f4(self) -> &'a mut W {
165 self.variant(TXFNUM_A::F4)
166 }
167 #[doc = "Device mode: TXFIFO 5 flush."]
168 #[inline(always)]
169 pub fn f5(self) -> &'a mut W {
170 self.variant(TXFNUM_A::F5)
171 }
172 #[doc = "Device mode: TXFIFO 6 flush."]
173 #[inline(always)]
174 pub fn f6(self) -> &'a mut W {
175 self.variant(TXFNUM_A::F6)
176 }
177 #[doc = "Flush all the transmit FIFOs in device or host mode."]
178 #[inline(always)]
179 pub fn fall(self) -> &'a mut W {
180 self.variant(TXFNUM_A::FALL)
181 }
182}
183#[doc = "Field `DMAREQ` reader - DMA Request Signal host and device"]
184pub type DMAREQ_R = crate::BitReader<bool>;
185#[doc = "Field `AHBIDLE` reader - AHB Master Idle host and device"]
186pub type AHBIDLE_R = crate::BitReader<bool>;
187impl R {
188 #[doc = "Bit 0 - Core Soft Reset host and device"]
189 #[inline(always)]
190 pub fn csftrst(&self) -> CSFTRST_R {
191 CSFTRST_R::new((self.bits & 1) != 0)
192 }
193 #[doc = "Bit 2 - Host Frame Counter Reset host only"]
194 #[inline(always)]
195 pub fn frmcntrrst(&self) -> FRMCNTRRST_R {
196 FRMCNTRRST_R::new(((self.bits >> 2) & 1) != 0)
197 }
198 #[doc = "Bit 4 - RxFIFO Flush host and device"]
199 #[inline(always)]
200 pub fn rxfflsh(&self) -> RXFFLSH_R {
201 RXFFLSH_R::new(((self.bits >> 4) & 1) != 0)
202 }
203 #[doc = "Bit 5 - TxFIFO Flush host and device"]
204 #[inline(always)]
205 pub fn txfflsh(&self) -> TXFFLSH_R {
206 TXFFLSH_R::new(((self.bits >> 5) & 1) != 0)
207 }
208 #[doc = "Bits 6:10 - TxFIFO Number host and device"]
209 #[inline(always)]
210 pub fn txfnum(&self) -> TXFNUM_R {
211 TXFNUM_R::new(((self.bits >> 6) & 0x1f) as u8)
212 }
213 #[doc = "Bit 30 - DMA Request Signal host and device"]
214 #[inline(always)]
215 pub fn dmareq(&self) -> DMAREQ_R {
216 DMAREQ_R::new(((self.bits >> 30) & 1) != 0)
217 }
218 #[doc = "Bit 31 - AHB Master Idle host and device"]
219 #[inline(always)]
220 pub fn ahbidle(&self) -> AHBIDLE_R {
221 AHBIDLE_R::new(((self.bits >> 31) & 1) != 0)
222 }
223}
224impl W {
225 #[doc = "Bit 0 - Core Soft Reset host and device"]
226 #[inline(always)]
227 #[must_use]
228 pub fn csftrst(&mut self) -> CSFTRST_W<0> {
229 CSFTRST_W::new(self)
230 }
231 #[doc = "Bit 2 - Host Frame Counter Reset host only"]
232 #[inline(always)]
233 #[must_use]
234 pub fn frmcntrrst(&mut self) -> FRMCNTRRST_W<2> {
235 FRMCNTRRST_W::new(self)
236 }
237 #[doc = "Bit 4 - RxFIFO Flush host and device"]
238 #[inline(always)]
239 #[must_use]
240 pub fn rxfflsh(&mut self) -> RXFFLSH_W<4> {
241 RXFFLSH_W::new(self)
242 }
243 #[doc = "Bit 5 - TxFIFO Flush host and device"]
244 #[inline(always)]
245 #[must_use]
246 pub fn txfflsh(&mut self) -> TXFFLSH_W<5> {
247 TXFFLSH_W::new(self)
248 }
249 #[doc = "Bits 6:10 - TxFIFO Number host and device"]
250 #[inline(always)]
251 #[must_use]
252 pub fn txfnum(&mut self) -> TXFNUM_W<6> {
253 TXFNUM_W::new(self)
254 }
255 #[doc = "Writes raw bits to the register."]
256 #[inline(always)]
257 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
258 self.0.bits(bits);
259 self
260 }
261}
262#[doc = "Reset 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 [grstctl](index.html) module"]
263pub struct GRSTCTL_SPEC;
264impl crate::RegisterSpec for GRSTCTL_SPEC {
265 type Ux = u32;
266}
267#[doc = "`read()` method returns [grstctl::R](R) reader structure"]
268impl crate::Readable for GRSTCTL_SPEC {
269 type Reader = R;
270}
271#[doc = "`write(|w| ..)` method takes [grstctl::W](W) writer structure"]
272impl crate::Writable for GRSTCTL_SPEC {
273 type Writer = W;
274 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
275 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
276}
277#[doc = "`reset()` method sets GRSTCTL to value 0x8000_0000"]
278impl crate::Resettable for GRSTCTL_SPEC {
279 const RESET_VALUE: Self::Ux = 0x8000_0000;
280}