corstone300_pac/slowclk/
ctrl.rs

1// Copyright 2022 Arm Limited and/or its affiliates <open-source-office@arm.com>
2//
3// SPDX-License-Identifier: MIT
4
5#[doc = "Register `CTRL` reader"]
6pub struct R(crate::R<CTRL_SPEC>);
7impl core::ops::Deref for R {
8    type Target = crate::R<CTRL_SPEC>;
9    #[inline(always)]
10    fn deref(&self) -> &Self::Target {
11        &self.0
12    }
13}
14impl From<crate::R<CTRL_SPEC>> for R {
15    #[inline(always)]
16    fn from(reader: crate::R<CTRL_SPEC>) -> Self {
17        R(reader)
18    }
19}
20#[doc = "Register `CTRL` writer"]
21pub struct W(crate::W<CTRL_SPEC>);
22impl core::ops::Deref for W {
23    type Target = crate::W<CTRL_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<CTRL_SPEC>> for W {
36    #[inline(always)]
37    fn from(writer: crate::W<CTRL_SPEC>) -> Self {
38        W(writer)
39    }
40}
41#[doc = "Field `ENABLE` reader - Enable"]
42pub type ENABLE_R = crate::BitReader<ENABLE_A>;
43#[doc = "Enable\n\nValue on reset: 0"]
44#[derive(Clone, Copy, Debug, PartialEq, Eq)]
45pub enum ENABLE_A {
46    #[doc = "0: Timer is disabled"]
47    DISABLE = 0,
48    #[doc = "1: Timer is enabled"]
49    ENABLE = 1,
50}
51impl From<ENABLE_A> for bool {
52    #[inline(always)]
53    fn from(variant: ENABLE_A) -> Self {
54        variant as u8 != 0
55    }
56}
57impl ENABLE_R {
58    #[doc = "Get enumerated values variant"]
59    #[inline(always)]
60    pub fn variant(&self) -> ENABLE_A {
61        match self.bits {
62            false => ENABLE_A::DISABLE,
63            true => ENABLE_A::ENABLE,
64        }
65    }
66    #[doc = "Checks if the value of the field is `DISABLE`"]
67    #[inline(always)]
68    pub fn is_disable(&self) -> bool {
69        *self == ENABLE_A::DISABLE
70    }
71    #[doc = "Checks if the value of the field is `ENABLE`"]
72    #[inline(always)]
73    pub fn is_enable(&self) -> bool {
74        *self == ENABLE_A::ENABLE
75    }
76}
77#[doc = "Field `ENABLE` writer - Enable"]
78pub type ENABLE_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, ENABLE_A, O>;
79impl<'a, const O: u8> ENABLE_W<'a, O> {
80    #[doc = "Timer is disabled"]
81    #[inline(always)]
82    pub fn disable(self) -> &'a mut W {
83        self.variant(ENABLE_A::DISABLE)
84    }
85    #[doc = "Timer is enabled"]
86    #[inline(always)]
87    pub fn enable(self) -> &'a mut W {
88        self.variant(ENABLE_A::ENABLE)
89    }
90}
91#[doc = "Field `EXTIN` reader - External Input as Enable"]
92pub type EXTIN_R = crate::BitReader<EXTIN_A>;
93#[doc = "External Input as Enable\n\nValue on reset: 0"]
94#[derive(Clone, Copy, Debug, PartialEq, Eq)]
95pub enum EXTIN_A {
96    #[doc = "0: External Input as Enable is disabled"]
97    DISABLE = 0,
98    #[doc = "1: External Input as Enable is enabled"]
99    ENABLE = 1,
100}
101impl From<EXTIN_A> for bool {
102    #[inline(always)]
103    fn from(variant: EXTIN_A) -> Self {
104        variant as u8 != 0
105    }
106}
107impl EXTIN_R {
108    #[doc = "Get enumerated values variant"]
109    #[inline(always)]
110    pub fn variant(&self) -> EXTIN_A {
111        match self.bits {
112            false => EXTIN_A::DISABLE,
113            true => EXTIN_A::ENABLE,
114        }
115    }
116    #[doc = "Checks if the value of the field is `DISABLE`"]
117    #[inline(always)]
118    pub fn is_disable(&self) -> bool {
119        *self == EXTIN_A::DISABLE
120    }
121    #[doc = "Checks if the value of the field is `ENABLE`"]
122    #[inline(always)]
123    pub fn is_enable(&self) -> bool {
124        *self == EXTIN_A::ENABLE
125    }
126}
127#[doc = "Field `EXTIN` writer - External Input as Enable"]
128pub type EXTIN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, EXTIN_A, O>;
129impl<'a, const O: u8> EXTIN_W<'a, O> {
130    #[doc = "External Input as Enable is disabled"]
131    #[inline(always)]
132    pub fn disable(self) -> &'a mut W {
133        self.variant(EXTIN_A::DISABLE)
134    }
135    #[doc = "External Input as Enable is enabled"]
136    #[inline(always)]
137    pub fn enable(self) -> &'a mut W {
138        self.variant(EXTIN_A::ENABLE)
139    }
140}
141#[doc = "Field `EXTCLK` reader - External Clock Enable"]
142pub type EXTCLK_R = crate::BitReader<EXTCLK_A>;
143#[doc = "External Clock Enable\n\nValue on reset: 0"]
144#[derive(Clone, Copy, Debug, PartialEq, Eq)]
145pub enum EXTCLK_A {
146    #[doc = "0: External Clock is disabled"]
147    DISABLE = 0,
148    #[doc = "1: External Clock is enabled"]
149    ENABLE = 1,
150}
151impl From<EXTCLK_A> for bool {
152    #[inline(always)]
153    fn from(variant: EXTCLK_A) -> Self {
154        variant as u8 != 0
155    }
156}
157impl EXTCLK_R {
158    #[doc = "Get enumerated values variant"]
159    #[inline(always)]
160    pub fn variant(&self) -> EXTCLK_A {
161        match self.bits {
162            false => EXTCLK_A::DISABLE,
163            true => EXTCLK_A::ENABLE,
164        }
165    }
166    #[doc = "Checks if the value of the field is `DISABLE`"]
167    #[inline(always)]
168    pub fn is_disable(&self) -> bool {
169        *self == EXTCLK_A::DISABLE
170    }
171    #[doc = "Checks if the value of the field is `ENABLE`"]
172    #[inline(always)]
173    pub fn is_enable(&self) -> bool {
174        *self == EXTCLK_A::ENABLE
175    }
176}
177#[doc = "Field `EXTCLK` writer - External Clock Enable"]
178pub type EXTCLK_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, EXTCLK_A, O>;
179impl<'a, const O: u8> EXTCLK_W<'a, O> {
180    #[doc = "External Clock is disabled"]
181    #[inline(always)]
182    pub fn disable(self) -> &'a mut W {
183        self.variant(EXTCLK_A::DISABLE)
184    }
185    #[doc = "External Clock is enabled"]
186    #[inline(always)]
187    pub fn enable(self) -> &'a mut W {
188        self.variant(EXTCLK_A::ENABLE)
189    }
190}
191#[doc = "Field `INTEN` reader - Interrupt Enable"]
192pub type INTEN_R = crate::BitReader<INTEN_A>;
193#[doc = "Interrupt Enable\n\nValue on reset: 0"]
194#[derive(Clone, Copy, Debug, PartialEq, Eq)]
195pub enum INTEN_A {
196    #[doc = "0: Interrupt is disabled"]
197    DISABLE = 0,
198    #[doc = "1: Interrupt is enabled"]
199    ENABLE = 1,
200}
201impl From<INTEN_A> for bool {
202    #[inline(always)]
203    fn from(variant: INTEN_A) -> Self {
204        variant as u8 != 0
205    }
206}
207impl INTEN_R {
208    #[doc = "Get enumerated values variant"]
209    #[inline(always)]
210    pub fn variant(&self) -> INTEN_A {
211        match self.bits {
212            false => INTEN_A::DISABLE,
213            true => INTEN_A::ENABLE,
214        }
215    }
216    #[doc = "Checks if the value of the field is `DISABLE`"]
217    #[inline(always)]
218    pub fn is_disable(&self) -> bool {
219        *self == INTEN_A::DISABLE
220    }
221    #[doc = "Checks if the value of the field is `ENABLE`"]
222    #[inline(always)]
223    pub fn is_enable(&self) -> bool {
224        *self == INTEN_A::ENABLE
225    }
226}
227#[doc = "Field `INTEN` writer - Interrupt Enable"]
228pub type INTEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, INTEN_A, O>;
229impl<'a, const O: u8> INTEN_W<'a, O> {
230    #[doc = "Interrupt is disabled"]
231    #[inline(always)]
232    pub fn disable(self) -> &'a mut W {
233        self.variant(INTEN_A::DISABLE)
234    }
235    #[doc = "Interrupt is enabled"]
236    #[inline(always)]
237    pub fn enable(self) -> &'a mut W {
238        self.variant(INTEN_A::ENABLE)
239    }
240}
241impl R {
242    #[doc = "Bit 0 - Enable"]
243    #[inline(always)]
244    pub fn enable(&self) -> ENABLE_R {
245        ENABLE_R::new((self.bits & 1) != 0)
246    }
247    #[doc = "Bit 1 - External Input as Enable"]
248    #[inline(always)]
249    pub fn extin(&self) -> EXTIN_R {
250        EXTIN_R::new(((self.bits >> 1) & 1) != 0)
251    }
252    #[doc = "Bit 2 - External Clock Enable"]
253    #[inline(always)]
254    pub fn extclk(&self) -> EXTCLK_R {
255        EXTCLK_R::new(((self.bits >> 2) & 1) != 0)
256    }
257    #[doc = "Bit 3 - Interrupt Enable"]
258    #[inline(always)]
259    pub fn inten(&self) -> INTEN_R {
260        INTEN_R::new(((self.bits >> 3) & 1) != 0)
261    }
262}
263impl W {
264    #[doc = "Bit 0 - Enable"]
265    #[inline(always)]
266    pub fn enable(&mut self) -> ENABLE_W<0> {
267        ENABLE_W::new(self)
268    }
269    #[doc = "Bit 1 - External Input as Enable"]
270    #[inline(always)]
271    pub fn extin(&mut self) -> EXTIN_W<1> {
272        EXTIN_W::new(self)
273    }
274    #[doc = "Bit 2 - External Clock Enable"]
275    #[inline(always)]
276    pub fn extclk(&mut self) -> EXTCLK_W<2> {
277        EXTCLK_W::new(self)
278    }
279    #[doc = "Bit 3 - Interrupt Enable"]
280    #[inline(always)]
281    pub fn inten(&mut self) -> INTEN_W<3> {
282        INTEN_W::new(self)
283    }
284    #[doc = "Writes raw bits to the register."]
285    #[inline(always)]
286    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
287        self.0.bits(bits);
288        self
289    }
290}
291#[doc = "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 [ctrl](index.html) module"]
292pub struct CTRL_SPEC;
293impl crate::RegisterSpec for CTRL_SPEC {
294    type Ux = u32;
295}
296#[doc = "`read()` method returns [ctrl::R](R) reader structure"]
297impl crate::Readable for CTRL_SPEC {
298    type Reader = R;
299}
300#[doc = "`write(|w| ..)` method takes [ctrl::W](W) writer structure"]
301impl crate::Writable for CTRL_SPEC {
302    type Writer = W;
303}
304#[doc = "`reset()` method sets CTRL to value 0"]
305impl crate::Resettable for CTRL_SPEC {
306    #[inline(always)]
307    fn reset_value() -> Self::Ux {
308        0
309    }
310}