corstone300_pac/uart0/
state.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 `STATE` reader"]
6pub struct R(crate::R<STATE_SPEC>);
7impl core::ops::Deref for R {
8    type Target = crate::R<STATE_SPEC>;
9    #[inline(always)]
10    fn deref(&self) -> &Self::Target {
11        &self.0
12    }
13}
14impl From<crate::R<STATE_SPEC>> for R {
15    #[inline(always)]
16    fn from(reader: crate::R<STATE_SPEC>) -> Self {
17        R(reader)
18    }
19}
20#[doc = "Register `STATE` writer"]
21pub struct W(crate::W<STATE_SPEC>);
22impl core::ops::Deref for W {
23    type Target = crate::W<STATE_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<STATE_SPEC>> for W {
36    #[inline(always)]
37    fn from(writer: crate::W<STATE_SPEC>) -> Self {
38        W(writer)
39    }
40}
41#[doc = "Field `TXBF` reader - TX Buffer Full"]
42pub type TXBF_R = crate::BitReader<bool>;
43#[doc = "Field `RXBF` reader - RX Buffer Full"]
44pub type RXBF_R = crate::BitReader<bool>;
45#[doc = "Field `TXOV` reader - TX Buffer Overun (write 1 to clear)"]
46pub type TXOV_R = crate::BitReader<bool>;
47#[doc = "Field `TXOV` writer - TX Buffer Overun (write 1 to clear)"]
48pub type TXOV_W<'a, const O: u8> = crate::BitWriter1C<'a, u32, STATE_SPEC, bool, O>;
49#[doc = "Field `RXOV` reader - RX Buffer Overun (write 1 to clear)"]
50pub type RXOV_R = crate::BitReader<bool>;
51#[doc = "Field `RXOV` writer - RX Buffer Overun (write 1 to clear)"]
52pub type RXOV_W<'a, const O: u8> = crate::BitWriter1C<'a, u32, STATE_SPEC, bool, O>;
53impl R {
54    #[doc = "Bit 0 - TX Buffer Full"]
55    #[inline(always)]
56    pub fn txbf(&self) -> TXBF_R {
57        TXBF_R::new((self.bits & 1) != 0)
58    }
59    #[doc = "Bit 1 - RX Buffer Full"]
60    #[inline(always)]
61    pub fn rxbf(&self) -> RXBF_R {
62        RXBF_R::new(((self.bits >> 1) & 1) != 0)
63    }
64    #[doc = "Bit 2 - TX Buffer Overun (write 1 to clear)"]
65    #[inline(always)]
66    pub fn txov(&self) -> TXOV_R {
67        TXOV_R::new(((self.bits >> 2) & 1) != 0)
68    }
69    #[doc = "Bit 3 - RX Buffer Overun (write 1 to clear)"]
70    #[inline(always)]
71    pub fn rxov(&self) -> RXOV_R {
72        RXOV_R::new(((self.bits >> 3) & 1) != 0)
73    }
74}
75impl W {
76    #[doc = "Bit 2 - TX Buffer Overun (write 1 to clear)"]
77    #[inline(always)]
78    pub fn txov(&mut self) -> TXOV_W<2> {
79        TXOV_W::new(self)
80    }
81    #[doc = "Bit 3 - RX Buffer Overun (write 1 to clear)"]
82    #[inline(always)]
83    pub fn rxov(&mut self) -> RXOV_W<3> {
84        RXOV_W::new(self)
85    }
86    #[doc = "Writes raw bits to the register."]
87    #[inline(always)]
88    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
89        self.0.bits(bits);
90        self
91    }
92}
93#[doc = "UART Status 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 [state](index.html) module"]
94pub struct STATE_SPEC;
95impl crate::RegisterSpec for STATE_SPEC {
96    type Ux = u32;
97}
98#[doc = "`read()` method returns [state::R](R) reader structure"]
99impl crate::Readable for STATE_SPEC {
100    type Reader = R;
101}
102#[doc = "`write(|w| ..)` method takes [state::W](W) writer structure"]
103impl crate::Writable for STATE_SPEC {
104    type Writer = W;
105}
106#[doc = "`reset()` method sets STATE to value 0"]
107impl crate::Resettable for STATE_SPEC {
108    #[inline(always)]
109    fn reset_value() -> Self::Ux {
110        0
111    }
112}