corstone300_pac/syscounter_cntrl/
cntid.rs1#[doc = "Register `CNTID` reader"]
6pub struct R(crate::R<CNTID_SPEC>);
7impl core::ops::Deref for R {
8 type Target = crate::R<CNTID_SPEC>;
9 #[inline(always)]
10 fn deref(&self) -> &Self::Target {
11 &self.0
12 }
13}
14impl From<crate::R<CNTID_SPEC>> for R {
15 #[inline(always)]
16 fn from(reader: crate::R<CNTID_SPEC>) -> Self {
17 R(reader)
18 }
19}
20#[doc = "Field `CNTSC` reader - Indicates whether Counter Scaling is implemented"]
21pub type CNTSC_R = crate::FieldReader<u8, CNTSC_A>;
22#[doc = "Indicates whether Counter Scaling is implemented\n\nValue on reset: 0"]
23#[derive(Clone, Copy, Debug, PartialEq, Eq)]
24#[repr(u8)]
25pub enum CNTSC_A {
26 #[doc = "0: Counter Scaling is not implemented"]
27 CNTSCNOTIMPLEMENTED = 0,
28 #[doc = "1: Counter Scaling is implemented"]
29 CNTSCIMPLEMENTED = 1,
30}
31impl From<CNTSC_A> for u8 {
32 #[inline(always)]
33 fn from(variant: CNTSC_A) -> Self {
34 variant as _
35 }
36}
37impl CNTSC_R {
38 #[doc = "Get enumerated values variant"]
39 #[inline(always)]
40 pub fn variant(&self) -> Option<CNTSC_A> {
41 match self.bits {
42 0 => Some(CNTSC_A::CNTSCNOTIMPLEMENTED),
43 1 => Some(CNTSC_A::CNTSCIMPLEMENTED),
44 _ => None,
45 }
46 }
47 #[doc = "Checks if the value of the field is `CNTSCNOTIMPLEMENTED`"]
48 #[inline(always)]
49 pub fn is_cntscnotimplemented(&self) -> bool {
50 *self == CNTSC_A::CNTSCNOTIMPLEMENTED
51 }
52 #[doc = "Checks if the value of the field is `CNTSCIMPLEMENTED`"]
53 #[inline(always)]
54 pub fn is_cntscimplemented(&self) -> bool {
55 *self == CNTSC_A::CNTSCIMPLEMENTED
56 }
57}
58#[doc = "Field `CNTCS` reader - Indicates whether Clock Switching is implemented"]
59pub type CNTCS_R = crate::BitReader<CNTCS_A>;
60#[doc = "Indicates whether Clock Switching is implemented\n\nValue on reset: 0"]
61#[derive(Clone, Copy, Debug, PartialEq, Eq)]
62pub enum CNTCS_A {
63 #[doc = "0: HW-based Counter Clock Switching is not implemented"]
64 CNTCSNOTIMPLEMENTED = 0,
65 #[doc = "1: HW-based Counter Clock Switching is implemented"]
66 CNTCSIMPLEMENTED = 1,
67}
68impl From<CNTCS_A> for bool {
69 #[inline(always)]
70 fn from(variant: CNTCS_A) -> Self {
71 variant as u8 != 0
72 }
73}
74impl CNTCS_R {
75 #[doc = "Get enumerated values variant"]
76 #[inline(always)]
77 pub fn variant(&self) -> CNTCS_A {
78 match self.bits {
79 false => CNTCS_A::CNTCSNOTIMPLEMENTED,
80 true => CNTCS_A::CNTCSIMPLEMENTED,
81 }
82 }
83 #[doc = "Checks if the value of the field is `CNTCSNOTIMPLEMENTED`"]
84 #[inline(always)]
85 pub fn is_cntcsnotimplemented(&self) -> bool {
86 *self == CNTCS_A::CNTCSNOTIMPLEMENTED
87 }
88 #[doc = "Checks if the value of the field is `CNTCSIMPLEMENTED`"]
89 #[inline(always)]
90 pub fn is_cntcsimplemented(&self) -> bool {
91 *self == CNTCS_A::CNTCSIMPLEMENTED
92 }
93}
94#[doc = "Field `CNTSELCLK` reader - Indicates the clock source that the Counter is using"]
95pub type CNTSELCLK_R = crate::FieldReader<u8, CNTSELCLK_A>;
96#[doc = "Indicates the clock source that the Counter is using\n\nValue on reset: 0"]
97#[derive(Clone, Copy, Debug, PartialEq, Eq)]
98#[repr(u8)]
99pub enum CNTSELCLK_A {
100 #[doc = "0: Invalid status, Counter not incrementing"]
101 INVALID0 = 0,
102 #[doc = "1: CLK0 (REFCLK)"]
103 CLK0 = 1,
104 #[doc = "2: CLK1 (FASTCLK)"]
105 CLK1 = 2,
106 #[doc = "3: Invalid status, Counter not incrementing"]
107 INVALID1 = 3,
108}
109impl From<CNTSELCLK_A> for u8 {
110 #[inline(always)]
111 fn from(variant: CNTSELCLK_A) -> Self {
112 variant as _
113 }
114}
115impl CNTSELCLK_R {
116 #[doc = "Get enumerated values variant"]
117 #[inline(always)]
118 pub fn variant(&self) -> CNTSELCLK_A {
119 match self.bits {
120 0 => CNTSELCLK_A::INVALID0,
121 1 => CNTSELCLK_A::CLK0,
122 2 => CNTSELCLK_A::CLK1,
123 3 => CNTSELCLK_A::INVALID1,
124 _ => unreachable!(),
125 }
126 }
127 #[doc = "Checks if the value of the field is `INVALID0`"]
128 #[inline(always)]
129 pub fn is_invalid0(&self) -> bool {
130 *self == CNTSELCLK_A::INVALID0
131 }
132 #[doc = "Checks if the value of the field is `CLK0`"]
133 #[inline(always)]
134 pub fn is_clk0(&self) -> bool {
135 *self == CNTSELCLK_A::CLK0
136 }
137 #[doc = "Checks if the value of the field is `CLK1`"]
138 #[inline(always)]
139 pub fn is_clk1(&self) -> bool {
140 *self == CNTSELCLK_A::CLK1
141 }
142 #[doc = "Checks if the value of the field is `INVALID1`"]
143 #[inline(always)]
144 pub fn is_invalid1(&self) -> bool {
145 *self == CNTSELCLK_A::INVALID1
146 }
147}
148#[doc = "Field `CNTSCR_OVR` reader - Override counter enable condition for writing to CNTSCR* registers"]
149pub type CNTSCR_OVR_R = crate::BitReader<CNTSCR_OVR_A>;
150#[doc = "Override counter enable condition for writing to CNTSCR* registers\n\nValue on reset: 0"]
151#[derive(Clone, Copy, Debug, PartialEq, Eq)]
152pub enum CNTSCR_OVR_A {
153 #[doc = "0: CNTSCR* can be written only when CNTCR.EN=0"]
154 COND1 = 0,
155 #[doc = "1: CNTSCR* can be written when CNTCR.EN=0 or 1"]
156 COND2 = 1,
157}
158impl From<CNTSCR_OVR_A> for bool {
159 #[inline(always)]
160 fn from(variant: CNTSCR_OVR_A) -> Self {
161 variant as u8 != 0
162 }
163}
164impl CNTSCR_OVR_R {
165 #[doc = "Get enumerated values variant"]
166 #[inline(always)]
167 pub fn variant(&self) -> CNTSCR_OVR_A {
168 match self.bits {
169 false => CNTSCR_OVR_A::COND1,
170 true => CNTSCR_OVR_A::COND2,
171 }
172 }
173 #[doc = "Checks if the value of the field is `COND1`"]
174 #[inline(always)]
175 pub fn is_cond1(&self) -> bool {
176 *self == CNTSCR_OVR_A::COND1
177 }
178 #[doc = "Checks if the value of the field is `COND2`"]
179 #[inline(always)]
180 pub fn is_cond2(&self) -> bool {
181 *self == CNTSCR_OVR_A::COND2
182 }
183}
184impl R {
185 #[doc = "Bits 0:3 - Indicates whether Counter Scaling is implemented"]
186 #[inline(always)]
187 pub fn cntsc(&self) -> CNTSC_R {
188 CNTSC_R::new((self.bits & 0x0f) as u8)
189 }
190 #[doc = "Bit 16 - Indicates whether Clock Switching is implemented"]
191 #[inline(always)]
192 pub fn cntcs(&self) -> CNTCS_R {
193 CNTCS_R::new(((self.bits >> 16) & 1) != 0)
194 }
195 #[doc = "Bits 17:18 - Indicates the clock source that the Counter is using"]
196 #[inline(always)]
197 pub fn cntselclk(&self) -> CNTSELCLK_R {
198 CNTSELCLK_R::new(((self.bits >> 17) & 3) as u8)
199 }
200 #[doc = "Bit 19 - Override counter enable condition for writing to CNTSCR* registers"]
201 #[inline(always)]
202 pub fn cntscr_ovr(&self) -> CNTSCR_OVR_R {
203 CNTSCR_OVR_R::new(((self.bits >> 19) & 1) != 0)
204 }
205}
206#[doc = "Indicates additional information about Counter Scaling implementation\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [cntid](index.html) module"]
207pub struct CNTID_SPEC;
208impl crate::RegisterSpec for CNTID_SPEC {
209 type Ux = u32;
210}
211#[doc = "`read()` method returns [cntid::R](R) reader structure"]
212impl crate::Readable for CNTID_SPEC {
213 type Reader = R;
214}
215#[doc = "`reset()` method sets CNTID to value 0"]
216impl crate::Resettable for CNTID_SPEC {
217 #[inline(always)]
218 fn reset_value() -> Self::Ux {
219 0
220 }
221}