1 | //! Register definitions for Synopsys DesignWare USB OTG core |
2 | |
3 | #![allow (missing_docs)] |
4 | |
5 | use core::marker::PhantomData; |
6 | |
7 | #[derive (Copy, Clone, PartialEq, Eq)] |
8 | pub struct RW; |
9 | #[derive (Copy, Clone, PartialEq, Eq)] |
10 | pub struct R; |
11 | #[derive (Copy, Clone, PartialEq, Eq)] |
12 | pub struct W; |
13 | |
14 | mod sealed { |
15 | use super::*; |
16 | pub trait Access {} |
17 | impl Access for R {} |
18 | impl Access for W {} |
19 | impl Access for RW {} |
20 | } |
21 | |
22 | pub trait Access: sealed::Access + Copy {} |
23 | impl Access for R {} |
24 | impl Access for W {} |
25 | impl Access for RW {} |
26 | |
27 | pub trait Read: Access {} |
28 | impl Read for RW {} |
29 | impl Read for R {} |
30 | |
31 | pub trait Write: Access {} |
32 | impl Write for RW {} |
33 | impl Write for W {} |
34 | |
35 | #[derive (Copy, Clone, PartialEq, Eq)] |
36 | pub struct Reg<T: Copy, A: Access> { |
37 | ptr: *mut u8, |
38 | phantom: PhantomData<*mut (T, A)>, |
39 | } |
40 | unsafe impl<T: Copy, A: Access> Send for Reg<T, A> {} |
41 | unsafe impl<T: Copy, A: Access> Sync for Reg<T, A> {} |
42 | |
43 | impl<T: Copy, A: Access> Reg<T, A> { |
44 | #[allow (clippy::missing_safety_doc)] |
45 | #[inline (always)] |
46 | pub const unsafe fn from_ptr(ptr: *mut T) -> Self { |
47 | Self { |
48 | ptr: ptr as _, |
49 | phantom: PhantomData, |
50 | } |
51 | } |
52 | |
53 | #[inline (always)] |
54 | pub const fn as_ptr(&self) -> *mut T { |
55 | self.ptr as _ |
56 | } |
57 | } |
58 | |
59 | impl<T: Copy, A: Read> Reg<T, A> { |
60 | #[inline (always)] |
61 | pub fn read(&self) -> T { |
62 | unsafe { (self.ptr as *mut T).read_volatile() } |
63 | } |
64 | } |
65 | |
66 | impl<T: Copy, A: Write> Reg<T, A> { |
67 | #[inline (always)] |
68 | pub fn write_value(&self, val: T) { |
69 | unsafe { (self.ptr as *mut T).write_volatile(val) } |
70 | } |
71 | } |
72 | |
73 | impl<T: Default + Copy, A: Write> Reg<T, A> { |
74 | #[inline (always)] |
75 | pub fn write<R>(&self, f: impl FnOnce(&mut T) -> R) -> R { |
76 | let mut val: T = Default::default(); |
77 | let res: R = f(&mut val); |
78 | self.write_value(val); |
79 | res |
80 | } |
81 | } |
82 | |
83 | impl<T: Copy, A: Read + Write> Reg<T, A> { |
84 | #[inline (always)] |
85 | pub fn modify<R>(&self, f: impl FnOnce(&mut T) -> R) -> R { |
86 | let mut val: T = self.read(); |
87 | let res: R = f(&mut val); |
88 | self.write_value(val); |
89 | res |
90 | } |
91 | } |
92 | |
93 | #[doc = "USB on the go" ] |
94 | #[derive (Copy, Clone, Eq, PartialEq)] |
95 | pub struct Otg { |
96 | ptr: *mut u8, |
97 | } |
98 | unsafe impl Send for Otg {} |
99 | unsafe impl Sync for Otg {} |
100 | impl Otg { |
101 | #[inline (always)] |
102 | pub const unsafe fn from_ptr(ptr: *mut ()) -> Self { |
103 | Self { ptr: ptr as _ } |
104 | } |
105 | #[inline (always)] |
106 | pub const fn as_ptr(&self) -> *mut () { |
107 | self.ptr as _ |
108 | } |
109 | #[doc = "Control and status register" ] |
110 | #[inline (always)] |
111 | pub fn gotgctl(self) -> Reg<regs::Gotgctl, RW> { |
112 | unsafe { Reg::from_ptr(self.ptr.add(0x0usize) as _) } |
113 | } |
114 | #[doc = "Interrupt register" ] |
115 | #[inline (always)] |
116 | pub fn gotgint(self) -> Reg<regs::Gotgint, RW> { |
117 | unsafe { Reg::from_ptr(self.ptr.add(0x04usize) as _) } |
118 | } |
119 | #[doc = "AHB configuration register" ] |
120 | #[inline (always)] |
121 | pub fn gahbcfg(self) -> Reg<regs::Gahbcfg, RW> { |
122 | unsafe { Reg::from_ptr(self.ptr.add(0x08usize) as _) } |
123 | } |
124 | #[doc = "USB configuration register" ] |
125 | #[inline (always)] |
126 | pub fn gusbcfg(self) -> Reg<regs::Gusbcfg, RW> { |
127 | unsafe { Reg::from_ptr(self.ptr.add(0x0cusize) as _) } |
128 | } |
129 | #[doc = "Reset register" ] |
130 | #[inline (always)] |
131 | pub fn grstctl(self) -> Reg<regs::Grstctl, RW> { |
132 | unsafe { Reg::from_ptr(self.ptr.add(0x10usize) as _) } |
133 | } |
134 | #[doc = "Core interrupt register" ] |
135 | #[inline (always)] |
136 | pub fn gintsts(self) -> Reg<regs::Gintsts, RW> { |
137 | unsafe { Reg::from_ptr(self.ptr.add(0x14usize) as _) } |
138 | } |
139 | #[doc = "Interrupt mask register" ] |
140 | #[inline (always)] |
141 | pub fn gintmsk(self) -> Reg<regs::Gintmsk, RW> { |
142 | unsafe { Reg::from_ptr(self.ptr.add(0x18usize) as _) } |
143 | } |
144 | #[doc = "Receive status debug read register" ] |
145 | #[inline (always)] |
146 | pub fn grxstsr(self) -> Reg<regs::Grxsts, R> { |
147 | unsafe { Reg::from_ptr(self.ptr.add(0x1cusize) as _) } |
148 | } |
149 | #[doc = "Status read and pop register" ] |
150 | #[inline (always)] |
151 | pub fn grxstsp(self) -> Reg<regs::Grxsts, R> { |
152 | unsafe { Reg::from_ptr(self.ptr.add(0x20usize) as _) } |
153 | } |
154 | #[doc = "Receive FIFO size register" ] |
155 | #[inline (always)] |
156 | pub fn grxfsiz(self) -> Reg<regs::Grxfsiz, RW> { |
157 | unsafe { Reg::from_ptr(self.ptr.add(0x24usize) as _) } |
158 | } |
159 | #[doc = "Endpoint 0 transmit FIFO size register (device mode)" ] |
160 | #[inline (always)] |
161 | pub fn dieptxf0(self) -> Reg<regs::Fsiz, RW> { |
162 | unsafe { Reg::from_ptr(self.ptr.add(0x28usize) as _) } |
163 | } |
164 | #[doc = "Non-periodic transmit FIFO size register (host mode)" ] |
165 | #[inline (always)] |
166 | pub fn hnptxfsiz(self) -> Reg<regs::Fsiz, RW> { |
167 | unsafe { Reg::from_ptr(self.ptr.add(0x28usize) as _) } |
168 | } |
169 | #[doc = "Non-periodic transmit FIFO/queue status register (host mode)" ] |
170 | #[inline (always)] |
171 | pub fn hnptxsts(self) -> Reg<regs::Hnptxsts, R> { |
172 | unsafe { Reg::from_ptr(self.ptr.add(0x2cusize) as _) } |
173 | } |
174 | #[doc = "OTG I2C access register" ] |
175 | #[inline (always)] |
176 | pub fn gi2cctl(self) -> Reg<regs::Gi2cctl, RW> { |
177 | unsafe { Reg::from_ptr(self.ptr.add(0x30usize) as _) } |
178 | } |
179 | #[doc = "General core configuration register, for core_id 0x0000_1xxx" ] |
180 | #[inline (always)] |
181 | pub fn gccfg_v1(self) -> Reg<regs::GccfgV1, RW> { |
182 | unsafe { Reg::from_ptr(self.ptr.add(0x38usize) as _) } |
183 | } |
184 | #[doc = "General core configuration register, for core_id 0x0000_ \\[23 \\]xxx" ] |
185 | #[inline (always)] |
186 | pub fn gccfg_v2(self) -> Reg<regs::GccfgV2, RW> { |
187 | unsafe { Reg::from_ptr(self.ptr.add(0x38usize) as _) } |
188 | } |
189 | #[doc = "General core configuration register, for core_id 0x0000_5xxx" ] |
190 | #[inline (always)] |
191 | pub fn gccfg_v3(self) -> Reg<regs::GccfgV3, RW> { |
192 | unsafe { Reg::from_ptr(self.ptr.add(0x38usize) as _) } |
193 | } |
194 | #[doc = "Core ID register" ] |
195 | #[inline (always)] |
196 | pub fn cid(self) -> Reg<regs::Cid, RW> { |
197 | unsafe { Reg::from_ptr(self.ptr.add(0x3cusize) as _) } |
198 | } |
199 | #[doc = "OTG core LPM configuration register" ] |
200 | #[inline (always)] |
201 | pub fn glpmcfg(self) -> Reg<regs::Glpmcfg, RW> { |
202 | unsafe { Reg::from_ptr(self.ptr.add(0x54usize) as _) } |
203 | } |
204 | #[doc = "Host periodic transmit FIFO size register" ] |
205 | #[inline (always)] |
206 | pub fn hptxfsiz(self) -> Reg<regs::Fsiz, RW> { |
207 | unsafe { Reg::from_ptr(self.ptr.add(0x0100usize) as _) } |
208 | } |
209 | #[doc = "Device IN endpoint transmit FIFO size register" ] |
210 | #[inline (always)] |
211 | pub fn dieptxf(self, n: usize) -> Reg<regs::Fsiz, RW> { |
212 | assert!(n < 7usize); |
213 | unsafe { Reg::from_ptr(self.ptr.add(0x0104usize + n * 4usize) as _) } |
214 | } |
215 | #[doc = "Host configuration register" ] |
216 | #[inline (always)] |
217 | pub fn hcfg(self) -> Reg<regs::Hcfg, RW> { |
218 | unsafe { Reg::from_ptr(self.ptr.add(0x0400usize) as _) } |
219 | } |
220 | #[doc = "Host frame interval register" ] |
221 | #[inline (always)] |
222 | pub fn hfir(self) -> Reg<regs::Hfir, RW> { |
223 | unsafe { Reg::from_ptr(self.ptr.add(0x0404usize) as _) } |
224 | } |
225 | #[doc = "Host frame number/frame time remaining register" ] |
226 | #[inline (always)] |
227 | pub fn hfnum(self) -> Reg<regs::Hfnum, R> { |
228 | unsafe { Reg::from_ptr(self.ptr.add(0x0408usize) as _) } |
229 | } |
230 | #[doc = "Periodic transmit FIFO/queue status register" ] |
231 | #[inline (always)] |
232 | pub fn hptxsts(self) -> Reg<regs::Hptxsts, RW> { |
233 | unsafe { Reg::from_ptr(self.ptr.add(0x0410usize) as _) } |
234 | } |
235 | #[doc = "Host all channels interrupt register" ] |
236 | #[inline (always)] |
237 | pub fn haint(self) -> Reg<regs::Haint, R> { |
238 | unsafe { Reg::from_ptr(self.ptr.add(0x0414usize) as _) } |
239 | } |
240 | #[doc = "Host all channels interrupt mask register" ] |
241 | #[inline (always)] |
242 | pub fn haintmsk(self) -> Reg<regs::Haintmsk, RW> { |
243 | unsafe { Reg::from_ptr(self.ptr.add(0x0418usize) as _) } |
244 | } |
245 | #[doc = "Host port control and status register" ] |
246 | #[inline (always)] |
247 | pub fn hprt(self) -> Reg<regs::Hprt, RW> { |
248 | unsafe { Reg::from_ptr(self.ptr.add(0x0440usize) as _) } |
249 | } |
250 | #[doc = "Host channel characteristics register" ] |
251 | #[inline (always)] |
252 | pub fn hcchar(self, n: usize) -> Reg<regs::Hcchar, RW> { |
253 | assert!(n < 12usize); |
254 | unsafe { Reg::from_ptr(self.ptr.add(0x0500usize + n * 32usize) as _) } |
255 | } |
256 | #[doc = "Host channel split control register" ] |
257 | #[inline (always)] |
258 | pub fn hcsplt(self, n: usize) -> Reg<u32, RW> { |
259 | assert!(n < 12usize); |
260 | unsafe { Reg::from_ptr(self.ptr.add(0x0504usize + n * 32usize) as _) } |
261 | } |
262 | #[doc = "Host channel interrupt register" ] |
263 | #[inline (always)] |
264 | pub fn hcint(self, n: usize) -> Reg<regs::Hcint, RW> { |
265 | assert!(n < 12usize); |
266 | unsafe { Reg::from_ptr(self.ptr.add(0x0508usize + n * 32usize) as _) } |
267 | } |
268 | #[doc = "Host channel mask register" ] |
269 | #[inline (always)] |
270 | pub fn hcintmsk(self, n: usize) -> Reg<regs::Hcintmsk, RW> { |
271 | assert!(n < 12usize); |
272 | unsafe { Reg::from_ptr(self.ptr.add(0x050cusize + n * 32usize) as _) } |
273 | } |
274 | #[doc = "Host channel transfer size register" ] |
275 | #[inline (always)] |
276 | pub fn hctsiz(self, n: usize) -> Reg<regs::Hctsiz, RW> { |
277 | assert!(n < 12usize); |
278 | unsafe { Reg::from_ptr(self.ptr.add(0x0510usize + n * 32usize) as _) } |
279 | } |
280 | #[doc = "Host channel DMA address register" ] |
281 | #[inline (always)] |
282 | pub fn hcdma(self, n: usize) -> Reg<u32, RW> { |
283 | assert!(n < 12usize); |
284 | unsafe { Reg::from_ptr(self.ptr.add(0x0514usize + n * 32usize) as _) } |
285 | } |
286 | #[doc = "Device configuration register" ] |
287 | #[inline (always)] |
288 | pub fn dcfg(self) -> Reg<regs::Dcfg, RW> { |
289 | unsafe { Reg::from_ptr(self.ptr.add(0x0800usize) as _) } |
290 | } |
291 | #[doc = "Device control register" ] |
292 | #[inline (always)] |
293 | pub fn dctl(self) -> Reg<regs::Dctl, RW> { |
294 | unsafe { Reg::from_ptr(self.ptr.add(0x0804usize) as _) } |
295 | } |
296 | #[doc = "Device status register" ] |
297 | #[inline (always)] |
298 | pub fn dsts(self) -> Reg<regs::Dsts, R> { |
299 | unsafe { Reg::from_ptr(self.ptr.add(0x0808usize) as _) } |
300 | } |
301 | #[doc = "Device IN endpoint common interrupt mask register" ] |
302 | #[inline (always)] |
303 | pub fn diepmsk(self) -> Reg<regs::Diepmsk, RW> { |
304 | unsafe { Reg::from_ptr(self.ptr.add(0x0810usize) as _) } |
305 | } |
306 | #[doc = "Device OUT endpoint common interrupt mask register" ] |
307 | #[inline (always)] |
308 | pub fn doepmsk(self) -> Reg<regs::Doepmsk, RW> { |
309 | unsafe { Reg::from_ptr(self.ptr.add(0x0814usize) as _) } |
310 | } |
311 | #[doc = "Device all endpoints interrupt register" ] |
312 | #[inline (always)] |
313 | pub fn daint(self) -> Reg<regs::Daint, R> { |
314 | unsafe { Reg::from_ptr(self.ptr.add(0x0818usize) as _) } |
315 | } |
316 | #[doc = "All endpoints interrupt mask register" ] |
317 | #[inline (always)] |
318 | pub fn daintmsk(self) -> Reg<regs::Daintmsk, RW> { |
319 | unsafe { Reg::from_ptr(self.ptr.add(0x081cusize) as _) } |
320 | } |
321 | #[doc = "Device VBUS discharge time register" ] |
322 | #[inline (always)] |
323 | pub fn dvbusdis(self) -> Reg<regs::Dvbusdis, RW> { |
324 | unsafe { Reg::from_ptr(self.ptr.add(0x0828usize) as _) } |
325 | } |
326 | #[doc = "Device VBUS pulsing time register" ] |
327 | #[inline (always)] |
328 | pub fn dvbuspulse(self) -> Reg<regs::Dvbuspulse, RW> { |
329 | unsafe { Reg::from_ptr(self.ptr.add(0x082cusize) as _) } |
330 | } |
331 | #[doc = "Device IN endpoint FIFO empty interrupt mask register" ] |
332 | #[inline (always)] |
333 | pub fn diepempmsk(self) -> Reg<regs::Diepempmsk, RW> { |
334 | unsafe { Reg::from_ptr(self.ptr.add(0x0834usize) as _) } |
335 | } |
336 | #[doc = "Device IN endpoint control register" ] |
337 | #[inline (always)] |
338 | pub fn diepctl(self, n: usize) -> Reg<regs::Diepctl, RW> { |
339 | assert!(n < 16usize); |
340 | unsafe { Reg::from_ptr(self.ptr.add(0x0900usize + n * 32usize) as _) } |
341 | } |
342 | #[doc = "Device IN endpoint interrupt register" ] |
343 | #[inline (always)] |
344 | pub fn diepint(self, n: usize) -> Reg<regs::Diepint, RW> { |
345 | assert!(n < 16usize); |
346 | unsafe { Reg::from_ptr(self.ptr.add(0x0908usize + n * 32usize) as _) } |
347 | } |
348 | #[doc = "Device IN endpoint transfer size register" ] |
349 | #[inline (always)] |
350 | pub fn dieptsiz(self, n: usize) -> Reg<regs::Dieptsiz, RW> { |
351 | assert!(n < 16usize); |
352 | unsafe { Reg::from_ptr(self.ptr.add(0x0910usize + n * 32usize) as _) } |
353 | } |
354 | #[doc = "Device IN endpoint transmit FIFO status register" ] |
355 | #[inline (always)] |
356 | pub fn dtxfsts(self, n: usize) -> Reg<regs::Dtxfsts, R> { |
357 | assert!(n < 16usize); |
358 | unsafe { Reg::from_ptr(self.ptr.add(0x0918usize + n * 32usize) as _) } |
359 | } |
360 | #[doc = "Device OUT endpoint control register" ] |
361 | #[inline (always)] |
362 | pub fn doepctl(self, n: usize) -> Reg<regs::Doepctl, RW> { |
363 | assert!(n < 16usize); |
364 | unsafe { Reg::from_ptr(self.ptr.add(0x0b00usize + n * 32usize) as _) } |
365 | } |
366 | #[doc = "Device OUT endpoint interrupt register" ] |
367 | #[inline (always)] |
368 | pub fn doepint(self, n: usize) -> Reg<regs::Doepint, RW> { |
369 | assert!(n < 16usize); |
370 | unsafe { Reg::from_ptr(self.ptr.add(0x0b08usize + n * 32usize) as _) } |
371 | } |
372 | #[doc = "Device OUT endpoint transfer size register" ] |
373 | #[inline (always)] |
374 | pub fn doeptsiz(self, n: usize) -> Reg<regs::Doeptsiz, RW> { |
375 | assert!(n < 16usize); |
376 | unsafe { Reg::from_ptr(self.ptr.add(0x0b10usize + n * 32usize) as _) } |
377 | } |
378 | #[doc = "Device OUT/IN endpoint DMA address register" ] |
379 | #[inline (always)] |
380 | pub fn doepdma(self, n: usize) -> Reg<u32, RW> { |
381 | assert!(n < 16usize); |
382 | unsafe { Reg::from_ptr(self.ptr.add(0x0b14usize + n * 32usize) as _) } |
383 | } |
384 | #[doc = "Power and clock gating control register" ] |
385 | #[inline (always)] |
386 | pub fn pcgcctl(self) -> Reg<regs::Pcgcctl, RW> { |
387 | unsafe { Reg::from_ptr(self.ptr.add(0x0e00usize) as _) } |
388 | } |
389 | #[doc = "Device endpoint / host channel FIFO register" ] |
390 | #[inline (always)] |
391 | pub fn fifo(self, n: usize) -> Reg<regs::Fifo, RW> { |
392 | assert!(n < 16usize); |
393 | unsafe { Reg::from_ptr(self.ptr.add(0x1000usize + n * 4096usize) as _) } |
394 | } |
395 | } |
396 | pub mod regs { |
397 | #[doc = "Core ID register" ] |
398 | #[repr (transparent)] |
399 | #[derive (Copy, Clone, Eq, PartialEq)] |
400 | pub struct Cid(pub u32); |
401 | impl Cid { |
402 | #[doc = "Product ID field" ] |
403 | #[inline (always)] |
404 | pub const fn product_id(&self) -> u32 { |
405 | let val = (self.0 >> 0usize) & 0xffff_ffff; |
406 | val as u32 |
407 | } |
408 | #[doc = "Product ID field" ] |
409 | #[inline (always)] |
410 | pub fn set_product_id(&mut self, val: u32) { |
411 | self.0 = (self.0 & !(0xffff_ffff << 0usize)) | (((val as u32) & 0xffff_ffff) << 0usize); |
412 | } |
413 | } |
414 | impl Default for Cid { |
415 | #[inline (always)] |
416 | fn default() -> Cid { |
417 | Cid(0) |
418 | } |
419 | } |
420 | #[doc = "Device all endpoints interrupt register" ] |
421 | #[repr (transparent)] |
422 | #[derive (Copy, Clone, Eq, PartialEq)] |
423 | pub struct Daint(pub u32); |
424 | impl Daint { |
425 | #[doc = "IN endpoint interrupt bits" ] |
426 | #[inline (always)] |
427 | pub const fn iepint(&self) -> u16 { |
428 | let val = (self.0 >> 0usize) & 0xffff; |
429 | val as u16 |
430 | } |
431 | #[doc = "IN endpoint interrupt bits" ] |
432 | #[inline (always)] |
433 | pub fn set_iepint(&mut self, val: u16) { |
434 | self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize); |
435 | } |
436 | #[doc = "OUT endpoint interrupt bits" ] |
437 | #[inline (always)] |
438 | pub const fn oepint(&self) -> u16 { |
439 | let val = (self.0 >> 16usize) & 0xffff; |
440 | val as u16 |
441 | } |
442 | #[doc = "OUT endpoint interrupt bits" ] |
443 | #[inline (always)] |
444 | pub fn set_oepint(&mut self, val: u16) { |
445 | self.0 = (self.0 & !(0xffff << 16usize)) | (((val as u32) & 0xffff) << 16usize); |
446 | } |
447 | } |
448 | impl Default for Daint { |
449 | #[inline (always)] |
450 | fn default() -> Daint { |
451 | Daint(0) |
452 | } |
453 | } |
454 | #[doc = "All endpoints interrupt mask register" ] |
455 | #[repr (transparent)] |
456 | #[derive (Copy, Clone, Eq, PartialEq)] |
457 | pub struct Daintmsk(pub u32); |
458 | impl Daintmsk { |
459 | #[doc = "IN EP interrupt mask bits" ] |
460 | #[inline (always)] |
461 | pub const fn iepm(&self) -> u16 { |
462 | let val = (self.0 >> 0usize) & 0xffff; |
463 | val as u16 |
464 | } |
465 | #[doc = "IN EP interrupt mask bits" ] |
466 | #[inline (always)] |
467 | pub fn set_iepm(&mut self, val: u16) { |
468 | self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize); |
469 | } |
470 | #[doc = "OUT EP interrupt mask bits" ] |
471 | #[inline (always)] |
472 | pub const fn oepm(&self) -> u16 { |
473 | let val = (self.0 >> 16usize) & 0xffff; |
474 | val as u16 |
475 | } |
476 | #[doc = "OUT EP interrupt mask bits" ] |
477 | #[inline (always)] |
478 | pub fn set_oepm(&mut self, val: u16) { |
479 | self.0 = (self.0 & !(0xffff << 16usize)) | (((val as u32) & 0xffff) << 16usize); |
480 | } |
481 | } |
482 | impl Default for Daintmsk { |
483 | #[inline (always)] |
484 | fn default() -> Daintmsk { |
485 | Daintmsk(0) |
486 | } |
487 | } |
488 | #[doc = "Device configuration register" ] |
489 | #[repr (transparent)] |
490 | #[derive (Copy, Clone, Eq, PartialEq)] |
491 | pub struct Dcfg(pub u32); |
492 | impl Dcfg { |
493 | #[doc = "Device speed" ] |
494 | #[inline (always)] |
495 | pub const fn dspd(&self) -> super::vals::Dspd { |
496 | let val = (self.0 >> 0usize) & 0x03; |
497 | super::vals::Dspd::from_bits(val as u8) |
498 | } |
499 | #[doc = "Device speed" ] |
500 | #[inline (always)] |
501 | pub fn set_dspd(&mut self, val: super::vals::Dspd) { |
502 | self.0 = (self.0 & !(0x03 << 0usize)) | (((val.to_bits() as u32) & 0x03) << 0usize); |
503 | } |
504 | #[doc = "Non-zero-length status OUT handshake" ] |
505 | #[inline (always)] |
506 | pub const fn nzlsohsk(&self) -> bool { |
507 | let val = (self.0 >> 2usize) & 0x01; |
508 | val != 0 |
509 | } |
510 | #[doc = "Non-zero-length status OUT handshake" ] |
511 | #[inline (always)] |
512 | pub fn set_nzlsohsk(&mut self, val: bool) { |
513 | self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize); |
514 | } |
515 | #[doc = "Device address" ] |
516 | #[inline (always)] |
517 | pub const fn dad(&self) -> u8 { |
518 | let val = (self.0 >> 4usize) & 0x7f; |
519 | val as u8 |
520 | } |
521 | #[doc = "Device address" ] |
522 | #[inline (always)] |
523 | pub fn set_dad(&mut self, val: u8) { |
524 | self.0 = (self.0 & !(0x7f << 4usize)) | (((val as u32) & 0x7f) << 4usize); |
525 | } |
526 | #[doc = "Periodic frame interval" ] |
527 | #[inline (always)] |
528 | pub const fn pfivl(&self) -> super::vals::Pfivl { |
529 | let val = (self.0 >> 11usize) & 0x03; |
530 | super::vals::Pfivl::from_bits(val as u8) |
531 | } |
532 | #[doc = "Periodic frame interval" ] |
533 | #[inline (always)] |
534 | pub fn set_pfivl(&mut self, val: super::vals::Pfivl) { |
535 | self.0 = (self.0 & !(0x03 << 11usize)) | (((val.to_bits() as u32) & 0x03) << 11usize); |
536 | } |
537 | #[doc = "Transceiver delay" ] |
538 | #[inline (always)] |
539 | pub const fn xcvrdly(&self) -> bool { |
540 | let val = (self.0 >> 14usize) & 0x01; |
541 | val != 0 |
542 | } |
543 | #[doc = "Transceiver delay" ] |
544 | #[inline (always)] |
545 | pub fn set_xcvrdly(&mut self, val: bool) { |
546 | self.0 = (self.0 & !(0x01 << 14usize)) | (((val as u32) & 0x01) << 14usize); |
547 | } |
548 | } |
549 | impl Default for Dcfg { |
550 | #[inline (always)] |
551 | fn default() -> Dcfg { |
552 | Dcfg(0) |
553 | } |
554 | } |
555 | #[doc = "Device control register" ] |
556 | #[repr (transparent)] |
557 | #[derive (Copy, Clone, Eq, PartialEq)] |
558 | pub struct Dctl(pub u32); |
559 | impl Dctl { |
560 | #[doc = "Remote wakeup signaling" ] |
561 | #[inline (always)] |
562 | pub const fn rwusig(&self) -> bool { |
563 | let val = (self.0 >> 0usize) & 0x01; |
564 | val != 0 |
565 | } |
566 | #[doc = "Remote wakeup signaling" ] |
567 | #[inline (always)] |
568 | pub fn set_rwusig(&mut self, val: bool) { |
569 | self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize); |
570 | } |
571 | #[doc = "Soft disconnect" ] |
572 | #[inline (always)] |
573 | pub const fn sdis(&self) -> bool { |
574 | let val = (self.0 >> 1usize) & 0x01; |
575 | val != 0 |
576 | } |
577 | #[doc = "Soft disconnect" ] |
578 | #[inline (always)] |
579 | pub fn set_sdis(&mut self, val: bool) { |
580 | self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize); |
581 | } |
582 | #[doc = "Global IN NAK status" ] |
583 | #[inline (always)] |
584 | pub const fn ginsts(&self) -> bool { |
585 | let val = (self.0 >> 2usize) & 0x01; |
586 | val != 0 |
587 | } |
588 | #[doc = "Global IN NAK status" ] |
589 | #[inline (always)] |
590 | pub fn set_ginsts(&mut self, val: bool) { |
591 | self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize); |
592 | } |
593 | #[doc = "Global OUT NAK status" ] |
594 | #[inline (always)] |
595 | pub const fn gonsts(&self) -> bool { |
596 | let val = (self.0 >> 3usize) & 0x01; |
597 | val != 0 |
598 | } |
599 | #[doc = "Global OUT NAK status" ] |
600 | #[inline (always)] |
601 | pub fn set_gonsts(&mut self, val: bool) { |
602 | self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize); |
603 | } |
604 | #[doc = "Test control" ] |
605 | #[inline (always)] |
606 | pub const fn tctl(&self) -> u8 { |
607 | let val = (self.0 >> 4usize) & 0x07; |
608 | val as u8 |
609 | } |
610 | #[doc = "Test control" ] |
611 | #[inline (always)] |
612 | pub fn set_tctl(&mut self, val: u8) { |
613 | self.0 = (self.0 & !(0x07 << 4usize)) | (((val as u32) & 0x07) << 4usize); |
614 | } |
615 | #[doc = "Set global IN NAK" ] |
616 | #[inline (always)] |
617 | pub const fn sginak(&self) -> bool { |
618 | let val = (self.0 >> 7usize) & 0x01; |
619 | val != 0 |
620 | } |
621 | #[doc = "Set global IN NAK" ] |
622 | #[inline (always)] |
623 | pub fn set_sginak(&mut self, val: bool) { |
624 | self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize); |
625 | } |
626 | #[doc = "Clear global IN NAK" ] |
627 | #[inline (always)] |
628 | pub const fn cginak(&self) -> bool { |
629 | let val = (self.0 >> 8usize) & 0x01; |
630 | val != 0 |
631 | } |
632 | #[doc = "Clear global IN NAK" ] |
633 | #[inline (always)] |
634 | pub fn set_cginak(&mut self, val: bool) { |
635 | self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize); |
636 | } |
637 | #[doc = "Set global OUT NAK" ] |
638 | #[inline (always)] |
639 | pub const fn sgonak(&self) -> bool { |
640 | let val = (self.0 >> 9usize) & 0x01; |
641 | val != 0 |
642 | } |
643 | #[doc = "Set global OUT NAK" ] |
644 | #[inline (always)] |
645 | pub fn set_sgonak(&mut self, val: bool) { |
646 | self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize); |
647 | } |
648 | #[doc = "Clear global OUT NAK" ] |
649 | #[inline (always)] |
650 | pub const fn cgonak(&self) -> bool { |
651 | let val = (self.0 >> 10usize) & 0x01; |
652 | val != 0 |
653 | } |
654 | #[doc = "Clear global OUT NAK" ] |
655 | #[inline (always)] |
656 | pub fn set_cgonak(&mut self, val: bool) { |
657 | self.0 = (self.0 & !(0x01 << 10usize)) | (((val as u32) & 0x01) << 10usize); |
658 | } |
659 | #[doc = "Power-on programming done" ] |
660 | #[inline (always)] |
661 | pub const fn poprgdne(&self) -> bool { |
662 | let val = (self.0 >> 11usize) & 0x01; |
663 | val != 0 |
664 | } |
665 | #[doc = "Power-on programming done" ] |
666 | #[inline (always)] |
667 | pub fn set_poprgdne(&mut self, val: bool) { |
668 | self.0 = (self.0 & !(0x01 << 11usize)) | (((val as u32) & 0x01) << 11usize); |
669 | } |
670 | } |
671 | impl Default for Dctl { |
672 | #[inline (always)] |
673 | fn default() -> Dctl { |
674 | Dctl(0) |
675 | } |
676 | } |
677 | #[doc = "Device endpoint control register" ] |
678 | #[repr (transparent)] |
679 | #[derive (Copy, Clone, Eq, PartialEq)] |
680 | pub struct Diepctl(pub u32); |
681 | impl Diepctl { |
682 | #[doc = "MPSIZ" ] |
683 | #[inline (always)] |
684 | pub const fn mpsiz(&self) -> u16 { |
685 | let val = (self.0 >> 0usize) & 0x07ff; |
686 | val as u16 |
687 | } |
688 | #[doc = "MPSIZ" ] |
689 | #[inline (always)] |
690 | pub fn set_mpsiz(&mut self, val: u16) { |
691 | self.0 = (self.0 & !(0x07ff << 0usize)) | (((val as u32) & 0x07ff) << 0usize); |
692 | } |
693 | #[doc = "USBAEP" ] |
694 | #[inline (always)] |
695 | pub const fn usbaep(&self) -> bool { |
696 | let val = (self.0 >> 15usize) & 0x01; |
697 | val != 0 |
698 | } |
699 | #[doc = "USBAEP" ] |
700 | #[inline (always)] |
701 | pub fn set_usbaep(&mut self, val: bool) { |
702 | self.0 = (self.0 & !(0x01 << 15usize)) | (((val as u32) & 0x01) << 15usize); |
703 | } |
704 | #[doc = "EONUM/DPID" ] |
705 | #[inline (always)] |
706 | pub const fn eonum_dpid(&self) -> bool { |
707 | let val = (self.0 >> 16usize) & 0x01; |
708 | val != 0 |
709 | } |
710 | #[doc = "EONUM/DPID" ] |
711 | #[inline (always)] |
712 | pub fn set_eonum_dpid(&mut self, val: bool) { |
713 | self.0 = (self.0 & !(0x01 << 16usize)) | (((val as u32) & 0x01) << 16usize); |
714 | } |
715 | #[doc = "NAKSTS" ] |
716 | #[inline (always)] |
717 | pub const fn naksts(&self) -> bool { |
718 | let val = (self.0 >> 17usize) & 0x01; |
719 | val != 0 |
720 | } |
721 | #[doc = "NAKSTS" ] |
722 | #[inline (always)] |
723 | pub fn set_naksts(&mut self, val: bool) { |
724 | self.0 = (self.0 & !(0x01 << 17usize)) | (((val as u32) & 0x01) << 17usize); |
725 | } |
726 | #[doc = "EPTYP" ] |
727 | #[inline (always)] |
728 | pub const fn eptyp(&self) -> super::vals::Eptyp { |
729 | let val = (self.0 >> 18usize) & 0x03; |
730 | super::vals::Eptyp::from_bits(val as u8) |
731 | } |
732 | #[doc = "EPTYP" ] |
733 | #[inline (always)] |
734 | pub fn set_eptyp(&mut self, val: super::vals::Eptyp) { |
735 | self.0 = (self.0 & !(0x03 << 18usize)) | (((val.to_bits() as u32) & 0x03) << 18usize); |
736 | } |
737 | #[doc = "SNPM" ] |
738 | #[inline (always)] |
739 | pub const fn snpm(&self) -> bool { |
740 | let val = (self.0 >> 20usize) & 0x01; |
741 | val != 0 |
742 | } |
743 | #[doc = "SNPM" ] |
744 | #[inline (always)] |
745 | pub fn set_snpm(&mut self, val: bool) { |
746 | self.0 = (self.0 & !(0x01 << 20usize)) | (((val as u32) & 0x01) << 20usize); |
747 | } |
748 | #[doc = "STALL" ] |
749 | #[inline (always)] |
750 | pub const fn stall(&self) -> bool { |
751 | let val = (self.0 >> 21usize) & 0x01; |
752 | val != 0 |
753 | } |
754 | #[doc = "STALL" ] |
755 | #[inline (always)] |
756 | pub fn set_stall(&mut self, val: bool) { |
757 | self.0 = (self.0 & !(0x01 << 21usize)) | (((val as u32) & 0x01) << 21usize); |
758 | } |
759 | #[doc = "TXFNUM" ] |
760 | #[inline (always)] |
761 | pub const fn txfnum(&self) -> u8 { |
762 | let val = (self.0 >> 22usize) & 0x0f; |
763 | val as u8 |
764 | } |
765 | #[doc = "TXFNUM" ] |
766 | #[inline (always)] |
767 | pub fn set_txfnum(&mut self, val: u8) { |
768 | self.0 = (self.0 & !(0x0f << 22usize)) | (((val as u32) & 0x0f) << 22usize); |
769 | } |
770 | #[doc = "CNAK" ] |
771 | #[inline (always)] |
772 | pub const fn cnak(&self) -> bool { |
773 | let val = (self.0 >> 26usize) & 0x01; |
774 | val != 0 |
775 | } |
776 | #[doc = "CNAK" ] |
777 | #[inline (always)] |
778 | pub fn set_cnak(&mut self, val: bool) { |
779 | self.0 = (self.0 & !(0x01 << 26usize)) | (((val as u32) & 0x01) << 26usize); |
780 | } |
781 | #[doc = "SNAK" ] |
782 | #[inline (always)] |
783 | pub const fn snak(&self) -> bool { |
784 | let val = (self.0 >> 27usize) & 0x01; |
785 | val != 0 |
786 | } |
787 | #[doc = "SNAK" ] |
788 | #[inline (always)] |
789 | pub fn set_snak(&mut self, val: bool) { |
790 | self.0 = (self.0 & !(0x01 << 27usize)) | (((val as u32) & 0x01) << 27usize); |
791 | } |
792 | #[doc = "SD0PID/SEVNFRM" ] |
793 | #[inline (always)] |
794 | pub const fn sd0pid_sevnfrm(&self) -> bool { |
795 | let val = (self.0 >> 28usize) & 0x01; |
796 | val != 0 |
797 | } |
798 | #[doc = "SD0PID/SEVNFRM" ] |
799 | #[inline (always)] |
800 | pub fn set_sd0pid_sevnfrm(&mut self, val: bool) { |
801 | self.0 = (self.0 & !(0x01 << 28usize)) | (((val as u32) & 0x01) << 28usize); |
802 | } |
803 | #[doc = "SD1PID/SODDFRM" ] |
804 | #[inline (always)] |
805 | pub const fn sd1pid_soddfrm(&self) -> bool { |
806 | let val = (self.0 >> 29usize) & 0x01; |
807 | val != 0 |
808 | } |
809 | #[doc = "SD1PID/SODDFRM" ] |
810 | #[inline (always)] |
811 | pub fn set_sd1pid_soddfrm(&mut self, val: bool) { |
812 | self.0 = (self.0 & !(0x01 << 29usize)) | (((val as u32) & 0x01) << 29usize); |
813 | } |
814 | #[doc = "EPDIS" ] |
815 | #[inline (always)] |
816 | pub const fn epdis(&self) -> bool { |
817 | let val = (self.0 >> 30usize) & 0x01; |
818 | val != 0 |
819 | } |
820 | #[doc = "EPDIS" ] |
821 | #[inline (always)] |
822 | pub fn set_epdis(&mut self, val: bool) { |
823 | self.0 = (self.0 & !(0x01 << 30usize)) | (((val as u32) & 0x01) << 30usize); |
824 | } |
825 | #[doc = "EPENA" ] |
826 | #[inline (always)] |
827 | pub const fn epena(&self) -> bool { |
828 | let val = (self.0 >> 31usize) & 0x01; |
829 | val != 0 |
830 | } |
831 | #[doc = "EPENA" ] |
832 | #[inline (always)] |
833 | pub fn set_epena(&mut self, val: bool) { |
834 | self.0 = (self.0 & !(0x01 << 31usize)) | (((val as u32) & 0x01) << 31usize); |
835 | } |
836 | } |
837 | impl Default for Diepctl { |
838 | #[inline (always)] |
839 | fn default() -> Diepctl { |
840 | Diepctl(0) |
841 | } |
842 | } |
843 | #[doc = "Device IN endpoint FIFO empty interrupt mask register" ] |
844 | #[repr (transparent)] |
845 | #[derive (Copy, Clone, Eq, PartialEq)] |
846 | pub struct Diepempmsk(pub u32); |
847 | impl Diepempmsk { |
848 | #[doc = "IN EP Tx FIFO empty interrupt mask bits" ] |
849 | #[inline (always)] |
850 | pub const fn ineptxfem(&self) -> u16 { |
851 | let val = (self.0 >> 0usize) & 0xffff; |
852 | val as u16 |
853 | } |
854 | #[doc = "IN EP Tx FIFO empty interrupt mask bits" ] |
855 | #[inline (always)] |
856 | pub fn set_ineptxfem(&mut self, val: u16) { |
857 | self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize); |
858 | } |
859 | } |
860 | impl Default for Diepempmsk { |
861 | #[inline (always)] |
862 | fn default() -> Diepempmsk { |
863 | Diepempmsk(0) |
864 | } |
865 | } |
866 | #[doc = "Device endpoint interrupt register" ] |
867 | #[repr (transparent)] |
868 | #[derive (Copy, Clone, Eq, PartialEq)] |
869 | pub struct Diepint(pub u32); |
870 | impl Diepint { |
871 | #[doc = "XFRC" ] |
872 | #[inline (always)] |
873 | pub const fn xfrc(&self) -> bool { |
874 | let val = (self.0 >> 0usize) & 0x01; |
875 | val != 0 |
876 | } |
877 | #[doc = "XFRC" ] |
878 | #[inline (always)] |
879 | pub fn set_xfrc(&mut self, val: bool) { |
880 | self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize); |
881 | } |
882 | #[doc = "EPDISD" ] |
883 | #[inline (always)] |
884 | pub const fn epdisd(&self) -> bool { |
885 | let val = (self.0 >> 1usize) & 0x01; |
886 | val != 0 |
887 | } |
888 | #[doc = "EPDISD" ] |
889 | #[inline (always)] |
890 | pub fn set_epdisd(&mut self, val: bool) { |
891 | self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize); |
892 | } |
893 | #[doc = "TOC" ] |
894 | #[inline (always)] |
895 | pub const fn toc(&self) -> bool { |
896 | let val = (self.0 >> 3usize) & 0x01; |
897 | val != 0 |
898 | } |
899 | #[doc = "TOC" ] |
900 | #[inline (always)] |
901 | pub fn set_toc(&mut self, val: bool) { |
902 | self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize); |
903 | } |
904 | #[doc = "ITTXFE" ] |
905 | #[inline (always)] |
906 | pub const fn ittxfe(&self) -> bool { |
907 | let val = (self.0 >> 4usize) & 0x01; |
908 | val != 0 |
909 | } |
910 | #[doc = "ITTXFE" ] |
911 | #[inline (always)] |
912 | pub fn set_ittxfe(&mut self, val: bool) { |
913 | self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize); |
914 | } |
915 | #[doc = "INEPNE" ] |
916 | #[inline (always)] |
917 | pub const fn inepne(&self) -> bool { |
918 | let val = (self.0 >> 6usize) & 0x01; |
919 | val != 0 |
920 | } |
921 | #[doc = "INEPNE" ] |
922 | #[inline (always)] |
923 | pub fn set_inepne(&mut self, val: bool) { |
924 | self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize); |
925 | } |
926 | #[doc = "TXFE" ] |
927 | #[inline (always)] |
928 | pub const fn txfe(&self) -> bool { |
929 | let val = (self.0 >> 7usize) & 0x01; |
930 | val != 0 |
931 | } |
932 | #[doc = "TXFE" ] |
933 | #[inline (always)] |
934 | pub fn set_txfe(&mut self, val: bool) { |
935 | self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize); |
936 | } |
937 | } |
938 | impl Default for Diepint { |
939 | #[inline (always)] |
940 | fn default() -> Diepint { |
941 | Diepint(0) |
942 | } |
943 | } |
944 | #[doc = "Device IN endpoint common interrupt mask register" ] |
945 | #[repr (transparent)] |
946 | #[derive (Copy, Clone, Eq, PartialEq)] |
947 | pub struct Diepmsk(pub u32); |
948 | impl Diepmsk { |
949 | #[doc = "Transfer completed interrupt mask" ] |
950 | #[inline (always)] |
951 | pub const fn xfrcm(&self) -> bool { |
952 | let val = (self.0 >> 0usize) & 0x01; |
953 | val != 0 |
954 | } |
955 | #[doc = "Transfer completed interrupt mask" ] |
956 | #[inline (always)] |
957 | pub fn set_xfrcm(&mut self, val: bool) { |
958 | self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize); |
959 | } |
960 | #[doc = "Endpoint disabled interrupt mask" ] |
961 | #[inline (always)] |
962 | pub const fn epdm(&self) -> bool { |
963 | let val = (self.0 >> 1usize) & 0x01; |
964 | val != 0 |
965 | } |
966 | #[doc = "Endpoint disabled interrupt mask" ] |
967 | #[inline (always)] |
968 | pub fn set_epdm(&mut self, val: bool) { |
969 | self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize); |
970 | } |
971 | #[doc = "Timeout condition mask (Non-isochronous endpoints)" ] |
972 | #[inline (always)] |
973 | pub const fn tom(&self) -> bool { |
974 | let val = (self.0 >> 3usize) & 0x01; |
975 | val != 0 |
976 | } |
977 | #[doc = "Timeout condition mask (Non-isochronous endpoints)" ] |
978 | #[inline (always)] |
979 | pub fn set_tom(&mut self, val: bool) { |
980 | self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize); |
981 | } |
982 | #[doc = "IN token received when TxFIFO empty mask" ] |
983 | #[inline (always)] |
984 | pub const fn ittxfemsk(&self) -> bool { |
985 | let val = (self.0 >> 4usize) & 0x01; |
986 | val != 0 |
987 | } |
988 | #[doc = "IN token received when TxFIFO empty mask" ] |
989 | #[inline (always)] |
990 | pub fn set_ittxfemsk(&mut self, val: bool) { |
991 | self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize); |
992 | } |
993 | #[doc = "IN token received with EP mismatch mask" ] |
994 | #[inline (always)] |
995 | pub const fn inepnmm(&self) -> bool { |
996 | let val = (self.0 >> 5usize) & 0x01; |
997 | val != 0 |
998 | } |
999 | #[doc = "IN token received with EP mismatch mask" ] |
1000 | #[inline (always)] |
1001 | pub fn set_inepnmm(&mut self, val: bool) { |
1002 | self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize); |
1003 | } |
1004 | #[doc = "IN endpoint NAK effective mask" ] |
1005 | #[inline (always)] |
1006 | pub const fn inepnem(&self) -> bool { |
1007 | let val = (self.0 >> 6usize) & 0x01; |
1008 | val != 0 |
1009 | } |
1010 | #[doc = "IN endpoint NAK effective mask" ] |
1011 | #[inline (always)] |
1012 | pub fn set_inepnem(&mut self, val: bool) { |
1013 | self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize); |
1014 | } |
1015 | } |
1016 | impl Default for Diepmsk { |
1017 | #[inline (always)] |
1018 | fn default() -> Diepmsk { |
1019 | Diepmsk(0) |
1020 | } |
1021 | } |
1022 | #[doc = "Device endpoint transfer size register" ] |
1023 | #[repr (transparent)] |
1024 | #[derive (Copy, Clone, Eq, PartialEq)] |
1025 | pub struct Dieptsiz(pub u32); |
1026 | impl Dieptsiz { |
1027 | #[doc = "Transfer size" ] |
1028 | #[inline (always)] |
1029 | pub const fn xfrsiz(&self) -> u32 { |
1030 | let val = (self.0 >> 0usize) & 0x0007_ffff; |
1031 | val as u32 |
1032 | } |
1033 | #[doc = "Transfer size" ] |
1034 | #[inline (always)] |
1035 | pub fn set_xfrsiz(&mut self, val: u32) { |
1036 | self.0 = (self.0 & !(0x0007_ffff << 0usize)) | (((val as u32) & 0x0007_ffff) << 0usize); |
1037 | } |
1038 | #[doc = "Packet count" ] |
1039 | #[inline (always)] |
1040 | pub const fn pktcnt(&self) -> u16 { |
1041 | let val = (self.0 >> 19usize) & 0x03ff; |
1042 | val as u16 |
1043 | } |
1044 | #[doc = "Packet count" ] |
1045 | #[inline (always)] |
1046 | pub fn set_pktcnt(&mut self, val: u16) { |
1047 | self.0 = (self.0 & !(0x03ff << 19usize)) | (((val as u32) & 0x03ff) << 19usize); |
1048 | } |
1049 | #[doc = "Multi count" ] |
1050 | #[inline (always)] |
1051 | pub const fn mcnt(&self) -> u8 { |
1052 | let val = (self.0 >> 29usize) & 0x03; |
1053 | val as u8 |
1054 | } |
1055 | #[doc = "Multi count" ] |
1056 | #[inline (always)] |
1057 | pub fn set_mcnt(&mut self, val: u8) { |
1058 | self.0 = (self.0 & !(0x03 << 29usize)) | (((val as u32) & 0x03) << 29usize); |
1059 | } |
1060 | } |
1061 | impl Default for Dieptsiz { |
1062 | #[inline (always)] |
1063 | fn default() -> Dieptsiz { |
1064 | Dieptsiz(0) |
1065 | } |
1066 | } |
1067 | #[doc = "Device endpoint control register" ] |
1068 | #[repr (transparent)] |
1069 | #[derive (Copy, Clone, Eq, PartialEq)] |
1070 | pub struct Doepctl(pub u32); |
1071 | impl Doepctl { |
1072 | #[doc = "MPSIZ" ] |
1073 | #[inline (always)] |
1074 | pub const fn mpsiz(&self) -> u16 { |
1075 | let val = (self.0 >> 0usize) & 0x07ff; |
1076 | val as u16 |
1077 | } |
1078 | #[doc = "MPSIZ" ] |
1079 | #[inline (always)] |
1080 | pub fn set_mpsiz(&mut self, val: u16) { |
1081 | self.0 = (self.0 & !(0x07ff << 0usize)) | (((val as u32) & 0x07ff) << 0usize); |
1082 | } |
1083 | #[doc = "USBAEP" ] |
1084 | #[inline (always)] |
1085 | pub const fn usbaep(&self) -> bool { |
1086 | let val = (self.0 >> 15usize) & 0x01; |
1087 | val != 0 |
1088 | } |
1089 | #[doc = "USBAEP" ] |
1090 | #[inline (always)] |
1091 | pub fn set_usbaep(&mut self, val: bool) { |
1092 | self.0 = (self.0 & !(0x01 << 15usize)) | (((val as u32) & 0x01) << 15usize); |
1093 | } |
1094 | #[doc = "EONUM/DPID" ] |
1095 | #[inline (always)] |
1096 | pub const fn eonum_dpid(&self) -> bool { |
1097 | let val = (self.0 >> 16usize) & 0x01; |
1098 | val != 0 |
1099 | } |
1100 | #[doc = "EONUM/DPID" ] |
1101 | #[inline (always)] |
1102 | pub fn set_eonum_dpid(&mut self, val: bool) { |
1103 | self.0 = (self.0 & !(0x01 << 16usize)) | (((val as u32) & 0x01) << 16usize); |
1104 | } |
1105 | #[doc = "NAKSTS" ] |
1106 | #[inline (always)] |
1107 | pub const fn naksts(&self) -> bool { |
1108 | let val = (self.0 >> 17usize) & 0x01; |
1109 | val != 0 |
1110 | } |
1111 | #[doc = "NAKSTS" ] |
1112 | #[inline (always)] |
1113 | pub fn set_naksts(&mut self, val: bool) { |
1114 | self.0 = (self.0 & !(0x01 << 17usize)) | (((val as u32) & 0x01) << 17usize); |
1115 | } |
1116 | #[doc = "EPTYP" ] |
1117 | #[inline (always)] |
1118 | pub const fn eptyp(&self) -> super::vals::Eptyp { |
1119 | let val = (self.0 >> 18usize) & 0x03; |
1120 | super::vals::Eptyp::from_bits(val as u8) |
1121 | } |
1122 | #[doc = "EPTYP" ] |
1123 | #[inline (always)] |
1124 | pub fn set_eptyp(&mut self, val: super::vals::Eptyp) { |
1125 | self.0 = (self.0 & !(0x03 << 18usize)) | (((val.to_bits() as u32) & 0x03) << 18usize); |
1126 | } |
1127 | #[doc = "SNPM" ] |
1128 | #[inline (always)] |
1129 | pub const fn snpm(&self) -> bool { |
1130 | let val = (self.0 >> 20usize) & 0x01; |
1131 | val != 0 |
1132 | } |
1133 | #[doc = "SNPM" ] |
1134 | #[inline (always)] |
1135 | pub fn set_snpm(&mut self, val: bool) { |
1136 | self.0 = (self.0 & !(0x01 << 20usize)) | (((val as u32) & 0x01) << 20usize); |
1137 | } |
1138 | #[doc = "STALL" ] |
1139 | #[inline (always)] |
1140 | pub const fn stall(&self) -> bool { |
1141 | let val = (self.0 >> 21usize) & 0x01; |
1142 | val != 0 |
1143 | } |
1144 | #[doc = "STALL" ] |
1145 | #[inline (always)] |
1146 | pub fn set_stall(&mut self, val: bool) { |
1147 | self.0 = (self.0 & !(0x01 << 21usize)) | (((val as u32) & 0x01) << 21usize); |
1148 | } |
1149 | #[doc = "CNAK" ] |
1150 | #[inline (always)] |
1151 | pub const fn cnak(&self) -> bool { |
1152 | let val = (self.0 >> 26usize) & 0x01; |
1153 | val != 0 |
1154 | } |
1155 | #[doc = "CNAK" ] |
1156 | #[inline (always)] |
1157 | pub fn set_cnak(&mut self, val: bool) { |
1158 | self.0 = (self.0 & !(0x01 << 26usize)) | (((val as u32) & 0x01) << 26usize); |
1159 | } |
1160 | #[doc = "SNAK" ] |
1161 | #[inline (always)] |
1162 | pub const fn snak(&self) -> bool { |
1163 | let val = (self.0 >> 27usize) & 0x01; |
1164 | val != 0 |
1165 | } |
1166 | #[doc = "SNAK" ] |
1167 | #[inline (always)] |
1168 | pub fn set_snak(&mut self, val: bool) { |
1169 | self.0 = (self.0 & !(0x01 << 27usize)) | (((val as u32) & 0x01) << 27usize); |
1170 | } |
1171 | #[doc = "SD0PID/SEVNFRM" ] |
1172 | #[inline (always)] |
1173 | pub const fn sd0pid_sevnfrm(&self) -> bool { |
1174 | let val = (self.0 >> 28usize) & 0x01; |
1175 | val != 0 |
1176 | } |
1177 | #[doc = "SD0PID/SEVNFRM" ] |
1178 | #[inline (always)] |
1179 | pub fn set_sd0pid_sevnfrm(&mut self, val: bool) { |
1180 | self.0 = (self.0 & !(0x01 << 28usize)) | (((val as u32) & 0x01) << 28usize); |
1181 | } |
1182 | #[doc = "SD1PID/SODDFRM" ] |
1183 | #[inline (always)] |
1184 | pub const fn sd1pid_soddfrm(&self) -> bool { |
1185 | let val = (self.0 >> 29usize) & 0x01; |
1186 | val != 0 |
1187 | } |
1188 | #[doc = "SD1PID/SODDFRM" ] |
1189 | #[inline (always)] |
1190 | pub fn set_sd1pid_soddfrm(&mut self, val: bool) { |
1191 | self.0 = (self.0 & !(0x01 << 29usize)) | (((val as u32) & 0x01) << 29usize); |
1192 | } |
1193 | #[doc = "EPDIS" ] |
1194 | #[inline (always)] |
1195 | pub const fn epdis(&self) -> bool { |
1196 | let val = (self.0 >> 30usize) & 0x01; |
1197 | val != 0 |
1198 | } |
1199 | #[doc = "EPDIS" ] |
1200 | #[inline (always)] |
1201 | pub fn set_epdis(&mut self, val: bool) { |
1202 | self.0 = (self.0 & !(0x01 << 30usize)) | (((val as u32) & 0x01) << 30usize); |
1203 | } |
1204 | #[doc = "EPENA" ] |
1205 | #[inline (always)] |
1206 | pub const fn epena(&self) -> bool { |
1207 | let val = (self.0 >> 31usize) & 0x01; |
1208 | val != 0 |
1209 | } |
1210 | #[doc = "EPENA" ] |
1211 | #[inline (always)] |
1212 | pub fn set_epena(&mut self, val: bool) { |
1213 | self.0 = (self.0 & !(0x01 << 31usize)) | (((val as u32) & 0x01) << 31usize); |
1214 | } |
1215 | } |
1216 | impl Default for Doepctl { |
1217 | #[inline (always)] |
1218 | fn default() -> Doepctl { |
1219 | Doepctl(0) |
1220 | } |
1221 | } |
1222 | #[doc = "Device endpoint interrupt register" ] |
1223 | #[repr (transparent)] |
1224 | #[derive (Copy, Clone, Eq, PartialEq)] |
1225 | pub struct Doepint(pub u32); |
1226 | impl Doepint { |
1227 | #[doc = "XFRC" ] |
1228 | #[inline (always)] |
1229 | pub const fn xfrc(&self) -> bool { |
1230 | let val = (self.0 >> 0usize) & 0x01; |
1231 | val != 0 |
1232 | } |
1233 | #[doc = "XFRC" ] |
1234 | #[inline (always)] |
1235 | pub fn set_xfrc(&mut self, val: bool) { |
1236 | self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize); |
1237 | } |
1238 | #[doc = "EPDISD" ] |
1239 | #[inline (always)] |
1240 | pub const fn epdisd(&self) -> bool { |
1241 | let val = (self.0 >> 1usize) & 0x01; |
1242 | val != 0 |
1243 | } |
1244 | #[doc = "EPDISD" ] |
1245 | #[inline (always)] |
1246 | pub fn set_epdisd(&mut self, val: bool) { |
1247 | self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize); |
1248 | } |
1249 | #[doc = "STUP" ] |
1250 | #[inline (always)] |
1251 | pub const fn stup(&self) -> bool { |
1252 | let val = (self.0 >> 3usize) & 0x01; |
1253 | val != 0 |
1254 | } |
1255 | #[doc = "STUP" ] |
1256 | #[inline (always)] |
1257 | pub fn set_stup(&mut self, val: bool) { |
1258 | self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize); |
1259 | } |
1260 | #[doc = "OTEPDIS" ] |
1261 | #[inline (always)] |
1262 | pub const fn otepdis(&self) -> bool { |
1263 | let val = (self.0 >> 4usize) & 0x01; |
1264 | val != 0 |
1265 | } |
1266 | #[doc = "OTEPDIS" ] |
1267 | #[inline (always)] |
1268 | pub fn set_otepdis(&mut self, val: bool) { |
1269 | self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize); |
1270 | } |
1271 | #[doc = "B2BSTUP" ] |
1272 | #[inline (always)] |
1273 | pub const fn b2bstup(&self) -> bool { |
1274 | let val = (self.0 >> 6usize) & 0x01; |
1275 | val != 0 |
1276 | } |
1277 | #[doc = "B2BSTUP" ] |
1278 | #[inline (always)] |
1279 | pub fn set_b2bstup(&mut self, val: bool) { |
1280 | self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize); |
1281 | } |
1282 | } |
1283 | impl Default for Doepint { |
1284 | #[inline (always)] |
1285 | fn default() -> Doepint { |
1286 | Doepint(0) |
1287 | } |
1288 | } |
1289 | #[doc = "Device OUT endpoint common interrupt mask register" ] |
1290 | #[repr (transparent)] |
1291 | #[derive (Copy, Clone, Eq, PartialEq)] |
1292 | pub struct Doepmsk(pub u32); |
1293 | impl Doepmsk { |
1294 | #[doc = "Transfer completed interrupt mask" ] |
1295 | #[inline (always)] |
1296 | pub const fn xfrcm(&self) -> bool { |
1297 | let val = (self.0 >> 0usize) & 0x01; |
1298 | val != 0 |
1299 | } |
1300 | #[doc = "Transfer completed interrupt mask" ] |
1301 | #[inline (always)] |
1302 | pub fn set_xfrcm(&mut self, val: bool) { |
1303 | self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize); |
1304 | } |
1305 | #[doc = "Endpoint disabled interrupt mask" ] |
1306 | #[inline (always)] |
1307 | pub const fn epdm(&self) -> bool { |
1308 | let val = (self.0 >> 1usize) & 0x01; |
1309 | val != 0 |
1310 | } |
1311 | #[doc = "Endpoint disabled interrupt mask" ] |
1312 | #[inline (always)] |
1313 | pub fn set_epdm(&mut self, val: bool) { |
1314 | self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize); |
1315 | } |
1316 | #[doc = "SETUP phase done mask" ] |
1317 | #[inline (always)] |
1318 | pub const fn stupm(&self) -> bool { |
1319 | let val = (self.0 >> 3usize) & 0x01; |
1320 | val != 0 |
1321 | } |
1322 | #[doc = "SETUP phase done mask" ] |
1323 | #[inline (always)] |
1324 | pub fn set_stupm(&mut self, val: bool) { |
1325 | self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize); |
1326 | } |
1327 | #[doc = "OUT token received when endpoint disabled mask" ] |
1328 | #[inline (always)] |
1329 | pub const fn otepdm(&self) -> bool { |
1330 | let val = (self.0 >> 4usize) & 0x01; |
1331 | val != 0 |
1332 | } |
1333 | #[doc = "OUT token received when endpoint disabled mask" ] |
1334 | #[inline (always)] |
1335 | pub fn set_otepdm(&mut self, val: bool) { |
1336 | self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize); |
1337 | } |
1338 | } |
1339 | impl Default for Doepmsk { |
1340 | #[inline (always)] |
1341 | fn default() -> Doepmsk { |
1342 | Doepmsk(0) |
1343 | } |
1344 | } |
1345 | #[doc = "Device OUT endpoint transfer size register" ] |
1346 | #[repr (transparent)] |
1347 | #[derive (Copy, Clone, Eq, PartialEq)] |
1348 | pub struct Doeptsiz(pub u32); |
1349 | impl Doeptsiz { |
1350 | #[doc = "Transfer size" ] |
1351 | #[inline (always)] |
1352 | pub const fn xfrsiz(&self) -> u32 { |
1353 | let val = (self.0 >> 0usize) & 0x0007_ffff; |
1354 | val as u32 |
1355 | } |
1356 | #[doc = "Transfer size" ] |
1357 | #[inline (always)] |
1358 | pub fn set_xfrsiz(&mut self, val: u32) { |
1359 | self.0 = (self.0 & !(0x0007_ffff << 0usize)) | (((val as u32) & 0x0007_ffff) << 0usize); |
1360 | } |
1361 | #[doc = "Packet count" ] |
1362 | #[inline (always)] |
1363 | pub const fn pktcnt(&self) -> u16 { |
1364 | let val = (self.0 >> 19usize) & 0x03ff; |
1365 | val as u16 |
1366 | } |
1367 | #[doc = "Packet count" ] |
1368 | #[inline (always)] |
1369 | pub fn set_pktcnt(&mut self, val: u16) { |
1370 | self.0 = (self.0 & !(0x03ff << 19usize)) | (((val as u32) & 0x03ff) << 19usize); |
1371 | } |
1372 | #[doc = "Received data PID/SETUP packet count" ] |
1373 | #[inline (always)] |
1374 | pub const fn rxdpid_stupcnt(&self) -> u8 { |
1375 | let val = (self.0 >> 29usize) & 0x03; |
1376 | val as u8 |
1377 | } |
1378 | #[doc = "Received data PID/SETUP packet count" ] |
1379 | #[inline (always)] |
1380 | pub fn set_rxdpid_stupcnt(&mut self, val: u8) { |
1381 | self.0 = (self.0 & !(0x03 << 29usize)) | (((val as u32) & 0x03) << 29usize); |
1382 | } |
1383 | } |
1384 | impl Default for Doeptsiz { |
1385 | #[inline (always)] |
1386 | fn default() -> Doeptsiz { |
1387 | Doeptsiz(0) |
1388 | } |
1389 | } |
1390 | #[doc = "Device status register" ] |
1391 | #[repr (transparent)] |
1392 | #[derive (Copy, Clone, Eq, PartialEq)] |
1393 | pub struct Dsts(pub u32); |
1394 | impl Dsts { |
1395 | #[doc = "Suspend status" ] |
1396 | #[inline (always)] |
1397 | pub const fn suspsts(&self) -> bool { |
1398 | let val = (self.0 >> 0usize) & 0x01; |
1399 | val != 0 |
1400 | } |
1401 | #[doc = "Suspend status" ] |
1402 | #[inline (always)] |
1403 | pub fn set_suspsts(&mut self, val: bool) { |
1404 | self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize); |
1405 | } |
1406 | #[doc = "Enumerated speed" ] |
1407 | #[inline (always)] |
1408 | pub const fn enumspd(&self) -> super::vals::Dspd { |
1409 | let val = (self.0 >> 1usize) & 0x03; |
1410 | super::vals::Dspd::from_bits(val as u8) |
1411 | } |
1412 | #[doc = "Enumerated speed" ] |
1413 | #[inline (always)] |
1414 | pub fn set_enumspd(&mut self, val: super::vals::Dspd) { |
1415 | self.0 = (self.0 & !(0x03 << 1usize)) | (((val.to_bits() as u32) & 0x03) << 1usize); |
1416 | } |
1417 | #[doc = "Erratic error" ] |
1418 | #[inline (always)] |
1419 | pub const fn eerr(&self) -> bool { |
1420 | let val = (self.0 >> 3usize) & 0x01; |
1421 | val != 0 |
1422 | } |
1423 | #[doc = "Erratic error" ] |
1424 | #[inline (always)] |
1425 | pub fn set_eerr(&mut self, val: bool) { |
1426 | self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize); |
1427 | } |
1428 | #[doc = "Frame number of the received SOF" ] |
1429 | #[inline (always)] |
1430 | pub const fn fnsof(&self) -> u16 { |
1431 | let val = (self.0 >> 8usize) & 0x3fff; |
1432 | val as u16 |
1433 | } |
1434 | #[doc = "Frame number of the received SOF" ] |
1435 | #[inline (always)] |
1436 | pub fn set_fnsof(&mut self, val: u16) { |
1437 | self.0 = (self.0 & !(0x3fff << 8usize)) | (((val as u32) & 0x3fff) << 8usize); |
1438 | } |
1439 | } |
1440 | impl Default for Dsts { |
1441 | #[inline (always)] |
1442 | fn default() -> Dsts { |
1443 | Dsts(0) |
1444 | } |
1445 | } |
1446 | #[doc = "Device IN endpoint transmit FIFO status register" ] |
1447 | #[repr (transparent)] |
1448 | #[derive (Copy, Clone, Eq, PartialEq)] |
1449 | pub struct Dtxfsts(pub u32); |
1450 | impl Dtxfsts { |
1451 | #[doc = "IN endpoint TxFIFO space available" ] |
1452 | #[inline (always)] |
1453 | pub const fn ineptfsav(&self) -> u16 { |
1454 | let val = (self.0 >> 0usize) & 0xffff; |
1455 | val as u16 |
1456 | } |
1457 | #[doc = "IN endpoint TxFIFO space available" ] |
1458 | #[inline (always)] |
1459 | pub fn set_ineptfsav(&mut self, val: u16) { |
1460 | self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize); |
1461 | } |
1462 | } |
1463 | impl Default for Dtxfsts { |
1464 | #[inline (always)] |
1465 | fn default() -> Dtxfsts { |
1466 | Dtxfsts(0) |
1467 | } |
1468 | } |
1469 | #[doc = "Device VBUS discharge time register" ] |
1470 | #[repr (transparent)] |
1471 | #[derive (Copy, Clone, Eq, PartialEq)] |
1472 | pub struct Dvbusdis(pub u32); |
1473 | impl Dvbusdis { |
1474 | #[doc = "Device VBUS discharge time" ] |
1475 | #[inline (always)] |
1476 | pub const fn vbusdt(&self) -> u16 { |
1477 | let val = (self.0 >> 0usize) & 0xffff; |
1478 | val as u16 |
1479 | } |
1480 | #[doc = "Device VBUS discharge time" ] |
1481 | #[inline (always)] |
1482 | pub fn set_vbusdt(&mut self, val: u16) { |
1483 | self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize); |
1484 | } |
1485 | } |
1486 | impl Default for Dvbusdis { |
1487 | #[inline (always)] |
1488 | fn default() -> Dvbusdis { |
1489 | Dvbusdis(0) |
1490 | } |
1491 | } |
1492 | #[doc = "Device VBUS pulsing time register" ] |
1493 | #[repr (transparent)] |
1494 | #[derive (Copy, Clone, Eq, PartialEq)] |
1495 | pub struct Dvbuspulse(pub u32); |
1496 | impl Dvbuspulse { |
1497 | #[doc = "Device VBUS pulsing time" ] |
1498 | #[inline (always)] |
1499 | pub const fn dvbusp(&self) -> u16 { |
1500 | let val = (self.0 >> 0usize) & 0x0fff; |
1501 | val as u16 |
1502 | } |
1503 | #[doc = "Device VBUS pulsing time" ] |
1504 | #[inline (always)] |
1505 | pub fn set_dvbusp(&mut self, val: u16) { |
1506 | self.0 = (self.0 & !(0x0fff << 0usize)) | (((val as u32) & 0x0fff) << 0usize); |
1507 | } |
1508 | } |
1509 | impl Default for Dvbuspulse { |
1510 | #[inline (always)] |
1511 | fn default() -> Dvbuspulse { |
1512 | Dvbuspulse(0) |
1513 | } |
1514 | } |
1515 | #[doc = "FIFO register" ] |
1516 | #[repr (transparent)] |
1517 | #[derive (Copy, Clone, Eq, PartialEq)] |
1518 | pub struct Fifo(pub u32); |
1519 | impl Fifo { |
1520 | #[doc = "Data" ] |
1521 | #[inline (always)] |
1522 | pub const fn data(&self) -> u32 { |
1523 | let val = (self.0 >> 0usize) & 0xffff_ffff; |
1524 | val as u32 |
1525 | } |
1526 | #[doc = "Data" ] |
1527 | #[inline (always)] |
1528 | pub fn set_data(&mut self, val: u32) { |
1529 | self.0 = (self.0 & !(0xffff_ffff << 0usize)) | (((val as u32) & 0xffff_ffff) << 0usize); |
1530 | } |
1531 | } |
1532 | impl Default for Fifo { |
1533 | #[inline (always)] |
1534 | fn default() -> Fifo { |
1535 | Fifo(0) |
1536 | } |
1537 | } |
1538 | #[doc = "FIFO size register" ] |
1539 | #[repr (transparent)] |
1540 | #[derive (Copy, Clone, Eq, PartialEq)] |
1541 | pub struct Fsiz(pub u32); |
1542 | impl Fsiz { |
1543 | #[doc = "RAM start address" ] |
1544 | #[inline (always)] |
1545 | pub const fn sa(&self) -> u16 { |
1546 | let val = (self.0 >> 0usize) & 0xffff; |
1547 | val as u16 |
1548 | } |
1549 | #[doc = "RAM start address" ] |
1550 | #[inline (always)] |
1551 | pub fn set_sa(&mut self, val: u16) { |
1552 | self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize); |
1553 | } |
1554 | #[doc = "FIFO depth" ] |
1555 | #[inline (always)] |
1556 | pub const fn fd(&self) -> u16 { |
1557 | let val = (self.0 >> 16usize) & 0xffff; |
1558 | val as u16 |
1559 | } |
1560 | #[doc = "FIFO depth" ] |
1561 | #[inline (always)] |
1562 | pub fn set_fd(&mut self, val: u16) { |
1563 | self.0 = (self.0 & !(0xffff << 16usize)) | (((val as u32) & 0xffff) << 16usize); |
1564 | } |
1565 | } |
1566 | impl Default for Fsiz { |
1567 | #[inline (always)] |
1568 | fn default() -> Fsiz { |
1569 | Fsiz(0) |
1570 | } |
1571 | } |
1572 | #[doc = "AHB configuration register" ] |
1573 | #[repr (transparent)] |
1574 | #[derive (Copy, Clone, Eq, PartialEq)] |
1575 | pub struct Gahbcfg(pub u32); |
1576 | impl Gahbcfg { |
1577 | #[doc = "Global interrupt mask" ] |
1578 | #[inline (always)] |
1579 | pub const fn gint(&self) -> bool { |
1580 | let val = (self.0 >> 0usize) & 0x01; |
1581 | val != 0 |
1582 | } |
1583 | #[doc = "Global interrupt mask" ] |
1584 | #[inline (always)] |
1585 | pub fn set_gint(&mut self, val: bool) { |
1586 | self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize); |
1587 | } |
1588 | #[doc = "Burst length/type" ] |
1589 | #[inline (always)] |
1590 | pub const fn hbstlen(&self) -> u8 { |
1591 | let val = (self.0 >> 1usize) & 0x0f; |
1592 | val as u8 |
1593 | } |
1594 | #[doc = "Burst length/type" ] |
1595 | #[inline (always)] |
1596 | pub fn set_hbstlen(&mut self, val: u8) { |
1597 | self.0 = (self.0 & !(0x0f << 1usize)) | (((val as u32) & 0x0f) << 1usize); |
1598 | } |
1599 | #[doc = "DMA enable" ] |
1600 | #[inline (always)] |
1601 | pub const fn dmaen(&self) -> bool { |
1602 | let val = (self.0 >> 5usize) & 0x01; |
1603 | val != 0 |
1604 | } |
1605 | #[doc = "DMA enable" ] |
1606 | #[inline (always)] |
1607 | pub fn set_dmaen(&mut self, val: bool) { |
1608 | self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize); |
1609 | } |
1610 | #[doc = "TxFIFO empty level" ] |
1611 | #[inline (always)] |
1612 | pub const fn txfelvl(&self) -> bool { |
1613 | let val = (self.0 >> 7usize) & 0x01; |
1614 | val != 0 |
1615 | } |
1616 | #[doc = "TxFIFO empty level" ] |
1617 | #[inline (always)] |
1618 | pub fn set_txfelvl(&mut self, val: bool) { |
1619 | self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize); |
1620 | } |
1621 | #[doc = "Periodic TxFIFO empty level" ] |
1622 | #[inline (always)] |
1623 | pub const fn ptxfelvl(&self) -> bool { |
1624 | let val = (self.0 >> 8usize) & 0x01; |
1625 | val != 0 |
1626 | } |
1627 | #[doc = "Periodic TxFIFO empty level" ] |
1628 | #[inline (always)] |
1629 | pub fn set_ptxfelvl(&mut self, val: bool) { |
1630 | self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize); |
1631 | } |
1632 | } |
1633 | impl Default for Gahbcfg { |
1634 | #[inline (always)] |
1635 | fn default() -> Gahbcfg { |
1636 | Gahbcfg(0) |
1637 | } |
1638 | } |
1639 | #[doc = "General core configuration register" ] |
1640 | #[repr (transparent)] |
1641 | #[derive (Copy, Clone, Eq, PartialEq)] |
1642 | pub struct GccfgV1(pub u32); |
1643 | impl GccfgV1 { |
1644 | #[doc = "Power down" ] |
1645 | #[inline (always)] |
1646 | pub const fn pwrdwn(&self) -> bool { |
1647 | let val = (self.0 >> 16usize) & 0x01; |
1648 | val != 0 |
1649 | } |
1650 | #[doc = "Power down" ] |
1651 | #[inline (always)] |
1652 | pub fn set_pwrdwn(&mut self, val: bool) { |
1653 | self.0 = (self.0 & !(0x01 << 16usize)) | (((val as u32) & 0x01) << 16usize); |
1654 | } |
1655 | #[doc = "Enable the VBUS \"A \" sensing device" ] |
1656 | #[inline (always)] |
1657 | pub const fn vbusasen(&self) -> bool { |
1658 | let val = (self.0 >> 18usize) & 0x01; |
1659 | val != 0 |
1660 | } |
1661 | #[doc = "Enable the VBUS \"A \" sensing device" ] |
1662 | #[inline (always)] |
1663 | pub fn set_vbusasen(&mut self, val: bool) { |
1664 | self.0 = (self.0 & !(0x01 << 18usize)) | (((val as u32) & 0x01) << 18usize); |
1665 | } |
1666 | #[doc = "Enable the VBUS \"B \" sensing device" ] |
1667 | #[inline (always)] |
1668 | pub const fn vbusbsen(&self) -> bool { |
1669 | let val = (self.0 >> 19usize) & 0x01; |
1670 | val != 0 |
1671 | } |
1672 | #[doc = "Enable the VBUS \"B \" sensing device" ] |
1673 | #[inline (always)] |
1674 | pub fn set_vbusbsen(&mut self, val: bool) { |
1675 | self.0 = (self.0 & !(0x01 << 19usize)) | (((val as u32) & 0x01) << 19usize); |
1676 | } |
1677 | #[doc = "SOF output enable" ] |
1678 | #[inline (always)] |
1679 | pub const fn sofouten(&self) -> bool { |
1680 | let val = (self.0 >> 20usize) & 0x01; |
1681 | val != 0 |
1682 | } |
1683 | #[doc = "SOF output enable" ] |
1684 | #[inline (always)] |
1685 | pub fn set_sofouten(&mut self, val: bool) { |
1686 | self.0 = (self.0 & !(0x01 << 20usize)) | (((val as u32) & 0x01) << 20usize); |
1687 | } |
1688 | #[doc = "VBUS sensing disable" ] |
1689 | #[inline (always)] |
1690 | pub const fn novbussens(&self) -> bool { |
1691 | let val = (self.0 >> 21usize) & 0x01; |
1692 | val != 0 |
1693 | } |
1694 | #[doc = "VBUS sensing disable" ] |
1695 | #[inline (always)] |
1696 | pub fn set_novbussens(&mut self, val: bool) { |
1697 | self.0 = (self.0 & !(0x01 << 21usize)) | (((val as u32) & 0x01) << 21usize); |
1698 | } |
1699 | } |
1700 | impl Default for GccfgV1 { |
1701 | #[inline (always)] |
1702 | fn default() -> GccfgV1 { |
1703 | GccfgV1(0) |
1704 | } |
1705 | } |
1706 | #[doc = "General core configuration register" ] |
1707 | #[repr (transparent)] |
1708 | #[derive (Copy, Clone, Eq, PartialEq)] |
1709 | pub struct GccfgV2(pub u32); |
1710 | impl GccfgV2 { |
1711 | #[doc = "Data contact detection (DCD) status" ] |
1712 | #[inline (always)] |
1713 | pub const fn dcdet(&self) -> bool { |
1714 | let val = (self.0 >> 0usize) & 0x01; |
1715 | val != 0 |
1716 | } |
1717 | #[doc = "Data contact detection (DCD) status" ] |
1718 | #[inline (always)] |
1719 | pub fn set_dcdet(&mut self, val: bool) { |
1720 | self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize); |
1721 | } |
1722 | #[doc = "Primary detection (PD) status" ] |
1723 | #[inline (always)] |
1724 | pub const fn pdet(&self) -> bool { |
1725 | let val = (self.0 >> 1usize) & 0x01; |
1726 | val != 0 |
1727 | } |
1728 | #[doc = "Primary detection (PD) status" ] |
1729 | #[inline (always)] |
1730 | pub fn set_pdet(&mut self, val: bool) { |
1731 | self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize); |
1732 | } |
1733 | #[doc = "Secondary detection (SD) status" ] |
1734 | #[inline (always)] |
1735 | pub const fn sdet(&self) -> bool { |
1736 | let val = (self.0 >> 2usize) & 0x01; |
1737 | val != 0 |
1738 | } |
1739 | #[doc = "Secondary detection (SD) status" ] |
1740 | #[inline (always)] |
1741 | pub fn set_sdet(&mut self, val: bool) { |
1742 | self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize); |
1743 | } |
1744 | #[doc = "DM pull-up detection status" ] |
1745 | #[inline (always)] |
1746 | pub const fn ps2det(&self) -> bool { |
1747 | let val = (self.0 >> 3usize) & 0x01; |
1748 | val != 0 |
1749 | } |
1750 | #[doc = "DM pull-up detection status" ] |
1751 | #[inline (always)] |
1752 | pub fn set_ps2det(&mut self, val: bool) { |
1753 | self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize); |
1754 | } |
1755 | #[doc = "Power down" ] |
1756 | #[inline (always)] |
1757 | pub const fn pwrdwn(&self) -> bool { |
1758 | let val = (self.0 >> 16usize) & 0x01; |
1759 | val != 0 |
1760 | } |
1761 | #[doc = "Power down" ] |
1762 | #[inline (always)] |
1763 | pub fn set_pwrdwn(&mut self, val: bool) { |
1764 | self.0 = (self.0 & !(0x01 << 16usize)) | (((val as u32) & 0x01) << 16usize); |
1765 | } |
1766 | #[doc = "Battery charging detector (BCD) enable" ] |
1767 | #[inline (always)] |
1768 | pub const fn bcden(&self) -> bool { |
1769 | let val = (self.0 >> 17usize) & 0x01; |
1770 | val != 0 |
1771 | } |
1772 | #[doc = "Battery charging detector (BCD) enable" ] |
1773 | #[inline (always)] |
1774 | pub fn set_bcden(&mut self, val: bool) { |
1775 | self.0 = (self.0 & !(0x01 << 17usize)) | (((val as u32) & 0x01) << 17usize); |
1776 | } |
1777 | #[doc = "Data contact detection (DCD) mode enable" ] |
1778 | #[inline (always)] |
1779 | pub const fn dcden(&self) -> bool { |
1780 | let val = (self.0 >> 18usize) & 0x01; |
1781 | val != 0 |
1782 | } |
1783 | #[doc = "Data contact detection (DCD) mode enable" ] |
1784 | #[inline (always)] |
1785 | pub fn set_dcden(&mut self, val: bool) { |
1786 | self.0 = (self.0 & !(0x01 << 18usize)) | (((val as u32) & 0x01) << 18usize); |
1787 | } |
1788 | #[doc = "Primary detection (PD) mode enable" ] |
1789 | #[inline (always)] |
1790 | pub const fn pden(&self) -> bool { |
1791 | let val = (self.0 >> 19usize) & 0x01; |
1792 | val != 0 |
1793 | } |
1794 | #[doc = "Primary detection (PD) mode enable" ] |
1795 | #[inline (always)] |
1796 | pub fn set_pden(&mut self, val: bool) { |
1797 | self.0 = (self.0 & !(0x01 << 19usize)) | (((val as u32) & 0x01) << 19usize); |
1798 | } |
1799 | #[doc = "Secondary detection (SD) mode enable" ] |
1800 | #[inline (always)] |
1801 | pub const fn sden(&self) -> bool { |
1802 | let val = (self.0 >> 20usize) & 0x01; |
1803 | val != 0 |
1804 | } |
1805 | #[doc = "Secondary detection (SD) mode enable" ] |
1806 | #[inline (always)] |
1807 | pub fn set_sden(&mut self, val: bool) { |
1808 | self.0 = (self.0 & !(0x01 << 20usize)) | (((val as u32) & 0x01) << 20usize); |
1809 | } |
1810 | #[doc = "USB VBUS detection enable" ] |
1811 | #[inline (always)] |
1812 | pub const fn vbden(&self) -> bool { |
1813 | let val = (self.0 >> 21usize) & 0x01; |
1814 | val != 0 |
1815 | } |
1816 | #[doc = "USB VBUS detection enable" ] |
1817 | #[inline (always)] |
1818 | pub fn set_vbden(&mut self, val: bool) { |
1819 | self.0 = (self.0 & !(0x01 << 21usize)) | (((val as u32) & 0x01) << 21usize); |
1820 | } |
1821 | #[doc = "Internal high-speed PHY enable." ] |
1822 | #[inline (always)] |
1823 | pub const fn phyhsen(&self) -> bool { |
1824 | let val = (self.0 >> 23usize) & 0x01; |
1825 | val != 0 |
1826 | } |
1827 | #[doc = "Internal high-speed PHY enable." ] |
1828 | #[inline (always)] |
1829 | pub fn set_phyhsen(&mut self, val: bool) { |
1830 | self.0 = (self.0 & !(0x01 << 23usize)) | (((val as u32) & 0x01) << 23usize); |
1831 | } |
1832 | } |
1833 | impl Default for GccfgV2 { |
1834 | #[inline (always)] |
1835 | fn default() -> GccfgV2 { |
1836 | GccfgV2(0) |
1837 | } |
1838 | } |
1839 | #[doc = "OTG general core configuration register." ] |
1840 | #[repr (transparent)] |
1841 | #[derive (Copy, Clone, Eq, PartialEq)] |
1842 | pub struct GccfgV3(pub u32); |
1843 | impl GccfgV3 { |
1844 | #[doc = "Charger detection, result of the current mode (primary or secondary)." ] |
1845 | #[inline (always)] |
1846 | pub const fn chgdet(&self) -> bool { |
1847 | let val = (self.0 >> 0usize) & 0x01; |
1848 | val != 0 |
1849 | } |
1850 | #[doc = "Charger detection, result of the current mode (primary or secondary)." ] |
1851 | #[inline (always)] |
1852 | pub fn set_chgdet(&mut self, val: bool) { |
1853 | self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize); |
1854 | } |
1855 | #[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)." ] |
1856 | #[inline (always)] |
1857 | pub const fn fsvplus(&self) -> bool { |
1858 | let val = (self.0 >> 1usize) & 0x01; |
1859 | val != 0 |
1860 | } |
1861 | #[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)." ] |
1862 | #[inline (always)] |
1863 | pub fn set_fsvplus(&mut self, val: bool) { |
1864 | self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize); |
1865 | } |
1866 | #[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)." ] |
1867 | #[inline (always)] |
1868 | pub const fn fsvminus(&self) -> bool { |
1869 | let val = (self.0 >> 2usize) & 0x01; |
1870 | val != 0 |
1871 | } |
1872 | #[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)." ] |
1873 | #[inline (always)] |
1874 | pub fn set_fsvminus(&mut self, val: bool) { |
1875 | self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize); |
1876 | } |
1877 | #[doc = "VBUS session indicator Indicates if VBUS is above VBUS session threshold." ] |
1878 | #[inline (always)] |
1879 | pub const fn sessvld(&self) -> bool { |
1880 | let val = (self.0 >> 3usize) & 0x01; |
1881 | val != 0 |
1882 | } |
1883 | #[doc = "VBUS session indicator Indicates if VBUS is above VBUS session threshold." ] |
1884 | #[inline (always)] |
1885 | pub fn set_sessvld(&mut self, val: bool) { |
1886 | self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize); |
1887 | } |
1888 | #[doc = "Host CDP behavior enable." ] |
1889 | #[inline (always)] |
1890 | pub const fn hcdpen(&self) -> bool { |
1891 | let val = (self.0 >> 16usize) & 0x01; |
1892 | val != 0 |
1893 | } |
1894 | #[doc = "Host CDP behavior enable." ] |
1895 | #[inline (always)] |
1896 | pub fn set_hcdpen(&mut self, val: bool) { |
1897 | self.0 = (self.0 & !(0x01 << 16usize)) | (((val as u32) & 0x01) << 16usize); |
1898 | } |
1899 | #[doc = "Host CDP port voltage detector enable on DP." ] |
1900 | #[inline (always)] |
1901 | pub const fn hcdpdeten(&self) -> bool { |
1902 | let val = (self.0 >> 17usize) & 0x01; |
1903 | val != 0 |
1904 | } |
1905 | #[doc = "Host CDP port voltage detector enable on DP." ] |
1906 | #[inline (always)] |
1907 | pub fn set_hcdpdeten(&mut self, val: bool) { |
1908 | self.0 = (self.0 & !(0x01 << 17usize)) | (((val as u32) & 0x01) << 17usize); |
1909 | } |
1910 | #[doc = "Host CDP port Voltage source enable on DM." ] |
1911 | #[inline (always)] |
1912 | pub const fn hvdmsrcen(&self) -> bool { |
1913 | let val = (self.0 >> 18usize) & 0x01; |
1914 | val != 0 |
1915 | } |
1916 | #[doc = "Host CDP port Voltage source enable on DM." ] |
1917 | #[inline (always)] |
1918 | pub fn set_hvdmsrcen(&mut self, val: bool) { |
1919 | self.0 = (self.0 & !(0x01 << 18usize)) | (((val as u32) & 0x01) << 18usize); |
1920 | } |
1921 | #[doc = "Data Contact Detection enable." ] |
1922 | #[inline (always)] |
1923 | pub const fn dcden(&self) -> bool { |
1924 | let val = (self.0 >> 19usize) & 0x01; |
1925 | val != 0 |
1926 | } |
1927 | #[doc = "Data Contact Detection enable." ] |
1928 | #[inline (always)] |
1929 | pub fn set_dcden(&mut self, val: bool) { |
1930 | self.0 = (self.0 & !(0x01 << 19usize)) | (((val as u32) & 0x01) << 19usize); |
1931 | } |
1932 | #[doc = "Primary detection enable." ] |
1933 | #[inline (always)] |
1934 | pub const fn pden(&self) -> bool { |
1935 | let val = (self.0 >> 20usize) & 0x01; |
1936 | val != 0 |
1937 | } |
1938 | #[doc = "Primary detection enable." ] |
1939 | #[inline (always)] |
1940 | pub fn set_pden(&mut self, val: bool) { |
1941 | self.0 = (self.0 & !(0x01 << 20usize)) | (((val as u32) & 0x01) << 20usize); |
1942 | } |
1943 | #[doc = "VBUS detection enable Enables VBUS Sensing Comparators in order to detect VBUS presence and/or perform OTG operation." ] |
1944 | #[inline (always)] |
1945 | pub const fn vbden(&self) -> bool { |
1946 | let val = (self.0 >> 21usize) & 0x01; |
1947 | val != 0 |
1948 | } |
1949 | #[doc = "VBUS detection enable Enables VBUS Sensing Comparators in order to detect VBUS presence and/or perform OTG operation." ] |
1950 | #[inline (always)] |
1951 | pub fn set_vbden(&mut self, val: bool) { |
1952 | self.0 = (self.0 & !(0x01 << 21usize)) | (((val as u32) & 0x01) << 21usize); |
1953 | } |
1954 | #[doc = "Secondary detection enable." ] |
1955 | #[inline (always)] |
1956 | pub const fn sden(&self) -> bool { |
1957 | let val = (self.0 >> 22usize) & 0x01; |
1958 | val != 0 |
1959 | } |
1960 | #[doc = "Secondary detection enable." ] |
1961 | #[inline (always)] |
1962 | pub fn set_sden(&mut self, val: bool) { |
1963 | self.0 = (self.0 & !(0x01 << 22usize)) | (((val as u32) & 0x01) << 22usize); |
1964 | } |
1965 | #[doc = "Software override value of the VBUS B-session detection." ] |
1966 | #[inline (always)] |
1967 | pub const fn vbvaloval(&self) -> bool { |
1968 | let val = (self.0 >> 23usize) & 0x01; |
1969 | val != 0 |
1970 | } |
1971 | #[doc = "Software override value of the VBUS B-session detection." ] |
1972 | #[inline (always)] |
1973 | pub fn set_vbvaloval(&mut self, val: bool) { |
1974 | self.0 = (self.0 & !(0x01 << 23usize)) | (((val as u32) & 0x01) << 23usize); |
1975 | } |
1976 | #[doc = "Enables a software override of the VBUS B-session detection." ] |
1977 | #[inline (always)] |
1978 | pub const fn vbvaloven(&self) -> bool { |
1979 | let val = (self.0 >> 24usize) & 0x01; |
1980 | val != 0 |
1981 | } |
1982 | #[doc = "Enables a software override of the VBUS B-session detection." ] |
1983 | #[inline (always)] |
1984 | pub fn set_vbvaloven(&mut self, val: bool) { |
1985 | self.0 = (self.0 & !(0x01 << 24usize)) | (((val as u32) & 0x01) << 24usize); |
1986 | } |
1987 | #[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." ] |
1988 | #[inline (always)] |
1989 | pub const fn forcehostpd(&self) -> bool { |
1990 | let val = (self.0 >> 25usize) & 0x01; |
1991 | val != 0 |
1992 | } |
1993 | #[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." ] |
1994 | #[inline (always)] |
1995 | pub fn set_forcehostpd(&mut self, val: bool) { |
1996 | self.0 = (self.0 & !(0x01 << 25usize)) | (((val as u32) & 0x01) << 25usize); |
1997 | } |
1998 | } |
1999 | impl Default for GccfgV3 { |
2000 | #[inline (always)] |
2001 | fn default() -> GccfgV3 { |
2002 | GccfgV3(0) |
2003 | } |
2004 | } |
2005 | #[doc = "I2C access register" ] |
2006 | #[repr (transparent)] |
2007 | #[derive (Copy, Clone, Eq, PartialEq)] |
2008 | pub struct Gi2cctl(pub u32); |
2009 | impl Gi2cctl { |
2010 | #[doc = "I2C Read/Write Data" ] |
2011 | #[inline (always)] |
2012 | pub const fn rwdata(&self) -> u8 { |
2013 | let val = (self.0 >> 0usize) & 0xff; |
2014 | val as u8 |
2015 | } |
2016 | #[doc = "I2C Read/Write Data" ] |
2017 | #[inline (always)] |
2018 | pub fn set_rwdata(&mut self, val: u8) { |
2019 | self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize); |
2020 | } |
2021 | #[doc = "I2C Register Address" ] |
2022 | #[inline (always)] |
2023 | pub const fn regaddr(&self) -> u8 { |
2024 | let val = (self.0 >> 8usize) & 0xff; |
2025 | val as u8 |
2026 | } |
2027 | #[doc = "I2C Register Address" ] |
2028 | #[inline (always)] |
2029 | pub fn set_regaddr(&mut self, val: u8) { |
2030 | self.0 = (self.0 & !(0xff << 8usize)) | (((val as u32) & 0xff) << 8usize); |
2031 | } |
2032 | #[doc = "I2C Address" ] |
2033 | #[inline (always)] |
2034 | pub const fn addr(&self) -> u8 { |
2035 | let val = (self.0 >> 16usize) & 0x7f; |
2036 | val as u8 |
2037 | } |
2038 | #[doc = "I2C Address" ] |
2039 | #[inline (always)] |
2040 | pub fn set_addr(&mut self, val: u8) { |
2041 | self.0 = (self.0 & !(0x7f << 16usize)) | (((val as u32) & 0x7f) << 16usize); |
2042 | } |
2043 | #[doc = "I2C Enable" ] |
2044 | #[inline (always)] |
2045 | pub const fn i2cen(&self) -> bool { |
2046 | let val = (self.0 >> 23usize) & 0x01; |
2047 | val != 0 |
2048 | } |
2049 | #[doc = "I2C Enable" ] |
2050 | #[inline (always)] |
2051 | pub fn set_i2cen(&mut self, val: bool) { |
2052 | self.0 = (self.0 & !(0x01 << 23usize)) | (((val as u32) & 0x01) << 23usize); |
2053 | } |
2054 | #[doc = "I2C ACK" ] |
2055 | #[inline (always)] |
2056 | pub const fn ack(&self) -> bool { |
2057 | let val = (self.0 >> 24usize) & 0x01; |
2058 | val != 0 |
2059 | } |
2060 | #[doc = "I2C ACK" ] |
2061 | #[inline (always)] |
2062 | pub fn set_ack(&mut self, val: bool) { |
2063 | self.0 = (self.0 & !(0x01 << 24usize)) | (((val as u32) & 0x01) << 24usize); |
2064 | } |
2065 | #[doc = "I2C Device Address" ] |
2066 | #[inline (always)] |
2067 | pub const fn i2cdevadr(&self) -> u8 { |
2068 | let val = (self.0 >> 26usize) & 0x03; |
2069 | val as u8 |
2070 | } |
2071 | #[doc = "I2C Device Address" ] |
2072 | #[inline (always)] |
2073 | pub fn set_i2cdevadr(&mut self, val: u8) { |
2074 | self.0 = (self.0 & !(0x03 << 26usize)) | (((val as u32) & 0x03) << 26usize); |
2075 | } |
2076 | #[doc = "I2C DatSe0 USB mode" ] |
2077 | #[inline (always)] |
2078 | pub const fn i2cdatse0(&self) -> bool { |
2079 | let val = (self.0 >> 28usize) & 0x01; |
2080 | val != 0 |
2081 | } |
2082 | #[doc = "I2C DatSe0 USB mode" ] |
2083 | #[inline (always)] |
2084 | pub fn set_i2cdatse0(&mut self, val: bool) { |
2085 | self.0 = (self.0 & !(0x01 << 28usize)) | (((val as u32) & 0x01) << 28usize); |
2086 | } |
2087 | #[doc = "Read/Write Indicator" ] |
2088 | #[inline (always)] |
2089 | pub const fn rw(&self) -> bool { |
2090 | let val = (self.0 >> 30usize) & 0x01; |
2091 | val != 0 |
2092 | } |
2093 | #[doc = "Read/Write Indicator" ] |
2094 | #[inline (always)] |
2095 | pub fn set_rw(&mut self, val: bool) { |
2096 | self.0 = (self.0 & !(0x01 << 30usize)) | (((val as u32) & 0x01) << 30usize); |
2097 | } |
2098 | #[doc = "I2C Busy/Done" ] |
2099 | #[inline (always)] |
2100 | pub const fn bsydne(&self) -> bool { |
2101 | let val = (self.0 >> 31usize) & 0x01; |
2102 | val != 0 |
2103 | } |
2104 | #[doc = "I2C Busy/Done" ] |
2105 | #[inline (always)] |
2106 | pub fn set_bsydne(&mut self, val: bool) { |
2107 | self.0 = (self.0 & !(0x01 << 31usize)) | (((val as u32) & 0x01) << 31usize); |
2108 | } |
2109 | } |
2110 | impl Default for Gi2cctl { |
2111 | #[inline (always)] |
2112 | fn default() -> Gi2cctl { |
2113 | Gi2cctl(0) |
2114 | } |
2115 | } |
2116 | #[doc = "Interrupt mask register" ] |
2117 | #[repr (transparent)] |
2118 | #[derive (Copy, Clone, Eq, PartialEq)] |
2119 | pub struct Gintmsk(pub u32); |
2120 | impl Gintmsk { |
2121 | #[doc = "Mode mismatch interrupt mask" ] |
2122 | #[inline (always)] |
2123 | pub const fn mmism(&self) -> bool { |
2124 | let val = (self.0 >> 1usize) & 0x01; |
2125 | val != 0 |
2126 | } |
2127 | #[doc = "Mode mismatch interrupt mask" ] |
2128 | #[inline (always)] |
2129 | pub fn set_mmism(&mut self, val: bool) { |
2130 | self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize); |
2131 | } |
2132 | #[doc = "OTG interrupt mask" ] |
2133 | #[inline (always)] |
2134 | pub const fn otgint(&self) -> bool { |
2135 | let val = (self.0 >> 2usize) & 0x01; |
2136 | val != 0 |
2137 | } |
2138 | #[doc = "OTG interrupt mask" ] |
2139 | #[inline (always)] |
2140 | pub fn set_otgint(&mut self, val: bool) { |
2141 | self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize); |
2142 | } |
2143 | #[doc = "Start of frame mask" ] |
2144 | #[inline (always)] |
2145 | pub const fn sofm(&self) -> bool { |
2146 | let val = (self.0 >> 3usize) & 0x01; |
2147 | val != 0 |
2148 | } |
2149 | #[doc = "Start of frame mask" ] |
2150 | #[inline (always)] |
2151 | pub fn set_sofm(&mut self, val: bool) { |
2152 | self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize); |
2153 | } |
2154 | #[doc = "Receive FIFO non-empty mask" ] |
2155 | #[inline (always)] |
2156 | pub const fn rxflvlm(&self) -> bool { |
2157 | let val = (self.0 >> 4usize) & 0x01; |
2158 | val != 0 |
2159 | } |
2160 | #[doc = "Receive FIFO non-empty mask" ] |
2161 | #[inline (always)] |
2162 | pub fn set_rxflvlm(&mut self, val: bool) { |
2163 | self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize); |
2164 | } |
2165 | #[doc = "Non-periodic TxFIFO empty mask" ] |
2166 | #[inline (always)] |
2167 | pub const fn nptxfem(&self) -> bool { |
2168 | let val = (self.0 >> 5usize) & 0x01; |
2169 | val != 0 |
2170 | } |
2171 | #[doc = "Non-periodic TxFIFO empty mask" ] |
2172 | #[inline (always)] |
2173 | pub fn set_nptxfem(&mut self, val: bool) { |
2174 | self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize); |
2175 | } |
2176 | #[doc = "Global non-periodic IN NAK effective mask" ] |
2177 | #[inline (always)] |
2178 | pub const fn ginakeffm(&self) -> bool { |
2179 | let val = (self.0 >> 6usize) & 0x01; |
2180 | val != 0 |
2181 | } |
2182 | #[doc = "Global non-periodic IN NAK effective mask" ] |
2183 | #[inline (always)] |
2184 | pub fn set_ginakeffm(&mut self, val: bool) { |
2185 | self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize); |
2186 | } |
2187 | #[doc = "Global OUT NAK effective mask" ] |
2188 | #[inline (always)] |
2189 | pub const fn gonakeffm(&self) -> bool { |
2190 | let val = (self.0 >> 7usize) & 0x01; |
2191 | val != 0 |
2192 | } |
2193 | #[doc = "Global OUT NAK effective mask" ] |
2194 | #[inline (always)] |
2195 | pub fn set_gonakeffm(&mut self, val: bool) { |
2196 | self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize); |
2197 | } |
2198 | #[doc = "Early suspend mask" ] |
2199 | #[inline (always)] |
2200 | pub const fn esuspm(&self) -> bool { |
2201 | let val = (self.0 >> 10usize) & 0x01; |
2202 | val != 0 |
2203 | } |
2204 | #[doc = "Early suspend mask" ] |
2205 | #[inline (always)] |
2206 | pub fn set_esuspm(&mut self, val: bool) { |
2207 | self.0 = (self.0 & !(0x01 << 10usize)) | (((val as u32) & 0x01) << 10usize); |
2208 | } |
2209 | #[doc = "USB suspend mask" ] |
2210 | #[inline (always)] |
2211 | pub const fn usbsuspm(&self) -> bool { |
2212 | let val = (self.0 >> 11usize) & 0x01; |
2213 | val != 0 |
2214 | } |
2215 | #[doc = "USB suspend mask" ] |
2216 | #[inline (always)] |
2217 | pub fn set_usbsuspm(&mut self, val: bool) { |
2218 | self.0 = (self.0 & !(0x01 << 11usize)) | (((val as u32) & 0x01) << 11usize); |
2219 | } |
2220 | #[doc = "USB reset mask" ] |
2221 | #[inline (always)] |
2222 | pub const fn usbrst(&self) -> bool { |
2223 | let val = (self.0 >> 12usize) & 0x01; |
2224 | val != 0 |
2225 | } |
2226 | #[doc = "USB reset mask" ] |
2227 | #[inline (always)] |
2228 | pub fn set_usbrst(&mut self, val: bool) { |
2229 | self.0 = (self.0 & !(0x01 << 12usize)) | (((val as u32) & 0x01) << 12usize); |
2230 | } |
2231 | #[doc = "Enumeration done mask" ] |
2232 | #[inline (always)] |
2233 | pub const fn enumdnem(&self) -> bool { |
2234 | let val = (self.0 >> 13usize) & 0x01; |
2235 | val != 0 |
2236 | } |
2237 | #[doc = "Enumeration done mask" ] |
2238 | #[inline (always)] |
2239 | pub fn set_enumdnem(&mut self, val: bool) { |
2240 | self.0 = (self.0 & !(0x01 << 13usize)) | (((val as u32) & 0x01) << 13usize); |
2241 | } |
2242 | #[doc = "Isochronous OUT packet dropped interrupt mask" ] |
2243 | #[inline (always)] |
2244 | pub const fn isoodrpm(&self) -> bool { |
2245 | let val = (self.0 >> 14usize) & 0x01; |
2246 | val != 0 |
2247 | } |
2248 | #[doc = "Isochronous OUT packet dropped interrupt mask" ] |
2249 | #[inline (always)] |
2250 | pub fn set_isoodrpm(&mut self, val: bool) { |
2251 | self.0 = (self.0 & !(0x01 << 14usize)) | (((val as u32) & 0x01) << 14usize); |
2252 | } |
2253 | #[doc = "End of periodic frame interrupt mask" ] |
2254 | #[inline (always)] |
2255 | pub const fn eopfm(&self) -> bool { |
2256 | let val = (self.0 >> 15usize) & 0x01; |
2257 | val != 0 |
2258 | } |
2259 | #[doc = "End of periodic frame interrupt mask" ] |
2260 | #[inline (always)] |
2261 | pub fn set_eopfm(&mut self, val: bool) { |
2262 | self.0 = (self.0 & !(0x01 << 15usize)) | (((val as u32) & 0x01) << 15usize); |
2263 | } |
2264 | #[doc = "Endpoint mismatch interrupt mask" ] |
2265 | #[inline (always)] |
2266 | pub const fn epmism(&self) -> bool { |
2267 | let val = (self.0 >> 17usize) & 0x01; |
2268 | val != 0 |
2269 | } |
2270 | #[doc = "Endpoint mismatch interrupt mask" ] |
2271 | #[inline (always)] |
2272 | pub fn set_epmism(&mut self, val: bool) { |
2273 | self.0 = (self.0 & !(0x01 << 17usize)) | (((val as u32) & 0x01) << 17usize); |
2274 | } |
2275 | #[doc = "IN endpoints interrupt mask" ] |
2276 | #[inline (always)] |
2277 | pub const fn iepint(&self) -> bool { |
2278 | let val = (self.0 >> 18usize) & 0x01; |
2279 | val != 0 |
2280 | } |
2281 | #[doc = "IN endpoints interrupt mask" ] |
2282 | #[inline (always)] |
2283 | pub fn set_iepint(&mut self, val: bool) { |
2284 | self.0 = (self.0 & !(0x01 << 18usize)) | (((val as u32) & 0x01) << 18usize); |
2285 | } |
2286 | #[doc = "OUT endpoints interrupt mask" ] |
2287 | #[inline (always)] |
2288 | pub const fn oepint(&self) -> bool { |
2289 | let val = (self.0 >> 19usize) & 0x01; |
2290 | val != 0 |
2291 | } |
2292 | #[doc = "OUT endpoints interrupt mask" ] |
2293 | #[inline (always)] |
2294 | pub fn set_oepint(&mut self, val: bool) { |
2295 | self.0 = (self.0 & !(0x01 << 19usize)) | (((val as u32) & 0x01) << 19usize); |
2296 | } |
2297 | #[doc = "Incomplete isochronous IN transfer mask" ] |
2298 | #[inline (always)] |
2299 | pub const fn iisoixfrm(&self) -> bool { |
2300 | let val = (self.0 >> 20usize) & 0x01; |
2301 | val != 0 |
2302 | } |
2303 | #[doc = "Incomplete isochronous IN transfer mask" ] |
2304 | #[inline (always)] |
2305 | pub fn set_iisoixfrm(&mut self, val: bool) { |
2306 | self.0 = (self.0 & !(0x01 << 20usize)) | (((val as u32) & 0x01) << 20usize); |
2307 | } |
2308 | #[doc = "Incomplete periodic transfer mask (host mode) / Incomplete isochronous OUT transfer mask (device mode)" ] |
2309 | #[inline (always)] |
2310 | pub const fn ipxfrm_iisooxfrm(&self) -> bool { |
2311 | let val = (self.0 >> 21usize) & 0x01; |
2312 | val != 0 |
2313 | } |
2314 | #[doc = "Incomplete periodic transfer mask (host mode) / Incomplete isochronous OUT transfer mask (device mode)" ] |
2315 | #[inline (always)] |
2316 | pub fn set_ipxfrm_iisooxfrm(&mut self, val: bool) { |
2317 | self.0 = (self.0 & !(0x01 << 21usize)) | (((val as u32) & 0x01) << 21usize); |
2318 | } |
2319 | #[doc = "Data fetch suspended mask" ] |
2320 | #[inline (always)] |
2321 | pub const fn fsuspm(&self) -> bool { |
2322 | let val = (self.0 >> 22usize) & 0x01; |
2323 | val != 0 |
2324 | } |
2325 | #[doc = "Data fetch suspended mask" ] |
2326 | #[inline (always)] |
2327 | pub fn set_fsuspm(&mut self, val: bool) { |
2328 | self.0 = (self.0 & !(0x01 << 22usize)) | (((val as u32) & 0x01) << 22usize); |
2329 | } |
2330 | #[doc = "Reset detected interrupt mask" ] |
2331 | #[inline (always)] |
2332 | pub const fn rstde(&self) -> bool { |
2333 | let val = (self.0 >> 23usize) & 0x01; |
2334 | val != 0 |
2335 | } |
2336 | #[doc = "Reset detected interrupt mask" ] |
2337 | #[inline (always)] |
2338 | pub fn set_rstde(&mut self, val: bool) { |
2339 | self.0 = (self.0 & !(0x01 << 23usize)) | (((val as u32) & 0x01) << 23usize); |
2340 | } |
2341 | #[doc = "Host port interrupt mask" ] |
2342 | #[inline (always)] |
2343 | pub const fn prtim(&self) -> bool { |
2344 | let val = (self.0 >> 24usize) & 0x01; |
2345 | val != 0 |
2346 | } |
2347 | #[doc = "Host port interrupt mask" ] |
2348 | #[inline (always)] |
2349 | pub fn set_prtim(&mut self, val: bool) { |
2350 | self.0 = (self.0 & !(0x01 << 24usize)) | (((val as u32) & 0x01) << 24usize); |
2351 | } |
2352 | #[doc = "Host channels interrupt mask" ] |
2353 | #[inline (always)] |
2354 | pub const fn hcim(&self) -> bool { |
2355 | let val = (self.0 >> 25usize) & 0x01; |
2356 | val != 0 |
2357 | } |
2358 | #[doc = "Host channels interrupt mask" ] |
2359 | #[inline (always)] |
2360 | pub fn set_hcim(&mut self, val: bool) { |
2361 | self.0 = (self.0 & !(0x01 << 25usize)) | (((val as u32) & 0x01) << 25usize); |
2362 | } |
2363 | #[doc = "Periodic TxFIFO empty mask" ] |
2364 | #[inline (always)] |
2365 | pub const fn ptxfem(&self) -> bool { |
2366 | let val = (self.0 >> 26usize) & 0x01; |
2367 | val != 0 |
2368 | } |
2369 | #[doc = "Periodic TxFIFO empty mask" ] |
2370 | #[inline (always)] |
2371 | pub fn set_ptxfem(&mut self, val: bool) { |
2372 | self.0 = (self.0 & !(0x01 << 26usize)) | (((val as u32) & 0x01) << 26usize); |
2373 | } |
2374 | #[doc = "LPM interrupt mask" ] |
2375 | #[inline (always)] |
2376 | pub const fn lpmintm(&self) -> bool { |
2377 | let val = (self.0 >> 27usize) & 0x01; |
2378 | val != 0 |
2379 | } |
2380 | #[doc = "LPM interrupt mask" ] |
2381 | #[inline (always)] |
2382 | pub fn set_lpmintm(&mut self, val: bool) { |
2383 | self.0 = (self.0 & !(0x01 << 27usize)) | (((val as u32) & 0x01) << 27usize); |
2384 | } |
2385 | #[doc = "Connector ID status change mask" ] |
2386 | #[inline (always)] |
2387 | pub const fn cidschgm(&self) -> bool { |
2388 | let val = (self.0 >> 28usize) & 0x01; |
2389 | val != 0 |
2390 | } |
2391 | #[doc = "Connector ID status change mask" ] |
2392 | #[inline (always)] |
2393 | pub fn set_cidschgm(&mut self, val: bool) { |
2394 | self.0 = (self.0 & !(0x01 << 28usize)) | (((val as u32) & 0x01) << 28usize); |
2395 | } |
2396 | #[doc = "Disconnect detected interrupt mask" ] |
2397 | #[inline (always)] |
2398 | pub const fn discint(&self) -> bool { |
2399 | let val = (self.0 >> 29usize) & 0x01; |
2400 | val != 0 |
2401 | } |
2402 | #[doc = "Disconnect detected interrupt mask" ] |
2403 | #[inline (always)] |
2404 | pub fn set_discint(&mut self, val: bool) { |
2405 | self.0 = (self.0 & !(0x01 << 29usize)) | (((val as u32) & 0x01) << 29usize); |
2406 | } |
2407 | #[doc = "Session request/new session detected interrupt mask" ] |
2408 | #[inline (always)] |
2409 | pub const fn srqim(&self) -> bool { |
2410 | let val = (self.0 >> 30usize) & 0x01; |
2411 | val != 0 |
2412 | } |
2413 | #[doc = "Session request/new session detected interrupt mask" ] |
2414 | #[inline (always)] |
2415 | pub fn set_srqim(&mut self, val: bool) { |
2416 | self.0 = (self.0 & !(0x01 << 30usize)) | (((val as u32) & 0x01) << 30usize); |
2417 | } |
2418 | #[doc = "Resume/remote wakeup detected interrupt mask" ] |
2419 | #[inline (always)] |
2420 | pub const fn wuim(&self) -> bool { |
2421 | let val = (self.0 >> 31usize) & 0x01; |
2422 | val != 0 |
2423 | } |
2424 | #[doc = "Resume/remote wakeup detected interrupt mask" ] |
2425 | #[inline (always)] |
2426 | pub fn set_wuim(&mut self, val: bool) { |
2427 | self.0 = (self.0 & !(0x01 << 31usize)) | (((val as u32) & 0x01) << 31usize); |
2428 | } |
2429 | } |
2430 | impl Default for Gintmsk { |
2431 | #[inline (always)] |
2432 | fn default() -> Gintmsk { |
2433 | Gintmsk(0) |
2434 | } |
2435 | } |
2436 | #[doc = "Core interrupt register" ] |
2437 | #[repr (transparent)] |
2438 | #[derive (Copy, Clone, Eq, PartialEq)] |
2439 | pub struct Gintsts(pub u32); |
2440 | impl Gintsts { |
2441 | #[doc = "Current mode of operation" ] |
2442 | #[inline (always)] |
2443 | pub const fn cmod(&self) -> bool { |
2444 | let val = (self.0 >> 0usize) & 0x01; |
2445 | val != 0 |
2446 | } |
2447 | #[doc = "Current mode of operation" ] |
2448 | #[inline (always)] |
2449 | pub fn set_cmod(&mut self, val: bool) { |
2450 | self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize); |
2451 | } |
2452 | #[doc = "Mode mismatch interrupt" ] |
2453 | #[inline (always)] |
2454 | pub const fn mmis(&self) -> bool { |
2455 | let val = (self.0 >> 1usize) & 0x01; |
2456 | val != 0 |
2457 | } |
2458 | #[doc = "Mode mismatch interrupt" ] |
2459 | #[inline (always)] |
2460 | pub fn set_mmis(&mut self, val: bool) { |
2461 | self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize); |
2462 | } |
2463 | #[doc = "OTG interrupt" ] |
2464 | #[inline (always)] |
2465 | pub const fn otgint(&self) -> bool { |
2466 | let val = (self.0 >> 2usize) & 0x01; |
2467 | val != 0 |
2468 | } |
2469 | #[doc = "OTG interrupt" ] |
2470 | #[inline (always)] |
2471 | pub fn set_otgint(&mut self, val: bool) { |
2472 | self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize); |
2473 | } |
2474 | #[doc = "Start of frame" ] |
2475 | #[inline (always)] |
2476 | pub const fn sof(&self) -> bool { |
2477 | let val = (self.0 >> 3usize) & 0x01; |
2478 | val != 0 |
2479 | } |
2480 | #[doc = "Start of frame" ] |
2481 | #[inline (always)] |
2482 | pub fn set_sof(&mut self, val: bool) { |
2483 | self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize); |
2484 | } |
2485 | #[doc = "RxFIFO non-empty" ] |
2486 | #[inline (always)] |
2487 | pub const fn rxflvl(&self) -> bool { |
2488 | let val = (self.0 >> 4usize) & 0x01; |
2489 | val != 0 |
2490 | } |
2491 | #[doc = "RxFIFO non-empty" ] |
2492 | #[inline (always)] |
2493 | pub fn set_rxflvl(&mut self, val: bool) { |
2494 | self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize); |
2495 | } |
2496 | #[doc = "Non-periodic TxFIFO empty" ] |
2497 | #[inline (always)] |
2498 | pub const fn nptxfe(&self) -> bool { |
2499 | let val = (self.0 >> 5usize) & 0x01; |
2500 | val != 0 |
2501 | } |
2502 | #[doc = "Non-periodic TxFIFO empty" ] |
2503 | #[inline (always)] |
2504 | pub fn set_nptxfe(&mut self, val: bool) { |
2505 | self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize); |
2506 | } |
2507 | #[doc = "Global IN non-periodic NAK effective" ] |
2508 | #[inline (always)] |
2509 | pub const fn ginakeff(&self) -> bool { |
2510 | let val = (self.0 >> 6usize) & 0x01; |
2511 | val != 0 |
2512 | } |
2513 | #[doc = "Global IN non-periodic NAK effective" ] |
2514 | #[inline (always)] |
2515 | pub fn set_ginakeff(&mut self, val: bool) { |
2516 | self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize); |
2517 | } |
2518 | #[doc = "Global OUT NAK effective" ] |
2519 | #[inline (always)] |
2520 | pub const fn goutnakeff(&self) -> bool { |
2521 | let val = (self.0 >> 7usize) & 0x01; |
2522 | val != 0 |
2523 | } |
2524 | #[doc = "Global OUT NAK effective" ] |
2525 | #[inline (always)] |
2526 | pub fn set_goutnakeff(&mut self, val: bool) { |
2527 | self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize); |
2528 | } |
2529 | #[doc = "Early suspend" ] |
2530 | #[inline (always)] |
2531 | pub const fn esusp(&self) -> bool { |
2532 | let val = (self.0 >> 10usize) & 0x01; |
2533 | val != 0 |
2534 | } |
2535 | #[doc = "Early suspend" ] |
2536 | #[inline (always)] |
2537 | pub fn set_esusp(&mut self, val: bool) { |
2538 | self.0 = (self.0 & !(0x01 << 10usize)) | (((val as u32) & 0x01) << 10usize); |
2539 | } |
2540 | #[doc = "USB suspend" ] |
2541 | #[inline (always)] |
2542 | pub const fn usbsusp(&self) -> bool { |
2543 | let val = (self.0 >> 11usize) & 0x01; |
2544 | val != 0 |
2545 | } |
2546 | #[doc = "USB suspend" ] |
2547 | #[inline (always)] |
2548 | pub fn set_usbsusp(&mut self, val: bool) { |
2549 | self.0 = (self.0 & !(0x01 << 11usize)) | (((val as u32) & 0x01) << 11usize); |
2550 | } |
2551 | #[doc = "USB reset" ] |
2552 | #[inline (always)] |
2553 | pub const fn usbrst(&self) -> bool { |
2554 | let val = (self.0 >> 12usize) & 0x01; |
2555 | val != 0 |
2556 | } |
2557 | #[doc = "USB reset" ] |
2558 | #[inline (always)] |
2559 | pub fn set_usbrst(&mut self, val: bool) { |
2560 | self.0 = (self.0 & !(0x01 << 12usize)) | (((val as u32) & 0x01) << 12usize); |
2561 | } |
2562 | #[doc = "Enumeration done" ] |
2563 | #[inline (always)] |
2564 | pub const fn enumdne(&self) -> bool { |
2565 | let val = (self.0 >> 13usize) & 0x01; |
2566 | val != 0 |
2567 | } |
2568 | #[doc = "Enumeration done" ] |
2569 | #[inline (always)] |
2570 | pub fn set_enumdne(&mut self, val: bool) { |
2571 | self.0 = (self.0 & !(0x01 << 13usize)) | (((val as u32) & 0x01) << 13usize); |
2572 | } |
2573 | #[doc = "Isochronous OUT packet dropped interrupt" ] |
2574 | #[inline (always)] |
2575 | pub const fn isoodrp(&self) -> bool { |
2576 | let val = (self.0 >> 14usize) & 0x01; |
2577 | val != 0 |
2578 | } |
2579 | #[doc = "Isochronous OUT packet dropped interrupt" ] |
2580 | #[inline (always)] |
2581 | pub fn set_isoodrp(&mut self, val: bool) { |
2582 | self.0 = (self.0 & !(0x01 << 14usize)) | (((val as u32) & 0x01) << 14usize); |
2583 | } |
2584 | #[doc = "End of periodic frame interrupt" ] |
2585 | #[inline (always)] |
2586 | pub const fn eopf(&self) -> bool { |
2587 | let val = (self.0 >> 15usize) & 0x01; |
2588 | val != 0 |
2589 | } |
2590 | #[doc = "End of periodic frame interrupt" ] |
2591 | #[inline (always)] |
2592 | pub fn set_eopf(&mut self, val: bool) { |
2593 | self.0 = (self.0 & !(0x01 << 15usize)) | (((val as u32) & 0x01) << 15usize); |
2594 | } |
2595 | #[doc = "IN endpoint interrupt" ] |
2596 | #[inline (always)] |
2597 | pub const fn iepint(&self) -> bool { |
2598 | let val = (self.0 >> 18usize) & 0x01; |
2599 | val != 0 |
2600 | } |
2601 | #[doc = "IN endpoint interrupt" ] |
2602 | #[inline (always)] |
2603 | pub fn set_iepint(&mut self, val: bool) { |
2604 | self.0 = (self.0 & !(0x01 << 18usize)) | (((val as u32) & 0x01) << 18usize); |
2605 | } |
2606 | #[doc = "OUT endpoint interrupt" ] |
2607 | #[inline (always)] |
2608 | pub const fn oepint(&self) -> bool { |
2609 | let val = (self.0 >> 19usize) & 0x01; |
2610 | val != 0 |
2611 | } |
2612 | #[doc = "OUT endpoint interrupt" ] |
2613 | #[inline (always)] |
2614 | pub fn set_oepint(&mut self, val: bool) { |
2615 | self.0 = (self.0 & !(0x01 << 19usize)) | (((val as u32) & 0x01) << 19usize); |
2616 | } |
2617 | #[doc = "Incomplete isochronous IN transfer" ] |
2618 | #[inline (always)] |
2619 | pub const fn iisoixfr(&self) -> bool { |
2620 | let val = (self.0 >> 20usize) & 0x01; |
2621 | val != 0 |
2622 | } |
2623 | #[doc = "Incomplete isochronous IN transfer" ] |
2624 | #[inline (always)] |
2625 | pub fn set_iisoixfr(&mut self, val: bool) { |
2626 | self.0 = (self.0 & !(0x01 << 20usize)) | (((val as u32) & 0x01) << 20usize); |
2627 | } |
2628 | #[doc = "Incomplete periodic transfer (host mode) / Incomplete isochronous OUT transfer (device mode)" ] |
2629 | #[inline (always)] |
2630 | pub const fn ipxfr_incompisoout(&self) -> bool { |
2631 | let val = (self.0 >> 21usize) & 0x01; |
2632 | val != 0 |
2633 | } |
2634 | #[doc = "Incomplete periodic transfer (host mode) / Incomplete isochronous OUT transfer (device mode)" ] |
2635 | #[inline (always)] |
2636 | pub fn set_ipxfr_incompisoout(&mut self, val: bool) { |
2637 | self.0 = (self.0 & !(0x01 << 21usize)) | (((val as u32) & 0x01) << 21usize); |
2638 | } |
2639 | #[doc = "Data fetch suspended" ] |
2640 | #[inline (always)] |
2641 | pub const fn datafsusp(&self) -> bool { |
2642 | let val = (self.0 >> 22usize) & 0x01; |
2643 | val != 0 |
2644 | } |
2645 | #[doc = "Data fetch suspended" ] |
2646 | #[inline (always)] |
2647 | pub fn set_datafsusp(&mut self, val: bool) { |
2648 | self.0 = (self.0 & !(0x01 << 22usize)) | (((val as u32) & 0x01) << 22usize); |
2649 | } |
2650 | #[doc = "Host port interrupt" ] |
2651 | #[inline (always)] |
2652 | pub const fn hprtint(&self) -> bool { |
2653 | let val = (self.0 >> 24usize) & 0x01; |
2654 | val != 0 |
2655 | } |
2656 | #[doc = "Host port interrupt" ] |
2657 | #[inline (always)] |
2658 | pub fn set_hprtint(&mut self, val: bool) { |
2659 | self.0 = (self.0 & !(0x01 << 24usize)) | (((val as u32) & 0x01) << 24usize); |
2660 | } |
2661 | #[doc = "Host channels interrupt" ] |
2662 | #[inline (always)] |
2663 | pub const fn hcint(&self) -> bool { |
2664 | let val = (self.0 >> 25usize) & 0x01; |
2665 | val != 0 |
2666 | } |
2667 | #[doc = "Host channels interrupt" ] |
2668 | #[inline (always)] |
2669 | pub fn set_hcint(&mut self, val: bool) { |
2670 | self.0 = (self.0 & !(0x01 << 25usize)) | (((val as u32) & 0x01) << 25usize); |
2671 | } |
2672 | #[doc = "Periodic TxFIFO empty" ] |
2673 | #[inline (always)] |
2674 | pub const fn ptxfe(&self) -> bool { |
2675 | let val = (self.0 >> 26usize) & 0x01; |
2676 | val != 0 |
2677 | } |
2678 | #[doc = "Periodic TxFIFO empty" ] |
2679 | #[inline (always)] |
2680 | pub fn set_ptxfe(&mut self, val: bool) { |
2681 | self.0 = (self.0 & !(0x01 << 26usize)) | (((val as u32) & 0x01) << 26usize); |
2682 | } |
2683 | #[doc = "Connector ID status change" ] |
2684 | #[inline (always)] |
2685 | pub const fn cidschg(&self) -> bool { |
2686 | let val = (self.0 >> 28usize) & 0x01; |
2687 | val != 0 |
2688 | } |
2689 | #[doc = "Connector ID status change" ] |
2690 | #[inline (always)] |
2691 | pub fn set_cidschg(&mut self, val: bool) { |
2692 | self.0 = (self.0 & !(0x01 << 28usize)) | (((val as u32) & 0x01) << 28usize); |
2693 | } |
2694 | #[doc = "Disconnect detected interrupt" ] |
2695 | #[inline (always)] |
2696 | pub const fn discint(&self) -> bool { |
2697 | let val = (self.0 >> 29usize) & 0x01; |
2698 | val != 0 |
2699 | } |
2700 | #[doc = "Disconnect detected interrupt" ] |
2701 | #[inline (always)] |
2702 | pub fn set_discint(&mut self, val: bool) { |
2703 | self.0 = (self.0 & !(0x01 << 29usize)) | (((val as u32) & 0x01) << 29usize); |
2704 | } |
2705 | #[doc = "Session request/new session detected interrupt" ] |
2706 | #[inline (always)] |
2707 | pub const fn srqint(&self) -> bool { |
2708 | let val = (self.0 >> 30usize) & 0x01; |
2709 | val != 0 |
2710 | } |
2711 | #[doc = "Session request/new session detected interrupt" ] |
2712 | #[inline (always)] |
2713 | pub fn set_srqint(&mut self, val: bool) { |
2714 | self.0 = (self.0 & !(0x01 << 30usize)) | (((val as u32) & 0x01) << 30usize); |
2715 | } |
2716 | #[doc = "Resume/remote wakeup detected interrupt" ] |
2717 | #[inline (always)] |
2718 | pub const fn wkupint(&self) -> bool { |
2719 | let val = (self.0 >> 31usize) & 0x01; |
2720 | val != 0 |
2721 | } |
2722 | #[doc = "Resume/remote wakeup detected interrupt" ] |
2723 | #[inline (always)] |
2724 | pub fn set_wkupint(&mut self, val: bool) { |
2725 | self.0 = (self.0 & !(0x01 << 31usize)) | (((val as u32) & 0x01) << 31usize); |
2726 | } |
2727 | } |
2728 | impl Default for Gintsts { |
2729 | #[inline (always)] |
2730 | fn default() -> Gintsts { |
2731 | Gintsts(0) |
2732 | } |
2733 | } |
2734 | #[doc = "Core LPM configuration register" ] |
2735 | #[repr (transparent)] |
2736 | #[derive (Copy, Clone, Eq, PartialEq)] |
2737 | pub struct Glpmcfg(pub u32); |
2738 | impl Glpmcfg { |
2739 | #[doc = "LPM support enable" ] |
2740 | #[inline (always)] |
2741 | pub const fn lpmen(&self) -> bool { |
2742 | let val = (self.0 >> 0usize) & 0x01; |
2743 | val != 0 |
2744 | } |
2745 | #[doc = "LPM support enable" ] |
2746 | #[inline (always)] |
2747 | pub fn set_lpmen(&mut self, val: bool) { |
2748 | self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize); |
2749 | } |
2750 | #[doc = "LPM token acknowledge enable" ] |
2751 | #[inline (always)] |
2752 | pub const fn lpmack(&self) -> bool { |
2753 | let val = (self.0 >> 1usize) & 0x01; |
2754 | val != 0 |
2755 | } |
2756 | #[doc = "LPM token acknowledge enable" ] |
2757 | #[inline (always)] |
2758 | pub fn set_lpmack(&mut self, val: bool) { |
2759 | self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize); |
2760 | } |
2761 | #[doc = "Best effort service latency" ] |
2762 | #[inline (always)] |
2763 | pub const fn besl(&self) -> u8 { |
2764 | let val = (self.0 >> 2usize) & 0x0f; |
2765 | val as u8 |
2766 | } |
2767 | #[doc = "Best effort service latency" ] |
2768 | #[inline (always)] |
2769 | pub fn set_besl(&mut self, val: u8) { |
2770 | self.0 = (self.0 & !(0x0f << 2usize)) | (((val as u32) & 0x0f) << 2usize); |
2771 | } |
2772 | #[doc = "bRemoteWake value" ] |
2773 | #[inline (always)] |
2774 | pub const fn remwake(&self) -> bool { |
2775 | let val = (self.0 >> 6usize) & 0x01; |
2776 | val != 0 |
2777 | } |
2778 | #[doc = "bRemoteWake value" ] |
2779 | #[inline (always)] |
2780 | pub fn set_remwake(&mut self, val: bool) { |
2781 | self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize); |
2782 | } |
2783 | #[doc = "L1 Shallow Sleep enable" ] |
2784 | #[inline (always)] |
2785 | pub const fn l1ssen(&self) -> bool { |
2786 | let val = (self.0 >> 7usize) & 0x01; |
2787 | val != 0 |
2788 | } |
2789 | #[doc = "L1 Shallow Sleep enable" ] |
2790 | #[inline (always)] |
2791 | pub fn set_l1ssen(&mut self, val: bool) { |
2792 | self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize); |
2793 | } |
2794 | #[doc = "BESL threshold" ] |
2795 | #[inline (always)] |
2796 | pub const fn beslthrs(&self) -> u8 { |
2797 | let val = (self.0 >> 8usize) & 0x0f; |
2798 | val as u8 |
2799 | } |
2800 | #[doc = "BESL threshold" ] |
2801 | #[inline (always)] |
2802 | pub fn set_beslthrs(&mut self, val: u8) { |
2803 | self.0 = (self.0 & !(0x0f << 8usize)) | (((val as u32) & 0x0f) << 8usize); |
2804 | } |
2805 | #[doc = "L1 deep sleep enable" ] |
2806 | #[inline (always)] |
2807 | pub const fn l1dsen(&self) -> bool { |
2808 | let val = (self.0 >> 12usize) & 0x01; |
2809 | val != 0 |
2810 | } |
2811 | #[doc = "L1 deep sleep enable" ] |
2812 | #[inline (always)] |
2813 | pub fn set_l1dsen(&mut self, val: bool) { |
2814 | self.0 = (self.0 & !(0x01 << 12usize)) | (((val as u32) & 0x01) << 12usize); |
2815 | } |
2816 | #[doc = "LPM response" ] |
2817 | #[inline (always)] |
2818 | pub const fn lpmrst(&self) -> u8 { |
2819 | let val = (self.0 >> 13usize) & 0x03; |
2820 | val as u8 |
2821 | } |
2822 | #[doc = "LPM response" ] |
2823 | #[inline (always)] |
2824 | pub fn set_lpmrst(&mut self, val: u8) { |
2825 | self.0 = (self.0 & !(0x03 << 13usize)) | (((val as u32) & 0x03) << 13usize); |
2826 | } |
2827 | #[doc = "Port sleep status" ] |
2828 | #[inline (always)] |
2829 | pub const fn slpsts(&self) -> bool { |
2830 | let val = (self.0 >> 15usize) & 0x01; |
2831 | val != 0 |
2832 | } |
2833 | #[doc = "Port sleep status" ] |
2834 | #[inline (always)] |
2835 | pub fn set_slpsts(&mut self, val: bool) { |
2836 | self.0 = (self.0 & !(0x01 << 15usize)) | (((val as u32) & 0x01) << 15usize); |
2837 | } |
2838 | #[doc = "Sleep State Resume OK" ] |
2839 | #[inline (always)] |
2840 | pub const fn l1rsmok(&self) -> bool { |
2841 | let val = (self.0 >> 16usize) & 0x01; |
2842 | val != 0 |
2843 | } |
2844 | #[doc = "Sleep State Resume OK" ] |
2845 | #[inline (always)] |
2846 | pub fn set_l1rsmok(&mut self, val: bool) { |
2847 | self.0 = (self.0 & !(0x01 << 16usize)) | (((val as u32) & 0x01) << 16usize); |
2848 | } |
2849 | #[doc = "LPM Channel Index" ] |
2850 | #[inline (always)] |
2851 | pub const fn lpmchidx(&self) -> u8 { |
2852 | let val = (self.0 >> 17usize) & 0x0f; |
2853 | val as u8 |
2854 | } |
2855 | #[doc = "LPM Channel Index" ] |
2856 | #[inline (always)] |
2857 | pub fn set_lpmchidx(&mut self, val: u8) { |
2858 | self.0 = (self.0 & !(0x0f << 17usize)) | (((val as u32) & 0x0f) << 17usize); |
2859 | } |
2860 | #[doc = "LPM retry count" ] |
2861 | #[inline (always)] |
2862 | pub const fn lpmrcnt(&self) -> u8 { |
2863 | let val = (self.0 >> 21usize) & 0x07; |
2864 | val as u8 |
2865 | } |
2866 | #[doc = "LPM retry count" ] |
2867 | #[inline (always)] |
2868 | pub fn set_lpmrcnt(&mut self, val: u8) { |
2869 | self.0 = (self.0 & !(0x07 << 21usize)) | (((val as u32) & 0x07) << 21usize); |
2870 | } |
2871 | #[doc = "Send LPM transaction" ] |
2872 | #[inline (always)] |
2873 | pub const fn sndlpm(&self) -> bool { |
2874 | let val = (self.0 >> 24usize) & 0x01; |
2875 | val != 0 |
2876 | } |
2877 | #[doc = "Send LPM transaction" ] |
2878 | #[inline (always)] |
2879 | pub fn set_sndlpm(&mut self, val: bool) { |
2880 | self.0 = (self.0 & !(0x01 << 24usize)) | (((val as u32) & 0x01) << 24usize); |
2881 | } |
2882 | #[doc = "LPM retry count status" ] |
2883 | #[inline (always)] |
2884 | pub const fn lpmrcntsts(&self) -> u8 { |
2885 | let val = (self.0 >> 25usize) & 0x07; |
2886 | val as u8 |
2887 | } |
2888 | #[doc = "LPM retry count status" ] |
2889 | #[inline (always)] |
2890 | pub fn set_lpmrcntsts(&mut self, val: u8) { |
2891 | self.0 = (self.0 & !(0x07 << 25usize)) | (((val as u32) & 0x07) << 25usize); |
2892 | } |
2893 | #[doc = "Enable best effort service latency" ] |
2894 | #[inline (always)] |
2895 | pub const fn enbesl(&self) -> bool { |
2896 | let val = (self.0 >> 28usize) & 0x01; |
2897 | val != 0 |
2898 | } |
2899 | #[doc = "Enable best effort service latency" ] |
2900 | #[inline (always)] |
2901 | pub fn set_enbesl(&mut self, val: bool) { |
2902 | self.0 = (self.0 & !(0x01 << 28usize)) | (((val as u32) & 0x01) << 28usize); |
2903 | } |
2904 | } |
2905 | impl Default for Glpmcfg { |
2906 | #[inline (always)] |
2907 | fn default() -> Glpmcfg { |
2908 | Glpmcfg(0) |
2909 | } |
2910 | } |
2911 | #[doc = "Control and status register" ] |
2912 | #[repr (transparent)] |
2913 | #[derive (Copy, Clone, Eq, PartialEq)] |
2914 | pub struct Gotgctl(pub u32); |
2915 | impl Gotgctl { |
2916 | #[doc = "Session request success" ] |
2917 | #[inline (always)] |
2918 | pub const fn srqscs(&self) -> bool { |
2919 | let val = (self.0 >> 0usize) & 0x01; |
2920 | val != 0 |
2921 | } |
2922 | #[doc = "Session request success" ] |
2923 | #[inline (always)] |
2924 | pub fn set_srqscs(&mut self, val: bool) { |
2925 | self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize); |
2926 | } |
2927 | #[doc = "Session request" ] |
2928 | #[inline (always)] |
2929 | pub const fn srq(&self) -> bool { |
2930 | let val = (self.0 >> 1usize) & 0x01; |
2931 | val != 0 |
2932 | } |
2933 | #[doc = "Session request" ] |
2934 | #[inline (always)] |
2935 | pub fn set_srq(&mut self, val: bool) { |
2936 | self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize); |
2937 | } |
2938 | #[doc = "VBUS valid override enable" ] |
2939 | #[inline (always)] |
2940 | pub const fn vbvaloen(&self) -> bool { |
2941 | let val = (self.0 >> 2usize) & 0x01; |
2942 | val != 0 |
2943 | } |
2944 | #[doc = "VBUS valid override enable" ] |
2945 | #[inline (always)] |
2946 | pub fn set_vbvaloen(&mut self, val: bool) { |
2947 | self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize); |
2948 | } |
2949 | #[doc = "VBUS valid override value" ] |
2950 | #[inline (always)] |
2951 | pub const fn vbvaloval(&self) -> bool { |
2952 | let val = (self.0 >> 3usize) & 0x01; |
2953 | val != 0 |
2954 | } |
2955 | #[doc = "VBUS valid override value" ] |
2956 | #[inline (always)] |
2957 | pub fn set_vbvaloval(&mut self, val: bool) { |
2958 | self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize); |
2959 | } |
2960 | #[doc = "A-peripheral session valid override enable" ] |
2961 | #[inline (always)] |
2962 | pub const fn avaloen(&self) -> bool { |
2963 | let val = (self.0 >> 4usize) & 0x01; |
2964 | val != 0 |
2965 | } |
2966 | #[doc = "A-peripheral session valid override enable" ] |
2967 | #[inline (always)] |
2968 | pub fn set_avaloen(&mut self, val: bool) { |
2969 | self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize); |
2970 | } |
2971 | #[doc = "A-peripheral session valid override value" ] |
2972 | #[inline (always)] |
2973 | pub const fn avaloval(&self) -> bool { |
2974 | let val = (self.0 >> 5usize) & 0x01; |
2975 | val != 0 |
2976 | } |
2977 | #[doc = "A-peripheral session valid override value" ] |
2978 | #[inline (always)] |
2979 | pub fn set_avaloval(&mut self, val: bool) { |
2980 | self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize); |
2981 | } |
2982 | #[doc = "B-peripheral session valid override enable" ] |
2983 | #[inline (always)] |
2984 | pub const fn bvaloen(&self) -> bool { |
2985 | let val = (self.0 >> 6usize) & 0x01; |
2986 | val != 0 |
2987 | } |
2988 | #[doc = "B-peripheral session valid override enable" ] |
2989 | #[inline (always)] |
2990 | pub fn set_bvaloen(&mut self, val: bool) { |
2991 | self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize); |
2992 | } |
2993 | #[doc = "B-peripheral session valid override value" ] |
2994 | #[inline (always)] |
2995 | pub const fn bvaloval(&self) -> bool { |
2996 | let val = (self.0 >> 7usize) & 0x01; |
2997 | val != 0 |
2998 | } |
2999 | #[doc = "B-peripheral session valid override value" ] |
3000 | #[inline (always)] |
3001 | pub fn set_bvaloval(&mut self, val: bool) { |
3002 | self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize); |
3003 | } |
3004 | #[doc = "Host negotiation success" ] |
3005 | #[inline (always)] |
3006 | pub const fn hngscs(&self) -> bool { |
3007 | let val = (self.0 >> 8usize) & 0x01; |
3008 | val != 0 |
3009 | } |
3010 | #[doc = "Host negotiation success" ] |
3011 | #[inline (always)] |
3012 | pub fn set_hngscs(&mut self, val: bool) { |
3013 | self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize); |
3014 | } |
3015 | #[doc = "HNP request" ] |
3016 | #[inline (always)] |
3017 | pub const fn hnprq(&self) -> bool { |
3018 | let val = (self.0 >> 9usize) & 0x01; |
3019 | val != 0 |
3020 | } |
3021 | #[doc = "HNP request" ] |
3022 | #[inline (always)] |
3023 | pub fn set_hnprq(&mut self, val: bool) { |
3024 | self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize); |
3025 | } |
3026 | #[doc = "Host set HNP enable" ] |
3027 | #[inline (always)] |
3028 | pub const fn hshnpen(&self) -> bool { |
3029 | let val = (self.0 >> 10usize) & 0x01; |
3030 | val != 0 |
3031 | } |
3032 | #[doc = "Host set HNP enable" ] |
3033 | #[inline (always)] |
3034 | pub fn set_hshnpen(&mut self, val: bool) { |
3035 | self.0 = (self.0 & !(0x01 << 10usize)) | (((val as u32) & 0x01) << 10usize); |
3036 | } |
3037 | #[doc = "Device HNP enabled" ] |
3038 | #[inline (always)] |
3039 | pub const fn dhnpen(&self) -> bool { |
3040 | let val = (self.0 >> 11usize) & 0x01; |
3041 | val != 0 |
3042 | } |
3043 | #[doc = "Device HNP enabled" ] |
3044 | #[inline (always)] |
3045 | pub fn set_dhnpen(&mut self, val: bool) { |
3046 | self.0 = (self.0 & !(0x01 << 11usize)) | (((val as u32) & 0x01) << 11usize); |
3047 | } |
3048 | #[doc = "Embedded host enable" ] |
3049 | #[inline (always)] |
3050 | pub const fn ehen(&self) -> bool { |
3051 | let val = (self.0 >> 12usize) & 0x01; |
3052 | val != 0 |
3053 | } |
3054 | #[doc = "Embedded host enable" ] |
3055 | #[inline (always)] |
3056 | pub fn set_ehen(&mut self, val: bool) { |
3057 | self.0 = (self.0 & !(0x01 << 12usize)) | (((val as u32) & 0x01) << 12usize); |
3058 | } |
3059 | #[doc = "Connector ID status" ] |
3060 | #[inline (always)] |
3061 | pub const fn cidsts(&self) -> bool { |
3062 | let val = (self.0 >> 16usize) & 0x01; |
3063 | val != 0 |
3064 | } |
3065 | #[doc = "Connector ID status" ] |
3066 | #[inline (always)] |
3067 | pub fn set_cidsts(&mut self, val: bool) { |
3068 | self.0 = (self.0 & !(0x01 << 16usize)) | (((val as u32) & 0x01) << 16usize); |
3069 | } |
3070 | #[doc = "Long/short debounce time" ] |
3071 | #[inline (always)] |
3072 | pub const fn dbct(&self) -> bool { |
3073 | let val = (self.0 >> 17usize) & 0x01; |
3074 | val != 0 |
3075 | } |
3076 | #[doc = "Long/short debounce time" ] |
3077 | #[inline (always)] |
3078 | pub fn set_dbct(&mut self, val: bool) { |
3079 | self.0 = (self.0 & !(0x01 << 17usize)) | (((val as u32) & 0x01) << 17usize); |
3080 | } |
3081 | #[doc = "A-session valid" ] |
3082 | #[inline (always)] |
3083 | pub const fn asvld(&self) -> bool { |
3084 | let val = (self.0 >> 18usize) & 0x01; |
3085 | val != 0 |
3086 | } |
3087 | #[doc = "A-session valid" ] |
3088 | #[inline (always)] |
3089 | pub fn set_asvld(&mut self, val: bool) { |
3090 | self.0 = (self.0 & !(0x01 << 18usize)) | (((val as u32) & 0x01) << 18usize); |
3091 | } |
3092 | #[doc = "B-session valid" ] |
3093 | #[inline (always)] |
3094 | pub const fn bsvld(&self) -> bool { |
3095 | let val = (self.0 >> 19usize) & 0x01; |
3096 | val != 0 |
3097 | } |
3098 | #[doc = "B-session valid" ] |
3099 | #[inline (always)] |
3100 | pub fn set_bsvld(&mut self, val: bool) { |
3101 | self.0 = (self.0 & !(0x01 << 19usize)) | (((val as u32) & 0x01) << 19usize); |
3102 | } |
3103 | } |
3104 | impl Default for Gotgctl { |
3105 | #[inline (always)] |
3106 | fn default() -> Gotgctl { |
3107 | Gotgctl(0) |
3108 | } |
3109 | } |
3110 | #[doc = "Interrupt register" ] |
3111 | #[repr (transparent)] |
3112 | #[derive (Copy, Clone, Eq, PartialEq)] |
3113 | pub struct Gotgint(pub u32); |
3114 | impl Gotgint { |
3115 | #[doc = "Session end detected" ] |
3116 | #[inline (always)] |
3117 | pub const fn sedet(&self) -> bool { |
3118 | let val = (self.0 >> 2usize) & 0x01; |
3119 | val != 0 |
3120 | } |
3121 | #[doc = "Session end detected" ] |
3122 | #[inline (always)] |
3123 | pub fn set_sedet(&mut self, val: bool) { |
3124 | self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize); |
3125 | } |
3126 | #[doc = "Session request success status change" ] |
3127 | #[inline (always)] |
3128 | pub const fn srsschg(&self) -> bool { |
3129 | let val = (self.0 >> 8usize) & 0x01; |
3130 | val != 0 |
3131 | } |
3132 | #[doc = "Session request success status change" ] |
3133 | #[inline (always)] |
3134 | pub fn set_srsschg(&mut self, val: bool) { |
3135 | self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize); |
3136 | } |
3137 | #[doc = "Host negotiation success status change" ] |
3138 | #[inline (always)] |
3139 | pub const fn hnsschg(&self) -> bool { |
3140 | let val = (self.0 >> 9usize) & 0x01; |
3141 | val != 0 |
3142 | } |
3143 | #[doc = "Host negotiation success status change" ] |
3144 | #[inline (always)] |
3145 | pub fn set_hnsschg(&mut self, val: bool) { |
3146 | self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize); |
3147 | } |
3148 | #[doc = "Host negotiation detected" ] |
3149 | #[inline (always)] |
3150 | pub const fn hngdet(&self) -> bool { |
3151 | let val = (self.0 >> 17usize) & 0x01; |
3152 | val != 0 |
3153 | } |
3154 | #[doc = "Host negotiation detected" ] |
3155 | #[inline (always)] |
3156 | pub fn set_hngdet(&mut self, val: bool) { |
3157 | self.0 = (self.0 & !(0x01 << 17usize)) | (((val as u32) & 0x01) << 17usize); |
3158 | } |
3159 | #[doc = "A-device timeout change" ] |
3160 | #[inline (always)] |
3161 | pub const fn adtochg(&self) -> bool { |
3162 | let val = (self.0 >> 18usize) & 0x01; |
3163 | val != 0 |
3164 | } |
3165 | #[doc = "A-device timeout change" ] |
3166 | #[inline (always)] |
3167 | pub fn set_adtochg(&mut self, val: bool) { |
3168 | self.0 = (self.0 & !(0x01 << 18usize)) | (((val as u32) & 0x01) << 18usize); |
3169 | } |
3170 | #[doc = "Debounce done" ] |
3171 | #[inline (always)] |
3172 | pub const fn dbcdne(&self) -> bool { |
3173 | let val = (self.0 >> 19usize) & 0x01; |
3174 | val != 0 |
3175 | } |
3176 | #[doc = "Debounce done" ] |
3177 | #[inline (always)] |
3178 | pub fn set_dbcdne(&mut self, val: bool) { |
3179 | self.0 = (self.0 & !(0x01 << 19usize)) | (((val as u32) & 0x01) << 19usize); |
3180 | } |
3181 | #[doc = "ID input pin changed" ] |
3182 | #[inline (always)] |
3183 | pub const fn idchng(&self) -> bool { |
3184 | let val = (self.0 >> 20usize) & 0x01; |
3185 | val != 0 |
3186 | } |
3187 | #[doc = "ID input pin changed" ] |
3188 | #[inline (always)] |
3189 | pub fn set_idchng(&mut self, val: bool) { |
3190 | self.0 = (self.0 & !(0x01 << 20usize)) | (((val as u32) & 0x01) << 20usize); |
3191 | } |
3192 | } |
3193 | impl Default for Gotgint { |
3194 | #[inline (always)] |
3195 | fn default() -> Gotgint { |
3196 | Gotgint(0) |
3197 | } |
3198 | } |
3199 | #[doc = "Reset register" ] |
3200 | #[repr (transparent)] |
3201 | #[derive (Copy, Clone, Eq, PartialEq)] |
3202 | pub struct Grstctl(pub u32); |
3203 | impl Grstctl { |
3204 | #[doc = "Core soft reset" ] |
3205 | #[inline (always)] |
3206 | pub const fn csrst(&self) -> bool { |
3207 | let val = (self.0 >> 0usize) & 0x01; |
3208 | val != 0 |
3209 | } |
3210 | #[doc = "Core soft reset" ] |
3211 | #[inline (always)] |
3212 | pub fn set_csrst(&mut self, val: bool) { |
3213 | self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize); |
3214 | } |
3215 | #[doc = "HCLK soft reset" ] |
3216 | #[inline (always)] |
3217 | pub const fn hsrst(&self) -> bool { |
3218 | let val = (self.0 >> 1usize) & 0x01; |
3219 | val != 0 |
3220 | } |
3221 | #[doc = "HCLK soft reset" ] |
3222 | #[inline (always)] |
3223 | pub fn set_hsrst(&mut self, val: bool) { |
3224 | self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize); |
3225 | } |
3226 | #[doc = "Host frame counter reset" ] |
3227 | #[inline (always)] |
3228 | pub const fn fcrst(&self) -> bool { |
3229 | let val = (self.0 >> 2usize) & 0x01; |
3230 | val != 0 |
3231 | } |
3232 | #[doc = "Host frame counter reset" ] |
3233 | #[inline (always)] |
3234 | pub fn set_fcrst(&mut self, val: bool) { |
3235 | self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize); |
3236 | } |
3237 | #[doc = "RxFIFO flush" ] |
3238 | #[inline (always)] |
3239 | pub const fn rxfflsh(&self) -> bool { |
3240 | let val = (self.0 >> 4usize) & 0x01; |
3241 | val != 0 |
3242 | } |
3243 | #[doc = "RxFIFO flush" ] |
3244 | #[inline (always)] |
3245 | pub fn set_rxfflsh(&mut self, val: bool) { |
3246 | self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize); |
3247 | } |
3248 | #[doc = "TxFIFO flush" ] |
3249 | #[inline (always)] |
3250 | pub const fn txfflsh(&self) -> bool { |
3251 | let val = (self.0 >> 5usize) & 0x01; |
3252 | val != 0 |
3253 | } |
3254 | #[doc = "TxFIFO flush" ] |
3255 | #[inline (always)] |
3256 | pub fn set_txfflsh(&mut self, val: bool) { |
3257 | self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize); |
3258 | } |
3259 | #[doc = "TxFIFO number" ] |
3260 | #[inline (always)] |
3261 | pub const fn txfnum(&self) -> u8 { |
3262 | let val = (self.0 >> 6usize) & 0x1f; |
3263 | val as u8 |
3264 | } |
3265 | #[doc = "TxFIFO number" ] |
3266 | #[inline (always)] |
3267 | pub fn set_txfnum(&mut self, val: u8) { |
3268 | self.0 = (self.0 & !(0x1f << 6usize)) | (((val as u32) & 0x1f) << 6usize); |
3269 | } |
3270 | #[doc = "DMA request signal enabled for USB OTG HS" ] |
3271 | #[inline (always)] |
3272 | pub const fn dmareq(&self) -> bool { |
3273 | let val = (self.0 >> 30usize) & 0x01; |
3274 | val != 0 |
3275 | } |
3276 | #[doc = "DMA request signal enabled for USB OTG HS" ] |
3277 | #[inline (always)] |
3278 | pub fn set_dmareq(&mut self, val: bool) { |
3279 | self.0 = (self.0 & !(0x01 << 30usize)) | (((val as u32) & 0x01) << 30usize); |
3280 | } |
3281 | #[doc = "AHB master idle" ] |
3282 | #[inline (always)] |
3283 | pub const fn ahbidl(&self) -> bool { |
3284 | let val = (self.0 >> 31usize) & 0x01; |
3285 | val != 0 |
3286 | } |
3287 | #[doc = "AHB master idle" ] |
3288 | #[inline (always)] |
3289 | pub fn set_ahbidl(&mut self, val: bool) { |
3290 | self.0 = (self.0 & !(0x01 << 31usize)) | (((val as u32) & 0x01) << 31usize); |
3291 | } |
3292 | } |
3293 | impl Default for Grstctl { |
3294 | #[inline (always)] |
3295 | fn default() -> Grstctl { |
3296 | Grstctl(0) |
3297 | } |
3298 | } |
3299 | #[doc = "Receive FIFO size register" ] |
3300 | #[repr (transparent)] |
3301 | #[derive (Copy, Clone, Eq, PartialEq)] |
3302 | pub struct Grxfsiz(pub u32); |
3303 | impl Grxfsiz { |
3304 | #[doc = "RxFIFO depth" ] |
3305 | #[inline (always)] |
3306 | pub const fn rxfd(&self) -> u16 { |
3307 | let val = (self.0 >> 0usize) & 0xffff; |
3308 | val as u16 |
3309 | } |
3310 | #[doc = "RxFIFO depth" ] |
3311 | #[inline (always)] |
3312 | pub fn set_rxfd(&mut self, val: u16) { |
3313 | self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize); |
3314 | } |
3315 | } |
3316 | impl Default for Grxfsiz { |
3317 | #[inline (always)] |
3318 | fn default() -> Grxfsiz { |
3319 | Grxfsiz(0) |
3320 | } |
3321 | } |
3322 | #[doc = "Status read and pop register" ] |
3323 | #[repr (transparent)] |
3324 | #[derive (Copy, Clone, Eq, PartialEq)] |
3325 | pub struct Grxsts(pub u32); |
3326 | impl Grxsts { |
3327 | #[doc = "Endpoint number (device mode) / Channel number (host mode)" ] |
3328 | #[inline (always)] |
3329 | pub const fn epnum(&self) -> u8 { |
3330 | let val = (self.0 >> 0usize) & 0x0f; |
3331 | val as u8 |
3332 | } |
3333 | #[doc = "Endpoint number (device mode) / Channel number (host mode)" ] |
3334 | #[inline (always)] |
3335 | pub fn set_epnum(&mut self, val: u8) { |
3336 | self.0 = (self.0 & !(0x0f << 0usize)) | (((val as u32) & 0x0f) << 0usize); |
3337 | } |
3338 | #[doc = "Byte count" ] |
3339 | #[inline (always)] |
3340 | pub const fn bcnt(&self) -> u16 { |
3341 | let val = (self.0 >> 4usize) & 0x07ff; |
3342 | val as u16 |
3343 | } |
3344 | #[doc = "Byte count" ] |
3345 | #[inline (always)] |
3346 | pub fn set_bcnt(&mut self, val: u16) { |
3347 | self.0 = (self.0 & !(0x07ff << 4usize)) | (((val as u32) & 0x07ff) << 4usize); |
3348 | } |
3349 | #[doc = "Data PID" ] |
3350 | #[inline (always)] |
3351 | pub const fn dpid(&self) -> super::vals::Dpid { |
3352 | let val = (self.0 >> 15usize) & 0x03; |
3353 | super::vals::Dpid::from_bits(val as u8) |
3354 | } |
3355 | #[doc = "Data PID" ] |
3356 | #[inline (always)] |
3357 | pub fn set_dpid(&mut self, val: super::vals::Dpid) { |
3358 | self.0 = (self.0 & !(0x03 << 15usize)) | (((val.to_bits() as u32) & 0x03) << 15usize); |
3359 | } |
3360 | #[doc = "Packet status (device mode)" ] |
3361 | #[inline (always)] |
3362 | pub const fn pktstsd(&self) -> super::vals::Pktstsd { |
3363 | let val = (self.0 >> 17usize) & 0x0f; |
3364 | super::vals::Pktstsd::from_bits(val as u8) |
3365 | } |
3366 | #[doc = "Packet status (device mode)" ] |
3367 | #[inline (always)] |
3368 | pub fn set_pktstsd(&mut self, val: super::vals::Pktstsd) { |
3369 | self.0 = (self.0 & !(0x0f << 17usize)) | (((val.to_bits() as u32) & 0x0f) << 17usize); |
3370 | } |
3371 | #[doc = "Packet status (host mode)" ] |
3372 | #[inline (always)] |
3373 | pub const fn pktstsh(&self) -> super::vals::Pktstsh { |
3374 | let val = (self.0 >> 17usize) & 0x0f; |
3375 | super::vals::Pktstsh::from_bits(val as u8) |
3376 | } |
3377 | #[doc = "Packet status (host mode)" ] |
3378 | #[inline (always)] |
3379 | pub fn set_pktstsh(&mut self, val: super::vals::Pktstsh) { |
3380 | self.0 = (self.0 & !(0x0f << 17usize)) | (((val.to_bits() as u32) & 0x0f) << 17usize); |
3381 | } |
3382 | #[doc = "Frame number (device mode)" ] |
3383 | #[inline (always)] |
3384 | pub const fn frmnum(&self) -> u8 { |
3385 | let val = (self.0 >> 21usize) & 0x0f; |
3386 | val as u8 |
3387 | } |
3388 | #[doc = "Frame number (device mode)" ] |
3389 | #[inline (always)] |
3390 | pub fn set_frmnum(&mut self, val: u8) { |
3391 | self.0 = (self.0 & !(0x0f << 21usize)) | (((val as u32) & 0x0f) << 21usize); |
3392 | } |
3393 | } |
3394 | impl Default for Grxsts { |
3395 | #[inline (always)] |
3396 | fn default() -> Grxsts { |
3397 | Grxsts(0) |
3398 | } |
3399 | } |
3400 | #[doc = "USB configuration register" ] |
3401 | #[repr (transparent)] |
3402 | #[derive (Copy, Clone, Eq, PartialEq)] |
3403 | pub struct Gusbcfg(pub u32); |
3404 | impl Gusbcfg { |
3405 | #[doc = "FS timeout calibration" ] |
3406 | #[inline (always)] |
3407 | pub const fn tocal(&self) -> u8 { |
3408 | let val = (self.0 >> 0usize) & 0x07; |
3409 | val as u8 |
3410 | } |
3411 | #[doc = "FS timeout calibration" ] |
3412 | #[inline (always)] |
3413 | pub fn set_tocal(&mut self, val: u8) { |
3414 | self.0 = (self.0 & !(0x07 << 0usize)) | (((val as u32) & 0x07) << 0usize); |
3415 | } |
3416 | #[doc = "Full-speed internal serial transceiver enable" ] |
3417 | #[inline (always)] |
3418 | pub const fn physel(&self) -> bool { |
3419 | let val = (self.0 >> 6usize) & 0x01; |
3420 | val != 0 |
3421 | } |
3422 | #[doc = "Full-speed internal serial transceiver enable" ] |
3423 | #[inline (always)] |
3424 | pub fn set_physel(&mut self, val: bool) { |
3425 | self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize); |
3426 | } |
3427 | #[doc = "SRP-capable" ] |
3428 | #[inline (always)] |
3429 | pub const fn srpcap(&self) -> bool { |
3430 | let val = (self.0 >> 8usize) & 0x01; |
3431 | val != 0 |
3432 | } |
3433 | #[doc = "SRP-capable" ] |
3434 | #[inline (always)] |
3435 | pub fn set_srpcap(&mut self, val: bool) { |
3436 | self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize); |
3437 | } |
3438 | #[doc = "HNP-capable" ] |
3439 | #[inline (always)] |
3440 | pub const fn hnpcap(&self) -> bool { |
3441 | let val = (self.0 >> 9usize) & 0x01; |
3442 | val != 0 |
3443 | } |
3444 | #[doc = "HNP-capable" ] |
3445 | #[inline (always)] |
3446 | pub fn set_hnpcap(&mut self, val: bool) { |
3447 | self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize); |
3448 | } |
3449 | #[doc = "USB turnaround time" ] |
3450 | #[inline (always)] |
3451 | pub const fn trdt(&self) -> u8 { |
3452 | let val = (self.0 >> 10usize) & 0x0f; |
3453 | val as u8 |
3454 | } |
3455 | #[doc = "USB turnaround time" ] |
3456 | #[inline (always)] |
3457 | pub fn set_trdt(&mut self, val: u8) { |
3458 | self.0 = (self.0 & !(0x0f << 10usize)) | (((val as u32) & 0x0f) << 10usize); |
3459 | } |
3460 | #[doc = "PHY Low-power clock select" ] |
3461 | #[inline (always)] |
3462 | pub const fn phylpcs(&self) -> bool { |
3463 | let val = (self.0 >> 15usize) & 0x01; |
3464 | val != 0 |
3465 | } |
3466 | #[doc = "PHY Low-power clock select" ] |
3467 | #[inline (always)] |
3468 | pub fn set_phylpcs(&mut self, val: bool) { |
3469 | self.0 = (self.0 & !(0x01 << 15usize)) | (((val as u32) & 0x01) << 15usize); |
3470 | } |
3471 | #[doc = "ULPI FS/LS select" ] |
3472 | #[inline (always)] |
3473 | pub const fn ulpifsls(&self) -> bool { |
3474 | let val = (self.0 >> 17usize) & 0x01; |
3475 | val != 0 |
3476 | } |
3477 | #[doc = "ULPI FS/LS select" ] |
3478 | #[inline (always)] |
3479 | pub fn set_ulpifsls(&mut self, val: bool) { |
3480 | self.0 = (self.0 & !(0x01 << 17usize)) | (((val as u32) & 0x01) << 17usize); |
3481 | } |
3482 | #[doc = "ULPI Auto-resume" ] |
3483 | #[inline (always)] |
3484 | pub const fn ulpiar(&self) -> bool { |
3485 | let val = (self.0 >> 18usize) & 0x01; |
3486 | val != 0 |
3487 | } |
3488 | #[doc = "ULPI Auto-resume" ] |
3489 | #[inline (always)] |
3490 | pub fn set_ulpiar(&mut self, val: bool) { |
3491 | self.0 = (self.0 & !(0x01 << 18usize)) | (((val as u32) & 0x01) << 18usize); |
3492 | } |
3493 | #[doc = "ULPI Clock SuspendM" ] |
3494 | #[inline (always)] |
3495 | pub const fn ulpicsm(&self) -> bool { |
3496 | let val = (self.0 >> 19usize) & 0x01; |
3497 | val != 0 |
3498 | } |
3499 | #[doc = "ULPI Clock SuspendM" ] |
3500 | #[inline (always)] |
3501 | pub fn set_ulpicsm(&mut self, val: bool) { |
3502 | self.0 = (self.0 & !(0x01 << 19usize)) | (((val as u32) & 0x01) << 19usize); |
3503 | } |
3504 | #[doc = "ULPI External VBUS Drive" ] |
3505 | #[inline (always)] |
3506 | pub const fn ulpievbusd(&self) -> bool { |
3507 | let val = (self.0 >> 20usize) & 0x01; |
3508 | val != 0 |
3509 | } |
3510 | #[doc = "ULPI External VBUS Drive" ] |
3511 | #[inline (always)] |
3512 | pub fn set_ulpievbusd(&mut self, val: bool) { |
3513 | self.0 = (self.0 & !(0x01 << 20usize)) | (((val as u32) & 0x01) << 20usize); |
3514 | } |
3515 | #[doc = "ULPI external VBUS indicator" ] |
3516 | #[inline (always)] |
3517 | pub const fn ulpievbusi(&self) -> bool { |
3518 | let val = (self.0 >> 21usize) & 0x01; |
3519 | val != 0 |
3520 | } |
3521 | #[doc = "ULPI external VBUS indicator" ] |
3522 | #[inline (always)] |
3523 | pub fn set_ulpievbusi(&mut self, val: bool) { |
3524 | self.0 = (self.0 & !(0x01 << 21usize)) | (((val as u32) & 0x01) << 21usize); |
3525 | } |
3526 | #[doc = "TermSel DLine pulsing selection" ] |
3527 | #[inline (always)] |
3528 | pub const fn tsdps(&self) -> bool { |
3529 | let val = (self.0 >> 22usize) & 0x01; |
3530 | val != 0 |
3531 | } |
3532 | #[doc = "TermSel DLine pulsing selection" ] |
3533 | #[inline (always)] |
3534 | pub fn set_tsdps(&mut self, val: bool) { |
3535 | self.0 = (self.0 & !(0x01 << 22usize)) | (((val as u32) & 0x01) << 22usize); |
3536 | } |
3537 | #[doc = "Indicator complement" ] |
3538 | #[inline (always)] |
3539 | pub const fn pcci(&self) -> bool { |
3540 | let val = (self.0 >> 23usize) & 0x01; |
3541 | val != 0 |
3542 | } |
3543 | #[doc = "Indicator complement" ] |
3544 | #[inline (always)] |
3545 | pub fn set_pcci(&mut self, val: bool) { |
3546 | self.0 = (self.0 & !(0x01 << 23usize)) | (((val as u32) & 0x01) << 23usize); |
3547 | } |
3548 | #[doc = "Indicator pass through" ] |
3549 | #[inline (always)] |
3550 | pub const fn ptci(&self) -> bool { |
3551 | let val = (self.0 >> 24usize) & 0x01; |
3552 | val != 0 |
3553 | } |
3554 | #[doc = "Indicator pass through" ] |
3555 | #[inline (always)] |
3556 | pub fn set_ptci(&mut self, val: bool) { |
3557 | self.0 = (self.0 & !(0x01 << 24usize)) | (((val as u32) & 0x01) << 24usize); |
3558 | } |
3559 | #[doc = "ULPI interface protect disable" ] |
3560 | #[inline (always)] |
3561 | pub const fn ulpiipd(&self) -> bool { |
3562 | let val = (self.0 >> 25usize) & 0x01; |
3563 | val != 0 |
3564 | } |
3565 | #[doc = "ULPI interface protect disable" ] |
3566 | #[inline (always)] |
3567 | pub fn set_ulpiipd(&mut self, val: bool) { |
3568 | self.0 = (self.0 & !(0x01 << 25usize)) | (((val as u32) & 0x01) << 25usize); |
3569 | } |
3570 | #[doc = "Force host mode" ] |
3571 | #[inline (always)] |
3572 | pub const fn fhmod(&self) -> bool { |
3573 | let val = (self.0 >> 29usize) & 0x01; |
3574 | val != 0 |
3575 | } |
3576 | #[doc = "Force host mode" ] |
3577 | #[inline (always)] |
3578 | pub fn set_fhmod(&mut self, val: bool) { |
3579 | self.0 = (self.0 & !(0x01 << 29usize)) | (((val as u32) & 0x01) << 29usize); |
3580 | } |
3581 | #[doc = "Force device mode" ] |
3582 | #[inline (always)] |
3583 | pub const fn fdmod(&self) -> bool { |
3584 | let val = (self.0 >> 30usize) & 0x01; |
3585 | val != 0 |
3586 | } |
3587 | #[doc = "Force device mode" ] |
3588 | #[inline (always)] |
3589 | pub fn set_fdmod(&mut self, val: bool) { |
3590 | self.0 = (self.0 & !(0x01 << 30usize)) | (((val as u32) & 0x01) << 30usize); |
3591 | } |
3592 | #[doc = "Corrupt Tx packet" ] |
3593 | #[inline (always)] |
3594 | pub const fn ctxpkt(&self) -> bool { |
3595 | let val = (self.0 >> 31usize) & 0x01; |
3596 | val != 0 |
3597 | } |
3598 | #[doc = "Corrupt Tx packet" ] |
3599 | #[inline (always)] |
3600 | pub fn set_ctxpkt(&mut self, val: bool) { |
3601 | self.0 = (self.0 & !(0x01 << 31usize)) | (((val as u32) & 0x01) << 31usize); |
3602 | } |
3603 | } |
3604 | impl Default for Gusbcfg { |
3605 | #[inline (always)] |
3606 | fn default() -> Gusbcfg { |
3607 | Gusbcfg(0) |
3608 | } |
3609 | } |
3610 | #[doc = "Host all channels interrupt register" ] |
3611 | #[repr (transparent)] |
3612 | #[derive (Copy, Clone, Eq, PartialEq)] |
3613 | pub struct Haint(pub u32); |
3614 | impl Haint { |
3615 | #[doc = "Channel interrupts" ] |
3616 | #[inline (always)] |
3617 | pub const fn haint(&self) -> u16 { |
3618 | let val = (self.0 >> 0usize) & 0xffff; |
3619 | val as u16 |
3620 | } |
3621 | #[doc = "Channel interrupts" ] |
3622 | #[inline (always)] |
3623 | pub fn set_haint(&mut self, val: u16) { |
3624 | self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize); |
3625 | } |
3626 | } |
3627 | impl Default for Haint { |
3628 | #[inline (always)] |
3629 | fn default() -> Haint { |
3630 | Haint(0) |
3631 | } |
3632 | } |
3633 | #[doc = "Host all channels interrupt mask register" ] |
3634 | #[repr (transparent)] |
3635 | #[derive (Copy, Clone, Eq, PartialEq)] |
3636 | pub struct Haintmsk(pub u32); |
3637 | impl Haintmsk { |
3638 | #[doc = "Channel interrupt mask" ] |
3639 | #[inline (always)] |
3640 | pub const fn haintm(&self) -> u16 { |
3641 | let val = (self.0 >> 0usize) & 0xffff; |
3642 | val as u16 |
3643 | } |
3644 | #[doc = "Channel interrupt mask" ] |
3645 | #[inline (always)] |
3646 | pub fn set_haintm(&mut self, val: u16) { |
3647 | self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize); |
3648 | } |
3649 | } |
3650 | impl Default for Haintmsk { |
3651 | #[inline (always)] |
3652 | fn default() -> Haintmsk { |
3653 | Haintmsk(0) |
3654 | } |
3655 | } |
3656 | #[doc = "Host channel characteristics register" ] |
3657 | #[repr (transparent)] |
3658 | #[derive (Copy, Clone, Eq, PartialEq)] |
3659 | pub struct Hcchar(pub u32); |
3660 | impl Hcchar { |
3661 | #[doc = "Maximum packet size" ] |
3662 | #[inline (always)] |
3663 | pub const fn mpsiz(&self) -> u16 { |
3664 | let val = (self.0 >> 0usize) & 0x07ff; |
3665 | val as u16 |
3666 | } |
3667 | #[doc = "Maximum packet size" ] |
3668 | #[inline (always)] |
3669 | pub fn set_mpsiz(&mut self, val: u16) { |
3670 | self.0 = (self.0 & !(0x07ff << 0usize)) | (((val as u32) & 0x07ff) << 0usize); |
3671 | } |
3672 | #[doc = "Endpoint number" ] |
3673 | #[inline (always)] |
3674 | pub const fn epnum(&self) -> u8 { |
3675 | let val = (self.0 >> 11usize) & 0x0f; |
3676 | val as u8 |
3677 | } |
3678 | #[doc = "Endpoint number" ] |
3679 | #[inline (always)] |
3680 | pub fn set_epnum(&mut self, val: u8) { |
3681 | self.0 = (self.0 & !(0x0f << 11usize)) | (((val as u32) & 0x0f) << 11usize); |
3682 | } |
3683 | #[doc = "Endpoint direction" ] |
3684 | #[inline (always)] |
3685 | pub const fn epdir(&self) -> bool { |
3686 | let val = (self.0 >> 15usize) & 0x01; |
3687 | val != 0 |
3688 | } |
3689 | #[doc = "Endpoint direction" ] |
3690 | #[inline (always)] |
3691 | pub fn set_epdir(&mut self, val: bool) { |
3692 | self.0 = (self.0 & !(0x01 << 15usize)) | (((val as u32) & 0x01) << 15usize); |
3693 | } |
3694 | #[doc = "Low-speed device" ] |
3695 | #[inline (always)] |
3696 | pub const fn lsdev(&self) -> bool { |
3697 | let val = (self.0 >> 17usize) & 0x01; |
3698 | val != 0 |
3699 | } |
3700 | #[doc = "Low-speed device" ] |
3701 | #[inline (always)] |
3702 | pub fn set_lsdev(&mut self, val: bool) { |
3703 | self.0 = (self.0 & !(0x01 << 17usize)) | (((val as u32) & 0x01) << 17usize); |
3704 | } |
3705 | #[doc = "Endpoint type" ] |
3706 | #[inline (always)] |
3707 | pub const fn eptyp(&self) -> super::vals::Eptyp { |
3708 | let val = (self.0 >> 18usize) & 0x03; |
3709 | super::vals::Eptyp::from_bits(val as u8) |
3710 | } |
3711 | #[doc = "Endpoint type" ] |
3712 | #[inline (always)] |
3713 | pub fn set_eptyp(&mut self, val: super::vals::Eptyp) { |
3714 | self.0 = (self.0 & !(0x03 << 18usize)) | (((val.to_bits() as u32) & 0x03) << 18usize); |
3715 | } |
3716 | #[doc = "Multicount" ] |
3717 | #[inline (always)] |
3718 | pub const fn mcnt(&self) -> u8 { |
3719 | let val = (self.0 >> 20usize) & 0x03; |
3720 | val as u8 |
3721 | } |
3722 | #[doc = "Multicount" ] |
3723 | #[inline (always)] |
3724 | pub fn set_mcnt(&mut self, val: u8) { |
3725 | self.0 = (self.0 & !(0x03 << 20usize)) | (((val as u32) & 0x03) << 20usize); |
3726 | } |
3727 | #[doc = "Device address" ] |
3728 | #[inline (always)] |
3729 | pub const fn dad(&self) -> u8 { |
3730 | let val = (self.0 >> 22usize) & 0x7f; |
3731 | val as u8 |
3732 | } |
3733 | #[doc = "Device address" ] |
3734 | #[inline (always)] |
3735 | pub fn set_dad(&mut self, val: u8) { |
3736 | self.0 = (self.0 & !(0x7f << 22usize)) | (((val as u32) & 0x7f) << 22usize); |
3737 | } |
3738 | #[doc = "Odd frame" ] |
3739 | #[inline (always)] |
3740 | pub const fn oddfrm(&self) -> bool { |
3741 | let val = (self.0 >> 29usize) & 0x01; |
3742 | val != 0 |
3743 | } |
3744 | #[doc = "Odd frame" ] |
3745 | #[inline (always)] |
3746 | pub fn set_oddfrm(&mut self, val: bool) { |
3747 | self.0 = (self.0 & !(0x01 << 29usize)) | (((val as u32) & 0x01) << 29usize); |
3748 | } |
3749 | #[doc = "Channel disable" ] |
3750 | #[inline (always)] |
3751 | pub const fn chdis(&self) -> bool { |
3752 | let val = (self.0 >> 30usize) & 0x01; |
3753 | val != 0 |
3754 | } |
3755 | #[doc = "Channel disable" ] |
3756 | #[inline (always)] |
3757 | pub fn set_chdis(&mut self, val: bool) { |
3758 | self.0 = (self.0 & !(0x01 << 30usize)) | (((val as u32) & 0x01) << 30usize); |
3759 | } |
3760 | #[doc = "Channel enable" ] |
3761 | #[inline (always)] |
3762 | pub const fn chena(&self) -> bool { |
3763 | let val = (self.0 >> 31usize) & 0x01; |
3764 | val != 0 |
3765 | } |
3766 | #[doc = "Channel enable" ] |
3767 | #[inline (always)] |
3768 | pub fn set_chena(&mut self, val: bool) { |
3769 | self.0 = (self.0 & !(0x01 << 31usize)) | (((val as u32) & 0x01) << 31usize); |
3770 | } |
3771 | } |
3772 | impl Default for Hcchar { |
3773 | #[inline (always)] |
3774 | fn default() -> Hcchar { |
3775 | Hcchar(0) |
3776 | } |
3777 | } |
3778 | #[doc = "Host configuration register" ] |
3779 | #[repr (transparent)] |
3780 | #[derive (Copy, Clone, Eq, PartialEq)] |
3781 | pub struct Hcfg(pub u32); |
3782 | impl Hcfg { |
3783 | #[doc = "FS/LS PHY clock select" ] |
3784 | #[inline (always)] |
3785 | pub const fn fslspcs(&self) -> u8 { |
3786 | let val = (self.0 >> 0usize) & 0x03; |
3787 | val as u8 |
3788 | } |
3789 | #[doc = "FS/LS PHY clock select" ] |
3790 | #[inline (always)] |
3791 | pub fn set_fslspcs(&mut self, val: u8) { |
3792 | self.0 = (self.0 & !(0x03 << 0usize)) | (((val as u32) & 0x03) << 0usize); |
3793 | } |
3794 | #[doc = "FS- and LS-only support" ] |
3795 | #[inline (always)] |
3796 | pub const fn fslss(&self) -> bool { |
3797 | let val = (self.0 >> 2usize) & 0x01; |
3798 | val != 0 |
3799 | } |
3800 | #[doc = "FS- and LS-only support" ] |
3801 | #[inline (always)] |
3802 | pub fn set_fslss(&mut self, val: bool) { |
3803 | self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize); |
3804 | } |
3805 | } |
3806 | impl Default for Hcfg { |
3807 | #[inline (always)] |
3808 | fn default() -> Hcfg { |
3809 | Hcfg(0) |
3810 | } |
3811 | } |
3812 | #[doc = "Host channel interrupt register" ] |
3813 | #[repr (transparent)] |
3814 | #[derive (Copy, Clone, Eq, PartialEq)] |
3815 | pub struct Hcint(pub u32); |
3816 | impl Hcint { |
3817 | #[doc = "Transfer completed" ] |
3818 | #[inline (always)] |
3819 | pub const fn xfrc(&self) -> bool { |
3820 | let val = (self.0 >> 0usize) & 0x01; |
3821 | val != 0 |
3822 | } |
3823 | #[doc = "Transfer completed" ] |
3824 | #[inline (always)] |
3825 | pub fn set_xfrc(&mut self, val: bool) { |
3826 | self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize); |
3827 | } |
3828 | #[doc = "Channel halted" ] |
3829 | #[inline (always)] |
3830 | pub const fn chh(&self) -> bool { |
3831 | let val = (self.0 >> 1usize) & 0x01; |
3832 | val != 0 |
3833 | } |
3834 | #[doc = "Channel halted" ] |
3835 | #[inline (always)] |
3836 | pub fn set_chh(&mut self, val: bool) { |
3837 | self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize); |
3838 | } |
3839 | #[doc = "STALL response received interrupt" ] |
3840 | #[inline (always)] |
3841 | pub const fn stall(&self) -> bool { |
3842 | let val = (self.0 >> 3usize) & 0x01; |
3843 | val != 0 |
3844 | } |
3845 | #[doc = "STALL response received interrupt" ] |
3846 | #[inline (always)] |
3847 | pub fn set_stall(&mut self, val: bool) { |
3848 | self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize); |
3849 | } |
3850 | #[doc = "NAK response received interrupt" ] |
3851 | #[inline (always)] |
3852 | pub const fn nak(&self) -> bool { |
3853 | let val = (self.0 >> 4usize) & 0x01; |
3854 | val != 0 |
3855 | } |
3856 | #[doc = "NAK response received interrupt" ] |
3857 | #[inline (always)] |
3858 | pub fn set_nak(&mut self, val: bool) { |
3859 | self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize); |
3860 | } |
3861 | #[doc = "ACK response received/transmitted interrupt" ] |
3862 | #[inline (always)] |
3863 | pub const fn ack(&self) -> bool { |
3864 | let val = (self.0 >> 5usize) & 0x01; |
3865 | val != 0 |
3866 | } |
3867 | #[doc = "ACK response received/transmitted interrupt" ] |
3868 | #[inline (always)] |
3869 | pub fn set_ack(&mut self, val: bool) { |
3870 | self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize); |
3871 | } |
3872 | #[doc = "Transaction error" ] |
3873 | #[inline (always)] |
3874 | pub const fn txerr(&self) -> bool { |
3875 | let val = (self.0 >> 7usize) & 0x01; |
3876 | val != 0 |
3877 | } |
3878 | #[doc = "Transaction error" ] |
3879 | #[inline (always)] |
3880 | pub fn set_txerr(&mut self, val: bool) { |
3881 | self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize); |
3882 | } |
3883 | #[doc = "Babble error" ] |
3884 | #[inline (always)] |
3885 | pub const fn bberr(&self) -> bool { |
3886 | let val = (self.0 >> 8usize) & 0x01; |
3887 | val != 0 |
3888 | } |
3889 | #[doc = "Babble error" ] |
3890 | #[inline (always)] |
3891 | pub fn set_bberr(&mut self, val: bool) { |
3892 | self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize); |
3893 | } |
3894 | #[doc = "Frame overrun" ] |
3895 | #[inline (always)] |
3896 | pub const fn frmor(&self) -> bool { |
3897 | let val = (self.0 >> 9usize) & 0x01; |
3898 | val != 0 |
3899 | } |
3900 | #[doc = "Frame overrun" ] |
3901 | #[inline (always)] |
3902 | pub fn set_frmor(&mut self, val: bool) { |
3903 | self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize); |
3904 | } |
3905 | #[doc = "Data toggle error" ] |
3906 | #[inline (always)] |
3907 | pub const fn dterr(&self) -> bool { |
3908 | let val = (self.0 >> 10usize) & 0x01; |
3909 | val != 0 |
3910 | } |
3911 | #[doc = "Data toggle error" ] |
3912 | #[inline (always)] |
3913 | pub fn set_dterr(&mut self, val: bool) { |
3914 | self.0 = (self.0 & !(0x01 << 10usize)) | (((val as u32) & 0x01) << 10usize); |
3915 | } |
3916 | } |
3917 | impl Default for Hcint { |
3918 | #[inline (always)] |
3919 | fn default() -> Hcint { |
3920 | Hcint(0) |
3921 | } |
3922 | } |
3923 | #[doc = "Host channel mask register" ] |
3924 | #[repr (transparent)] |
3925 | #[derive (Copy, Clone, Eq, PartialEq)] |
3926 | pub struct Hcintmsk(pub u32); |
3927 | impl Hcintmsk { |
3928 | #[doc = "Transfer completed mask" ] |
3929 | #[inline (always)] |
3930 | pub const fn xfrcm(&self) -> bool { |
3931 | let val = (self.0 >> 0usize) & 0x01; |
3932 | val != 0 |
3933 | } |
3934 | #[doc = "Transfer completed mask" ] |
3935 | #[inline (always)] |
3936 | pub fn set_xfrcm(&mut self, val: bool) { |
3937 | self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize); |
3938 | } |
3939 | #[doc = "Channel halted mask" ] |
3940 | #[inline (always)] |
3941 | pub const fn chhm(&self) -> bool { |
3942 | let val = (self.0 >> 1usize) & 0x01; |
3943 | val != 0 |
3944 | } |
3945 | #[doc = "Channel halted mask" ] |
3946 | #[inline (always)] |
3947 | pub fn set_chhm(&mut self, val: bool) { |
3948 | self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize); |
3949 | } |
3950 | #[doc = "STALL response received interrupt mask" ] |
3951 | #[inline (always)] |
3952 | pub const fn stallm(&self) -> bool { |
3953 | let val = (self.0 >> 3usize) & 0x01; |
3954 | val != 0 |
3955 | } |
3956 | #[doc = "STALL response received interrupt mask" ] |
3957 | #[inline (always)] |
3958 | pub fn set_stallm(&mut self, val: bool) { |
3959 | self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize); |
3960 | } |
3961 | #[doc = "NAK response received interrupt mask" ] |
3962 | #[inline (always)] |
3963 | pub const fn nakm(&self) -> bool { |
3964 | let val = (self.0 >> 4usize) & 0x01; |
3965 | val != 0 |
3966 | } |
3967 | #[doc = "NAK response received interrupt mask" ] |
3968 | #[inline (always)] |
3969 | pub fn set_nakm(&mut self, val: bool) { |
3970 | self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize); |
3971 | } |
3972 | #[doc = "ACK response received/transmitted interrupt mask" ] |
3973 | #[inline (always)] |
3974 | pub const fn ackm(&self) -> bool { |
3975 | let val = (self.0 >> 5usize) & 0x01; |
3976 | val != 0 |
3977 | } |
3978 | #[doc = "ACK response received/transmitted interrupt mask" ] |
3979 | #[inline (always)] |
3980 | pub fn set_ackm(&mut self, val: bool) { |
3981 | self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize); |
3982 | } |
3983 | #[doc = "Response received interrupt mask" ] |
3984 | #[inline (always)] |
3985 | pub const fn nyet(&self) -> bool { |
3986 | let val = (self.0 >> 6usize) & 0x01; |
3987 | val != 0 |
3988 | } |
3989 | #[doc = "Response received interrupt mask" ] |
3990 | #[inline (always)] |
3991 | pub fn set_nyet(&mut self, val: bool) { |
3992 | self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize); |
3993 | } |
3994 | #[doc = "Transaction error mask" ] |
3995 | #[inline (always)] |
3996 | pub const fn txerrm(&self) -> bool { |
3997 | let val = (self.0 >> 7usize) & 0x01; |
3998 | val != 0 |
3999 | } |
4000 | #[doc = "Transaction error mask" ] |
4001 | #[inline (always)] |
4002 | pub fn set_txerrm(&mut self, val: bool) { |
4003 | self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize); |
4004 | } |
4005 | #[doc = "Babble error mask" ] |
4006 | #[inline (always)] |
4007 | pub const fn bberrm(&self) -> bool { |
4008 | let val = (self.0 >> 8usize) & 0x01; |
4009 | val != 0 |
4010 | } |
4011 | #[doc = "Babble error mask" ] |
4012 | #[inline (always)] |
4013 | pub fn set_bberrm(&mut self, val: bool) { |
4014 | self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize); |
4015 | } |
4016 | #[doc = "Frame overrun mask" ] |
4017 | #[inline (always)] |
4018 | pub const fn frmorm(&self) -> bool { |
4019 | let val = (self.0 >> 9usize) & 0x01; |
4020 | val != 0 |
4021 | } |
4022 | #[doc = "Frame overrun mask" ] |
4023 | #[inline (always)] |
4024 | pub fn set_frmorm(&mut self, val: bool) { |
4025 | self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize); |
4026 | } |
4027 | #[doc = "Data toggle error mask" ] |
4028 | #[inline (always)] |
4029 | pub const fn dterrm(&self) -> bool { |
4030 | let val = (self.0 >> 10usize) & 0x01; |
4031 | val != 0 |
4032 | } |
4033 | #[doc = "Data toggle error mask" ] |
4034 | #[inline (always)] |
4035 | pub fn set_dterrm(&mut self, val: bool) { |
4036 | self.0 = (self.0 & !(0x01 << 10usize)) | (((val as u32) & 0x01) << 10usize); |
4037 | } |
4038 | } |
4039 | impl Default for Hcintmsk { |
4040 | #[inline (always)] |
4041 | fn default() -> Hcintmsk { |
4042 | Hcintmsk(0) |
4043 | } |
4044 | } |
4045 | #[doc = "Host channel transfer size register" ] |
4046 | #[repr (transparent)] |
4047 | #[derive (Copy, Clone, Eq, PartialEq)] |
4048 | pub struct Hctsiz(pub u32); |
4049 | impl Hctsiz { |
4050 | #[doc = "Transfer size" ] |
4051 | #[inline (always)] |
4052 | pub const fn xfrsiz(&self) -> u32 { |
4053 | let val = (self.0 >> 0usize) & 0x0007_ffff; |
4054 | val as u32 |
4055 | } |
4056 | #[doc = "Transfer size" ] |
4057 | #[inline (always)] |
4058 | pub fn set_xfrsiz(&mut self, val: u32) { |
4059 | self.0 = (self.0 & !(0x0007_ffff << 0usize)) | (((val as u32) & 0x0007_ffff) << 0usize); |
4060 | } |
4061 | #[doc = "Packet count" ] |
4062 | #[inline (always)] |
4063 | pub const fn pktcnt(&self) -> u16 { |
4064 | let val = (self.0 >> 19usize) & 0x03ff; |
4065 | val as u16 |
4066 | } |
4067 | #[doc = "Packet count" ] |
4068 | #[inline (always)] |
4069 | pub fn set_pktcnt(&mut self, val: u16) { |
4070 | self.0 = (self.0 & !(0x03ff << 19usize)) | (((val as u32) & 0x03ff) << 19usize); |
4071 | } |
4072 | #[doc = "Data PID" ] |
4073 | #[inline (always)] |
4074 | pub const fn dpid(&self) -> u8 { |
4075 | let val = (self.0 >> 29usize) & 0x03; |
4076 | val as u8 |
4077 | } |
4078 | #[doc = "Data PID" ] |
4079 | #[inline (always)] |
4080 | pub fn set_dpid(&mut self, val: u8) { |
4081 | self.0 = (self.0 & !(0x03 << 29usize)) | (((val as u32) & 0x03) << 29usize); |
4082 | } |
4083 | } |
4084 | impl Default for Hctsiz { |
4085 | #[inline (always)] |
4086 | fn default() -> Hctsiz { |
4087 | Hctsiz(0) |
4088 | } |
4089 | } |
4090 | #[doc = "Host frame interval register" ] |
4091 | #[repr (transparent)] |
4092 | #[derive (Copy, Clone, Eq, PartialEq)] |
4093 | pub struct Hfir(pub u32); |
4094 | impl Hfir { |
4095 | #[doc = "Frame interval" ] |
4096 | #[inline (always)] |
4097 | pub const fn frivl(&self) -> u16 { |
4098 | let val = (self.0 >> 0usize) & 0xffff; |
4099 | val as u16 |
4100 | } |
4101 | #[doc = "Frame interval" ] |
4102 | #[inline (always)] |
4103 | pub fn set_frivl(&mut self, val: u16) { |
4104 | self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize); |
4105 | } |
4106 | } |
4107 | impl Default for Hfir { |
4108 | #[inline (always)] |
4109 | fn default() -> Hfir { |
4110 | Hfir(0) |
4111 | } |
4112 | } |
4113 | #[doc = "Host frame number/frame time remaining register" ] |
4114 | #[repr (transparent)] |
4115 | #[derive (Copy, Clone, Eq, PartialEq)] |
4116 | pub struct Hfnum(pub u32); |
4117 | impl Hfnum { |
4118 | #[doc = "Frame number" ] |
4119 | #[inline (always)] |
4120 | pub const fn frnum(&self) -> u16 { |
4121 | let val = (self.0 >> 0usize) & 0xffff; |
4122 | val as u16 |
4123 | } |
4124 | #[doc = "Frame number" ] |
4125 | #[inline (always)] |
4126 | pub fn set_frnum(&mut self, val: u16) { |
4127 | self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize); |
4128 | } |
4129 | #[doc = "Frame time remaining" ] |
4130 | #[inline (always)] |
4131 | pub const fn ftrem(&self) -> u16 { |
4132 | let val = (self.0 >> 16usize) & 0xffff; |
4133 | val as u16 |
4134 | } |
4135 | #[doc = "Frame time remaining" ] |
4136 | #[inline (always)] |
4137 | pub fn set_ftrem(&mut self, val: u16) { |
4138 | self.0 = (self.0 & !(0xffff << 16usize)) | (((val as u32) & 0xffff) << 16usize); |
4139 | } |
4140 | } |
4141 | impl Default for Hfnum { |
4142 | #[inline (always)] |
4143 | fn default() -> Hfnum { |
4144 | Hfnum(0) |
4145 | } |
4146 | } |
4147 | #[doc = "Non-periodic transmit FIFO/queue status register" ] |
4148 | #[repr (transparent)] |
4149 | #[derive (Copy, Clone, Eq, PartialEq)] |
4150 | pub struct Hnptxsts(pub u32); |
4151 | impl Hnptxsts { |
4152 | #[doc = "Non-periodic TxFIFO space available" ] |
4153 | #[inline (always)] |
4154 | pub const fn nptxfsav(&self) -> u16 { |
4155 | let val = (self.0 >> 0usize) & 0xffff; |
4156 | val as u16 |
4157 | } |
4158 | #[doc = "Non-periodic TxFIFO space available" ] |
4159 | #[inline (always)] |
4160 | pub fn set_nptxfsav(&mut self, val: u16) { |
4161 | self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize); |
4162 | } |
4163 | #[doc = "Non-periodic transmit request queue space available" ] |
4164 | #[inline (always)] |
4165 | pub const fn nptqxsav(&self) -> u8 { |
4166 | let val = (self.0 >> 16usize) & 0xff; |
4167 | val as u8 |
4168 | } |
4169 | #[doc = "Non-periodic transmit request queue space available" ] |
4170 | #[inline (always)] |
4171 | pub fn set_nptqxsav(&mut self, val: u8) { |
4172 | self.0 = (self.0 & !(0xff << 16usize)) | (((val as u32) & 0xff) << 16usize); |
4173 | } |
4174 | #[doc = "Top of the non-periodic transmit request queue" ] |
4175 | #[inline (always)] |
4176 | pub const fn nptxqtop(&self) -> u8 { |
4177 | let val = (self.0 >> 24usize) & 0x7f; |
4178 | val as u8 |
4179 | } |
4180 | #[doc = "Top of the non-periodic transmit request queue" ] |
4181 | #[inline (always)] |
4182 | pub fn set_nptxqtop(&mut self, val: u8) { |
4183 | self.0 = (self.0 & !(0x7f << 24usize)) | (((val as u32) & 0x7f) << 24usize); |
4184 | } |
4185 | } |
4186 | impl Default for Hnptxsts { |
4187 | #[inline (always)] |
4188 | fn default() -> Hnptxsts { |
4189 | Hnptxsts(0) |
4190 | } |
4191 | } |
4192 | #[doc = "Host port control and status register" ] |
4193 | #[repr (transparent)] |
4194 | #[derive (Copy, Clone, Eq, PartialEq)] |
4195 | pub struct Hprt(pub u32); |
4196 | impl Hprt { |
4197 | #[doc = "Port connect status" ] |
4198 | #[inline (always)] |
4199 | pub const fn pcsts(&self) -> bool { |
4200 | let val = (self.0 >> 0usize) & 0x01; |
4201 | val != 0 |
4202 | } |
4203 | #[doc = "Port connect status" ] |
4204 | #[inline (always)] |
4205 | pub fn set_pcsts(&mut self, val: bool) { |
4206 | self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize); |
4207 | } |
4208 | #[doc = "Port connect detected" ] |
4209 | #[inline (always)] |
4210 | pub const fn pcdet(&self) -> bool { |
4211 | let val = (self.0 >> 1usize) & 0x01; |
4212 | val != 0 |
4213 | } |
4214 | #[doc = "Port connect detected" ] |
4215 | #[inline (always)] |
4216 | pub fn set_pcdet(&mut self, val: bool) { |
4217 | self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize); |
4218 | } |
4219 | #[doc = "Port enable" ] |
4220 | #[inline (always)] |
4221 | pub const fn pena(&self) -> bool { |
4222 | let val = (self.0 >> 2usize) & 0x01; |
4223 | val != 0 |
4224 | } |
4225 | #[doc = "Port enable" ] |
4226 | #[inline (always)] |
4227 | pub fn set_pena(&mut self, val: bool) { |
4228 | self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize); |
4229 | } |
4230 | #[doc = "Port enable/disable change" ] |
4231 | #[inline (always)] |
4232 | pub const fn penchng(&self) -> bool { |
4233 | let val = (self.0 >> 3usize) & 0x01; |
4234 | val != 0 |
4235 | } |
4236 | #[doc = "Port enable/disable change" ] |
4237 | #[inline (always)] |
4238 | pub fn set_penchng(&mut self, val: bool) { |
4239 | self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize); |
4240 | } |
4241 | #[doc = "Port overcurrent active" ] |
4242 | #[inline (always)] |
4243 | pub const fn poca(&self) -> bool { |
4244 | let val = (self.0 >> 4usize) & 0x01; |
4245 | val != 0 |
4246 | } |
4247 | #[doc = "Port overcurrent active" ] |
4248 | #[inline (always)] |
4249 | pub fn set_poca(&mut self, val: bool) { |
4250 | self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize); |
4251 | } |
4252 | #[doc = "Port overcurrent change" ] |
4253 | #[inline (always)] |
4254 | pub const fn pocchng(&self) -> bool { |
4255 | let val = (self.0 >> 5usize) & 0x01; |
4256 | val != 0 |
4257 | } |
4258 | #[doc = "Port overcurrent change" ] |
4259 | #[inline (always)] |
4260 | pub fn set_pocchng(&mut self, val: bool) { |
4261 | self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize); |
4262 | } |
4263 | #[doc = "Port resume" ] |
4264 | #[inline (always)] |
4265 | pub const fn pres(&self) -> bool { |
4266 | let val = (self.0 >> 6usize) & 0x01; |
4267 | val != 0 |
4268 | } |
4269 | #[doc = "Port resume" ] |
4270 | #[inline (always)] |
4271 | pub fn set_pres(&mut self, val: bool) { |
4272 | self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize); |
4273 | } |
4274 | #[doc = "Port suspend" ] |
4275 | #[inline (always)] |
4276 | pub const fn psusp(&self) -> bool { |
4277 | let val = (self.0 >> 7usize) & 0x01; |
4278 | val != 0 |
4279 | } |
4280 | #[doc = "Port suspend" ] |
4281 | #[inline (always)] |
4282 | pub fn set_psusp(&mut self, val: bool) { |
4283 | self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize); |
4284 | } |
4285 | #[doc = "Port reset" ] |
4286 | #[inline (always)] |
4287 | pub const fn prst(&self) -> bool { |
4288 | let val = (self.0 >> 8usize) & 0x01; |
4289 | val != 0 |
4290 | } |
4291 | #[doc = "Port reset" ] |
4292 | #[inline (always)] |
4293 | pub fn set_prst(&mut self, val: bool) { |
4294 | self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize); |
4295 | } |
4296 | #[doc = "Port line status" ] |
4297 | #[inline (always)] |
4298 | pub const fn plsts(&self) -> u8 { |
4299 | let val = (self.0 >> 10usize) & 0x03; |
4300 | val as u8 |
4301 | } |
4302 | #[doc = "Port line status" ] |
4303 | #[inline (always)] |
4304 | pub fn set_plsts(&mut self, val: u8) { |
4305 | self.0 = (self.0 & !(0x03 << 10usize)) | (((val as u32) & 0x03) << 10usize); |
4306 | } |
4307 | #[doc = "Port power" ] |
4308 | #[inline (always)] |
4309 | pub const fn ppwr(&self) -> bool { |
4310 | let val = (self.0 >> 12usize) & 0x01; |
4311 | val != 0 |
4312 | } |
4313 | #[doc = "Port power" ] |
4314 | #[inline (always)] |
4315 | pub fn set_ppwr(&mut self, val: bool) { |
4316 | self.0 = (self.0 & !(0x01 << 12usize)) | (((val as u32) & 0x01) << 12usize); |
4317 | } |
4318 | #[doc = "Port test control" ] |
4319 | #[inline (always)] |
4320 | pub const fn ptctl(&self) -> u8 { |
4321 | let val = (self.0 >> 13usize) & 0x0f; |
4322 | val as u8 |
4323 | } |
4324 | #[doc = "Port test control" ] |
4325 | #[inline (always)] |
4326 | pub fn set_ptctl(&mut self, val: u8) { |
4327 | self.0 = (self.0 & !(0x0f << 13usize)) | (((val as u32) & 0x0f) << 13usize); |
4328 | } |
4329 | #[doc = "Port speed" ] |
4330 | #[inline (always)] |
4331 | pub const fn pspd(&self) -> u8 { |
4332 | let val = (self.0 >> 17usize) & 0x03; |
4333 | val as u8 |
4334 | } |
4335 | #[doc = "Port speed" ] |
4336 | #[inline (always)] |
4337 | pub fn set_pspd(&mut self, val: u8) { |
4338 | self.0 = (self.0 & !(0x03 << 17usize)) | (((val as u32) & 0x03) << 17usize); |
4339 | } |
4340 | } |
4341 | impl Default for Hprt { |
4342 | #[inline (always)] |
4343 | fn default() -> Hprt { |
4344 | Hprt(0) |
4345 | } |
4346 | } |
4347 | #[doc = "Periodic transmit FIFO/queue status register" ] |
4348 | #[repr (transparent)] |
4349 | #[derive (Copy, Clone, Eq, PartialEq)] |
4350 | pub struct Hptxsts(pub u32); |
4351 | impl Hptxsts { |
4352 | #[doc = "Periodic transmit data FIFO space available" ] |
4353 | #[inline (always)] |
4354 | pub const fn ptxfsavl(&self) -> u16 { |
4355 | let val = (self.0 >> 0usize) & 0xffff; |
4356 | val as u16 |
4357 | } |
4358 | #[doc = "Periodic transmit data FIFO space available" ] |
4359 | #[inline (always)] |
4360 | pub fn set_ptxfsavl(&mut self, val: u16) { |
4361 | self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize); |
4362 | } |
4363 | #[doc = "Periodic transmit request queue space available" ] |
4364 | #[inline (always)] |
4365 | pub const fn ptxqsav(&self) -> u8 { |
4366 | let val = (self.0 >> 16usize) & 0xff; |
4367 | val as u8 |
4368 | } |
4369 | #[doc = "Periodic transmit request queue space available" ] |
4370 | #[inline (always)] |
4371 | pub fn set_ptxqsav(&mut self, val: u8) { |
4372 | self.0 = (self.0 & !(0xff << 16usize)) | (((val as u32) & 0xff) << 16usize); |
4373 | } |
4374 | #[doc = "Top of the periodic transmit request queue" ] |
4375 | #[inline (always)] |
4376 | pub const fn ptxqtop(&self) -> u8 { |
4377 | let val = (self.0 >> 24usize) & 0xff; |
4378 | val as u8 |
4379 | } |
4380 | #[doc = "Top of the periodic transmit request queue" ] |
4381 | #[inline (always)] |
4382 | pub fn set_ptxqtop(&mut self, val: u8) { |
4383 | self.0 = (self.0 & !(0xff << 24usize)) | (((val as u32) & 0xff) << 24usize); |
4384 | } |
4385 | } |
4386 | impl Default for Hptxsts { |
4387 | #[inline (always)] |
4388 | fn default() -> Hptxsts { |
4389 | Hptxsts(0) |
4390 | } |
4391 | } |
4392 | #[doc = "Power and clock gating control register" ] |
4393 | #[repr (transparent)] |
4394 | #[derive (Copy, Clone, Eq, PartialEq)] |
4395 | pub struct Pcgcctl(pub u32); |
4396 | impl Pcgcctl { |
4397 | #[doc = "Stop PHY clock" ] |
4398 | #[inline (always)] |
4399 | pub const fn stppclk(&self) -> bool { |
4400 | let val = (self.0 >> 0usize) & 0x01; |
4401 | val != 0 |
4402 | } |
4403 | #[doc = "Stop PHY clock" ] |
4404 | #[inline (always)] |
4405 | pub fn set_stppclk(&mut self, val: bool) { |
4406 | self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize); |
4407 | } |
4408 | #[doc = "Gate HCLK" ] |
4409 | #[inline (always)] |
4410 | pub const fn gatehclk(&self) -> bool { |
4411 | let val = (self.0 >> 1usize) & 0x01; |
4412 | val != 0 |
4413 | } |
4414 | #[doc = "Gate HCLK" ] |
4415 | #[inline (always)] |
4416 | pub fn set_gatehclk(&mut self, val: bool) { |
4417 | self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize); |
4418 | } |
4419 | #[doc = "PHY Suspended" ] |
4420 | #[inline (always)] |
4421 | pub const fn physusp(&self) -> bool { |
4422 | let val = (self.0 >> 4usize) & 0x01; |
4423 | val != 0 |
4424 | } |
4425 | #[doc = "PHY Suspended" ] |
4426 | #[inline (always)] |
4427 | pub fn set_physusp(&mut self, val: bool) { |
4428 | self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize); |
4429 | } |
4430 | } |
4431 | impl Default for Pcgcctl { |
4432 | #[inline (always)] |
4433 | fn default() -> Pcgcctl { |
4434 | Pcgcctl(0) |
4435 | } |
4436 | } |
4437 | } |
4438 | pub mod vals { |
4439 | #[repr (u8)] |
4440 | #[derive (Copy, Clone, Eq, PartialEq, Ord, PartialOrd)] |
4441 | #[allow (non_camel_case_types)] |
4442 | pub enum Dpid { |
4443 | DATA0 = 0x0, |
4444 | DATA2 = 0x01, |
4445 | DATA1 = 0x02, |
4446 | MDATA = 0x03, |
4447 | } |
4448 | impl Dpid { |
4449 | #[inline (always)] |
4450 | pub const fn from_bits(val: u8) -> Dpid { |
4451 | unsafe { core::mem::transmute(val & 0x03) } |
4452 | } |
4453 | #[inline (always)] |
4454 | pub const fn to_bits(self) -> u8 { |
4455 | unsafe { core::mem::transmute(self) } |
4456 | } |
4457 | } |
4458 | impl From<u8> for Dpid { |
4459 | #[inline (always)] |
4460 | fn from(val: u8) -> Dpid { |
4461 | Dpid::from_bits(val) |
4462 | } |
4463 | } |
4464 | impl From<Dpid> for u8 { |
4465 | #[inline (always)] |
4466 | fn from(val: Dpid) -> u8 { |
4467 | Dpid::to_bits(val) |
4468 | } |
4469 | } |
4470 | #[repr (u8)] |
4471 | #[derive (Copy, Clone, Eq, PartialEq, Ord, PartialOrd)] |
4472 | #[allow (non_camel_case_types)] |
4473 | pub enum Dspd { |
4474 | #[doc = "High speed" ] |
4475 | HIGH_SPEED = 0x0, |
4476 | #[doc = "Full speed using external ULPI PHY" ] |
4477 | FULL_SPEED_EXTERNAL = 0x01, |
4478 | _RESERVED_2 = 0x02, |
4479 | #[doc = "Full speed using internal embedded PHY" ] |
4480 | FULL_SPEED_INTERNAL = 0x03, |
4481 | } |
4482 | impl Dspd { |
4483 | #[inline (always)] |
4484 | pub const fn from_bits(val: u8) -> Dspd { |
4485 | unsafe { core::mem::transmute(val & 0x03) } |
4486 | } |
4487 | #[inline (always)] |
4488 | pub const fn to_bits(self) -> u8 { |
4489 | unsafe { core::mem::transmute(self) } |
4490 | } |
4491 | } |
4492 | impl From<u8> for Dspd { |
4493 | #[inline (always)] |
4494 | fn from(val: u8) -> Dspd { |
4495 | Dspd::from_bits(val) |
4496 | } |
4497 | } |
4498 | impl From<Dspd> for u8 { |
4499 | #[inline (always)] |
4500 | fn from(val: Dspd) -> u8 { |
4501 | Dspd::to_bits(val) |
4502 | } |
4503 | } |
4504 | #[repr (u8)] |
4505 | #[derive (Copy, Clone, Eq, PartialEq, Ord, PartialOrd)] |
4506 | #[allow (non_camel_case_types)] |
4507 | pub enum Eptyp { |
4508 | CONTROL = 0x0, |
4509 | ISOCHRONOUS = 0x01, |
4510 | BULK = 0x02, |
4511 | INTERRUPT = 0x03, |
4512 | } |
4513 | impl Eptyp { |
4514 | #[inline (always)] |
4515 | pub const fn from_bits(val: u8) -> Eptyp { |
4516 | unsafe { core::mem::transmute(val & 0x03) } |
4517 | } |
4518 | #[inline (always)] |
4519 | pub const fn to_bits(self) -> u8 { |
4520 | unsafe { core::mem::transmute(self) } |
4521 | } |
4522 | } |
4523 | impl From<u8> for Eptyp { |
4524 | #[inline (always)] |
4525 | fn from(val: u8) -> Eptyp { |
4526 | Eptyp::from_bits(val) |
4527 | } |
4528 | } |
4529 | impl From<Eptyp> for u8 { |
4530 | #[inline (always)] |
4531 | fn from(val: Eptyp) -> u8 { |
4532 | Eptyp::to_bits(val) |
4533 | } |
4534 | } |
4535 | #[repr (u8)] |
4536 | #[derive (Copy, Clone, Eq, PartialEq, Ord, PartialOrd)] |
4537 | #[allow (non_camel_case_types)] |
4538 | pub enum Pfivl { |
4539 | #[doc = "80% of the frame interval" ] |
4540 | FRAME_INTERVAL_80 = 0x0, |
4541 | #[doc = "85% of the frame interval" ] |
4542 | FRAME_INTERVAL_85 = 0x01, |
4543 | #[doc = "90% of the frame interval" ] |
4544 | FRAME_INTERVAL_90 = 0x02, |
4545 | #[doc = "95% of the frame interval" ] |
4546 | FRAME_INTERVAL_95 = 0x03, |
4547 | } |
4548 | impl Pfivl { |
4549 | #[inline (always)] |
4550 | pub const fn from_bits(val: u8) -> Pfivl { |
4551 | unsafe { core::mem::transmute(val & 0x03) } |
4552 | } |
4553 | #[inline (always)] |
4554 | pub const fn to_bits(self) -> u8 { |
4555 | unsafe { core::mem::transmute(self) } |
4556 | } |
4557 | } |
4558 | impl From<u8> for Pfivl { |
4559 | #[inline (always)] |
4560 | fn from(val: u8) -> Pfivl { |
4561 | Pfivl::from_bits(val) |
4562 | } |
4563 | } |
4564 | impl From<Pfivl> for u8 { |
4565 | #[inline (always)] |
4566 | fn from(val: Pfivl) -> u8 { |
4567 | Pfivl::to_bits(val) |
4568 | } |
4569 | } |
4570 | #[repr (u8)] |
4571 | #[derive (Copy, Clone, Eq, PartialEq, Ord, PartialOrd)] |
4572 | #[allow (non_camel_case_types)] |
4573 | pub enum Pktstsd { |
4574 | _RESERVED_0 = 0x0, |
4575 | #[doc = "Global OUT NAK (triggers an interrupt)" ] |
4576 | OUT_NAK = 0x01, |
4577 | #[doc = "OUT data packet received" ] |
4578 | OUT_DATA_RX = 0x02, |
4579 | #[doc = "OUT transfer completed (triggers an interrupt)" ] |
4580 | OUT_DATA_DONE = 0x03, |
4581 | #[doc = "SETUP transaction completed (triggers an interrupt)" ] |
4582 | SETUP_DATA_DONE = 0x04, |
4583 | _RESERVED_5 = 0x05, |
4584 | #[doc = "SETUP data packet received" ] |
4585 | SETUP_DATA_RX = 0x06, |
4586 | _RESERVED_7 = 0x07, |
4587 | _RESERVED_8 = 0x08, |
4588 | _RESERVED_9 = 0x09, |
4589 | _RESERVED_a = 0x0a, |
4590 | _RESERVED_b = 0x0b, |
4591 | _RESERVED_c = 0x0c, |
4592 | _RESERVED_d = 0x0d, |
4593 | _RESERVED_e = 0x0e, |
4594 | _RESERVED_f = 0x0f, |
4595 | } |
4596 | impl Pktstsd { |
4597 | #[inline (always)] |
4598 | pub const fn from_bits(val: u8) -> Pktstsd { |
4599 | unsafe { core::mem::transmute(val & 0x0f) } |
4600 | } |
4601 | #[inline (always)] |
4602 | pub const fn to_bits(self) -> u8 { |
4603 | unsafe { core::mem::transmute(self) } |
4604 | } |
4605 | } |
4606 | impl From<u8> for Pktstsd { |
4607 | #[inline (always)] |
4608 | fn from(val: u8) -> Pktstsd { |
4609 | Pktstsd::from_bits(val) |
4610 | } |
4611 | } |
4612 | impl From<Pktstsd> for u8 { |
4613 | #[inline (always)] |
4614 | fn from(val: Pktstsd) -> u8 { |
4615 | Pktstsd::to_bits(val) |
4616 | } |
4617 | } |
4618 | #[repr (u8)] |
4619 | #[derive (Copy, Clone, Eq, PartialEq, Ord, PartialOrd)] |
4620 | #[allow (non_camel_case_types)] |
4621 | pub enum Pktstsh { |
4622 | _RESERVED_0 = 0x0, |
4623 | _RESERVED_1 = 0x01, |
4624 | #[doc = "IN data packet received" ] |
4625 | IN_DATA_RX = 0x02, |
4626 | #[doc = "IN transfer completed (triggers an interrupt)" ] |
4627 | IN_DATA_DONE = 0x03, |
4628 | _RESERVED_4 = 0x04, |
4629 | #[doc = "Data toggle error (triggers an interrupt)" ] |
4630 | DATA_TOGGLE_ERR = 0x05, |
4631 | _RESERVED_6 = 0x06, |
4632 | #[doc = "Channel halted (triggers an interrupt)" ] |
4633 | CHANNEL_HALTED = 0x07, |
4634 | _RESERVED_8 = 0x08, |
4635 | _RESERVED_9 = 0x09, |
4636 | _RESERVED_a = 0x0a, |
4637 | _RESERVED_b = 0x0b, |
4638 | _RESERVED_c = 0x0c, |
4639 | _RESERVED_d = 0x0d, |
4640 | _RESERVED_e = 0x0e, |
4641 | _RESERVED_f = 0x0f, |
4642 | } |
4643 | impl Pktstsh { |
4644 | #[inline (always)] |
4645 | pub const fn from_bits(val: u8) -> Pktstsh { |
4646 | unsafe { core::mem::transmute(val & 0x0f) } |
4647 | } |
4648 | #[inline (always)] |
4649 | pub const fn to_bits(self) -> u8 { |
4650 | unsafe { core::mem::transmute(self) } |
4651 | } |
4652 | } |
4653 | impl From<u8> for Pktstsh { |
4654 | #[inline (always)] |
4655 | fn from(val: u8) -> Pktstsh { |
4656 | Pktstsh::from_bits(val) |
4657 | } |
4658 | } |
4659 | impl From<Pktstsh> for u8 { |
4660 | #[inline (always)] |
4661 | fn from(val: Pktstsh) -> u8 { |
4662 | Pktstsh::to_bits(val) |
4663 | } |
4664 | } |
4665 | } |
4666 | |