mimxrt685s_pac/usbhsh/
usbsts.rs

1#[doc = "Register `USBSTS` reader"]
2pub type R = crate::R<UsbstsSpec>;
3#[doc = "Register `USBSTS` writer"]
4pub type W = crate::W<UsbstsSpec>;
5#[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. or - the ID pin value changes or - an LPM token has been transmitted to enter LPM L1 suspend state.. Software must write a one to clear the bit"]
6pub type PcdR = crate::BitReader;
7#[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. or - the ID pin value changes or - an LPM token has been transmitted to enter LPM L1 suspend state.. Software must write a one to clear the bit"]
8pub type PcdW<'a, REG> = crate::BitWriter<'a, REG>;
9#[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."]
10pub type FlrR = crate::BitReader;
11#[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."]
12pub type FlrW<'a, REG> = crate::BitWriter<'a, REG>;
13#[doc = "Field `ATL_IRQ` reader - ATL IRQ: Indicates that an ATL PTD (with I-bit set) was completed."]
14pub type AtlIrqR = crate::BitReader;
15#[doc = "Field `ATL_IRQ` writer - ATL IRQ: Indicates that an ATL PTD (with I-bit set) was completed."]
16pub type AtlIrqW<'a, REG> = crate::BitWriter<'a, REG>;
17#[doc = "Field `ISO_IRQ` reader - ISO IRQ: Indicates that an ISO PTD (with I-bit set) was completed."]
18pub type IsoIrqR = crate::BitReader;
19#[doc = "Field `ISO_IRQ` writer - ISO IRQ: Indicates that an ISO PTD (with I-bit set) was completed."]
20pub type IsoIrqW<'a, REG> = crate::BitWriter<'a, REG>;
21#[doc = "Field `INT_IRQ` reader - INT IRQ: Indicates that an INT PTD (with I-bit set) was completed."]
22pub type IntIrqR = crate::BitReader;
23#[doc = "Field `INT_IRQ` writer - INT IRQ: Indicates that an INT PTD (with I-bit set) was completed."]
24pub type IntIrqW<'a, REG> = crate::BitWriter<'a, REG>;
25#[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."]
26pub type SofIrqR = crate::BitReader;
27#[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."]
28pub type SofIrqW<'a, REG> = crate::BitWriter<'a, REG>;
29impl R {
30    #[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. or - the ID pin value changes or - an LPM token has been transmitted to enter LPM L1 suspend state.. Software must write a one to clear the bit"]
31    #[inline(always)]
32    pub fn pcd(&self) -> PcdR {
33        PcdR::new(((self.bits >> 2) & 1) != 0)
34    }
35    #[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."]
36    #[inline(always)]
37    pub fn flr(&self) -> FlrR {
38        FlrR::new(((self.bits >> 3) & 1) != 0)
39    }
40    #[doc = "Bit 16 - ATL IRQ: Indicates that an ATL PTD (with I-bit set) was completed."]
41    #[inline(always)]
42    pub fn atl_irq(&self) -> AtlIrqR {
43        AtlIrqR::new(((self.bits >> 16) & 1) != 0)
44    }
45    #[doc = "Bit 17 - ISO IRQ: Indicates that an ISO PTD (with I-bit set) was completed."]
46    #[inline(always)]
47    pub fn iso_irq(&self) -> IsoIrqR {
48        IsoIrqR::new(((self.bits >> 17) & 1) != 0)
49    }
50    #[doc = "Bit 18 - INT IRQ: Indicates that an INT PTD (with I-bit set) was completed."]
51    #[inline(always)]
52    pub fn int_irq(&self) -> IntIrqR {
53        IntIrqR::new(((self.bits >> 18) & 1) != 0)
54    }
55    #[doc = "Bit 19 - SOF interrupt: Every time when the host sends a Start of Frame token on the USB bus, this bit is set."]
56    #[inline(always)]
57    pub fn sof_irq(&self) -> SofIrqR {
58        SofIrqR::new(((self.bits >> 19) & 1) != 0)
59    }
60}
61#[cfg(feature = "debug")]
62impl core::fmt::Debug for R {
63    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
64        f.debug_struct("USBSTS")
65            .field("pcd", &self.pcd())
66            .field("flr", &self.flr())
67            .field("atl_irq", &self.atl_irq())
68            .field("iso_irq", &self.iso_irq())
69            .field("int_irq", &self.int_irq())
70            .field("sof_irq", &self.sof_irq())
71            .finish()
72    }
73}
74impl W {
75    #[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. or - the ID pin value changes or - an LPM token has been transmitted to enter LPM L1 suspend state.. Software must write a one to clear the bit"]
76    #[inline(always)]
77    pub fn pcd(&mut self) -> PcdW<UsbstsSpec> {
78        PcdW::new(self, 2)
79    }
80    #[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."]
81    #[inline(always)]
82    pub fn flr(&mut self) -> FlrW<UsbstsSpec> {
83        FlrW::new(self, 3)
84    }
85    #[doc = "Bit 16 - ATL IRQ: Indicates that an ATL PTD (with I-bit set) was completed."]
86    #[inline(always)]
87    pub fn atl_irq(&mut self) -> AtlIrqW<UsbstsSpec> {
88        AtlIrqW::new(self, 16)
89    }
90    #[doc = "Bit 17 - ISO IRQ: Indicates that an ISO PTD (with I-bit set) was completed."]
91    #[inline(always)]
92    pub fn iso_irq(&mut self) -> IsoIrqW<UsbstsSpec> {
93        IsoIrqW::new(self, 17)
94    }
95    #[doc = "Bit 18 - INT IRQ: Indicates that an INT PTD (with I-bit set) was completed."]
96    #[inline(always)]
97    pub fn int_irq(&mut self) -> IntIrqW<UsbstsSpec> {
98        IntIrqW::new(self, 18)
99    }
100    #[doc = "Bit 19 - SOF interrupt: Every time when the host sends a Start of Frame token on the USB bus, this bit is set."]
101    #[inline(always)]
102    pub fn sof_irq(&mut self) -> SofIrqW<UsbstsSpec> {
103        SofIrqW::new(self, 19)
104    }
105}
106#[doc = "USB Interrupt Status register\n\nYou can [`read`](crate::Reg::read) this register and get [`usbsts::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`usbsts::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
107pub struct UsbstsSpec;
108impl crate::RegisterSpec for UsbstsSpec {
109    type Ux = u32;
110}
111#[doc = "`read()` method returns [`usbsts::R`](R) reader structure"]
112impl crate::Readable for UsbstsSpec {}
113#[doc = "`write(|w| ..)` method takes [`usbsts::W`](W) writer structure"]
114impl crate::Writable for UsbstsSpec {
115    type Safety = crate::Unsafe;
116    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
117    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
118}
119#[doc = "`reset()` method sets USBSTS to value 0"]
120impl crate::Resettable for UsbstsSpec {
121    const RESET_VALUE: u32 = 0;
122}