stm32f103xx/usb/istr/
mod.rs1#[doc = r" Value read from the register"]
2pub struct R {
3 bits: u32,
4}
5#[doc = r" Value to write to the register"]
6pub struct W {
7 bits: u32,
8}
9impl super::ISTR {
10 #[doc = r" Modifies the contents of the register"]
11 #[inline]
12 pub fn modify<F>(&self, f: F)
13 where
14 for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
15 {
16 let bits = self.register.get();
17 let r = R { bits: bits };
18 let mut w = W { bits: bits };
19 f(&r, &mut w);
20 self.register.set(w.bits);
21 }
22 #[doc = r" Reads the contents of the register"]
23 #[inline]
24 pub fn read(&self) -> R {
25 R {
26 bits: self.register.get(),
27 }
28 }
29 #[doc = r" Writes to the register"]
30 #[inline]
31 pub fn write<F>(&self, f: F)
32 where
33 F: FnOnce(&mut W) -> &mut W,
34 {
35 let mut w = W::reset_value();
36 f(&mut w);
37 self.register.set(w.bits);
38 }
39 #[doc = r" Writes the reset value to the register"]
40 #[inline]
41 pub fn reset(&self) {
42 self.write(|w| w)
43 }
44}
45#[doc = r" Value of the field"]
46pub struct EP_IDR {
47 bits: u8,
48}
49impl EP_IDR {
50 #[doc = r" Value of the field as raw bits"]
51 #[inline]
52 pub fn bits(&self) -> u8 {
53 self.bits
54 }
55}
56#[doc = r" Value of the field"]
57pub struct DIRR {
58 bits: bool,
59}
60impl DIRR {
61 #[doc = r" Value of the field as raw bits"]
62 #[inline]
63 pub fn bit(&self) -> bool {
64 self.bits
65 }
66 #[doc = r" Returns `true` if the bit is clear (0)"]
67 #[inline]
68 pub fn bit_is_clear(&self) -> bool {
69 !self.bit()
70 }
71 #[doc = r" Returns `true` if the bit is set (1)"]
72 #[inline]
73 pub fn bit_is_set(&self) -> bool {
74 self.bit()
75 }
76}
77#[doc = r" Value of the field"]
78pub struct ESOFR {
79 bits: bool,
80}
81impl ESOFR {
82 #[doc = r" Value of the field as raw bits"]
83 #[inline]
84 pub fn bit(&self) -> bool {
85 self.bits
86 }
87 #[doc = r" Returns `true` if the bit is clear (0)"]
88 #[inline]
89 pub fn bit_is_clear(&self) -> bool {
90 !self.bit()
91 }
92 #[doc = r" Returns `true` if the bit is set (1)"]
93 #[inline]
94 pub fn bit_is_set(&self) -> bool {
95 self.bit()
96 }
97}
98#[doc = r" Value of the field"]
99pub struct SOFR {
100 bits: bool,
101}
102impl SOFR {
103 #[doc = r" Value of the field as raw bits"]
104 #[inline]
105 pub fn bit(&self) -> bool {
106 self.bits
107 }
108 #[doc = r" Returns `true` if the bit is clear (0)"]
109 #[inline]
110 pub fn bit_is_clear(&self) -> bool {
111 !self.bit()
112 }
113 #[doc = r" Returns `true` if the bit is set (1)"]
114 #[inline]
115 pub fn bit_is_set(&self) -> bool {
116 self.bit()
117 }
118}
119#[doc = r" Value of the field"]
120pub struct RESETR {
121 bits: bool,
122}
123impl RESETR {
124 #[doc = r" Value of the field as raw bits"]
125 #[inline]
126 pub fn bit(&self) -> bool {
127 self.bits
128 }
129 #[doc = r" Returns `true` if the bit is clear (0)"]
130 #[inline]
131 pub fn bit_is_clear(&self) -> bool {
132 !self.bit()
133 }
134 #[doc = r" Returns `true` if the bit is set (1)"]
135 #[inline]
136 pub fn bit_is_set(&self) -> bool {
137 self.bit()
138 }
139}
140#[doc = r" Value of the field"]
141pub struct SUSPR {
142 bits: bool,
143}
144impl SUSPR {
145 #[doc = r" Value of the field as raw bits"]
146 #[inline]
147 pub fn bit(&self) -> bool {
148 self.bits
149 }
150 #[doc = r" Returns `true` if the bit is clear (0)"]
151 #[inline]
152 pub fn bit_is_clear(&self) -> bool {
153 !self.bit()
154 }
155 #[doc = r" Returns `true` if the bit is set (1)"]
156 #[inline]
157 pub fn bit_is_set(&self) -> bool {
158 self.bit()
159 }
160}
161#[doc = r" Value of the field"]
162pub struct WKUPR {
163 bits: bool,
164}
165impl WKUPR {
166 #[doc = r" Value of the field as raw bits"]
167 #[inline]
168 pub fn bit(&self) -> bool {
169 self.bits
170 }
171 #[doc = r" Returns `true` if the bit is clear (0)"]
172 #[inline]
173 pub fn bit_is_clear(&self) -> bool {
174 !self.bit()
175 }
176 #[doc = r" Returns `true` if the bit is set (1)"]
177 #[inline]
178 pub fn bit_is_set(&self) -> bool {
179 self.bit()
180 }
181}
182#[doc = r" Value of the field"]
183pub struct ERRR {
184 bits: bool,
185}
186impl ERRR {
187 #[doc = r" Value of the field as raw bits"]
188 #[inline]
189 pub fn bit(&self) -> bool {
190 self.bits
191 }
192 #[doc = r" Returns `true` if the bit is clear (0)"]
193 #[inline]
194 pub fn bit_is_clear(&self) -> bool {
195 !self.bit()
196 }
197 #[doc = r" Returns `true` if the bit is set (1)"]
198 #[inline]
199 pub fn bit_is_set(&self) -> bool {
200 self.bit()
201 }
202}
203#[doc = r" Value of the field"]
204pub struct PMAOVRR {
205 bits: bool,
206}
207impl PMAOVRR {
208 #[doc = r" Value of the field as raw bits"]
209 #[inline]
210 pub fn bit(&self) -> bool {
211 self.bits
212 }
213 #[doc = r" Returns `true` if the bit is clear (0)"]
214 #[inline]
215 pub fn bit_is_clear(&self) -> bool {
216 !self.bit()
217 }
218 #[doc = r" Returns `true` if the bit is set (1)"]
219 #[inline]
220 pub fn bit_is_set(&self) -> bool {
221 self.bit()
222 }
223}
224#[doc = r" Value of the field"]
225pub struct CTRR {
226 bits: bool,
227}
228impl CTRR {
229 #[doc = r" Value of the field as raw bits"]
230 #[inline]
231 pub fn bit(&self) -> bool {
232 self.bits
233 }
234 #[doc = r" Returns `true` if the bit is clear (0)"]
235 #[inline]
236 pub fn bit_is_clear(&self) -> bool {
237 !self.bit()
238 }
239 #[doc = r" Returns `true` if the bit is set (1)"]
240 #[inline]
241 pub fn bit_is_set(&self) -> bool {
242 self.bit()
243 }
244}
245#[doc = r" Proxy"]
246pub struct _EP_IDW<'a> {
247 w: &'a mut W,
248}
249impl<'a> _EP_IDW<'a> {
250 #[doc = r" Writes raw bits to the field"]
251 #[inline]
252 pub unsafe fn bits(self, value: u8) -> &'a mut W {
253 const MASK: u8 = 15;
254 const OFFSET: u8 = 0;
255 self.w.bits &= !((MASK as u32) << OFFSET);
256 self.w.bits |= ((value & MASK) as u32) << OFFSET;
257 self.w
258 }
259}
260#[doc = r" Proxy"]
261pub struct _DIRW<'a> {
262 w: &'a mut W,
263}
264impl<'a> _DIRW<'a> {
265 #[doc = r" Sets the field bit"]
266 pub fn set_bit(self) -> &'a mut W {
267 self.bit(true)
268 }
269 #[doc = r" Clears the field bit"]
270 pub fn clear_bit(self) -> &'a mut W {
271 self.bit(false)
272 }
273 #[doc = r" Writes raw bits to the field"]
274 #[inline]
275 pub fn bit(self, value: bool) -> &'a mut W {
276 const MASK: bool = true;
277 const OFFSET: u8 = 4;
278 self.w.bits &= !((MASK as u32) << OFFSET);
279 self.w.bits |= ((value & MASK) as u32) << OFFSET;
280 self.w
281 }
282}
283#[doc = r" Proxy"]
284pub struct _ESOFW<'a> {
285 w: &'a mut W,
286}
287impl<'a> _ESOFW<'a> {
288 #[doc = r" Sets the field bit"]
289 pub fn set_bit(self) -> &'a mut W {
290 self.bit(true)
291 }
292 #[doc = r" Clears the field bit"]
293 pub fn clear_bit(self) -> &'a mut W {
294 self.bit(false)
295 }
296 #[doc = r" Writes raw bits to the field"]
297 #[inline]
298 pub fn bit(self, value: bool) -> &'a mut W {
299 const MASK: bool = true;
300 const OFFSET: u8 = 8;
301 self.w.bits &= !((MASK as u32) << OFFSET);
302 self.w.bits |= ((value & MASK) as u32) << OFFSET;
303 self.w
304 }
305}
306#[doc = r" Proxy"]
307pub struct _SOFW<'a> {
308 w: &'a mut W,
309}
310impl<'a> _SOFW<'a> {
311 #[doc = r" Sets the field bit"]
312 pub fn set_bit(self) -> &'a mut W {
313 self.bit(true)
314 }
315 #[doc = r" Clears the field bit"]
316 pub fn clear_bit(self) -> &'a mut W {
317 self.bit(false)
318 }
319 #[doc = r" Writes raw bits to the field"]
320 #[inline]
321 pub fn bit(self, value: bool) -> &'a mut W {
322 const MASK: bool = true;
323 const OFFSET: u8 = 9;
324 self.w.bits &= !((MASK as u32) << OFFSET);
325 self.w.bits |= ((value & MASK) as u32) << OFFSET;
326 self.w
327 }
328}
329#[doc = r" Proxy"]
330pub struct _RESETW<'a> {
331 w: &'a mut W,
332}
333impl<'a> _RESETW<'a> {
334 #[doc = r" Sets the field bit"]
335 pub fn set_bit(self) -> &'a mut W {
336 self.bit(true)
337 }
338 #[doc = r" Clears the field bit"]
339 pub fn clear_bit(self) -> &'a mut W {
340 self.bit(false)
341 }
342 #[doc = r" Writes raw bits to the field"]
343 #[inline]
344 pub fn bit(self, value: bool) -> &'a mut W {
345 const MASK: bool = true;
346 const OFFSET: u8 = 10;
347 self.w.bits &= !((MASK as u32) << OFFSET);
348 self.w.bits |= ((value & MASK) as u32) << OFFSET;
349 self.w
350 }
351}
352#[doc = r" Proxy"]
353pub struct _SUSPW<'a> {
354 w: &'a mut W,
355}
356impl<'a> _SUSPW<'a> {
357 #[doc = r" Sets the field bit"]
358 pub fn set_bit(self) -> &'a mut W {
359 self.bit(true)
360 }
361 #[doc = r" Clears the field bit"]
362 pub fn clear_bit(self) -> &'a mut W {
363 self.bit(false)
364 }
365 #[doc = r" Writes raw bits to the field"]
366 #[inline]
367 pub fn bit(self, value: bool) -> &'a mut W {
368 const MASK: bool = true;
369 const OFFSET: u8 = 11;
370 self.w.bits &= !((MASK as u32) << OFFSET);
371 self.w.bits |= ((value & MASK) as u32) << OFFSET;
372 self.w
373 }
374}
375#[doc = r" Proxy"]
376pub struct _WKUPW<'a> {
377 w: &'a mut W,
378}
379impl<'a> _WKUPW<'a> {
380 #[doc = r" Sets the field bit"]
381 pub fn set_bit(self) -> &'a mut W {
382 self.bit(true)
383 }
384 #[doc = r" Clears the field bit"]
385 pub fn clear_bit(self) -> &'a mut W {
386 self.bit(false)
387 }
388 #[doc = r" Writes raw bits to the field"]
389 #[inline]
390 pub fn bit(self, value: bool) -> &'a mut W {
391 const MASK: bool = true;
392 const OFFSET: u8 = 12;
393 self.w.bits &= !((MASK as u32) << OFFSET);
394 self.w.bits |= ((value & MASK) as u32) << OFFSET;
395 self.w
396 }
397}
398#[doc = r" Proxy"]
399pub struct _ERRW<'a> {
400 w: &'a mut W,
401}
402impl<'a> _ERRW<'a> {
403 #[doc = r" Sets the field bit"]
404 pub fn set_bit(self) -> &'a mut W {
405 self.bit(true)
406 }
407 #[doc = r" Clears the field bit"]
408 pub fn clear_bit(self) -> &'a mut W {
409 self.bit(false)
410 }
411 #[doc = r" Writes raw bits to the field"]
412 #[inline]
413 pub fn bit(self, value: bool) -> &'a mut W {
414 const MASK: bool = true;
415 const OFFSET: u8 = 13;
416 self.w.bits &= !((MASK as u32) << OFFSET);
417 self.w.bits |= ((value & MASK) as u32) << OFFSET;
418 self.w
419 }
420}
421#[doc = r" Proxy"]
422pub struct _PMAOVRW<'a> {
423 w: &'a mut W,
424}
425impl<'a> _PMAOVRW<'a> {
426 #[doc = r" Sets the field bit"]
427 pub fn set_bit(self) -> &'a mut W {
428 self.bit(true)
429 }
430 #[doc = r" Clears the field bit"]
431 pub fn clear_bit(self) -> &'a mut W {
432 self.bit(false)
433 }
434 #[doc = r" Writes raw bits to the field"]
435 #[inline]
436 pub fn bit(self, value: bool) -> &'a mut W {
437 const MASK: bool = true;
438 const OFFSET: u8 = 14;
439 self.w.bits &= !((MASK as u32) << OFFSET);
440 self.w.bits |= ((value & MASK) as u32) << OFFSET;
441 self.w
442 }
443}
444#[doc = r" Proxy"]
445pub struct _CTRW<'a> {
446 w: &'a mut W,
447}
448impl<'a> _CTRW<'a> {
449 #[doc = r" Sets the field bit"]
450 pub fn set_bit(self) -> &'a mut W {
451 self.bit(true)
452 }
453 #[doc = r" Clears the field bit"]
454 pub fn clear_bit(self) -> &'a mut W {
455 self.bit(false)
456 }
457 #[doc = r" Writes raw bits to the field"]
458 #[inline]
459 pub fn bit(self, value: bool) -> &'a mut W {
460 const MASK: bool = true;
461 const OFFSET: u8 = 15;
462 self.w.bits &= !((MASK as u32) << OFFSET);
463 self.w.bits |= ((value & MASK) as u32) << OFFSET;
464 self.w
465 }
466}
467impl R {
468 #[doc = r" Value of the register as raw bits"]
469 #[inline]
470 pub fn bits(&self) -> u32 {
471 self.bits
472 }
473 #[doc = "Bits 0:3 - Endpoint Identifier"]
474 #[inline]
475 pub fn ep_id(&self) -> EP_IDR {
476 let bits = {
477 const MASK: u8 = 15;
478 const OFFSET: u8 = 0;
479 ((self.bits >> OFFSET) & MASK as u32) as u8
480 };
481 EP_IDR { bits }
482 }
483 #[doc = "Bit 4 - Direction of transaction"]
484 #[inline]
485 pub fn dir(&self) -> DIRR {
486 let bits = {
487 const MASK: bool = true;
488 const OFFSET: u8 = 4;
489 ((self.bits >> OFFSET) & MASK as u32) != 0
490 };
491 DIRR { bits }
492 }
493 #[doc = "Bit 8 - Expected start frame"]
494 #[inline]
495 pub fn esof(&self) -> ESOFR {
496 let bits = {
497 const MASK: bool = true;
498 const OFFSET: u8 = 8;
499 ((self.bits >> OFFSET) & MASK as u32) != 0
500 };
501 ESOFR { bits }
502 }
503 #[doc = "Bit 9 - start of frame"]
504 #[inline]
505 pub fn sof(&self) -> SOFR {
506 let bits = {
507 const MASK: bool = true;
508 const OFFSET: u8 = 9;
509 ((self.bits >> OFFSET) & MASK as u32) != 0
510 };
511 SOFR { bits }
512 }
513 #[doc = "Bit 10 - reset request"]
514 #[inline]
515 pub fn reset(&self) -> RESETR {
516 let bits = {
517 const MASK: bool = true;
518 const OFFSET: u8 = 10;
519 ((self.bits >> OFFSET) & MASK as u32) != 0
520 };
521 RESETR { bits }
522 }
523 #[doc = "Bit 11 - Suspend mode request"]
524 #[inline]
525 pub fn susp(&self) -> SUSPR {
526 let bits = {
527 const MASK: bool = true;
528 const OFFSET: u8 = 11;
529 ((self.bits >> OFFSET) & MASK as u32) != 0
530 };
531 SUSPR { bits }
532 }
533 #[doc = "Bit 12 - Wakeup"]
534 #[inline]
535 pub fn wkup(&self) -> WKUPR {
536 let bits = {
537 const MASK: bool = true;
538 const OFFSET: u8 = 12;
539 ((self.bits >> OFFSET) & MASK as u32) != 0
540 };
541 WKUPR { bits }
542 }
543 #[doc = "Bit 13 - Error"]
544 #[inline]
545 pub fn err(&self) -> ERRR {
546 let bits = {
547 const MASK: bool = true;
548 const OFFSET: u8 = 13;
549 ((self.bits >> OFFSET) & MASK as u32) != 0
550 };
551 ERRR { bits }
552 }
553 #[doc = "Bit 14 - Packet memory area over / underrun"]
554 #[inline]
555 pub fn pmaovr(&self) -> PMAOVRR {
556 let bits = {
557 const MASK: bool = true;
558 const OFFSET: u8 = 14;
559 ((self.bits >> OFFSET) & MASK as u32) != 0
560 };
561 PMAOVRR { bits }
562 }
563 #[doc = "Bit 15 - Correct transfer"]
564 #[inline]
565 pub fn ctr(&self) -> CTRR {
566 let bits = {
567 const MASK: bool = true;
568 const OFFSET: u8 = 15;
569 ((self.bits >> OFFSET) & MASK as u32) != 0
570 };
571 CTRR { bits }
572 }
573}
574impl W {
575 #[doc = r" Reset value of the register"]
576 #[inline]
577 pub fn reset_value() -> W {
578 W { bits: 0 }
579 }
580 #[doc = r" Writes raw bits to the register"]
581 #[inline]
582 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
583 self.bits = bits;
584 self
585 }
586 #[doc = "Bits 0:3 - Endpoint Identifier"]
587 #[inline]
588 pub fn ep_id(&mut self) -> _EP_IDW {
589 _EP_IDW { w: self }
590 }
591 #[doc = "Bit 4 - Direction of transaction"]
592 #[inline]
593 pub fn dir(&mut self) -> _DIRW {
594 _DIRW { w: self }
595 }
596 #[doc = "Bit 8 - Expected start frame"]
597 #[inline]
598 pub fn esof(&mut self) -> _ESOFW {
599 _ESOFW { w: self }
600 }
601 #[doc = "Bit 9 - start of frame"]
602 #[inline]
603 pub fn sof(&mut self) -> _SOFW {
604 _SOFW { w: self }
605 }
606 #[doc = "Bit 10 - reset request"]
607 #[inline]
608 pub fn reset(&mut self) -> _RESETW {
609 _RESETW { w: self }
610 }
611 #[doc = "Bit 11 - Suspend mode request"]
612 #[inline]
613 pub fn susp(&mut self) -> _SUSPW {
614 _SUSPW { w: self }
615 }
616 #[doc = "Bit 12 - Wakeup"]
617 #[inline]
618 pub fn wkup(&mut self) -> _WKUPW {
619 _WKUPW { w: self }
620 }
621 #[doc = "Bit 13 - Error"]
622 #[inline]
623 pub fn err(&mut self) -> _ERRW {
624 _ERRW { w: self }
625 }
626 #[doc = "Bit 14 - Packet memory area over / underrun"]
627 #[inline]
628 pub fn pmaovr(&mut self) -> _PMAOVRW {
629 _PMAOVRW { w: self }
630 }
631 #[doc = "Bit 15 - Correct transfer"]
632 #[inline]
633 pub fn ctr(&mut self) -> _CTRW {
634 _CTRW { w: self }
635 }
636}