1#[doc = "Register `PL1CTRL1` reader"]
2pub struct R(crate::R<PL1CTRL1_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<PL1CTRL1_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<PL1CTRL1_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<PL1CTRL1_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `PL1CTRL1` writer"]
17pub struct W(crate::W<PL1CTRL1_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<PL1CTRL1_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<PL1CTRL1_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<PL1CTRL1_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `L1RESPEN` reader - L1 Response Enable"]
38pub type L1RESPEN_R = crate::BitReader<L1RESPEN_A>;
39#[doc = "L1 Response Enable\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub enum L1RESPEN_A {
42 #[doc = "0: LPM is not supported."]
43 _0 = 0,
44 #[doc = "1: LPM is supported."]
45 _1 = 1,
46}
47impl From<L1RESPEN_A> for bool {
48 #[inline(always)]
49 fn from(variant: L1RESPEN_A) -> Self {
50 variant as u8 != 0
51 }
52}
53impl L1RESPEN_R {
54 #[doc = "Get enumerated values variant"]
55 #[inline(always)]
56 pub fn variant(&self) -> L1RESPEN_A {
57 match self.bits {
58 false => L1RESPEN_A::_0,
59 true => L1RESPEN_A::_1,
60 }
61 }
62 #[doc = "Checks if the value of the field is `_0`"]
63 #[inline(always)]
64 pub fn is_0(&self) -> bool {
65 *self == L1RESPEN_A::_0
66 }
67 #[doc = "Checks if the value of the field is `_1`"]
68 #[inline(always)]
69 pub fn is_1(&self) -> bool {
70 *self == L1RESPEN_A::_1
71 }
72}
73#[doc = "Field `L1RESPEN` writer - L1 Response Enable"]
74pub type L1RESPEN_W<'a, const O: u8> = crate::BitWriter<'a, u16, PL1CTRL1_SPEC, L1RESPEN_A, O>;
75impl<'a, const O: u8> L1RESPEN_W<'a, O> {
76 #[doc = "LPM is not supported."]
77 #[inline(always)]
78 pub fn _0(self) -> &'a mut W {
79 self.variant(L1RESPEN_A::_0)
80 }
81 #[doc = "LPM is supported."]
82 #[inline(always)]
83 pub fn _1(self) -> &'a mut W {
84 self.variant(L1RESPEN_A::_1)
85 }
86}
87#[doc = "Field `L1RESPMD` reader - L1 Response Mode"]
88pub type L1RESPMD_R = crate::FieldReader<u8, L1RESPMD_A>;
89#[doc = "L1 Response Mode\n\nValue on reset: 0"]
90#[derive(Clone, Copy, Debug, PartialEq, Eq)]
91#[repr(u8)]
92pub enum L1RESPMD_A {
93 #[doc = "0: NYET"]
94 _00 = 0,
95 #[doc = "1: ACK"]
96 _01 = 1,
97 #[doc = "2: STALL"]
98 _10 = 2,
99 #[doc = "3: According to the L1NEGOMD bit"]
100 _11 = 3,
101}
102impl From<L1RESPMD_A> for u8 {
103 #[inline(always)]
104 fn from(variant: L1RESPMD_A) -> Self {
105 variant as _
106 }
107}
108impl L1RESPMD_R {
109 #[doc = "Get enumerated values variant"]
110 #[inline(always)]
111 pub fn variant(&self) -> L1RESPMD_A {
112 match self.bits {
113 0 => L1RESPMD_A::_00,
114 1 => L1RESPMD_A::_01,
115 2 => L1RESPMD_A::_10,
116 3 => L1RESPMD_A::_11,
117 _ => unreachable!(),
118 }
119 }
120 #[doc = "Checks if the value of the field is `_00`"]
121 #[inline(always)]
122 pub fn is_00(&self) -> bool {
123 *self == L1RESPMD_A::_00
124 }
125 #[doc = "Checks if the value of the field is `_01`"]
126 #[inline(always)]
127 pub fn is_01(&self) -> bool {
128 *self == L1RESPMD_A::_01
129 }
130 #[doc = "Checks if the value of the field is `_10`"]
131 #[inline(always)]
132 pub fn is_10(&self) -> bool {
133 *self == L1RESPMD_A::_10
134 }
135 #[doc = "Checks if the value of the field is `_11`"]
136 #[inline(always)]
137 pub fn is_11(&self) -> bool {
138 *self == L1RESPMD_A::_11
139 }
140}
141#[doc = "Field `L1RESPMD` writer - L1 Response Mode"]
142pub type L1RESPMD_W<'a, const O: u8> =
143 crate::FieldWriterSafe<'a, u16, PL1CTRL1_SPEC, u8, L1RESPMD_A, 2, O>;
144impl<'a, const O: u8> L1RESPMD_W<'a, O> {
145 #[doc = "NYET"]
146 #[inline(always)]
147 pub fn _00(self) -> &'a mut W {
148 self.variant(L1RESPMD_A::_00)
149 }
150 #[doc = "ACK"]
151 #[inline(always)]
152 pub fn _01(self) -> &'a mut W {
153 self.variant(L1RESPMD_A::_01)
154 }
155 #[doc = "STALL"]
156 #[inline(always)]
157 pub fn _10(self) -> &'a mut W {
158 self.variant(L1RESPMD_A::_10)
159 }
160 #[doc = "According to the L1NEGOMD bit"]
161 #[inline(always)]
162 pub fn _11(self) -> &'a mut W {
163 self.variant(L1RESPMD_A::_11)
164 }
165}
166#[doc = "Field `L1NEGOMD` reader - L1 Response Negotiation Control.NOTE: This bit is valid only when the L1RESPMD\\[1:0\\]
167value is 2'b11."]
168pub type L1NEGOMD_R = crate::BitReader<L1NEGOMD_A>;
169#[doc = "L1 Response Negotiation Control.NOTE: This bit is valid only when the L1RESPMD\\[1:0\\]
170value is 2'b11.\n\nValue on reset: 0"]
171#[derive(Clone, Copy, Debug, PartialEq, Eq)]
172pub enum L1NEGOMD_A {
173 #[doc = "0: When receive HIRD is larger than HIRDTHR\\[3:0\\], ACK response is returned. In other cases (including HIRD = HIRDTHR\\[3:0\\]), NYET response is returned."]
174 _0 = 0,
175 #[doc = "1: When receive HIRD is smaller than HIRDTHR\\[3:0\\], ACK response is returned. In other cases (including HIRD = HIRDTHR\\[3:0\\]), NYET response is returned."]
176 _1 = 1,
177}
178impl From<L1NEGOMD_A> for bool {
179 #[inline(always)]
180 fn from(variant: L1NEGOMD_A) -> Self {
181 variant as u8 != 0
182 }
183}
184impl L1NEGOMD_R {
185 #[doc = "Get enumerated values variant"]
186 #[inline(always)]
187 pub fn variant(&self) -> L1NEGOMD_A {
188 match self.bits {
189 false => L1NEGOMD_A::_0,
190 true => L1NEGOMD_A::_1,
191 }
192 }
193 #[doc = "Checks if the value of the field is `_0`"]
194 #[inline(always)]
195 pub fn is_0(&self) -> bool {
196 *self == L1NEGOMD_A::_0
197 }
198 #[doc = "Checks if the value of the field is `_1`"]
199 #[inline(always)]
200 pub fn is_1(&self) -> bool {
201 *self == L1NEGOMD_A::_1
202 }
203}
204#[doc = "Field `L1NEGOMD` writer - L1 Response Negotiation Control.NOTE: This bit is valid only when the L1RESPMD\\[1:0\\]
205value is 2'b11."]
206pub type L1NEGOMD_W<'a, const O: u8> = crate::BitWriter<'a, u16, PL1CTRL1_SPEC, L1NEGOMD_A, O>;
207impl<'a, const O: u8> L1NEGOMD_W<'a, O> {
208 #[doc = "When receive HIRD is larger than HIRDTHR\\[3:0\\], ACK response is returned. In other cases (including HIRD = HIRDTHR\\[3:0\\]), NYET response is returned."]
209 #[inline(always)]
210 pub fn _0(self) -> &'a mut W {
211 self.variant(L1NEGOMD_A::_0)
212 }
213 #[doc = "When receive HIRD is smaller than HIRDTHR\\[3:0\\], ACK response is returned. In other cases (including HIRD = HIRDTHR\\[3:0\\]), NYET response is returned."]
214 #[inline(always)]
215 pub fn _1(self) -> &'a mut W {
216 self.variant(L1NEGOMD_A::_1)
217 }
218}
219#[doc = "Field `DVSQ` reader - DVSQ Extension.DVSQ\\[3\\]
220is Mirror of DVSQ\\[2:0\\]
221in INTSTS0.Indicates the L1 state together with the device state bits DVSQ\\[2:0\\]."]
222pub type DVSQ_R = crate::FieldReader<u8, DVSQ_A>;
223#[doc = "DVSQ Extension.DVSQ\\[3\\]
224is Mirror of DVSQ\\[2:0\\]
225in INTSTS0.Indicates the L1 state together with the device state bits DVSQ\\[2:0\\].\n\nValue on reset: 0"]
226#[derive(Clone, Copy, Debug, PartialEq, Eq)]
227#[repr(u8)]
228pub enum DVSQ_A {
229 #[doc = "0: Powered state"]
230 _0000 = 0,
231 #[doc = "1: Default state"]
232 _0001 = 1,
233 #[doc = "2: Address state"]
234 _0010 = 2,
235 #[doc = "3: Configured state"]
236 _0011 = 3,
237 #[doc = "4: Suspended state"]
238 _0100 = 4,
239 #[doc = "5: Suspended state"]
240 _0101 = 5,
241 #[doc = "6: Suspended state"]
242 _0110 = 6,
243 #[doc = "7: Suspended state"]
244 _0111 = 7,
245 #[doc = "8: L1 state"]
246 _1000 = 8,
247 #[doc = "9: L1 state"]
248 _1001 = 9,
249 #[doc = "10: L1 state"]
250 _1010 = 10,
251 #[doc = "11: L1 state"]
252 _1011 = 11,
253}
254impl From<DVSQ_A> for u8 {
255 #[inline(always)]
256 fn from(variant: DVSQ_A) -> Self {
257 variant as _
258 }
259}
260impl DVSQ_R {
261 #[doc = "Get enumerated values variant"]
262 #[inline(always)]
263 pub fn variant(&self) -> Option<DVSQ_A> {
264 match self.bits {
265 0 => Some(DVSQ_A::_0000),
266 1 => Some(DVSQ_A::_0001),
267 2 => Some(DVSQ_A::_0010),
268 3 => Some(DVSQ_A::_0011),
269 4 => Some(DVSQ_A::_0100),
270 5 => Some(DVSQ_A::_0101),
271 6 => Some(DVSQ_A::_0110),
272 7 => Some(DVSQ_A::_0111),
273 8 => Some(DVSQ_A::_1000),
274 9 => Some(DVSQ_A::_1001),
275 10 => Some(DVSQ_A::_1010),
276 11 => Some(DVSQ_A::_1011),
277 _ => None,
278 }
279 }
280 #[doc = "Checks if the value of the field is `_0000`"]
281 #[inline(always)]
282 pub fn is_0000(&self) -> bool {
283 *self == DVSQ_A::_0000
284 }
285 #[doc = "Checks if the value of the field is `_0001`"]
286 #[inline(always)]
287 pub fn is_0001(&self) -> bool {
288 *self == DVSQ_A::_0001
289 }
290 #[doc = "Checks if the value of the field is `_0010`"]
291 #[inline(always)]
292 pub fn is_0010(&self) -> bool {
293 *self == DVSQ_A::_0010
294 }
295 #[doc = "Checks if the value of the field is `_0011`"]
296 #[inline(always)]
297 pub fn is_0011(&self) -> bool {
298 *self == DVSQ_A::_0011
299 }
300 #[doc = "Checks if the value of the field is `_0100`"]
301 #[inline(always)]
302 pub fn is_0100(&self) -> bool {
303 *self == DVSQ_A::_0100
304 }
305 #[doc = "Checks if the value of the field is `_0101`"]
306 #[inline(always)]
307 pub fn is_0101(&self) -> bool {
308 *self == DVSQ_A::_0101
309 }
310 #[doc = "Checks if the value of the field is `_0110`"]
311 #[inline(always)]
312 pub fn is_0110(&self) -> bool {
313 *self == DVSQ_A::_0110
314 }
315 #[doc = "Checks if the value of the field is `_0111`"]
316 #[inline(always)]
317 pub fn is_0111(&self) -> bool {
318 *self == DVSQ_A::_0111
319 }
320 #[doc = "Checks if the value of the field is `_1000`"]
321 #[inline(always)]
322 pub fn is_1000(&self) -> bool {
323 *self == DVSQ_A::_1000
324 }
325 #[doc = "Checks if the value of the field is `_1001`"]
326 #[inline(always)]
327 pub fn is_1001(&self) -> bool {
328 *self == DVSQ_A::_1001
329 }
330 #[doc = "Checks if the value of the field is `_1010`"]
331 #[inline(always)]
332 pub fn is_1010(&self) -> bool {
333 *self == DVSQ_A::_1010
334 }
335 #[doc = "Checks if the value of the field is `_1011`"]
336 #[inline(always)]
337 pub fn is_1011(&self) -> bool {
338 *self == DVSQ_A::_1011
339 }
340}
341#[doc = "Field `HIRDTHR` reader - L1 Response Negotiation Threshold ValueHIRD threshold value used for L1NEGOMD.The format is the same as the HIRD field in HL1CTRL."]
342pub type HIRDTHR_R = crate::FieldReader<u8, u8>;
343#[doc = "Field `HIRDTHR` writer - L1 Response Negotiation Threshold ValueHIRD threshold value used for L1NEGOMD.The format is the same as the HIRD field in HL1CTRL."]
344pub type HIRDTHR_W<'a, const O: u8> = crate::FieldWriter<'a, u16, PL1CTRL1_SPEC, u8, u8, 4, O>;
345#[doc = "Field `L1EXTMD` reader - PHY Control Mode at L1 Return"]
346pub type L1EXTMD_R = crate::BitReader<L1EXTMD_A>;
347#[doc = "PHY Control Mode at L1 Return\n\nValue on reset: 0"]
348#[derive(Clone, Copy, Debug, PartialEq, Eq)]
349pub enum L1EXTMD_A {
350 #[doc = "0: SUSPENDM is not set by hardware when Host K is received."]
351 _0 = 0,
352 #[doc = "1: SUSPENDM is set by hardware when Host K is received."]
353 _1 = 1,
354}
355impl From<L1EXTMD_A> for bool {
356 #[inline(always)]
357 fn from(variant: L1EXTMD_A) -> Self {
358 variant as u8 != 0
359 }
360}
361impl L1EXTMD_R {
362 #[doc = "Get enumerated values variant"]
363 #[inline(always)]
364 pub fn variant(&self) -> L1EXTMD_A {
365 match self.bits {
366 false => L1EXTMD_A::_0,
367 true => L1EXTMD_A::_1,
368 }
369 }
370 #[doc = "Checks if the value of the field is `_0`"]
371 #[inline(always)]
372 pub fn is_0(&self) -> bool {
373 *self == L1EXTMD_A::_0
374 }
375 #[doc = "Checks if the value of the field is `_1`"]
376 #[inline(always)]
377 pub fn is_1(&self) -> bool {
378 *self == L1EXTMD_A::_1
379 }
380}
381#[doc = "Field `L1EXTMD` writer - PHY Control Mode at L1 Return"]
382pub type L1EXTMD_W<'a, const O: u8> = crate::BitWriter<'a, u16, PL1CTRL1_SPEC, L1EXTMD_A, O>;
383impl<'a, const O: u8> L1EXTMD_W<'a, O> {
384 #[doc = "SUSPENDM is not set by hardware when Host K is received."]
385 #[inline(always)]
386 pub fn _0(self) -> &'a mut W {
387 self.variant(L1EXTMD_A::_0)
388 }
389 #[doc = "SUSPENDM is set by hardware when Host K is received."]
390 #[inline(always)]
391 pub fn _1(self) -> &'a mut W {
392 self.variant(L1EXTMD_A::_1)
393 }
394}
395impl R {
396 #[doc = "Bit 0 - L1 Response Enable"]
397 #[inline(always)]
398 pub fn l1respen(&self) -> L1RESPEN_R {
399 L1RESPEN_R::new((self.bits & 1) != 0)
400 }
401 #[doc = "Bits 1:2 - L1 Response Mode"]
402 #[inline(always)]
403 pub fn l1respmd(&self) -> L1RESPMD_R {
404 L1RESPMD_R::new(((self.bits >> 1) & 3) as u8)
405 }
406 #[doc = "Bit 3 - L1 Response Negotiation Control.NOTE: This bit is valid only when the L1RESPMD\\[1:0\\]
407value is 2'b11."]
408 #[inline(always)]
409 pub fn l1negomd(&self) -> L1NEGOMD_R {
410 L1NEGOMD_R::new(((self.bits >> 3) & 1) != 0)
411 }
412 #[doc = "Bits 4:7 - DVSQ Extension.DVSQ\\[3\\]
413is Mirror of DVSQ\\[2:0\\]
414in INTSTS0.Indicates the L1 state together with the device state bits DVSQ\\[2:0\\]."]
415 #[inline(always)]
416 pub fn dvsq(&self) -> DVSQ_R {
417 DVSQ_R::new(((self.bits >> 4) & 0x0f) as u8)
418 }
419 #[doc = "Bits 8:11 - L1 Response Negotiation Threshold ValueHIRD threshold value used for L1NEGOMD.The format is the same as the HIRD field in HL1CTRL."]
420 #[inline(always)]
421 pub fn hirdthr(&self) -> HIRDTHR_R {
422 HIRDTHR_R::new(((self.bits >> 8) & 0x0f) as u8)
423 }
424 #[doc = "Bit 14 - PHY Control Mode at L1 Return"]
425 #[inline(always)]
426 pub fn l1extmd(&self) -> L1EXTMD_R {
427 L1EXTMD_R::new(((self.bits >> 14) & 1) != 0)
428 }
429}
430impl W {
431 #[doc = "Bit 0 - L1 Response Enable"]
432 #[inline(always)]
433 #[must_use]
434 pub fn l1respen(&mut self) -> L1RESPEN_W<0> {
435 L1RESPEN_W::new(self)
436 }
437 #[doc = "Bits 1:2 - L1 Response Mode"]
438 #[inline(always)]
439 #[must_use]
440 pub fn l1respmd(&mut self) -> L1RESPMD_W<1> {
441 L1RESPMD_W::new(self)
442 }
443 #[doc = "Bit 3 - L1 Response Negotiation Control.NOTE: This bit is valid only when the L1RESPMD\\[1:0\\]
444value is 2'b11."]
445 #[inline(always)]
446 #[must_use]
447 pub fn l1negomd(&mut self) -> L1NEGOMD_W<3> {
448 L1NEGOMD_W::new(self)
449 }
450 #[doc = "Bits 8:11 - L1 Response Negotiation Threshold ValueHIRD threshold value used for L1NEGOMD.The format is the same as the HIRD field in HL1CTRL."]
451 #[inline(always)]
452 #[must_use]
453 pub fn hirdthr(&mut self) -> HIRDTHR_W<8> {
454 HIRDTHR_W::new(self)
455 }
456 #[doc = "Bit 14 - PHY Control Mode at L1 Return"]
457 #[inline(always)]
458 #[must_use]
459 pub fn l1extmd(&mut self) -> L1EXTMD_W<14> {
460 L1EXTMD_W::new(self)
461 }
462 #[doc = "Writes raw bits to the register."]
463 #[inline(always)]
464 pub unsafe fn bits(&mut self, bits: u16) -> &mut Self {
465 self.0.bits(bits);
466 self
467 }
468}
469#[doc = "Function L1 Control Register 1\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 [pl1ctrl1](index.html) module"]
470pub struct PL1CTRL1_SPEC;
471impl crate::RegisterSpec for PL1CTRL1_SPEC {
472 type Ux = u16;
473}
474#[doc = "`read()` method returns [pl1ctrl1::R](R) reader structure"]
475impl crate::Readable for PL1CTRL1_SPEC {
476 type Reader = R;
477}
478#[doc = "`write(|w| ..)` method takes [pl1ctrl1::W](W) writer structure"]
479impl crate::Writable for PL1CTRL1_SPEC {
480 type Writer = W;
481 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
482 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
483}
484#[doc = "`reset()` method sets PL1CTRL1 to value 0"]
485impl crate::Resettable for PL1CTRL1_SPEC {
486 const RESET_VALUE: Self::Ux = 0;
487}