lpc55_pac/usb1/
devcmdstat.rs1#[doc = "Register `DEVCMDSTAT` reader"]
2pub struct R(crate::R<DEVCMDSTAT_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<DEVCMDSTAT_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<DEVCMDSTAT_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<DEVCMDSTAT_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `DEVCMDSTAT` writer"]
17pub struct W(crate::W<DEVCMDSTAT_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<DEVCMDSTAT_SPEC>;
20 #[inline(always)]
21 fn deref(&self) -> &Self::Target {
22 &self.0
23 }
24}
25impl core::ops::DerefMut for W {
26 #[inline(always)]
27 fn deref_mut(&mut self) -> &mut Self::Target {
28 &mut self.0
29 }
30}
31impl From<crate::W<DEVCMDSTAT_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<DEVCMDSTAT_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `DEV_ADDR` reader - USB device address."]
38pub struct DEV_ADDR_R(crate::FieldReader<u8, u8>);
39impl DEV_ADDR_R {
40 #[inline(always)]
41 pub(crate) fn new(bits: u8) -> Self {
42 DEV_ADDR_R(crate::FieldReader::new(bits))
43 }
44}
45impl core::ops::Deref for DEV_ADDR_R {
46 type Target = crate::FieldReader<u8, u8>;
47 #[inline(always)]
48 fn deref(&self) -> &Self::Target {
49 &self.0
50 }
51}
52#[doc = "Field `DEV_ADDR` writer - USB device address."]
53pub struct DEV_ADDR_W<'a> {
54 w: &'a mut W,
55}
56impl<'a> DEV_ADDR_W<'a> {
57 #[doc = r"Writes raw bits to the field"]
58 #[inline(always)]
59 pub unsafe fn bits(self, value: u8) -> &'a mut W {
60 self.w.bits = (self.w.bits & !0x7f) | (value as u32 & 0x7f);
61 self.w
62 }
63}
64#[doc = "Field `DEV_EN` reader - USB device enable."]
65pub struct DEV_EN_R(crate::FieldReader<bool, bool>);
66impl DEV_EN_R {
67 #[inline(always)]
68 pub(crate) fn new(bits: bool) -> Self {
69 DEV_EN_R(crate::FieldReader::new(bits))
70 }
71}
72impl core::ops::Deref for DEV_EN_R {
73 type Target = crate::FieldReader<bool, bool>;
74 #[inline(always)]
75 fn deref(&self) -> &Self::Target {
76 &self.0
77 }
78}
79#[doc = "Field `DEV_EN` writer - USB device enable."]
80pub struct DEV_EN_W<'a> {
81 w: &'a mut W,
82}
83impl<'a> DEV_EN_W<'a> {
84 #[doc = r"Sets the field bit"]
85 #[inline(always)]
86 pub fn set_bit(self) -> &'a mut W {
87 self.bit(true)
88 }
89 #[doc = r"Clears the field bit"]
90 #[inline(always)]
91 pub fn clear_bit(self) -> &'a mut W {
92 self.bit(false)
93 }
94 #[doc = r"Writes raw bits to the field"]
95 #[inline(always)]
96 pub fn bit(self, value: bool) -> &'a mut W {
97 self.w.bits = (self.w.bits & !(0x01 << 7)) | ((value as u32 & 0x01) << 7);
98 self.w
99 }
100}
101#[doc = "Field `SETUP` reader - SETUP token received."]
102pub struct SETUP_R(crate::FieldReader<bool, bool>);
103impl SETUP_R {
104 #[inline(always)]
105 pub(crate) fn new(bits: bool) -> Self {
106 SETUP_R(crate::FieldReader::new(bits))
107 }
108}
109impl core::ops::Deref for SETUP_R {
110 type Target = crate::FieldReader<bool, bool>;
111 #[inline(always)]
112 fn deref(&self) -> &Self::Target {
113 &self.0
114 }
115}
116#[doc = "Field `SETUP` writer - SETUP token received."]
117pub struct SETUP_W<'a> {
118 w: &'a mut W,
119}
120impl<'a> SETUP_W<'a> {
121 #[doc = r"Sets the field bit"]
122 #[inline(always)]
123 pub fn set_bit(self) -> &'a mut W {
124 self.bit(true)
125 }
126 #[doc = r"Clears the field bit"]
127 #[inline(always)]
128 pub fn clear_bit(self) -> &'a mut W {
129 self.bit(false)
130 }
131 #[doc = r"Writes raw bits to the field"]
132 #[inline(always)]
133 pub fn bit(self, value: bool) -> &'a mut W {
134 self.w.bits = (self.w.bits & !(0x01 << 8)) | ((value as u32 & 0x01) << 8);
135 self.w
136 }
137}
138#[doc = "Field `FORCE_NEEDCLK` reader - Forces the NEEDCLK output to always be on:."]
139pub struct FORCE_NEEDCLK_R(crate::FieldReader<bool, bool>);
140impl FORCE_NEEDCLK_R {
141 #[inline(always)]
142 pub(crate) fn new(bits: bool) -> Self {
143 FORCE_NEEDCLK_R(crate::FieldReader::new(bits))
144 }
145}
146impl core::ops::Deref for FORCE_NEEDCLK_R {
147 type Target = crate::FieldReader<bool, bool>;
148 #[inline(always)]
149 fn deref(&self) -> &Self::Target {
150 &self.0
151 }
152}
153#[doc = "Field `FORCE_NEEDCLK` writer - Forces the NEEDCLK output to always be on:."]
154pub struct FORCE_NEEDCLK_W<'a> {
155 w: &'a mut W,
156}
157impl<'a> FORCE_NEEDCLK_W<'a> {
158 #[doc = r"Sets the field bit"]
159 #[inline(always)]
160 pub fn set_bit(self) -> &'a mut W {
161 self.bit(true)
162 }
163 #[doc = r"Clears the field bit"]
164 #[inline(always)]
165 pub fn clear_bit(self) -> &'a mut W {
166 self.bit(false)
167 }
168 #[doc = r"Writes raw bits to the field"]
169 #[inline(always)]
170 pub fn bit(self, value: bool) -> &'a mut W {
171 self.w.bits = (self.w.bits & !(0x01 << 9)) | ((value as u32 & 0x01) << 9);
172 self.w
173 }
174}
175#[doc = "Field `LPM_SUP` reader - LPM Supported:."]
176pub struct LPM_SUP_R(crate::FieldReader<bool, bool>);
177impl LPM_SUP_R {
178 #[inline(always)]
179 pub(crate) fn new(bits: bool) -> Self {
180 LPM_SUP_R(crate::FieldReader::new(bits))
181 }
182}
183impl core::ops::Deref for LPM_SUP_R {
184 type Target = crate::FieldReader<bool, bool>;
185 #[inline(always)]
186 fn deref(&self) -> &Self::Target {
187 &self.0
188 }
189}
190#[doc = "Field `LPM_SUP` writer - LPM Supported:."]
191pub struct LPM_SUP_W<'a> {
192 w: &'a mut W,
193}
194impl<'a> LPM_SUP_W<'a> {
195 #[doc = r"Sets the field bit"]
196 #[inline(always)]
197 pub fn set_bit(self) -> &'a mut W {
198 self.bit(true)
199 }
200 #[doc = r"Clears the field bit"]
201 #[inline(always)]
202 pub fn clear_bit(self) -> &'a mut W {
203 self.bit(false)
204 }
205 #[doc = r"Writes raw bits to the field"]
206 #[inline(always)]
207 pub fn bit(self, value: bool) -> &'a mut W {
208 self.w.bits = (self.w.bits & !(0x01 << 11)) | ((value as u32 & 0x01) << 11);
209 self.w
210 }
211}
212#[doc = "Field `INTONNAK_AO` reader - Interrupt on NAK for interrupt and bulk OUT EP:."]
213pub struct INTONNAK_AO_R(crate::FieldReader<bool, bool>);
214impl INTONNAK_AO_R {
215 #[inline(always)]
216 pub(crate) fn new(bits: bool) -> Self {
217 INTONNAK_AO_R(crate::FieldReader::new(bits))
218 }
219}
220impl core::ops::Deref for INTONNAK_AO_R {
221 type Target = crate::FieldReader<bool, bool>;
222 #[inline(always)]
223 fn deref(&self) -> &Self::Target {
224 &self.0
225 }
226}
227#[doc = "Field `INTONNAK_AO` writer - Interrupt on NAK for interrupt and bulk OUT EP:."]
228pub struct INTONNAK_AO_W<'a> {
229 w: &'a mut W,
230}
231impl<'a> INTONNAK_AO_W<'a> {
232 #[doc = r"Sets the field bit"]
233 #[inline(always)]
234 pub fn set_bit(self) -> &'a mut W {
235 self.bit(true)
236 }
237 #[doc = r"Clears the field bit"]
238 #[inline(always)]
239 pub fn clear_bit(self) -> &'a mut W {
240 self.bit(false)
241 }
242 #[doc = r"Writes raw bits to the field"]
243 #[inline(always)]
244 pub fn bit(self, value: bool) -> &'a mut W {
245 self.w.bits = (self.w.bits & !(0x01 << 12)) | ((value as u32 & 0x01) << 12);
246 self.w
247 }
248}
249#[doc = "Field `INTONNAK_AI` reader - Interrupt on NAK for interrupt and bulk IN EP:."]
250pub struct INTONNAK_AI_R(crate::FieldReader<bool, bool>);
251impl INTONNAK_AI_R {
252 #[inline(always)]
253 pub(crate) fn new(bits: bool) -> Self {
254 INTONNAK_AI_R(crate::FieldReader::new(bits))
255 }
256}
257impl core::ops::Deref for INTONNAK_AI_R {
258 type Target = crate::FieldReader<bool, bool>;
259 #[inline(always)]
260 fn deref(&self) -> &Self::Target {
261 &self.0
262 }
263}
264#[doc = "Field `INTONNAK_AI` writer - Interrupt on NAK for interrupt and bulk IN EP:."]
265pub struct INTONNAK_AI_W<'a> {
266 w: &'a mut W,
267}
268impl<'a> INTONNAK_AI_W<'a> {
269 #[doc = r"Sets the field bit"]
270 #[inline(always)]
271 pub fn set_bit(self) -> &'a mut W {
272 self.bit(true)
273 }
274 #[doc = r"Clears the field bit"]
275 #[inline(always)]
276 pub fn clear_bit(self) -> &'a mut W {
277 self.bit(false)
278 }
279 #[doc = r"Writes raw bits to the field"]
280 #[inline(always)]
281 pub fn bit(self, value: bool) -> &'a mut W {
282 self.w.bits = (self.w.bits & !(0x01 << 13)) | ((value as u32 & 0x01) << 13);
283 self.w
284 }
285}
286#[doc = "Field `INTONNAK_CO` reader - Interrupt on NAK for control OUT EP:."]
287pub struct INTONNAK_CO_R(crate::FieldReader<bool, bool>);
288impl INTONNAK_CO_R {
289 #[inline(always)]
290 pub(crate) fn new(bits: bool) -> Self {
291 INTONNAK_CO_R(crate::FieldReader::new(bits))
292 }
293}
294impl core::ops::Deref for INTONNAK_CO_R {
295 type Target = crate::FieldReader<bool, bool>;
296 #[inline(always)]
297 fn deref(&self) -> &Self::Target {
298 &self.0
299 }
300}
301#[doc = "Field `INTONNAK_CO` writer - Interrupt on NAK for control OUT EP:."]
302pub struct INTONNAK_CO_W<'a> {
303 w: &'a mut W,
304}
305impl<'a> INTONNAK_CO_W<'a> {
306 #[doc = r"Sets the field bit"]
307 #[inline(always)]
308 pub fn set_bit(self) -> &'a mut W {
309 self.bit(true)
310 }
311 #[doc = r"Clears the field bit"]
312 #[inline(always)]
313 pub fn clear_bit(self) -> &'a mut W {
314 self.bit(false)
315 }
316 #[doc = r"Writes raw bits to the field"]
317 #[inline(always)]
318 pub fn bit(self, value: bool) -> &'a mut W {
319 self.w.bits = (self.w.bits & !(0x01 << 14)) | ((value as u32 & 0x01) << 14);
320 self.w
321 }
322}
323#[doc = "Field `INTONNAK_CI` reader - Interrupt on NAK for control IN EP:."]
324pub struct INTONNAK_CI_R(crate::FieldReader<bool, bool>);
325impl INTONNAK_CI_R {
326 #[inline(always)]
327 pub(crate) fn new(bits: bool) -> Self {
328 INTONNAK_CI_R(crate::FieldReader::new(bits))
329 }
330}
331impl core::ops::Deref for INTONNAK_CI_R {
332 type Target = crate::FieldReader<bool, bool>;
333 #[inline(always)]
334 fn deref(&self) -> &Self::Target {
335 &self.0
336 }
337}
338#[doc = "Field `INTONNAK_CI` writer - Interrupt on NAK for control IN EP:."]
339pub struct INTONNAK_CI_W<'a> {
340 w: &'a mut W,
341}
342impl<'a> INTONNAK_CI_W<'a> {
343 #[doc = r"Sets the field bit"]
344 #[inline(always)]
345 pub fn set_bit(self) -> &'a mut W {
346 self.bit(true)
347 }
348 #[doc = r"Clears the field bit"]
349 #[inline(always)]
350 pub fn clear_bit(self) -> &'a mut W {
351 self.bit(false)
352 }
353 #[doc = r"Writes raw bits to the field"]
354 #[inline(always)]
355 pub fn bit(self, value: bool) -> &'a mut W {
356 self.w.bits = (self.w.bits & !(0x01 << 15)) | ((value as u32 & 0x01) << 15);
357 self.w
358 }
359}
360#[doc = "Field `DCON` reader - Device status - connect."]
361pub struct DCON_R(crate::FieldReader<bool, bool>);
362impl DCON_R {
363 #[inline(always)]
364 pub(crate) fn new(bits: bool) -> Self {
365 DCON_R(crate::FieldReader::new(bits))
366 }
367}
368impl core::ops::Deref for DCON_R {
369 type Target = crate::FieldReader<bool, bool>;
370 #[inline(always)]
371 fn deref(&self) -> &Self::Target {
372 &self.0
373 }
374}
375#[doc = "Field `DCON` writer - Device status - connect."]
376pub struct DCON_W<'a> {
377 w: &'a mut W,
378}
379impl<'a> DCON_W<'a> {
380 #[doc = r"Sets the field bit"]
381 #[inline(always)]
382 pub fn set_bit(self) -> &'a mut W {
383 self.bit(true)
384 }
385 #[doc = r"Clears the field bit"]
386 #[inline(always)]
387 pub fn clear_bit(self) -> &'a mut W {
388 self.bit(false)
389 }
390 #[doc = r"Writes raw bits to the field"]
391 #[inline(always)]
392 pub fn bit(self, value: bool) -> &'a mut W {
393 self.w.bits = (self.w.bits & !(0x01 << 16)) | ((value as u32 & 0x01) << 16);
394 self.w
395 }
396}
397#[doc = "Field `DSUS` reader - Device status - suspend."]
398pub struct DSUS_R(crate::FieldReader<bool, bool>);
399impl DSUS_R {
400 #[inline(always)]
401 pub(crate) fn new(bits: bool) -> Self {
402 DSUS_R(crate::FieldReader::new(bits))
403 }
404}
405impl core::ops::Deref for DSUS_R {
406 type Target = crate::FieldReader<bool, bool>;
407 #[inline(always)]
408 fn deref(&self) -> &Self::Target {
409 &self.0
410 }
411}
412#[doc = "Field `DSUS` writer - Device status - suspend."]
413pub struct DSUS_W<'a> {
414 w: &'a mut W,
415}
416impl<'a> DSUS_W<'a> {
417 #[doc = r"Sets the field bit"]
418 #[inline(always)]
419 pub fn set_bit(self) -> &'a mut W {
420 self.bit(true)
421 }
422 #[doc = r"Clears the field bit"]
423 #[inline(always)]
424 pub fn clear_bit(self) -> &'a mut W {
425 self.bit(false)
426 }
427 #[doc = r"Writes raw bits to the field"]
428 #[inline(always)]
429 pub fn bit(self, value: bool) -> &'a mut W {
430 self.w.bits = (self.w.bits & !(0x01 << 17)) | ((value as u32 & 0x01) << 17);
431 self.w
432 }
433}
434#[doc = "Field `LPM_SUS` reader - Device status - LPM Suspend."]
435pub struct LPM_SUS_R(crate::FieldReader<bool, bool>);
436impl LPM_SUS_R {
437 #[inline(always)]
438 pub(crate) fn new(bits: bool) -> Self {
439 LPM_SUS_R(crate::FieldReader::new(bits))
440 }
441}
442impl core::ops::Deref for LPM_SUS_R {
443 type Target = crate::FieldReader<bool, bool>;
444 #[inline(always)]
445 fn deref(&self) -> &Self::Target {
446 &self.0
447 }
448}
449#[doc = "Field `LPM_SUS` writer - Device status - LPM Suspend."]
450pub struct LPM_SUS_W<'a> {
451 w: &'a mut W,
452}
453impl<'a> LPM_SUS_W<'a> {
454 #[doc = r"Sets the field bit"]
455 #[inline(always)]
456 pub fn set_bit(self) -> &'a mut W {
457 self.bit(true)
458 }
459 #[doc = r"Clears the field bit"]
460 #[inline(always)]
461 pub fn clear_bit(self) -> &'a mut W {
462 self.bit(false)
463 }
464 #[doc = r"Writes raw bits to the field"]
465 #[inline(always)]
466 pub fn bit(self, value: bool) -> &'a mut W {
467 self.w.bits = (self.w.bits & !(0x01 << 19)) | ((value as u32 & 0x01) << 19);
468 self.w
469 }
470}
471#[doc = "Field `LPM_REWP` reader - LPM Remote Wake-up Enabled by USB host."]
472pub struct LPM_REWP_R(crate::FieldReader<bool, bool>);
473impl LPM_REWP_R {
474 #[inline(always)]
475 pub(crate) fn new(bits: bool) -> Self {
476 LPM_REWP_R(crate::FieldReader::new(bits))
477 }
478}
479impl core::ops::Deref for LPM_REWP_R {
480 type Target = crate::FieldReader<bool, bool>;
481 #[inline(always)]
482 fn deref(&self) -> &Self::Target {
483 &self.0
484 }
485}
486#[doc = "Field `Speed` reader - This field indicates the speed at which the device operates: 00b: reserved 01b: full-speed 10b: high-speed 11b: super-speed (reserved for future use)."]
487pub struct SPEED_R(crate::FieldReader<u8, u8>);
488impl SPEED_R {
489 #[inline(always)]
490 pub(crate) fn new(bits: u8) -> Self {
491 SPEED_R(crate::FieldReader::new(bits))
492 }
493}
494impl core::ops::Deref for SPEED_R {
495 type Target = crate::FieldReader<u8, u8>;
496 #[inline(always)]
497 fn deref(&self) -> &Self::Target {
498 &self.0
499 }
500}
501#[doc = "Field `DCON_C` reader - Device status - connect change."]
502pub struct DCON_C_R(crate::FieldReader<bool, bool>);
503impl DCON_C_R {
504 #[inline(always)]
505 pub(crate) fn new(bits: bool) -> Self {
506 DCON_C_R(crate::FieldReader::new(bits))
507 }
508}
509impl core::ops::Deref for DCON_C_R {
510 type Target = crate::FieldReader<bool, bool>;
511 #[inline(always)]
512 fn deref(&self) -> &Self::Target {
513 &self.0
514 }
515}
516#[doc = "Field `DCON_C` writer - Device status - connect change."]
517pub struct DCON_C_W<'a> {
518 w: &'a mut W,
519}
520impl<'a> DCON_C_W<'a> {
521 #[doc = r"Sets the field bit"]
522 #[inline(always)]
523 pub fn set_bit(self) -> &'a mut W {
524 self.bit(true)
525 }
526 #[doc = r"Clears the field bit"]
527 #[inline(always)]
528 pub fn clear_bit(self) -> &'a mut W {
529 self.bit(false)
530 }
531 #[doc = r"Writes raw bits to the field"]
532 #[inline(always)]
533 pub fn bit(self, value: bool) -> &'a mut W {
534 self.w.bits = (self.w.bits & !(0x01 << 24)) | ((value as u32 & 0x01) << 24);
535 self.w
536 }
537}
538#[doc = "Field `DSUS_C` reader - Device status - suspend change."]
539pub struct DSUS_C_R(crate::FieldReader<bool, bool>);
540impl DSUS_C_R {
541 #[inline(always)]
542 pub(crate) fn new(bits: bool) -> Self {
543 DSUS_C_R(crate::FieldReader::new(bits))
544 }
545}
546impl core::ops::Deref for DSUS_C_R {
547 type Target = crate::FieldReader<bool, bool>;
548 #[inline(always)]
549 fn deref(&self) -> &Self::Target {
550 &self.0
551 }
552}
553#[doc = "Field `DSUS_C` writer - Device status - suspend change."]
554pub struct DSUS_C_W<'a> {
555 w: &'a mut W,
556}
557impl<'a> DSUS_C_W<'a> {
558 #[doc = r"Sets the field bit"]
559 #[inline(always)]
560 pub fn set_bit(self) -> &'a mut W {
561 self.bit(true)
562 }
563 #[doc = r"Clears the field bit"]
564 #[inline(always)]
565 pub fn clear_bit(self) -> &'a mut W {
566 self.bit(false)
567 }
568 #[doc = r"Writes raw bits to the field"]
569 #[inline(always)]
570 pub fn bit(self, value: bool) -> &'a mut W {
571 self.w.bits = (self.w.bits & !(0x01 << 25)) | ((value as u32 & 0x01) << 25);
572 self.w
573 }
574}
575#[doc = "Field `DRES_C` reader - Device status - reset change."]
576pub struct DRES_C_R(crate::FieldReader<bool, bool>);
577impl DRES_C_R {
578 #[inline(always)]
579 pub(crate) fn new(bits: bool) -> Self {
580 DRES_C_R(crate::FieldReader::new(bits))
581 }
582}
583impl core::ops::Deref for DRES_C_R {
584 type Target = crate::FieldReader<bool, bool>;
585 #[inline(always)]
586 fn deref(&self) -> &Self::Target {
587 &self.0
588 }
589}
590#[doc = "Field `DRES_C` writer - Device status - reset change."]
591pub struct DRES_C_W<'a> {
592 w: &'a mut W,
593}
594impl<'a> DRES_C_W<'a> {
595 #[doc = r"Sets the field bit"]
596 #[inline(always)]
597 pub fn set_bit(self) -> &'a mut W {
598 self.bit(true)
599 }
600 #[doc = r"Clears the field bit"]
601 #[inline(always)]
602 pub fn clear_bit(self) -> &'a mut W {
603 self.bit(false)
604 }
605 #[doc = r"Writes raw bits to the field"]
606 #[inline(always)]
607 pub fn bit(self, value: bool) -> &'a mut W {
608 self.w.bits = (self.w.bits & !(0x01 << 26)) | ((value as u32 & 0x01) << 26);
609 self.w
610 }
611}
612#[doc = "Field `VBUS_DEBOUNCED` reader - This bit indicates if VBUS is detected or not."]
613pub struct VBUS_DEBOUNCED_R(crate::FieldReader<bool, bool>);
614impl VBUS_DEBOUNCED_R {
615 #[inline(always)]
616 pub(crate) fn new(bits: bool) -> Self {
617 VBUS_DEBOUNCED_R(crate::FieldReader::new(bits))
618 }
619}
620impl core::ops::Deref for VBUS_DEBOUNCED_R {
621 type Target = crate::FieldReader<bool, bool>;
622 #[inline(always)]
623 fn deref(&self) -> &Self::Target {
624 &self.0
625 }
626}
627#[doc = "Field `PHY_TEST_MODE` reader - This field is written by firmware to put the PHY into a test mode as defined by the USB2.0 specification"]
628pub struct PHY_TEST_MODE_R(crate::FieldReader<u8, u8>);
629impl PHY_TEST_MODE_R {
630 #[inline(always)]
631 pub(crate) fn new(bits: u8) -> Self {
632 PHY_TEST_MODE_R(crate::FieldReader::new(bits))
633 }
634}
635impl core::ops::Deref for PHY_TEST_MODE_R {
636 type Target = crate::FieldReader<u8, u8>;
637 #[inline(always)]
638 fn deref(&self) -> &Self::Target {
639 &self.0
640 }
641}
642#[doc = "Field `PHY_TEST_MODE` writer - This field is written by firmware to put the PHY into a test mode as defined by the USB2.0 specification"]
643pub struct PHY_TEST_MODE_W<'a> {
644 w: &'a mut W,
645}
646impl<'a> PHY_TEST_MODE_W<'a> {
647 #[doc = r"Writes raw bits to the field"]
648 #[inline(always)]
649 pub unsafe fn bits(self, value: u8) -> &'a mut W {
650 self.w.bits = (self.w.bits & !(0x07 << 29)) | ((value as u32 & 0x07) << 29);
651 self.w
652 }
653}
654#[doc = "Field `FORCE_FS` reader - Force USB device to operate in full-speed mode."]
655pub struct FORCE_FS_R(crate::FieldReader<bool, bool>);
656impl FORCE_FS_R {
657 #[inline(always)]
658 pub(crate) fn new(bits: bool) -> Self {
659 FORCE_FS_R(crate::FieldReader::new(bits))
660 }
661}
662impl core::ops::Deref for FORCE_FS_R {
663 type Target = crate::FieldReader<bool, bool>;
664 #[inline(always)]
665 fn deref(&self) -> &Self::Target {
666 &self.0
667 }
668}
669#[doc = "Field `FORCE_FS` writer - Force USB device to operate in full-speed mode."]
670pub struct FORCE_FS_W<'a> {
671 w: &'a mut W,
672}
673impl<'a> FORCE_FS_W<'a> {
674 #[doc = r"Sets the field bit"]
675 #[inline(always)]
676 pub fn set_bit(self) -> &'a mut W {
677 self.bit(true)
678 }
679 #[doc = r"Clears the field bit"]
680 #[inline(always)]
681 pub fn clear_bit(self) -> &'a mut W {
682 self.bit(false)
683 }
684 #[doc = r"Writes raw bits to the field"]
685 #[inline(always)]
686 pub fn bit(self, value: bool) -> &'a mut W {
687 self.w.bits = (self.w.bits & !(0x01 << 21)) | ((value as u32 & 0x01) << 21);
688 self.w
689 }
690}
691impl R {
692 #[doc = "Bits 0:6 - USB device address."]
693 #[inline(always)]
694 pub fn dev_addr(&self) -> DEV_ADDR_R {
695 DEV_ADDR_R::new((self.bits & 0x7f) as u8)
696 }
697 #[doc = "Bit 7 - USB device enable."]
698 #[inline(always)]
699 pub fn dev_en(&self) -> DEV_EN_R {
700 DEV_EN_R::new(((self.bits >> 7) & 0x01) != 0)
701 }
702 #[doc = "Bit 8 - SETUP token received."]
703 #[inline(always)]
704 pub fn setup(&self) -> SETUP_R {
705 SETUP_R::new(((self.bits >> 8) & 0x01) != 0)
706 }
707 #[doc = "Bit 9 - Forces the NEEDCLK output to always be on:."]
708 #[inline(always)]
709 pub fn force_needclk(&self) -> FORCE_NEEDCLK_R {
710 FORCE_NEEDCLK_R::new(((self.bits >> 9) & 0x01) != 0)
711 }
712 #[doc = "Bit 11 - LPM Supported:."]
713 #[inline(always)]
714 pub fn lpm_sup(&self) -> LPM_SUP_R {
715 LPM_SUP_R::new(((self.bits >> 11) & 0x01) != 0)
716 }
717 #[doc = "Bit 12 - Interrupt on NAK for interrupt and bulk OUT EP:."]
718 #[inline(always)]
719 pub fn intonnak_ao(&self) -> INTONNAK_AO_R {
720 INTONNAK_AO_R::new(((self.bits >> 12) & 0x01) != 0)
721 }
722 #[doc = "Bit 13 - Interrupt on NAK for interrupt and bulk IN EP:."]
723 #[inline(always)]
724 pub fn intonnak_ai(&self) -> INTONNAK_AI_R {
725 INTONNAK_AI_R::new(((self.bits >> 13) & 0x01) != 0)
726 }
727 #[doc = "Bit 14 - Interrupt on NAK for control OUT EP:."]
728 #[inline(always)]
729 pub fn intonnak_co(&self) -> INTONNAK_CO_R {
730 INTONNAK_CO_R::new(((self.bits >> 14) & 0x01) != 0)
731 }
732 #[doc = "Bit 15 - Interrupt on NAK for control IN EP:."]
733 #[inline(always)]
734 pub fn intonnak_ci(&self) -> INTONNAK_CI_R {
735 INTONNAK_CI_R::new(((self.bits >> 15) & 0x01) != 0)
736 }
737 #[doc = "Bit 16 - Device status - connect."]
738 #[inline(always)]
739 pub fn dcon(&self) -> DCON_R {
740 DCON_R::new(((self.bits >> 16) & 0x01) != 0)
741 }
742 #[doc = "Bit 17 - Device status - suspend."]
743 #[inline(always)]
744 pub fn dsus(&self) -> DSUS_R {
745 DSUS_R::new(((self.bits >> 17) & 0x01) != 0)
746 }
747 #[doc = "Bit 19 - Device status - LPM Suspend."]
748 #[inline(always)]
749 pub fn lpm_sus(&self) -> LPM_SUS_R {
750 LPM_SUS_R::new(((self.bits >> 19) & 0x01) != 0)
751 }
752 #[doc = "Bit 20 - LPM Remote Wake-up Enabled by USB host."]
753 #[inline(always)]
754 pub fn lpm_rewp(&self) -> LPM_REWP_R {
755 LPM_REWP_R::new(((self.bits >> 20) & 0x01) != 0)
756 }
757 #[doc = "Bits 22:23 - This field indicates the speed at which the device operates: 00b: reserved 01b: full-speed 10b: high-speed 11b: super-speed (reserved for future use)."]
758 #[inline(always)]
759 pub fn speed(&self) -> SPEED_R {
760 SPEED_R::new(((self.bits >> 22) & 0x03) as u8)
761 }
762 #[doc = "Bit 24 - Device status - connect change."]
763 #[inline(always)]
764 pub fn dcon_c(&self) -> DCON_C_R {
765 DCON_C_R::new(((self.bits >> 24) & 0x01) != 0)
766 }
767 #[doc = "Bit 25 - Device status - suspend change."]
768 #[inline(always)]
769 pub fn dsus_c(&self) -> DSUS_C_R {
770 DSUS_C_R::new(((self.bits >> 25) & 0x01) != 0)
771 }
772 #[doc = "Bit 26 - Device status - reset change."]
773 #[inline(always)]
774 pub fn dres_c(&self) -> DRES_C_R {
775 DRES_C_R::new(((self.bits >> 26) & 0x01) != 0)
776 }
777 #[doc = "Bit 28 - This bit indicates if VBUS is detected or not."]
778 #[inline(always)]
779 pub fn vbus_debounced(&self) -> VBUS_DEBOUNCED_R {
780 VBUS_DEBOUNCED_R::new(((self.bits >> 28) & 0x01) != 0)
781 }
782 #[doc = "Bits 29:31 - This field is written by firmware to put the PHY into a test mode as defined by the USB2.0 specification"]
783 #[inline(always)]
784 pub fn phy_test_mode(&self) -> PHY_TEST_MODE_R {
785 PHY_TEST_MODE_R::new(((self.bits >> 29) & 0x07) as u8)
786 }
787 #[doc = "Bit 21 - Force USB device to operate in full-speed mode."]
788 #[inline(always)]
789 pub fn force_fs(&self) -> FORCE_FS_R {
790 FORCE_FS_R::new(((self.bits >> 21) & 0x01) != 0)
791 }
792}
793impl W {
794 #[doc = "Bits 0:6 - USB device address."]
795 #[inline(always)]
796 pub fn dev_addr(&mut self) -> DEV_ADDR_W {
797 DEV_ADDR_W { w: self }
798 }
799 #[doc = "Bit 7 - USB device enable."]
800 #[inline(always)]
801 pub fn dev_en(&mut self) -> DEV_EN_W {
802 DEV_EN_W { w: self }
803 }
804 #[doc = "Bit 8 - SETUP token received."]
805 #[inline(always)]
806 pub fn setup(&mut self) -> SETUP_W {
807 SETUP_W { w: self }
808 }
809 #[doc = "Bit 9 - Forces the NEEDCLK output to always be on:."]
810 #[inline(always)]
811 pub fn force_needclk(&mut self) -> FORCE_NEEDCLK_W {
812 FORCE_NEEDCLK_W { w: self }
813 }
814 #[doc = "Bit 11 - LPM Supported:."]
815 #[inline(always)]
816 pub fn lpm_sup(&mut self) -> LPM_SUP_W {
817 LPM_SUP_W { w: self }
818 }
819 #[doc = "Bit 12 - Interrupt on NAK for interrupt and bulk OUT EP:."]
820 #[inline(always)]
821 pub fn intonnak_ao(&mut self) -> INTONNAK_AO_W {
822 INTONNAK_AO_W { w: self }
823 }
824 #[doc = "Bit 13 - Interrupt on NAK for interrupt and bulk IN EP:."]
825 #[inline(always)]
826 pub fn intonnak_ai(&mut self) -> INTONNAK_AI_W {
827 INTONNAK_AI_W { w: self }
828 }
829 #[doc = "Bit 14 - Interrupt on NAK for control OUT EP:."]
830 #[inline(always)]
831 pub fn intonnak_co(&mut self) -> INTONNAK_CO_W {
832 INTONNAK_CO_W { w: self }
833 }
834 #[doc = "Bit 15 - Interrupt on NAK for control IN EP:."]
835 #[inline(always)]
836 pub fn intonnak_ci(&mut self) -> INTONNAK_CI_W {
837 INTONNAK_CI_W { w: self }
838 }
839 #[doc = "Bit 16 - Device status - connect."]
840 #[inline(always)]
841 pub fn dcon(&mut self) -> DCON_W {
842 DCON_W { w: self }
843 }
844 #[doc = "Bit 17 - Device status - suspend."]
845 #[inline(always)]
846 pub fn dsus(&mut self) -> DSUS_W {
847 DSUS_W { w: self }
848 }
849 #[doc = "Bit 19 - Device status - LPM Suspend."]
850 #[inline(always)]
851 pub fn lpm_sus(&mut self) -> LPM_SUS_W {
852 LPM_SUS_W { w: self }
853 }
854 #[doc = "Bit 24 - Device status - connect change."]
855 #[inline(always)]
856 pub fn dcon_c(&mut self) -> DCON_C_W {
857 DCON_C_W { w: self }
858 }
859 #[doc = "Bit 25 - Device status - suspend change."]
860 #[inline(always)]
861 pub fn dsus_c(&mut self) -> DSUS_C_W {
862 DSUS_C_W { w: self }
863 }
864 #[doc = "Bit 26 - Device status - reset change."]
865 #[inline(always)]
866 pub fn dres_c(&mut self) -> DRES_C_W {
867 DRES_C_W { w: self }
868 }
869 #[doc = "Bits 29:31 - This field is written by firmware to put the PHY into a test mode as defined by the USB2.0 specification"]
870 #[inline(always)]
871 pub fn phy_test_mode(&mut self) -> PHY_TEST_MODE_W {
872 PHY_TEST_MODE_W { w: self }
873 }
874 #[doc = "Bit 21 - Force USB device to operate in full-speed mode."]
875 #[inline(always)]
876 pub fn force_fs(&mut self) -> FORCE_FS_W {
877 FORCE_FS_W { w: self }
878 }
879 #[doc = "Writes raw bits to the register."]
880 #[inline(always)]
881 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
882 self.0.bits(bits);
883 self
884 }
885}
886#[doc = "USB Device Command/Status register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [devcmdstat](index.html) module"]
887pub struct DEVCMDSTAT_SPEC;
888impl crate::RegisterSpec for DEVCMDSTAT_SPEC {
889 type Ux = u32;
890}
891#[doc = "`read()` method returns [devcmdstat::R](R) reader structure"]
892impl crate::Readable for DEVCMDSTAT_SPEC {
893 type Reader = R;
894}
895#[doc = "`write(|w| ..)` method takes [devcmdstat::W](W) writer structure"]
896impl crate::Writable for DEVCMDSTAT_SPEC {
897 type Writer = W;
898}
899#[doc = "`reset()` method sets DEVCMDSTAT to value 0x0800"]
900impl crate::Resettable for DEVCMDSTAT_SPEC {
901 #[inline(always)]
902 fn reset_value() -> Self::Ux {
903 0x0800
904 }
905}