mk66f18/usbhs/
hcsparams.rs1#[doc = "Reader of register HCSPARAMS"]
2pub type R = crate::R<u32, super::HCSPARAMS>;
3#[doc = "Reader of field `N_PORTS`"]
4pub type N_PORTS_R = crate::R<u8, u8>;
5#[doc = "Power Port Control\n\nValue on reset: 1"]
6#[derive(Clone, Copy, Debug, PartialEq)]
7pub enum PPC_A {
8 #[doc = "1: Ports have power port switches"]
9 _1,
10}
11impl From<PPC_A> for bool {
12 #[inline(always)]
13 fn from(variant: PPC_A) -> Self {
14 match variant {
15 PPC_A::_1 => true,
16 }
17 }
18}
19#[doc = "Reader of field `PPC`"]
20pub type PPC_R = crate::R<bool, PPC_A>;
21impl PPC_R {
22 #[doc = r"Get enumerated values variant"]
23 #[inline(always)]
24 pub fn variant(&self) -> crate::Variant<bool, PPC_A> {
25 use crate::Variant::*;
26 match self.bits {
27 true => Val(PPC_A::_1),
28 i => Res(i),
29 }
30 }
31 #[doc = "Checks if the value of the field is `_1`"]
32 #[inline(always)]
33 pub fn is_1(&self) -> bool {
34 *self == PPC_A::_1
35 }
36}
37#[doc = "Reader of field `N_PCC`"]
38pub type N_PCC_R = crate::R<u8, u8>;
39#[doc = "Reader of field `N_CC`"]
40pub type N_CC_R = crate::R<u8, u8>;
41#[doc = "Port Indicators\n\nValue on reset: 1"]
42#[derive(Clone, Copy, Debug, PartialEq)]
43pub enum PI_A {
44 #[doc = "0: No port indicator fields"]
45 _0,
46 #[doc = "1: The port status and control registers include a R/W field for controlling the state of the port indicator"]
47 _1,
48}
49impl From<PI_A> for bool {
50 #[inline(always)]
51 fn from(variant: PI_A) -> Self {
52 match variant {
53 PI_A::_0 => false,
54 PI_A::_1 => true,
55 }
56 }
57}
58#[doc = "Reader of field `PI`"]
59pub type PI_R = crate::R<bool, PI_A>;
60impl PI_R {
61 #[doc = r"Get enumerated values variant"]
62 #[inline(always)]
63 pub fn variant(&self) -> PI_A {
64 match self.bits {
65 false => PI_A::_0,
66 true => PI_A::_1,
67 }
68 }
69 #[doc = "Checks if the value of the field is `_0`"]
70 #[inline(always)]
71 pub fn is_0(&self) -> bool {
72 *self == PI_A::_0
73 }
74 #[doc = "Checks if the value of the field is `_1`"]
75 #[inline(always)]
76 pub fn is_1(&self) -> bool {
77 *self == PI_A::_1
78 }
79}
80#[doc = "Reader of field `N_PTT`"]
81pub type N_PTT_R = crate::R<u8, u8>;
82#[doc = "Reader of field `N_TT`"]
83pub type N_TT_R = crate::R<u8, u8>;
84impl R {
85 #[doc = "Bits 0:3 - Number of Ports"]
86 #[inline(always)]
87 pub fn n_ports(&self) -> N_PORTS_R {
88 N_PORTS_R::new((self.bits & 0x0f) as u8)
89 }
90 #[doc = "Bit 4 - Power Port Control"]
91 #[inline(always)]
92 pub fn ppc(&self) -> PPC_R {
93 PPC_R::new(((self.bits >> 4) & 0x01) != 0)
94 }
95 #[doc = "Bits 8:11 - Number Ports per CC"]
96 #[inline(always)]
97 pub fn n_pcc(&self) -> N_PCC_R {
98 N_PCC_R::new(((self.bits >> 8) & 0x0f) as u8)
99 }
100 #[doc = "Bits 12:15 - Number of Companion Controllers"]
101 #[inline(always)]
102 pub fn n_cc(&self) -> N_CC_R {
103 N_CC_R::new(((self.bits >> 12) & 0x0f) as u8)
104 }
105 #[doc = "Bit 16 - Port Indicators"]
106 #[inline(always)]
107 pub fn pi(&self) -> PI_R {
108 PI_R::new(((self.bits >> 16) & 0x01) != 0)
109 }
110 #[doc = "Bits 20:23 - Ports per Transaction Translator"]
111 #[inline(always)]
112 pub fn n_ptt(&self) -> N_PTT_R {
113 N_PTT_R::new(((self.bits >> 20) & 0x0f) as u8)
114 }
115 #[doc = "Bits 24:27 - Number of Transaction Translators."]
116 #[inline(always)]
117 pub fn n_tt(&self) -> N_TT_R {
118 N_TT_R::new(((self.bits >> 24) & 0x0f) as u8)
119 }
120}