1#![allow(clippy::missing_safety_doc)]
2#![allow(clippy::identity_op)]
3#![allow(clippy::unnecessary_cast)]
4#![allow(clippy::erasing_op)]
5
6#[doc = "USB OTG core by Synopsys (more docs at <https://www.intel.com/content/www/us/en/programmable/hps/agilex5/index_frames.html>)"]
7#[derive(Copy, Clone, Eq, PartialEq)]
8pub struct Otg {
9 ptr: *mut u8,
10}
11unsafe impl Send for Otg {}
12unsafe impl Sync for Otg {}
13impl Otg {
14 #[inline(always)]
15 pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
16 Self { ptr: ptr as _ }
17 }
18 #[inline(always)]
19 pub const fn as_ptr(&self) -> *mut () {
20 self.ptr as _
21 }
22 #[doc = "Control and status register"]
23 #[inline(always)]
24 pub const fn gotgctl(self) -> crate::common::Reg<regs::Gotgctl, crate::common::RW> {
25 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0usize) as _) }
26 }
27 #[doc = "Interrupt register"]
28 #[inline(always)]
29 pub const fn gotgint(self) -> crate::common::Reg<regs::Gotgint, crate::common::RW> {
30 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x04usize) as _) }
31 }
32 #[doc = "AHB configuration register"]
33 #[inline(always)]
34 pub const fn gahbcfg(self) -> crate::common::Reg<regs::Gahbcfg, crate::common::RW> {
35 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x08usize) as _) }
36 }
37 #[doc = "USB configuration register"]
38 #[inline(always)]
39 pub const fn gusbcfg(self) -> crate::common::Reg<regs::Gusbcfg, crate::common::RW> {
40 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0cusize) as _) }
41 }
42 #[doc = "Reset register"]
43 #[inline(always)]
44 pub const fn grstctl(self) -> crate::common::Reg<regs::Grstctl, crate::common::RW> {
45 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x10usize) as _) }
46 }
47 #[doc = "Core interrupt register"]
48 #[inline(always)]
49 pub const fn gintsts(self) -> crate::common::Reg<regs::Gintsts, crate::common::RW> {
50 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x14usize) as _) }
51 }
52 #[doc = "Interrupt mask register"]
53 #[inline(always)]
54 pub const fn gintmsk(self) -> crate::common::Reg<regs::Gintmsk, crate::common::RW> {
55 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x18usize) as _) }
56 }
57 #[doc = "Receive status debug read register"]
58 #[inline(always)]
59 pub const fn grxstsr(self) -> crate::common::Reg<regs::Grxsts, crate::common::R> {
60 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x1cusize) as _) }
61 }
62 #[doc = "Status read and pop register"]
63 #[inline(always)]
64 pub const fn grxstsp(self) -> crate::common::Reg<regs::Grxsts, crate::common::R> {
65 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x20usize) as _) }
66 }
67 #[doc = "Receive FIFO size register"]
68 #[inline(always)]
69 pub const fn grxfsiz(self) -> crate::common::Reg<regs::Grxfsiz, crate::common::RW> {
70 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x24usize) as _) }
71 }
72 #[doc = "Endpoint 0 transmit FIFO size register (device mode)"]
73 #[inline(always)]
74 pub const fn dieptxf0(self) -> crate::common::Reg<regs::Fsiz, crate::common::RW> {
75 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x28usize) as _) }
76 }
77 #[doc = "Non-periodic transmit FIFO size register (host mode)"]
78 #[inline(always)]
79 pub const fn hnptxfsiz(self) -> crate::common::Reg<regs::Fsiz, crate::common::RW> {
80 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x28usize) as _) }
81 }
82 #[doc = "Non-periodic transmit FIFO/queue status register (host mode)"]
83 #[inline(always)]
84 pub const fn hnptxsts(self) -> crate::common::Reg<regs::Hnptxsts, crate::common::R> {
85 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x2cusize) as _) }
86 }
87 #[doc = "OTG I2C access register"]
88 #[inline(always)]
89 pub const fn gi2cctl(self) -> crate::common::Reg<regs::Gi2cctl, crate::common::RW> {
90 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x30usize) as _) }
91 }
92 #[doc = "General core configuration register, for core_id 0x0000_1xxx"]
93 #[inline(always)]
94 pub const fn gccfg_v1(self) -> crate::common::Reg<regs::GccfgV1, crate::common::RW> {
95 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x38usize) as _) }
96 }
97 #[doc = "General core configuration register, for core_id 0x0000_\\[23\\]xxx"]
98 #[inline(always)]
99 pub const fn gccfg_v2(self) -> crate::common::Reg<regs::GccfgV2, crate::common::RW> {
100 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x38usize) as _) }
101 }
102 #[doc = "General core configuration register, for core_id 0x0000_5xxx"]
103 #[inline(always)]
104 pub const fn gccfg_v3(self) -> crate::common::Reg<regs::GccfgV3, crate::common::RW> {
105 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x38usize) as _) }
106 }
107 #[doc = "Core ID register"]
108 #[inline(always)]
109 pub const fn cid(self) -> crate::common::Reg<regs::Cid, crate::common::RW> {
110 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x3cusize) as _) }
111 }
112 #[doc = "Synopsis ID Register"]
113 #[inline(always)]
114 pub const fn snpsid(self) -> crate::common::Reg<u32, crate::common::RW> {
115 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x40usize) as _) }
116 }
117 #[doc = "User HW Config 1 Register"]
118 #[inline(always)]
119 pub const fn hwcfg1(self) -> crate::common::Reg<u32, crate::common::RW> {
120 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x44usize) as _) }
121 }
122 #[doc = "User HW Config 2 Register"]
123 #[inline(always)]
124 pub const fn hwcfg2(self) -> crate::common::Reg<u32, crate::common::RW> {
125 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x48usize) as _) }
126 }
127 #[doc = "User HW Config 3 Register"]
128 #[inline(always)]
129 pub const fn hwcfg3(self) -> crate::common::Reg<u32, crate::common::RW> {
130 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x4cusize) as _) }
131 }
132 #[doc = "User HW Config 4 Register"]
133 #[inline(always)]
134 pub const fn hwcfg4(self) -> crate::common::Reg<u32, crate::common::RW> {
135 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x50usize) as _) }
136 }
137 #[doc = "OTG core LPM configuration register"]
138 #[inline(always)]
139 pub const fn glpmcfg(self) -> crate::common::Reg<regs::Glpmcfg, crate::common::RW> {
140 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x54usize) as _) }
141 }
142 #[doc = "Global PowerDn Register"]
143 #[inline(always)]
144 pub const fn gpwrdn(self) -> crate::common::Reg<u32, crate::common::RW> {
145 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x58usize) as _) }
146 }
147 #[doc = "Global DFIFO SW Config Register"]
148 #[inline(always)]
149 pub const fn gdfifocfg(self) -> crate::common::Reg<u32, crate::common::RW> {
150 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x5cusize) as _) }
151 }
152 #[doc = "ADP (Attach Detection Protocol) Control Register"]
153 #[inline(always)]
154 pub const fn adpctl(self) -> crate::common::Reg<regs::Adpctl, crate::common::RW> {
155 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x60usize) as _) }
156 }
157 #[doc = "Host periodic transmit FIFO size register"]
158 #[inline(always)]
159 pub const fn hptxfsiz(self) -> crate::common::Reg<regs::Fsiz, crate::common::RW> {
160 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0100usize) as _) }
161 }
162 #[doc = "Device IN endpoint transmit FIFO size register"]
163 #[inline(always)]
164 pub const fn dieptxf(self, n: usize) -> crate::common::Reg<regs::Fsiz, crate::common::RW> {
165 assert!(n < 7usize);
166 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0104usize + n * 4usize) as _) }
167 }
168 #[doc = "Host configuration register"]
169 #[inline(always)]
170 pub const fn hcfg(self) -> crate::common::Reg<regs::Hcfg, crate::common::RW> {
171 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0400usize) as _) }
172 }
173 #[doc = "Host frame interval register"]
174 #[inline(always)]
175 pub const fn hfir(self) -> crate::common::Reg<regs::Hfir, crate::common::RW> {
176 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0404usize) as _) }
177 }
178 #[doc = "Host frame number/frame time remaining register"]
179 #[inline(always)]
180 pub const fn hfnum(self) -> crate::common::Reg<regs::Hfnum, crate::common::R> {
181 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0408usize) as _) }
182 }
183 #[doc = "Periodic transmit FIFO/queue status register"]
184 #[inline(always)]
185 pub const fn hptxsts(self) -> crate::common::Reg<regs::Hptxsts, crate::common::RW> {
186 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0410usize) as _) }
187 }
188 #[doc = "Host all channels interrupt register"]
189 #[inline(always)]
190 pub const fn haint(self) -> crate::common::Reg<regs::Haint, crate::common::R> {
191 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0414usize) as _) }
192 }
193 #[doc = "Host all channels interrupt mask register"]
194 #[inline(always)]
195 pub const fn haintmsk(self) -> crate::common::Reg<regs::Haintmsk, crate::common::RW> {
196 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0418usize) as _) }
197 }
198 #[doc = "Host Frame Scheduling List Register"]
199 #[inline(always)]
200 pub const fn hflbaddr(self) -> crate::common::Reg<u32, crate::common::RW> {
201 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x041cusize) as _) }
202 }
203 #[doc = "Host port control and status register"]
204 #[inline(always)]
205 pub const fn hprt(self) -> crate::common::Reg<regs::Hprt, crate::common::RW> {
206 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0440usize) as _) }
207 }
208 #[doc = "Host channel characteristics register"]
209 #[inline(always)]
210 pub const fn hcchar(self, n: usize) -> crate::common::Reg<regs::Hcchar, crate::common::RW> {
211 assert!(n < 12usize);
212 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0500usize + n * 32usize) as _) }
213 }
214 #[doc = "Host channel split control register"]
215 #[inline(always)]
216 pub const fn hcsplt(self, n: usize) -> crate::common::Reg<u32, crate::common::RW> {
217 assert!(n < 12usize);
218 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0504usize + n * 32usize) as _) }
219 }
220 #[doc = "Host channel interrupt register"]
221 #[inline(always)]
222 pub const fn hcint(self, n: usize) -> crate::common::Reg<regs::Hcint, crate::common::RW> {
223 assert!(n < 12usize);
224 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0508usize + n * 32usize) as _) }
225 }
226 #[doc = "Host channel mask register"]
227 #[inline(always)]
228 pub const fn hcintmsk(self, n: usize) -> crate::common::Reg<regs::Hcintmsk, crate::common::RW> {
229 assert!(n < 12usize);
230 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x050cusize + n * 32usize) as _) }
231 }
232 #[doc = "Host channel transfer size register"]
233 #[inline(always)]
234 pub const fn hctsiz(self, n: usize) -> crate::common::Reg<regs::Hctsiz, crate::common::RW> {
235 assert!(n < 12usize);
236 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0510usize + n * 32usize) as _) }
237 }
238 #[doc = "Host channel DMA address register (config for scatter/gather)"]
239 #[inline(always)]
240 pub const fn hcdma(self, n: usize) -> crate::common::Reg<regs::Hcdma, crate::common::RW> {
241 assert!(n < 12usize);
242 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0514usize + n * 32usize) as _) }
243 }
244 #[doc = "Host channel DMA address register (address for current transfer; debug)"]
245 #[inline(always)]
246 pub const fn hcdmab(self, n: usize) -> crate::common::Reg<u32, crate::common::RW> {
247 assert!(n < 12usize);
248 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x051cusize + n * 32usize) as _) }
249 }
250 #[doc = "Device configuration register"]
251 #[inline(always)]
252 pub const fn dcfg(self) -> crate::common::Reg<regs::Dcfg, crate::common::RW> {
253 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0800usize) as _) }
254 }
255 #[doc = "Device control register"]
256 #[inline(always)]
257 pub const fn dctl(self) -> crate::common::Reg<regs::Dctl, crate::common::RW> {
258 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0804usize) as _) }
259 }
260 #[doc = "Device status register"]
261 #[inline(always)]
262 pub const fn dsts(self) -> crate::common::Reg<regs::Dsts, crate::common::R> {
263 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0808usize) as _) }
264 }
265 #[doc = "Device IN endpoint common interrupt mask register"]
266 #[inline(always)]
267 pub const fn diepmsk(self) -> crate::common::Reg<regs::Diepmsk, crate::common::RW> {
268 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0810usize) as _) }
269 }
270 #[doc = "Device OUT endpoint common interrupt mask register"]
271 #[inline(always)]
272 pub const fn doepmsk(self) -> crate::common::Reg<regs::Doepmsk, crate::common::RW> {
273 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0814usize) as _) }
274 }
275 #[doc = "Device all endpoints interrupt register"]
276 #[inline(always)]
277 pub const fn daint(self) -> crate::common::Reg<regs::Daint, crate::common::R> {
278 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0818usize) as _) }
279 }
280 #[doc = "All endpoints interrupt mask register"]
281 #[inline(always)]
282 pub const fn daintmsk(self) -> crate::common::Reg<regs::Daintmsk, crate::common::RW> {
283 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x081cusize) as _) }
284 }
285 #[doc = "Device VBUS discharge time register"]
286 #[inline(always)]
287 pub const fn dvbusdis(self) -> crate::common::Reg<regs::Dvbusdis, crate::common::RW> {
288 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0828usize) as _) }
289 }
290 #[doc = "Device VBUS pulsing time register"]
291 #[inline(always)]
292 pub const fn dvbuspulse(self) -> crate::common::Reg<regs::Dvbuspulse, crate::common::RW> {
293 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x082cusize) as _) }
294 }
295 #[doc = "Device IN endpoint FIFO empty interrupt mask register"]
296 #[inline(always)]
297 pub const fn diepempmsk(self) -> crate::common::Reg<regs::Diepempmsk, crate::common::RW> {
298 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0834usize) as _) }
299 }
300 #[doc = "Device IN endpoint control register"]
301 #[inline(always)]
302 pub const fn diepctl(self, n: usize) -> crate::common::Reg<regs::Diepctl, crate::common::RW> {
303 assert!(n < 16usize);
304 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0900usize + n * 32usize) as _) }
305 }
306 #[doc = "Device IN endpoint interrupt register"]
307 #[inline(always)]
308 pub const fn diepint(self, n: usize) -> crate::common::Reg<regs::Diepint, crate::common::RW> {
309 assert!(n < 16usize);
310 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0908usize + n * 32usize) as _) }
311 }
312 #[doc = "Device IN endpoint transfer size register"]
313 #[inline(always)]
314 pub const fn dieptsiz(self, n: usize) -> crate::common::Reg<regs::Dieptsiz, crate::common::RW> {
315 assert!(n < 16usize);
316 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0910usize + n * 32usize) as _) }
317 }
318 #[doc = "Device IN endpoint transmit FIFO status register"]
319 #[inline(always)]
320 pub const fn dtxfsts(self, n: usize) -> crate::common::Reg<regs::Dtxfsts, crate::common::R> {
321 assert!(n < 16usize);
322 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0918usize + n * 32usize) as _) }
323 }
324 #[doc = "Device OUT endpoint control register"]
325 #[inline(always)]
326 pub const fn doepctl(self, n: usize) -> crate::common::Reg<regs::Doepctl, crate::common::RW> {
327 assert!(n < 16usize);
328 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0b00usize + n * 32usize) as _) }
329 }
330 #[doc = "Device OUT endpoint interrupt register"]
331 #[inline(always)]
332 pub const fn doepint(self, n: usize) -> crate::common::Reg<regs::Doepint, crate::common::RW> {
333 assert!(n < 16usize);
334 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0b08usize + n * 32usize) as _) }
335 }
336 #[doc = "Device OUT endpoint transfer size register"]
337 #[inline(always)]
338 pub const fn doeptsiz(self, n: usize) -> crate::common::Reg<regs::Doeptsiz, crate::common::RW> {
339 assert!(n < 16usize);
340 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0b10usize + n * 32usize) as _) }
341 }
342 #[doc = "Device OUT/IN endpoint DMA address register"]
343 #[inline(always)]
344 pub const fn doepdma(self, n: usize) -> crate::common::Reg<u32, crate::common::RW> {
345 assert!(n < 16usize);
346 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0b14usize + n * 32usize) as _) }
347 }
348 #[doc = "Power and clock gating control register"]
349 #[inline(always)]
350 pub const fn pcgcctl(self) -> crate::common::Reg<regs::Pcgcctl, crate::common::RW> {
351 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0e00usize) as _) }
352 }
353 #[doc = "Device endpoint / host channel FIFO register"]
354 #[inline(always)]
355 pub const fn fifo(self, n: usize) -> crate::common::Reg<regs::Fifo, crate::common::RW> {
356 assert!(n < 16usize);
357 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x1000usize + n * 4096usize) as _) }
358 }
359}
360pub mod regs {
361 #[doc = "ADP (Attach Detection Protocol) Control Register"]
362 #[repr(transparent)]
363 #[derive(Copy, Clone, Eq, PartialEq)]
364 pub struct Adpctl(pub u32);
365 impl Adpctl {
366 #[doc = "Probe Discharge time (times for TADP_DSCHG)"]
367 #[inline(always)]
368 pub const fn prb_dschg(&self) -> u8 {
369 let val = (self.0 >> 0usize) & 0x03;
370 val as u8
371 }
372 #[doc = "Probe Discharge time (times for TADP_DSCHG)"]
373 #[inline(always)]
374 pub fn set_prb_dschg(&mut self, val: u8) {
375 self.0 = (self.0 & !(0x03 << 0usize)) | (((val as u32) & 0x03) << 0usize);
376 }
377 #[doc = "Probe Delta (resolution for RTIM)"]
378 #[inline(always)]
379 pub const fn prb_delta(&self) -> u8 {
380 let val = (self.0 >> 2usize) & 0x03;
381 val as u8
382 }
383 #[doc = "Probe Delta (resolution for RTIM)"]
384 #[inline(always)]
385 pub fn set_prb_delta(&mut self, val: u8) {
386 self.0 = (self.0 & !(0x03 << 2usize)) | (((val as u32) & 0x03) << 2usize);
387 }
388 #[doc = "Probe Period (TADP_PRD)"]
389 #[inline(always)]
390 pub const fn prb_per(&self) -> u8 {
391 let val = (self.0 >> 4usize) & 0x03;
392 val as u8
393 }
394 #[doc = "Probe Period (TADP_PRD)"]
395 #[inline(always)]
396 pub fn set_prb_per(&mut self, val: u8) {
397 self.0 = (self.0 & !(0x03 << 4usize)) | (((val as u32) & 0x03) << 4usize);
398 }
399 #[doc = "Probe Period (TADP_PRD)"]
400 #[inline(always)]
401 pub const fn rtim(&self) -> u16 {
402 let val = (self.0 >> 6usize) & 0x07ff;
403 val as u16
404 }
405 #[doc = "Probe Period (TADP_PRD)"]
406 #[inline(always)]
407 pub fn set_rtim(&mut self, val: u16) {
408 self.0 = (self.0 & !(0x07ff << 6usize)) | (((val as u32) & 0x07ff) << 6usize);
409 }
410 #[doc = "Enable Probe"]
411 #[inline(always)]
412 pub const fn enaprb(&self) -> bool {
413 let val = (self.0 >> 17usize) & 0x01;
414 val != 0
415 }
416 #[doc = "Enable Probe"]
417 #[inline(always)]
418 pub fn set_enaprb(&mut self, val: bool) {
419 self.0 = (self.0 & !(0x01 << 17usize)) | (((val as u32) & 0x01) << 17usize);
420 }
421 #[doc = "Enable Sense"]
422 #[inline(always)]
423 pub const fn enasns(&self) -> bool {
424 let val = (self.0 >> 18usize) & 0x01;
425 val != 0
426 }
427 #[doc = "Enable Sense"]
428 #[inline(always)]
429 pub fn set_enasns(&mut self, val: bool) {
430 self.0 = (self.0 & !(0x01 << 18usize)) | (((val as u32) & 0x01) << 18usize);
431 }
432 #[doc = "ADP Reset"]
433 #[inline(always)]
434 pub const fn adpres(&self) -> bool {
435 let val = (self.0 >> 19usize) & 0x01;
436 val != 0
437 }
438 #[doc = "ADP Reset"]
439 #[inline(always)]
440 pub fn set_adpres(&mut self, val: bool) {
441 self.0 = (self.0 & !(0x01 << 19usize)) | (((val as u32) & 0x01) << 19usize);
442 }
443 #[doc = "ADP Enable"]
444 #[inline(always)]
445 pub const fn adpen(&self) -> bool {
446 let val = (self.0 >> 20usize) & 0x01;
447 val != 0
448 }
449 #[doc = "ADP Enable"]
450 #[inline(always)]
451 pub fn set_adpen(&mut self, val: bool) {
452 self.0 = (self.0 & !(0x01 << 20usize)) | (((val as u32) & 0x01) << 20usize);
453 }
454 #[doc = "ADP Probe Interrupt Enable"]
455 #[inline(always)]
456 pub const fn adp_prb_int(&self) -> bool {
457 let val = (self.0 >> 21usize) & 0x01;
458 val != 0
459 }
460 #[doc = "ADP Probe Interrupt Enable"]
461 #[inline(always)]
462 pub fn set_adp_prb_int(&mut self, val: bool) {
463 self.0 = (self.0 & !(0x01 << 21usize)) | (((val as u32) & 0x01) << 21usize);
464 }
465 #[doc = "ADP Sense Interrupt Enable"]
466 #[inline(always)]
467 pub const fn adp_sns_int(&self) -> bool {
468 let val = (self.0 >> 22usize) & 0x01;
469 val != 0
470 }
471 #[doc = "ADP Sense Interrupt Enable"]
472 #[inline(always)]
473 pub fn set_adp_sns_int(&mut self, val: bool) {
474 self.0 = (self.0 & !(0x01 << 22usize)) | (((val as u32) & 0x01) << 22usize);
475 }
476 #[doc = "ADP Timeout Interrupt Enable"]
477 #[inline(always)]
478 pub const fn adp_tmout_int(&self) -> bool {
479 let val = (self.0 >> 23usize) & 0x01;
480 val != 0
481 }
482 #[doc = "ADP Timeout Interrupt Enable"]
483 #[inline(always)]
484 pub fn set_adp_tmout_int(&mut self, val: bool) {
485 self.0 = (self.0 & !(0x01 << 23usize)) | (((val as u32) & 0x01) << 23usize);
486 }
487 #[doc = "ADP Probe Interrupt Mask"]
488 #[inline(always)]
489 pub const fn adp_prb_msk(&self) -> bool {
490 let val = (self.0 >> 24usize) & 0x01;
491 val != 0
492 }
493 #[doc = "ADP Probe Interrupt Mask"]
494 #[inline(always)]
495 pub fn set_adp_prb_msk(&mut self, val: bool) {
496 self.0 = (self.0 & !(0x01 << 24usize)) | (((val as u32) & 0x01) << 24usize);
497 }
498 #[doc = "ADP Timeout Interrupt Mask"]
499 #[inline(always)]
500 pub const fn adp_tmout_msk(&self) -> bool {
501 let val = (self.0 >> 25usize) & 0x01;
502 val != 0
503 }
504 #[doc = "ADP Timeout Interrupt Mask"]
505 #[inline(always)]
506 pub fn set_adp_tmout_msk(&mut self, val: bool) {
507 self.0 = (self.0 & !(0x01 << 25usize)) | (((val as u32) & 0x01) << 25usize);
508 }
509 #[doc = "Access Request"]
510 #[inline(always)]
511 pub const fn ar(&self) -> bool {
512 let val = (self.0 >> 26usize) & 0x01;
513 val != 0
514 }
515 #[doc = "Access Request"]
516 #[inline(always)]
517 pub fn set_ar(&mut self, val: bool) {
518 self.0 = (self.0 & !(0x01 << 26usize)) | (((val as u32) & 0x01) << 26usize);
519 }
520 }
521 impl Default for Adpctl {
522 #[inline(always)]
523 fn default() -> Adpctl {
524 Adpctl(0)
525 }
526 }
527 impl core::fmt::Debug for Adpctl {
528 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
529 f.debug_struct("Adpctl")
530 .field("prb_dschg", &self.prb_dschg())
531 .field("prb_delta", &self.prb_delta())
532 .field("prb_per", &self.prb_per())
533 .field("rtim", &self.rtim())
534 .field("enaprb", &self.enaprb())
535 .field("enasns", &self.enasns())
536 .field("adpres", &self.adpres())
537 .field("adpen", &self.adpen())
538 .field("adp_prb_int", &self.adp_prb_int())
539 .field("adp_sns_int", &self.adp_sns_int())
540 .field("adp_tmout_int", &self.adp_tmout_int())
541 .field("adp_prb_msk", &self.adp_prb_msk())
542 .field("adp_tmout_msk", &self.adp_tmout_msk())
543 .field("ar", &self.ar())
544 .finish()
545 }
546 }
547 #[cfg(feature = "defmt")]
548 impl defmt::Format for Adpctl {
549 fn format(&self, f: defmt::Formatter) {
550 #[derive(defmt :: Format)]
551 struct Adpctl {
552 prb_dschg: u8,
553 prb_delta: u8,
554 prb_per: u8,
555 rtim: u16,
556 enaprb: bool,
557 enasns: bool,
558 adpres: bool,
559 adpen: bool,
560 adp_prb_int: bool,
561 adp_sns_int: bool,
562 adp_tmout_int: bool,
563 adp_prb_msk: bool,
564 adp_tmout_msk: bool,
565 ar: bool,
566 }
567 let proxy = Adpctl {
568 prb_dschg: self.prb_dschg(),
569 prb_delta: self.prb_delta(),
570 prb_per: self.prb_per(),
571 rtim: self.rtim(),
572 enaprb: self.enaprb(),
573 enasns: self.enasns(),
574 adpres: self.adpres(),
575 adpen: self.adpen(),
576 adp_prb_int: self.adp_prb_int(),
577 adp_sns_int: self.adp_sns_int(),
578 adp_tmout_int: self.adp_tmout_int(),
579 adp_prb_msk: self.adp_prb_msk(),
580 adp_tmout_msk: self.adp_tmout_msk(),
581 ar: self.ar(),
582 };
583 defmt::write!(f, "{}", proxy)
584 }
585 }
586 #[doc = "Core ID register"]
587 #[repr(transparent)]
588 #[derive(Copy, Clone, Eq, PartialEq)]
589 pub struct Cid(pub u32);
590 impl Cid {
591 #[doc = "Product ID field"]
592 #[inline(always)]
593 pub const fn product_id(&self) -> u32 {
594 let val = (self.0 >> 0usize) & 0xffff_ffff;
595 val as u32
596 }
597 #[doc = "Product ID field"]
598 #[inline(always)]
599 pub fn set_product_id(&mut self, val: u32) {
600 self.0 = (self.0 & !(0xffff_ffff << 0usize)) | (((val as u32) & 0xffff_ffff) << 0usize);
601 }
602 }
603 impl Default for Cid {
604 #[inline(always)]
605 fn default() -> Cid {
606 Cid(0)
607 }
608 }
609 impl core::fmt::Debug for Cid {
610 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
611 f.debug_struct("Cid").field("product_id", &self.product_id()).finish()
612 }
613 }
614 #[cfg(feature = "defmt")]
615 impl defmt::Format for Cid {
616 fn format(&self, f: defmt::Formatter) {
617 #[derive(defmt :: Format)]
618 struct Cid {
619 product_id: u32,
620 }
621 let proxy = Cid {
622 product_id: self.product_id(),
623 };
624 defmt::write!(f, "{}", proxy)
625 }
626 }
627 #[doc = "Device all endpoints interrupt register"]
628 #[repr(transparent)]
629 #[derive(Copy, Clone, Eq, PartialEq)]
630 pub struct Daint(pub u32);
631 impl Daint {
632 #[doc = "IN endpoint interrupt bits"]
633 #[inline(always)]
634 pub const fn iepint(&self) -> u16 {
635 let val = (self.0 >> 0usize) & 0xffff;
636 val as u16
637 }
638 #[doc = "IN endpoint interrupt bits"]
639 #[inline(always)]
640 pub fn set_iepint(&mut self, val: u16) {
641 self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
642 }
643 #[doc = "OUT endpoint interrupt bits"]
644 #[inline(always)]
645 pub const fn oepint(&self) -> u16 {
646 let val = (self.0 >> 16usize) & 0xffff;
647 val as u16
648 }
649 #[doc = "OUT endpoint interrupt bits"]
650 #[inline(always)]
651 pub fn set_oepint(&mut self, val: u16) {
652 self.0 = (self.0 & !(0xffff << 16usize)) | (((val as u32) & 0xffff) << 16usize);
653 }
654 }
655 impl Default for Daint {
656 #[inline(always)]
657 fn default() -> Daint {
658 Daint(0)
659 }
660 }
661 impl core::fmt::Debug for Daint {
662 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
663 f.debug_struct("Daint")
664 .field("iepint", &self.iepint())
665 .field("oepint", &self.oepint())
666 .finish()
667 }
668 }
669 #[cfg(feature = "defmt")]
670 impl defmt::Format for Daint {
671 fn format(&self, f: defmt::Formatter) {
672 #[derive(defmt :: Format)]
673 struct Daint {
674 iepint: u16,
675 oepint: u16,
676 }
677 let proxy = Daint {
678 iepint: self.iepint(),
679 oepint: self.oepint(),
680 };
681 defmt::write!(f, "{}", proxy)
682 }
683 }
684 #[doc = "All endpoints interrupt mask register"]
685 #[repr(transparent)]
686 #[derive(Copy, Clone, Eq, PartialEq)]
687 pub struct Daintmsk(pub u32);
688 impl Daintmsk {
689 #[doc = "IN EP interrupt mask bits"]
690 #[inline(always)]
691 pub const fn iepm(&self) -> u16 {
692 let val = (self.0 >> 0usize) & 0xffff;
693 val as u16
694 }
695 #[doc = "IN EP interrupt mask bits"]
696 #[inline(always)]
697 pub fn set_iepm(&mut self, val: u16) {
698 self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
699 }
700 #[doc = "OUT EP interrupt mask bits"]
701 #[inline(always)]
702 pub const fn oepm(&self) -> u16 {
703 let val = (self.0 >> 16usize) & 0xffff;
704 val as u16
705 }
706 #[doc = "OUT EP interrupt mask bits"]
707 #[inline(always)]
708 pub fn set_oepm(&mut self, val: u16) {
709 self.0 = (self.0 & !(0xffff << 16usize)) | (((val as u32) & 0xffff) << 16usize);
710 }
711 }
712 impl Default for Daintmsk {
713 #[inline(always)]
714 fn default() -> Daintmsk {
715 Daintmsk(0)
716 }
717 }
718 impl core::fmt::Debug for Daintmsk {
719 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
720 f.debug_struct("Daintmsk")
721 .field("iepm", &self.iepm())
722 .field("oepm", &self.oepm())
723 .finish()
724 }
725 }
726 #[cfg(feature = "defmt")]
727 impl defmt::Format for Daintmsk {
728 fn format(&self, f: defmt::Formatter) {
729 #[derive(defmt :: Format)]
730 struct Daintmsk {
731 iepm: u16,
732 oepm: u16,
733 }
734 let proxy = Daintmsk {
735 iepm: self.iepm(),
736 oepm: self.oepm(),
737 };
738 defmt::write!(f, "{}", proxy)
739 }
740 }
741 #[doc = "Device configuration register"]
742 #[repr(transparent)]
743 #[derive(Copy, Clone, Eq, PartialEq)]
744 pub struct Dcfg(pub u32);
745 impl Dcfg {
746 #[doc = "Device speed"]
747 #[inline(always)]
748 pub const fn dspd(&self) -> super::vals::Dspd {
749 let val = (self.0 >> 0usize) & 0x03;
750 super::vals::Dspd::from_bits(val as u8)
751 }
752 #[doc = "Device speed"]
753 #[inline(always)]
754 pub fn set_dspd(&mut self, val: super::vals::Dspd) {
755 self.0 = (self.0 & !(0x03 << 0usize)) | (((val.to_bits() as u32) & 0x03) << 0usize);
756 }
757 #[doc = "Non-zero-length status OUT handshake"]
758 #[inline(always)]
759 pub const fn nzlsohsk(&self) -> bool {
760 let val = (self.0 >> 2usize) & 0x01;
761 val != 0
762 }
763 #[doc = "Non-zero-length status OUT handshake"]
764 #[inline(always)]
765 pub fn set_nzlsohsk(&mut self, val: bool) {
766 self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
767 }
768 #[doc = "Device address"]
769 #[inline(always)]
770 pub const fn dad(&self) -> u8 {
771 let val = (self.0 >> 4usize) & 0x7f;
772 val as u8
773 }
774 #[doc = "Device address"]
775 #[inline(always)]
776 pub fn set_dad(&mut self, val: u8) {
777 self.0 = (self.0 & !(0x7f << 4usize)) | (((val as u32) & 0x7f) << 4usize);
778 }
779 #[doc = "Periodic frame interval"]
780 #[inline(always)]
781 pub const fn pfivl(&self) -> super::vals::Pfivl {
782 let val = (self.0 >> 11usize) & 0x03;
783 super::vals::Pfivl::from_bits(val as u8)
784 }
785 #[doc = "Periodic frame interval"]
786 #[inline(always)]
787 pub fn set_pfivl(&mut self, val: super::vals::Pfivl) {
788 self.0 = (self.0 & !(0x03 << 11usize)) | (((val.to_bits() as u32) & 0x03) << 11usize);
789 }
790 #[doc = "Transceiver delay"]
791 #[inline(always)]
792 pub const fn xcvrdly(&self) -> bool {
793 let val = (self.0 >> 14usize) & 0x01;
794 val != 0
795 }
796 #[doc = "Transceiver delay"]
797 #[inline(always)]
798 pub fn set_xcvrdly(&mut self, val: bool) {
799 self.0 = (self.0 & !(0x01 << 14usize)) | (((val as u32) & 0x01) << 14usize);
800 }
801 }
802 impl Default for Dcfg {
803 #[inline(always)]
804 fn default() -> Dcfg {
805 Dcfg(0)
806 }
807 }
808 impl core::fmt::Debug for Dcfg {
809 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
810 f.debug_struct("Dcfg")
811 .field("dspd", &self.dspd())
812 .field("nzlsohsk", &self.nzlsohsk())
813 .field("dad", &self.dad())
814 .field("pfivl", &self.pfivl())
815 .field("xcvrdly", &self.xcvrdly())
816 .finish()
817 }
818 }
819 #[cfg(feature = "defmt")]
820 impl defmt::Format for Dcfg {
821 fn format(&self, f: defmt::Formatter) {
822 #[derive(defmt :: Format)]
823 struct Dcfg {
824 dspd: super::vals::Dspd,
825 nzlsohsk: bool,
826 dad: u8,
827 pfivl: super::vals::Pfivl,
828 xcvrdly: bool,
829 }
830 let proxy = Dcfg {
831 dspd: self.dspd(),
832 nzlsohsk: self.nzlsohsk(),
833 dad: self.dad(),
834 pfivl: self.pfivl(),
835 xcvrdly: self.xcvrdly(),
836 };
837 defmt::write!(f, "{}", proxy)
838 }
839 }
840 #[doc = "Device control register"]
841 #[repr(transparent)]
842 #[derive(Copy, Clone, Eq, PartialEq)]
843 pub struct Dctl(pub u32);
844 impl Dctl {
845 #[doc = "Remote wakeup signaling"]
846 #[inline(always)]
847 pub const fn rwusig(&self) -> bool {
848 let val = (self.0 >> 0usize) & 0x01;
849 val != 0
850 }
851 #[doc = "Remote wakeup signaling"]
852 #[inline(always)]
853 pub fn set_rwusig(&mut self, val: bool) {
854 self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
855 }
856 #[doc = "Soft disconnect"]
857 #[inline(always)]
858 pub const fn sdis(&self) -> bool {
859 let val = (self.0 >> 1usize) & 0x01;
860 val != 0
861 }
862 #[doc = "Soft disconnect"]
863 #[inline(always)]
864 pub fn set_sdis(&mut self, val: bool) {
865 self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
866 }
867 #[doc = "Global IN NAK status"]
868 #[inline(always)]
869 pub const fn ginsts(&self) -> bool {
870 let val = (self.0 >> 2usize) & 0x01;
871 val != 0
872 }
873 #[doc = "Global IN NAK status"]
874 #[inline(always)]
875 pub fn set_ginsts(&mut self, val: bool) {
876 self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
877 }
878 #[doc = "Global OUT NAK status"]
879 #[inline(always)]
880 pub const fn gonsts(&self) -> bool {
881 let val = (self.0 >> 3usize) & 0x01;
882 val != 0
883 }
884 #[doc = "Global OUT NAK status"]
885 #[inline(always)]
886 pub fn set_gonsts(&mut self, val: bool) {
887 self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
888 }
889 #[doc = "Test control"]
890 #[inline(always)]
891 pub const fn tctl(&self) -> u8 {
892 let val = (self.0 >> 4usize) & 0x07;
893 val as u8
894 }
895 #[doc = "Test control"]
896 #[inline(always)]
897 pub fn set_tctl(&mut self, val: u8) {
898 self.0 = (self.0 & !(0x07 << 4usize)) | (((val as u32) & 0x07) << 4usize);
899 }
900 #[doc = "Set global IN NAK"]
901 #[inline(always)]
902 pub const fn sginak(&self) -> bool {
903 let val = (self.0 >> 7usize) & 0x01;
904 val != 0
905 }
906 #[doc = "Set global IN NAK"]
907 #[inline(always)]
908 pub fn set_sginak(&mut self, val: bool) {
909 self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
910 }
911 #[doc = "Clear global IN NAK"]
912 #[inline(always)]
913 pub const fn cginak(&self) -> bool {
914 let val = (self.0 >> 8usize) & 0x01;
915 val != 0
916 }
917 #[doc = "Clear global IN NAK"]
918 #[inline(always)]
919 pub fn set_cginak(&mut self, val: bool) {
920 self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
921 }
922 #[doc = "Set global OUT NAK"]
923 #[inline(always)]
924 pub const fn sgonak(&self) -> bool {
925 let val = (self.0 >> 9usize) & 0x01;
926 val != 0
927 }
928 #[doc = "Set global OUT NAK"]
929 #[inline(always)]
930 pub fn set_sgonak(&mut self, val: bool) {
931 self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize);
932 }
933 #[doc = "Clear global OUT NAK"]
934 #[inline(always)]
935 pub const fn cgonak(&self) -> bool {
936 let val = (self.0 >> 10usize) & 0x01;
937 val != 0
938 }
939 #[doc = "Clear global OUT NAK"]
940 #[inline(always)]
941 pub fn set_cgonak(&mut self, val: bool) {
942 self.0 = (self.0 & !(0x01 << 10usize)) | (((val as u32) & 0x01) << 10usize);
943 }
944 #[doc = "Power-on programming done"]
945 #[inline(always)]
946 pub const fn poprgdne(&self) -> bool {
947 let val = (self.0 >> 11usize) & 0x01;
948 val != 0
949 }
950 #[doc = "Power-on programming done"]
951 #[inline(always)]
952 pub fn set_poprgdne(&mut self, val: bool) {
953 self.0 = (self.0 & !(0x01 << 11usize)) | (((val as u32) & 0x01) << 11usize);
954 }
955 }
956 impl Default for Dctl {
957 #[inline(always)]
958 fn default() -> Dctl {
959 Dctl(0)
960 }
961 }
962 impl core::fmt::Debug for Dctl {
963 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
964 f.debug_struct("Dctl")
965 .field("rwusig", &self.rwusig())
966 .field("sdis", &self.sdis())
967 .field("ginsts", &self.ginsts())
968 .field("gonsts", &self.gonsts())
969 .field("tctl", &self.tctl())
970 .field("sginak", &self.sginak())
971 .field("cginak", &self.cginak())
972 .field("sgonak", &self.sgonak())
973 .field("cgonak", &self.cgonak())
974 .field("poprgdne", &self.poprgdne())
975 .finish()
976 }
977 }
978 #[cfg(feature = "defmt")]
979 impl defmt::Format for Dctl {
980 fn format(&self, f: defmt::Formatter) {
981 #[derive(defmt :: Format)]
982 struct Dctl {
983 rwusig: bool,
984 sdis: bool,
985 ginsts: bool,
986 gonsts: bool,
987 tctl: u8,
988 sginak: bool,
989 cginak: bool,
990 sgonak: bool,
991 cgonak: bool,
992 poprgdne: bool,
993 }
994 let proxy = Dctl {
995 rwusig: self.rwusig(),
996 sdis: self.sdis(),
997 ginsts: self.ginsts(),
998 gonsts: self.gonsts(),
999 tctl: self.tctl(),
1000 sginak: self.sginak(),
1001 cginak: self.cginak(),
1002 sgonak: self.sgonak(),
1003 cgonak: self.cgonak(),
1004 poprgdne: self.poprgdne(),
1005 };
1006 defmt::write!(f, "{}", proxy)
1007 }
1008 }
1009 #[doc = "Device endpoint control register"]
1010 #[repr(transparent)]
1011 #[derive(Copy, Clone, Eq, PartialEq)]
1012 pub struct Diepctl(pub u32);
1013 impl Diepctl {
1014 #[doc = "MPSIZ"]
1015 #[inline(always)]
1016 pub const fn mpsiz(&self) -> u16 {
1017 let val = (self.0 >> 0usize) & 0x07ff;
1018 val as u16
1019 }
1020 #[doc = "MPSIZ"]
1021 #[inline(always)]
1022 pub fn set_mpsiz(&mut self, val: u16) {
1023 self.0 = (self.0 & !(0x07ff << 0usize)) | (((val as u32) & 0x07ff) << 0usize);
1024 }
1025 #[doc = "USBAEP"]
1026 #[inline(always)]
1027 pub const fn usbaep(&self) -> bool {
1028 let val = (self.0 >> 15usize) & 0x01;
1029 val != 0
1030 }
1031 #[doc = "USBAEP"]
1032 #[inline(always)]
1033 pub fn set_usbaep(&mut self, val: bool) {
1034 self.0 = (self.0 & !(0x01 << 15usize)) | (((val as u32) & 0x01) << 15usize);
1035 }
1036 #[doc = "EONUM/DPID"]
1037 #[inline(always)]
1038 pub const fn eonum_dpid(&self) -> bool {
1039 let val = (self.0 >> 16usize) & 0x01;
1040 val != 0
1041 }
1042 #[doc = "EONUM/DPID"]
1043 #[inline(always)]
1044 pub fn set_eonum_dpid(&mut self, val: bool) {
1045 self.0 = (self.0 & !(0x01 << 16usize)) | (((val as u32) & 0x01) << 16usize);
1046 }
1047 #[doc = "NAKSTS"]
1048 #[inline(always)]
1049 pub const fn naksts(&self) -> bool {
1050 let val = (self.0 >> 17usize) & 0x01;
1051 val != 0
1052 }
1053 #[doc = "NAKSTS"]
1054 #[inline(always)]
1055 pub fn set_naksts(&mut self, val: bool) {
1056 self.0 = (self.0 & !(0x01 << 17usize)) | (((val as u32) & 0x01) << 17usize);
1057 }
1058 #[doc = "EPTYP"]
1059 #[inline(always)]
1060 pub const fn eptyp(&self) -> super::vals::Eptyp {
1061 let val = (self.0 >> 18usize) & 0x03;
1062 super::vals::Eptyp::from_bits(val as u8)
1063 }
1064 #[doc = "EPTYP"]
1065 #[inline(always)]
1066 pub fn set_eptyp(&mut self, val: super::vals::Eptyp) {
1067 self.0 = (self.0 & !(0x03 << 18usize)) | (((val.to_bits() as u32) & 0x03) << 18usize);
1068 }
1069 #[doc = "SNPM"]
1070 #[inline(always)]
1071 pub const fn snpm(&self) -> bool {
1072 let val = (self.0 >> 20usize) & 0x01;
1073 val != 0
1074 }
1075 #[doc = "SNPM"]
1076 #[inline(always)]
1077 pub fn set_snpm(&mut self, val: bool) {
1078 self.0 = (self.0 & !(0x01 << 20usize)) | (((val as u32) & 0x01) << 20usize);
1079 }
1080 #[doc = "STALL"]
1081 #[inline(always)]
1082 pub const fn stall(&self) -> bool {
1083 let val = (self.0 >> 21usize) & 0x01;
1084 val != 0
1085 }
1086 #[doc = "STALL"]
1087 #[inline(always)]
1088 pub fn set_stall(&mut self, val: bool) {
1089 self.0 = (self.0 & !(0x01 << 21usize)) | (((val as u32) & 0x01) << 21usize);
1090 }
1091 #[doc = "TXFNUM"]
1092 #[inline(always)]
1093 pub const fn txfnum(&self) -> u8 {
1094 let val = (self.0 >> 22usize) & 0x0f;
1095 val as u8
1096 }
1097 #[doc = "TXFNUM"]
1098 #[inline(always)]
1099 pub fn set_txfnum(&mut self, val: u8) {
1100 self.0 = (self.0 & !(0x0f << 22usize)) | (((val as u32) & 0x0f) << 22usize);
1101 }
1102 #[doc = "CNAK"]
1103 #[inline(always)]
1104 pub const fn cnak(&self) -> bool {
1105 let val = (self.0 >> 26usize) & 0x01;
1106 val != 0
1107 }
1108 #[doc = "CNAK"]
1109 #[inline(always)]
1110 pub fn set_cnak(&mut self, val: bool) {
1111 self.0 = (self.0 & !(0x01 << 26usize)) | (((val as u32) & 0x01) << 26usize);
1112 }
1113 #[doc = "SNAK"]
1114 #[inline(always)]
1115 pub const fn snak(&self) -> bool {
1116 let val = (self.0 >> 27usize) & 0x01;
1117 val != 0
1118 }
1119 #[doc = "SNAK"]
1120 #[inline(always)]
1121 pub fn set_snak(&mut self, val: bool) {
1122 self.0 = (self.0 & !(0x01 << 27usize)) | (((val as u32) & 0x01) << 27usize);
1123 }
1124 #[doc = "SD0PID/SEVNFRM"]
1125 #[inline(always)]
1126 pub const fn sd0pid_sevnfrm(&self) -> bool {
1127 let val = (self.0 >> 28usize) & 0x01;
1128 val != 0
1129 }
1130 #[doc = "SD0PID/SEVNFRM"]
1131 #[inline(always)]
1132 pub fn set_sd0pid_sevnfrm(&mut self, val: bool) {
1133 self.0 = (self.0 & !(0x01 << 28usize)) | (((val as u32) & 0x01) << 28usize);
1134 }
1135 #[doc = "SODDFRM/SD1PID"]
1136 #[inline(always)]
1137 pub const fn soddfrm_sd1pid(&self) -> bool {
1138 let val = (self.0 >> 29usize) & 0x01;
1139 val != 0
1140 }
1141 #[doc = "SODDFRM/SD1PID"]
1142 #[inline(always)]
1143 pub fn set_soddfrm_sd1pid(&mut self, val: bool) {
1144 self.0 = (self.0 & !(0x01 << 29usize)) | (((val as u32) & 0x01) << 29usize);
1145 }
1146 #[doc = "EPDIS"]
1147 #[inline(always)]
1148 pub const fn epdis(&self) -> bool {
1149 let val = (self.0 >> 30usize) & 0x01;
1150 val != 0
1151 }
1152 #[doc = "EPDIS"]
1153 #[inline(always)]
1154 pub fn set_epdis(&mut self, val: bool) {
1155 self.0 = (self.0 & !(0x01 << 30usize)) | (((val as u32) & 0x01) << 30usize);
1156 }
1157 #[doc = "EPENA"]
1158 #[inline(always)]
1159 pub const fn epena(&self) -> bool {
1160 let val = (self.0 >> 31usize) & 0x01;
1161 val != 0
1162 }
1163 #[doc = "EPENA"]
1164 #[inline(always)]
1165 pub fn set_epena(&mut self, val: bool) {
1166 self.0 = (self.0 & !(0x01 << 31usize)) | (((val as u32) & 0x01) << 31usize);
1167 }
1168 }
1169 impl Default for Diepctl {
1170 #[inline(always)]
1171 fn default() -> Diepctl {
1172 Diepctl(0)
1173 }
1174 }
1175 impl core::fmt::Debug for Diepctl {
1176 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1177 f.debug_struct("Diepctl")
1178 .field("mpsiz", &self.mpsiz())
1179 .field("usbaep", &self.usbaep())
1180 .field("eonum_dpid", &self.eonum_dpid())
1181 .field("naksts", &self.naksts())
1182 .field("eptyp", &self.eptyp())
1183 .field("snpm", &self.snpm())
1184 .field("stall", &self.stall())
1185 .field("txfnum", &self.txfnum())
1186 .field("cnak", &self.cnak())
1187 .field("snak", &self.snak())
1188 .field("sd0pid_sevnfrm", &self.sd0pid_sevnfrm())
1189 .field("soddfrm_sd1pid", &self.soddfrm_sd1pid())
1190 .field("epdis", &self.epdis())
1191 .field("epena", &self.epena())
1192 .finish()
1193 }
1194 }
1195 #[cfg(feature = "defmt")]
1196 impl defmt::Format for Diepctl {
1197 fn format(&self, f: defmt::Formatter) {
1198 #[derive(defmt :: Format)]
1199 struct Diepctl {
1200 mpsiz: u16,
1201 usbaep: bool,
1202 eonum_dpid: bool,
1203 naksts: bool,
1204 eptyp: super::vals::Eptyp,
1205 snpm: bool,
1206 stall: bool,
1207 txfnum: u8,
1208 cnak: bool,
1209 snak: bool,
1210 sd0pid_sevnfrm: bool,
1211 soddfrm_sd1pid: bool,
1212 epdis: bool,
1213 epena: bool,
1214 }
1215 let proxy = Diepctl {
1216 mpsiz: self.mpsiz(),
1217 usbaep: self.usbaep(),
1218 eonum_dpid: self.eonum_dpid(),
1219 naksts: self.naksts(),
1220 eptyp: self.eptyp(),
1221 snpm: self.snpm(),
1222 stall: self.stall(),
1223 txfnum: self.txfnum(),
1224 cnak: self.cnak(),
1225 snak: self.snak(),
1226 sd0pid_sevnfrm: self.sd0pid_sevnfrm(),
1227 soddfrm_sd1pid: self.soddfrm_sd1pid(),
1228 epdis: self.epdis(),
1229 epena: self.epena(),
1230 };
1231 defmt::write!(f, "{}", proxy)
1232 }
1233 }
1234 #[doc = "Device IN endpoint FIFO empty interrupt mask register"]
1235 #[repr(transparent)]
1236 #[derive(Copy, Clone, Eq, PartialEq)]
1237 pub struct Diepempmsk(pub u32);
1238 impl Diepempmsk {
1239 #[doc = "IN EP Tx FIFO empty interrupt mask bits"]
1240 #[inline(always)]
1241 pub const fn ineptxfem(&self) -> u16 {
1242 let val = (self.0 >> 0usize) & 0xffff;
1243 val as u16
1244 }
1245 #[doc = "IN EP Tx FIFO empty interrupt mask bits"]
1246 #[inline(always)]
1247 pub fn set_ineptxfem(&mut self, val: u16) {
1248 self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
1249 }
1250 }
1251 impl Default for Diepempmsk {
1252 #[inline(always)]
1253 fn default() -> Diepempmsk {
1254 Diepempmsk(0)
1255 }
1256 }
1257 impl core::fmt::Debug for Diepempmsk {
1258 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1259 f.debug_struct("Diepempmsk")
1260 .field("ineptxfem", &self.ineptxfem())
1261 .finish()
1262 }
1263 }
1264 #[cfg(feature = "defmt")]
1265 impl defmt::Format for Diepempmsk {
1266 fn format(&self, f: defmt::Formatter) {
1267 #[derive(defmt :: Format)]
1268 struct Diepempmsk {
1269 ineptxfem: u16,
1270 }
1271 let proxy = Diepempmsk {
1272 ineptxfem: self.ineptxfem(),
1273 };
1274 defmt::write!(f, "{}", proxy)
1275 }
1276 }
1277 #[doc = "Device endpoint interrupt register"]
1278 #[repr(transparent)]
1279 #[derive(Copy, Clone, Eq, PartialEq)]
1280 pub struct Diepint(pub u32);
1281 impl Diepint {
1282 #[doc = "XFRC"]
1283 #[inline(always)]
1284 pub const fn xfrc(&self) -> bool {
1285 let val = (self.0 >> 0usize) & 0x01;
1286 val != 0
1287 }
1288 #[doc = "XFRC"]
1289 #[inline(always)]
1290 pub fn set_xfrc(&mut self, val: bool) {
1291 self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
1292 }
1293 #[doc = "EPDISD"]
1294 #[inline(always)]
1295 pub const fn epdisd(&self) -> bool {
1296 let val = (self.0 >> 1usize) & 0x01;
1297 val != 0
1298 }
1299 #[doc = "EPDISD"]
1300 #[inline(always)]
1301 pub fn set_epdisd(&mut self, val: bool) {
1302 self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
1303 }
1304 #[doc = "TOC"]
1305 #[inline(always)]
1306 pub const fn toc(&self) -> bool {
1307 let val = (self.0 >> 3usize) & 0x01;
1308 val != 0
1309 }
1310 #[doc = "TOC"]
1311 #[inline(always)]
1312 pub fn set_toc(&mut self, val: bool) {
1313 self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
1314 }
1315 #[doc = "ITTXFE"]
1316 #[inline(always)]
1317 pub const fn ittxfe(&self) -> bool {
1318 let val = (self.0 >> 4usize) & 0x01;
1319 val != 0
1320 }
1321 #[doc = "ITTXFE"]
1322 #[inline(always)]
1323 pub fn set_ittxfe(&mut self, val: bool) {
1324 self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
1325 }
1326 #[doc = "INEPNE"]
1327 #[inline(always)]
1328 pub const fn inepne(&self) -> bool {
1329 let val = (self.0 >> 6usize) & 0x01;
1330 val != 0
1331 }
1332 #[doc = "INEPNE"]
1333 #[inline(always)]
1334 pub fn set_inepne(&mut self, val: bool) {
1335 self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
1336 }
1337 #[doc = "TXFE"]
1338 #[inline(always)]
1339 pub const fn txfe(&self) -> bool {
1340 let val = (self.0 >> 7usize) & 0x01;
1341 val != 0
1342 }
1343 #[doc = "TXFE"]
1344 #[inline(always)]
1345 pub fn set_txfe(&mut self, val: bool) {
1346 self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
1347 }
1348 }
1349 impl Default for Diepint {
1350 #[inline(always)]
1351 fn default() -> Diepint {
1352 Diepint(0)
1353 }
1354 }
1355 impl core::fmt::Debug for Diepint {
1356 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1357 f.debug_struct("Diepint")
1358 .field("xfrc", &self.xfrc())
1359 .field("epdisd", &self.epdisd())
1360 .field("toc", &self.toc())
1361 .field("ittxfe", &self.ittxfe())
1362 .field("inepne", &self.inepne())
1363 .field("txfe", &self.txfe())
1364 .finish()
1365 }
1366 }
1367 #[cfg(feature = "defmt")]
1368 impl defmt::Format for Diepint {
1369 fn format(&self, f: defmt::Formatter) {
1370 #[derive(defmt :: Format)]
1371 struct Diepint {
1372 xfrc: bool,
1373 epdisd: bool,
1374 toc: bool,
1375 ittxfe: bool,
1376 inepne: bool,
1377 txfe: bool,
1378 }
1379 let proxy = Diepint {
1380 xfrc: self.xfrc(),
1381 epdisd: self.epdisd(),
1382 toc: self.toc(),
1383 ittxfe: self.ittxfe(),
1384 inepne: self.inepne(),
1385 txfe: self.txfe(),
1386 };
1387 defmt::write!(f, "{}", proxy)
1388 }
1389 }
1390 #[doc = "Device IN endpoint common interrupt mask register"]
1391 #[repr(transparent)]
1392 #[derive(Copy, Clone, Eq, PartialEq)]
1393 pub struct Diepmsk(pub u32);
1394 impl Diepmsk {
1395 #[doc = "Transfer completed interrupt mask"]
1396 #[inline(always)]
1397 pub const fn xfrcm(&self) -> bool {
1398 let val = (self.0 >> 0usize) & 0x01;
1399 val != 0
1400 }
1401 #[doc = "Transfer completed interrupt mask"]
1402 #[inline(always)]
1403 pub fn set_xfrcm(&mut self, val: bool) {
1404 self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
1405 }
1406 #[doc = "Endpoint disabled interrupt mask"]
1407 #[inline(always)]
1408 pub const fn epdm(&self) -> bool {
1409 let val = (self.0 >> 1usize) & 0x01;
1410 val != 0
1411 }
1412 #[doc = "Endpoint disabled interrupt mask"]
1413 #[inline(always)]
1414 pub fn set_epdm(&mut self, val: bool) {
1415 self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
1416 }
1417 #[doc = "Timeout condition mask (Non-isochronous endpoints)"]
1418 #[inline(always)]
1419 pub const fn tom(&self) -> bool {
1420 let val = (self.0 >> 3usize) & 0x01;
1421 val != 0
1422 }
1423 #[doc = "Timeout condition mask (Non-isochronous endpoints)"]
1424 #[inline(always)]
1425 pub fn set_tom(&mut self, val: bool) {
1426 self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
1427 }
1428 #[doc = "IN token received when TxFIFO empty mask"]
1429 #[inline(always)]
1430 pub const fn ittxfemsk(&self) -> bool {
1431 let val = (self.0 >> 4usize) & 0x01;
1432 val != 0
1433 }
1434 #[doc = "IN token received when TxFIFO empty mask"]
1435 #[inline(always)]
1436 pub fn set_ittxfemsk(&mut self, val: bool) {
1437 self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
1438 }
1439 #[doc = "IN token received with EP mismatch mask"]
1440 #[inline(always)]
1441 pub const fn inepnmm(&self) -> bool {
1442 let val = (self.0 >> 5usize) & 0x01;
1443 val != 0
1444 }
1445 #[doc = "IN token received with EP mismatch mask"]
1446 #[inline(always)]
1447 pub fn set_inepnmm(&mut self, val: bool) {
1448 self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
1449 }
1450 #[doc = "IN endpoint NAK effective mask"]
1451 #[inline(always)]
1452 pub const fn inepnem(&self) -> bool {
1453 let val = (self.0 >> 6usize) & 0x01;
1454 val != 0
1455 }
1456 #[doc = "IN endpoint NAK effective mask"]
1457 #[inline(always)]
1458 pub fn set_inepnem(&mut self, val: bool) {
1459 self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
1460 }
1461 }
1462 impl Default for Diepmsk {
1463 #[inline(always)]
1464 fn default() -> Diepmsk {
1465 Diepmsk(0)
1466 }
1467 }
1468 impl core::fmt::Debug for Diepmsk {
1469 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1470 f.debug_struct("Diepmsk")
1471 .field("xfrcm", &self.xfrcm())
1472 .field("epdm", &self.epdm())
1473 .field("tom", &self.tom())
1474 .field("ittxfemsk", &self.ittxfemsk())
1475 .field("inepnmm", &self.inepnmm())
1476 .field("inepnem", &self.inepnem())
1477 .finish()
1478 }
1479 }
1480 #[cfg(feature = "defmt")]
1481 impl defmt::Format for Diepmsk {
1482 fn format(&self, f: defmt::Formatter) {
1483 #[derive(defmt :: Format)]
1484 struct Diepmsk {
1485 xfrcm: bool,
1486 epdm: bool,
1487 tom: bool,
1488 ittxfemsk: bool,
1489 inepnmm: bool,
1490 inepnem: bool,
1491 }
1492 let proxy = Diepmsk {
1493 xfrcm: self.xfrcm(),
1494 epdm: self.epdm(),
1495 tom: self.tom(),
1496 ittxfemsk: self.ittxfemsk(),
1497 inepnmm: self.inepnmm(),
1498 inepnem: self.inepnem(),
1499 };
1500 defmt::write!(f, "{}", proxy)
1501 }
1502 }
1503 #[doc = "Device endpoint transfer size register"]
1504 #[repr(transparent)]
1505 #[derive(Copy, Clone, Eq, PartialEq)]
1506 pub struct Dieptsiz(pub u32);
1507 impl Dieptsiz {
1508 #[doc = "Transfer size"]
1509 #[inline(always)]
1510 pub const fn xfrsiz(&self) -> u32 {
1511 let val = (self.0 >> 0usize) & 0x0007_ffff;
1512 val as u32
1513 }
1514 #[doc = "Transfer size"]
1515 #[inline(always)]
1516 pub fn set_xfrsiz(&mut self, val: u32) {
1517 self.0 = (self.0 & !(0x0007_ffff << 0usize)) | (((val as u32) & 0x0007_ffff) << 0usize);
1518 }
1519 #[doc = "Packet count"]
1520 #[inline(always)]
1521 pub const fn pktcnt(&self) -> u16 {
1522 let val = (self.0 >> 19usize) & 0x03ff;
1523 val as u16
1524 }
1525 #[doc = "Packet count"]
1526 #[inline(always)]
1527 pub fn set_pktcnt(&mut self, val: u16) {
1528 self.0 = (self.0 & !(0x03ff << 19usize)) | (((val as u32) & 0x03ff) << 19usize);
1529 }
1530 #[doc = "Multi count"]
1531 #[inline(always)]
1532 pub const fn mcnt(&self) -> u8 {
1533 let val = (self.0 >> 29usize) & 0x03;
1534 val as u8
1535 }
1536 #[doc = "Multi count"]
1537 #[inline(always)]
1538 pub fn set_mcnt(&mut self, val: u8) {
1539 self.0 = (self.0 & !(0x03 << 29usize)) | (((val as u32) & 0x03) << 29usize);
1540 }
1541 }
1542 impl Default for Dieptsiz {
1543 #[inline(always)]
1544 fn default() -> Dieptsiz {
1545 Dieptsiz(0)
1546 }
1547 }
1548 impl core::fmt::Debug for Dieptsiz {
1549 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1550 f.debug_struct("Dieptsiz")
1551 .field("xfrsiz", &self.xfrsiz())
1552 .field("pktcnt", &self.pktcnt())
1553 .field("mcnt", &self.mcnt())
1554 .finish()
1555 }
1556 }
1557 #[cfg(feature = "defmt")]
1558 impl defmt::Format for Dieptsiz {
1559 fn format(&self, f: defmt::Formatter) {
1560 #[derive(defmt :: Format)]
1561 struct Dieptsiz {
1562 xfrsiz: u32,
1563 pktcnt: u16,
1564 mcnt: u8,
1565 }
1566 let proxy = Dieptsiz {
1567 xfrsiz: self.xfrsiz(),
1568 pktcnt: self.pktcnt(),
1569 mcnt: self.mcnt(),
1570 };
1571 defmt::write!(f, "{}", proxy)
1572 }
1573 }
1574 #[doc = "Device endpoint control register"]
1575 #[repr(transparent)]
1576 #[derive(Copy, Clone, Eq, PartialEq)]
1577 pub struct Doepctl(pub u32);
1578 impl Doepctl {
1579 #[doc = "MPSIZ"]
1580 #[inline(always)]
1581 pub const fn mpsiz(&self) -> u16 {
1582 let val = (self.0 >> 0usize) & 0x07ff;
1583 val as u16
1584 }
1585 #[doc = "MPSIZ"]
1586 #[inline(always)]
1587 pub fn set_mpsiz(&mut self, val: u16) {
1588 self.0 = (self.0 & !(0x07ff << 0usize)) | (((val as u32) & 0x07ff) << 0usize);
1589 }
1590 #[doc = "USBAEP"]
1591 #[inline(always)]
1592 pub const fn usbaep(&self) -> bool {
1593 let val = (self.0 >> 15usize) & 0x01;
1594 val != 0
1595 }
1596 #[doc = "USBAEP"]
1597 #[inline(always)]
1598 pub fn set_usbaep(&mut self, val: bool) {
1599 self.0 = (self.0 & !(0x01 << 15usize)) | (((val as u32) & 0x01) << 15usize);
1600 }
1601 #[doc = "EONUM/DPID"]
1602 #[inline(always)]
1603 pub const fn eonum_dpid(&self) -> bool {
1604 let val = (self.0 >> 16usize) & 0x01;
1605 val != 0
1606 }
1607 #[doc = "EONUM/DPID"]
1608 #[inline(always)]
1609 pub fn set_eonum_dpid(&mut self, val: bool) {
1610 self.0 = (self.0 & !(0x01 << 16usize)) | (((val as u32) & 0x01) << 16usize);
1611 }
1612 #[doc = "NAKSTS"]
1613 #[inline(always)]
1614 pub const fn naksts(&self) -> bool {
1615 let val = (self.0 >> 17usize) & 0x01;
1616 val != 0
1617 }
1618 #[doc = "NAKSTS"]
1619 #[inline(always)]
1620 pub fn set_naksts(&mut self, val: bool) {
1621 self.0 = (self.0 & !(0x01 << 17usize)) | (((val as u32) & 0x01) << 17usize);
1622 }
1623 #[doc = "EPTYP"]
1624 #[inline(always)]
1625 pub const fn eptyp(&self) -> super::vals::Eptyp {
1626 let val = (self.0 >> 18usize) & 0x03;
1627 super::vals::Eptyp::from_bits(val as u8)
1628 }
1629 #[doc = "EPTYP"]
1630 #[inline(always)]
1631 pub fn set_eptyp(&mut self, val: super::vals::Eptyp) {
1632 self.0 = (self.0 & !(0x03 << 18usize)) | (((val.to_bits() as u32) & 0x03) << 18usize);
1633 }
1634 #[doc = "SNPM"]
1635 #[inline(always)]
1636 pub const fn snpm(&self) -> bool {
1637 let val = (self.0 >> 20usize) & 0x01;
1638 val != 0
1639 }
1640 #[doc = "SNPM"]
1641 #[inline(always)]
1642 pub fn set_snpm(&mut self, val: bool) {
1643 self.0 = (self.0 & !(0x01 << 20usize)) | (((val as u32) & 0x01) << 20usize);
1644 }
1645 #[doc = "STALL"]
1646 #[inline(always)]
1647 pub const fn stall(&self) -> bool {
1648 let val = (self.0 >> 21usize) & 0x01;
1649 val != 0
1650 }
1651 #[doc = "STALL"]
1652 #[inline(always)]
1653 pub fn set_stall(&mut self, val: bool) {
1654 self.0 = (self.0 & !(0x01 << 21usize)) | (((val as u32) & 0x01) << 21usize);
1655 }
1656 #[doc = "CNAK"]
1657 #[inline(always)]
1658 pub const fn cnak(&self) -> bool {
1659 let val = (self.0 >> 26usize) & 0x01;
1660 val != 0
1661 }
1662 #[doc = "CNAK"]
1663 #[inline(always)]
1664 pub fn set_cnak(&mut self, val: bool) {
1665 self.0 = (self.0 & !(0x01 << 26usize)) | (((val as u32) & 0x01) << 26usize);
1666 }
1667 #[doc = "SNAK"]
1668 #[inline(always)]
1669 pub const fn snak(&self) -> bool {
1670 let val = (self.0 >> 27usize) & 0x01;
1671 val != 0
1672 }
1673 #[doc = "SNAK"]
1674 #[inline(always)]
1675 pub fn set_snak(&mut self, val: bool) {
1676 self.0 = (self.0 & !(0x01 << 27usize)) | (((val as u32) & 0x01) << 27usize);
1677 }
1678 #[doc = "SD0PID/SEVNFRM"]
1679 #[inline(always)]
1680 pub const fn sd0pid_sevnfrm(&self) -> bool {
1681 let val = (self.0 >> 28usize) & 0x01;
1682 val != 0
1683 }
1684 #[doc = "SD0PID/SEVNFRM"]
1685 #[inline(always)]
1686 pub fn set_sd0pid_sevnfrm(&mut self, val: bool) {
1687 self.0 = (self.0 & !(0x01 << 28usize)) | (((val as u32) & 0x01) << 28usize);
1688 }
1689 #[doc = "SODDFRM"]
1690 #[inline(always)]
1691 pub const fn soddfrm(&self) -> bool {
1692 let val = (self.0 >> 29usize) & 0x01;
1693 val != 0
1694 }
1695 #[doc = "SODDFRM"]
1696 #[inline(always)]
1697 pub fn set_soddfrm(&mut self, val: bool) {
1698 self.0 = (self.0 & !(0x01 << 29usize)) | (((val as u32) & 0x01) << 29usize);
1699 }
1700 #[doc = "EPDIS"]
1701 #[inline(always)]
1702 pub const fn epdis(&self) -> bool {
1703 let val = (self.0 >> 30usize) & 0x01;
1704 val != 0
1705 }
1706 #[doc = "EPDIS"]
1707 #[inline(always)]
1708 pub fn set_epdis(&mut self, val: bool) {
1709 self.0 = (self.0 & !(0x01 << 30usize)) | (((val as u32) & 0x01) << 30usize);
1710 }
1711 #[doc = "EPENA"]
1712 #[inline(always)]
1713 pub const fn epena(&self) -> bool {
1714 let val = (self.0 >> 31usize) & 0x01;
1715 val != 0
1716 }
1717 #[doc = "EPENA"]
1718 #[inline(always)]
1719 pub fn set_epena(&mut self, val: bool) {
1720 self.0 = (self.0 & !(0x01 << 31usize)) | (((val as u32) & 0x01) << 31usize);
1721 }
1722 }
1723 impl Default for Doepctl {
1724 #[inline(always)]
1725 fn default() -> Doepctl {
1726 Doepctl(0)
1727 }
1728 }
1729 impl core::fmt::Debug for Doepctl {
1730 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1731 f.debug_struct("Doepctl")
1732 .field("mpsiz", &self.mpsiz())
1733 .field("usbaep", &self.usbaep())
1734 .field("eonum_dpid", &self.eonum_dpid())
1735 .field("naksts", &self.naksts())
1736 .field("eptyp", &self.eptyp())
1737 .field("snpm", &self.snpm())
1738 .field("stall", &self.stall())
1739 .field("cnak", &self.cnak())
1740 .field("snak", &self.snak())
1741 .field("sd0pid_sevnfrm", &self.sd0pid_sevnfrm())
1742 .field("soddfrm", &self.soddfrm())
1743 .field("epdis", &self.epdis())
1744 .field("epena", &self.epena())
1745 .finish()
1746 }
1747 }
1748 #[cfg(feature = "defmt")]
1749 impl defmt::Format for Doepctl {
1750 fn format(&self, f: defmt::Formatter) {
1751 #[derive(defmt :: Format)]
1752 struct Doepctl {
1753 mpsiz: u16,
1754 usbaep: bool,
1755 eonum_dpid: bool,
1756 naksts: bool,
1757 eptyp: super::vals::Eptyp,
1758 snpm: bool,
1759 stall: bool,
1760 cnak: bool,
1761 snak: bool,
1762 sd0pid_sevnfrm: bool,
1763 soddfrm: bool,
1764 epdis: bool,
1765 epena: bool,
1766 }
1767 let proxy = Doepctl {
1768 mpsiz: self.mpsiz(),
1769 usbaep: self.usbaep(),
1770 eonum_dpid: self.eonum_dpid(),
1771 naksts: self.naksts(),
1772 eptyp: self.eptyp(),
1773 snpm: self.snpm(),
1774 stall: self.stall(),
1775 cnak: self.cnak(),
1776 snak: self.snak(),
1777 sd0pid_sevnfrm: self.sd0pid_sevnfrm(),
1778 soddfrm: self.soddfrm(),
1779 epdis: self.epdis(),
1780 epena: self.epena(),
1781 };
1782 defmt::write!(f, "{}", proxy)
1783 }
1784 }
1785 #[doc = "Device endpoint interrupt register"]
1786 #[repr(transparent)]
1787 #[derive(Copy, Clone, Eq, PartialEq)]
1788 pub struct Doepint(pub u32);
1789 impl Doepint {
1790 #[doc = "XFRC"]
1791 #[inline(always)]
1792 pub const fn xfrc(&self) -> bool {
1793 let val = (self.0 >> 0usize) & 0x01;
1794 val != 0
1795 }
1796 #[doc = "XFRC"]
1797 #[inline(always)]
1798 pub fn set_xfrc(&mut self, val: bool) {
1799 self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
1800 }
1801 #[doc = "EPDISD"]
1802 #[inline(always)]
1803 pub const fn epdisd(&self) -> bool {
1804 let val = (self.0 >> 1usize) & 0x01;
1805 val != 0
1806 }
1807 #[doc = "EPDISD"]
1808 #[inline(always)]
1809 pub fn set_epdisd(&mut self, val: bool) {
1810 self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
1811 }
1812 #[doc = "STUP"]
1813 #[inline(always)]
1814 pub const fn stup(&self) -> bool {
1815 let val = (self.0 >> 3usize) & 0x01;
1816 val != 0
1817 }
1818 #[doc = "STUP"]
1819 #[inline(always)]
1820 pub fn set_stup(&mut self, val: bool) {
1821 self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
1822 }
1823 #[doc = "OTEPDIS"]
1824 #[inline(always)]
1825 pub const fn otepdis(&self) -> bool {
1826 let val = (self.0 >> 4usize) & 0x01;
1827 val != 0
1828 }
1829 #[doc = "OTEPDIS"]
1830 #[inline(always)]
1831 pub fn set_otepdis(&mut self, val: bool) {
1832 self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
1833 }
1834 #[doc = "B2BSTUP"]
1835 #[inline(always)]
1836 pub const fn b2bstup(&self) -> bool {
1837 let val = (self.0 >> 6usize) & 0x01;
1838 val != 0
1839 }
1840 #[doc = "B2BSTUP"]
1841 #[inline(always)]
1842 pub fn set_b2bstup(&mut self, val: bool) {
1843 self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
1844 }
1845 }
1846 impl Default for Doepint {
1847 #[inline(always)]
1848 fn default() -> Doepint {
1849 Doepint(0)
1850 }
1851 }
1852 impl core::fmt::Debug for Doepint {
1853 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1854 f.debug_struct("Doepint")
1855 .field("xfrc", &self.xfrc())
1856 .field("epdisd", &self.epdisd())
1857 .field("stup", &self.stup())
1858 .field("otepdis", &self.otepdis())
1859 .field("b2bstup", &self.b2bstup())
1860 .finish()
1861 }
1862 }
1863 #[cfg(feature = "defmt")]
1864 impl defmt::Format for Doepint {
1865 fn format(&self, f: defmt::Formatter) {
1866 #[derive(defmt :: Format)]
1867 struct Doepint {
1868 xfrc: bool,
1869 epdisd: bool,
1870 stup: bool,
1871 otepdis: bool,
1872 b2bstup: bool,
1873 }
1874 let proxy = Doepint {
1875 xfrc: self.xfrc(),
1876 epdisd: self.epdisd(),
1877 stup: self.stup(),
1878 otepdis: self.otepdis(),
1879 b2bstup: self.b2bstup(),
1880 };
1881 defmt::write!(f, "{}", proxy)
1882 }
1883 }
1884 #[doc = "Device OUT endpoint common interrupt mask register"]
1885 #[repr(transparent)]
1886 #[derive(Copy, Clone, Eq, PartialEq)]
1887 pub struct Doepmsk(pub u32);
1888 impl Doepmsk {
1889 #[doc = "Transfer completed interrupt mask"]
1890 #[inline(always)]
1891 pub const fn xfrcm(&self) -> bool {
1892 let val = (self.0 >> 0usize) & 0x01;
1893 val != 0
1894 }
1895 #[doc = "Transfer completed interrupt mask"]
1896 #[inline(always)]
1897 pub fn set_xfrcm(&mut self, val: bool) {
1898 self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
1899 }
1900 #[doc = "Endpoint disabled interrupt mask"]
1901 #[inline(always)]
1902 pub const fn epdm(&self) -> bool {
1903 let val = (self.0 >> 1usize) & 0x01;
1904 val != 0
1905 }
1906 #[doc = "Endpoint disabled interrupt mask"]
1907 #[inline(always)]
1908 pub fn set_epdm(&mut self, val: bool) {
1909 self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
1910 }
1911 #[doc = "SETUP phase done mask"]
1912 #[inline(always)]
1913 pub const fn stupm(&self) -> bool {
1914 let val = (self.0 >> 3usize) & 0x01;
1915 val != 0
1916 }
1917 #[doc = "SETUP phase done mask"]
1918 #[inline(always)]
1919 pub fn set_stupm(&mut self, val: bool) {
1920 self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
1921 }
1922 #[doc = "OUT token received when endpoint disabled mask"]
1923 #[inline(always)]
1924 pub const fn otepdm(&self) -> bool {
1925 let val = (self.0 >> 4usize) & 0x01;
1926 val != 0
1927 }
1928 #[doc = "OUT token received when endpoint disabled mask"]
1929 #[inline(always)]
1930 pub fn set_otepdm(&mut self, val: bool) {
1931 self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
1932 }
1933 }
1934 impl Default for Doepmsk {
1935 #[inline(always)]
1936 fn default() -> Doepmsk {
1937 Doepmsk(0)
1938 }
1939 }
1940 impl core::fmt::Debug for Doepmsk {
1941 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1942 f.debug_struct("Doepmsk")
1943 .field("xfrcm", &self.xfrcm())
1944 .field("epdm", &self.epdm())
1945 .field("stupm", &self.stupm())
1946 .field("otepdm", &self.otepdm())
1947 .finish()
1948 }
1949 }
1950 #[cfg(feature = "defmt")]
1951 impl defmt::Format for Doepmsk {
1952 fn format(&self, f: defmt::Formatter) {
1953 #[derive(defmt :: Format)]
1954 struct Doepmsk {
1955 xfrcm: bool,
1956 epdm: bool,
1957 stupm: bool,
1958 otepdm: bool,
1959 }
1960 let proxy = Doepmsk {
1961 xfrcm: self.xfrcm(),
1962 epdm: self.epdm(),
1963 stupm: self.stupm(),
1964 otepdm: self.otepdm(),
1965 };
1966 defmt::write!(f, "{}", proxy)
1967 }
1968 }
1969 #[doc = "Device OUT endpoint transfer size register"]
1970 #[repr(transparent)]
1971 #[derive(Copy, Clone, Eq, PartialEq)]
1972 pub struct Doeptsiz(pub u32);
1973 impl Doeptsiz {
1974 #[doc = "Transfer size"]
1975 #[inline(always)]
1976 pub const fn xfrsiz(&self) -> u32 {
1977 let val = (self.0 >> 0usize) & 0x0007_ffff;
1978 val as u32
1979 }
1980 #[doc = "Transfer size"]
1981 #[inline(always)]
1982 pub fn set_xfrsiz(&mut self, val: u32) {
1983 self.0 = (self.0 & !(0x0007_ffff << 0usize)) | (((val as u32) & 0x0007_ffff) << 0usize);
1984 }
1985 #[doc = "Packet count"]
1986 #[inline(always)]
1987 pub const fn pktcnt(&self) -> u16 {
1988 let val = (self.0 >> 19usize) & 0x03ff;
1989 val as u16
1990 }
1991 #[doc = "Packet count"]
1992 #[inline(always)]
1993 pub fn set_pktcnt(&mut self, val: u16) {
1994 self.0 = (self.0 & !(0x03ff << 19usize)) | (((val as u32) & 0x03ff) << 19usize);
1995 }
1996 #[doc = "Received data PID/SETUP packet count"]
1997 #[inline(always)]
1998 pub const fn rxdpid_stupcnt(&self) -> u8 {
1999 let val = (self.0 >> 29usize) & 0x03;
2000 val as u8
2001 }
2002 #[doc = "Received data PID/SETUP packet count"]
2003 #[inline(always)]
2004 pub fn set_rxdpid_stupcnt(&mut self, val: u8) {
2005 self.0 = (self.0 & !(0x03 << 29usize)) | (((val as u32) & 0x03) << 29usize);
2006 }
2007 }
2008 impl Default for Doeptsiz {
2009 #[inline(always)]
2010 fn default() -> Doeptsiz {
2011 Doeptsiz(0)
2012 }
2013 }
2014 impl core::fmt::Debug for Doeptsiz {
2015 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2016 f.debug_struct("Doeptsiz")
2017 .field("xfrsiz", &self.xfrsiz())
2018 .field("pktcnt", &self.pktcnt())
2019 .field("rxdpid_stupcnt", &self.rxdpid_stupcnt())
2020 .finish()
2021 }
2022 }
2023 #[cfg(feature = "defmt")]
2024 impl defmt::Format for Doeptsiz {
2025 fn format(&self, f: defmt::Formatter) {
2026 #[derive(defmt :: Format)]
2027 struct Doeptsiz {
2028 xfrsiz: u32,
2029 pktcnt: u16,
2030 rxdpid_stupcnt: u8,
2031 }
2032 let proxy = Doeptsiz {
2033 xfrsiz: self.xfrsiz(),
2034 pktcnt: self.pktcnt(),
2035 rxdpid_stupcnt: self.rxdpid_stupcnt(),
2036 };
2037 defmt::write!(f, "{}", proxy)
2038 }
2039 }
2040 #[doc = "Device status register"]
2041 #[repr(transparent)]
2042 #[derive(Copy, Clone, Eq, PartialEq)]
2043 pub struct Dsts(pub u32);
2044 impl Dsts {
2045 #[doc = "Suspend status"]
2046 #[inline(always)]
2047 pub const fn suspsts(&self) -> bool {
2048 let val = (self.0 >> 0usize) & 0x01;
2049 val != 0
2050 }
2051 #[doc = "Suspend status"]
2052 #[inline(always)]
2053 pub fn set_suspsts(&mut self, val: bool) {
2054 self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
2055 }
2056 #[doc = "Enumerated speed"]
2057 #[inline(always)]
2058 pub const fn enumspd(&self) -> super::vals::Dspd {
2059 let val = (self.0 >> 1usize) & 0x03;
2060 super::vals::Dspd::from_bits(val as u8)
2061 }
2062 #[doc = "Enumerated speed"]
2063 #[inline(always)]
2064 pub fn set_enumspd(&mut self, val: super::vals::Dspd) {
2065 self.0 = (self.0 & !(0x03 << 1usize)) | (((val.to_bits() as u32) & 0x03) << 1usize);
2066 }
2067 #[doc = "Erratic error"]
2068 #[inline(always)]
2069 pub const fn eerr(&self) -> bool {
2070 let val = (self.0 >> 3usize) & 0x01;
2071 val != 0
2072 }
2073 #[doc = "Erratic error"]
2074 #[inline(always)]
2075 pub fn set_eerr(&mut self, val: bool) {
2076 self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
2077 }
2078 #[doc = "Frame number of the received SOF"]
2079 #[inline(always)]
2080 pub const fn fnsof(&self) -> u16 {
2081 let val = (self.0 >> 8usize) & 0x3fff;
2082 val as u16
2083 }
2084 #[doc = "Frame number of the received SOF"]
2085 #[inline(always)]
2086 pub fn set_fnsof(&mut self, val: u16) {
2087 self.0 = (self.0 & !(0x3fff << 8usize)) | (((val as u32) & 0x3fff) << 8usize);
2088 }
2089 }
2090 impl Default for Dsts {
2091 #[inline(always)]
2092 fn default() -> Dsts {
2093 Dsts(0)
2094 }
2095 }
2096 impl core::fmt::Debug for Dsts {
2097 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2098 f.debug_struct("Dsts")
2099 .field("suspsts", &self.suspsts())
2100 .field("enumspd", &self.enumspd())
2101 .field("eerr", &self.eerr())
2102 .field("fnsof", &self.fnsof())
2103 .finish()
2104 }
2105 }
2106 #[cfg(feature = "defmt")]
2107 impl defmt::Format for Dsts {
2108 fn format(&self, f: defmt::Formatter) {
2109 #[derive(defmt :: Format)]
2110 struct Dsts {
2111 suspsts: bool,
2112 enumspd: super::vals::Dspd,
2113 eerr: bool,
2114 fnsof: u16,
2115 }
2116 let proxy = Dsts {
2117 suspsts: self.suspsts(),
2118 enumspd: self.enumspd(),
2119 eerr: self.eerr(),
2120 fnsof: self.fnsof(),
2121 };
2122 defmt::write!(f, "{}", proxy)
2123 }
2124 }
2125 #[doc = "Device IN endpoint transmit FIFO status register"]
2126 #[repr(transparent)]
2127 #[derive(Copy, Clone, Eq, PartialEq)]
2128 pub struct Dtxfsts(pub u32);
2129 impl Dtxfsts {
2130 #[doc = "IN endpoint TxFIFO space available"]
2131 #[inline(always)]
2132 pub const fn ineptfsav(&self) -> u16 {
2133 let val = (self.0 >> 0usize) & 0xffff;
2134 val as u16
2135 }
2136 #[doc = "IN endpoint TxFIFO space available"]
2137 #[inline(always)]
2138 pub fn set_ineptfsav(&mut self, val: u16) {
2139 self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
2140 }
2141 }
2142 impl Default for Dtxfsts {
2143 #[inline(always)]
2144 fn default() -> Dtxfsts {
2145 Dtxfsts(0)
2146 }
2147 }
2148 impl core::fmt::Debug for Dtxfsts {
2149 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2150 f.debug_struct("Dtxfsts").field("ineptfsav", &self.ineptfsav()).finish()
2151 }
2152 }
2153 #[cfg(feature = "defmt")]
2154 impl defmt::Format for Dtxfsts {
2155 fn format(&self, f: defmt::Formatter) {
2156 #[derive(defmt :: Format)]
2157 struct Dtxfsts {
2158 ineptfsav: u16,
2159 }
2160 let proxy = Dtxfsts {
2161 ineptfsav: self.ineptfsav(),
2162 };
2163 defmt::write!(f, "{}", proxy)
2164 }
2165 }
2166 #[doc = "Device VBUS discharge time register"]
2167 #[repr(transparent)]
2168 #[derive(Copy, Clone, Eq, PartialEq)]
2169 pub struct Dvbusdis(pub u32);
2170 impl Dvbusdis {
2171 #[doc = "Device VBUS discharge time"]
2172 #[inline(always)]
2173 pub const fn vbusdt(&self) -> u16 {
2174 let val = (self.0 >> 0usize) & 0xffff;
2175 val as u16
2176 }
2177 #[doc = "Device VBUS discharge time"]
2178 #[inline(always)]
2179 pub fn set_vbusdt(&mut self, val: u16) {
2180 self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
2181 }
2182 }
2183 impl Default for Dvbusdis {
2184 #[inline(always)]
2185 fn default() -> Dvbusdis {
2186 Dvbusdis(0)
2187 }
2188 }
2189 impl core::fmt::Debug for Dvbusdis {
2190 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2191 f.debug_struct("Dvbusdis").field("vbusdt", &self.vbusdt()).finish()
2192 }
2193 }
2194 #[cfg(feature = "defmt")]
2195 impl defmt::Format for Dvbusdis {
2196 fn format(&self, f: defmt::Formatter) {
2197 #[derive(defmt :: Format)]
2198 struct Dvbusdis {
2199 vbusdt: u16,
2200 }
2201 let proxy = Dvbusdis { vbusdt: self.vbusdt() };
2202 defmt::write!(f, "{}", proxy)
2203 }
2204 }
2205 #[doc = "Device VBUS pulsing time register"]
2206 #[repr(transparent)]
2207 #[derive(Copy, Clone, Eq, PartialEq)]
2208 pub struct Dvbuspulse(pub u32);
2209 impl Dvbuspulse {
2210 #[doc = "Device VBUS pulsing time"]
2211 #[inline(always)]
2212 pub const fn dvbusp(&self) -> u16 {
2213 let val = (self.0 >> 0usize) & 0x0fff;
2214 val as u16
2215 }
2216 #[doc = "Device VBUS pulsing time"]
2217 #[inline(always)]
2218 pub fn set_dvbusp(&mut self, val: u16) {
2219 self.0 = (self.0 & !(0x0fff << 0usize)) | (((val as u32) & 0x0fff) << 0usize);
2220 }
2221 }
2222 impl Default for Dvbuspulse {
2223 #[inline(always)]
2224 fn default() -> Dvbuspulse {
2225 Dvbuspulse(0)
2226 }
2227 }
2228 impl core::fmt::Debug for Dvbuspulse {
2229 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2230 f.debug_struct("Dvbuspulse").field("dvbusp", &self.dvbusp()).finish()
2231 }
2232 }
2233 #[cfg(feature = "defmt")]
2234 impl defmt::Format for Dvbuspulse {
2235 fn format(&self, f: defmt::Formatter) {
2236 #[derive(defmt :: Format)]
2237 struct Dvbuspulse {
2238 dvbusp: u16,
2239 }
2240 let proxy = Dvbuspulse { dvbusp: self.dvbusp() };
2241 defmt::write!(f, "{}", proxy)
2242 }
2243 }
2244 #[doc = "FIFO register"]
2245 #[repr(transparent)]
2246 #[derive(Copy, Clone, Eq, PartialEq)]
2247 pub struct Fifo(pub u32);
2248 impl Fifo {
2249 #[doc = "Data"]
2250 #[inline(always)]
2251 pub const fn data(&self) -> u32 {
2252 let val = (self.0 >> 0usize) & 0xffff_ffff;
2253 val as u32
2254 }
2255 #[doc = "Data"]
2256 #[inline(always)]
2257 pub fn set_data(&mut self, val: u32) {
2258 self.0 = (self.0 & !(0xffff_ffff << 0usize)) | (((val as u32) & 0xffff_ffff) << 0usize);
2259 }
2260 }
2261 impl Default for Fifo {
2262 #[inline(always)]
2263 fn default() -> Fifo {
2264 Fifo(0)
2265 }
2266 }
2267 impl core::fmt::Debug for Fifo {
2268 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2269 f.debug_struct("Fifo").field("data", &self.data()).finish()
2270 }
2271 }
2272 #[cfg(feature = "defmt")]
2273 impl defmt::Format for Fifo {
2274 fn format(&self, f: defmt::Formatter) {
2275 #[derive(defmt :: Format)]
2276 struct Fifo {
2277 data: u32,
2278 }
2279 let proxy = Fifo { data: self.data() };
2280 defmt::write!(f, "{}", proxy)
2281 }
2282 }
2283 #[doc = "FIFO size register"]
2284 #[repr(transparent)]
2285 #[derive(Copy, Clone, Eq, PartialEq)]
2286 pub struct Fsiz(pub u32);
2287 impl Fsiz {
2288 #[doc = "RAM start address"]
2289 #[inline(always)]
2290 pub const fn sa(&self) -> u16 {
2291 let val = (self.0 >> 0usize) & 0xffff;
2292 val as u16
2293 }
2294 #[doc = "RAM start address"]
2295 #[inline(always)]
2296 pub fn set_sa(&mut self, val: u16) {
2297 self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
2298 }
2299 #[doc = "FIFO depth"]
2300 #[inline(always)]
2301 pub const fn fd(&self) -> u16 {
2302 let val = (self.0 >> 16usize) & 0xffff;
2303 val as u16
2304 }
2305 #[doc = "FIFO depth"]
2306 #[inline(always)]
2307 pub fn set_fd(&mut self, val: u16) {
2308 self.0 = (self.0 & !(0xffff << 16usize)) | (((val as u32) & 0xffff) << 16usize);
2309 }
2310 }
2311 impl Default for Fsiz {
2312 #[inline(always)]
2313 fn default() -> Fsiz {
2314 Fsiz(0)
2315 }
2316 }
2317 impl core::fmt::Debug for Fsiz {
2318 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2319 f.debug_struct("Fsiz")
2320 .field("sa", &self.sa())
2321 .field("fd", &self.fd())
2322 .finish()
2323 }
2324 }
2325 #[cfg(feature = "defmt")]
2326 impl defmt::Format for Fsiz {
2327 fn format(&self, f: defmt::Formatter) {
2328 #[derive(defmt :: Format)]
2329 struct Fsiz {
2330 sa: u16,
2331 fd: u16,
2332 }
2333 let proxy = Fsiz {
2334 sa: self.sa(),
2335 fd: self.fd(),
2336 };
2337 defmt::write!(f, "{}", proxy)
2338 }
2339 }
2340 #[doc = "AHB configuration register"]
2341 #[repr(transparent)]
2342 #[derive(Copy, Clone, Eq, PartialEq)]
2343 pub struct Gahbcfg(pub u32);
2344 impl Gahbcfg {
2345 #[doc = "Global interrupt mask"]
2346 #[inline(always)]
2347 pub const fn gint(&self) -> bool {
2348 let val = (self.0 >> 0usize) & 0x01;
2349 val != 0
2350 }
2351 #[doc = "Global interrupt mask"]
2352 #[inline(always)]
2353 pub fn set_gint(&mut self, val: bool) {
2354 self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
2355 }
2356 #[doc = "Burst length/type"]
2357 #[inline(always)]
2358 pub const fn hbstlen(&self) -> u8 {
2359 let val = (self.0 >> 1usize) & 0x0f;
2360 val as u8
2361 }
2362 #[doc = "Burst length/type"]
2363 #[inline(always)]
2364 pub fn set_hbstlen(&mut self, val: u8) {
2365 self.0 = (self.0 & !(0x0f << 1usize)) | (((val as u32) & 0x0f) << 1usize);
2366 }
2367 #[doc = "DMA enable"]
2368 #[inline(always)]
2369 pub const fn dmaen(&self) -> bool {
2370 let val = (self.0 >> 5usize) & 0x01;
2371 val != 0
2372 }
2373 #[doc = "DMA enable"]
2374 #[inline(always)]
2375 pub fn set_dmaen(&mut self, val: bool) {
2376 self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
2377 }
2378 #[doc = "TxFIFO empty level"]
2379 #[inline(always)]
2380 pub const fn txfelvl(&self) -> bool {
2381 let val = (self.0 >> 7usize) & 0x01;
2382 val != 0
2383 }
2384 #[doc = "TxFIFO empty level"]
2385 #[inline(always)]
2386 pub fn set_txfelvl(&mut self, val: bool) {
2387 self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
2388 }
2389 #[doc = "Periodic TxFIFO empty level"]
2390 #[inline(always)]
2391 pub const fn ptxfelvl(&self) -> bool {
2392 let val = (self.0 >> 8usize) & 0x01;
2393 val != 0
2394 }
2395 #[doc = "Periodic TxFIFO empty level"]
2396 #[inline(always)]
2397 pub fn set_ptxfelvl(&mut self, val: bool) {
2398 self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
2399 }
2400 }
2401 impl Default for Gahbcfg {
2402 #[inline(always)]
2403 fn default() -> Gahbcfg {
2404 Gahbcfg(0)
2405 }
2406 }
2407 impl core::fmt::Debug for Gahbcfg {
2408 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2409 f.debug_struct("Gahbcfg")
2410 .field("gint", &self.gint())
2411 .field("hbstlen", &self.hbstlen())
2412 .field("dmaen", &self.dmaen())
2413 .field("txfelvl", &self.txfelvl())
2414 .field("ptxfelvl", &self.ptxfelvl())
2415 .finish()
2416 }
2417 }
2418 #[cfg(feature = "defmt")]
2419 impl defmt::Format for Gahbcfg {
2420 fn format(&self, f: defmt::Formatter) {
2421 #[derive(defmt :: Format)]
2422 struct Gahbcfg {
2423 gint: bool,
2424 hbstlen: u8,
2425 dmaen: bool,
2426 txfelvl: bool,
2427 ptxfelvl: bool,
2428 }
2429 let proxy = Gahbcfg {
2430 gint: self.gint(),
2431 hbstlen: self.hbstlen(),
2432 dmaen: self.dmaen(),
2433 txfelvl: self.txfelvl(),
2434 ptxfelvl: self.ptxfelvl(),
2435 };
2436 defmt::write!(f, "{}", proxy)
2437 }
2438 }
2439 #[doc = "General core configuration register"]
2440 #[repr(transparent)]
2441 #[derive(Copy, Clone, Eq, PartialEq)]
2442 pub struct GccfgV1(pub u32);
2443 impl GccfgV1 {
2444 #[doc = "Power down"]
2445 #[inline(always)]
2446 pub const fn pwrdwn(&self) -> bool {
2447 let val = (self.0 >> 16usize) & 0x01;
2448 val != 0
2449 }
2450 #[doc = "Power down"]
2451 #[inline(always)]
2452 pub fn set_pwrdwn(&mut self, val: bool) {
2453 self.0 = (self.0 & !(0x01 << 16usize)) | (((val as u32) & 0x01) << 16usize);
2454 }
2455 #[doc = "Enable the VBUS \"A\" sensing device"]
2456 #[inline(always)]
2457 pub const fn vbusasen(&self) -> bool {
2458 let val = (self.0 >> 18usize) & 0x01;
2459 val != 0
2460 }
2461 #[doc = "Enable the VBUS \"A\" sensing device"]
2462 #[inline(always)]
2463 pub fn set_vbusasen(&mut self, val: bool) {
2464 self.0 = (self.0 & !(0x01 << 18usize)) | (((val as u32) & 0x01) << 18usize);
2465 }
2466 #[doc = "Enable the VBUS \"B\" sensing device"]
2467 #[inline(always)]
2468 pub const fn vbusbsen(&self) -> bool {
2469 let val = (self.0 >> 19usize) & 0x01;
2470 val != 0
2471 }
2472 #[doc = "Enable the VBUS \"B\" sensing device"]
2473 #[inline(always)]
2474 pub fn set_vbusbsen(&mut self, val: bool) {
2475 self.0 = (self.0 & !(0x01 << 19usize)) | (((val as u32) & 0x01) << 19usize);
2476 }
2477 #[doc = "SOF output enable"]
2478 #[inline(always)]
2479 pub const fn sofouten(&self) -> bool {
2480 let val = (self.0 >> 20usize) & 0x01;
2481 val != 0
2482 }
2483 #[doc = "SOF output enable"]
2484 #[inline(always)]
2485 pub fn set_sofouten(&mut self, val: bool) {
2486 self.0 = (self.0 & !(0x01 << 20usize)) | (((val as u32) & 0x01) << 20usize);
2487 }
2488 #[doc = "VBUS sensing disable"]
2489 #[inline(always)]
2490 pub const fn novbussens(&self) -> bool {
2491 let val = (self.0 >> 21usize) & 0x01;
2492 val != 0
2493 }
2494 #[doc = "VBUS sensing disable"]
2495 #[inline(always)]
2496 pub fn set_novbussens(&mut self, val: bool) {
2497 self.0 = (self.0 & !(0x01 << 21usize)) | (((val as u32) & 0x01) << 21usize);
2498 }
2499 }
2500 impl Default for GccfgV1 {
2501 #[inline(always)]
2502 fn default() -> GccfgV1 {
2503 GccfgV1(0)
2504 }
2505 }
2506 impl core::fmt::Debug for GccfgV1 {
2507 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2508 f.debug_struct("GccfgV1")
2509 .field("pwrdwn", &self.pwrdwn())
2510 .field("vbusasen", &self.vbusasen())
2511 .field("vbusbsen", &self.vbusbsen())
2512 .field("sofouten", &self.sofouten())
2513 .field("novbussens", &self.novbussens())
2514 .finish()
2515 }
2516 }
2517 #[cfg(feature = "defmt")]
2518 impl defmt::Format for GccfgV1 {
2519 fn format(&self, f: defmt::Formatter) {
2520 #[derive(defmt :: Format)]
2521 struct GccfgV1 {
2522 pwrdwn: bool,
2523 vbusasen: bool,
2524 vbusbsen: bool,
2525 sofouten: bool,
2526 novbussens: bool,
2527 }
2528 let proxy = GccfgV1 {
2529 pwrdwn: self.pwrdwn(),
2530 vbusasen: self.vbusasen(),
2531 vbusbsen: self.vbusbsen(),
2532 sofouten: self.sofouten(),
2533 novbussens: self.novbussens(),
2534 };
2535 defmt::write!(f, "{}", proxy)
2536 }
2537 }
2538 #[doc = "General core configuration register"]
2539 #[repr(transparent)]
2540 #[derive(Copy, Clone, Eq, PartialEq)]
2541 pub struct GccfgV2(pub u32);
2542 impl GccfgV2 {
2543 #[doc = "Data contact detection (DCD) status"]
2544 #[inline(always)]
2545 pub const fn dcdet(&self) -> bool {
2546 let val = (self.0 >> 0usize) & 0x01;
2547 val != 0
2548 }
2549 #[doc = "Data contact detection (DCD) status"]
2550 #[inline(always)]
2551 pub fn set_dcdet(&mut self, val: bool) {
2552 self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
2553 }
2554 #[doc = "Primary detection (PD) status"]
2555 #[inline(always)]
2556 pub const fn pdet(&self) -> bool {
2557 let val = (self.0 >> 1usize) & 0x01;
2558 val != 0
2559 }
2560 #[doc = "Primary detection (PD) status"]
2561 #[inline(always)]
2562 pub fn set_pdet(&mut self, val: bool) {
2563 self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
2564 }
2565 #[doc = "Secondary detection (SD) status"]
2566 #[inline(always)]
2567 pub const fn sdet(&self) -> bool {
2568 let val = (self.0 >> 2usize) & 0x01;
2569 val != 0
2570 }
2571 #[doc = "Secondary detection (SD) status"]
2572 #[inline(always)]
2573 pub fn set_sdet(&mut self, val: bool) {
2574 self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
2575 }
2576 #[doc = "DM pull-up detection status"]
2577 #[inline(always)]
2578 pub const fn ps2det(&self) -> bool {
2579 let val = (self.0 >> 3usize) & 0x01;
2580 val != 0
2581 }
2582 #[doc = "DM pull-up detection status"]
2583 #[inline(always)]
2584 pub fn set_ps2det(&mut self, val: bool) {
2585 self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
2586 }
2587 #[doc = "Power down"]
2588 #[inline(always)]
2589 pub const fn pwrdwn(&self) -> bool {
2590 let val = (self.0 >> 16usize) & 0x01;
2591 val != 0
2592 }
2593 #[doc = "Power down"]
2594 #[inline(always)]
2595 pub fn set_pwrdwn(&mut self, val: bool) {
2596 self.0 = (self.0 & !(0x01 << 16usize)) | (((val as u32) & 0x01) << 16usize);
2597 }
2598 #[doc = "Battery charging detector (BCD) enable"]
2599 #[inline(always)]
2600 pub const fn bcden(&self) -> bool {
2601 let val = (self.0 >> 17usize) & 0x01;
2602 val != 0
2603 }
2604 #[doc = "Battery charging detector (BCD) enable"]
2605 #[inline(always)]
2606 pub fn set_bcden(&mut self, val: bool) {
2607 self.0 = (self.0 & !(0x01 << 17usize)) | (((val as u32) & 0x01) << 17usize);
2608 }
2609 #[doc = "Data contact detection (DCD) mode enable"]
2610 #[inline(always)]
2611 pub const fn dcden(&self) -> bool {
2612 let val = (self.0 >> 18usize) & 0x01;
2613 val != 0
2614 }
2615 #[doc = "Data contact detection (DCD) mode enable"]
2616 #[inline(always)]
2617 pub fn set_dcden(&mut self, val: bool) {
2618 self.0 = (self.0 & !(0x01 << 18usize)) | (((val as u32) & 0x01) << 18usize);
2619 }
2620 #[doc = "Primary detection (PD) mode enable"]
2621 #[inline(always)]
2622 pub const fn pden(&self) -> bool {
2623 let val = (self.0 >> 19usize) & 0x01;
2624 val != 0
2625 }
2626 #[doc = "Primary detection (PD) mode enable"]
2627 #[inline(always)]
2628 pub fn set_pden(&mut self, val: bool) {
2629 self.0 = (self.0 & !(0x01 << 19usize)) | (((val as u32) & 0x01) << 19usize);
2630 }
2631 #[doc = "Secondary detection (SD) mode enable"]
2632 #[inline(always)]
2633 pub const fn sden(&self) -> bool {
2634 let val = (self.0 >> 20usize) & 0x01;
2635 val != 0
2636 }
2637 #[doc = "Secondary detection (SD) mode enable"]
2638 #[inline(always)]
2639 pub fn set_sden(&mut self, val: bool) {
2640 self.0 = (self.0 & !(0x01 << 20usize)) | (((val as u32) & 0x01) << 20usize);
2641 }
2642 #[doc = "USB VBUS detection enable"]
2643 #[inline(always)]
2644 pub const fn vbden(&self) -> bool {
2645 let val = (self.0 >> 21usize) & 0x01;
2646 val != 0
2647 }
2648 #[doc = "USB VBUS detection enable"]
2649 #[inline(always)]
2650 pub fn set_vbden(&mut self, val: bool) {
2651 self.0 = (self.0 & !(0x01 << 21usize)) | (((val as u32) & 0x01) << 21usize);
2652 }
2653 #[doc = "Internal high-speed PHY enable."]
2654 #[inline(always)]
2655 pub const fn phyhsen(&self) -> bool {
2656 let val = (self.0 >> 23usize) & 0x01;
2657 val != 0
2658 }
2659 #[doc = "Internal high-speed PHY enable."]
2660 #[inline(always)]
2661 pub fn set_phyhsen(&mut self, val: bool) {
2662 self.0 = (self.0 & !(0x01 << 23usize)) | (((val as u32) & 0x01) << 23usize);
2663 }
2664 }
2665 impl Default for GccfgV2 {
2666 #[inline(always)]
2667 fn default() -> GccfgV2 {
2668 GccfgV2(0)
2669 }
2670 }
2671 impl core::fmt::Debug for GccfgV2 {
2672 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2673 f.debug_struct("GccfgV2")
2674 .field("dcdet", &self.dcdet())
2675 .field("pdet", &self.pdet())
2676 .field("sdet", &self.sdet())
2677 .field("ps2det", &self.ps2det())
2678 .field("pwrdwn", &self.pwrdwn())
2679 .field("bcden", &self.bcden())
2680 .field("dcden", &self.dcden())
2681 .field("pden", &self.pden())
2682 .field("sden", &self.sden())
2683 .field("vbden", &self.vbden())
2684 .field("phyhsen", &self.phyhsen())
2685 .finish()
2686 }
2687 }
2688 #[cfg(feature = "defmt")]
2689 impl defmt::Format for GccfgV2 {
2690 fn format(&self, f: defmt::Formatter) {
2691 #[derive(defmt :: Format)]
2692 struct GccfgV2 {
2693 dcdet: bool,
2694 pdet: bool,
2695 sdet: bool,
2696 ps2det: bool,
2697 pwrdwn: bool,
2698 bcden: bool,
2699 dcden: bool,
2700 pden: bool,
2701 sden: bool,
2702 vbden: bool,
2703 phyhsen: bool,
2704 }
2705 let proxy = GccfgV2 {
2706 dcdet: self.dcdet(),
2707 pdet: self.pdet(),
2708 sdet: self.sdet(),
2709 ps2det: self.ps2det(),
2710 pwrdwn: self.pwrdwn(),
2711 bcden: self.bcden(),
2712 dcden: self.dcden(),
2713 pden: self.pden(),
2714 sden: self.sden(),
2715 vbden: self.vbden(),
2716 phyhsen: self.phyhsen(),
2717 };
2718 defmt::write!(f, "{}", proxy)
2719 }
2720 }
2721 #[doc = "OTG general core configuration register."]
2722 #[repr(transparent)]
2723 #[derive(Copy, Clone, Eq, PartialEq)]
2724 pub struct GccfgV3(pub u32);
2725 impl GccfgV3 {
2726 #[doc = "Charger detection, result of the current mode (primary or secondary)."]
2727 #[inline(always)]
2728 pub const fn chgdet(&self) -> bool {
2729 let val = (self.0 >> 0usize) & 0x01;
2730 val != 0
2731 }
2732 #[doc = "Charger detection, result of the current mode (primary or secondary)."]
2733 #[inline(always)]
2734 pub fn set_chgdet(&mut self, val: bool) {
2735 self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
2736 }
2737 #[doc = "Single-Ended DP indicator This bit gives the voltage level on DP (also result of the comparison with V<sub>LGC</sub> threshold as defined in BC v1.2 standard)."]
2738 #[inline(always)]
2739 pub const fn fsvplus(&self) -> bool {
2740 let val = (self.0 >> 1usize) & 0x01;
2741 val != 0
2742 }
2743 #[doc = "Single-Ended DP indicator This bit gives the voltage level on DP (also result of the comparison with V<sub>LGC</sub> threshold as defined in BC v1.2 standard)."]
2744 #[inline(always)]
2745 pub fn set_fsvplus(&mut self, val: bool) {
2746 self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
2747 }
2748 #[doc = "Single-Ended DM indicator This bit gives the voltage level on DM (also result of the comparison with V<sub>LGC</sub> threshold as defined in BC v1.2 standard)."]
2749 #[inline(always)]
2750 pub const fn fsvminus(&self) -> bool {
2751 let val = (self.0 >> 2usize) & 0x01;
2752 val != 0
2753 }
2754 #[doc = "Single-Ended DM indicator This bit gives the voltage level on DM (also result of the comparison with V<sub>LGC</sub> threshold as defined in BC v1.2 standard)."]
2755 #[inline(always)]
2756 pub fn set_fsvminus(&mut self, val: bool) {
2757 self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
2758 }
2759 #[doc = "VBUS session indicator Indicates if VBUS is above VBUS session threshold."]
2760 #[inline(always)]
2761 pub const fn sessvld(&self) -> bool {
2762 let val = (self.0 >> 3usize) & 0x01;
2763 val != 0
2764 }
2765 #[doc = "VBUS session indicator Indicates if VBUS is above VBUS session threshold."]
2766 #[inline(always)]
2767 pub fn set_sessvld(&mut self, val: bool) {
2768 self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
2769 }
2770 #[doc = "Host CDP behavior enable."]
2771 #[inline(always)]
2772 pub const fn hcdpen(&self) -> bool {
2773 let val = (self.0 >> 16usize) & 0x01;
2774 val != 0
2775 }
2776 #[doc = "Host CDP behavior enable."]
2777 #[inline(always)]
2778 pub fn set_hcdpen(&mut self, val: bool) {
2779 self.0 = (self.0 & !(0x01 << 16usize)) | (((val as u32) & 0x01) << 16usize);
2780 }
2781 #[doc = "Host CDP port voltage detector enable on DP."]
2782 #[inline(always)]
2783 pub const fn hcdpdeten(&self) -> bool {
2784 let val = (self.0 >> 17usize) & 0x01;
2785 val != 0
2786 }
2787 #[doc = "Host CDP port voltage detector enable on DP."]
2788 #[inline(always)]
2789 pub fn set_hcdpdeten(&mut self, val: bool) {
2790 self.0 = (self.0 & !(0x01 << 17usize)) | (((val as u32) & 0x01) << 17usize);
2791 }
2792 #[doc = "Host CDP port Voltage source enable on DM."]
2793 #[inline(always)]
2794 pub const fn hvdmsrcen(&self) -> bool {
2795 let val = (self.0 >> 18usize) & 0x01;
2796 val != 0
2797 }
2798 #[doc = "Host CDP port Voltage source enable on DM."]
2799 #[inline(always)]
2800 pub fn set_hvdmsrcen(&mut self, val: bool) {
2801 self.0 = (self.0 & !(0x01 << 18usize)) | (((val as u32) & 0x01) << 18usize);
2802 }
2803 #[doc = "Data Contact Detection enable."]
2804 #[inline(always)]
2805 pub const fn dcden(&self) -> bool {
2806 let val = (self.0 >> 19usize) & 0x01;
2807 val != 0
2808 }
2809 #[doc = "Data Contact Detection enable."]
2810 #[inline(always)]
2811 pub fn set_dcden(&mut self, val: bool) {
2812 self.0 = (self.0 & !(0x01 << 19usize)) | (((val as u32) & 0x01) << 19usize);
2813 }
2814 #[doc = "Primary detection enable."]
2815 #[inline(always)]
2816 pub const fn pden(&self) -> bool {
2817 let val = (self.0 >> 20usize) & 0x01;
2818 val != 0
2819 }
2820 #[doc = "Primary detection enable."]
2821 #[inline(always)]
2822 pub fn set_pden(&mut self, val: bool) {
2823 self.0 = (self.0 & !(0x01 << 20usize)) | (((val as u32) & 0x01) << 20usize);
2824 }
2825 #[doc = "VBUS detection enable Enables VBUS Sensing Comparators in order to detect VBUS presence and/or perform OTG operation."]
2826 #[inline(always)]
2827 pub const fn vbden(&self) -> bool {
2828 let val = (self.0 >> 21usize) & 0x01;
2829 val != 0
2830 }
2831 #[doc = "VBUS detection enable Enables VBUS Sensing Comparators in order to detect VBUS presence and/or perform OTG operation."]
2832 #[inline(always)]
2833 pub fn set_vbden(&mut self, val: bool) {
2834 self.0 = (self.0 & !(0x01 << 21usize)) | (((val as u32) & 0x01) << 21usize);
2835 }
2836 #[doc = "Secondary detection enable."]
2837 #[inline(always)]
2838 pub const fn sden(&self) -> bool {
2839 let val = (self.0 >> 22usize) & 0x01;
2840 val != 0
2841 }
2842 #[doc = "Secondary detection enable."]
2843 #[inline(always)]
2844 pub fn set_sden(&mut self, val: bool) {
2845 self.0 = (self.0 & !(0x01 << 22usize)) | (((val as u32) & 0x01) << 22usize);
2846 }
2847 #[doc = "Software override value of the VBUS B-session detection."]
2848 #[inline(always)]
2849 pub const fn vbvaloval(&self) -> bool {
2850 let val = (self.0 >> 23usize) & 0x01;
2851 val != 0
2852 }
2853 #[doc = "Software override value of the VBUS B-session detection."]
2854 #[inline(always)]
2855 pub fn set_vbvaloval(&mut self, val: bool) {
2856 self.0 = (self.0 & !(0x01 << 23usize)) | (((val as u32) & 0x01) << 23usize);
2857 }
2858 #[doc = "Enables a software override of the VBUS B-session detection."]
2859 #[inline(always)]
2860 pub const fn vbvaloven(&self) -> bool {
2861 let val = (self.0 >> 24usize) & 0x01;
2862 val != 0
2863 }
2864 #[doc = "Enables a software override of the VBUS B-session detection."]
2865 #[inline(always)]
2866 pub fn set_vbvaloven(&mut self, val: bool) {
2867 self.0 = (self.0 & !(0x01 << 24usize)) | (((val as u32) & 0x01) << 24usize);
2868 }
2869 #[doc = "Force host mode pull-downs If the ID pin functions are enabled, the host mode pull-downs on DP and DM activate automatically. However, whenever that is not the case, yet host mode is required, this bit must be used to force the pull-downs active."]
2870 #[inline(always)]
2871 pub const fn forcehostpd(&self) -> bool {
2872 let val = (self.0 >> 25usize) & 0x01;
2873 val != 0
2874 }
2875 #[doc = "Force host mode pull-downs If the ID pin functions are enabled, the host mode pull-downs on DP and DM activate automatically. However, whenever that is not the case, yet host mode is required, this bit must be used to force the pull-downs active."]
2876 #[inline(always)]
2877 pub fn set_forcehostpd(&mut self, val: bool) {
2878 self.0 = (self.0 & !(0x01 << 25usize)) | (((val as u32) & 0x01) << 25usize);
2879 }
2880 }
2881 impl Default for GccfgV3 {
2882 #[inline(always)]
2883 fn default() -> GccfgV3 {
2884 GccfgV3(0)
2885 }
2886 }
2887 impl core::fmt::Debug for GccfgV3 {
2888 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2889 f.debug_struct("GccfgV3")
2890 .field("chgdet", &self.chgdet())
2891 .field("fsvplus", &self.fsvplus())
2892 .field("fsvminus", &self.fsvminus())
2893 .field("sessvld", &self.sessvld())
2894 .field("hcdpen", &self.hcdpen())
2895 .field("hcdpdeten", &self.hcdpdeten())
2896 .field("hvdmsrcen", &self.hvdmsrcen())
2897 .field("dcden", &self.dcden())
2898 .field("pden", &self.pden())
2899 .field("vbden", &self.vbden())
2900 .field("sden", &self.sden())
2901 .field("vbvaloval", &self.vbvaloval())
2902 .field("vbvaloven", &self.vbvaloven())
2903 .field("forcehostpd", &self.forcehostpd())
2904 .finish()
2905 }
2906 }
2907 #[cfg(feature = "defmt")]
2908 impl defmt::Format for GccfgV3 {
2909 fn format(&self, f: defmt::Formatter) {
2910 #[derive(defmt :: Format)]
2911 struct GccfgV3 {
2912 chgdet: bool,
2913 fsvplus: bool,
2914 fsvminus: bool,
2915 sessvld: bool,
2916 hcdpen: bool,
2917 hcdpdeten: bool,
2918 hvdmsrcen: bool,
2919 dcden: bool,
2920 pden: bool,
2921 vbden: bool,
2922 sden: bool,
2923 vbvaloval: bool,
2924 vbvaloven: bool,
2925 forcehostpd: bool,
2926 }
2927 let proxy = GccfgV3 {
2928 chgdet: self.chgdet(),
2929 fsvplus: self.fsvplus(),
2930 fsvminus: self.fsvminus(),
2931 sessvld: self.sessvld(),
2932 hcdpen: self.hcdpen(),
2933 hcdpdeten: self.hcdpdeten(),
2934 hvdmsrcen: self.hvdmsrcen(),
2935 dcden: self.dcden(),
2936 pden: self.pden(),
2937 vbden: self.vbden(),
2938 sden: self.sden(),
2939 vbvaloval: self.vbvaloval(),
2940 vbvaloven: self.vbvaloven(),
2941 forcehostpd: self.forcehostpd(),
2942 };
2943 defmt::write!(f, "{}", proxy)
2944 }
2945 }
2946 #[doc = "I2C access register"]
2947 #[repr(transparent)]
2948 #[derive(Copy, Clone, Eq, PartialEq)]
2949 pub struct Gi2cctl(pub u32);
2950 impl Gi2cctl {
2951 #[doc = "I2C Read/Write Data"]
2952 #[inline(always)]
2953 pub const fn rwdata(&self) -> u8 {
2954 let val = (self.0 >> 0usize) & 0xff;
2955 val as u8
2956 }
2957 #[doc = "I2C Read/Write Data"]
2958 #[inline(always)]
2959 pub fn set_rwdata(&mut self, val: u8) {
2960 self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
2961 }
2962 #[doc = "I2C Register Address"]
2963 #[inline(always)]
2964 pub const fn regaddr(&self) -> u8 {
2965 let val = (self.0 >> 8usize) & 0xff;
2966 val as u8
2967 }
2968 #[doc = "I2C Register Address"]
2969 #[inline(always)]
2970 pub fn set_regaddr(&mut self, val: u8) {
2971 self.0 = (self.0 & !(0xff << 8usize)) | (((val as u32) & 0xff) << 8usize);
2972 }
2973 #[doc = "I2C Address"]
2974 #[inline(always)]
2975 pub const fn addr(&self) -> u8 {
2976 let val = (self.0 >> 16usize) & 0x7f;
2977 val as u8
2978 }
2979 #[doc = "I2C Address"]
2980 #[inline(always)]
2981 pub fn set_addr(&mut self, val: u8) {
2982 self.0 = (self.0 & !(0x7f << 16usize)) | (((val as u32) & 0x7f) << 16usize);
2983 }
2984 #[doc = "I2C Enable"]
2985 #[inline(always)]
2986 pub const fn i2cen(&self) -> bool {
2987 let val = (self.0 >> 23usize) & 0x01;
2988 val != 0
2989 }
2990 #[doc = "I2C Enable"]
2991 #[inline(always)]
2992 pub fn set_i2cen(&mut self, val: bool) {
2993 self.0 = (self.0 & !(0x01 << 23usize)) | (((val as u32) & 0x01) << 23usize);
2994 }
2995 #[doc = "I2C ACK"]
2996 #[inline(always)]
2997 pub const fn ack(&self) -> bool {
2998 let val = (self.0 >> 24usize) & 0x01;
2999 val != 0
3000 }
3001 #[doc = "I2C ACK"]
3002 #[inline(always)]
3003 pub fn set_ack(&mut self, val: bool) {
3004 self.0 = (self.0 & !(0x01 << 24usize)) | (((val as u32) & 0x01) << 24usize);
3005 }
3006 #[doc = "I2C Device Address"]
3007 #[inline(always)]
3008 pub const fn i2cdevadr(&self) -> u8 {
3009 let val = (self.0 >> 26usize) & 0x03;
3010 val as u8
3011 }
3012 #[doc = "I2C Device Address"]
3013 #[inline(always)]
3014 pub fn set_i2cdevadr(&mut self, val: u8) {
3015 self.0 = (self.0 & !(0x03 << 26usize)) | (((val as u32) & 0x03) << 26usize);
3016 }
3017 #[doc = "I2C DatSe0 USB mode"]
3018 #[inline(always)]
3019 pub const fn i2cdatse0(&self) -> bool {
3020 let val = (self.0 >> 28usize) & 0x01;
3021 val != 0
3022 }
3023 #[doc = "I2C DatSe0 USB mode"]
3024 #[inline(always)]
3025 pub fn set_i2cdatse0(&mut self, val: bool) {
3026 self.0 = (self.0 & !(0x01 << 28usize)) | (((val as u32) & 0x01) << 28usize);
3027 }
3028 #[doc = "Read/Write Indicator"]
3029 #[inline(always)]
3030 pub const fn rw(&self) -> bool {
3031 let val = (self.0 >> 30usize) & 0x01;
3032 val != 0
3033 }
3034 #[doc = "Read/Write Indicator"]
3035 #[inline(always)]
3036 pub fn set_rw(&mut self, val: bool) {
3037 self.0 = (self.0 & !(0x01 << 30usize)) | (((val as u32) & 0x01) << 30usize);
3038 }
3039 #[doc = "I2C Busy/Done"]
3040 #[inline(always)]
3041 pub const fn bsydne(&self) -> bool {
3042 let val = (self.0 >> 31usize) & 0x01;
3043 val != 0
3044 }
3045 #[doc = "I2C Busy/Done"]
3046 #[inline(always)]
3047 pub fn set_bsydne(&mut self, val: bool) {
3048 self.0 = (self.0 & !(0x01 << 31usize)) | (((val as u32) & 0x01) << 31usize);
3049 }
3050 }
3051 impl Default for Gi2cctl {
3052 #[inline(always)]
3053 fn default() -> Gi2cctl {
3054 Gi2cctl(0)
3055 }
3056 }
3057 impl core::fmt::Debug for Gi2cctl {
3058 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
3059 f.debug_struct("Gi2cctl")
3060 .field("rwdata", &self.rwdata())
3061 .field("regaddr", &self.regaddr())
3062 .field("addr", &self.addr())
3063 .field("i2cen", &self.i2cen())
3064 .field("ack", &self.ack())
3065 .field("i2cdevadr", &self.i2cdevadr())
3066 .field("i2cdatse0", &self.i2cdatse0())
3067 .field("rw", &self.rw())
3068 .field("bsydne", &self.bsydne())
3069 .finish()
3070 }
3071 }
3072 #[cfg(feature = "defmt")]
3073 impl defmt::Format for Gi2cctl {
3074 fn format(&self, f: defmt::Formatter) {
3075 #[derive(defmt :: Format)]
3076 struct Gi2cctl {
3077 rwdata: u8,
3078 regaddr: u8,
3079 addr: u8,
3080 i2cen: bool,
3081 ack: bool,
3082 i2cdevadr: u8,
3083 i2cdatse0: bool,
3084 rw: bool,
3085 bsydne: bool,
3086 }
3087 let proxy = Gi2cctl {
3088 rwdata: self.rwdata(),
3089 regaddr: self.regaddr(),
3090 addr: self.addr(),
3091 i2cen: self.i2cen(),
3092 ack: self.ack(),
3093 i2cdevadr: self.i2cdevadr(),
3094 i2cdatse0: self.i2cdatse0(),
3095 rw: self.rw(),
3096 bsydne: self.bsydne(),
3097 };
3098 defmt::write!(f, "{}", proxy)
3099 }
3100 }
3101 #[doc = "Interrupt mask register"]
3102 #[repr(transparent)]
3103 #[derive(Copy, Clone, Eq, PartialEq)]
3104 pub struct Gintmsk(pub u32);
3105 impl Gintmsk {
3106 #[doc = "Mode mismatch interrupt mask"]
3107 #[inline(always)]
3108 pub const fn mmism(&self) -> bool {
3109 let val = (self.0 >> 1usize) & 0x01;
3110 val != 0
3111 }
3112 #[doc = "Mode mismatch interrupt mask"]
3113 #[inline(always)]
3114 pub fn set_mmism(&mut self, val: bool) {
3115 self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
3116 }
3117 #[doc = "OTG interrupt mask"]
3118 #[inline(always)]
3119 pub const fn otgint(&self) -> bool {
3120 let val = (self.0 >> 2usize) & 0x01;
3121 val != 0
3122 }
3123 #[doc = "OTG interrupt mask"]
3124 #[inline(always)]
3125 pub fn set_otgint(&mut self, val: bool) {
3126 self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
3127 }
3128 #[doc = "Start of frame mask"]
3129 #[inline(always)]
3130 pub const fn sofm(&self) -> bool {
3131 let val = (self.0 >> 3usize) & 0x01;
3132 val != 0
3133 }
3134 #[doc = "Start of frame mask"]
3135 #[inline(always)]
3136 pub fn set_sofm(&mut self, val: bool) {
3137 self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
3138 }
3139 #[doc = "Receive FIFO non-empty mask"]
3140 #[inline(always)]
3141 pub const fn rxflvlm(&self) -> bool {
3142 let val = (self.0 >> 4usize) & 0x01;
3143 val != 0
3144 }
3145 #[doc = "Receive FIFO non-empty mask"]
3146 #[inline(always)]
3147 pub fn set_rxflvlm(&mut self, val: bool) {
3148 self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
3149 }
3150 #[doc = "Non-periodic TxFIFO empty mask"]
3151 #[inline(always)]
3152 pub const fn nptxfem(&self) -> bool {
3153 let val = (self.0 >> 5usize) & 0x01;
3154 val != 0
3155 }
3156 #[doc = "Non-periodic TxFIFO empty mask"]
3157 #[inline(always)]
3158 pub fn set_nptxfem(&mut self, val: bool) {
3159 self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
3160 }
3161 #[doc = "Global non-periodic IN NAK effective mask"]
3162 #[inline(always)]
3163 pub const fn ginakeffm(&self) -> bool {
3164 let val = (self.0 >> 6usize) & 0x01;
3165 val != 0
3166 }
3167 #[doc = "Global non-periodic IN NAK effective mask"]
3168 #[inline(always)]
3169 pub fn set_ginakeffm(&mut self, val: bool) {
3170 self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
3171 }
3172 #[doc = "Global OUT NAK effective mask"]
3173 #[inline(always)]
3174 pub const fn gonakeffm(&self) -> bool {
3175 let val = (self.0 >> 7usize) & 0x01;
3176 val != 0
3177 }
3178 #[doc = "Global OUT NAK effective mask"]
3179 #[inline(always)]
3180 pub fn set_gonakeffm(&mut self, val: bool) {
3181 self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
3182 }
3183 #[doc = "Early suspend mask"]
3184 #[inline(always)]
3185 pub const fn esuspm(&self) -> bool {
3186 let val = (self.0 >> 10usize) & 0x01;
3187 val != 0
3188 }
3189 #[doc = "Early suspend mask"]
3190 #[inline(always)]
3191 pub fn set_esuspm(&mut self, val: bool) {
3192 self.0 = (self.0 & !(0x01 << 10usize)) | (((val as u32) & 0x01) << 10usize);
3193 }
3194 #[doc = "USB suspend mask"]
3195 #[inline(always)]
3196 pub const fn usbsuspm(&self) -> bool {
3197 let val = (self.0 >> 11usize) & 0x01;
3198 val != 0
3199 }
3200 #[doc = "USB suspend mask"]
3201 #[inline(always)]
3202 pub fn set_usbsuspm(&mut self, val: bool) {
3203 self.0 = (self.0 & !(0x01 << 11usize)) | (((val as u32) & 0x01) << 11usize);
3204 }
3205 #[doc = "USB reset mask"]
3206 #[inline(always)]
3207 pub const fn usbrst(&self) -> bool {
3208 let val = (self.0 >> 12usize) & 0x01;
3209 val != 0
3210 }
3211 #[doc = "USB reset mask"]
3212 #[inline(always)]
3213 pub fn set_usbrst(&mut self, val: bool) {
3214 self.0 = (self.0 & !(0x01 << 12usize)) | (((val as u32) & 0x01) << 12usize);
3215 }
3216 #[doc = "Enumeration done mask"]
3217 #[inline(always)]
3218 pub const fn enumdnem(&self) -> bool {
3219 let val = (self.0 >> 13usize) & 0x01;
3220 val != 0
3221 }
3222 #[doc = "Enumeration done mask"]
3223 #[inline(always)]
3224 pub fn set_enumdnem(&mut self, val: bool) {
3225 self.0 = (self.0 & !(0x01 << 13usize)) | (((val as u32) & 0x01) << 13usize);
3226 }
3227 #[doc = "Isochronous OUT packet dropped interrupt mask"]
3228 #[inline(always)]
3229 pub const fn isoodrpm(&self) -> bool {
3230 let val = (self.0 >> 14usize) & 0x01;
3231 val != 0
3232 }
3233 #[doc = "Isochronous OUT packet dropped interrupt mask"]
3234 #[inline(always)]
3235 pub fn set_isoodrpm(&mut self, val: bool) {
3236 self.0 = (self.0 & !(0x01 << 14usize)) | (((val as u32) & 0x01) << 14usize);
3237 }
3238 #[doc = "End of periodic frame interrupt mask"]
3239 #[inline(always)]
3240 pub const fn eopfm(&self) -> bool {
3241 let val = (self.0 >> 15usize) & 0x01;
3242 val != 0
3243 }
3244 #[doc = "End of periodic frame interrupt mask"]
3245 #[inline(always)]
3246 pub fn set_eopfm(&mut self, val: bool) {
3247 self.0 = (self.0 & !(0x01 << 15usize)) | (((val as u32) & 0x01) << 15usize);
3248 }
3249 #[doc = "Endpoint mismatch interrupt mask"]
3250 #[inline(always)]
3251 pub const fn epmism(&self) -> bool {
3252 let val = (self.0 >> 17usize) & 0x01;
3253 val != 0
3254 }
3255 #[doc = "Endpoint mismatch interrupt mask"]
3256 #[inline(always)]
3257 pub fn set_epmism(&mut self, val: bool) {
3258 self.0 = (self.0 & !(0x01 << 17usize)) | (((val as u32) & 0x01) << 17usize);
3259 }
3260 #[doc = "IN endpoints interrupt mask"]
3261 #[inline(always)]
3262 pub const fn iepint(&self) -> bool {
3263 let val = (self.0 >> 18usize) & 0x01;
3264 val != 0
3265 }
3266 #[doc = "IN endpoints interrupt mask"]
3267 #[inline(always)]
3268 pub fn set_iepint(&mut self, val: bool) {
3269 self.0 = (self.0 & !(0x01 << 18usize)) | (((val as u32) & 0x01) << 18usize);
3270 }
3271 #[doc = "OUT endpoints interrupt mask"]
3272 #[inline(always)]
3273 pub const fn oepint(&self) -> bool {
3274 let val = (self.0 >> 19usize) & 0x01;
3275 val != 0
3276 }
3277 #[doc = "OUT endpoints interrupt mask"]
3278 #[inline(always)]
3279 pub fn set_oepint(&mut self, val: bool) {
3280 self.0 = (self.0 & !(0x01 << 19usize)) | (((val as u32) & 0x01) << 19usize);
3281 }
3282 #[doc = "Incomplete isochronous IN transfer mask"]
3283 #[inline(always)]
3284 pub const fn iisoixfrm(&self) -> bool {
3285 let val = (self.0 >> 20usize) & 0x01;
3286 val != 0
3287 }
3288 #[doc = "Incomplete isochronous IN transfer mask"]
3289 #[inline(always)]
3290 pub fn set_iisoixfrm(&mut self, val: bool) {
3291 self.0 = (self.0 & !(0x01 << 20usize)) | (((val as u32) & 0x01) << 20usize);
3292 }
3293 #[doc = "Incomplete periodic transfer mask (host mode) / Incomplete isochronous OUT transfer mask (device mode)"]
3294 #[inline(always)]
3295 pub const fn ipxfrm_iisooxfrm(&self) -> bool {
3296 let val = (self.0 >> 21usize) & 0x01;
3297 val != 0
3298 }
3299 #[doc = "Incomplete periodic transfer mask (host mode) / Incomplete isochronous OUT transfer mask (device mode)"]
3300 #[inline(always)]
3301 pub fn set_ipxfrm_iisooxfrm(&mut self, val: bool) {
3302 self.0 = (self.0 & !(0x01 << 21usize)) | (((val as u32) & 0x01) << 21usize);
3303 }
3304 #[doc = "Data fetch suspended mask"]
3305 #[inline(always)]
3306 pub const fn fsuspm(&self) -> bool {
3307 let val = (self.0 >> 22usize) & 0x01;
3308 val != 0
3309 }
3310 #[doc = "Data fetch suspended mask"]
3311 #[inline(always)]
3312 pub fn set_fsuspm(&mut self, val: bool) {
3313 self.0 = (self.0 & !(0x01 << 22usize)) | (((val as u32) & 0x01) << 22usize);
3314 }
3315 #[doc = "Reset detected interrupt mask"]
3316 #[inline(always)]
3317 pub const fn rstde(&self) -> bool {
3318 let val = (self.0 >> 23usize) & 0x01;
3319 val != 0
3320 }
3321 #[doc = "Reset detected interrupt mask"]
3322 #[inline(always)]
3323 pub fn set_rstde(&mut self, val: bool) {
3324 self.0 = (self.0 & !(0x01 << 23usize)) | (((val as u32) & 0x01) << 23usize);
3325 }
3326 #[doc = "Host port interrupt mask"]
3327 #[inline(always)]
3328 pub const fn prtim(&self) -> bool {
3329 let val = (self.0 >> 24usize) & 0x01;
3330 val != 0
3331 }
3332 #[doc = "Host port interrupt mask"]
3333 #[inline(always)]
3334 pub fn set_prtim(&mut self, val: bool) {
3335 self.0 = (self.0 & !(0x01 << 24usize)) | (((val as u32) & 0x01) << 24usize);
3336 }
3337 #[doc = "Host channels interrupt mask"]
3338 #[inline(always)]
3339 pub const fn hcim(&self) -> bool {
3340 let val = (self.0 >> 25usize) & 0x01;
3341 val != 0
3342 }
3343 #[doc = "Host channels interrupt mask"]
3344 #[inline(always)]
3345 pub fn set_hcim(&mut self, val: bool) {
3346 self.0 = (self.0 & !(0x01 << 25usize)) | (((val as u32) & 0x01) << 25usize);
3347 }
3348 #[doc = "Periodic TxFIFO empty mask"]
3349 #[inline(always)]
3350 pub const fn ptxfem(&self) -> bool {
3351 let val = (self.0 >> 26usize) & 0x01;
3352 val != 0
3353 }
3354 #[doc = "Periodic TxFIFO empty mask"]
3355 #[inline(always)]
3356 pub fn set_ptxfem(&mut self, val: bool) {
3357 self.0 = (self.0 & !(0x01 << 26usize)) | (((val as u32) & 0x01) << 26usize);
3358 }
3359 #[doc = "LPM interrupt mask"]
3360 #[inline(always)]
3361 pub const fn lpmintm(&self) -> bool {
3362 let val = (self.0 >> 27usize) & 0x01;
3363 val != 0
3364 }
3365 #[doc = "LPM interrupt mask"]
3366 #[inline(always)]
3367 pub fn set_lpmintm(&mut self, val: bool) {
3368 self.0 = (self.0 & !(0x01 << 27usize)) | (((val as u32) & 0x01) << 27usize);
3369 }
3370 #[doc = "Connector ID status change mask"]
3371 #[inline(always)]
3372 pub const fn cidschgm(&self) -> bool {
3373 let val = (self.0 >> 28usize) & 0x01;
3374 val != 0
3375 }
3376 #[doc = "Connector ID status change mask"]
3377 #[inline(always)]
3378 pub fn set_cidschgm(&mut self, val: bool) {
3379 self.0 = (self.0 & !(0x01 << 28usize)) | (((val as u32) & 0x01) << 28usize);
3380 }
3381 #[doc = "Disconnect detected interrupt mask"]
3382 #[inline(always)]
3383 pub const fn discint(&self) -> bool {
3384 let val = (self.0 >> 29usize) & 0x01;
3385 val != 0
3386 }
3387 #[doc = "Disconnect detected interrupt mask"]
3388 #[inline(always)]
3389 pub fn set_discint(&mut self, val: bool) {
3390 self.0 = (self.0 & !(0x01 << 29usize)) | (((val as u32) & 0x01) << 29usize);
3391 }
3392 #[doc = "Session request/new session detected interrupt mask"]
3393 #[inline(always)]
3394 pub const fn srqim(&self) -> bool {
3395 let val = (self.0 >> 30usize) & 0x01;
3396 val != 0
3397 }
3398 #[doc = "Session request/new session detected interrupt mask"]
3399 #[inline(always)]
3400 pub fn set_srqim(&mut self, val: bool) {
3401 self.0 = (self.0 & !(0x01 << 30usize)) | (((val as u32) & 0x01) << 30usize);
3402 }
3403 #[doc = "Resume/remote wakeup detected interrupt mask"]
3404 #[inline(always)]
3405 pub const fn wuim(&self) -> bool {
3406 let val = (self.0 >> 31usize) & 0x01;
3407 val != 0
3408 }
3409 #[doc = "Resume/remote wakeup detected interrupt mask"]
3410 #[inline(always)]
3411 pub fn set_wuim(&mut self, val: bool) {
3412 self.0 = (self.0 & !(0x01 << 31usize)) | (((val as u32) & 0x01) << 31usize);
3413 }
3414 }
3415 impl Default for Gintmsk {
3416 #[inline(always)]
3417 fn default() -> Gintmsk {
3418 Gintmsk(0)
3419 }
3420 }
3421 impl core::fmt::Debug for Gintmsk {
3422 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
3423 f.debug_struct("Gintmsk")
3424 .field("mmism", &self.mmism())
3425 .field("otgint", &self.otgint())
3426 .field("sofm", &self.sofm())
3427 .field("rxflvlm", &self.rxflvlm())
3428 .field("nptxfem", &self.nptxfem())
3429 .field("ginakeffm", &self.ginakeffm())
3430 .field("gonakeffm", &self.gonakeffm())
3431 .field("esuspm", &self.esuspm())
3432 .field("usbsuspm", &self.usbsuspm())
3433 .field("usbrst", &self.usbrst())
3434 .field("enumdnem", &self.enumdnem())
3435 .field("isoodrpm", &self.isoodrpm())
3436 .field("eopfm", &self.eopfm())
3437 .field("epmism", &self.epmism())
3438 .field("iepint", &self.iepint())
3439 .field("oepint", &self.oepint())
3440 .field("iisoixfrm", &self.iisoixfrm())
3441 .field("ipxfrm_iisooxfrm", &self.ipxfrm_iisooxfrm())
3442 .field("fsuspm", &self.fsuspm())
3443 .field("rstde", &self.rstde())
3444 .field("prtim", &self.prtim())
3445 .field("hcim", &self.hcim())
3446 .field("ptxfem", &self.ptxfem())
3447 .field("lpmintm", &self.lpmintm())
3448 .field("cidschgm", &self.cidschgm())
3449 .field("discint", &self.discint())
3450 .field("srqim", &self.srqim())
3451 .field("wuim", &self.wuim())
3452 .finish()
3453 }
3454 }
3455 #[cfg(feature = "defmt")]
3456 impl defmt::Format for Gintmsk {
3457 fn format(&self, f: defmt::Formatter) {
3458 #[derive(defmt :: Format)]
3459 struct Gintmsk {
3460 mmism: bool,
3461 otgint: bool,
3462 sofm: bool,
3463 rxflvlm: bool,
3464 nptxfem: bool,
3465 ginakeffm: bool,
3466 gonakeffm: bool,
3467 esuspm: bool,
3468 usbsuspm: bool,
3469 usbrst: bool,
3470 enumdnem: bool,
3471 isoodrpm: bool,
3472 eopfm: bool,
3473 epmism: bool,
3474 iepint: bool,
3475 oepint: bool,
3476 iisoixfrm: bool,
3477 ipxfrm_iisooxfrm: bool,
3478 fsuspm: bool,
3479 rstde: bool,
3480 prtim: bool,
3481 hcim: bool,
3482 ptxfem: bool,
3483 lpmintm: bool,
3484 cidschgm: bool,
3485 discint: bool,
3486 srqim: bool,
3487 wuim: bool,
3488 }
3489 let proxy = Gintmsk {
3490 mmism: self.mmism(),
3491 otgint: self.otgint(),
3492 sofm: self.sofm(),
3493 rxflvlm: self.rxflvlm(),
3494 nptxfem: self.nptxfem(),
3495 ginakeffm: self.ginakeffm(),
3496 gonakeffm: self.gonakeffm(),
3497 esuspm: self.esuspm(),
3498 usbsuspm: self.usbsuspm(),
3499 usbrst: self.usbrst(),
3500 enumdnem: self.enumdnem(),
3501 isoodrpm: self.isoodrpm(),
3502 eopfm: self.eopfm(),
3503 epmism: self.epmism(),
3504 iepint: self.iepint(),
3505 oepint: self.oepint(),
3506 iisoixfrm: self.iisoixfrm(),
3507 ipxfrm_iisooxfrm: self.ipxfrm_iisooxfrm(),
3508 fsuspm: self.fsuspm(),
3509 rstde: self.rstde(),
3510 prtim: self.prtim(),
3511 hcim: self.hcim(),
3512 ptxfem: self.ptxfem(),
3513 lpmintm: self.lpmintm(),
3514 cidschgm: self.cidschgm(),
3515 discint: self.discint(),
3516 srqim: self.srqim(),
3517 wuim: self.wuim(),
3518 };
3519 defmt::write!(f, "{}", proxy)
3520 }
3521 }
3522 #[doc = "Core interrupt register"]
3523 #[repr(transparent)]
3524 #[derive(Copy, Clone, Eq, PartialEq)]
3525 pub struct Gintsts(pub u32);
3526 impl Gintsts {
3527 #[doc = "Current mode of operation"]
3528 #[inline(always)]
3529 pub const fn cmod(&self) -> bool {
3530 let val = (self.0 >> 0usize) & 0x01;
3531 val != 0
3532 }
3533 #[doc = "Current mode of operation"]
3534 #[inline(always)]
3535 pub fn set_cmod(&mut self, val: bool) {
3536 self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
3537 }
3538 #[doc = "Mode mismatch interrupt"]
3539 #[inline(always)]
3540 pub const fn mmis(&self) -> bool {
3541 let val = (self.0 >> 1usize) & 0x01;
3542 val != 0
3543 }
3544 #[doc = "Mode mismatch interrupt"]
3545 #[inline(always)]
3546 pub fn set_mmis(&mut self, val: bool) {
3547 self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
3548 }
3549 #[doc = "OTG interrupt"]
3550 #[inline(always)]
3551 pub const fn otgint(&self) -> bool {
3552 let val = (self.0 >> 2usize) & 0x01;
3553 val != 0
3554 }
3555 #[doc = "OTG interrupt"]
3556 #[inline(always)]
3557 pub fn set_otgint(&mut self, val: bool) {
3558 self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
3559 }
3560 #[doc = "Start of frame"]
3561 #[inline(always)]
3562 pub const fn sof(&self) -> bool {
3563 let val = (self.0 >> 3usize) & 0x01;
3564 val != 0
3565 }
3566 #[doc = "Start of frame"]
3567 #[inline(always)]
3568 pub fn set_sof(&mut self, val: bool) {
3569 self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
3570 }
3571 #[doc = "RxFIFO non-empty"]
3572 #[inline(always)]
3573 pub const fn rxflvl(&self) -> bool {
3574 let val = (self.0 >> 4usize) & 0x01;
3575 val != 0
3576 }
3577 #[doc = "RxFIFO non-empty"]
3578 #[inline(always)]
3579 pub fn set_rxflvl(&mut self, val: bool) {
3580 self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
3581 }
3582 #[doc = "Non-periodic TxFIFO empty"]
3583 #[inline(always)]
3584 pub const fn nptxfe(&self) -> bool {
3585 let val = (self.0 >> 5usize) & 0x01;
3586 val != 0
3587 }
3588 #[doc = "Non-periodic TxFIFO empty"]
3589 #[inline(always)]
3590 pub fn set_nptxfe(&mut self, val: bool) {
3591 self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
3592 }
3593 #[doc = "Global IN non-periodic NAK effective"]
3594 #[inline(always)]
3595 pub const fn ginakeff(&self) -> bool {
3596 let val = (self.0 >> 6usize) & 0x01;
3597 val != 0
3598 }
3599 #[doc = "Global IN non-periodic NAK effective"]
3600 #[inline(always)]
3601 pub fn set_ginakeff(&mut self, val: bool) {
3602 self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
3603 }
3604 #[doc = "Global OUT NAK effective"]
3605 #[inline(always)]
3606 pub const fn goutnakeff(&self) -> bool {
3607 let val = (self.0 >> 7usize) & 0x01;
3608 val != 0
3609 }
3610 #[doc = "Global OUT NAK effective"]
3611 #[inline(always)]
3612 pub fn set_goutnakeff(&mut self, val: bool) {
3613 self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
3614 }
3615 #[doc = "Early suspend"]
3616 #[inline(always)]
3617 pub const fn esusp(&self) -> bool {
3618 let val = (self.0 >> 10usize) & 0x01;
3619 val != 0
3620 }
3621 #[doc = "Early suspend"]
3622 #[inline(always)]
3623 pub fn set_esusp(&mut self, val: bool) {
3624 self.0 = (self.0 & !(0x01 << 10usize)) | (((val as u32) & 0x01) << 10usize);
3625 }
3626 #[doc = "USB suspend"]
3627 #[inline(always)]
3628 pub const fn usbsusp(&self) -> bool {
3629 let val = (self.0 >> 11usize) & 0x01;
3630 val != 0
3631 }
3632 #[doc = "USB suspend"]
3633 #[inline(always)]
3634 pub fn set_usbsusp(&mut self, val: bool) {
3635 self.0 = (self.0 & !(0x01 << 11usize)) | (((val as u32) & 0x01) << 11usize);
3636 }
3637 #[doc = "USB reset"]
3638 #[inline(always)]
3639 pub const fn usbrst(&self) -> bool {
3640 let val = (self.0 >> 12usize) & 0x01;
3641 val != 0
3642 }
3643 #[doc = "USB reset"]
3644 #[inline(always)]
3645 pub fn set_usbrst(&mut self, val: bool) {
3646 self.0 = (self.0 & !(0x01 << 12usize)) | (((val as u32) & 0x01) << 12usize);
3647 }
3648 #[doc = "Enumeration done"]
3649 #[inline(always)]
3650 pub const fn enumdne(&self) -> bool {
3651 let val = (self.0 >> 13usize) & 0x01;
3652 val != 0
3653 }
3654 #[doc = "Enumeration done"]
3655 #[inline(always)]
3656 pub fn set_enumdne(&mut self, val: bool) {
3657 self.0 = (self.0 & !(0x01 << 13usize)) | (((val as u32) & 0x01) << 13usize);
3658 }
3659 #[doc = "Isochronous OUT packet dropped interrupt"]
3660 #[inline(always)]
3661 pub const fn isoodrp(&self) -> bool {
3662 let val = (self.0 >> 14usize) & 0x01;
3663 val != 0
3664 }
3665 #[doc = "Isochronous OUT packet dropped interrupt"]
3666 #[inline(always)]
3667 pub fn set_isoodrp(&mut self, val: bool) {
3668 self.0 = (self.0 & !(0x01 << 14usize)) | (((val as u32) & 0x01) << 14usize);
3669 }
3670 #[doc = "End of periodic frame interrupt"]
3671 #[inline(always)]
3672 pub const fn eopf(&self) -> bool {
3673 let val = (self.0 >> 15usize) & 0x01;
3674 val != 0
3675 }
3676 #[doc = "End of periodic frame interrupt"]
3677 #[inline(always)]
3678 pub fn set_eopf(&mut self, val: bool) {
3679 self.0 = (self.0 & !(0x01 << 15usize)) | (((val as u32) & 0x01) << 15usize);
3680 }
3681 #[doc = "IN endpoint interrupt"]
3682 #[inline(always)]
3683 pub const fn iepint(&self) -> bool {
3684 let val = (self.0 >> 18usize) & 0x01;
3685 val != 0
3686 }
3687 #[doc = "IN endpoint interrupt"]
3688 #[inline(always)]
3689 pub fn set_iepint(&mut self, val: bool) {
3690 self.0 = (self.0 & !(0x01 << 18usize)) | (((val as u32) & 0x01) << 18usize);
3691 }
3692 #[doc = "OUT endpoint interrupt"]
3693 #[inline(always)]
3694 pub const fn oepint(&self) -> bool {
3695 let val = (self.0 >> 19usize) & 0x01;
3696 val != 0
3697 }
3698 #[doc = "OUT endpoint interrupt"]
3699 #[inline(always)]
3700 pub fn set_oepint(&mut self, val: bool) {
3701 self.0 = (self.0 & !(0x01 << 19usize)) | (((val as u32) & 0x01) << 19usize);
3702 }
3703 #[doc = "Incomplete isochronous IN transfer"]
3704 #[inline(always)]
3705 pub const fn iisoixfr(&self) -> bool {
3706 let val = (self.0 >> 20usize) & 0x01;
3707 val != 0
3708 }
3709 #[doc = "Incomplete isochronous IN transfer"]
3710 #[inline(always)]
3711 pub fn set_iisoixfr(&mut self, val: bool) {
3712 self.0 = (self.0 & !(0x01 << 20usize)) | (((val as u32) & 0x01) << 20usize);
3713 }
3714 #[doc = "Incomplete periodic transfer (host mode) / Incomplete isochronous OUT transfer (device mode)"]
3715 #[inline(always)]
3716 pub const fn ipxfr_incompisoout(&self) -> bool {
3717 let val = (self.0 >> 21usize) & 0x01;
3718 val != 0
3719 }
3720 #[doc = "Incomplete periodic transfer (host mode) / Incomplete isochronous OUT transfer (device mode)"]
3721 #[inline(always)]
3722 pub fn set_ipxfr_incompisoout(&mut self, val: bool) {
3723 self.0 = (self.0 & !(0x01 << 21usize)) | (((val as u32) & 0x01) << 21usize);
3724 }
3725 #[doc = "Data fetch suspended"]
3726 #[inline(always)]
3727 pub const fn datafsusp(&self) -> bool {
3728 let val = (self.0 >> 22usize) & 0x01;
3729 val != 0
3730 }
3731 #[doc = "Data fetch suspended"]
3732 #[inline(always)]
3733 pub fn set_datafsusp(&mut self, val: bool) {
3734 self.0 = (self.0 & !(0x01 << 22usize)) | (((val as u32) & 0x01) << 22usize);
3735 }
3736 #[doc = "Reset detected"]
3737 #[inline(always)]
3738 pub const fn resetdet(&self) -> bool {
3739 let val = (self.0 >> 23usize) & 0x01;
3740 val != 0
3741 }
3742 #[doc = "Reset detected"]
3743 #[inline(always)]
3744 pub fn set_resetdet(&mut self, val: bool) {
3745 self.0 = (self.0 & !(0x01 << 23usize)) | (((val as u32) & 0x01) << 23usize);
3746 }
3747 #[doc = "Host port interrupt"]
3748 #[inline(always)]
3749 pub const fn hprtint(&self) -> bool {
3750 let val = (self.0 >> 24usize) & 0x01;
3751 val != 0
3752 }
3753 #[doc = "Host port interrupt"]
3754 #[inline(always)]
3755 pub fn set_hprtint(&mut self, val: bool) {
3756 self.0 = (self.0 & !(0x01 << 24usize)) | (((val as u32) & 0x01) << 24usize);
3757 }
3758 #[doc = "Host channels interrupt"]
3759 #[inline(always)]
3760 pub const fn hcint(&self) -> bool {
3761 let val = (self.0 >> 25usize) & 0x01;
3762 val != 0
3763 }
3764 #[doc = "Host channels interrupt"]
3765 #[inline(always)]
3766 pub fn set_hcint(&mut self, val: bool) {
3767 self.0 = (self.0 & !(0x01 << 25usize)) | (((val as u32) & 0x01) << 25usize);
3768 }
3769 #[doc = "Periodic TxFIFO empty"]
3770 #[inline(always)]
3771 pub const fn ptxfe(&self) -> bool {
3772 let val = (self.0 >> 26usize) & 0x01;
3773 val != 0
3774 }
3775 #[doc = "Periodic TxFIFO empty"]
3776 #[inline(always)]
3777 pub fn set_ptxfe(&mut self, val: bool) {
3778 self.0 = (self.0 & !(0x01 << 26usize)) | (((val as u32) & 0x01) << 26usize);
3779 }
3780 #[doc = "Connector ID status change"]
3781 #[inline(always)]
3782 pub const fn cidschg(&self) -> bool {
3783 let val = (self.0 >> 28usize) & 0x01;
3784 val != 0
3785 }
3786 #[doc = "Connector ID status change"]
3787 #[inline(always)]
3788 pub fn set_cidschg(&mut self, val: bool) {
3789 self.0 = (self.0 & !(0x01 << 28usize)) | (((val as u32) & 0x01) << 28usize);
3790 }
3791 #[doc = "Disconnect detected interrupt"]
3792 #[inline(always)]
3793 pub const fn discint(&self) -> bool {
3794 let val = (self.0 >> 29usize) & 0x01;
3795 val != 0
3796 }
3797 #[doc = "Disconnect detected interrupt"]
3798 #[inline(always)]
3799 pub fn set_discint(&mut self, val: bool) {
3800 self.0 = (self.0 & !(0x01 << 29usize)) | (((val as u32) & 0x01) << 29usize);
3801 }
3802 #[doc = "Session request/new session detected interrupt"]
3803 #[inline(always)]
3804 pub const fn srqint(&self) -> bool {
3805 let val = (self.0 >> 30usize) & 0x01;
3806 val != 0
3807 }
3808 #[doc = "Session request/new session detected interrupt"]
3809 #[inline(always)]
3810 pub fn set_srqint(&mut self, val: bool) {
3811 self.0 = (self.0 & !(0x01 << 30usize)) | (((val as u32) & 0x01) << 30usize);
3812 }
3813 #[doc = "Resume/remote wakeup detected interrupt"]
3814 #[inline(always)]
3815 pub const fn wkupint(&self) -> bool {
3816 let val = (self.0 >> 31usize) & 0x01;
3817 val != 0
3818 }
3819 #[doc = "Resume/remote wakeup detected interrupt"]
3820 #[inline(always)]
3821 pub fn set_wkupint(&mut self, val: bool) {
3822 self.0 = (self.0 & !(0x01 << 31usize)) | (((val as u32) & 0x01) << 31usize);
3823 }
3824 }
3825 impl Default for Gintsts {
3826 #[inline(always)]
3827 fn default() -> Gintsts {
3828 Gintsts(0)
3829 }
3830 }
3831 impl core::fmt::Debug for Gintsts {
3832 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
3833 f.debug_struct("Gintsts")
3834 .field("cmod", &self.cmod())
3835 .field("mmis", &self.mmis())
3836 .field("otgint", &self.otgint())
3837 .field("sof", &self.sof())
3838 .field("rxflvl", &self.rxflvl())
3839 .field("nptxfe", &self.nptxfe())
3840 .field("ginakeff", &self.ginakeff())
3841 .field("goutnakeff", &self.goutnakeff())
3842 .field("esusp", &self.esusp())
3843 .field("usbsusp", &self.usbsusp())
3844 .field("usbrst", &self.usbrst())
3845 .field("enumdne", &self.enumdne())
3846 .field("isoodrp", &self.isoodrp())
3847 .field("eopf", &self.eopf())
3848 .field("iepint", &self.iepint())
3849 .field("oepint", &self.oepint())
3850 .field("iisoixfr", &self.iisoixfr())
3851 .field("ipxfr_incompisoout", &self.ipxfr_incompisoout())
3852 .field("datafsusp", &self.datafsusp())
3853 .field("resetdet", &self.resetdet())
3854 .field("hprtint", &self.hprtint())
3855 .field("hcint", &self.hcint())
3856 .field("ptxfe", &self.ptxfe())
3857 .field("cidschg", &self.cidschg())
3858 .field("discint", &self.discint())
3859 .field("srqint", &self.srqint())
3860 .field("wkupint", &self.wkupint())
3861 .finish()
3862 }
3863 }
3864 #[cfg(feature = "defmt")]
3865 impl defmt::Format for Gintsts {
3866 fn format(&self, f: defmt::Formatter) {
3867 #[derive(defmt :: Format)]
3868 struct Gintsts {
3869 cmod: bool,
3870 mmis: bool,
3871 otgint: bool,
3872 sof: bool,
3873 rxflvl: bool,
3874 nptxfe: bool,
3875 ginakeff: bool,
3876 goutnakeff: bool,
3877 esusp: bool,
3878 usbsusp: bool,
3879 usbrst: bool,
3880 enumdne: bool,
3881 isoodrp: bool,
3882 eopf: bool,
3883 iepint: bool,
3884 oepint: bool,
3885 iisoixfr: bool,
3886 ipxfr_incompisoout: bool,
3887 datafsusp: bool,
3888 resetdet: bool,
3889 hprtint: bool,
3890 hcint: bool,
3891 ptxfe: bool,
3892 cidschg: bool,
3893 discint: bool,
3894 srqint: bool,
3895 wkupint: bool,
3896 }
3897 let proxy = Gintsts {
3898 cmod: self.cmod(),
3899 mmis: self.mmis(),
3900 otgint: self.otgint(),
3901 sof: self.sof(),
3902 rxflvl: self.rxflvl(),
3903 nptxfe: self.nptxfe(),
3904 ginakeff: self.ginakeff(),
3905 goutnakeff: self.goutnakeff(),
3906 esusp: self.esusp(),
3907 usbsusp: self.usbsusp(),
3908 usbrst: self.usbrst(),
3909 enumdne: self.enumdne(),
3910 isoodrp: self.isoodrp(),
3911 eopf: self.eopf(),
3912 iepint: self.iepint(),
3913 oepint: self.oepint(),
3914 iisoixfr: self.iisoixfr(),
3915 ipxfr_incompisoout: self.ipxfr_incompisoout(),
3916 datafsusp: self.datafsusp(),
3917 resetdet: self.resetdet(),
3918 hprtint: self.hprtint(),
3919 hcint: self.hcint(),
3920 ptxfe: self.ptxfe(),
3921 cidschg: self.cidschg(),
3922 discint: self.discint(),
3923 srqint: self.srqint(),
3924 wkupint: self.wkupint(),
3925 };
3926 defmt::write!(f, "{}", proxy)
3927 }
3928 }
3929 #[doc = "Core LPM configuration register"]
3930 #[repr(transparent)]
3931 #[derive(Copy, Clone, Eq, PartialEq)]
3932 pub struct Glpmcfg(pub u32);
3933 impl Glpmcfg {
3934 #[doc = "LPM support enable"]
3935 #[inline(always)]
3936 pub const fn lpmen(&self) -> bool {
3937 let val = (self.0 >> 0usize) & 0x01;
3938 val != 0
3939 }
3940 #[doc = "LPM support enable"]
3941 #[inline(always)]
3942 pub fn set_lpmen(&mut self, val: bool) {
3943 self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
3944 }
3945 #[doc = "LPM token acknowledge enable"]
3946 #[inline(always)]
3947 pub const fn lpmack(&self) -> bool {
3948 let val = (self.0 >> 1usize) & 0x01;
3949 val != 0
3950 }
3951 #[doc = "LPM token acknowledge enable"]
3952 #[inline(always)]
3953 pub fn set_lpmack(&mut self, val: bool) {
3954 self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
3955 }
3956 #[doc = "Best effort service latency"]
3957 #[inline(always)]
3958 pub const fn besl(&self) -> u8 {
3959 let val = (self.0 >> 2usize) & 0x0f;
3960 val as u8
3961 }
3962 #[doc = "Best effort service latency"]
3963 #[inline(always)]
3964 pub fn set_besl(&mut self, val: u8) {
3965 self.0 = (self.0 & !(0x0f << 2usize)) | (((val as u32) & 0x0f) << 2usize);
3966 }
3967 #[doc = "bRemoteWake value"]
3968 #[inline(always)]
3969 pub const fn remwake(&self) -> bool {
3970 let val = (self.0 >> 6usize) & 0x01;
3971 val != 0
3972 }
3973 #[doc = "bRemoteWake value"]
3974 #[inline(always)]
3975 pub fn set_remwake(&mut self, val: bool) {
3976 self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
3977 }
3978 #[doc = "L1 Shallow Sleep enable"]
3979 #[inline(always)]
3980 pub const fn l1ssen(&self) -> bool {
3981 let val = (self.0 >> 7usize) & 0x01;
3982 val != 0
3983 }
3984 #[doc = "L1 Shallow Sleep enable"]
3985 #[inline(always)]
3986 pub fn set_l1ssen(&mut self, val: bool) {
3987 self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
3988 }
3989 #[doc = "BESL threshold"]
3990 #[inline(always)]
3991 pub const fn beslthrs(&self) -> u8 {
3992 let val = (self.0 >> 8usize) & 0x0f;
3993 val as u8
3994 }
3995 #[doc = "BESL threshold"]
3996 #[inline(always)]
3997 pub fn set_beslthrs(&mut self, val: u8) {
3998 self.0 = (self.0 & !(0x0f << 8usize)) | (((val as u32) & 0x0f) << 8usize);
3999 }
4000 #[doc = "L1 deep sleep enable"]
4001 #[inline(always)]
4002 pub const fn l1dsen(&self) -> bool {
4003 let val = (self.0 >> 12usize) & 0x01;
4004 val != 0
4005 }
4006 #[doc = "L1 deep sleep enable"]
4007 #[inline(always)]
4008 pub fn set_l1dsen(&mut self, val: bool) {
4009 self.0 = (self.0 & !(0x01 << 12usize)) | (((val as u32) & 0x01) << 12usize);
4010 }
4011 #[doc = "LPM response"]
4012 #[inline(always)]
4013 pub const fn lpmrst(&self) -> u8 {
4014 let val = (self.0 >> 13usize) & 0x03;
4015 val as u8
4016 }
4017 #[doc = "LPM response"]
4018 #[inline(always)]
4019 pub fn set_lpmrst(&mut self, val: u8) {
4020 self.0 = (self.0 & !(0x03 << 13usize)) | (((val as u32) & 0x03) << 13usize);
4021 }
4022 #[doc = "Port sleep status"]
4023 #[inline(always)]
4024 pub const fn slpsts(&self) -> bool {
4025 let val = (self.0 >> 15usize) & 0x01;
4026 val != 0
4027 }
4028 #[doc = "Port sleep status"]
4029 #[inline(always)]
4030 pub fn set_slpsts(&mut self, val: bool) {
4031 self.0 = (self.0 & !(0x01 << 15usize)) | (((val as u32) & 0x01) << 15usize);
4032 }
4033 #[doc = "Sleep State Resume OK"]
4034 #[inline(always)]
4035 pub const fn l1rsmok(&self) -> bool {
4036 let val = (self.0 >> 16usize) & 0x01;
4037 val != 0
4038 }
4039 #[doc = "Sleep State Resume OK"]
4040 #[inline(always)]
4041 pub fn set_l1rsmok(&mut self, val: bool) {
4042 self.0 = (self.0 & !(0x01 << 16usize)) | (((val as u32) & 0x01) << 16usize);
4043 }
4044 #[doc = "LPM Channel Index"]
4045 #[inline(always)]
4046 pub const fn lpmchidx(&self) -> u8 {
4047 let val = (self.0 >> 17usize) & 0x0f;
4048 val as u8
4049 }
4050 #[doc = "LPM Channel Index"]
4051 #[inline(always)]
4052 pub fn set_lpmchidx(&mut self, val: u8) {
4053 self.0 = (self.0 & !(0x0f << 17usize)) | (((val as u32) & 0x0f) << 17usize);
4054 }
4055 #[doc = "LPM retry count"]
4056 #[inline(always)]
4057 pub const fn lpmrcnt(&self) -> u8 {
4058 let val = (self.0 >> 21usize) & 0x07;
4059 val as u8
4060 }
4061 #[doc = "LPM retry count"]
4062 #[inline(always)]
4063 pub fn set_lpmrcnt(&mut self, val: u8) {
4064 self.0 = (self.0 & !(0x07 << 21usize)) | (((val as u32) & 0x07) << 21usize);
4065 }
4066 #[doc = "Send LPM transaction"]
4067 #[inline(always)]
4068 pub const fn sndlpm(&self) -> bool {
4069 let val = (self.0 >> 24usize) & 0x01;
4070 val != 0
4071 }
4072 #[doc = "Send LPM transaction"]
4073 #[inline(always)]
4074 pub fn set_sndlpm(&mut self, val: bool) {
4075 self.0 = (self.0 & !(0x01 << 24usize)) | (((val as u32) & 0x01) << 24usize);
4076 }
4077 #[doc = "LPM retry count status"]
4078 #[inline(always)]
4079 pub const fn lpmrcntsts(&self) -> u8 {
4080 let val = (self.0 >> 25usize) & 0x07;
4081 val as u8
4082 }
4083 #[doc = "LPM retry count status"]
4084 #[inline(always)]
4085 pub fn set_lpmrcntsts(&mut self, val: u8) {
4086 self.0 = (self.0 & !(0x07 << 25usize)) | (((val as u32) & 0x07) << 25usize);
4087 }
4088 #[doc = "Enable best effort service latency"]
4089 #[inline(always)]
4090 pub const fn enbesl(&self) -> bool {
4091 let val = (self.0 >> 28usize) & 0x01;
4092 val != 0
4093 }
4094 #[doc = "Enable best effort service latency"]
4095 #[inline(always)]
4096 pub fn set_enbesl(&mut self, val: bool) {
4097 self.0 = (self.0 & !(0x01 << 28usize)) | (((val as u32) & 0x01) << 28usize);
4098 }
4099 }
4100 impl Default for Glpmcfg {
4101 #[inline(always)]
4102 fn default() -> Glpmcfg {
4103 Glpmcfg(0)
4104 }
4105 }
4106 impl core::fmt::Debug for Glpmcfg {
4107 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
4108 f.debug_struct("Glpmcfg")
4109 .field("lpmen", &self.lpmen())
4110 .field("lpmack", &self.lpmack())
4111 .field("besl", &self.besl())
4112 .field("remwake", &self.remwake())
4113 .field("l1ssen", &self.l1ssen())
4114 .field("beslthrs", &self.beslthrs())
4115 .field("l1dsen", &self.l1dsen())
4116 .field("lpmrst", &self.lpmrst())
4117 .field("slpsts", &self.slpsts())
4118 .field("l1rsmok", &self.l1rsmok())
4119 .field("lpmchidx", &self.lpmchidx())
4120 .field("lpmrcnt", &self.lpmrcnt())
4121 .field("sndlpm", &self.sndlpm())
4122 .field("lpmrcntsts", &self.lpmrcntsts())
4123 .field("enbesl", &self.enbesl())
4124 .finish()
4125 }
4126 }
4127 #[cfg(feature = "defmt")]
4128 impl defmt::Format for Glpmcfg {
4129 fn format(&self, f: defmt::Formatter) {
4130 #[derive(defmt :: Format)]
4131 struct Glpmcfg {
4132 lpmen: bool,
4133 lpmack: bool,
4134 besl: u8,
4135 remwake: bool,
4136 l1ssen: bool,
4137 beslthrs: u8,
4138 l1dsen: bool,
4139 lpmrst: u8,
4140 slpsts: bool,
4141 l1rsmok: bool,
4142 lpmchidx: u8,
4143 lpmrcnt: u8,
4144 sndlpm: bool,
4145 lpmrcntsts: u8,
4146 enbesl: bool,
4147 }
4148 let proxy = Glpmcfg {
4149 lpmen: self.lpmen(),
4150 lpmack: self.lpmack(),
4151 besl: self.besl(),
4152 remwake: self.remwake(),
4153 l1ssen: self.l1ssen(),
4154 beslthrs: self.beslthrs(),
4155 l1dsen: self.l1dsen(),
4156 lpmrst: self.lpmrst(),
4157 slpsts: self.slpsts(),
4158 l1rsmok: self.l1rsmok(),
4159 lpmchidx: self.lpmchidx(),
4160 lpmrcnt: self.lpmrcnt(),
4161 sndlpm: self.sndlpm(),
4162 lpmrcntsts: self.lpmrcntsts(),
4163 enbesl: self.enbesl(),
4164 };
4165 defmt::write!(f, "{}", proxy)
4166 }
4167 }
4168 #[doc = "Control and status register"]
4169 #[repr(transparent)]
4170 #[derive(Copy, Clone, Eq, PartialEq)]
4171 pub struct Gotgctl(pub u32);
4172 impl Gotgctl {
4173 #[doc = "Session request success"]
4174 #[inline(always)]
4175 pub const fn srqscs(&self) -> bool {
4176 let val = (self.0 >> 0usize) & 0x01;
4177 val != 0
4178 }
4179 #[doc = "Session request success"]
4180 #[inline(always)]
4181 pub fn set_srqscs(&mut self, val: bool) {
4182 self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
4183 }
4184 #[doc = "Session request"]
4185 #[inline(always)]
4186 pub const fn srq(&self) -> bool {
4187 let val = (self.0 >> 1usize) & 0x01;
4188 val != 0
4189 }
4190 #[doc = "Session request"]
4191 #[inline(always)]
4192 pub fn set_srq(&mut self, val: bool) {
4193 self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
4194 }
4195 #[doc = "VBUS valid override enable"]
4196 #[inline(always)]
4197 pub const fn vbvaloen(&self) -> bool {
4198 let val = (self.0 >> 2usize) & 0x01;
4199 val != 0
4200 }
4201 #[doc = "VBUS valid override enable"]
4202 #[inline(always)]
4203 pub fn set_vbvaloen(&mut self, val: bool) {
4204 self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
4205 }
4206 #[doc = "VBUS valid override value"]
4207 #[inline(always)]
4208 pub const fn vbvaloval(&self) -> bool {
4209 let val = (self.0 >> 3usize) & 0x01;
4210 val != 0
4211 }
4212 #[doc = "VBUS valid override value"]
4213 #[inline(always)]
4214 pub fn set_vbvaloval(&mut self, val: bool) {
4215 self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
4216 }
4217 #[doc = "A-peripheral session valid override enable"]
4218 #[inline(always)]
4219 pub const fn avaloen(&self) -> bool {
4220 let val = (self.0 >> 4usize) & 0x01;
4221 val != 0
4222 }
4223 #[doc = "A-peripheral session valid override enable"]
4224 #[inline(always)]
4225 pub fn set_avaloen(&mut self, val: bool) {
4226 self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
4227 }
4228 #[doc = "A-peripheral session valid override value"]
4229 #[inline(always)]
4230 pub const fn avaloval(&self) -> bool {
4231 let val = (self.0 >> 5usize) & 0x01;
4232 val != 0
4233 }
4234 #[doc = "A-peripheral session valid override value"]
4235 #[inline(always)]
4236 pub fn set_avaloval(&mut self, val: bool) {
4237 self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
4238 }
4239 #[doc = "B-peripheral session valid override enable"]
4240 #[inline(always)]
4241 pub const fn bvaloen(&self) -> bool {
4242 let val = (self.0 >> 6usize) & 0x01;
4243 val != 0
4244 }
4245 #[doc = "B-peripheral session valid override enable"]
4246 #[inline(always)]
4247 pub fn set_bvaloen(&mut self, val: bool) {
4248 self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
4249 }
4250 #[doc = "B-peripheral session valid override value"]
4251 #[inline(always)]
4252 pub const fn bvaloval(&self) -> bool {
4253 let val = (self.0 >> 7usize) & 0x01;
4254 val != 0
4255 }
4256 #[doc = "B-peripheral session valid override value"]
4257 #[inline(always)]
4258 pub fn set_bvaloval(&mut self, val: bool) {
4259 self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
4260 }
4261 #[doc = "Host negotiation success"]
4262 #[inline(always)]
4263 pub const fn hngscs(&self) -> bool {
4264 let val = (self.0 >> 8usize) & 0x01;
4265 val != 0
4266 }
4267 #[doc = "Host negotiation success"]
4268 #[inline(always)]
4269 pub fn set_hngscs(&mut self, val: bool) {
4270 self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
4271 }
4272 #[doc = "HNP request"]
4273 #[inline(always)]
4274 pub const fn hnprq(&self) -> bool {
4275 let val = (self.0 >> 9usize) & 0x01;
4276 val != 0
4277 }
4278 #[doc = "HNP request"]
4279 #[inline(always)]
4280 pub fn set_hnprq(&mut self, val: bool) {
4281 self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize);
4282 }
4283 #[doc = "Host set HNP enable"]
4284 #[inline(always)]
4285 pub const fn hshnpen(&self) -> bool {
4286 let val = (self.0 >> 10usize) & 0x01;
4287 val != 0
4288 }
4289 #[doc = "Host set HNP enable"]
4290 #[inline(always)]
4291 pub fn set_hshnpen(&mut self, val: bool) {
4292 self.0 = (self.0 & !(0x01 << 10usize)) | (((val as u32) & 0x01) << 10usize);
4293 }
4294 #[doc = "Device HNP enabled"]
4295 #[inline(always)]
4296 pub const fn dhnpen(&self) -> bool {
4297 let val = (self.0 >> 11usize) & 0x01;
4298 val != 0
4299 }
4300 #[doc = "Device HNP enabled"]
4301 #[inline(always)]
4302 pub fn set_dhnpen(&mut self, val: bool) {
4303 self.0 = (self.0 & !(0x01 << 11usize)) | (((val as u32) & 0x01) << 11usize);
4304 }
4305 #[doc = "Embedded host enable"]
4306 #[inline(always)]
4307 pub const fn ehen(&self) -> bool {
4308 let val = (self.0 >> 12usize) & 0x01;
4309 val != 0
4310 }
4311 #[doc = "Embedded host enable"]
4312 #[inline(always)]
4313 pub fn set_ehen(&mut self, val: bool) {
4314 self.0 = (self.0 & !(0x01 << 12usize)) | (((val as u32) & 0x01) << 12usize);
4315 }
4316 #[doc = "Connector ID status"]
4317 #[inline(always)]
4318 pub const fn cidsts(&self) -> bool {
4319 let val = (self.0 >> 16usize) & 0x01;
4320 val != 0
4321 }
4322 #[doc = "Connector ID status"]
4323 #[inline(always)]
4324 pub fn set_cidsts(&mut self, val: bool) {
4325 self.0 = (self.0 & !(0x01 << 16usize)) | (((val as u32) & 0x01) << 16usize);
4326 }
4327 #[doc = "Long/short debounce time"]
4328 #[inline(always)]
4329 pub const fn dbct(&self) -> bool {
4330 let val = (self.0 >> 17usize) & 0x01;
4331 val != 0
4332 }
4333 #[doc = "Long/short debounce time"]
4334 #[inline(always)]
4335 pub fn set_dbct(&mut self, val: bool) {
4336 self.0 = (self.0 & !(0x01 << 17usize)) | (((val as u32) & 0x01) << 17usize);
4337 }
4338 #[doc = "A-session valid"]
4339 #[inline(always)]
4340 pub const fn asvld(&self) -> bool {
4341 let val = (self.0 >> 18usize) & 0x01;
4342 val != 0
4343 }
4344 #[doc = "A-session valid"]
4345 #[inline(always)]
4346 pub fn set_asvld(&mut self, val: bool) {
4347 self.0 = (self.0 & !(0x01 << 18usize)) | (((val as u32) & 0x01) << 18usize);
4348 }
4349 #[doc = "B-session valid"]
4350 #[inline(always)]
4351 pub const fn bsvld(&self) -> bool {
4352 let val = (self.0 >> 19usize) & 0x01;
4353 val != 0
4354 }
4355 #[doc = "B-session valid"]
4356 #[inline(always)]
4357 pub fn set_bsvld(&mut self, val: bool) {
4358 self.0 = (self.0 & !(0x01 << 19usize)) | (((val as u32) & 0x01) << 19usize);
4359 }
4360 }
4361 impl Default for Gotgctl {
4362 #[inline(always)]
4363 fn default() -> Gotgctl {
4364 Gotgctl(0)
4365 }
4366 }
4367 impl core::fmt::Debug for Gotgctl {
4368 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
4369 f.debug_struct("Gotgctl")
4370 .field("srqscs", &self.srqscs())
4371 .field("srq", &self.srq())
4372 .field("vbvaloen", &self.vbvaloen())
4373 .field("vbvaloval", &self.vbvaloval())
4374 .field("avaloen", &self.avaloen())
4375 .field("avaloval", &self.avaloval())
4376 .field("bvaloen", &self.bvaloen())
4377 .field("bvaloval", &self.bvaloval())
4378 .field("hngscs", &self.hngscs())
4379 .field("hnprq", &self.hnprq())
4380 .field("hshnpen", &self.hshnpen())
4381 .field("dhnpen", &self.dhnpen())
4382 .field("ehen", &self.ehen())
4383 .field("cidsts", &self.cidsts())
4384 .field("dbct", &self.dbct())
4385 .field("asvld", &self.asvld())
4386 .field("bsvld", &self.bsvld())
4387 .finish()
4388 }
4389 }
4390 #[cfg(feature = "defmt")]
4391 impl defmt::Format for Gotgctl {
4392 fn format(&self, f: defmt::Formatter) {
4393 #[derive(defmt :: Format)]
4394 struct Gotgctl {
4395 srqscs: bool,
4396 srq: bool,
4397 vbvaloen: bool,
4398 vbvaloval: bool,
4399 avaloen: bool,
4400 avaloval: bool,
4401 bvaloen: bool,
4402 bvaloval: bool,
4403 hngscs: bool,
4404 hnprq: bool,
4405 hshnpen: bool,
4406 dhnpen: bool,
4407 ehen: bool,
4408 cidsts: bool,
4409 dbct: bool,
4410 asvld: bool,
4411 bsvld: bool,
4412 }
4413 let proxy = Gotgctl {
4414 srqscs: self.srqscs(),
4415 srq: self.srq(),
4416 vbvaloen: self.vbvaloen(),
4417 vbvaloval: self.vbvaloval(),
4418 avaloen: self.avaloen(),
4419 avaloval: self.avaloval(),
4420 bvaloen: self.bvaloen(),
4421 bvaloval: self.bvaloval(),
4422 hngscs: self.hngscs(),
4423 hnprq: self.hnprq(),
4424 hshnpen: self.hshnpen(),
4425 dhnpen: self.dhnpen(),
4426 ehen: self.ehen(),
4427 cidsts: self.cidsts(),
4428 dbct: self.dbct(),
4429 asvld: self.asvld(),
4430 bsvld: self.bsvld(),
4431 };
4432 defmt::write!(f, "{}", proxy)
4433 }
4434 }
4435 #[doc = "Interrupt register"]
4436 #[repr(transparent)]
4437 #[derive(Copy, Clone, Eq, PartialEq)]
4438 pub struct Gotgint(pub u32);
4439 impl Gotgint {
4440 #[doc = "Session end detected"]
4441 #[inline(always)]
4442 pub const fn sedet(&self) -> bool {
4443 let val = (self.0 >> 2usize) & 0x01;
4444 val != 0
4445 }
4446 #[doc = "Session end detected"]
4447 #[inline(always)]
4448 pub fn set_sedet(&mut self, val: bool) {
4449 self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
4450 }
4451 #[doc = "Session request success status change"]
4452 #[inline(always)]
4453 pub const fn srsschg(&self) -> bool {
4454 let val = (self.0 >> 8usize) & 0x01;
4455 val != 0
4456 }
4457 #[doc = "Session request success status change"]
4458 #[inline(always)]
4459 pub fn set_srsschg(&mut self, val: bool) {
4460 self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
4461 }
4462 #[doc = "Host negotiation success status change"]
4463 #[inline(always)]
4464 pub const fn hnsschg(&self) -> bool {
4465 let val = (self.0 >> 9usize) & 0x01;
4466 val != 0
4467 }
4468 #[doc = "Host negotiation success status change"]
4469 #[inline(always)]
4470 pub fn set_hnsschg(&mut self, val: bool) {
4471 self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize);
4472 }
4473 #[doc = "Host negotiation detected"]
4474 #[inline(always)]
4475 pub const fn hngdet(&self) -> bool {
4476 let val = (self.0 >> 17usize) & 0x01;
4477 val != 0
4478 }
4479 #[doc = "Host negotiation detected"]
4480 #[inline(always)]
4481 pub fn set_hngdet(&mut self, val: bool) {
4482 self.0 = (self.0 & !(0x01 << 17usize)) | (((val as u32) & 0x01) << 17usize);
4483 }
4484 #[doc = "A-device timeout change"]
4485 #[inline(always)]
4486 pub const fn adtochg(&self) -> bool {
4487 let val = (self.0 >> 18usize) & 0x01;
4488 val != 0
4489 }
4490 #[doc = "A-device timeout change"]
4491 #[inline(always)]
4492 pub fn set_adtochg(&mut self, val: bool) {
4493 self.0 = (self.0 & !(0x01 << 18usize)) | (((val as u32) & 0x01) << 18usize);
4494 }
4495 #[doc = "Debounce done"]
4496 #[inline(always)]
4497 pub const fn dbcdne(&self) -> bool {
4498 let val = (self.0 >> 19usize) & 0x01;
4499 val != 0
4500 }
4501 #[doc = "Debounce done"]
4502 #[inline(always)]
4503 pub fn set_dbcdne(&mut self, val: bool) {
4504 self.0 = (self.0 & !(0x01 << 19usize)) | (((val as u32) & 0x01) << 19usize);
4505 }
4506 #[doc = "ID input pin changed"]
4507 #[inline(always)]
4508 pub const fn idchng(&self) -> bool {
4509 let val = (self.0 >> 20usize) & 0x01;
4510 val != 0
4511 }
4512 #[doc = "ID input pin changed"]
4513 #[inline(always)]
4514 pub fn set_idchng(&mut self, val: bool) {
4515 self.0 = (self.0 & !(0x01 << 20usize)) | (((val as u32) & 0x01) << 20usize);
4516 }
4517 }
4518 impl Default for Gotgint {
4519 #[inline(always)]
4520 fn default() -> Gotgint {
4521 Gotgint(0)
4522 }
4523 }
4524 impl core::fmt::Debug for Gotgint {
4525 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
4526 f.debug_struct("Gotgint")
4527 .field("sedet", &self.sedet())
4528 .field("srsschg", &self.srsschg())
4529 .field("hnsschg", &self.hnsschg())
4530 .field("hngdet", &self.hngdet())
4531 .field("adtochg", &self.adtochg())
4532 .field("dbcdne", &self.dbcdne())
4533 .field("idchng", &self.idchng())
4534 .finish()
4535 }
4536 }
4537 #[cfg(feature = "defmt")]
4538 impl defmt::Format for Gotgint {
4539 fn format(&self, f: defmt::Formatter) {
4540 #[derive(defmt :: Format)]
4541 struct Gotgint {
4542 sedet: bool,
4543 srsschg: bool,
4544 hnsschg: bool,
4545 hngdet: bool,
4546 adtochg: bool,
4547 dbcdne: bool,
4548 idchng: bool,
4549 }
4550 let proxy = Gotgint {
4551 sedet: self.sedet(),
4552 srsschg: self.srsschg(),
4553 hnsschg: self.hnsschg(),
4554 hngdet: self.hngdet(),
4555 adtochg: self.adtochg(),
4556 dbcdne: self.dbcdne(),
4557 idchng: self.idchng(),
4558 };
4559 defmt::write!(f, "{}", proxy)
4560 }
4561 }
4562 #[doc = "Reset register"]
4563 #[repr(transparent)]
4564 #[derive(Copy, Clone, Eq, PartialEq)]
4565 pub struct Grstctl(pub u32);
4566 impl Grstctl {
4567 #[doc = "Core soft reset"]
4568 #[inline(always)]
4569 pub const fn csrst(&self) -> bool {
4570 let val = (self.0 >> 0usize) & 0x01;
4571 val != 0
4572 }
4573 #[doc = "Core soft reset"]
4574 #[inline(always)]
4575 pub fn set_csrst(&mut self, val: bool) {
4576 self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
4577 }
4578 #[doc = "HCLK soft reset"]
4579 #[inline(always)]
4580 pub const fn hsrst(&self) -> bool {
4581 let val = (self.0 >> 1usize) & 0x01;
4582 val != 0
4583 }
4584 #[doc = "HCLK soft reset"]
4585 #[inline(always)]
4586 pub fn set_hsrst(&mut self, val: bool) {
4587 self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
4588 }
4589 #[doc = "Host frame counter reset"]
4590 #[inline(always)]
4591 pub const fn fcrst(&self) -> bool {
4592 let val = (self.0 >> 2usize) & 0x01;
4593 val != 0
4594 }
4595 #[doc = "Host frame counter reset"]
4596 #[inline(always)]
4597 pub fn set_fcrst(&mut self, val: bool) {
4598 self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
4599 }
4600 #[doc = "RxFIFO flush"]
4601 #[inline(always)]
4602 pub const fn rxfflsh(&self) -> bool {
4603 let val = (self.0 >> 4usize) & 0x01;
4604 val != 0
4605 }
4606 #[doc = "RxFIFO flush"]
4607 #[inline(always)]
4608 pub fn set_rxfflsh(&mut self, val: bool) {
4609 self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
4610 }
4611 #[doc = "TxFIFO flush"]
4612 #[inline(always)]
4613 pub const fn txfflsh(&self) -> bool {
4614 let val = (self.0 >> 5usize) & 0x01;
4615 val != 0
4616 }
4617 #[doc = "TxFIFO flush"]
4618 #[inline(always)]
4619 pub fn set_txfflsh(&mut self, val: bool) {
4620 self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
4621 }
4622 #[doc = "TxFIFO number"]
4623 #[inline(always)]
4624 pub const fn txfnum(&self) -> u8 {
4625 let val = (self.0 >> 6usize) & 0x1f;
4626 val as u8
4627 }
4628 #[doc = "TxFIFO number"]
4629 #[inline(always)]
4630 pub fn set_txfnum(&mut self, val: u8) {
4631 self.0 = (self.0 & !(0x1f << 6usize)) | (((val as u32) & 0x1f) << 6usize);
4632 }
4633 #[doc = "DMA request signal enabled for USB OTG HS"]
4634 #[inline(always)]
4635 pub const fn dmareq(&self) -> bool {
4636 let val = (self.0 >> 30usize) & 0x01;
4637 val != 0
4638 }
4639 #[doc = "DMA request signal enabled for USB OTG HS"]
4640 #[inline(always)]
4641 pub fn set_dmareq(&mut self, val: bool) {
4642 self.0 = (self.0 & !(0x01 << 30usize)) | (((val as u32) & 0x01) << 30usize);
4643 }
4644 #[doc = "AHB master idle"]
4645 #[inline(always)]
4646 pub const fn ahbidl(&self) -> bool {
4647 let val = (self.0 >> 31usize) & 0x01;
4648 val != 0
4649 }
4650 #[doc = "AHB master idle"]
4651 #[inline(always)]
4652 pub fn set_ahbidl(&mut self, val: bool) {
4653 self.0 = (self.0 & !(0x01 << 31usize)) | (((val as u32) & 0x01) << 31usize);
4654 }
4655 }
4656 impl Default for Grstctl {
4657 #[inline(always)]
4658 fn default() -> Grstctl {
4659 Grstctl(0)
4660 }
4661 }
4662 impl core::fmt::Debug for Grstctl {
4663 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
4664 f.debug_struct("Grstctl")
4665 .field("csrst", &self.csrst())
4666 .field("hsrst", &self.hsrst())
4667 .field("fcrst", &self.fcrst())
4668 .field("rxfflsh", &self.rxfflsh())
4669 .field("txfflsh", &self.txfflsh())
4670 .field("txfnum", &self.txfnum())
4671 .field("dmareq", &self.dmareq())
4672 .field("ahbidl", &self.ahbidl())
4673 .finish()
4674 }
4675 }
4676 #[cfg(feature = "defmt")]
4677 impl defmt::Format for Grstctl {
4678 fn format(&self, f: defmt::Formatter) {
4679 #[derive(defmt :: Format)]
4680 struct Grstctl {
4681 csrst: bool,
4682 hsrst: bool,
4683 fcrst: bool,
4684 rxfflsh: bool,
4685 txfflsh: bool,
4686 txfnum: u8,
4687 dmareq: bool,
4688 ahbidl: bool,
4689 }
4690 let proxy = Grstctl {
4691 csrst: self.csrst(),
4692 hsrst: self.hsrst(),
4693 fcrst: self.fcrst(),
4694 rxfflsh: self.rxfflsh(),
4695 txfflsh: self.txfflsh(),
4696 txfnum: self.txfnum(),
4697 dmareq: self.dmareq(),
4698 ahbidl: self.ahbidl(),
4699 };
4700 defmt::write!(f, "{}", proxy)
4701 }
4702 }
4703 #[doc = "Receive FIFO size register"]
4704 #[repr(transparent)]
4705 #[derive(Copy, Clone, Eq, PartialEq)]
4706 pub struct Grxfsiz(pub u32);
4707 impl Grxfsiz {
4708 #[doc = "RxFIFO depth"]
4709 #[inline(always)]
4710 pub const fn rxfd(&self) -> u16 {
4711 let val = (self.0 >> 0usize) & 0xffff;
4712 val as u16
4713 }
4714 #[doc = "RxFIFO depth"]
4715 #[inline(always)]
4716 pub fn set_rxfd(&mut self, val: u16) {
4717 self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
4718 }
4719 }
4720 impl Default for Grxfsiz {
4721 #[inline(always)]
4722 fn default() -> Grxfsiz {
4723 Grxfsiz(0)
4724 }
4725 }
4726 impl core::fmt::Debug for Grxfsiz {
4727 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
4728 f.debug_struct("Grxfsiz").field("rxfd", &self.rxfd()).finish()
4729 }
4730 }
4731 #[cfg(feature = "defmt")]
4732 impl defmt::Format for Grxfsiz {
4733 fn format(&self, f: defmt::Formatter) {
4734 #[derive(defmt :: Format)]
4735 struct Grxfsiz {
4736 rxfd: u16,
4737 }
4738 let proxy = Grxfsiz { rxfd: self.rxfd() };
4739 defmt::write!(f, "{}", proxy)
4740 }
4741 }
4742 #[doc = "Status read and pop register"]
4743 #[repr(transparent)]
4744 #[derive(Copy, Clone, Eq, PartialEq)]
4745 pub struct Grxsts(pub u32);
4746 impl Grxsts {
4747 #[doc = "Endpoint number (device mode) / Channel number (host mode)"]
4748 #[inline(always)]
4749 pub const fn epnum(&self) -> u8 {
4750 let val = (self.0 >> 0usize) & 0x0f;
4751 val as u8
4752 }
4753 #[doc = "Endpoint number (device mode) / Channel number (host mode)"]
4754 #[inline(always)]
4755 pub fn set_epnum(&mut self, val: u8) {
4756 self.0 = (self.0 & !(0x0f << 0usize)) | (((val as u32) & 0x0f) << 0usize);
4757 }
4758 #[doc = "Byte count"]
4759 #[inline(always)]
4760 pub const fn bcnt(&self) -> u16 {
4761 let val = (self.0 >> 4usize) & 0x07ff;
4762 val as u16
4763 }
4764 #[doc = "Byte count"]
4765 #[inline(always)]
4766 pub fn set_bcnt(&mut self, val: u16) {
4767 self.0 = (self.0 & !(0x07ff << 4usize)) | (((val as u32) & 0x07ff) << 4usize);
4768 }
4769 #[doc = "Data PID"]
4770 #[inline(always)]
4771 pub const fn dpid(&self) -> super::vals::Dpid {
4772 let val = (self.0 >> 15usize) & 0x03;
4773 super::vals::Dpid::from_bits(val as u8)
4774 }
4775 #[doc = "Data PID"]
4776 #[inline(always)]
4777 pub fn set_dpid(&mut self, val: super::vals::Dpid) {
4778 self.0 = (self.0 & !(0x03 << 15usize)) | (((val.to_bits() as u32) & 0x03) << 15usize);
4779 }
4780 #[doc = "Packet status (device mode)"]
4781 #[inline(always)]
4782 pub const fn pktstsd(&self) -> super::vals::Pktstsd {
4783 let val = (self.0 >> 17usize) & 0x0f;
4784 super::vals::Pktstsd::from_bits(val as u8)
4785 }
4786 #[doc = "Packet status (device mode)"]
4787 #[inline(always)]
4788 pub fn set_pktstsd(&mut self, val: super::vals::Pktstsd) {
4789 self.0 = (self.0 & !(0x0f << 17usize)) | (((val.to_bits() as u32) & 0x0f) << 17usize);
4790 }
4791 #[doc = "Packet status (host mode)"]
4792 #[inline(always)]
4793 pub const fn pktstsh(&self) -> super::vals::Pktstsh {
4794 let val = (self.0 >> 17usize) & 0x0f;
4795 super::vals::Pktstsh::from_bits(val as u8)
4796 }
4797 #[doc = "Packet status (host mode)"]
4798 #[inline(always)]
4799 pub fn set_pktstsh(&mut self, val: super::vals::Pktstsh) {
4800 self.0 = (self.0 & !(0x0f << 17usize)) | (((val.to_bits() as u32) & 0x0f) << 17usize);
4801 }
4802 #[doc = "Frame number (device mode)"]
4803 #[inline(always)]
4804 pub const fn frmnum(&self) -> u8 {
4805 let val = (self.0 >> 21usize) & 0x0f;
4806 val as u8
4807 }
4808 #[doc = "Frame number (device mode)"]
4809 #[inline(always)]
4810 pub fn set_frmnum(&mut self, val: u8) {
4811 self.0 = (self.0 & !(0x0f << 21usize)) | (((val as u32) & 0x0f) << 21usize);
4812 }
4813 }
4814 impl Default for Grxsts {
4815 #[inline(always)]
4816 fn default() -> Grxsts {
4817 Grxsts(0)
4818 }
4819 }
4820 impl core::fmt::Debug for Grxsts {
4821 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
4822 f.debug_struct("Grxsts")
4823 .field("epnum", &self.epnum())
4824 .field("bcnt", &self.bcnt())
4825 .field("dpid", &self.dpid())
4826 .field("pktstsd", &self.pktstsd())
4827 .field("pktstsh", &self.pktstsh())
4828 .field("frmnum", &self.frmnum())
4829 .finish()
4830 }
4831 }
4832 #[cfg(feature = "defmt")]
4833 impl defmt::Format for Grxsts {
4834 fn format(&self, f: defmt::Formatter) {
4835 #[derive(defmt :: Format)]
4836 struct Grxsts {
4837 epnum: u8,
4838 bcnt: u16,
4839 dpid: super::vals::Dpid,
4840 pktstsd: super::vals::Pktstsd,
4841 pktstsh: super::vals::Pktstsh,
4842 frmnum: u8,
4843 }
4844 let proxy = Grxsts {
4845 epnum: self.epnum(),
4846 bcnt: self.bcnt(),
4847 dpid: self.dpid(),
4848 pktstsd: self.pktstsd(),
4849 pktstsh: self.pktstsh(),
4850 frmnum: self.frmnum(),
4851 };
4852 defmt::write!(f, "{}", proxy)
4853 }
4854 }
4855 #[doc = "USB configuration register"]
4856 #[repr(transparent)]
4857 #[derive(Copy, Clone, Eq, PartialEq)]
4858 pub struct Gusbcfg(pub u32);
4859 impl Gusbcfg {
4860 #[doc = "FS timeout calibration"]
4861 #[inline(always)]
4862 pub const fn tocal(&self) -> u8 {
4863 let val = (self.0 >> 0usize) & 0x07;
4864 val as u8
4865 }
4866 #[doc = "FS timeout calibration"]
4867 #[inline(always)]
4868 pub fn set_tocal(&mut self, val: u8) {
4869 self.0 = (self.0 & !(0x07 << 0usize)) | (((val as u32) & 0x07) << 0usize);
4870 }
4871 #[doc = "Full-speed internal serial transceiver enable"]
4872 #[inline(always)]
4873 pub const fn physel(&self) -> bool {
4874 let val = (self.0 >> 6usize) & 0x01;
4875 val != 0
4876 }
4877 #[doc = "Full-speed internal serial transceiver enable"]
4878 #[inline(always)]
4879 pub fn set_physel(&mut self, val: bool) {
4880 self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
4881 }
4882 #[doc = "SRP-capable"]
4883 #[inline(always)]
4884 pub const fn srpcap(&self) -> bool {
4885 let val = (self.0 >> 8usize) & 0x01;
4886 val != 0
4887 }
4888 #[doc = "SRP-capable"]
4889 #[inline(always)]
4890 pub fn set_srpcap(&mut self, val: bool) {
4891 self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
4892 }
4893 #[doc = "HNP-capable"]
4894 #[inline(always)]
4895 pub const fn hnpcap(&self) -> bool {
4896 let val = (self.0 >> 9usize) & 0x01;
4897 val != 0
4898 }
4899 #[doc = "HNP-capable"]
4900 #[inline(always)]
4901 pub fn set_hnpcap(&mut self, val: bool) {
4902 self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize);
4903 }
4904 #[doc = "USB turnaround time"]
4905 #[inline(always)]
4906 pub const fn trdt(&self) -> u8 {
4907 let val = (self.0 >> 10usize) & 0x0f;
4908 val as u8
4909 }
4910 #[doc = "USB turnaround time"]
4911 #[inline(always)]
4912 pub fn set_trdt(&mut self, val: u8) {
4913 self.0 = (self.0 & !(0x0f << 10usize)) | (((val as u32) & 0x0f) << 10usize);
4914 }
4915 #[doc = "PHY Low-power clock select"]
4916 #[inline(always)]
4917 pub const fn phylpcs(&self) -> bool {
4918 let val = (self.0 >> 15usize) & 0x01;
4919 val != 0
4920 }
4921 #[doc = "PHY Low-power clock select"]
4922 #[inline(always)]
4923 pub fn set_phylpcs(&mut self, val: bool) {
4924 self.0 = (self.0 & !(0x01 << 15usize)) | (((val as u32) & 0x01) << 15usize);
4925 }
4926 #[doc = "ULPI FS/LS select"]
4927 #[inline(always)]
4928 pub const fn ulpifsls(&self) -> bool {
4929 let val = (self.0 >> 17usize) & 0x01;
4930 val != 0
4931 }
4932 #[doc = "ULPI FS/LS select"]
4933 #[inline(always)]
4934 pub fn set_ulpifsls(&mut self, val: bool) {
4935 self.0 = (self.0 & !(0x01 << 17usize)) | (((val as u32) & 0x01) << 17usize);
4936 }
4937 #[doc = "ULPI Auto-resume"]
4938 #[inline(always)]
4939 pub const fn ulpiar(&self) -> bool {
4940 let val = (self.0 >> 18usize) & 0x01;
4941 val != 0
4942 }
4943 #[doc = "ULPI Auto-resume"]
4944 #[inline(always)]
4945 pub fn set_ulpiar(&mut self, val: bool) {
4946 self.0 = (self.0 & !(0x01 << 18usize)) | (((val as u32) & 0x01) << 18usize);
4947 }
4948 #[doc = "ULPI Clock SuspendM"]
4949 #[inline(always)]
4950 pub const fn ulpicsm(&self) -> bool {
4951 let val = (self.0 >> 19usize) & 0x01;
4952 val != 0
4953 }
4954 #[doc = "ULPI Clock SuspendM"]
4955 #[inline(always)]
4956 pub fn set_ulpicsm(&mut self, val: bool) {
4957 self.0 = (self.0 & !(0x01 << 19usize)) | (((val as u32) & 0x01) << 19usize);
4958 }
4959 #[doc = "ULPI External VBUS Drive"]
4960 #[inline(always)]
4961 pub const fn ulpievbusd(&self) -> bool {
4962 let val = (self.0 >> 20usize) & 0x01;
4963 val != 0
4964 }
4965 #[doc = "ULPI External VBUS Drive"]
4966 #[inline(always)]
4967 pub fn set_ulpievbusd(&mut self, val: bool) {
4968 self.0 = (self.0 & !(0x01 << 20usize)) | (((val as u32) & 0x01) << 20usize);
4969 }
4970 #[doc = "ULPI external VBUS indicator"]
4971 #[inline(always)]
4972 pub const fn ulpievbusi(&self) -> bool {
4973 let val = (self.0 >> 21usize) & 0x01;
4974 val != 0
4975 }
4976 #[doc = "ULPI external VBUS indicator"]
4977 #[inline(always)]
4978 pub fn set_ulpievbusi(&mut self, val: bool) {
4979 self.0 = (self.0 & !(0x01 << 21usize)) | (((val as u32) & 0x01) << 21usize);
4980 }
4981 #[doc = "TermSel DLine pulsing selection"]
4982 #[inline(always)]
4983 pub const fn tsdps(&self) -> bool {
4984 let val = (self.0 >> 22usize) & 0x01;
4985 val != 0
4986 }
4987 #[doc = "TermSel DLine pulsing selection"]
4988 #[inline(always)]
4989 pub fn set_tsdps(&mut self, val: bool) {
4990 self.0 = (self.0 & !(0x01 << 22usize)) | (((val as u32) & 0x01) << 22usize);
4991 }
4992 #[doc = "Indicator complement"]
4993 #[inline(always)]
4994 pub const fn pcci(&self) -> bool {
4995 let val = (self.0 >> 23usize) & 0x01;
4996 val != 0
4997 }
4998 #[doc = "Indicator complement"]
4999 #[inline(always)]
5000 pub fn set_pcci(&mut self, val: bool) {
5001 self.0 = (self.0 & !(0x01 << 23usize)) | (((val as u32) & 0x01) << 23usize);
5002 }
5003 #[doc = "Indicator pass through"]
5004 #[inline(always)]
5005 pub const fn ptci(&self) -> bool {
5006 let val = (self.0 >> 24usize) & 0x01;
5007 val != 0
5008 }
5009 #[doc = "Indicator pass through"]
5010 #[inline(always)]
5011 pub fn set_ptci(&mut self, val: bool) {
5012 self.0 = (self.0 & !(0x01 << 24usize)) | (((val as u32) & 0x01) << 24usize);
5013 }
5014 #[doc = "ULPI interface protect disable"]
5015 #[inline(always)]
5016 pub const fn ulpiipd(&self) -> bool {
5017 let val = (self.0 >> 25usize) & 0x01;
5018 val != 0
5019 }
5020 #[doc = "ULPI interface protect disable"]
5021 #[inline(always)]
5022 pub fn set_ulpiipd(&mut self, val: bool) {
5023 self.0 = (self.0 & !(0x01 << 25usize)) | (((val as u32) & 0x01) << 25usize);
5024 }
5025 #[doc = "Force host mode"]
5026 #[inline(always)]
5027 pub const fn fhmod(&self) -> bool {
5028 let val = (self.0 >> 29usize) & 0x01;
5029 val != 0
5030 }
5031 #[doc = "Force host mode"]
5032 #[inline(always)]
5033 pub fn set_fhmod(&mut self, val: bool) {
5034 self.0 = (self.0 & !(0x01 << 29usize)) | (((val as u32) & 0x01) << 29usize);
5035 }
5036 #[doc = "Force device mode"]
5037 #[inline(always)]
5038 pub const fn fdmod(&self) -> bool {
5039 let val = (self.0 >> 30usize) & 0x01;
5040 val != 0
5041 }
5042 #[doc = "Force device mode"]
5043 #[inline(always)]
5044 pub fn set_fdmod(&mut self, val: bool) {
5045 self.0 = (self.0 & !(0x01 << 30usize)) | (((val as u32) & 0x01) << 30usize);
5046 }
5047 #[doc = "Corrupt Tx packet"]
5048 #[inline(always)]
5049 pub const fn ctxpkt(&self) -> bool {
5050 let val = (self.0 >> 31usize) & 0x01;
5051 val != 0
5052 }
5053 #[doc = "Corrupt Tx packet"]
5054 #[inline(always)]
5055 pub fn set_ctxpkt(&mut self, val: bool) {
5056 self.0 = (self.0 & !(0x01 << 31usize)) | (((val as u32) & 0x01) << 31usize);
5057 }
5058 }
5059 impl Default for Gusbcfg {
5060 #[inline(always)]
5061 fn default() -> Gusbcfg {
5062 Gusbcfg(0)
5063 }
5064 }
5065 impl core::fmt::Debug for Gusbcfg {
5066 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
5067 f.debug_struct("Gusbcfg")
5068 .field("tocal", &self.tocal())
5069 .field("physel", &self.physel())
5070 .field("srpcap", &self.srpcap())
5071 .field("hnpcap", &self.hnpcap())
5072 .field("trdt", &self.trdt())
5073 .field("phylpcs", &self.phylpcs())
5074 .field("ulpifsls", &self.ulpifsls())
5075 .field("ulpiar", &self.ulpiar())
5076 .field("ulpicsm", &self.ulpicsm())
5077 .field("ulpievbusd", &self.ulpievbusd())
5078 .field("ulpievbusi", &self.ulpievbusi())
5079 .field("tsdps", &self.tsdps())
5080 .field("pcci", &self.pcci())
5081 .field("ptci", &self.ptci())
5082 .field("ulpiipd", &self.ulpiipd())
5083 .field("fhmod", &self.fhmod())
5084 .field("fdmod", &self.fdmod())
5085 .field("ctxpkt", &self.ctxpkt())
5086 .finish()
5087 }
5088 }
5089 #[cfg(feature = "defmt")]
5090 impl defmt::Format for Gusbcfg {
5091 fn format(&self, f: defmt::Formatter) {
5092 #[derive(defmt :: Format)]
5093 struct Gusbcfg {
5094 tocal: u8,
5095 physel: bool,
5096 srpcap: bool,
5097 hnpcap: bool,
5098 trdt: u8,
5099 phylpcs: bool,
5100 ulpifsls: bool,
5101 ulpiar: bool,
5102 ulpicsm: bool,
5103 ulpievbusd: bool,
5104 ulpievbusi: bool,
5105 tsdps: bool,
5106 pcci: bool,
5107 ptci: bool,
5108 ulpiipd: bool,
5109 fhmod: bool,
5110 fdmod: bool,
5111 ctxpkt: bool,
5112 }
5113 let proxy = Gusbcfg {
5114 tocal: self.tocal(),
5115 physel: self.physel(),
5116 srpcap: self.srpcap(),
5117 hnpcap: self.hnpcap(),
5118 trdt: self.trdt(),
5119 phylpcs: self.phylpcs(),
5120 ulpifsls: self.ulpifsls(),
5121 ulpiar: self.ulpiar(),
5122 ulpicsm: self.ulpicsm(),
5123 ulpievbusd: self.ulpievbusd(),
5124 ulpievbusi: self.ulpievbusi(),
5125 tsdps: self.tsdps(),
5126 pcci: self.pcci(),
5127 ptci: self.ptci(),
5128 ulpiipd: self.ulpiipd(),
5129 fhmod: self.fhmod(),
5130 fdmod: self.fdmod(),
5131 ctxpkt: self.ctxpkt(),
5132 };
5133 defmt::write!(f, "{}", proxy)
5134 }
5135 }
5136 #[doc = "Host all channels interrupt register"]
5137 #[repr(transparent)]
5138 #[derive(Copy, Clone, Eq, PartialEq)]
5139 pub struct Haint(pub u32);
5140 impl Haint {
5141 #[doc = "Channel interrupts"]
5142 #[inline(always)]
5143 pub const fn haint(&self) -> u16 {
5144 let val = (self.0 >> 0usize) & 0xffff;
5145 val as u16
5146 }
5147 #[doc = "Channel interrupts"]
5148 #[inline(always)]
5149 pub fn set_haint(&mut self, val: u16) {
5150 self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
5151 }
5152 }
5153 impl Default for Haint {
5154 #[inline(always)]
5155 fn default() -> Haint {
5156 Haint(0)
5157 }
5158 }
5159 impl core::fmt::Debug for Haint {
5160 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
5161 f.debug_struct("Haint").field("haint", &self.haint()).finish()
5162 }
5163 }
5164 #[cfg(feature = "defmt")]
5165 impl defmt::Format for Haint {
5166 fn format(&self, f: defmt::Formatter) {
5167 #[derive(defmt :: Format)]
5168 struct Haint {
5169 haint: u16,
5170 }
5171 let proxy = Haint { haint: self.haint() };
5172 defmt::write!(f, "{}", proxy)
5173 }
5174 }
5175 #[doc = "Host all channels interrupt mask register"]
5176 #[repr(transparent)]
5177 #[derive(Copy, Clone, Eq, PartialEq)]
5178 pub struct Haintmsk(pub u32);
5179 impl Haintmsk {
5180 #[doc = "Channel interrupt mask"]
5181 #[inline(always)]
5182 pub const fn haintm(&self) -> u16 {
5183 let val = (self.0 >> 0usize) & 0xffff;
5184 val as u16
5185 }
5186 #[doc = "Channel interrupt mask"]
5187 #[inline(always)]
5188 pub fn set_haintm(&mut self, val: u16) {
5189 self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
5190 }
5191 }
5192 impl Default for Haintmsk {
5193 #[inline(always)]
5194 fn default() -> Haintmsk {
5195 Haintmsk(0)
5196 }
5197 }
5198 impl core::fmt::Debug for Haintmsk {
5199 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
5200 f.debug_struct("Haintmsk").field("haintm", &self.haintm()).finish()
5201 }
5202 }
5203 #[cfg(feature = "defmt")]
5204 impl defmt::Format for Haintmsk {
5205 fn format(&self, f: defmt::Formatter) {
5206 #[derive(defmt :: Format)]
5207 struct Haintmsk {
5208 haintm: u16,
5209 }
5210 let proxy = Haintmsk { haintm: self.haintm() };
5211 defmt::write!(f, "{}", proxy)
5212 }
5213 }
5214 #[doc = "Host channel characteristics register"]
5215 #[repr(transparent)]
5216 #[derive(Copy, Clone, Eq, PartialEq)]
5217 pub struct Hcchar(pub u32);
5218 impl Hcchar {
5219 #[doc = "Maximum packet size"]
5220 #[inline(always)]
5221 pub const fn mpsiz(&self) -> u16 {
5222 let val = (self.0 >> 0usize) & 0x07ff;
5223 val as u16
5224 }
5225 #[doc = "Maximum packet size"]
5226 #[inline(always)]
5227 pub fn set_mpsiz(&mut self, val: u16) {
5228 self.0 = (self.0 & !(0x07ff << 0usize)) | (((val as u32) & 0x07ff) << 0usize);
5229 }
5230 #[doc = "Endpoint number"]
5231 #[inline(always)]
5232 pub const fn epnum(&self) -> u8 {
5233 let val = (self.0 >> 11usize) & 0x0f;
5234 val as u8
5235 }
5236 #[doc = "Endpoint number"]
5237 #[inline(always)]
5238 pub fn set_epnum(&mut self, val: u8) {
5239 self.0 = (self.0 & !(0x0f << 11usize)) | (((val as u32) & 0x0f) << 11usize);
5240 }
5241 #[doc = "Endpoint direction"]
5242 #[inline(always)]
5243 pub const fn epdir(&self) -> bool {
5244 let val = (self.0 >> 15usize) & 0x01;
5245 val != 0
5246 }
5247 #[doc = "Endpoint direction"]
5248 #[inline(always)]
5249 pub fn set_epdir(&mut self, val: bool) {
5250 self.0 = (self.0 & !(0x01 << 15usize)) | (((val as u32) & 0x01) << 15usize);
5251 }
5252 #[doc = "Low-speed device"]
5253 #[inline(always)]
5254 pub const fn lsdev(&self) -> bool {
5255 let val = (self.0 >> 17usize) & 0x01;
5256 val != 0
5257 }
5258 #[doc = "Low-speed device"]
5259 #[inline(always)]
5260 pub fn set_lsdev(&mut self, val: bool) {
5261 self.0 = (self.0 & !(0x01 << 17usize)) | (((val as u32) & 0x01) << 17usize);
5262 }
5263 #[doc = "Endpoint type"]
5264 #[inline(always)]
5265 pub const fn eptyp(&self) -> super::vals::Eptyp {
5266 let val = (self.0 >> 18usize) & 0x03;
5267 super::vals::Eptyp::from_bits(val as u8)
5268 }
5269 #[doc = "Endpoint type"]
5270 #[inline(always)]
5271 pub fn set_eptyp(&mut self, val: super::vals::Eptyp) {
5272 self.0 = (self.0 & !(0x03 << 18usize)) | (((val.to_bits() as u32) & 0x03) << 18usize);
5273 }
5274 #[doc = "Multicount"]
5275 #[inline(always)]
5276 pub const fn mcnt(&self) -> u8 {
5277 let val = (self.0 >> 20usize) & 0x03;
5278 val as u8
5279 }
5280 #[doc = "Multicount"]
5281 #[inline(always)]
5282 pub fn set_mcnt(&mut self, val: u8) {
5283 self.0 = (self.0 & !(0x03 << 20usize)) | (((val as u32) & 0x03) << 20usize);
5284 }
5285 #[doc = "Device address"]
5286 #[inline(always)]
5287 pub const fn dad(&self) -> u8 {
5288 let val = (self.0 >> 22usize) & 0x7f;
5289 val as u8
5290 }
5291 #[doc = "Device address"]
5292 #[inline(always)]
5293 pub fn set_dad(&mut self, val: u8) {
5294 self.0 = (self.0 & !(0x7f << 22usize)) | (((val as u32) & 0x7f) << 22usize);
5295 }
5296 #[doc = "Odd frame (request iso/interrupt transaction to be performed on odd micro-frame)"]
5297 #[inline(always)]
5298 pub const fn oddfrm(&self) -> bool {
5299 let val = (self.0 >> 29usize) & 0x01;
5300 val != 0
5301 }
5302 #[doc = "Odd frame (request iso/interrupt transaction to be performed on odd micro-frame)"]
5303 #[inline(always)]
5304 pub fn set_oddfrm(&mut self, val: bool) {
5305 self.0 = (self.0 & !(0x01 << 29usize)) | (((val as u32) & 0x01) << 29usize);
5306 }
5307 #[doc = "Channel disable"]
5308 #[inline(always)]
5309 pub const fn chdis(&self) -> bool {
5310 let val = (self.0 >> 30usize) & 0x01;
5311 val != 0
5312 }
5313 #[doc = "Channel disable"]
5314 #[inline(always)]
5315 pub fn set_chdis(&mut self, val: bool) {
5316 self.0 = (self.0 & !(0x01 << 30usize)) | (((val as u32) & 0x01) << 30usize);
5317 }
5318 #[doc = "Channel enable"]
5319 #[inline(always)]
5320 pub const fn chena(&self) -> bool {
5321 let val = (self.0 >> 31usize) & 0x01;
5322 val != 0
5323 }
5324 #[doc = "Channel enable"]
5325 #[inline(always)]
5326 pub fn set_chena(&mut self, val: bool) {
5327 self.0 = (self.0 & !(0x01 << 31usize)) | (((val as u32) & 0x01) << 31usize);
5328 }
5329 }
5330 impl Default for Hcchar {
5331 #[inline(always)]
5332 fn default() -> Hcchar {
5333 Hcchar(0)
5334 }
5335 }
5336 impl core::fmt::Debug for Hcchar {
5337 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
5338 f.debug_struct("Hcchar")
5339 .field("mpsiz", &self.mpsiz())
5340 .field("epnum", &self.epnum())
5341 .field("epdir", &self.epdir())
5342 .field("lsdev", &self.lsdev())
5343 .field("eptyp", &self.eptyp())
5344 .field("mcnt", &self.mcnt())
5345 .field("dad", &self.dad())
5346 .field("oddfrm", &self.oddfrm())
5347 .field("chdis", &self.chdis())
5348 .field("chena", &self.chena())
5349 .finish()
5350 }
5351 }
5352 #[cfg(feature = "defmt")]
5353 impl defmt::Format for Hcchar {
5354 fn format(&self, f: defmt::Formatter) {
5355 #[derive(defmt :: Format)]
5356 struct Hcchar {
5357 mpsiz: u16,
5358 epnum: u8,
5359 epdir: bool,
5360 lsdev: bool,
5361 eptyp: super::vals::Eptyp,
5362 mcnt: u8,
5363 dad: u8,
5364 oddfrm: bool,
5365 chdis: bool,
5366 chena: bool,
5367 }
5368 let proxy = Hcchar {
5369 mpsiz: self.mpsiz(),
5370 epnum: self.epnum(),
5371 epdir: self.epdir(),
5372 lsdev: self.lsdev(),
5373 eptyp: self.eptyp(),
5374 mcnt: self.mcnt(),
5375 dad: self.dad(),
5376 oddfrm: self.oddfrm(),
5377 chdis: self.chdis(),
5378 chena: self.chena(),
5379 };
5380 defmt::write!(f, "{}", proxy)
5381 }
5382 }
5383 #[doc = "Host channel DMA config register"]
5384 #[repr(transparent)]
5385 #[derive(Copy, Clone, Eq, PartialEq)]
5386 pub struct Hcdma(pub u32);
5387 impl Hcdma {
5388 #[doc = "QTD list base address"]
5389 #[inline(always)]
5390 pub const fn qtdaddr(&self) -> u32 {
5391 let val = (self.0 >> 0usize) & 0xffff_ffff;
5392 val as u32
5393 }
5394 #[doc = "QTD list base address"]
5395 #[inline(always)]
5396 pub fn set_qtdaddr(&mut self, val: u32) {
5397 self.0 = (self.0 & !(0xffff_ffff << 0usize)) | (((val as u32) & 0xffff_ffff) << 0usize);
5398 }
5399 #[doc = "Current QTD (transfer descriptor) index"]
5400 #[inline(always)]
5401 pub const fn cqtd(&self) -> u8 {
5402 let val = (self.0 >> 3usize) & 0x3f;
5403 val as u8
5404 }
5405 #[doc = "Current QTD (transfer descriptor) index"]
5406 #[inline(always)]
5407 pub fn set_cqtd(&mut self, val: u8) {
5408 self.0 = (self.0 & !(0x3f << 3usize)) | (((val as u32) & 0x3f) << 3usize);
5409 }
5410 }
5411 impl Default for Hcdma {
5412 #[inline(always)]
5413 fn default() -> Hcdma {
5414 Hcdma(0)
5415 }
5416 }
5417 impl core::fmt::Debug for Hcdma {
5418 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
5419 f.debug_struct("Hcdma")
5420 .field("qtdaddr", &self.qtdaddr())
5421 .field("cqtd", &self.cqtd())
5422 .finish()
5423 }
5424 }
5425 #[cfg(feature = "defmt")]
5426 impl defmt::Format for Hcdma {
5427 fn format(&self, f: defmt::Formatter) {
5428 #[derive(defmt :: Format)]
5429 struct Hcdma {
5430 qtdaddr: u32,
5431 cqtd: u8,
5432 }
5433 let proxy = Hcdma {
5434 qtdaddr: self.qtdaddr(),
5435 cqtd: self.cqtd(),
5436 };
5437 defmt::write!(f, "{}", proxy)
5438 }
5439 }
5440 #[doc = "Host configuration register"]
5441 #[repr(transparent)]
5442 #[derive(Copy, Clone, Eq, PartialEq)]
5443 pub struct Hcfg(pub u32);
5444 impl Hcfg {
5445 #[doc = "FS/LS PHY clock select"]
5446 #[inline(always)]
5447 pub const fn fslspcs(&self) -> u8 {
5448 let val = (self.0 >> 0usize) & 0x03;
5449 val as u8
5450 }
5451 #[doc = "FS/LS PHY clock select"]
5452 #[inline(always)]
5453 pub fn set_fslspcs(&mut self, val: u8) {
5454 self.0 = (self.0 & !(0x03 << 0usize)) | (((val as u32) & 0x03) << 0usize);
5455 }
5456 #[doc = "FS- and LS-only support"]
5457 #[inline(always)]
5458 pub const fn fslss(&self) -> bool {
5459 let val = (self.0 >> 2usize) & 0x01;
5460 val != 0
5461 }
5462 #[doc = "FS- and LS-only support"]
5463 #[inline(always)]
5464 pub fn set_fslss(&mut self, val: bool) {
5465 self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
5466 }
5467 #[doc = "Descriptor DMA-mode enable (qtd)"]
5468 #[inline(always)]
5469 pub const fn descdma(&self) -> bool {
5470 let val = (self.0 >> 23usize) & 0x01;
5471 val != 0
5472 }
5473 #[doc = "Descriptor DMA-mode enable (qtd)"]
5474 #[inline(always)]
5475 pub fn set_descdma(&mut self, val: bool) {
5476 self.0 = (self.0 & !(0x01 << 23usize)) | (((val as u32) & 0x01) << 23usize);
5477 }
5478 #[doc = "Frame list length"]
5479 #[inline(always)]
5480 pub const fn frlistlen(&self) -> super::vals::Frlistlen {
5481 let val = (self.0 >> 24usize) & 0x03;
5482 super::vals::Frlistlen::from_bits(val as u8)
5483 }
5484 #[doc = "Frame list length"]
5485 #[inline(always)]
5486 pub fn set_frlistlen(&mut self, val: super::vals::Frlistlen) {
5487 self.0 = (self.0 & !(0x03 << 24usize)) | (((val.to_bits() as u32) & 0x03) << 24usize);
5488 }
5489 #[doc = "Period scheduling enable"]
5490 #[inline(always)]
5491 pub const fn perschedena(&self) -> bool {
5492 let val = (self.0 >> 26usize) & 0x01;
5493 val != 0
5494 }
5495 #[doc = "Period scheduling enable"]
5496 #[inline(always)]
5497 pub fn set_perschedena(&mut self, val: bool) {
5498 self.0 = (self.0 & !(0x01 << 26usize)) | (((val as u32) & 0x01) << 26usize);
5499 }
5500 }
5501 impl Default for Hcfg {
5502 #[inline(always)]
5503 fn default() -> Hcfg {
5504 Hcfg(0)
5505 }
5506 }
5507 impl core::fmt::Debug for Hcfg {
5508 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
5509 f.debug_struct("Hcfg")
5510 .field("fslspcs", &self.fslspcs())
5511 .field("fslss", &self.fslss())
5512 .field("descdma", &self.descdma())
5513 .field("frlistlen", &self.frlistlen())
5514 .field("perschedena", &self.perschedena())
5515 .finish()
5516 }
5517 }
5518 #[cfg(feature = "defmt")]
5519 impl defmt::Format for Hcfg {
5520 fn format(&self, f: defmt::Formatter) {
5521 #[derive(defmt :: Format)]
5522 struct Hcfg {
5523 fslspcs: u8,
5524 fslss: bool,
5525 descdma: bool,
5526 frlistlen: super::vals::Frlistlen,
5527 perschedena: bool,
5528 }
5529 let proxy = Hcfg {
5530 fslspcs: self.fslspcs(),
5531 fslss: self.fslss(),
5532 descdma: self.descdma(),
5533 frlistlen: self.frlistlen(),
5534 perschedena: self.perschedena(),
5535 };
5536 defmt::write!(f, "{}", proxy)
5537 }
5538 }
5539 #[doc = "Host channel interrupt register"]
5540 #[repr(transparent)]
5541 #[derive(Copy, Clone, Eq, PartialEq)]
5542 pub struct Hcint(pub u32);
5543 impl Hcint {
5544 #[doc = "Transfer completed"]
5545 #[inline(always)]
5546 pub const fn xfrc(&self) -> bool {
5547 let val = (self.0 >> 0usize) & 0x01;
5548 val != 0
5549 }
5550 #[doc = "Transfer completed"]
5551 #[inline(always)]
5552 pub fn set_xfrc(&mut self, val: bool) {
5553 self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
5554 }
5555 #[doc = "Channel halted"]
5556 #[inline(always)]
5557 pub const fn chh(&self) -> bool {
5558 let val = (self.0 >> 1usize) & 0x01;
5559 val != 0
5560 }
5561 #[doc = "Channel halted"]
5562 #[inline(always)]
5563 pub fn set_chh(&mut self, val: bool) {
5564 self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
5565 }
5566 #[doc = "STALL response received interrupt"]
5567 #[inline(always)]
5568 pub const fn stall(&self) -> bool {
5569 let val = (self.0 >> 3usize) & 0x01;
5570 val != 0
5571 }
5572 #[doc = "STALL response received interrupt"]
5573 #[inline(always)]
5574 pub fn set_stall(&mut self, val: bool) {
5575 self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
5576 }
5577 #[doc = "NAK response received interrupt"]
5578 #[inline(always)]
5579 pub const fn nak(&self) -> bool {
5580 let val = (self.0 >> 4usize) & 0x01;
5581 val != 0
5582 }
5583 #[doc = "NAK response received interrupt"]
5584 #[inline(always)]
5585 pub fn set_nak(&mut self, val: bool) {
5586 self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
5587 }
5588 #[doc = "ACK response received/transmitted interrupt"]
5589 #[inline(always)]
5590 pub const fn ack(&self) -> bool {
5591 let val = (self.0 >> 5usize) & 0x01;
5592 val != 0
5593 }
5594 #[doc = "ACK response received/transmitted interrupt"]
5595 #[inline(always)]
5596 pub fn set_ack(&mut self, val: bool) {
5597 self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
5598 }
5599 #[doc = "Transaction error"]
5600 #[inline(always)]
5601 pub const fn txerr(&self) -> bool {
5602 let val = (self.0 >> 7usize) & 0x01;
5603 val != 0
5604 }
5605 #[doc = "Transaction error"]
5606 #[inline(always)]
5607 pub fn set_txerr(&mut self, val: bool) {
5608 self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
5609 }
5610 #[doc = "Babble error"]
5611 #[inline(always)]
5612 pub const fn bberr(&self) -> bool {
5613 let val = (self.0 >> 8usize) & 0x01;
5614 val != 0
5615 }
5616 #[doc = "Babble error"]
5617 #[inline(always)]
5618 pub fn set_bberr(&mut self, val: bool) {
5619 self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
5620 }
5621 #[doc = "Frame overrun"]
5622 #[inline(always)]
5623 pub const fn frmor(&self) -> bool {
5624 let val = (self.0 >> 9usize) & 0x01;
5625 val != 0
5626 }
5627 #[doc = "Frame overrun"]
5628 #[inline(always)]
5629 pub fn set_frmor(&mut self, val: bool) {
5630 self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize);
5631 }
5632 #[doc = "Data toggle error"]
5633 #[inline(always)]
5634 pub const fn dterr(&self) -> bool {
5635 let val = (self.0 >> 10usize) & 0x01;
5636 val != 0
5637 }
5638 #[doc = "Data toggle error"]
5639 #[inline(always)]
5640 pub fn set_dterr(&mut self, val: bool) {
5641 self.0 = (self.0 & !(0x01 << 10usize)) | (((val as u32) & 0x01) << 10usize);
5642 }
5643 }
5644 impl Default for Hcint {
5645 #[inline(always)]
5646 fn default() -> Hcint {
5647 Hcint(0)
5648 }
5649 }
5650 impl core::fmt::Debug for Hcint {
5651 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
5652 f.debug_struct("Hcint")
5653 .field("xfrc", &self.xfrc())
5654 .field("chh", &self.chh())
5655 .field("stall", &self.stall())
5656 .field("nak", &self.nak())
5657 .field("ack", &self.ack())
5658 .field("txerr", &self.txerr())
5659 .field("bberr", &self.bberr())
5660 .field("frmor", &self.frmor())
5661 .field("dterr", &self.dterr())
5662 .finish()
5663 }
5664 }
5665 #[cfg(feature = "defmt")]
5666 impl defmt::Format for Hcint {
5667 fn format(&self, f: defmt::Formatter) {
5668 #[derive(defmt :: Format)]
5669 struct Hcint {
5670 xfrc: bool,
5671 chh: bool,
5672 stall: bool,
5673 nak: bool,
5674 ack: bool,
5675 txerr: bool,
5676 bberr: bool,
5677 frmor: bool,
5678 dterr: bool,
5679 }
5680 let proxy = Hcint {
5681 xfrc: self.xfrc(),
5682 chh: self.chh(),
5683 stall: self.stall(),
5684 nak: self.nak(),
5685 ack: self.ack(),
5686 txerr: self.txerr(),
5687 bberr: self.bberr(),
5688 frmor: self.frmor(),
5689 dterr: self.dterr(),
5690 };
5691 defmt::write!(f, "{}", proxy)
5692 }
5693 }
5694 #[doc = "Host channel mask register"]
5695 #[repr(transparent)]
5696 #[derive(Copy, Clone, Eq, PartialEq)]
5697 pub struct Hcintmsk(pub u32);
5698 impl Hcintmsk {
5699 #[doc = "Transfer completed mask"]
5700 #[inline(always)]
5701 pub const fn xfrcm(&self) -> bool {
5702 let val = (self.0 >> 0usize) & 0x01;
5703 val != 0
5704 }
5705 #[doc = "Transfer completed mask"]
5706 #[inline(always)]
5707 pub fn set_xfrcm(&mut self, val: bool) {
5708 self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
5709 }
5710 #[doc = "Channel halted mask"]
5711 #[inline(always)]
5712 pub const fn chhm(&self) -> bool {
5713 let val = (self.0 >> 1usize) & 0x01;
5714 val != 0
5715 }
5716 #[doc = "Channel halted mask"]
5717 #[inline(always)]
5718 pub fn set_chhm(&mut self, val: bool) {
5719 self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
5720 }
5721 #[doc = "STALL response received interrupt mask"]
5722 #[inline(always)]
5723 pub const fn stallm(&self) -> bool {
5724 let val = (self.0 >> 3usize) & 0x01;
5725 val != 0
5726 }
5727 #[doc = "STALL response received interrupt mask"]
5728 #[inline(always)]
5729 pub fn set_stallm(&mut self, val: bool) {
5730 self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
5731 }
5732 #[doc = "NAK response received interrupt mask"]
5733 #[inline(always)]
5734 pub const fn nakm(&self) -> bool {
5735 let val = (self.0 >> 4usize) & 0x01;
5736 val != 0
5737 }
5738 #[doc = "NAK response received interrupt mask"]
5739 #[inline(always)]
5740 pub fn set_nakm(&mut self, val: bool) {
5741 self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
5742 }
5743 #[doc = "ACK response received/transmitted interrupt mask"]
5744 #[inline(always)]
5745 pub const fn ackm(&self) -> bool {
5746 let val = (self.0 >> 5usize) & 0x01;
5747 val != 0
5748 }
5749 #[doc = "ACK response received/transmitted interrupt mask"]
5750 #[inline(always)]
5751 pub fn set_ackm(&mut self, val: bool) {
5752 self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
5753 }
5754 #[doc = "Response received interrupt mask"]
5755 #[inline(always)]
5756 pub const fn nyet(&self) -> bool {
5757 let val = (self.0 >> 6usize) & 0x01;
5758 val != 0
5759 }
5760 #[doc = "Response received interrupt mask"]
5761 #[inline(always)]
5762 pub fn set_nyet(&mut self, val: bool) {
5763 self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
5764 }
5765 #[doc = "Transaction error mask"]
5766 #[inline(always)]
5767 pub const fn txerrm(&self) -> bool {
5768 let val = (self.0 >> 7usize) & 0x01;
5769 val != 0
5770 }
5771 #[doc = "Transaction error mask"]
5772 #[inline(always)]
5773 pub fn set_txerrm(&mut self, val: bool) {
5774 self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
5775 }
5776 #[doc = "Babble error mask"]
5777 #[inline(always)]
5778 pub const fn bberrm(&self) -> bool {
5779 let val = (self.0 >> 8usize) & 0x01;
5780 val != 0
5781 }
5782 #[doc = "Babble error mask"]
5783 #[inline(always)]
5784 pub fn set_bberrm(&mut self, val: bool) {
5785 self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
5786 }
5787 #[doc = "Frame overrun mask"]
5788 #[inline(always)]
5789 pub const fn frmorm(&self) -> bool {
5790 let val = (self.0 >> 9usize) & 0x01;
5791 val != 0
5792 }
5793 #[doc = "Frame overrun mask"]
5794 #[inline(always)]
5795 pub fn set_frmorm(&mut self, val: bool) {
5796 self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize);
5797 }
5798 #[doc = "Data toggle error mask"]
5799 #[inline(always)]
5800 pub const fn dterrm(&self) -> bool {
5801 let val = (self.0 >> 10usize) & 0x01;
5802 val != 0
5803 }
5804 #[doc = "Data toggle error mask"]
5805 #[inline(always)]
5806 pub fn set_dterrm(&mut self, val: bool) {
5807 self.0 = (self.0 & !(0x01 << 10usize)) | (((val as u32) & 0x01) << 10usize);
5808 }
5809 }
5810 impl Default for Hcintmsk {
5811 #[inline(always)]
5812 fn default() -> Hcintmsk {
5813 Hcintmsk(0)
5814 }
5815 }
5816 impl core::fmt::Debug for Hcintmsk {
5817 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
5818 f.debug_struct("Hcintmsk")
5819 .field("xfrcm", &self.xfrcm())
5820 .field("chhm", &self.chhm())
5821 .field("stallm", &self.stallm())
5822 .field("nakm", &self.nakm())
5823 .field("ackm", &self.ackm())
5824 .field("nyet", &self.nyet())
5825 .field("txerrm", &self.txerrm())
5826 .field("bberrm", &self.bberrm())
5827 .field("frmorm", &self.frmorm())
5828 .field("dterrm", &self.dterrm())
5829 .finish()
5830 }
5831 }
5832 #[cfg(feature = "defmt")]
5833 impl defmt::Format for Hcintmsk {
5834 fn format(&self, f: defmt::Formatter) {
5835 #[derive(defmt :: Format)]
5836 struct Hcintmsk {
5837 xfrcm: bool,
5838 chhm: bool,
5839 stallm: bool,
5840 nakm: bool,
5841 ackm: bool,
5842 nyet: bool,
5843 txerrm: bool,
5844 bberrm: bool,
5845 frmorm: bool,
5846 dterrm: bool,
5847 }
5848 let proxy = Hcintmsk {
5849 xfrcm: self.xfrcm(),
5850 chhm: self.chhm(),
5851 stallm: self.stallm(),
5852 nakm: self.nakm(),
5853 ackm: self.ackm(),
5854 nyet: self.nyet(),
5855 txerrm: self.txerrm(),
5856 bberrm: self.bberrm(),
5857 frmorm: self.frmorm(),
5858 dterrm: self.dterrm(),
5859 };
5860 defmt::write!(f, "{}", proxy)
5861 }
5862 }
5863 #[doc = "Host channel transfer size register"]
5864 #[repr(transparent)]
5865 #[derive(Copy, Clone, Eq, PartialEq)]
5866 pub struct Hctsiz(pub u32);
5867 impl Hctsiz {
5868 #[doc = "Schedule info for isochronuous & interrupt pipes (xfrsiz\\[7:0\\])"]
5869 #[inline(always)]
5870 pub const fn schedinfo(&self) -> u8 {
5871 let val = (self.0 >> 0usize) & 0xff;
5872 val as u8
5873 }
5874 #[doc = "Schedule info for isochronuous & interrupt pipes (xfrsiz\\[7:0\\])"]
5875 #[inline(always)]
5876 pub fn set_schedinfo(&mut self, val: u8) {
5877 self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
5878 }
5879 #[doc = "Transfer size for non-isochronuous/interrupt pipes"]
5880 #[inline(always)]
5881 pub const fn xfrsiz(&self) -> u32 {
5882 let val = (self.0 >> 0usize) & 0x0007_ffff;
5883 val as u32
5884 }
5885 #[doc = "Transfer size for non-isochronuous/interrupt pipes"]
5886 #[inline(always)]
5887 pub fn set_xfrsiz(&mut self, val: u32) {
5888 self.0 = (self.0 & !(0x0007_ffff << 0usize)) | (((val as u32) & 0x0007_ffff) << 0usize);
5889 }
5890 #[doc = "NTD descriptor list length for isochronuous & interrupt pipes (xfrsiz\\[15:8\\], note val+1 is actual length)"]
5891 #[inline(always)]
5892 pub const fn ntdl(&self) -> u8 {
5893 let val = (self.0 >> 8usize) & 0xff;
5894 val as u8
5895 }
5896 #[doc = "NTD descriptor list length for isochronuous & interrupt pipes (xfrsiz\\[15:8\\], note val+1 is actual length)"]
5897 #[inline(always)]
5898 pub fn set_ntdl(&mut self, val: u8) {
5899 self.0 = (self.0 & !(0xff << 8usize)) | (((val as u32) & 0xff) << 8usize);
5900 }
5901 #[doc = "Packet count"]
5902 #[inline(always)]
5903 pub const fn pktcnt(&self) -> u16 {
5904 let val = (self.0 >> 19usize) & 0x03ff;
5905 val as u16
5906 }
5907 #[doc = "Packet count"]
5908 #[inline(always)]
5909 pub fn set_pktcnt(&mut self, val: u16) {
5910 self.0 = (self.0 & !(0x03ff << 19usize)) | (((val as u32) & 0x03ff) << 19usize);
5911 }
5912 #[doc = "Data PID"]
5913 #[inline(always)]
5914 pub const fn dpid(&self) -> u8 {
5915 let val = (self.0 >> 29usize) & 0x03;
5916 val as u8
5917 }
5918 #[doc = "Data PID"]
5919 #[inline(always)]
5920 pub fn set_dpid(&mut self, val: u8) {
5921 self.0 = (self.0 & !(0x03 << 29usize)) | (((val as u32) & 0x03) << 29usize);
5922 }
5923 #[doc = "Do Ping"]
5924 #[inline(always)]
5925 pub const fn doping(&self) -> bool {
5926 let val = (self.0 >> 31usize) & 0x01;
5927 val != 0
5928 }
5929 #[doc = "Do Ping"]
5930 #[inline(always)]
5931 pub fn set_doping(&mut self, val: bool) {
5932 self.0 = (self.0 & !(0x01 << 31usize)) | (((val as u32) & 0x01) << 31usize);
5933 }
5934 }
5935 impl Default for Hctsiz {
5936 #[inline(always)]
5937 fn default() -> Hctsiz {
5938 Hctsiz(0)
5939 }
5940 }
5941 impl core::fmt::Debug for Hctsiz {
5942 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
5943 f.debug_struct("Hctsiz")
5944 .field("schedinfo", &self.schedinfo())
5945 .field("xfrsiz", &self.xfrsiz())
5946 .field("ntdl", &self.ntdl())
5947 .field("pktcnt", &self.pktcnt())
5948 .field("dpid", &self.dpid())
5949 .field("doping", &self.doping())
5950 .finish()
5951 }
5952 }
5953 #[cfg(feature = "defmt")]
5954 impl defmt::Format for Hctsiz {
5955 fn format(&self, f: defmt::Formatter) {
5956 #[derive(defmt :: Format)]
5957 struct Hctsiz {
5958 schedinfo: u8,
5959 xfrsiz: u32,
5960 ntdl: u8,
5961 pktcnt: u16,
5962 dpid: u8,
5963 doping: bool,
5964 }
5965 let proxy = Hctsiz {
5966 schedinfo: self.schedinfo(),
5967 xfrsiz: self.xfrsiz(),
5968 ntdl: self.ntdl(),
5969 pktcnt: self.pktcnt(),
5970 dpid: self.dpid(),
5971 doping: self.doping(),
5972 };
5973 defmt::write!(f, "{}", proxy)
5974 }
5975 }
5976 #[doc = "Host frame interval register"]
5977 #[repr(transparent)]
5978 #[derive(Copy, Clone, Eq, PartialEq)]
5979 pub struct Hfir(pub u32);
5980 impl Hfir {
5981 #[doc = "Frame interval"]
5982 #[inline(always)]
5983 pub const fn frivl(&self) -> u16 {
5984 let val = (self.0 >> 0usize) & 0xffff;
5985 val as u16
5986 }
5987 #[doc = "Frame interval"]
5988 #[inline(always)]
5989 pub fn set_frivl(&mut self, val: u16) {
5990 self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
5991 }
5992 #[doc = "Dynamic Loading Control"]
5993 #[inline(always)]
5994 pub const fn rldctrl(&self) -> bool {
5995 let val = (self.0 >> 16usize) & 0x01;
5996 val != 0
5997 }
5998 #[doc = "Dynamic Loading Control"]
5999 #[inline(always)]
6000 pub fn set_rldctrl(&mut self, val: bool) {
6001 self.0 = (self.0 & !(0x01 << 16usize)) | (((val as u32) & 0x01) << 16usize);
6002 }
6003 }
6004 impl Default for Hfir {
6005 #[inline(always)]
6006 fn default() -> Hfir {
6007 Hfir(0)
6008 }
6009 }
6010 impl core::fmt::Debug for Hfir {
6011 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
6012 f.debug_struct("Hfir")
6013 .field("frivl", &self.frivl())
6014 .field("rldctrl", &self.rldctrl())
6015 .finish()
6016 }
6017 }
6018 #[cfg(feature = "defmt")]
6019 impl defmt::Format for Hfir {
6020 fn format(&self, f: defmt::Formatter) {
6021 #[derive(defmt :: Format)]
6022 struct Hfir {
6023 frivl: u16,
6024 rldctrl: bool,
6025 }
6026 let proxy = Hfir {
6027 frivl: self.frivl(),
6028 rldctrl: self.rldctrl(),
6029 };
6030 defmt::write!(f, "{}", proxy)
6031 }
6032 }
6033 #[doc = "Host frame number/frame time remaining register"]
6034 #[repr(transparent)]
6035 #[derive(Copy, Clone, Eq, PartialEq)]
6036 pub struct Hfnum(pub u32);
6037 impl Hfnum {
6038 #[doc = "Frame number"]
6039 #[inline(always)]
6040 pub const fn frnum(&self) -> u16 {
6041 let val = (self.0 >> 0usize) & 0xffff;
6042 val as u16
6043 }
6044 #[doc = "Frame number"]
6045 #[inline(always)]
6046 pub fn set_frnum(&mut self, val: u16) {
6047 self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
6048 }
6049 #[doc = "Frame time remaining"]
6050 #[inline(always)]
6051 pub const fn ftrem(&self) -> u16 {
6052 let val = (self.0 >> 16usize) & 0xffff;
6053 val as u16
6054 }
6055 #[doc = "Frame time remaining"]
6056 #[inline(always)]
6057 pub fn set_ftrem(&mut self, val: u16) {
6058 self.0 = (self.0 & !(0xffff << 16usize)) | (((val as u32) & 0xffff) << 16usize);
6059 }
6060 }
6061 impl Default for Hfnum {
6062 #[inline(always)]
6063 fn default() -> Hfnum {
6064 Hfnum(0)
6065 }
6066 }
6067 impl core::fmt::Debug for Hfnum {
6068 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
6069 f.debug_struct("Hfnum")
6070 .field("frnum", &self.frnum())
6071 .field("ftrem", &self.ftrem())
6072 .finish()
6073 }
6074 }
6075 #[cfg(feature = "defmt")]
6076 impl defmt::Format for Hfnum {
6077 fn format(&self, f: defmt::Formatter) {
6078 #[derive(defmt :: Format)]
6079 struct Hfnum {
6080 frnum: u16,
6081 ftrem: u16,
6082 }
6083 let proxy = Hfnum {
6084 frnum: self.frnum(),
6085 ftrem: self.ftrem(),
6086 };
6087 defmt::write!(f, "{}", proxy)
6088 }
6089 }
6090 #[doc = "Non-periodic transmit FIFO/queue status register"]
6091 #[repr(transparent)]
6092 #[derive(Copy, Clone, Eq, PartialEq)]
6093 pub struct Hnptxsts(pub u32);
6094 impl Hnptxsts {
6095 #[doc = "Non-periodic TxFIFO space available"]
6096 #[inline(always)]
6097 pub const fn nptxfsav(&self) -> u16 {
6098 let val = (self.0 >> 0usize) & 0xffff;
6099 val as u16
6100 }
6101 #[doc = "Non-periodic TxFIFO space available"]
6102 #[inline(always)]
6103 pub fn set_nptxfsav(&mut self, val: u16) {
6104 self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
6105 }
6106 #[doc = "Non-periodic transmit request queue space available"]
6107 #[inline(always)]
6108 pub const fn nptqxsav(&self) -> u8 {
6109 let val = (self.0 >> 16usize) & 0xff;
6110 val as u8
6111 }
6112 #[doc = "Non-periodic transmit request queue space available"]
6113 #[inline(always)]
6114 pub fn set_nptqxsav(&mut self, val: u8) {
6115 self.0 = (self.0 & !(0xff << 16usize)) | (((val as u32) & 0xff) << 16usize);
6116 }
6117 #[doc = "Top of the non-periodic transmit request queue"]
6118 #[inline(always)]
6119 pub const fn nptxqtop(&self) -> u8 {
6120 let val = (self.0 >> 24usize) & 0x7f;
6121 val as u8
6122 }
6123 #[doc = "Top of the non-periodic transmit request queue"]
6124 #[inline(always)]
6125 pub fn set_nptxqtop(&mut self, val: u8) {
6126 self.0 = (self.0 & !(0x7f << 24usize)) | (((val as u32) & 0x7f) << 24usize);
6127 }
6128 }
6129 impl Default for Hnptxsts {
6130 #[inline(always)]
6131 fn default() -> Hnptxsts {
6132 Hnptxsts(0)
6133 }
6134 }
6135 impl core::fmt::Debug for Hnptxsts {
6136 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
6137 f.debug_struct("Hnptxsts")
6138 .field("nptxfsav", &self.nptxfsav())
6139 .field("nptqxsav", &self.nptqxsav())
6140 .field("nptxqtop", &self.nptxqtop())
6141 .finish()
6142 }
6143 }
6144 #[cfg(feature = "defmt")]
6145 impl defmt::Format for Hnptxsts {
6146 fn format(&self, f: defmt::Formatter) {
6147 #[derive(defmt :: Format)]
6148 struct Hnptxsts {
6149 nptxfsav: u16,
6150 nptqxsav: u8,
6151 nptxqtop: u8,
6152 }
6153 let proxy = Hnptxsts {
6154 nptxfsav: self.nptxfsav(),
6155 nptqxsav: self.nptqxsav(),
6156 nptxqtop: self.nptxqtop(),
6157 };
6158 defmt::write!(f, "{}", proxy)
6159 }
6160 }
6161 #[doc = "Host port control and status register"]
6162 #[repr(transparent)]
6163 #[derive(Copy, Clone, Eq, PartialEq)]
6164 pub struct Hprt(pub u32);
6165 impl Hprt {
6166 #[doc = "Port connect status"]
6167 #[inline(always)]
6168 pub const fn pcsts(&self) -> bool {
6169 let val = (self.0 >> 0usize) & 0x01;
6170 val != 0
6171 }
6172 #[doc = "Port connect status"]
6173 #[inline(always)]
6174 pub fn set_pcsts(&mut self, val: bool) {
6175 self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
6176 }
6177 #[doc = "Port connect detected"]
6178 #[inline(always)]
6179 pub const fn pcdet(&self) -> bool {
6180 let val = (self.0 >> 1usize) & 0x01;
6181 val != 0
6182 }
6183 #[doc = "Port connect detected"]
6184 #[inline(always)]
6185 pub fn set_pcdet(&mut self, val: bool) {
6186 self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
6187 }
6188 #[doc = "Port enable (W1C)"]
6189 #[inline(always)]
6190 pub const fn pena(&self) -> bool {
6191 let val = (self.0 >> 2usize) & 0x01;
6192 val != 0
6193 }
6194 #[doc = "Port enable (W1C)"]
6195 #[inline(always)]
6196 pub fn set_pena(&mut self, val: bool) {
6197 self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
6198 }
6199 #[doc = "Port enable/disable change"]
6200 #[inline(always)]
6201 pub const fn penchng(&self) -> bool {
6202 let val = (self.0 >> 3usize) & 0x01;
6203 val != 0
6204 }
6205 #[doc = "Port enable/disable change"]
6206 #[inline(always)]
6207 pub fn set_penchng(&mut self, val: bool) {
6208 self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
6209 }
6210 #[doc = "Port overcurrent active"]
6211 #[inline(always)]
6212 pub const fn poca(&self) -> bool {
6213 let val = (self.0 >> 4usize) & 0x01;
6214 val != 0
6215 }
6216 #[doc = "Port overcurrent active"]
6217 #[inline(always)]
6218 pub fn set_poca(&mut self, val: bool) {
6219 self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
6220 }
6221 #[doc = "Port overcurrent change"]
6222 #[inline(always)]
6223 pub const fn pocchng(&self) -> bool {
6224 let val = (self.0 >> 5usize) & 0x01;
6225 val != 0
6226 }
6227 #[doc = "Port overcurrent change"]
6228 #[inline(always)]
6229 pub fn set_pocchng(&mut self, val: bool) {
6230 self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
6231 }
6232 #[doc = "Port resume"]
6233 #[inline(always)]
6234 pub const fn pres(&self) -> bool {
6235 let val = (self.0 >> 6usize) & 0x01;
6236 val != 0
6237 }
6238 #[doc = "Port resume"]
6239 #[inline(always)]
6240 pub fn set_pres(&mut self, val: bool) {
6241 self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
6242 }
6243 #[doc = "Port suspend"]
6244 #[inline(always)]
6245 pub const fn psusp(&self) -> bool {
6246 let val = (self.0 >> 7usize) & 0x01;
6247 val != 0
6248 }
6249 #[doc = "Port suspend"]
6250 #[inline(always)]
6251 pub fn set_psusp(&mut self, val: bool) {
6252 self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
6253 }
6254 #[doc = "Port reset"]
6255 #[inline(always)]
6256 pub const fn prst(&self) -> bool {
6257 let val = (self.0 >> 8usize) & 0x01;
6258 val != 0
6259 }
6260 #[doc = "Port reset"]
6261 #[inline(always)]
6262 pub fn set_prst(&mut self, val: bool) {
6263 self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
6264 }
6265 #[doc = "Port line status"]
6266 #[inline(always)]
6267 pub const fn plsts(&self) -> u8 {
6268 let val = (self.0 >> 10usize) & 0x03;
6269 val as u8
6270 }
6271 #[doc = "Port line status"]
6272 #[inline(always)]
6273 pub fn set_plsts(&mut self, val: u8) {
6274 self.0 = (self.0 & !(0x03 << 10usize)) | (((val as u32) & 0x03) << 10usize);
6275 }
6276 #[doc = "Port power"]
6277 #[inline(always)]
6278 pub const fn ppwr(&self) -> bool {
6279 let val = (self.0 >> 12usize) & 0x01;
6280 val != 0
6281 }
6282 #[doc = "Port power"]
6283 #[inline(always)]
6284 pub fn set_ppwr(&mut self, val: bool) {
6285 self.0 = (self.0 & !(0x01 << 12usize)) | (((val as u32) & 0x01) << 12usize);
6286 }
6287 #[doc = "Port test control"]
6288 #[inline(always)]
6289 pub const fn ptctl(&self) -> u8 {
6290 let val = (self.0 >> 13usize) & 0x0f;
6291 val as u8
6292 }
6293 #[doc = "Port test control"]
6294 #[inline(always)]
6295 pub fn set_ptctl(&mut self, val: u8) {
6296 self.0 = (self.0 & !(0x0f << 13usize)) | (((val as u32) & 0x0f) << 13usize);
6297 }
6298 #[doc = "Port speed"]
6299 #[inline(always)]
6300 pub const fn pspd(&self) -> u8 {
6301 let val = (self.0 >> 17usize) & 0x03;
6302 val as u8
6303 }
6304 #[doc = "Port speed"]
6305 #[inline(always)]
6306 pub fn set_pspd(&mut self, val: u8) {
6307 self.0 = (self.0 & !(0x03 << 17usize)) | (((val as u32) & 0x03) << 17usize);
6308 }
6309 }
6310 impl Default for Hprt {
6311 #[inline(always)]
6312 fn default() -> Hprt {
6313 Hprt(0)
6314 }
6315 }
6316 impl core::fmt::Debug for Hprt {
6317 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
6318 f.debug_struct("Hprt")
6319 .field("pcsts", &self.pcsts())
6320 .field("pcdet", &self.pcdet())
6321 .field("pena", &self.pena())
6322 .field("penchng", &self.penchng())
6323 .field("poca", &self.poca())
6324 .field("pocchng", &self.pocchng())
6325 .field("pres", &self.pres())
6326 .field("psusp", &self.psusp())
6327 .field("prst", &self.prst())
6328 .field("plsts", &self.plsts())
6329 .field("ppwr", &self.ppwr())
6330 .field("ptctl", &self.ptctl())
6331 .field("pspd", &self.pspd())
6332 .finish()
6333 }
6334 }
6335 #[cfg(feature = "defmt")]
6336 impl defmt::Format for Hprt {
6337 fn format(&self, f: defmt::Formatter) {
6338 #[derive(defmt :: Format)]
6339 struct Hprt {
6340 pcsts: bool,
6341 pcdet: bool,
6342 pena: bool,
6343 penchng: bool,
6344 poca: bool,
6345 pocchng: bool,
6346 pres: bool,
6347 psusp: bool,
6348 prst: bool,
6349 plsts: u8,
6350 ppwr: bool,
6351 ptctl: u8,
6352 pspd: u8,
6353 }
6354 let proxy = Hprt {
6355 pcsts: self.pcsts(),
6356 pcdet: self.pcdet(),
6357 pena: self.pena(),
6358 penchng: self.penchng(),
6359 poca: self.poca(),
6360 pocchng: self.pocchng(),
6361 pres: self.pres(),
6362 psusp: self.psusp(),
6363 prst: self.prst(),
6364 plsts: self.plsts(),
6365 ppwr: self.ppwr(),
6366 ptctl: self.ptctl(),
6367 pspd: self.pspd(),
6368 };
6369 defmt::write!(f, "{}", proxy)
6370 }
6371 }
6372 #[doc = "Periodic transmit FIFO/queue status register"]
6373 #[repr(transparent)]
6374 #[derive(Copy, Clone, Eq, PartialEq)]
6375 pub struct Hptxsts(pub u32);
6376 impl Hptxsts {
6377 #[doc = "Periodic transmit data FIFO space available"]
6378 #[inline(always)]
6379 pub const fn ptxfsavl(&self) -> u16 {
6380 let val = (self.0 >> 0usize) & 0xffff;
6381 val as u16
6382 }
6383 #[doc = "Periodic transmit data FIFO space available"]
6384 #[inline(always)]
6385 pub fn set_ptxfsavl(&mut self, val: u16) {
6386 self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
6387 }
6388 #[doc = "Periodic transmit request queue space available"]
6389 #[inline(always)]
6390 pub const fn ptxqsav(&self) -> u8 {
6391 let val = (self.0 >> 16usize) & 0xff;
6392 val as u8
6393 }
6394 #[doc = "Periodic transmit request queue space available"]
6395 #[inline(always)]
6396 pub fn set_ptxqsav(&mut self, val: u8) {
6397 self.0 = (self.0 & !(0xff << 16usize)) | (((val as u32) & 0xff) << 16usize);
6398 }
6399 #[doc = "Top of the periodic transmit request queue"]
6400 #[inline(always)]
6401 pub const fn ptxqtop(&self) -> u8 {
6402 let val = (self.0 >> 24usize) & 0xff;
6403 val as u8
6404 }
6405 #[doc = "Top of the periodic transmit request queue"]
6406 #[inline(always)]
6407 pub fn set_ptxqtop(&mut self, val: u8) {
6408 self.0 = (self.0 & !(0xff << 24usize)) | (((val as u32) & 0xff) << 24usize);
6409 }
6410 }
6411 impl Default for Hptxsts {
6412 #[inline(always)]
6413 fn default() -> Hptxsts {
6414 Hptxsts(0)
6415 }
6416 }
6417 impl core::fmt::Debug for Hptxsts {
6418 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
6419 f.debug_struct("Hptxsts")
6420 .field("ptxfsavl", &self.ptxfsavl())
6421 .field("ptxqsav", &self.ptxqsav())
6422 .field("ptxqtop", &self.ptxqtop())
6423 .finish()
6424 }
6425 }
6426 #[cfg(feature = "defmt")]
6427 impl defmt::Format for Hptxsts {
6428 fn format(&self, f: defmt::Formatter) {
6429 #[derive(defmt :: Format)]
6430 struct Hptxsts {
6431 ptxfsavl: u16,
6432 ptxqsav: u8,
6433 ptxqtop: u8,
6434 }
6435 let proxy = Hptxsts {
6436 ptxfsavl: self.ptxfsavl(),
6437 ptxqsav: self.ptxqsav(),
6438 ptxqtop: self.ptxqtop(),
6439 };
6440 defmt::write!(f, "{}", proxy)
6441 }
6442 }
6443 #[doc = "Power and clock gating control register"]
6444 #[repr(transparent)]
6445 #[derive(Copy, Clone, Eq, PartialEq)]
6446 pub struct Pcgcctl(pub u32);
6447 impl Pcgcctl {
6448 #[doc = "Stop PHY clock"]
6449 #[inline(always)]
6450 pub const fn stppclk(&self) -> bool {
6451 let val = (self.0 >> 0usize) & 0x01;
6452 val != 0
6453 }
6454 #[doc = "Stop PHY clock"]
6455 #[inline(always)]
6456 pub fn set_stppclk(&mut self, val: bool) {
6457 self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
6458 }
6459 #[doc = "Gate HCLK"]
6460 #[inline(always)]
6461 pub const fn gatehclk(&self) -> bool {
6462 let val = (self.0 >> 1usize) & 0x01;
6463 val != 0
6464 }
6465 #[doc = "Gate HCLK"]
6466 #[inline(always)]
6467 pub fn set_gatehclk(&mut self, val: bool) {
6468 self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
6469 }
6470 #[doc = "PHY Suspended"]
6471 #[inline(always)]
6472 pub const fn physusp(&self) -> bool {
6473 let val = (self.0 >> 4usize) & 0x01;
6474 val != 0
6475 }
6476 #[doc = "PHY Suspended"]
6477 #[inline(always)]
6478 pub fn set_physusp(&mut self, val: bool) {
6479 self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
6480 }
6481 }
6482 impl Default for Pcgcctl {
6483 #[inline(always)]
6484 fn default() -> Pcgcctl {
6485 Pcgcctl(0)
6486 }
6487 }
6488 impl core::fmt::Debug for Pcgcctl {
6489 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
6490 f.debug_struct("Pcgcctl")
6491 .field("stppclk", &self.stppclk())
6492 .field("gatehclk", &self.gatehclk())
6493 .field("physusp", &self.physusp())
6494 .finish()
6495 }
6496 }
6497 #[cfg(feature = "defmt")]
6498 impl defmt::Format for Pcgcctl {
6499 fn format(&self, f: defmt::Formatter) {
6500 #[derive(defmt :: Format)]
6501 struct Pcgcctl {
6502 stppclk: bool,
6503 gatehclk: bool,
6504 physusp: bool,
6505 }
6506 let proxy = Pcgcctl {
6507 stppclk: self.stppclk(),
6508 gatehclk: self.gatehclk(),
6509 physusp: self.physusp(),
6510 };
6511 defmt::write!(f, "{}", proxy)
6512 }
6513 }
6514}
6515pub mod vals {
6516 #[repr(u8)]
6517 #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
6518 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
6519 pub enum Dpid {
6520 DATA0 = 0x0,
6521 DATA2 = 0x01,
6522 DATA1 = 0x02,
6523 MDATA = 0x03,
6524 }
6525 impl Dpid {
6526 #[inline(always)]
6527 pub const fn from_bits(val: u8) -> Dpid {
6528 unsafe { core::mem::transmute(val & 0x03) }
6529 }
6530 #[inline(always)]
6531 pub const fn to_bits(self) -> u8 {
6532 unsafe { core::mem::transmute(self) }
6533 }
6534 }
6535 impl From<u8> for Dpid {
6536 #[inline(always)]
6537 fn from(val: u8) -> Dpid {
6538 Dpid::from_bits(val)
6539 }
6540 }
6541 impl From<Dpid> for u8 {
6542 #[inline(always)]
6543 fn from(val: Dpid) -> u8 {
6544 Dpid::to_bits(val)
6545 }
6546 }
6547 #[repr(u8)]
6548 #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
6549 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
6550 pub enum Dspd {
6551 #[doc = "High speed"]
6552 HIGH_SPEED = 0x0,
6553 #[doc = "Full speed using external ULPI PHY"]
6554 FULL_SPEED_EXTERNAL = 0x01,
6555 _RESERVED_2 = 0x02,
6556 #[doc = "Full speed using internal embedded PHY"]
6557 FULL_SPEED_INTERNAL = 0x03,
6558 }
6559 impl Dspd {
6560 #[inline(always)]
6561 pub const fn from_bits(val: u8) -> Dspd {
6562 unsafe { core::mem::transmute(val & 0x03) }
6563 }
6564 #[inline(always)]
6565 pub const fn to_bits(self) -> u8 {
6566 unsafe { core::mem::transmute(self) }
6567 }
6568 }
6569 impl From<u8> for Dspd {
6570 #[inline(always)]
6571 fn from(val: u8) -> Dspd {
6572 Dspd::from_bits(val)
6573 }
6574 }
6575 impl From<Dspd> for u8 {
6576 #[inline(always)]
6577 fn from(val: Dspd) -> u8 {
6578 Dspd::to_bits(val)
6579 }
6580 }
6581 #[repr(u8)]
6582 #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
6583 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
6584 pub enum Eptyp {
6585 CONTROL = 0x0,
6586 ISOCHRONOUS = 0x01,
6587 BULK = 0x02,
6588 INTERRUPT = 0x03,
6589 }
6590 impl Eptyp {
6591 #[inline(always)]
6592 pub const fn from_bits(val: u8) -> Eptyp {
6593 unsafe { core::mem::transmute(val & 0x03) }
6594 }
6595 #[inline(always)]
6596 pub const fn to_bits(self) -> u8 {
6597 unsafe { core::mem::transmute(self) }
6598 }
6599 }
6600 impl From<u8> for Eptyp {
6601 #[inline(always)]
6602 fn from(val: u8) -> Eptyp {
6603 Eptyp::from_bits(val)
6604 }
6605 }
6606 impl From<Eptyp> for u8 {
6607 #[inline(always)]
6608 fn from(val: Eptyp) -> u8 {
6609 Eptyp::to_bits(val)
6610 }
6611 }
6612 #[repr(u8)]
6613 #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
6614 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
6615 pub enum Frlistlen {
6616 #[doc = "Length = 8"]
6617 LEN8 = 0x0,
6618 #[doc = "Length = 16"]
6619 LEN16 = 0x01,
6620 #[doc = "Length = 32"]
6621 LEN32 = 0x02,
6622 #[doc = "Length = 64"]
6623 LEN64 = 0x03,
6624 }
6625 impl Frlistlen {
6626 #[inline(always)]
6627 pub const fn from_bits(val: u8) -> Frlistlen {
6628 unsafe { core::mem::transmute(val & 0x03) }
6629 }
6630 #[inline(always)]
6631 pub const fn to_bits(self) -> u8 {
6632 unsafe { core::mem::transmute(self) }
6633 }
6634 }
6635 impl From<u8> for Frlistlen {
6636 #[inline(always)]
6637 fn from(val: u8) -> Frlistlen {
6638 Frlistlen::from_bits(val)
6639 }
6640 }
6641 impl From<Frlistlen> for u8 {
6642 #[inline(always)]
6643 fn from(val: Frlistlen) -> u8 {
6644 Frlistlen::to_bits(val)
6645 }
6646 }
6647 #[repr(u8)]
6648 #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
6649 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
6650 pub enum Pfivl {
6651 #[doc = "80% of the frame interval"]
6652 FRAME_INTERVAL_80 = 0x0,
6653 #[doc = "85% of the frame interval"]
6654 FRAME_INTERVAL_85 = 0x01,
6655 #[doc = "90% of the frame interval"]
6656 FRAME_INTERVAL_90 = 0x02,
6657 #[doc = "95% of the frame interval"]
6658 FRAME_INTERVAL_95 = 0x03,
6659 }
6660 impl Pfivl {
6661 #[inline(always)]
6662 pub const fn from_bits(val: u8) -> Pfivl {
6663 unsafe { core::mem::transmute(val & 0x03) }
6664 }
6665 #[inline(always)]
6666 pub const fn to_bits(self) -> u8 {
6667 unsafe { core::mem::transmute(self) }
6668 }
6669 }
6670 impl From<u8> for Pfivl {
6671 #[inline(always)]
6672 fn from(val: u8) -> Pfivl {
6673 Pfivl::from_bits(val)
6674 }
6675 }
6676 impl From<Pfivl> for u8 {
6677 #[inline(always)]
6678 fn from(val: Pfivl) -> u8 {
6679 Pfivl::to_bits(val)
6680 }
6681 }
6682 #[repr(u8)]
6683 #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
6684 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
6685 pub enum Pktstsd {
6686 _RESERVED_0 = 0x0,
6687 #[doc = "Global OUT NAK (triggers an interrupt)"]
6688 OUT_NAK = 0x01,
6689 #[doc = "OUT data packet received"]
6690 OUT_DATA_RX = 0x02,
6691 #[doc = "OUT transfer completed (triggers an interrupt)"]
6692 OUT_DATA_DONE = 0x03,
6693 #[doc = "SETUP transaction completed (triggers an interrupt)"]
6694 SETUP_DATA_DONE = 0x04,
6695 _RESERVED_5 = 0x05,
6696 #[doc = "SETUP data packet received"]
6697 SETUP_DATA_RX = 0x06,
6698 _RESERVED_7 = 0x07,
6699 _RESERVED_8 = 0x08,
6700 _RESERVED_9 = 0x09,
6701 _RESERVED_a = 0x0a,
6702 _RESERVED_b = 0x0b,
6703 _RESERVED_c = 0x0c,
6704 _RESERVED_d = 0x0d,
6705 _RESERVED_e = 0x0e,
6706 _RESERVED_f = 0x0f,
6707 }
6708 impl Pktstsd {
6709 #[inline(always)]
6710 pub const fn from_bits(val: u8) -> Pktstsd {
6711 unsafe { core::mem::transmute(val & 0x0f) }
6712 }
6713 #[inline(always)]
6714 pub const fn to_bits(self) -> u8 {
6715 unsafe { core::mem::transmute(self) }
6716 }
6717 }
6718 impl From<u8> for Pktstsd {
6719 #[inline(always)]
6720 fn from(val: u8) -> Pktstsd {
6721 Pktstsd::from_bits(val)
6722 }
6723 }
6724 impl From<Pktstsd> for u8 {
6725 #[inline(always)]
6726 fn from(val: Pktstsd) -> u8 {
6727 Pktstsd::to_bits(val)
6728 }
6729 }
6730 #[repr(u8)]
6731 #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
6732 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
6733 pub enum Pktstsh {
6734 _RESERVED_0 = 0x0,
6735 _RESERVED_1 = 0x01,
6736 #[doc = "IN data packet received"]
6737 IN_DATA_RX = 0x02,
6738 #[doc = "IN transfer completed (triggers an interrupt)"]
6739 IN_DATA_DONE = 0x03,
6740 _RESERVED_4 = 0x04,
6741 #[doc = "Data toggle error (triggers an interrupt)"]
6742 DATA_TOGGLE_ERR = 0x05,
6743 _RESERVED_6 = 0x06,
6744 #[doc = "Channel halted (triggers an interrupt)"]
6745 CHANNEL_HALTED = 0x07,
6746 _RESERVED_8 = 0x08,
6747 _RESERVED_9 = 0x09,
6748 _RESERVED_a = 0x0a,
6749 _RESERVED_b = 0x0b,
6750 _RESERVED_c = 0x0c,
6751 _RESERVED_d = 0x0d,
6752 _RESERVED_e = 0x0e,
6753 _RESERVED_f = 0x0f,
6754 }
6755 impl Pktstsh {
6756 #[inline(always)]
6757 pub const fn from_bits(val: u8) -> Pktstsh {
6758 unsafe { core::mem::transmute(val & 0x0f) }
6759 }
6760 #[inline(always)]
6761 pub const fn to_bits(self) -> u8 {
6762 unsafe { core::mem::transmute(self) }
6763 }
6764 }
6765 impl From<u8> for Pktstsh {
6766 #[inline(always)]
6767 fn from(val: u8) -> Pktstsh {
6768 Pktstsh::from_bits(val)
6769 }
6770 }
6771 impl From<Pktstsh> for u8 {
6772 #[inline(always)]
6773 fn from(val: Pktstsh) -> u8 {
6774 Pktstsh::to_bits(val)
6775 }
6776 }
6777}
6778