stm32f446/otg_hs_device/otg_hs_dieptsiz3/
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::OTG_HS_DIEPTSIZ3 {
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 XFRSIZR {
47 bits: u32,
48}
49impl XFRSIZR {
50 #[doc = r" Value of the field as raw bits"]
51 #[inline]
52 pub fn bits(&self) -> u32 {
53 self.bits
54 }
55}
56#[doc = r" Value of the field"]
57pub struct PKTCNTR {
58 bits: u16,
59}
60impl PKTCNTR {
61 #[doc = r" Value of the field as raw bits"]
62 #[inline]
63 pub fn bits(&self) -> u16 {
64 self.bits
65 }
66}
67#[doc = r" Value of the field"]
68pub struct MCNTR {
69 bits: u8,
70}
71impl MCNTR {
72 #[doc = r" Value of the field as raw bits"]
73 #[inline]
74 pub fn bits(&self) -> u8 {
75 self.bits
76 }
77}
78#[doc = r" Proxy"]
79pub struct _XFRSIZW<'a> {
80 w: &'a mut W,
81}
82impl<'a> _XFRSIZW<'a> {
83 #[doc = r" Writes raw bits to the field"]
84 #[inline]
85 pub unsafe fn bits(self, value: u32) -> &'a mut W {
86 const MASK: u32 = 524287;
87 const OFFSET: u8 = 0;
88 self.w.bits &= !((MASK as u32) << OFFSET);
89 self.w.bits |= ((value & MASK) as u32) << OFFSET;
90 self.w
91 }
92}
93#[doc = r" Proxy"]
94pub struct _PKTCNTW<'a> {
95 w: &'a mut W,
96}
97impl<'a> _PKTCNTW<'a> {
98 #[doc = r" Writes raw bits to the field"]
99 #[inline]
100 pub unsafe fn bits(self, value: u16) -> &'a mut W {
101 const MASK: u16 = 1023;
102 const OFFSET: u8 = 19;
103 self.w.bits &= !((MASK as u32) << OFFSET);
104 self.w.bits |= ((value & MASK) as u32) << OFFSET;
105 self.w
106 }
107}
108#[doc = r" Proxy"]
109pub struct _MCNTW<'a> {
110 w: &'a mut W,
111}
112impl<'a> _MCNTW<'a> {
113 #[doc = r" Writes raw bits to the field"]
114 #[inline]
115 pub unsafe fn bits(self, value: u8) -> &'a mut W {
116 const MASK: u8 = 3;
117 const OFFSET: u8 = 29;
118 self.w.bits &= !((MASK as u32) << OFFSET);
119 self.w.bits |= ((value & MASK) as u32) << OFFSET;
120 self.w
121 }
122}
123impl R {
124 #[doc = r" Value of the register as raw bits"]
125 #[inline]
126 pub fn bits(&self) -> u32 {
127 self.bits
128 }
129 #[doc = "Bits 0:18 - Transfer size"]
130 #[inline]
131 pub fn xfrsiz(&self) -> XFRSIZR {
132 let bits = {
133 const MASK: u32 = 524287;
134 const OFFSET: u8 = 0;
135 ((self.bits >> OFFSET) & MASK as u32) as u32
136 };
137 XFRSIZR { bits }
138 }
139 #[doc = "Bits 19:28 - Packet count"]
140 #[inline]
141 pub fn pktcnt(&self) -> PKTCNTR {
142 let bits = {
143 const MASK: u16 = 1023;
144 const OFFSET: u8 = 19;
145 ((self.bits >> OFFSET) & MASK as u32) as u16
146 };
147 PKTCNTR { bits }
148 }
149 #[doc = "Bits 29:30 - Multi count"]
150 #[inline]
151 pub fn mcnt(&self) -> MCNTR {
152 let bits = {
153 const MASK: u8 = 3;
154 const OFFSET: u8 = 29;
155 ((self.bits >> OFFSET) & MASK as u32) as u8
156 };
157 MCNTR { bits }
158 }
159}
160impl W {
161 #[doc = r" Reset value of the register"]
162 #[inline]
163 pub fn reset_value() -> W {
164 W { bits: 0 }
165 }
166 #[doc = r" Writes raw bits to the register"]
167 #[inline]
168 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
169 self.bits = bits;
170 self
171 }
172 #[doc = "Bits 0:18 - Transfer size"]
173 #[inline]
174 pub fn xfrsiz(&mut self) -> _XFRSIZW {
175 _XFRSIZW { w: self }
176 }
177 #[doc = "Bits 19:28 - Packet count"]
178 #[inline]
179 pub fn pktcnt(&mut self) -> _PKTCNTW {
180 _PKTCNTW { w: self }
181 }
182 #[doc = "Bits 29:30 - Multi count"]
183 #[inline]
184 pub fn mcnt(&mut self) -> _MCNTW {
185 _MCNTW { w: self }
186 }
187}