efm32gg_pac/efm32gg995/usb/
dctl.rs1#[doc = "Register `DCTL` reader"]
2pub struct R(crate::R<DCTL_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<DCTL_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<DCTL_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<DCTL_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `DCTL` writer"]
17pub struct W(crate::W<DCTL_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<DCTL_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<DCTL_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<DCTL_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `RMTWKUPSIG` reader - Remote Wakeup Signaling"]
38pub type RMTWKUPSIG_R = crate::BitReader<bool>;
39#[doc = "Field `RMTWKUPSIG` writer - Remote Wakeup Signaling"]
40pub type RMTWKUPSIG_W<'a, const O: u8> = crate::BitWriter<'a, u32, DCTL_SPEC, bool, O>;
41#[doc = "Field `SFTDISCON` reader - Soft Disconnect"]
42pub type SFTDISCON_R = crate::BitReader<bool>;
43#[doc = "Field `SFTDISCON` writer - Soft Disconnect"]
44pub type SFTDISCON_W<'a, const O: u8> = crate::BitWriter<'a, u32, DCTL_SPEC, bool, O>;
45#[doc = "Field `GNPINNAKSTS` reader - Global Non-periodic IN NAK Status"]
46pub type GNPINNAKSTS_R = crate::BitReader<bool>;
47#[doc = "Field `GOUTNAKSTS` reader - Global OUT NAK Status"]
48pub type GOUTNAKSTS_R = crate::BitReader<bool>;
49#[doc = "Field `TSTCTL` reader - Test Control"]
50pub type TSTCTL_R = crate::FieldReader<u8, TSTCTL_A>;
51#[doc = "Test Control\n\nValue on reset: 0"]
52#[derive(Clone, Copy, Debug, PartialEq, Eq)]
53#[repr(u8)]
54pub enum TSTCTL_A {
55 #[doc = "0: Test mode disabled."]
56 DISABLE = 0,
57 #[doc = "1: Test_J mode."]
58 J = 1,
59 #[doc = "2: Test_K mode."]
60 K = 2,
61 #[doc = "3: Test_SE0_NAK mode."]
62 SE0NAK = 3,
63 #[doc = "4: Test_Packet mode."]
64 PACKET = 4,
65 #[doc = "5: Test_Force_Enable."]
66 FORCE = 5,
67}
68impl From<TSTCTL_A> for u8 {
69 #[inline(always)]
70 fn from(variant: TSTCTL_A) -> Self {
71 variant as _
72 }
73}
74impl TSTCTL_R {
75 #[doc = "Get enumerated values variant"]
76 #[inline(always)]
77 pub fn variant(&self) -> Option<TSTCTL_A> {
78 match self.bits {
79 0 => Some(TSTCTL_A::DISABLE),
80 1 => Some(TSTCTL_A::J),
81 2 => Some(TSTCTL_A::K),
82 3 => Some(TSTCTL_A::SE0NAK),
83 4 => Some(TSTCTL_A::PACKET),
84 5 => Some(TSTCTL_A::FORCE),
85 _ => None,
86 }
87 }
88 #[doc = "Checks if the value of the field is `DISABLE`"]
89 #[inline(always)]
90 pub fn is_disable(&self) -> bool {
91 *self == TSTCTL_A::DISABLE
92 }
93 #[doc = "Checks if the value of the field is `J`"]
94 #[inline(always)]
95 pub fn is_j(&self) -> bool {
96 *self == TSTCTL_A::J
97 }
98 #[doc = "Checks if the value of the field is `K`"]
99 #[inline(always)]
100 pub fn is_k(&self) -> bool {
101 *self == TSTCTL_A::K
102 }
103 #[doc = "Checks if the value of the field is `SE0NAK`"]
104 #[inline(always)]
105 pub fn is_se0nak(&self) -> bool {
106 *self == TSTCTL_A::SE0NAK
107 }
108 #[doc = "Checks if the value of the field is `PACKET`"]
109 #[inline(always)]
110 pub fn is_packet(&self) -> bool {
111 *self == TSTCTL_A::PACKET
112 }
113 #[doc = "Checks if the value of the field is `FORCE`"]
114 #[inline(always)]
115 pub fn is_force(&self) -> bool {
116 *self == TSTCTL_A::FORCE
117 }
118}
119#[doc = "Field `TSTCTL` writer - Test Control"]
120pub type TSTCTL_W<'a, const O: u8> = crate::FieldWriter<'a, u32, DCTL_SPEC, u8, TSTCTL_A, 3, O>;
121impl<'a, const O: u8> TSTCTL_W<'a, O> {
122 #[doc = "Test mode disabled."]
123 #[inline(always)]
124 pub fn disable(self) -> &'a mut W {
125 self.variant(TSTCTL_A::DISABLE)
126 }
127 #[doc = "Test_J mode."]
128 #[inline(always)]
129 pub fn j(self) -> &'a mut W {
130 self.variant(TSTCTL_A::J)
131 }
132 #[doc = "Test_K mode."]
133 #[inline(always)]
134 pub fn k(self) -> &'a mut W {
135 self.variant(TSTCTL_A::K)
136 }
137 #[doc = "Test_SE0_NAK mode."]
138 #[inline(always)]
139 pub fn se0nak(self) -> &'a mut W {
140 self.variant(TSTCTL_A::SE0NAK)
141 }
142 #[doc = "Test_Packet mode."]
143 #[inline(always)]
144 pub fn packet(self) -> &'a mut W {
145 self.variant(TSTCTL_A::PACKET)
146 }
147 #[doc = "Test_Force_Enable."]
148 #[inline(always)]
149 pub fn force(self) -> &'a mut W {
150 self.variant(TSTCTL_A::FORCE)
151 }
152}
153#[doc = "Field `SGNPINNAK` writer - Set Global Non-periodic IN NAK"]
154pub type SGNPINNAK_W<'a, const O: u8> = crate::BitWriter<'a, u32, DCTL_SPEC, bool, O>;
155#[doc = "Field `CGNPINNAK` writer - Clear Global Non-periodic IN NAK"]
156pub type CGNPINNAK_W<'a, const O: u8> = crate::BitWriter<'a, u32, DCTL_SPEC, bool, O>;
157#[doc = "Field `SGOUTNAK` writer - Set Global OUT NAK"]
158pub type SGOUTNAK_W<'a, const O: u8> = crate::BitWriter<'a, u32, DCTL_SPEC, bool, O>;
159#[doc = "Field `CGOUTNAK` writer - Clear Global OUT NAK"]
160pub type CGOUTNAK_W<'a, const O: u8> = crate::BitWriter<'a, u32, DCTL_SPEC, bool, O>;
161#[doc = "Field `PWRONPRGDONE` reader - Power-On Programming Done"]
162pub type PWRONPRGDONE_R = crate::BitReader<bool>;
163#[doc = "Field `PWRONPRGDONE` writer - Power-On Programming Done"]
164pub type PWRONPRGDONE_W<'a, const O: u8> = crate::BitWriter<'a, u32, DCTL_SPEC, bool, O>;
165#[doc = "Field `IGNRFRMNUM` reader - Ignore Frame number For Isochronous End points"]
166pub type IGNRFRMNUM_R = crate::BitReader<bool>;
167#[doc = "Field `IGNRFRMNUM` writer - Ignore Frame number For Isochronous End points"]
168pub type IGNRFRMNUM_W<'a, const O: u8> = crate::BitWriter<'a, u32, DCTL_SPEC, bool, O>;
169#[doc = "Field `NAKONBBLE` reader - NAK on Babble Error"]
170pub type NAKONBBLE_R = crate::BitReader<bool>;
171#[doc = "Field `NAKONBBLE` writer - NAK on Babble Error"]
172pub type NAKONBBLE_W<'a, const O: u8> = crate::BitWriter<'a, u32, DCTL_SPEC, bool, O>;
173impl R {
174 #[doc = "Bit 0 - Remote Wakeup Signaling"]
175 #[inline(always)]
176 pub fn rmtwkupsig(&self) -> RMTWKUPSIG_R {
177 RMTWKUPSIG_R::new((self.bits & 1) != 0)
178 }
179 #[doc = "Bit 1 - Soft Disconnect"]
180 #[inline(always)]
181 pub fn sftdiscon(&self) -> SFTDISCON_R {
182 SFTDISCON_R::new(((self.bits >> 1) & 1) != 0)
183 }
184 #[doc = "Bit 2 - Global Non-periodic IN NAK Status"]
185 #[inline(always)]
186 pub fn gnpinnaksts(&self) -> GNPINNAKSTS_R {
187 GNPINNAKSTS_R::new(((self.bits >> 2) & 1) != 0)
188 }
189 #[doc = "Bit 3 - Global OUT NAK Status"]
190 #[inline(always)]
191 pub fn goutnaksts(&self) -> GOUTNAKSTS_R {
192 GOUTNAKSTS_R::new(((self.bits >> 3) & 1) != 0)
193 }
194 #[doc = "Bits 4:6 - Test Control"]
195 #[inline(always)]
196 pub fn tstctl(&self) -> TSTCTL_R {
197 TSTCTL_R::new(((self.bits >> 4) & 7) as u8)
198 }
199 #[doc = "Bit 11 - Power-On Programming Done"]
200 #[inline(always)]
201 pub fn pwronprgdone(&self) -> PWRONPRGDONE_R {
202 PWRONPRGDONE_R::new(((self.bits >> 11) & 1) != 0)
203 }
204 #[doc = "Bit 15 - Ignore Frame number For Isochronous End points"]
205 #[inline(always)]
206 pub fn ignrfrmnum(&self) -> IGNRFRMNUM_R {
207 IGNRFRMNUM_R::new(((self.bits >> 15) & 1) != 0)
208 }
209 #[doc = "Bit 16 - NAK on Babble Error"]
210 #[inline(always)]
211 pub fn nakonbble(&self) -> NAKONBBLE_R {
212 NAKONBBLE_R::new(((self.bits >> 16) & 1) != 0)
213 }
214}
215impl W {
216 #[doc = "Bit 0 - Remote Wakeup Signaling"]
217 #[inline(always)]
218 #[must_use]
219 pub fn rmtwkupsig(&mut self) -> RMTWKUPSIG_W<0> {
220 RMTWKUPSIG_W::new(self)
221 }
222 #[doc = "Bit 1 - Soft Disconnect"]
223 #[inline(always)]
224 #[must_use]
225 pub fn sftdiscon(&mut self) -> SFTDISCON_W<1> {
226 SFTDISCON_W::new(self)
227 }
228 #[doc = "Bits 4:6 - Test Control"]
229 #[inline(always)]
230 #[must_use]
231 pub fn tstctl(&mut self) -> TSTCTL_W<4> {
232 TSTCTL_W::new(self)
233 }
234 #[doc = "Bit 7 - Set Global Non-periodic IN NAK"]
235 #[inline(always)]
236 #[must_use]
237 pub fn sgnpinnak(&mut self) -> SGNPINNAK_W<7> {
238 SGNPINNAK_W::new(self)
239 }
240 #[doc = "Bit 8 - Clear Global Non-periodic IN NAK"]
241 #[inline(always)]
242 #[must_use]
243 pub fn cgnpinnak(&mut self) -> CGNPINNAK_W<8> {
244 CGNPINNAK_W::new(self)
245 }
246 #[doc = "Bit 9 - Set Global OUT NAK"]
247 #[inline(always)]
248 #[must_use]
249 pub fn sgoutnak(&mut self) -> SGOUTNAK_W<9> {
250 SGOUTNAK_W::new(self)
251 }
252 #[doc = "Bit 10 - Clear Global OUT NAK"]
253 #[inline(always)]
254 #[must_use]
255 pub fn cgoutnak(&mut self) -> CGOUTNAK_W<10> {
256 CGOUTNAK_W::new(self)
257 }
258 #[doc = "Bit 11 - Power-On Programming Done"]
259 #[inline(always)]
260 #[must_use]
261 pub fn pwronprgdone(&mut self) -> PWRONPRGDONE_W<11> {
262 PWRONPRGDONE_W::new(self)
263 }
264 #[doc = "Bit 15 - Ignore Frame number For Isochronous End points"]
265 #[inline(always)]
266 #[must_use]
267 pub fn ignrfrmnum(&mut self) -> IGNRFRMNUM_W<15> {
268 IGNRFRMNUM_W::new(self)
269 }
270 #[doc = "Bit 16 - NAK on Babble Error"]
271 #[inline(always)]
272 #[must_use]
273 pub fn nakonbble(&mut self) -> NAKONBBLE_W<16> {
274 NAKONBBLE_W::new(self)
275 }
276 #[doc = "Writes raw bits to the register."]
277 #[inline(always)]
278 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
279 self.0.bits(bits);
280 self
281 }
282}
283#[doc = "Device Control 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 [dctl](index.html) module"]
284pub struct DCTL_SPEC;
285impl crate::RegisterSpec for DCTL_SPEC {
286 type Ux = u32;
287}
288#[doc = "`read()` method returns [dctl::R](R) reader structure"]
289impl crate::Readable for DCTL_SPEC {
290 type Reader = R;
291}
292#[doc = "`write(|w| ..)` method takes [dctl::W](W) writer structure"]
293impl crate::Writable for DCTL_SPEC {
294 type Writer = W;
295 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
296 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
297}
298#[doc = "`reset()` method sets DCTL to value 0"]
299impl crate::Resettable for DCTL_SPEC {
300 const RESET_VALUE: Self::Ux = 0;
301}