efm32gg12b410_pac/usb/
gotgctl.rs1#[doc = "Register `GOTGCTL` reader"]
2pub struct R(crate::R<GOTGCTL_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<GOTGCTL_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<GOTGCTL_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<GOTGCTL_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `GOTGCTL` writer"]
17pub struct W(crate::W<GOTGCTL_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<GOTGCTL_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<GOTGCTL_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<GOTGCTL_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `SESREQSCS` reader - Session Request Success"]
38pub type SESREQSCS_R = crate::BitReader<bool>;
39#[doc = "Field `SESREQ` reader - Session Request"]
40pub type SESREQ_R = crate::BitReader<bool>;
41#[doc = "Field `SESREQ` writer - Session Request"]
42pub type SESREQ_W<'a> = crate::BitWriter<'a, u32, GOTGCTL_SPEC, bool, 1>;
43#[doc = "Field `VBVALIDOVEN` reader - VBUS Valid Override Enable"]
44pub type VBVALIDOVEN_R = crate::BitReader<bool>;
45#[doc = "Field `VBVALIDOVEN` writer - VBUS Valid Override Enable"]
46pub type VBVALIDOVEN_W<'a> = crate::BitWriter<'a, u32, GOTGCTL_SPEC, bool, 2>;
47#[doc = "Field `VBVALIDOVVAL` reader - VBUS Valid OverrideValue"]
48pub type VBVALIDOVVAL_R = crate::BitReader<bool>;
49#[doc = "Field `VBVALIDOVVAL` writer - VBUS Valid OverrideValue"]
50pub type VBVALIDOVVAL_W<'a> = crate::BitWriter<'a, u32, GOTGCTL_SPEC, bool, 3>;
51#[doc = "Field `AVALIDOVEN` reader - A-Peripheral Session Valid Override Enable"]
52pub type AVALIDOVEN_R = crate::BitReader<bool>;
53#[doc = "Field `AVALIDOVEN` writer - A-Peripheral Session Valid Override Enable"]
54pub type AVALIDOVEN_W<'a> = crate::BitWriter<'a, u32, GOTGCTL_SPEC, bool, 4>;
55#[doc = "Field `AVALIDOVVAL` reader - A-Peripheral Session Valid OverrideValue"]
56pub type AVALIDOVVAL_R = crate::BitReader<bool>;
57#[doc = "Field `AVALIDOVVAL` writer - A-Peripheral Session Valid OverrideValue"]
58pub type AVALIDOVVAL_W<'a> = crate::BitWriter<'a, u32, GOTGCTL_SPEC, bool, 5>;
59#[doc = "Field `BVALIDOVEN` reader - B-Peripheral Session Valid Override Enable"]
60pub type BVALIDOVEN_R = crate::BitReader<bool>;
61#[doc = "Field `BVALIDOVEN` writer - B-Peripheral Session Valid Override Enable"]
62pub type BVALIDOVEN_W<'a> = crate::BitWriter<'a, u32, GOTGCTL_SPEC, bool, 6>;
63#[doc = "Field `BVALIDOVVAL` reader - B-Peripheral Session Valid OverrideValue"]
64pub type BVALIDOVVAL_R = crate::BitReader<bool>;
65#[doc = "Field `BVALIDOVVAL` writer - B-Peripheral Session Valid OverrideValue"]
66pub type BVALIDOVVAL_W<'a> = crate::BitWriter<'a, u32, GOTGCTL_SPEC, bool, 7>;
67#[doc = "Field `HSTNEGSCS` reader - Host Negotiation Success"]
68pub type HSTNEGSCS_R = crate::BitReader<bool>;
69#[doc = "Field `HNPREQ` reader - HNP Request"]
70pub type HNPREQ_R = crate::BitReader<bool>;
71#[doc = "Field `HNPREQ` writer - HNP Request"]
72pub type HNPREQ_W<'a> = crate::BitWriter<'a, u32, GOTGCTL_SPEC, bool, 9>;
73#[doc = "Field `HSTSETHNPEN` reader - Host Set HNP Enable"]
74pub type HSTSETHNPEN_R = crate::BitReader<bool>;
75#[doc = "Field `HSTSETHNPEN` writer - Host Set HNP Enable"]
76pub type HSTSETHNPEN_W<'a> = crate::BitWriter<'a, u32, GOTGCTL_SPEC, bool, 10>;
77#[doc = "Field `DEVHNPEN` reader - Device HNP Enabled"]
78pub type DEVHNPEN_R = crate::BitReader<bool>;
79#[doc = "Field `DEVHNPEN` writer - Device HNP Enabled"]
80pub type DEVHNPEN_W<'a> = crate::BitWriter<'a, u32, GOTGCTL_SPEC, bool, 11>;
81#[doc = "Field `EHEN` reader - Embedded Host Enable"]
82pub type EHEN_R = crate::BitReader<bool>;
83#[doc = "Field `EHEN` writer - Embedded Host Enable"]
84pub type EHEN_W<'a> = crate::BitWriter<'a, u32, GOTGCTL_SPEC, bool, 12>;
85#[doc = "Field `DBNCEFLTRBYPASS` reader - Debounce Filter Bypass"]
86pub type DBNCEFLTRBYPASS_R = crate::BitReader<bool>;
87#[doc = "Field `DBNCEFLTRBYPASS` writer - Debounce Filter Bypass"]
88pub type DBNCEFLTRBYPASS_W<'a> = crate::BitWriter<'a, u32, GOTGCTL_SPEC, bool, 15>;
89#[doc = "Field `CONIDSTS` reader - Connector ID Status"]
90pub type CONIDSTS_R = crate::BitReader<bool>;
91#[doc = "Field `DBNCTIME` reader - Long/Short Debounce Time"]
92pub type DBNCTIME_R = crate::BitReader<bool>;
93#[doc = "Field `ASESVLD` reader - A-Session Valid"]
94pub type ASESVLD_R = crate::BitReader<bool>;
95#[doc = "Field `BSESVLD` reader - B-Session Valid"]
96pub type BSESVLD_R = crate::BitReader<bool>;
97#[doc = "Field `OTGVER` reader - OTG Version"]
98pub type OTGVER_R = crate::BitReader<bool>;
99#[doc = "Field `OTGVER` writer - OTG Version"]
100pub type OTGVER_W<'a> = crate::BitWriter<'a, u32, GOTGCTL_SPEC, bool, 20>;
101#[doc = "Field `CURMOD` reader - Current Mode of Operation"]
102pub type CURMOD_R = crate::BitReader<bool>;
103impl R {
104 #[doc = "Bit 0 - Session Request Success"]
105 #[inline(always)]
106 pub fn sesreqscs(&self) -> SESREQSCS_R {
107 SESREQSCS_R::new((self.bits & 1) != 0)
108 }
109 #[doc = "Bit 1 - Session Request"]
110 #[inline(always)]
111 pub fn sesreq(&self) -> SESREQ_R {
112 SESREQ_R::new(((self.bits >> 1) & 1) != 0)
113 }
114 #[doc = "Bit 2 - VBUS Valid Override Enable"]
115 #[inline(always)]
116 pub fn vbvalidoven(&self) -> VBVALIDOVEN_R {
117 VBVALIDOVEN_R::new(((self.bits >> 2) & 1) != 0)
118 }
119 #[doc = "Bit 3 - VBUS Valid OverrideValue"]
120 #[inline(always)]
121 pub fn vbvalidovval(&self) -> VBVALIDOVVAL_R {
122 VBVALIDOVVAL_R::new(((self.bits >> 3) & 1) != 0)
123 }
124 #[doc = "Bit 4 - A-Peripheral Session Valid Override Enable"]
125 #[inline(always)]
126 pub fn avalidoven(&self) -> AVALIDOVEN_R {
127 AVALIDOVEN_R::new(((self.bits >> 4) & 1) != 0)
128 }
129 #[doc = "Bit 5 - A-Peripheral Session Valid OverrideValue"]
130 #[inline(always)]
131 pub fn avalidovval(&self) -> AVALIDOVVAL_R {
132 AVALIDOVVAL_R::new(((self.bits >> 5) & 1) != 0)
133 }
134 #[doc = "Bit 6 - B-Peripheral Session Valid Override Enable"]
135 #[inline(always)]
136 pub fn bvalidoven(&self) -> BVALIDOVEN_R {
137 BVALIDOVEN_R::new(((self.bits >> 6) & 1) != 0)
138 }
139 #[doc = "Bit 7 - B-Peripheral Session Valid OverrideValue"]
140 #[inline(always)]
141 pub fn bvalidovval(&self) -> BVALIDOVVAL_R {
142 BVALIDOVVAL_R::new(((self.bits >> 7) & 1) != 0)
143 }
144 #[doc = "Bit 8 - Host Negotiation Success"]
145 #[inline(always)]
146 pub fn hstnegscs(&self) -> HSTNEGSCS_R {
147 HSTNEGSCS_R::new(((self.bits >> 8) & 1) != 0)
148 }
149 #[doc = "Bit 9 - HNP Request"]
150 #[inline(always)]
151 pub fn hnpreq(&self) -> HNPREQ_R {
152 HNPREQ_R::new(((self.bits >> 9) & 1) != 0)
153 }
154 #[doc = "Bit 10 - Host Set HNP Enable"]
155 #[inline(always)]
156 pub fn hstsethnpen(&self) -> HSTSETHNPEN_R {
157 HSTSETHNPEN_R::new(((self.bits >> 10) & 1) != 0)
158 }
159 #[doc = "Bit 11 - Device HNP Enabled"]
160 #[inline(always)]
161 pub fn devhnpen(&self) -> DEVHNPEN_R {
162 DEVHNPEN_R::new(((self.bits >> 11) & 1) != 0)
163 }
164 #[doc = "Bit 12 - Embedded Host Enable"]
165 #[inline(always)]
166 pub fn ehen(&self) -> EHEN_R {
167 EHEN_R::new(((self.bits >> 12) & 1) != 0)
168 }
169 #[doc = "Bit 15 - Debounce Filter Bypass"]
170 #[inline(always)]
171 pub fn dbncefltrbypass(&self) -> DBNCEFLTRBYPASS_R {
172 DBNCEFLTRBYPASS_R::new(((self.bits >> 15) & 1) != 0)
173 }
174 #[doc = "Bit 16 - Connector ID Status"]
175 #[inline(always)]
176 pub fn conidsts(&self) -> CONIDSTS_R {
177 CONIDSTS_R::new(((self.bits >> 16) & 1) != 0)
178 }
179 #[doc = "Bit 17 - Long/Short Debounce Time"]
180 #[inline(always)]
181 pub fn dbnctime(&self) -> DBNCTIME_R {
182 DBNCTIME_R::new(((self.bits >> 17) & 1) != 0)
183 }
184 #[doc = "Bit 18 - A-Session Valid"]
185 #[inline(always)]
186 pub fn asesvld(&self) -> ASESVLD_R {
187 ASESVLD_R::new(((self.bits >> 18) & 1) != 0)
188 }
189 #[doc = "Bit 19 - B-Session Valid"]
190 #[inline(always)]
191 pub fn bsesvld(&self) -> BSESVLD_R {
192 BSESVLD_R::new(((self.bits >> 19) & 1) != 0)
193 }
194 #[doc = "Bit 20 - OTG Version"]
195 #[inline(always)]
196 pub fn otgver(&self) -> OTGVER_R {
197 OTGVER_R::new(((self.bits >> 20) & 1) != 0)
198 }
199 #[doc = "Bit 21 - Current Mode of Operation"]
200 #[inline(always)]
201 pub fn curmod(&self) -> CURMOD_R {
202 CURMOD_R::new(((self.bits >> 21) & 1) != 0)
203 }
204}
205impl W {
206 #[doc = "Bit 1 - Session Request"]
207 #[inline(always)]
208 pub fn sesreq(&mut self) -> SESREQ_W {
209 SESREQ_W::new(self)
210 }
211 #[doc = "Bit 2 - VBUS Valid Override Enable"]
212 #[inline(always)]
213 pub fn vbvalidoven(&mut self) -> VBVALIDOVEN_W {
214 VBVALIDOVEN_W::new(self)
215 }
216 #[doc = "Bit 3 - VBUS Valid OverrideValue"]
217 #[inline(always)]
218 pub fn vbvalidovval(&mut self) -> VBVALIDOVVAL_W {
219 VBVALIDOVVAL_W::new(self)
220 }
221 #[doc = "Bit 4 - A-Peripheral Session Valid Override Enable"]
222 #[inline(always)]
223 pub fn avalidoven(&mut self) -> AVALIDOVEN_W {
224 AVALIDOVEN_W::new(self)
225 }
226 #[doc = "Bit 5 - A-Peripheral Session Valid OverrideValue"]
227 #[inline(always)]
228 pub fn avalidovval(&mut self) -> AVALIDOVVAL_W {
229 AVALIDOVVAL_W::new(self)
230 }
231 #[doc = "Bit 6 - B-Peripheral Session Valid Override Enable"]
232 #[inline(always)]
233 pub fn bvalidoven(&mut self) -> BVALIDOVEN_W {
234 BVALIDOVEN_W::new(self)
235 }
236 #[doc = "Bit 7 - B-Peripheral Session Valid OverrideValue"]
237 #[inline(always)]
238 pub fn bvalidovval(&mut self) -> BVALIDOVVAL_W {
239 BVALIDOVVAL_W::new(self)
240 }
241 #[doc = "Bit 9 - HNP Request"]
242 #[inline(always)]
243 pub fn hnpreq(&mut self) -> HNPREQ_W {
244 HNPREQ_W::new(self)
245 }
246 #[doc = "Bit 10 - Host Set HNP Enable"]
247 #[inline(always)]
248 pub fn hstsethnpen(&mut self) -> HSTSETHNPEN_W {
249 HSTSETHNPEN_W::new(self)
250 }
251 #[doc = "Bit 11 - Device HNP Enabled"]
252 #[inline(always)]
253 pub fn devhnpen(&mut self) -> DEVHNPEN_W {
254 DEVHNPEN_W::new(self)
255 }
256 #[doc = "Bit 12 - Embedded Host Enable"]
257 #[inline(always)]
258 pub fn ehen(&mut self) -> EHEN_W {
259 EHEN_W::new(self)
260 }
261 #[doc = "Bit 15 - Debounce Filter Bypass"]
262 #[inline(always)]
263 pub fn dbncefltrbypass(&mut self) -> DBNCEFLTRBYPASS_W {
264 DBNCEFLTRBYPASS_W::new(self)
265 }
266 #[doc = "Bit 20 - OTG Version"]
267 #[inline(always)]
268 pub fn otgver(&mut self) -> OTGVER_W {
269 OTGVER_W::new(self)
270 }
271 #[doc = "Writes raw bits to the register."]
272 #[inline(always)]
273 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
274 self.0.bits(bits);
275 self
276 }
277}
278#[doc = "OTG Control and 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 [gotgctl](index.html) module"]
279pub struct GOTGCTL_SPEC;
280impl crate::RegisterSpec for GOTGCTL_SPEC {
281 type Ux = u32;
282}
283#[doc = "`read()` method returns [gotgctl::R](R) reader structure"]
284impl crate::Readable for GOTGCTL_SPEC {
285 type Reader = R;
286}
287#[doc = "`write(|w| ..)` method takes [gotgctl::W](W) writer structure"]
288impl crate::Writable for GOTGCTL_SPEC {
289 type Writer = W;
290}
291#[doc = "`reset()` method sets GOTGCTL to value 0x0001_0000"]
292impl crate::Resettable for GOTGCTL_SPEC {
293 #[inline(always)]
294 fn reset_value() -> Self::Ux {
295 0x0001_0000
296 }
297}