corstone300_pac/syscounter_cntrl/
cntcr.rs1#[doc = "Register `CNTCR` reader"]
6pub struct R(crate::R<CNTCR_SPEC>);
7impl core::ops::Deref for R {
8 type Target = crate::R<CNTCR_SPEC>;
9 #[inline(always)]
10 fn deref(&self) -> &Self::Target {
11 &self.0
12 }
13}
14impl From<crate::R<CNTCR_SPEC>> for R {
15 #[inline(always)]
16 fn from(reader: crate::R<CNTCR_SPEC>) -> Self {
17 R(reader)
18 }
19}
20#[doc = "Register `CNTCR` writer"]
21pub struct W(crate::W<CNTCR_SPEC>);
22impl core::ops::Deref for W {
23 type Target = crate::W<CNTCR_SPEC>;
24 #[inline(always)]
25 fn deref(&self) -> &Self::Target {
26 &self.0
27 }
28}
29impl core::ops::DerefMut for W {
30 #[inline(always)]
31 fn deref_mut(&mut self) -> &mut Self::Target {
32 &mut self.0
33 }
34}
35impl From<crate::W<CNTCR_SPEC>> for W {
36 #[inline(always)]
37 fn from(writer: crate::W<CNTCR_SPEC>) -> Self {
38 W(writer)
39 }
40}
41#[doc = "Field `EN` reader - Enable Counter"]
42pub type EN_R = crate::BitReader<EN_A>;
43#[doc = "Enable Counter\n\nValue on reset: 0"]
44#[derive(Clone, Copy, Debug, PartialEq, Eq)]
45pub enum EN_A {
46 #[doc = "0: Count is not incrementing"]
47 DISABLED = 0,
48 #[doc = "1: Count is incrementing"]
49 ENABLED = 1,
50}
51impl From<EN_A> for bool {
52 #[inline(always)]
53 fn from(variant: EN_A) -> Self {
54 variant as u8 != 0
55 }
56}
57impl EN_R {
58 #[doc = "Get enumerated values variant"]
59 #[inline(always)]
60 pub fn variant(&self) -> EN_A {
61 match self.bits {
62 false => EN_A::DISABLED,
63 true => EN_A::ENABLED,
64 }
65 }
66 #[doc = "Checks if the value of the field is `DISABLED`"]
67 #[inline(always)]
68 pub fn is_disabled(&self) -> bool {
69 *self == EN_A::DISABLED
70 }
71 #[doc = "Checks if the value of the field is `ENABLED`"]
72 #[inline(always)]
73 pub fn is_enabled(&self) -> bool {
74 *self == EN_A::ENABLED
75 }
76}
77#[doc = "Field `EN` writer - Enable Counter"]
78pub type EN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CNTCR_SPEC, EN_A, O>;
79impl<'a, const O: u8> EN_W<'a, O> {
80 #[doc = "Count is not incrementing"]
81 #[inline(always)]
82 pub fn disabled(self) -> &'a mut W {
83 self.variant(EN_A::DISABLED)
84 }
85 #[doc = "Count is incrementing"]
86 #[inline(always)]
87 pub fn enabled(self) -> &'a mut W {
88 self.variant(EN_A::ENABLED)
89 }
90}
91#[doc = "Field `HDBG` reader - Halt on debug"]
92pub type HDBG_R = crate::BitReader<HDBG_A>;
93#[doc = "Halt on debug\n\nValue on reset: 0"]
94#[derive(Clone, Copy, Debug, PartialEq, Eq)]
95pub enum HDBG_A {
96 #[doc = "0: HALTREQ signal into the Counter has no effect"]
97 NOHALT = 0,
98 #[doc = "1: HALTREQ signal into the Counter halts the Count"]
99 HALT = 1,
100}
101impl From<HDBG_A> for bool {
102 #[inline(always)]
103 fn from(variant: HDBG_A) -> Self {
104 variant as u8 != 0
105 }
106}
107impl HDBG_R {
108 #[doc = "Get enumerated values variant"]
109 #[inline(always)]
110 pub fn variant(&self) -> HDBG_A {
111 match self.bits {
112 false => HDBG_A::NOHALT,
113 true => HDBG_A::HALT,
114 }
115 }
116 #[doc = "Checks if the value of the field is `NOHALT`"]
117 #[inline(always)]
118 pub fn is_nohalt(&self) -> bool {
119 *self == HDBG_A::NOHALT
120 }
121 #[doc = "Checks if the value of the field is `HALT`"]
122 #[inline(always)]
123 pub fn is_halt(&self) -> bool {
124 *self == HDBG_A::HALT
125 }
126}
127#[doc = "Field `HDBG` writer - Halt on debug"]
128pub type HDBG_W<'a, const O: u8> = crate::BitWriter<'a, u32, CNTCR_SPEC, HDBG_A, O>;
129impl<'a, const O: u8> HDBG_W<'a, O> {
130 #[doc = "HALTREQ signal into the Counter has no effect"]
131 #[inline(always)]
132 pub fn nohalt(self) -> &'a mut W {
133 self.variant(HDBG_A::NOHALT)
134 }
135 #[doc = "HALTREQ signal into the Counter halts the Count"]
136 #[inline(always)]
137 pub fn halt(self) -> &'a mut W {
138 self.variant(HDBG_A::HALT)
139 }
140}
141#[doc = "Field `SCEN` reader - Scale enable"]
142pub type SCEN_R = crate::BitReader<SCEN_A>;
143#[doc = "Scale enable\n\nValue on reset: 0"]
144#[derive(Clone, Copy, Debug, PartialEq, Eq)]
145pub enum SCEN_A {
146 #[doc = "0: Scaling is not enabled"]
147 SCALE_DISABLED = 0,
148 #[doc = "1: Scaling is enabled"]
149 SCALE_ENABLED = 1,
150}
151impl From<SCEN_A> for bool {
152 #[inline(always)]
153 fn from(variant: SCEN_A) -> Self {
154 variant as u8 != 0
155 }
156}
157impl SCEN_R {
158 #[doc = "Get enumerated values variant"]
159 #[inline(always)]
160 pub fn variant(&self) -> SCEN_A {
161 match self.bits {
162 false => SCEN_A::SCALE_DISABLED,
163 true => SCEN_A::SCALE_ENABLED,
164 }
165 }
166 #[doc = "Checks if the value of the field is `SCALE_DISABLED`"]
167 #[inline(always)]
168 pub fn is_scale_disabled(&self) -> bool {
169 *self == SCEN_A::SCALE_DISABLED
170 }
171 #[doc = "Checks if the value of the field is `SCALE_ENABLED`"]
172 #[inline(always)]
173 pub fn is_scale_enabled(&self) -> bool {
174 *self == SCEN_A::SCALE_ENABLED
175 }
176}
177#[doc = "Field `SCEN` writer - Scale enable"]
178pub type SCEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CNTCR_SPEC, SCEN_A, O>;
179impl<'a, const O: u8> SCEN_W<'a, O> {
180 #[doc = "Scaling is not enabled"]
181 #[inline(always)]
182 pub fn scale_disabled(self) -> &'a mut W {
183 self.variant(SCEN_A::SCALE_DISABLED)
184 }
185 #[doc = "Scaling is enabled"]
186 #[inline(always)]
187 pub fn scale_enabled(self) -> &'a mut W {
188 self.variant(SCEN_A::SCALE_ENABLED)
189 }
190}
191#[doc = "Field `INTRMASK` reader - Interrupt mask"]
192pub type INTRMASK_R = crate::BitReader<INTRMASK_A>;
193#[doc = "Interrupt mask\n\nValue on reset: 0"]
194#[derive(Clone, Copy, Debug, PartialEq, Eq)]
195pub enum INTRMASK_A {
196 #[doc = "0: Interrupt output disabled"]
197 INTERRUPT_DISABLED = 0,
198 #[doc = "1: Interrupt output enabled"]
199 INTERRUPT_ENABLED = 1,
200}
201impl From<INTRMASK_A> for bool {
202 #[inline(always)]
203 fn from(variant: INTRMASK_A) -> Self {
204 variant as u8 != 0
205 }
206}
207impl INTRMASK_R {
208 #[doc = "Get enumerated values variant"]
209 #[inline(always)]
210 pub fn variant(&self) -> INTRMASK_A {
211 match self.bits {
212 false => INTRMASK_A::INTERRUPT_DISABLED,
213 true => INTRMASK_A::INTERRUPT_ENABLED,
214 }
215 }
216 #[doc = "Checks if the value of the field is `INTERRUPT_DISABLED`"]
217 #[inline(always)]
218 pub fn is_interrupt_disabled(&self) -> bool {
219 *self == INTRMASK_A::INTERRUPT_DISABLED
220 }
221 #[doc = "Checks if the value of the field is `INTERRUPT_ENABLED`"]
222 #[inline(always)]
223 pub fn is_interrupt_enabled(&self) -> bool {
224 *self == INTRMASK_A::INTERRUPT_ENABLED
225 }
226}
227#[doc = "Field `INTRMASK` writer - Interrupt mask"]
228pub type INTRMASK_W<'a, const O: u8> = crate::BitWriter<'a, u32, CNTCR_SPEC, INTRMASK_A, O>;
229impl<'a, const O: u8> INTRMASK_W<'a, O> {
230 #[doc = "Interrupt output disabled"]
231 #[inline(always)]
232 pub fn interrupt_disabled(self) -> &'a mut W {
233 self.variant(INTRMASK_A::INTERRUPT_DISABLED)
234 }
235 #[doc = "Interrupt output enabled"]
236 #[inline(always)]
237 pub fn interrupt_enabled(self) -> &'a mut W {
238 self.variant(INTRMASK_A::INTERRUPT_ENABLED)
239 }
240}
241#[doc = "Field `PSLVERRDIS` reader - PSLVERR output disable"]
242pub type PSLVERRDIS_R = crate::BitReader<PSLVERRDIS_A>;
243#[doc = "PSLVERR output disable\n\nValue on reset: 0"]
244#[derive(Clone, Copy, Debug, PartialEq, Eq)]
245pub enum PSLVERRDIS_A {
246 #[doc = "0: PSLVERR is permanently driven to 0"]
247 PSLVERRDISABLED = 0,
248 #[doc = "1: PSLVERR output that the System Counter generates dynamically"]
249 PSLVERRENABLED = 1,
250}
251impl From<PSLVERRDIS_A> for bool {
252 #[inline(always)]
253 fn from(variant: PSLVERRDIS_A) -> Self {
254 variant as u8 != 0
255 }
256}
257impl PSLVERRDIS_R {
258 #[doc = "Get enumerated values variant"]
259 #[inline(always)]
260 pub fn variant(&self) -> PSLVERRDIS_A {
261 match self.bits {
262 false => PSLVERRDIS_A::PSLVERRDISABLED,
263 true => PSLVERRDIS_A::PSLVERRENABLED,
264 }
265 }
266 #[doc = "Checks if the value of the field is `PSLVERRDISABLED`"]
267 #[inline(always)]
268 pub fn is_pslverrdisabled(&self) -> bool {
269 *self == PSLVERRDIS_A::PSLVERRDISABLED
270 }
271 #[doc = "Checks if the value of the field is `PSLVERRENABLED`"]
272 #[inline(always)]
273 pub fn is_pslverrenabled(&self) -> bool {
274 *self == PSLVERRDIS_A::PSLVERRENABLED
275 }
276}
277#[doc = "Field `PSLVERRDIS` writer - PSLVERR output disable"]
278pub type PSLVERRDIS_W<'a, const O: u8> = crate::BitWriter<'a, u32, CNTCR_SPEC, PSLVERRDIS_A, O>;
279impl<'a, const O: u8> PSLVERRDIS_W<'a, O> {
280 #[doc = "PSLVERR is permanently driven to 0"]
281 #[inline(always)]
282 pub fn pslverrdisabled(self) -> &'a mut W {
283 self.variant(PSLVERRDIS_A::PSLVERRDISABLED)
284 }
285 #[doc = "PSLVERR output that the System Counter generates dynamically"]
286 #[inline(always)]
287 pub fn pslverrenabled(self) -> &'a mut W {
288 self.variant(PSLVERRDIS_A::PSLVERRENABLED)
289 }
290}
291#[doc = "Field `INTRCLR` reader - Interrupt clear bit, only writes of 0 are permitted, and writes of 1 are ignored."]
292pub type INTRCLR_R = crate::BitReader<bool>;
293#[doc = "Field `INTRCLR` writer - Interrupt clear bit, only writes of 0 are permitted, and writes of 1 are ignored."]
294pub type INTRCLR_W<'a, const O: u8> = crate::BitWriter<'a, u32, CNTCR_SPEC, bool, O>;
295impl R {
296 #[doc = "Bit 0 - Enable Counter"]
297 #[inline(always)]
298 pub fn en(&self) -> EN_R {
299 EN_R::new((self.bits & 1) != 0)
300 }
301 #[doc = "Bit 1 - Halt on debug"]
302 #[inline(always)]
303 pub fn hdbg(&self) -> HDBG_R {
304 HDBG_R::new(((self.bits >> 1) & 1) != 0)
305 }
306 #[doc = "Bit 2 - Scale enable"]
307 #[inline(always)]
308 pub fn scen(&self) -> SCEN_R {
309 SCEN_R::new(((self.bits >> 2) & 1) != 0)
310 }
311 #[doc = "Bit 3 - Interrupt mask"]
312 #[inline(always)]
313 pub fn intrmask(&self) -> INTRMASK_R {
314 INTRMASK_R::new(((self.bits >> 3) & 1) != 0)
315 }
316 #[doc = "Bit 4 - PSLVERR output disable"]
317 #[inline(always)]
318 pub fn pslverrdis(&self) -> PSLVERRDIS_R {
319 PSLVERRDIS_R::new(((self.bits >> 4) & 1) != 0)
320 }
321 #[doc = "Bit 5 - Interrupt clear bit, only writes of 0 are permitted, and writes of 1 are ignored."]
322 #[inline(always)]
323 pub fn intrclr(&self) -> INTRCLR_R {
324 INTRCLR_R::new(((self.bits >> 5) & 1) != 0)
325 }
326}
327impl W {
328 #[doc = "Bit 0 - Enable Counter"]
329 #[inline(always)]
330 pub fn en(&mut self) -> EN_W<0> {
331 EN_W::new(self)
332 }
333 #[doc = "Bit 1 - Halt on debug"]
334 #[inline(always)]
335 pub fn hdbg(&mut self) -> HDBG_W<1> {
336 HDBG_W::new(self)
337 }
338 #[doc = "Bit 2 - Scale enable"]
339 #[inline(always)]
340 pub fn scen(&mut self) -> SCEN_W<2> {
341 SCEN_W::new(self)
342 }
343 #[doc = "Bit 3 - Interrupt mask"]
344 #[inline(always)]
345 pub fn intrmask(&mut self) -> INTRMASK_W<3> {
346 INTRMASK_W::new(self)
347 }
348 #[doc = "Bit 4 - PSLVERR output disable"]
349 #[inline(always)]
350 pub fn pslverrdis(&mut self) -> PSLVERRDIS_W<4> {
351 PSLVERRDIS_W::new(self)
352 }
353 #[doc = "Bit 5 - Interrupt clear bit, only writes of 0 are permitted, and writes of 1 are ignored."]
354 #[inline(always)]
355 pub fn intrclr(&mut self) -> INTRCLR_W<5> {
356 INTRCLR_W::new(self)
357 }
358 #[doc = "Writes raw bits to the register."]
359 #[inline(always)]
360 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
361 self.0.bits(bits);
362 self
363 }
364}
365#[doc = "Counter 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 [cntcr](index.html) module"]
366pub struct CNTCR_SPEC;
367impl crate::RegisterSpec for CNTCR_SPEC {
368 type Ux = u32;
369}
370#[doc = "`read()` method returns [cntcr::R](R) reader structure"]
371impl crate::Readable for CNTCR_SPEC {
372 type Reader = R;
373}
374#[doc = "`write(|w| ..)` method takes [cntcr::W](W) writer structure"]
375impl crate::Writable for CNTCR_SPEC {
376 type Writer = W;
377}
378#[doc = "`reset()` method sets CNTCR to value 0"]
379impl crate::Resettable for CNTCR_SPEC {
380 #[inline(always)]
381 fn reset_value() -> Self::Ux {
382 0
383 }
384}