mimxrt685s_pac/usbhsd/
devcmdstat.rs

1#[doc = "Register `DEVCMDSTAT` reader"]
2pub type R = crate::R<DevcmdstatSpec>;
3#[doc = "Register `DEVCMDSTAT` writer"]
4pub type W = crate::W<DevcmdstatSpec>;
5#[doc = "Field `DEV_ADDR` reader - USB device address."]
6pub type DevAddrR = crate::FieldReader;
7#[doc = "Field `DEV_ADDR` writer - USB device address."]
8pub type DevAddrW<'a, REG> = crate::FieldWriter<'a, REG, 7>;
9#[doc = "Field `DEV_EN` reader - USB device enable."]
10pub type DevEnR = crate::BitReader;
11#[doc = "Field `DEV_EN` writer - USB device enable."]
12pub type DevEnW<'a, REG> = crate::BitWriter<'a, REG>;
13#[doc = "Field `SETUP` reader - SETUP token received."]
14pub type SetupR = crate::BitReader;
15#[doc = "Field `SETUP` writer - SETUP token received."]
16pub type SetupW<'a, REG> = crate::BitWriter<'a, REG>;
17#[doc = "Field `FORCE_NEEDCLK` reader - Forces the NEEDCLK output to always be on:."]
18pub type ForceNeedclkR = crate::BitReader;
19#[doc = "Field `FORCE_NEEDCLK` writer - Forces the NEEDCLK output to always be on:."]
20pub type ForceNeedclkW<'a, REG> = crate::BitWriter<'a, REG>;
21#[doc = "Field `FORCE_VBUS` reader - If this bit is set to 1, the VBUS voltage indicators from the PHY are overruled."]
22pub type ForceVbusR = crate::BitReader;
23#[doc = "Field `FORCE_VBUS` writer - If this bit is set to 1, the VBUS voltage indicators from the PHY are overruled."]
24pub type ForceVbusW<'a, REG> = crate::BitWriter<'a, REG>;
25#[doc = "Field `LPM_SUP` reader - LPM Supported:."]
26pub type LpmSupR = crate::BitReader;
27#[doc = "Field `LPM_SUP` writer - LPM Supported:."]
28pub type LpmSupW<'a, REG> = crate::BitWriter<'a, REG>;
29#[doc = "Field `INTONNAK_AO` reader - Interrupt on NAK for interrupt and bulk OUT EP:."]
30pub type IntonnakAoR = crate::BitReader;
31#[doc = "Field `INTONNAK_AO` writer - Interrupt on NAK for interrupt and bulk OUT EP:."]
32pub type IntonnakAoW<'a, REG> = crate::BitWriter<'a, REG>;
33#[doc = "Field `INTONNAK_AI` reader - Interrupt on NAK for interrupt and bulk IN EP:."]
34pub type IntonnakAiR = crate::BitReader;
35#[doc = "Field `INTONNAK_AI` writer - Interrupt on NAK for interrupt and bulk IN EP:."]
36pub type IntonnakAiW<'a, REG> = crate::BitWriter<'a, REG>;
37#[doc = "Field `INTONNAK_CO` reader - Interrupt on NAK for control OUT EP:."]
38pub type IntonnakCoR = crate::BitReader;
39#[doc = "Field `INTONNAK_CO` writer - Interrupt on NAK for control OUT EP:."]
40pub type IntonnakCoW<'a, REG> = crate::BitWriter<'a, REG>;
41#[doc = "Field `INTONNAK_CI` reader - Interrupt on NAK for control IN EP:."]
42pub type IntonnakCiR = crate::BitReader;
43#[doc = "Field `INTONNAK_CI` writer - Interrupt on NAK for control IN EP:."]
44pub type IntonnakCiW<'a, REG> = crate::BitWriter<'a, REG>;
45#[doc = "Field `DCON` reader - Device status - connect."]
46pub type DconR = crate::BitReader;
47#[doc = "Field `DCON` writer - Device status - connect."]
48pub type DconW<'a, REG> = crate::BitWriter<'a, REG>;
49#[doc = "Field `DSUS` reader - Device status - suspend."]
50pub type DsusR = crate::BitReader;
51#[doc = "Field `DSUS` writer - Device status - suspend."]
52pub type DsusW<'a, REG> = crate::BitWriter<'a, REG>;
53#[doc = "Field `LPM_SUS` reader - Device status - LPM Suspend."]
54pub type LpmSusR = crate::BitReader;
55#[doc = "Field `LPM_SUS` writer - Device status - LPM Suspend."]
56pub type LpmSusW<'a, REG> = crate::BitWriter<'a, REG>;
57#[doc = "Field `LPM_REWP` reader - LPM Remote Wake-up Enabled by USB host."]
58pub type LpmRewpR = crate::BitReader;
59#[doc = "Field `SPEED` reader - This field indicates the speed at which the device operates: 00b: reserved 01b: full-speed 10b: high-speed 11b: super-speed (reserved for future use)."]
60pub type SpeedR = crate::FieldReader;
61#[doc = "Field `DCON_C` reader - Device status - connect change."]
62pub type DconCR = crate::BitReader;
63#[doc = "Field `DCON_C` writer - Device status - connect change."]
64pub type DconCW<'a, REG> = crate::BitWriter<'a, REG>;
65#[doc = "Field `DSUS_C` reader - Device status - suspend change."]
66pub type DsusCR = crate::BitReader;
67#[doc = "Field `DSUS_C` writer - Device status - suspend change."]
68pub type DsusCW<'a, REG> = crate::BitWriter<'a, REG>;
69#[doc = "Field `DRES_C` reader - Device status - reset change."]
70pub type DresCR = crate::BitReader;
71#[doc = "Field `DRES_C` writer - Device status - reset change."]
72pub type DresCW<'a, REG> = crate::BitWriter<'a, REG>;
73#[doc = "Field `VBUS_DEBOUNCED` reader - This bit indicates if VBUS is detected or not."]
74pub type VbusDebouncedR = crate::BitReader;
75#[doc = "Field `PHY_TEST_MODE` reader - This field is written by firmware to put the PHY into a test mode as defined by the USB2.0 specification."]
76pub type PhyTestModeR = crate::FieldReader;
77#[doc = "Field `PHY_TEST_MODE` writer - This field is written by firmware to put the PHY into a test mode as defined by the USB2.0 specification."]
78pub type PhyTestModeW<'a, REG> = crate::FieldWriter<'a, REG, 3>;
79impl R {
80    #[doc = "Bits 0:6 - USB device address."]
81    #[inline(always)]
82    pub fn dev_addr(&self) -> DevAddrR {
83        DevAddrR::new((self.bits & 0x7f) as u8)
84    }
85    #[doc = "Bit 7 - USB device enable."]
86    #[inline(always)]
87    pub fn dev_en(&self) -> DevEnR {
88        DevEnR::new(((self.bits >> 7) & 1) != 0)
89    }
90    #[doc = "Bit 8 - SETUP token received."]
91    #[inline(always)]
92    pub fn setup(&self) -> SetupR {
93        SetupR::new(((self.bits >> 8) & 1) != 0)
94    }
95    #[doc = "Bit 9 - Forces the NEEDCLK output to always be on:."]
96    #[inline(always)]
97    pub fn force_needclk(&self) -> ForceNeedclkR {
98        ForceNeedclkR::new(((self.bits >> 9) & 1) != 0)
99    }
100    #[doc = "Bit 10 - If this bit is set to 1, the VBUS voltage indicators from the PHY are overruled."]
101    #[inline(always)]
102    pub fn force_vbus(&self) -> ForceVbusR {
103        ForceVbusR::new(((self.bits >> 10) & 1) != 0)
104    }
105    #[doc = "Bit 11 - LPM Supported:."]
106    #[inline(always)]
107    pub fn lpm_sup(&self) -> LpmSupR {
108        LpmSupR::new(((self.bits >> 11) & 1) != 0)
109    }
110    #[doc = "Bit 12 - Interrupt on NAK for interrupt and bulk OUT EP:."]
111    #[inline(always)]
112    pub fn intonnak_ao(&self) -> IntonnakAoR {
113        IntonnakAoR::new(((self.bits >> 12) & 1) != 0)
114    }
115    #[doc = "Bit 13 - Interrupt on NAK for interrupt and bulk IN EP:."]
116    #[inline(always)]
117    pub fn intonnak_ai(&self) -> IntonnakAiR {
118        IntonnakAiR::new(((self.bits >> 13) & 1) != 0)
119    }
120    #[doc = "Bit 14 - Interrupt on NAK for control OUT EP:."]
121    #[inline(always)]
122    pub fn intonnak_co(&self) -> IntonnakCoR {
123        IntonnakCoR::new(((self.bits >> 14) & 1) != 0)
124    }
125    #[doc = "Bit 15 - Interrupt on NAK for control IN EP:."]
126    #[inline(always)]
127    pub fn intonnak_ci(&self) -> IntonnakCiR {
128        IntonnakCiR::new(((self.bits >> 15) & 1) != 0)
129    }
130    #[doc = "Bit 16 - Device status - connect."]
131    #[inline(always)]
132    pub fn dcon(&self) -> DconR {
133        DconR::new(((self.bits >> 16) & 1) != 0)
134    }
135    #[doc = "Bit 17 - Device status - suspend."]
136    #[inline(always)]
137    pub fn dsus(&self) -> DsusR {
138        DsusR::new(((self.bits >> 17) & 1) != 0)
139    }
140    #[doc = "Bit 19 - Device status - LPM Suspend."]
141    #[inline(always)]
142    pub fn lpm_sus(&self) -> LpmSusR {
143        LpmSusR::new(((self.bits >> 19) & 1) != 0)
144    }
145    #[doc = "Bit 20 - LPM Remote Wake-up Enabled by USB host."]
146    #[inline(always)]
147    pub fn lpm_rewp(&self) -> LpmRewpR {
148        LpmRewpR::new(((self.bits >> 20) & 1) != 0)
149    }
150    #[doc = "Bits 22:23 - This field indicates the speed at which the device operates: 00b: reserved 01b: full-speed 10b: high-speed 11b: super-speed (reserved for future use)."]
151    #[inline(always)]
152    pub fn speed(&self) -> SpeedR {
153        SpeedR::new(((self.bits >> 22) & 3) as u8)
154    }
155    #[doc = "Bit 24 - Device status - connect change."]
156    #[inline(always)]
157    pub fn dcon_c(&self) -> DconCR {
158        DconCR::new(((self.bits >> 24) & 1) != 0)
159    }
160    #[doc = "Bit 25 - Device status - suspend change."]
161    #[inline(always)]
162    pub fn dsus_c(&self) -> DsusCR {
163        DsusCR::new(((self.bits >> 25) & 1) != 0)
164    }
165    #[doc = "Bit 26 - Device status - reset change."]
166    #[inline(always)]
167    pub fn dres_c(&self) -> DresCR {
168        DresCR::new(((self.bits >> 26) & 1) != 0)
169    }
170    #[doc = "Bit 28 - This bit indicates if VBUS is detected or not."]
171    #[inline(always)]
172    pub fn vbus_debounced(&self) -> VbusDebouncedR {
173        VbusDebouncedR::new(((self.bits >> 28) & 1) != 0)
174    }
175    #[doc = "Bits 29:31 - This field is written by firmware to put the PHY into a test mode as defined by the USB2.0 specification."]
176    #[inline(always)]
177    pub fn phy_test_mode(&self) -> PhyTestModeR {
178        PhyTestModeR::new(((self.bits >> 29) & 7) as u8)
179    }
180}
181#[cfg(feature = "debug")]
182impl core::fmt::Debug for R {
183    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
184        f.debug_struct("DEVCMDSTAT")
185            .field("dev_addr", &self.dev_addr())
186            .field("dev_en", &self.dev_en())
187            .field("setup", &self.setup())
188            .field("force_needclk", &self.force_needclk())
189            .field("force_vbus", &self.force_vbus())
190            .field("lpm_sup", &self.lpm_sup())
191            .field("intonnak_ao", &self.intonnak_ao())
192            .field("intonnak_ai", &self.intonnak_ai())
193            .field("intonnak_co", &self.intonnak_co())
194            .field("intonnak_ci", &self.intonnak_ci())
195            .field("dcon", &self.dcon())
196            .field("dsus", &self.dsus())
197            .field("lpm_sus", &self.lpm_sus())
198            .field("lpm_rewp", &self.lpm_rewp())
199            .field("speed", &self.speed())
200            .field("dcon_c", &self.dcon_c())
201            .field("dsus_c", &self.dsus_c())
202            .field("dres_c", &self.dres_c())
203            .field("vbus_debounced", &self.vbus_debounced())
204            .field("phy_test_mode", &self.phy_test_mode())
205            .finish()
206    }
207}
208impl W {
209    #[doc = "Bits 0:6 - USB device address."]
210    #[inline(always)]
211    pub fn dev_addr(&mut self) -> DevAddrW<DevcmdstatSpec> {
212        DevAddrW::new(self, 0)
213    }
214    #[doc = "Bit 7 - USB device enable."]
215    #[inline(always)]
216    pub fn dev_en(&mut self) -> DevEnW<DevcmdstatSpec> {
217        DevEnW::new(self, 7)
218    }
219    #[doc = "Bit 8 - SETUP token received."]
220    #[inline(always)]
221    pub fn setup(&mut self) -> SetupW<DevcmdstatSpec> {
222        SetupW::new(self, 8)
223    }
224    #[doc = "Bit 9 - Forces the NEEDCLK output to always be on:."]
225    #[inline(always)]
226    pub fn force_needclk(&mut self) -> ForceNeedclkW<DevcmdstatSpec> {
227        ForceNeedclkW::new(self, 9)
228    }
229    #[doc = "Bit 10 - If this bit is set to 1, the VBUS voltage indicators from the PHY are overruled."]
230    #[inline(always)]
231    pub fn force_vbus(&mut self) -> ForceVbusW<DevcmdstatSpec> {
232        ForceVbusW::new(self, 10)
233    }
234    #[doc = "Bit 11 - LPM Supported:."]
235    #[inline(always)]
236    pub fn lpm_sup(&mut self) -> LpmSupW<DevcmdstatSpec> {
237        LpmSupW::new(self, 11)
238    }
239    #[doc = "Bit 12 - Interrupt on NAK for interrupt and bulk OUT EP:."]
240    #[inline(always)]
241    pub fn intonnak_ao(&mut self) -> IntonnakAoW<DevcmdstatSpec> {
242        IntonnakAoW::new(self, 12)
243    }
244    #[doc = "Bit 13 - Interrupt on NAK for interrupt and bulk IN EP:."]
245    #[inline(always)]
246    pub fn intonnak_ai(&mut self) -> IntonnakAiW<DevcmdstatSpec> {
247        IntonnakAiW::new(self, 13)
248    }
249    #[doc = "Bit 14 - Interrupt on NAK for control OUT EP:."]
250    #[inline(always)]
251    pub fn intonnak_co(&mut self) -> IntonnakCoW<DevcmdstatSpec> {
252        IntonnakCoW::new(self, 14)
253    }
254    #[doc = "Bit 15 - Interrupt on NAK for control IN EP:."]
255    #[inline(always)]
256    pub fn intonnak_ci(&mut self) -> IntonnakCiW<DevcmdstatSpec> {
257        IntonnakCiW::new(self, 15)
258    }
259    #[doc = "Bit 16 - Device status - connect."]
260    #[inline(always)]
261    pub fn dcon(&mut self) -> DconW<DevcmdstatSpec> {
262        DconW::new(self, 16)
263    }
264    #[doc = "Bit 17 - Device status - suspend."]
265    #[inline(always)]
266    pub fn dsus(&mut self) -> DsusW<DevcmdstatSpec> {
267        DsusW::new(self, 17)
268    }
269    #[doc = "Bit 19 - Device status - LPM Suspend."]
270    #[inline(always)]
271    pub fn lpm_sus(&mut self) -> LpmSusW<DevcmdstatSpec> {
272        LpmSusW::new(self, 19)
273    }
274    #[doc = "Bit 24 - Device status - connect change."]
275    #[inline(always)]
276    pub fn dcon_c(&mut self) -> DconCW<DevcmdstatSpec> {
277        DconCW::new(self, 24)
278    }
279    #[doc = "Bit 25 - Device status - suspend change."]
280    #[inline(always)]
281    pub fn dsus_c(&mut self) -> DsusCW<DevcmdstatSpec> {
282        DsusCW::new(self, 25)
283    }
284    #[doc = "Bit 26 - Device status - reset change."]
285    #[inline(always)]
286    pub fn dres_c(&mut self) -> DresCW<DevcmdstatSpec> {
287        DresCW::new(self, 26)
288    }
289    #[doc = "Bits 29:31 - This field is written by firmware to put the PHY into a test mode as defined by the USB2.0 specification."]
290    #[inline(always)]
291    pub fn phy_test_mode(&mut self) -> PhyTestModeW<DevcmdstatSpec> {
292        PhyTestModeW::new(self, 29)
293    }
294}
295#[doc = "USB Device Command/Status register\n\nYou can [`read`](crate::Reg::read) this register and get [`devcmdstat::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`devcmdstat::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
296pub struct DevcmdstatSpec;
297impl crate::RegisterSpec for DevcmdstatSpec {
298    type Ux = u32;
299}
300#[doc = "`read()` method returns [`devcmdstat::R`](R) reader structure"]
301impl crate::Readable for DevcmdstatSpec {}
302#[doc = "`write(|w| ..)` method takes [`devcmdstat::W`](W) writer structure"]
303impl crate::Writable for DevcmdstatSpec {
304    type Safety = crate::Unsafe;
305    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
306    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
307}
308#[doc = "`reset()` method sets DEVCMDSTAT to value 0x0800"]
309impl crate::Resettable for DevcmdstatSpec {
310    const RESET_VALUE: u32 = 0x0800;
311}