corstone300_pac/uart0/
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 `TXEN` reader - TX Enable"]
42pub type TXEN_R = crate::BitReader<TXEN_A>;
43#[doc = "TX Enable\n\nValue on reset: 0"]
44#[derive(Clone, Copy, Debug, PartialEq, Eq)]
45pub enum TXEN_A {
46    #[doc = "0: Disabled"]
47    DISABLE = 0,
48    #[doc = "1: Enabled"]
49    ENABLE = 1,
50}
51impl From<TXEN_A> for bool {
52    #[inline(always)]
53    fn from(variant: TXEN_A) -> Self {
54        variant as u8 != 0
55    }
56}
57impl TXEN_R {
58    #[doc = "Get enumerated values variant"]
59    #[inline(always)]
60    pub fn variant(&self) -> TXEN_A {
61        match self.bits {
62            false => TXEN_A::DISABLE,
63            true => TXEN_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 == TXEN_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 == TXEN_A::ENABLE
75    }
76}
77#[doc = "Field `TXEN` writer - TX Enable"]
78pub type TXEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, TXEN_A, O>;
79impl<'a, const O: u8> TXEN_W<'a, O> {
80    #[doc = "Disabled"]
81    #[inline(always)]
82    pub fn disable(self) -> &'a mut W {
83        self.variant(TXEN_A::DISABLE)
84    }
85    #[doc = "Enabled"]
86    #[inline(always)]
87    pub fn enable(self) -> &'a mut W {
88        self.variant(TXEN_A::ENABLE)
89    }
90}
91#[doc = "Field `RXEN` reader - RX Enable"]
92pub type RXEN_R = crate::BitReader<RXEN_A>;
93#[doc = "RX Enable\n\nValue on reset: 0"]
94#[derive(Clone, Copy, Debug, PartialEq, Eq)]
95pub enum RXEN_A {
96    #[doc = "0: Disabled"]
97    DISABLE = 0,
98    #[doc = "1: Enabled"]
99    ENABLE = 1,
100}
101impl From<RXEN_A> for bool {
102    #[inline(always)]
103    fn from(variant: RXEN_A) -> Self {
104        variant as u8 != 0
105    }
106}
107impl RXEN_R {
108    #[doc = "Get enumerated values variant"]
109    #[inline(always)]
110    pub fn variant(&self) -> RXEN_A {
111        match self.bits {
112            false => RXEN_A::DISABLE,
113            true => RXEN_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 == RXEN_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 == RXEN_A::ENABLE
125    }
126}
127#[doc = "Field `RXEN` writer - RX Enable"]
128pub type RXEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, RXEN_A, O>;
129impl<'a, const O: u8> RXEN_W<'a, O> {
130    #[doc = "Disabled"]
131    #[inline(always)]
132    pub fn disable(self) -> &'a mut W {
133        self.variant(RXEN_A::DISABLE)
134    }
135    #[doc = "Enabled"]
136    #[inline(always)]
137    pub fn enable(self) -> &'a mut W {
138        self.variant(RXEN_A::ENABLE)
139    }
140}
141#[doc = "Field `TXINT` reader - TX Interrupt Enable"]
142pub type TXINT_R = crate::BitReader<TXINT_A>;
143#[doc = "TX Interrupt Enable\n\nValue on reset: 0"]
144#[derive(Clone, Copy, Debug, PartialEq, Eq)]
145pub enum TXINT_A {
146    #[doc = "0: Disabled"]
147    DISABLE = 0,
148    #[doc = "1: Enabled"]
149    ENABLE = 1,
150}
151impl From<TXINT_A> for bool {
152    #[inline(always)]
153    fn from(variant: TXINT_A) -> Self {
154        variant as u8 != 0
155    }
156}
157impl TXINT_R {
158    #[doc = "Get enumerated values variant"]
159    #[inline(always)]
160    pub fn variant(&self) -> TXINT_A {
161        match self.bits {
162            false => TXINT_A::DISABLE,
163            true => TXINT_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 == TXINT_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 == TXINT_A::ENABLE
175    }
176}
177#[doc = "Field `TXINT` writer - TX Interrupt Enable"]
178pub type TXINT_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, TXINT_A, O>;
179impl<'a, const O: u8> TXINT_W<'a, O> {
180    #[doc = "Disabled"]
181    #[inline(always)]
182    pub fn disable(self) -> &'a mut W {
183        self.variant(TXINT_A::DISABLE)
184    }
185    #[doc = "Enabled"]
186    #[inline(always)]
187    pub fn enable(self) -> &'a mut W {
188        self.variant(TXINT_A::ENABLE)
189    }
190}
191#[doc = "Field `RXINT` reader - RX Interrupt Enable"]
192pub type RXINT_R = crate::BitReader<RXINT_A>;
193#[doc = "RX Interrupt Enable\n\nValue on reset: 0"]
194#[derive(Clone, Copy, Debug, PartialEq, Eq)]
195pub enum RXINT_A {
196    #[doc = "0: Disabled"]
197    DISABLE = 0,
198    #[doc = "1: Enabled"]
199    ENABLE = 1,
200}
201impl From<RXINT_A> for bool {
202    #[inline(always)]
203    fn from(variant: RXINT_A) -> Self {
204        variant as u8 != 0
205    }
206}
207impl RXINT_R {
208    #[doc = "Get enumerated values variant"]
209    #[inline(always)]
210    pub fn variant(&self) -> RXINT_A {
211        match self.bits {
212            false => RXINT_A::DISABLE,
213            true => RXINT_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 == RXINT_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 == RXINT_A::ENABLE
225    }
226}
227#[doc = "Field `RXINT` writer - RX Interrupt Enable"]
228pub type RXINT_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, RXINT_A, O>;
229impl<'a, const O: u8> RXINT_W<'a, O> {
230    #[doc = "Disabled"]
231    #[inline(always)]
232    pub fn disable(self) -> &'a mut W {
233        self.variant(RXINT_A::DISABLE)
234    }
235    #[doc = "Enabled"]
236    #[inline(always)]
237    pub fn enable(self) -> &'a mut W {
238        self.variant(RXINT_A::ENABLE)
239    }
240}
241#[doc = "Field `TXOVINT` reader - TX Overrun Interrupt Enable"]
242pub type TXOVINT_R = crate::BitReader<TXOVINT_A>;
243#[doc = "TX Overrun Interrupt Enable\n\nValue on reset: 0"]
244#[derive(Clone, Copy, Debug, PartialEq, Eq)]
245pub enum TXOVINT_A {
246    #[doc = "0: Disabled"]
247    DISABLE = 0,
248    #[doc = "1: Enabled"]
249    ENABLE = 1,
250}
251impl From<TXOVINT_A> for bool {
252    #[inline(always)]
253    fn from(variant: TXOVINT_A) -> Self {
254        variant as u8 != 0
255    }
256}
257impl TXOVINT_R {
258    #[doc = "Get enumerated values variant"]
259    #[inline(always)]
260    pub fn variant(&self) -> TXOVINT_A {
261        match self.bits {
262            false => TXOVINT_A::DISABLE,
263            true => TXOVINT_A::ENABLE,
264        }
265    }
266    #[doc = "Checks if the value of the field is `DISABLE`"]
267    #[inline(always)]
268    pub fn is_disable(&self) -> bool {
269        *self == TXOVINT_A::DISABLE
270    }
271    #[doc = "Checks if the value of the field is `ENABLE`"]
272    #[inline(always)]
273    pub fn is_enable(&self) -> bool {
274        *self == TXOVINT_A::ENABLE
275    }
276}
277#[doc = "Field `TXOVINT` writer - TX Overrun Interrupt Enable"]
278pub type TXOVINT_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, TXOVINT_A, O>;
279impl<'a, const O: u8> TXOVINT_W<'a, O> {
280    #[doc = "Disabled"]
281    #[inline(always)]
282    pub fn disable(self) -> &'a mut W {
283        self.variant(TXOVINT_A::DISABLE)
284    }
285    #[doc = "Enabled"]
286    #[inline(always)]
287    pub fn enable(self) -> &'a mut W {
288        self.variant(TXOVINT_A::ENABLE)
289    }
290}
291#[doc = "Field `RVOVINT` reader - RX Overrun Interrupt Enable"]
292pub type RVOVINT_R = crate::BitReader<RVOVINT_A>;
293#[doc = "RX Overrun Interrupt Enable\n\nValue on reset: 0"]
294#[derive(Clone, Copy, Debug, PartialEq, Eq)]
295pub enum RVOVINT_A {
296    #[doc = "0: Disabled"]
297    DISABLE = 0,
298    #[doc = "1: Enabled"]
299    ENABLE = 1,
300}
301impl From<RVOVINT_A> for bool {
302    #[inline(always)]
303    fn from(variant: RVOVINT_A) -> Self {
304        variant as u8 != 0
305    }
306}
307impl RVOVINT_R {
308    #[doc = "Get enumerated values variant"]
309    #[inline(always)]
310    pub fn variant(&self) -> RVOVINT_A {
311        match self.bits {
312            false => RVOVINT_A::DISABLE,
313            true => RVOVINT_A::ENABLE,
314        }
315    }
316    #[doc = "Checks if the value of the field is `DISABLE`"]
317    #[inline(always)]
318    pub fn is_disable(&self) -> bool {
319        *self == RVOVINT_A::DISABLE
320    }
321    #[doc = "Checks if the value of the field is `ENABLE`"]
322    #[inline(always)]
323    pub fn is_enable(&self) -> bool {
324        *self == RVOVINT_A::ENABLE
325    }
326}
327#[doc = "Field `RVOVINT` writer - RX Overrun Interrupt Enable"]
328pub type RVOVINT_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, RVOVINT_A, O>;
329impl<'a, const O: u8> RVOVINT_W<'a, O> {
330    #[doc = "Disabled"]
331    #[inline(always)]
332    pub fn disable(self) -> &'a mut W {
333        self.variant(RVOVINT_A::DISABLE)
334    }
335    #[doc = "Enabled"]
336    #[inline(always)]
337    pub fn enable(self) -> &'a mut W {
338        self.variant(RVOVINT_A::ENABLE)
339    }
340}
341#[doc = "Field `HSTX` reader - High Speed Test Mode for TX only"]
342pub type HSTX_R = crate::BitReader<HSTX_A>;
343#[doc = "High Speed Test Mode for TX only\n\nValue on reset: 0"]
344#[derive(Clone, Copy, Debug, PartialEq, Eq)]
345pub enum HSTX_A {
346    #[doc = "0: Disabled"]
347    DISABLE = 0,
348    #[doc = "1: Enabled"]
349    ENABLE = 1,
350}
351impl From<HSTX_A> for bool {
352    #[inline(always)]
353    fn from(variant: HSTX_A) -> Self {
354        variant as u8 != 0
355    }
356}
357impl HSTX_R {
358    #[doc = "Get enumerated values variant"]
359    #[inline(always)]
360    pub fn variant(&self) -> HSTX_A {
361        match self.bits {
362            false => HSTX_A::DISABLE,
363            true => HSTX_A::ENABLE,
364        }
365    }
366    #[doc = "Checks if the value of the field is `DISABLE`"]
367    #[inline(always)]
368    pub fn is_disable(&self) -> bool {
369        *self == HSTX_A::DISABLE
370    }
371    #[doc = "Checks if the value of the field is `ENABLE`"]
372    #[inline(always)]
373    pub fn is_enable(&self) -> bool {
374        *self == HSTX_A::ENABLE
375    }
376}
377#[doc = "Field `HSTX` writer - High Speed Test Mode for TX only"]
378pub type HSTX_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, HSTX_A, O>;
379impl<'a, const O: u8> HSTX_W<'a, O> {
380    #[doc = "Disabled"]
381    #[inline(always)]
382    pub fn disable(self) -> &'a mut W {
383        self.variant(HSTX_A::DISABLE)
384    }
385    #[doc = "Enabled"]
386    #[inline(always)]
387    pub fn enable(self) -> &'a mut W {
388        self.variant(HSTX_A::ENABLE)
389    }
390}
391impl R {
392    #[doc = "Bit 0 - TX Enable"]
393    #[inline(always)]
394    pub fn txen(&self) -> TXEN_R {
395        TXEN_R::new((self.bits & 1) != 0)
396    }
397    #[doc = "Bit 1 - RX Enable"]
398    #[inline(always)]
399    pub fn rxen(&self) -> RXEN_R {
400        RXEN_R::new(((self.bits >> 1) & 1) != 0)
401    }
402    #[doc = "Bit 2 - TX Interrupt Enable"]
403    #[inline(always)]
404    pub fn txint(&self) -> TXINT_R {
405        TXINT_R::new(((self.bits >> 2) & 1) != 0)
406    }
407    #[doc = "Bit 3 - RX Interrupt Enable"]
408    #[inline(always)]
409    pub fn rxint(&self) -> RXINT_R {
410        RXINT_R::new(((self.bits >> 3) & 1) != 0)
411    }
412    #[doc = "Bit 4 - TX Overrun Interrupt Enable"]
413    #[inline(always)]
414    pub fn txovint(&self) -> TXOVINT_R {
415        TXOVINT_R::new(((self.bits >> 4) & 1) != 0)
416    }
417    #[doc = "Bit 5 - RX Overrun Interrupt Enable"]
418    #[inline(always)]
419    pub fn rvovint(&self) -> RVOVINT_R {
420        RVOVINT_R::new(((self.bits >> 5) & 1) != 0)
421    }
422    #[doc = "Bit 6 - High Speed Test Mode for TX only"]
423    #[inline(always)]
424    pub fn hstx(&self) -> HSTX_R {
425        HSTX_R::new(((self.bits >> 6) & 1) != 0)
426    }
427}
428impl W {
429    #[doc = "Bit 0 - TX Enable"]
430    #[inline(always)]
431    pub fn txen(&mut self) -> TXEN_W<0> {
432        TXEN_W::new(self)
433    }
434    #[doc = "Bit 1 - RX Enable"]
435    #[inline(always)]
436    pub fn rxen(&mut self) -> RXEN_W<1> {
437        RXEN_W::new(self)
438    }
439    #[doc = "Bit 2 - TX Interrupt Enable"]
440    #[inline(always)]
441    pub fn txint(&mut self) -> TXINT_W<2> {
442        TXINT_W::new(self)
443    }
444    #[doc = "Bit 3 - RX Interrupt Enable"]
445    #[inline(always)]
446    pub fn rxint(&mut self) -> RXINT_W<3> {
447        RXINT_W::new(self)
448    }
449    #[doc = "Bit 4 - TX Overrun Interrupt Enable"]
450    #[inline(always)]
451    pub fn txovint(&mut self) -> TXOVINT_W<4> {
452        TXOVINT_W::new(self)
453    }
454    #[doc = "Bit 5 - RX Overrun Interrupt Enable"]
455    #[inline(always)]
456    pub fn rvovint(&mut self) -> RVOVINT_W<5> {
457        RVOVINT_W::new(self)
458    }
459    #[doc = "Bit 6 - High Speed Test Mode for TX only"]
460    #[inline(always)]
461    pub fn hstx(&mut self) -> HSTX_W<6> {
462        HSTX_W::new(self)
463    }
464    #[doc = "Writes raw bits to the register."]
465    #[inline(always)]
466    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
467        self.0.bits(bits);
468        self
469    }
470}
471#[doc = "UART 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"]
472pub struct CTRL_SPEC;
473impl crate::RegisterSpec for CTRL_SPEC {
474    type Ux = u32;
475}
476#[doc = "`read()` method returns [ctrl::R](R) reader structure"]
477impl crate::Readable for CTRL_SPEC {
478    type Reader = R;
479}
480#[doc = "`write(|w| ..)` method takes [ctrl::W](W) writer structure"]
481impl crate::Writable for CTRL_SPEC {
482    type Writer = W;
483}
484#[doc = "`reset()` method sets CTRL to value 0"]
485impl crate::Resettable for CTRL_SPEC {
486    #[inline(always)]
487    fn reset_value() -> Self::Ux {
488        0
489    }
490}