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