mimxrt685s_pac/usbphy/
usb1_loopback_set.rs

1#[doc = "Register `USB1_LOOPBACK_SET` reader"]
2pub type R = crate::R<Usb1LoopbackSetSpec>;
3#[doc = "Register `USB1_LOOPBACK_SET` writer"]
4pub type W = crate::W<Usb1LoopbackSetSpec>;
5#[doc = "Field `UTMI_TESTSTART` reader - This bit enables the USB loopback test."]
6pub type UtmiTeststartR = crate::BitReader;
7#[doc = "Field `UTMI_TESTSTART` writer - This bit enables the USB loopback test."]
8pub type UtmiTeststartW<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Field `UTMI_DIG_TST0` reader - Mode control for USB loopback test"]
10pub type UtmiDigTst0R = crate::BitReader;
11#[doc = "Field `UTMI_DIG_TST0` writer - Mode control for USB loopback test"]
12pub type UtmiDigTst0W<'a, REG> = crate::BitWriter<'a, REG>;
13#[doc = "Field `UTMI_DIG_TST1` reader - Mode control for USB loopback test"]
14pub type UtmiDigTst1R = crate::BitReader;
15#[doc = "Field `UTMI_DIG_TST1` writer - Mode control for USB loopback test"]
16pub type UtmiDigTst1W<'a, REG> = crate::BitWriter<'a, REG>;
17#[doc = "Field `TSTI_TX_HS_MODE` reader - Select HS or FS mode for USB loopback testing"]
18pub type TstiTxHsModeR = crate::BitReader;
19#[doc = "Field `TSTI_TX_HS_MODE` writer - Select HS or FS mode for USB loopback testing"]
20pub type TstiTxHsModeW<'a, REG> = crate::BitWriter<'a, REG>;
21#[doc = "Field `TSTI_TX_LS_MODE` reader - Set to value 1'b1 to choose LS for USB loopback testing, set to value 1'b0 to choose HS or FS mode which is defined by TSTI1_TX_HS"]
22pub type TstiTxLsModeR = crate::BitReader;
23#[doc = "Field `TSTI_TX_LS_MODE` writer - Set to value 1'b1 to choose LS for USB loopback testing, set to value 1'b0 to choose HS or FS mode which is defined by TSTI1_TX_HS"]
24pub type TstiTxLsModeW<'a, REG> = crate::BitWriter<'a, REG>;
25#[doc = "Field `TSTI_TX_EN` reader - Enable TX for USB loopback test."]
26pub type TstiTxEnR = crate::BitReader;
27#[doc = "Field `TSTI_TX_EN` writer - Enable TX for USB loopback test."]
28pub type TstiTxEnW<'a, REG> = crate::BitWriter<'a, REG>;
29#[doc = "Field `TSTI_TX_HIZ` reader - Sets TX Hi-Z for USB loopback test."]
30pub type TstiTxHizR = crate::BitReader;
31#[doc = "Field `TSTI_TX_HIZ` writer - Sets TX Hi-Z for USB loopback test."]
32pub type TstiTxHizW<'a, REG> = crate::BitWriter<'a, REG>;
33#[doc = "Field `UTMO_DIG_TST0` reader - This read-only bit is a status bit for USB loopback test results"]
34pub type UtmoDigTst0R = crate::BitReader;
35#[doc = "Field `UTMO_DIG_TST0` writer - This read-only bit is a status bit for USB loopback test results"]
36pub type UtmoDigTst0W<'a, REG> = crate::BitWriter<'a, REG>;
37#[doc = "Field `UTMO_DIG_TST1` reader - This read-only bit is a status bit for USB loopback test"]
38pub type UtmoDigTst1R = crate::BitReader;
39#[doc = "Field `UTMO_DIG_TST1` writer - This read-only bit is a status bit for USB loopback test"]
40pub type UtmoDigTst1W<'a, REG> = crate::BitWriter<'a, REG>;
41#[doc = "Field `TSTI_HSFS_MODE_EN` reader - Setting this bit field to value 1'b1 will enable the loopback test to dynamically change the packet speed"]
42pub type TstiHsfsModeEnR = crate::BitReader;
43#[doc = "Field `TSTI_HSFS_MODE_EN` writer - Setting this bit field to value 1'b1 will enable the loopback test to dynamically change the packet speed"]
44pub type TstiHsfsModeEnW<'a, REG> = crate::BitWriter<'a, REG>;
45#[doc = "Field `TSTPKT` reader - Selects the packet data byte used for USB loopback testing in Pulse mode"]
46pub type TstpktR = crate::FieldReader;
47#[doc = "Field `TSTPKT` writer - Selects the packet data byte used for USB loopback testing in Pulse mode"]
48pub type TstpktW<'a, REG> = crate::FieldWriter<'a, REG, 8>;
49impl R {
50    #[doc = "Bit 0 - This bit enables the USB loopback test."]
51    #[inline(always)]
52    pub fn utmi_teststart(&self) -> UtmiTeststartR {
53        UtmiTeststartR::new((self.bits & 1) != 0)
54    }
55    #[doc = "Bit 1 - Mode control for USB loopback test"]
56    #[inline(always)]
57    pub fn utmi_dig_tst0(&self) -> UtmiDigTst0R {
58        UtmiDigTst0R::new(((self.bits >> 1) & 1) != 0)
59    }
60    #[doc = "Bit 2 - Mode control for USB loopback test"]
61    #[inline(always)]
62    pub fn utmi_dig_tst1(&self) -> UtmiDigTst1R {
63        UtmiDigTst1R::new(((self.bits >> 2) & 1) != 0)
64    }
65    #[doc = "Bit 3 - Select HS or FS mode for USB loopback testing"]
66    #[inline(always)]
67    pub fn tsti_tx_hs_mode(&self) -> TstiTxHsModeR {
68        TstiTxHsModeR::new(((self.bits >> 3) & 1) != 0)
69    }
70    #[doc = "Bit 4 - Set to value 1'b1 to choose LS for USB loopback testing, set to value 1'b0 to choose HS or FS mode which is defined by TSTI1_TX_HS"]
71    #[inline(always)]
72    pub fn tsti_tx_ls_mode(&self) -> TstiTxLsModeR {
73        TstiTxLsModeR::new(((self.bits >> 4) & 1) != 0)
74    }
75    #[doc = "Bit 5 - Enable TX for USB loopback test."]
76    #[inline(always)]
77    pub fn tsti_tx_en(&self) -> TstiTxEnR {
78        TstiTxEnR::new(((self.bits >> 5) & 1) != 0)
79    }
80    #[doc = "Bit 6 - Sets TX Hi-Z for USB loopback test."]
81    #[inline(always)]
82    pub fn tsti_tx_hiz(&self) -> TstiTxHizR {
83        TstiTxHizR::new(((self.bits >> 6) & 1) != 0)
84    }
85    #[doc = "Bit 7 - This read-only bit is a status bit for USB loopback test results"]
86    #[inline(always)]
87    pub fn utmo_dig_tst0(&self) -> UtmoDigTst0R {
88        UtmoDigTst0R::new(((self.bits >> 7) & 1) != 0)
89    }
90    #[doc = "Bit 8 - This read-only bit is a status bit for USB loopback test"]
91    #[inline(always)]
92    pub fn utmo_dig_tst1(&self) -> UtmoDigTst1R {
93        UtmoDigTst1R::new(((self.bits >> 8) & 1) != 0)
94    }
95    #[doc = "Bit 15 - Setting this bit field to value 1'b1 will enable the loopback test to dynamically change the packet speed"]
96    #[inline(always)]
97    pub fn tsti_hsfs_mode_en(&self) -> TstiHsfsModeEnR {
98        TstiHsfsModeEnR::new(((self.bits >> 15) & 1) != 0)
99    }
100    #[doc = "Bits 16:23 - Selects the packet data byte used for USB loopback testing in Pulse mode"]
101    #[inline(always)]
102    pub fn tstpkt(&self) -> TstpktR {
103        TstpktR::new(((self.bits >> 16) & 0xff) as u8)
104    }
105}
106#[cfg(feature = "debug")]
107impl core::fmt::Debug for R {
108    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
109        f.debug_struct("USB1_LOOPBACK_SET")
110            .field("utmi_teststart", &self.utmi_teststart())
111            .field("utmi_dig_tst0", &self.utmi_dig_tst0())
112            .field("utmi_dig_tst1", &self.utmi_dig_tst1())
113            .field("tsti_tx_hs_mode", &self.tsti_tx_hs_mode())
114            .field("tsti_tx_ls_mode", &self.tsti_tx_ls_mode())
115            .field("tsti_tx_en", &self.tsti_tx_en())
116            .field("tsti_tx_hiz", &self.tsti_tx_hiz())
117            .field("utmo_dig_tst0", &self.utmo_dig_tst0())
118            .field("utmo_dig_tst1", &self.utmo_dig_tst1())
119            .field("tsti_hsfs_mode_en", &self.tsti_hsfs_mode_en())
120            .field("tstpkt", &self.tstpkt())
121            .finish()
122    }
123}
124impl W {
125    #[doc = "Bit 0 - This bit enables the USB loopback test."]
126    #[inline(always)]
127    pub fn utmi_teststart(&mut self) -> UtmiTeststartW<Usb1LoopbackSetSpec> {
128        UtmiTeststartW::new(self, 0)
129    }
130    #[doc = "Bit 1 - Mode control for USB loopback test"]
131    #[inline(always)]
132    pub fn utmi_dig_tst0(&mut self) -> UtmiDigTst0W<Usb1LoopbackSetSpec> {
133        UtmiDigTst0W::new(self, 1)
134    }
135    #[doc = "Bit 2 - Mode control for USB loopback test"]
136    #[inline(always)]
137    pub fn utmi_dig_tst1(&mut self) -> UtmiDigTst1W<Usb1LoopbackSetSpec> {
138        UtmiDigTst1W::new(self, 2)
139    }
140    #[doc = "Bit 3 - Select HS or FS mode for USB loopback testing"]
141    #[inline(always)]
142    pub fn tsti_tx_hs_mode(&mut self) -> TstiTxHsModeW<Usb1LoopbackSetSpec> {
143        TstiTxHsModeW::new(self, 3)
144    }
145    #[doc = "Bit 4 - Set to value 1'b1 to choose LS for USB loopback testing, set to value 1'b0 to choose HS or FS mode which is defined by TSTI1_TX_HS"]
146    #[inline(always)]
147    pub fn tsti_tx_ls_mode(&mut self) -> TstiTxLsModeW<Usb1LoopbackSetSpec> {
148        TstiTxLsModeW::new(self, 4)
149    }
150    #[doc = "Bit 5 - Enable TX for USB loopback test."]
151    #[inline(always)]
152    pub fn tsti_tx_en(&mut self) -> TstiTxEnW<Usb1LoopbackSetSpec> {
153        TstiTxEnW::new(self, 5)
154    }
155    #[doc = "Bit 6 - Sets TX Hi-Z for USB loopback test."]
156    #[inline(always)]
157    pub fn tsti_tx_hiz(&mut self) -> TstiTxHizW<Usb1LoopbackSetSpec> {
158        TstiTxHizW::new(self, 6)
159    }
160    #[doc = "Bit 7 - This read-only bit is a status bit for USB loopback test results"]
161    #[inline(always)]
162    pub fn utmo_dig_tst0(&mut self) -> UtmoDigTst0W<Usb1LoopbackSetSpec> {
163        UtmoDigTst0W::new(self, 7)
164    }
165    #[doc = "Bit 8 - This read-only bit is a status bit for USB loopback test"]
166    #[inline(always)]
167    pub fn utmo_dig_tst1(&mut self) -> UtmoDigTst1W<Usb1LoopbackSetSpec> {
168        UtmoDigTst1W::new(self, 8)
169    }
170    #[doc = "Bit 15 - Setting this bit field to value 1'b1 will enable the loopback test to dynamically change the packet speed"]
171    #[inline(always)]
172    pub fn tsti_hsfs_mode_en(&mut self) -> TstiHsfsModeEnW<Usb1LoopbackSetSpec> {
173        TstiHsfsModeEnW::new(self, 15)
174    }
175    #[doc = "Bits 16:23 - Selects the packet data byte used for USB loopback testing in Pulse mode"]
176    #[inline(always)]
177    pub fn tstpkt(&mut self) -> TstpktW<Usb1LoopbackSetSpec> {
178        TstpktW::new(self, 16)
179    }
180}
181#[doc = "USB PHY Loopback Control/Status Register\n\nYou can [`read`](crate::Reg::read) this register and get [`usb1_loopback_set::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`usb1_loopback_set::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
182pub struct Usb1LoopbackSetSpec;
183impl crate::RegisterSpec for Usb1LoopbackSetSpec {
184    type Ux = u32;
185}
186#[doc = "`read()` method returns [`usb1_loopback_set::R`](R) reader structure"]
187impl crate::Readable for Usb1LoopbackSetSpec {}
188#[doc = "`write(|w| ..)` method takes [`usb1_loopback_set::W`](W) writer structure"]
189impl crate::Writable for Usb1LoopbackSetSpec {
190    type Safety = crate::Unsafe;
191    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
192    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
193}
194#[doc = "`reset()` method sets USB1_LOOPBACK_SET to value 0x0055_0000"]
195impl crate::Resettable for Usb1LoopbackSetSpec {
196    const RESET_VALUE: u32 = 0x0055_0000;
197}