ra6m4/edmac0/
fdr.rs

1#[doc = "Register `FDR` reader"]
2pub struct R(crate::R<FDR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<FDR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<FDR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<FDR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `FDR` writer"]
17pub struct W(crate::W<FDR_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<FDR_SPEC>;
20    #[inline(always)]
21    fn deref(&self) -> &Self::Target {
22        &self.0
23    }
24}
25impl core::ops::DerefMut for W {
26    #[inline(always)]
27    fn deref_mut(&mut self) -> &mut Self::Target {
28        &mut self.0
29    }
30}
31impl From<crate::W<FDR_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<FDR_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `RFD` reader - Receive FIFO Depth"]
38pub type RFD_R = crate::FieldReader<u8, RFD_A>;
39#[doc = "Receive FIFO Depth\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum RFD_A {
43    #[doc = "15: 4096 bytes"]
44    _0X0F = 15,
45}
46impl From<RFD_A> for u8 {
47    #[inline(always)]
48    fn from(variant: RFD_A) -> Self {
49        variant as _
50    }
51}
52impl RFD_R {
53    #[doc = "Get enumerated values variant"]
54    #[inline(always)]
55    pub fn variant(&self) -> Option<RFD_A> {
56        match self.bits {
57            15 => Some(RFD_A::_0X0F),
58            _ => None,
59        }
60    }
61    #[doc = "Checks if the value of the field is `_0X0F`"]
62    #[inline(always)]
63    pub fn is_0x0f(&self) -> bool {
64        *self == RFD_A::_0X0F
65    }
66}
67#[doc = "Field `RFD` writer - Receive FIFO Depth"]
68pub type RFD_W<'a, const O: u8> = crate::FieldWriter<'a, u32, FDR_SPEC, u8, RFD_A, 5, O>;
69impl<'a, const O: u8> RFD_W<'a, O> {
70    #[doc = "4096 bytes"]
71    #[inline(always)]
72    pub fn _0x0f(self) -> &'a mut W {
73        self.variant(RFD_A::_0X0F)
74    }
75}
76#[doc = "Field `TFD` reader - Transmit FIFO Depth"]
77pub type TFD_R = crate::FieldReader<u8, TFD_A>;
78#[doc = "Transmit FIFO Depth\n\nValue on reset: 0"]
79#[derive(Clone, Copy, Debug, PartialEq, Eq)]
80#[repr(u8)]
81pub enum TFD_A {
82    #[doc = "7: 2048 bytes"]
83    _0X07 = 7,
84}
85impl From<TFD_A> for u8 {
86    #[inline(always)]
87    fn from(variant: TFD_A) -> Self {
88        variant as _
89    }
90}
91impl TFD_R {
92    #[doc = "Get enumerated values variant"]
93    #[inline(always)]
94    pub fn variant(&self) -> Option<TFD_A> {
95        match self.bits {
96            7 => Some(TFD_A::_0X07),
97            _ => None,
98        }
99    }
100    #[doc = "Checks if the value of the field is `_0X07`"]
101    #[inline(always)]
102    pub fn is_0x07(&self) -> bool {
103        *self == TFD_A::_0X07
104    }
105}
106#[doc = "Field `TFD` writer - Transmit FIFO Depth"]
107pub type TFD_W<'a, const O: u8> = crate::FieldWriter<'a, u32, FDR_SPEC, u8, TFD_A, 5, O>;
108impl<'a, const O: u8> TFD_W<'a, O> {
109    #[doc = "2048 bytes"]
110    #[inline(always)]
111    pub fn _0x07(self) -> &'a mut W {
112        self.variant(TFD_A::_0X07)
113    }
114}
115impl R {
116    #[doc = "Bits 0:4 - Receive FIFO Depth"]
117    #[inline(always)]
118    pub fn rfd(&self) -> RFD_R {
119        RFD_R::new((self.bits & 0x1f) as u8)
120    }
121    #[doc = "Bits 8:12 - Transmit FIFO Depth"]
122    #[inline(always)]
123    pub fn tfd(&self) -> TFD_R {
124        TFD_R::new(((self.bits >> 8) & 0x1f) as u8)
125    }
126}
127impl W {
128    #[doc = "Bits 0:4 - Receive FIFO Depth"]
129    #[inline(always)]
130    #[must_use]
131    pub fn rfd(&mut self) -> RFD_W<0> {
132        RFD_W::new(self)
133    }
134    #[doc = "Bits 8:12 - Transmit FIFO Depth"]
135    #[inline(always)]
136    #[must_use]
137    pub fn tfd(&mut self) -> TFD_W<8> {
138        TFD_W::new(self)
139    }
140    #[doc = "Writes raw bits to the register."]
141    #[inline(always)]
142    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
143        self.0.bits(bits);
144        self
145    }
146}
147#[doc = "FIFO Depth 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 [fdr](index.html) module"]
148pub struct FDR_SPEC;
149impl crate::RegisterSpec for FDR_SPEC {
150    type Ux = u32;
151}
152#[doc = "`read()` method returns [fdr::R](R) reader structure"]
153impl crate::Readable for FDR_SPEC {
154    type Reader = R;
155}
156#[doc = "`write(|w| ..)` method takes [fdr::W](W) writer structure"]
157impl crate::Writable for FDR_SPEC {
158    type Writer = W;
159    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
160    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
161}
162#[doc = "`reset()` method sets FDR to value 0"]
163impl crate::Resettable for FDR_SPEC {
164    const RESET_VALUE: Self::Ux = 0;
165}