lpc55_pac/usbhsh/
usbsts.rs1#[doc = "Register `USBSTS` reader"]
2pub struct R(crate::R<USBSTS_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<USBSTS_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<USBSTS_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<USBSTS_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `USBSTS` writer"]
17pub struct W(crate::W<USBSTS_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<USBSTS_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<USBSTS_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<USBSTS_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `PCD` reader - Port Change Detect: The host controller sets this bit to logic 1 when any port has a change bit transition from a 0 to a one or a Force Port Resume bit transition from a 0 to a 1 as a result of a J-K transition detected on a suspended port."]
38pub struct PCD_R(crate::FieldReader<bool, bool>);
39impl PCD_R {
40 #[inline(always)]
41 pub(crate) fn new(bits: bool) -> Self {
42 PCD_R(crate::FieldReader::new(bits))
43 }
44}
45impl core::ops::Deref for PCD_R {
46 type Target = crate::FieldReader<bool, bool>;
47 #[inline(always)]
48 fn deref(&self) -> &Self::Target {
49 &self.0
50 }
51}
52#[doc = "Field `PCD` writer - Port Change Detect: The host controller sets this bit to logic 1 when any port has a change bit transition from a 0 to a one or a Force Port Resume bit transition from a 0 to a 1 as a result of a J-K transition detected on a suspended port."]
53pub struct PCD_W<'a> {
54 w: &'a mut W,
55}
56impl<'a> PCD_W<'a> {
57 #[doc = r"Sets the field bit"]
58 #[inline(always)]
59 pub fn set_bit(self) -> &'a mut W {
60 self.bit(true)
61 }
62 #[doc = r"Clears the field bit"]
63 #[inline(always)]
64 pub fn clear_bit(self) -> &'a mut W {
65 self.bit(false)
66 }
67 #[doc = r"Writes raw bits to the field"]
68 #[inline(always)]
69 pub fn bit(self, value: bool) -> &'a mut W {
70 self.w.bits = (self.w.bits & !(0x01 << 2)) | ((value as u32 & 0x01) << 2);
71 self.w
72 }
73}
74#[doc = "Field `FLR` reader - Frame List Rollover: The host controller sets this bit to logic 1 when the frame list index rolls over its maximum value to 0."]
75pub struct FLR_R(crate::FieldReader<bool, bool>);
76impl FLR_R {
77 #[inline(always)]
78 pub(crate) fn new(bits: bool) -> Self {
79 FLR_R(crate::FieldReader::new(bits))
80 }
81}
82impl core::ops::Deref for FLR_R {
83 type Target = crate::FieldReader<bool, bool>;
84 #[inline(always)]
85 fn deref(&self) -> &Self::Target {
86 &self.0
87 }
88}
89#[doc = "Field `FLR` writer - Frame List Rollover: The host controller sets this bit to logic 1 when the frame list index rolls over its maximum value to 0."]
90pub struct FLR_W<'a> {
91 w: &'a mut W,
92}
93impl<'a> FLR_W<'a> {
94 #[doc = r"Sets the field bit"]
95 #[inline(always)]
96 pub fn set_bit(self) -> &'a mut W {
97 self.bit(true)
98 }
99 #[doc = r"Clears the field bit"]
100 #[inline(always)]
101 pub fn clear_bit(self) -> &'a mut W {
102 self.bit(false)
103 }
104 #[doc = r"Writes raw bits to the field"]
105 #[inline(always)]
106 pub fn bit(self, value: bool) -> &'a mut W {
107 self.w.bits = (self.w.bits & !(0x01 << 3)) | ((value as u32 & 0x01) << 3);
108 self.w
109 }
110}
111#[doc = "Field `ATL_IRQ` reader - ATL IRQ: Indicates that an ATL PTD (with I-bit set) was completed."]
112pub struct ATL_IRQ_R(crate::FieldReader<bool, bool>);
113impl ATL_IRQ_R {
114 #[inline(always)]
115 pub(crate) fn new(bits: bool) -> Self {
116 ATL_IRQ_R(crate::FieldReader::new(bits))
117 }
118}
119impl core::ops::Deref for ATL_IRQ_R {
120 type Target = crate::FieldReader<bool, bool>;
121 #[inline(always)]
122 fn deref(&self) -> &Self::Target {
123 &self.0
124 }
125}
126#[doc = "Field `ATL_IRQ` writer - ATL IRQ: Indicates that an ATL PTD (with I-bit set) was completed."]
127pub struct ATL_IRQ_W<'a> {
128 w: &'a mut W,
129}
130impl<'a> ATL_IRQ_W<'a> {
131 #[doc = r"Sets the field bit"]
132 #[inline(always)]
133 pub fn set_bit(self) -> &'a mut W {
134 self.bit(true)
135 }
136 #[doc = r"Clears the field bit"]
137 #[inline(always)]
138 pub fn clear_bit(self) -> &'a mut W {
139 self.bit(false)
140 }
141 #[doc = r"Writes raw bits to the field"]
142 #[inline(always)]
143 pub fn bit(self, value: bool) -> &'a mut W {
144 self.w.bits = (self.w.bits & !(0x01 << 16)) | ((value as u32 & 0x01) << 16);
145 self.w
146 }
147}
148#[doc = "Field `ISO_IRQ` reader - ISO IRQ: Indicates that an ISO PTD (with I-bit set) was completed."]
149pub struct ISO_IRQ_R(crate::FieldReader<bool, bool>);
150impl ISO_IRQ_R {
151 #[inline(always)]
152 pub(crate) fn new(bits: bool) -> Self {
153 ISO_IRQ_R(crate::FieldReader::new(bits))
154 }
155}
156impl core::ops::Deref for ISO_IRQ_R {
157 type Target = crate::FieldReader<bool, bool>;
158 #[inline(always)]
159 fn deref(&self) -> &Self::Target {
160 &self.0
161 }
162}
163#[doc = "Field `ISO_IRQ` writer - ISO IRQ: Indicates that an ISO PTD (with I-bit set) was completed."]
164pub struct ISO_IRQ_W<'a> {
165 w: &'a mut W,
166}
167impl<'a> ISO_IRQ_W<'a> {
168 #[doc = r"Sets the field bit"]
169 #[inline(always)]
170 pub fn set_bit(self) -> &'a mut W {
171 self.bit(true)
172 }
173 #[doc = r"Clears the field bit"]
174 #[inline(always)]
175 pub fn clear_bit(self) -> &'a mut W {
176 self.bit(false)
177 }
178 #[doc = r"Writes raw bits to the field"]
179 #[inline(always)]
180 pub fn bit(self, value: bool) -> &'a mut W {
181 self.w.bits = (self.w.bits & !(0x01 << 17)) | ((value as u32 & 0x01) << 17);
182 self.w
183 }
184}
185#[doc = "Field `INT_IRQ` reader - INT IRQ: Indicates that an INT PTD (with I-bit set) was completed."]
186pub struct INT_IRQ_R(crate::FieldReader<bool, bool>);
187impl INT_IRQ_R {
188 #[inline(always)]
189 pub(crate) fn new(bits: bool) -> Self {
190 INT_IRQ_R(crate::FieldReader::new(bits))
191 }
192}
193impl core::ops::Deref for INT_IRQ_R {
194 type Target = crate::FieldReader<bool, bool>;
195 #[inline(always)]
196 fn deref(&self) -> &Self::Target {
197 &self.0
198 }
199}
200#[doc = "Field `INT_IRQ` writer - INT IRQ: Indicates that an INT PTD (with I-bit set) was completed."]
201pub struct INT_IRQ_W<'a> {
202 w: &'a mut W,
203}
204impl<'a> INT_IRQ_W<'a> {
205 #[doc = r"Sets the field bit"]
206 #[inline(always)]
207 pub fn set_bit(self) -> &'a mut W {
208 self.bit(true)
209 }
210 #[doc = r"Clears the field bit"]
211 #[inline(always)]
212 pub fn clear_bit(self) -> &'a mut W {
213 self.bit(false)
214 }
215 #[doc = r"Writes raw bits to the field"]
216 #[inline(always)]
217 pub fn bit(self, value: bool) -> &'a mut W {
218 self.w.bits = (self.w.bits & !(0x01 << 18)) | ((value as u32 & 0x01) << 18);
219 self.w
220 }
221}
222#[doc = "Field `SOF_IRQ` reader - SOF interrupt: Every time when the host sends a Start of Frame token on the USB bus, this bit is set."]
223pub struct SOF_IRQ_R(crate::FieldReader<bool, bool>);
224impl SOF_IRQ_R {
225 #[inline(always)]
226 pub(crate) fn new(bits: bool) -> Self {
227 SOF_IRQ_R(crate::FieldReader::new(bits))
228 }
229}
230impl core::ops::Deref for SOF_IRQ_R {
231 type Target = crate::FieldReader<bool, bool>;
232 #[inline(always)]
233 fn deref(&self) -> &Self::Target {
234 &self.0
235 }
236}
237#[doc = "Field `SOF_IRQ` writer - SOF interrupt: Every time when the host sends a Start of Frame token on the USB bus, this bit is set."]
238pub struct SOF_IRQ_W<'a> {
239 w: &'a mut W,
240}
241impl<'a> SOF_IRQ_W<'a> {
242 #[doc = r"Sets the field bit"]
243 #[inline(always)]
244 pub fn set_bit(self) -> &'a mut W {
245 self.bit(true)
246 }
247 #[doc = r"Clears the field bit"]
248 #[inline(always)]
249 pub fn clear_bit(self) -> &'a mut W {
250 self.bit(false)
251 }
252 #[doc = r"Writes raw bits to the field"]
253 #[inline(always)]
254 pub fn bit(self, value: bool) -> &'a mut W {
255 self.w.bits = (self.w.bits & !(0x01 << 19)) | ((value as u32 & 0x01) << 19);
256 self.w
257 }
258}
259impl R {
260 #[doc = "Bit 2 - Port Change Detect: The host controller sets this bit to logic 1 when any port has a change bit transition from a 0 to a one or a Force Port Resume bit transition from a 0 to a 1 as a result of a J-K transition detected on a suspended port."]
261 #[inline(always)]
262 pub fn pcd(&self) -> PCD_R {
263 PCD_R::new(((self.bits >> 2) & 0x01) != 0)
264 }
265 #[doc = "Bit 3 - Frame List Rollover: The host controller sets this bit to logic 1 when the frame list index rolls over its maximum value to 0."]
266 #[inline(always)]
267 pub fn flr(&self) -> FLR_R {
268 FLR_R::new(((self.bits >> 3) & 0x01) != 0)
269 }
270 #[doc = "Bit 16 - ATL IRQ: Indicates that an ATL PTD (with I-bit set) was completed."]
271 #[inline(always)]
272 pub fn atl_irq(&self) -> ATL_IRQ_R {
273 ATL_IRQ_R::new(((self.bits >> 16) & 0x01) != 0)
274 }
275 #[doc = "Bit 17 - ISO IRQ: Indicates that an ISO PTD (with I-bit set) was completed."]
276 #[inline(always)]
277 pub fn iso_irq(&self) -> ISO_IRQ_R {
278 ISO_IRQ_R::new(((self.bits >> 17) & 0x01) != 0)
279 }
280 #[doc = "Bit 18 - INT IRQ: Indicates that an INT PTD (with I-bit set) was completed."]
281 #[inline(always)]
282 pub fn int_irq(&self) -> INT_IRQ_R {
283 INT_IRQ_R::new(((self.bits >> 18) & 0x01) != 0)
284 }
285 #[doc = "Bit 19 - SOF interrupt: Every time when the host sends a Start of Frame token on the USB bus, this bit is set."]
286 #[inline(always)]
287 pub fn sof_irq(&self) -> SOF_IRQ_R {
288 SOF_IRQ_R::new(((self.bits >> 19) & 0x01) != 0)
289 }
290}
291impl W {
292 #[doc = "Bit 2 - Port Change Detect: The host controller sets this bit to logic 1 when any port has a change bit transition from a 0 to a one or a Force Port Resume bit transition from a 0 to a 1 as a result of a J-K transition detected on a suspended port."]
293 #[inline(always)]
294 pub fn pcd(&mut self) -> PCD_W {
295 PCD_W { w: self }
296 }
297 #[doc = "Bit 3 - Frame List Rollover: The host controller sets this bit to logic 1 when the frame list index rolls over its maximum value to 0."]
298 #[inline(always)]
299 pub fn flr(&mut self) -> FLR_W {
300 FLR_W { w: self }
301 }
302 #[doc = "Bit 16 - ATL IRQ: Indicates that an ATL PTD (with I-bit set) was completed."]
303 #[inline(always)]
304 pub fn atl_irq(&mut self) -> ATL_IRQ_W {
305 ATL_IRQ_W { w: self }
306 }
307 #[doc = "Bit 17 - ISO IRQ: Indicates that an ISO PTD (with I-bit set) was completed."]
308 #[inline(always)]
309 pub fn iso_irq(&mut self) -> ISO_IRQ_W {
310 ISO_IRQ_W { w: self }
311 }
312 #[doc = "Bit 18 - INT IRQ: Indicates that an INT PTD (with I-bit set) was completed."]
313 #[inline(always)]
314 pub fn int_irq(&mut self) -> INT_IRQ_W {
315 INT_IRQ_W { w: self }
316 }
317 #[doc = "Bit 19 - SOF interrupt: Every time when the host sends a Start of Frame token on the USB bus, this bit is set."]
318 #[inline(always)]
319 pub fn sof_irq(&mut self) -> SOF_IRQ_W {
320 SOF_IRQ_W { w: self }
321 }
322 #[doc = "Writes raw bits to the register."]
323 #[inline(always)]
324 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
325 self.0.bits(bits);
326 self
327 }
328}
329#[doc = "USB Interrupt 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 [usbsts](index.html) module"]
330pub struct USBSTS_SPEC;
331impl crate::RegisterSpec for USBSTS_SPEC {
332 type Ux = u32;
333}
334#[doc = "`read()` method returns [usbsts::R](R) reader structure"]
335impl crate::Readable for USBSTS_SPEC {
336 type Reader = R;
337}
338#[doc = "`write(|w| ..)` method takes [usbsts::W](W) writer structure"]
339impl crate::Writable for USBSTS_SPEC {
340 type Writer = W;
341}
342#[doc = "`reset()` method sets USBSTS to value 0"]
343impl crate::Resettable for USBSTS_SPEC {
344 #[inline(always)]
345 fn reset_value() -> Self::Ux {
346 0
347 }
348}