xmc4300/usb0/
gintsts_devicemode.rs1#[doc = "Register `GINTSTS_DEVICEMODE` reader"]
2pub type R = crate::R<GINTSTS_DEVICEMODE_SPEC>;
3#[doc = "Register `GINTSTS_DEVICEMODE` writer"]
4pub type W = crate::W<GINTSTS_DEVICEMODE_SPEC>;
5#[doc = "Current Mode of Operation\n\nValue on reset: 0"]
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7pub enum CUR_MOD_A {
8 #[doc = "0: Device mode"]
9 VALUE1 = 0,
10 #[doc = "1: Host mode"]
11 VALUE2 = 1,
12}
13impl From<CUR_MOD_A> for bool {
14 #[inline(always)]
15 fn from(variant: CUR_MOD_A) -> Self {
16 variant as u8 != 0
17 }
18}
19#[doc = "Field `CurMod` reader - Current Mode of Operation"]
20pub type CUR_MOD_R = crate::BitReader<CUR_MOD_A>;
21impl CUR_MOD_R {
22 #[doc = "Get enumerated values variant"]
23 #[inline(always)]
24 pub const fn variant(&self) -> CUR_MOD_A {
25 match self.bits {
26 false => CUR_MOD_A::VALUE1,
27 true => CUR_MOD_A::VALUE2,
28 }
29 }
30 #[doc = "Device mode"]
31 #[inline(always)]
32 pub fn is_value1(&self) -> bool {
33 *self == CUR_MOD_A::VALUE1
34 }
35 #[doc = "Host mode"]
36 #[inline(always)]
37 pub fn is_value2(&self) -> bool {
38 *self == CUR_MOD_A::VALUE2
39 }
40}
41#[doc = "Field `ModeMis` reader - Mode Mismatch Interrupt"]
42pub type MODE_MIS_R = crate::BitReader;
43#[doc = "Field `ModeMis` writer - Mode Mismatch Interrupt"]
44pub type MODE_MIS_W<'a, REG> = crate::BitWriter<'a, REG>;
45#[doc = "Field `OTGInt` reader - OTG Interrupt"]
46pub type OTGINT_R = crate::BitReader;
47#[doc = "Field `Sof` reader - Start of Frame"]
48pub type SOF_R = crate::BitReader;
49#[doc = "Field `Sof` writer - Start of Frame"]
50pub type SOF_W<'a, REG> = crate::BitWriter<'a, REG>;
51#[doc = "Field `RxFLvl` reader - RxFIFO Non-Empty"]
52pub type RX_FLVL_R = crate::BitReader;
53#[doc = "Field `GINNakEff` reader - Global IN Non-Periodic NAK Effective"]
54pub type GINNAK_EFF_R = crate::BitReader;
55#[doc = "Field `GOUTNakEff` reader - Global OUT NAK Effective"]
56pub type GOUTNAK_EFF_R = crate::BitReader;
57#[doc = "Field `ErlySusp` reader - Early Suspend"]
58pub type ERLY_SUSP_R = crate::BitReader;
59#[doc = "Field `ErlySusp` writer - Early Suspend"]
60pub type ERLY_SUSP_W<'a, REG> = crate::BitWriter<'a, REG>;
61#[doc = "Field `USBSusp` reader - USB Suspend"]
62pub type USBSUSP_R = crate::BitReader;
63#[doc = "Field `USBSusp` writer - USB Suspend"]
64pub type USBSUSP_W<'a, REG> = crate::BitWriter<'a, REG>;
65#[doc = "Field `USBRst` reader - USB Reset"]
66pub type USBRST_R = crate::BitReader;
67#[doc = "Field `USBRst` writer - USB Reset"]
68pub type USBRST_W<'a, REG> = crate::BitWriter<'a, REG>;
69#[doc = "Field `EnumDone` reader - Enumeration Done"]
70pub type ENUM_DONE_R = crate::BitReader;
71#[doc = "Field `EnumDone` writer - Enumeration Done"]
72pub type ENUM_DONE_W<'a, REG> = crate::BitWriter<'a, REG>;
73#[doc = "Field `ISOOutDrop` reader - Isochronous OUT Packet Dropped Interrupt"]
74pub type ISOOUT_DROP_R = crate::BitReader;
75#[doc = "Field `ISOOutDrop` writer - Isochronous OUT Packet Dropped Interrupt"]
76pub type ISOOUT_DROP_W<'a, REG> = crate::BitWriter<'a, REG>;
77#[doc = "Field `EOPF` reader - End of Periodic Frame Interrupt"]
78pub type EOPF_R = crate::BitReader;
79#[doc = "Field `EOPF` writer - End of Periodic Frame Interrupt"]
80pub type EOPF_W<'a, REG> = crate::BitWriter<'a, REG>;
81#[doc = "Field `IEPInt` reader - IN Endpoints Interrupt"]
82pub type IEPINT_R = crate::BitReader;
83#[doc = "Field `OEPInt` reader - OUT Endpoints Interrupt"]
84pub type OEPINT_R = crate::BitReader;
85#[doc = "Field `incompISOIN` reader - Incomplete Isochronous IN Transfer"]
86pub type INCOMP_ISOIN_R = crate::BitReader;
87#[doc = "Field `incompISOIN` writer - Incomplete Isochronous IN Transfer"]
88pub type INCOMP_ISOIN_W<'a, REG> = crate::BitWriter<'a, REG>;
89#[doc = "Field `incomplSOOUT` reader - Incomplete Isochronous OUT Transfer"]
90pub type INCOMPL_SOOUT_R = crate::BitReader;
91#[doc = "Field `incomplSOOUT` writer - Incomplete Isochronous OUT Transfer"]
92pub type INCOMPL_SOOUT_W<'a, REG> = crate::BitWriter<'a, REG>;
93#[doc = "Field `ConIDStsChng` reader - Connector ID Status Change"]
94pub type CON_IDSTS_CHNG_R = crate::BitReader;
95#[doc = "Field `ConIDStsChng` writer - Connector ID Status Change"]
96pub type CON_IDSTS_CHNG_W<'a, REG> = crate::BitWriter<'a, REG>;
97#[doc = "Field `SessReqInt` reader - Session Request/New Session Detected Interrupt"]
98pub type SESS_REQ_INT_R = crate::BitReader;
99#[doc = "Field `SessReqInt` writer - Session Request/New Session Detected Interrupt"]
100pub type SESS_REQ_INT_W<'a, REG> = crate::BitWriter<'a, REG>;
101#[doc = "Field `WkUpInt` reader - Resume/Remote Wakeup Detected Interrupt"]
102pub type WK_UP_INT_R = crate::BitReader;
103#[doc = "Field `WkUpInt` writer - Resume/Remote Wakeup Detected Interrupt"]
104pub type WK_UP_INT_W<'a, REG> = crate::BitWriter<'a, REG>;
105impl R {
106 #[doc = "Bit 0 - Current Mode of Operation"]
107 #[inline(always)]
108 pub fn cur_mod(&self) -> CUR_MOD_R {
109 CUR_MOD_R::new((self.bits & 1) != 0)
110 }
111 #[doc = "Bit 1 - Mode Mismatch Interrupt"]
112 #[inline(always)]
113 pub fn mode_mis(&self) -> MODE_MIS_R {
114 MODE_MIS_R::new(((self.bits >> 1) & 1) != 0)
115 }
116 #[doc = "Bit 2 - OTG Interrupt"]
117 #[inline(always)]
118 pub fn otgint(&self) -> OTGINT_R {
119 OTGINT_R::new(((self.bits >> 2) & 1) != 0)
120 }
121 #[doc = "Bit 3 - Start of Frame"]
122 #[inline(always)]
123 pub fn sof(&self) -> SOF_R {
124 SOF_R::new(((self.bits >> 3) & 1) != 0)
125 }
126 #[doc = "Bit 4 - RxFIFO Non-Empty"]
127 #[inline(always)]
128 pub fn rx_flvl(&self) -> RX_FLVL_R {
129 RX_FLVL_R::new(((self.bits >> 4) & 1) != 0)
130 }
131 #[doc = "Bit 6 - Global IN Non-Periodic NAK Effective"]
132 #[inline(always)]
133 pub fn ginnak_eff(&self) -> GINNAK_EFF_R {
134 GINNAK_EFF_R::new(((self.bits >> 6) & 1) != 0)
135 }
136 #[doc = "Bit 7 - Global OUT NAK Effective"]
137 #[inline(always)]
138 pub fn goutnak_eff(&self) -> GOUTNAK_EFF_R {
139 GOUTNAK_EFF_R::new(((self.bits >> 7) & 1) != 0)
140 }
141 #[doc = "Bit 10 - Early Suspend"]
142 #[inline(always)]
143 pub fn erly_susp(&self) -> ERLY_SUSP_R {
144 ERLY_SUSP_R::new(((self.bits >> 10) & 1) != 0)
145 }
146 #[doc = "Bit 11 - USB Suspend"]
147 #[inline(always)]
148 pub fn usbsusp(&self) -> USBSUSP_R {
149 USBSUSP_R::new(((self.bits >> 11) & 1) != 0)
150 }
151 #[doc = "Bit 12 - USB Reset"]
152 #[inline(always)]
153 pub fn usbrst(&self) -> USBRST_R {
154 USBRST_R::new(((self.bits >> 12) & 1) != 0)
155 }
156 #[doc = "Bit 13 - Enumeration Done"]
157 #[inline(always)]
158 pub fn enum_done(&self) -> ENUM_DONE_R {
159 ENUM_DONE_R::new(((self.bits >> 13) & 1) != 0)
160 }
161 #[doc = "Bit 14 - Isochronous OUT Packet Dropped Interrupt"]
162 #[inline(always)]
163 pub fn isoout_drop(&self) -> ISOOUT_DROP_R {
164 ISOOUT_DROP_R::new(((self.bits >> 14) & 1) != 0)
165 }
166 #[doc = "Bit 15 - End of Periodic Frame Interrupt"]
167 #[inline(always)]
168 pub fn eopf(&self) -> EOPF_R {
169 EOPF_R::new(((self.bits >> 15) & 1) != 0)
170 }
171 #[doc = "Bit 18 - IN Endpoints Interrupt"]
172 #[inline(always)]
173 pub fn iepint(&self) -> IEPINT_R {
174 IEPINT_R::new(((self.bits >> 18) & 1) != 0)
175 }
176 #[doc = "Bit 19 - OUT Endpoints Interrupt"]
177 #[inline(always)]
178 pub fn oepint(&self) -> OEPINT_R {
179 OEPINT_R::new(((self.bits >> 19) & 1) != 0)
180 }
181 #[doc = "Bit 20 - Incomplete Isochronous IN Transfer"]
182 #[inline(always)]
183 pub fn incomp_isoin(&self) -> INCOMP_ISOIN_R {
184 INCOMP_ISOIN_R::new(((self.bits >> 20) & 1) != 0)
185 }
186 #[doc = "Bit 21 - Incomplete Isochronous OUT Transfer"]
187 #[inline(always)]
188 pub fn incompl_soout(&self) -> INCOMPL_SOOUT_R {
189 INCOMPL_SOOUT_R::new(((self.bits >> 21) & 1) != 0)
190 }
191 #[doc = "Bit 28 - Connector ID Status Change"]
192 #[inline(always)]
193 pub fn con_idsts_chng(&self) -> CON_IDSTS_CHNG_R {
194 CON_IDSTS_CHNG_R::new(((self.bits >> 28) & 1) != 0)
195 }
196 #[doc = "Bit 30 - Session Request/New Session Detected Interrupt"]
197 #[inline(always)]
198 pub fn sess_req_int(&self) -> SESS_REQ_INT_R {
199 SESS_REQ_INT_R::new(((self.bits >> 30) & 1) != 0)
200 }
201 #[doc = "Bit 31 - Resume/Remote Wakeup Detected Interrupt"]
202 #[inline(always)]
203 pub fn wk_up_int(&self) -> WK_UP_INT_R {
204 WK_UP_INT_R::new(((self.bits >> 31) & 1) != 0)
205 }
206}
207impl W {
208 #[doc = "Bit 1 - Mode Mismatch Interrupt"]
209 #[inline(always)]
210 pub fn mode_mis(&mut self) -> MODE_MIS_W<GINTSTS_DEVICEMODE_SPEC> {
211 MODE_MIS_W::new(self, 1)
212 }
213 #[doc = "Bit 3 - Start of Frame"]
214 #[inline(always)]
215 pub fn sof(&mut self) -> SOF_W<GINTSTS_DEVICEMODE_SPEC> {
216 SOF_W::new(self, 3)
217 }
218 #[doc = "Bit 10 - Early Suspend"]
219 #[inline(always)]
220 pub fn erly_susp(&mut self) -> ERLY_SUSP_W<GINTSTS_DEVICEMODE_SPEC> {
221 ERLY_SUSP_W::new(self, 10)
222 }
223 #[doc = "Bit 11 - USB Suspend"]
224 #[inline(always)]
225 pub fn usbsusp(&mut self) -> USBSUSP_W<GINTSTS_DEVICEMODE_SPEC> {
226 USBSUSP_W::new(self, 11)
227 }
228 #[doc = "Bit 12 - USB Reset"]
229 #[inline(always)]
230 pub fn usbrst(&mut self) -> USBRST_W<GINTSTS_DEVICEMODE_SPEC> {
231 USBRST_W::new(self, 12)
232 }
233 #[doc = "Bit 13 - Enumeration Done"]
234 #[inline(always)]
235 pub fn enum_done(&mut self) -> ENUM_DONE_W<GINTSTS_DEVICEMODE_SPEC> {
236 ENUM_DONE_W::new(self, 13)
237 }
238 #[doc = "Bit 14 - Isochronous OUT Packet Dropped Interrupt"]
239 #[inline(always)]
240 pub fn isoout_drop(&mut self) -> ISOOUT_DROP_W<GINTSTS_DEVICEMODE_SPEC> {
241 ISOOUT_DROP_W::new(self, 14)
242 }
243 #[doc = "Bit 15 - End of Periodic Frame Interrupt"]
244 #[inline(always)]
245 pub fn eopf(&mut self) -> EOPF_W<GINTSTS_DEVICEMODE_SPEC> {
246 EOPF_W::new(self, 15)
247 }
248 #[doc = "Bit 20 - Incomplete Isochronous IN Transfer"]
249 #[inline(always)]
250 pub fn incomp_isoin(&mut self) -> INCOMP_ISOIN_W<GINTSTS_DEVICEMODE_SPEC> {
251 INCOMP_ISOIN_W::new(self, 20)
252 }
253 #[doc = "Bit 21 - Incomplete Isochronous OUT Transfer"]
254 #[inline(always)]
255 pub fn incompl_soout(&mut self) -> INCOMPL_SOOUT_W<GINTSTS_DEVICEMODE_SPEC> {
256 INCOMPL_SOOUT_W::new(self, 21)
257 }
258 #[doc = "Bit 28 - Connector ID Status Change"]
259 #[inline(always)]
260 pub fn con_idsts_chng(&mut self) -> CON_IDSTS_CHNG_W<GINTSTS_DEVICEMODE_SPEC> {
261 CON_IDSTS_CHNG_W::new(self, 28)
262 }
263 #[doc = "Bit 30 - Session Request/New Session Detected Interrupt"]
264 #[inline(always)]
265 pub fn sess_req_int(&mut self) -> SESS_REQ_INT_W<GINTSTS_DEVICEMODE_SPEC> {
266 SESS_REQ_INT_W::new(self, 30)
267 }
268 #[doc = "Bit 31 - Resume/Remote Wakeup Detected Interrupt"]
269 #[inline(always)]
270 pub fn wk_up_int(&mut self) -> WK_UP_INT_W<GINTSTS_DEVICEMODE_SPEC> {
271 WK_UP_INT_W::new(self, 31)
272 }
273}
274#[doc = "Interrupt Register \\[DEVICEMODE\\]\n\nYou can [`read`](crate::Reg::read) this register and get [`gintsts_devicemode::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`gintsts_devicemode::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
275pub struct GINTSTS_DEVICEMODE_SPEC;
276impl crate::RegisterSpec for GINTSTS_DEVICEMODE_SPEC {
277 type Ux = u32;
278}
279#[doc = "`read()` method returns [`gintsts_devicemode::R`](R) reader structure"]
280impl crate::Readable for GINTSTS_DEVICEMODE_SPEC {}
281#[doc = "`write(|w| ..)` method takes [`gintsts_devicemode::W`](W) writer structure"]
282impl crate::Writable for GINTSTS_DEVICEMODE_SPEC {
283 type Safety = crate::Unsafe;
284 const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
285 const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
286}
287#[doc = "`reset()` method sets GINTSTS_DEVICEMODE to value 0x1400_0020"]
288impl crate::Resettable for GINTSTS_DEVICEMODE_SPEC {
289 const RESET_VALUE: u32 = 0x1400_0020;
290}