corstone300_pac/audio_i2s/
error.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 `ERROR` reader"]
6pub struct R(crate::R<ERROR_SPEC>);
7impl core::ops::Deref for R {
8    type Target = crate::R<ERROR_SPEC>;
9    #[inline(always)]
10    fn deref(&self) -> &Self::Target {
11        &self.0
12    }
13}
14impl From<crate::R<ERROR_SPEC>> for R {
15    #[inline(always)]
16    fn from(reader: crate::R<ERROR_SPEC>) -> Self {
17        R(reader)
18    }
19}
20#[doc = "Register `ERROR` writer"]
21pub struct W(crate::W<ERROR_SPEC>);
22impl core::ops::Deref for W {
23    type Target = crate::W<ERROR_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<ERROR_SPEC>> for W {
36    #[inline(always)]
37    fn from(writer: crate::W<ERROR_SPEC>) -> Self {
38        W(writer)
39    }
40}
41#[doc = "Field `TxOverrun` reader - Transmit buffer ovverrun or underrun. Set this bit to clear."]
42pub type TX_OVERRUN_R = crate::BitReader<bool>;
43#[doc = "Field `TxOverrun` writer - Transmit buffer ovverrun or underrun. Set this bit to clear."]
44pub type TX_OVERRUN_W<'a, const O: u8> = crate::BitWriter<'a, u32, ERROR_SPEC, bool, O>;
45#[doc = "Field `RxOverrun` reader - Receive buffer ovverrun. Set this bit to clear."]
46pub type RX_OVERRUN_R = crate::BitReader<bool>;
47#[doc = "Field `RxOverrun` writer - Receive buffer ovverrun. Set this bit to clear."]
48pub type RX_OVERRUN_W<'a, const O: u8> = crate::BitWriter<'a, u32, ERROR_SPEC, bool, O>;
49impl R {
50    #[doc = "Bit 0 - Transmit buffer ovverrun or underrun. Set this bit to clear."]
51    #[inline(always)]
52    pub fn tx_overrun(&self) -> TX_OVERRUN_R {
53        TX_OVERRUN_R::new((self.bits & 1) != 0)
54    }
55    #[doc = "Bit 1 - Receive buffer ovverrun. Set this bit to clear."]
56    #[inline(always)]
57    pub fn rx_overrun(&self) -> RX_OVERRUN_R {
58        RX_OVERRUN_R::new(((self.bits >> 1) & 1) != 0)
59    }
60}
61impl W {
62    #[doc = "Bit 0 - Transmit buffer ovverrun or underrun. Set this bit to clear."]
63    #[inline(always)]
64    pub fn tx_overrun(&mut self) -> TX_OVERRUN_W<0> {
65        TX_OVERRUN_W::new(self)
66    }
67    #[doc = "Bit 1 - Receive buffer ovverrun. Set this bit to clear."]
68    #[inline(always)]
69    pub fn rx_overrun(&mut self) -> RX_OVERRUN_W<1> {
70        RX_OVERRUN_W::new(self)
71    }
72    #[doc = "Writes raw bits to the register."]
73    #[inline(always)]
74    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
75        self.0.bits(bits);
76        self
77    }
78}
79#[doc = "Error 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 [error](index.html) module"]
80pub struct ERROR_SPEC;
81impl crate::RegisterSpec for ERROR_SPEC {
82    type Ux = u32;
83}
84#[doc = "`read()` method returns [error::R](R) reader structure"]
85impl crate::Readable for ERROR_SPEC {
86    type Reader = R;
87}
88#[doc = "`write(|w| ..)` method takes [error::W](W) writer structure"]
89impl crate::Writable for ERROR_SPEC {
90    type Writer = W;
91}
92#[doc = "`reset()` method sets ERROR to value 0"]
93impl crate::Resettable for ERROR_SPEC {
94    #[inline(always)]
95    fn reset_value() -> Self::Ux {
96        0
97    }
98}