corstone300_pac/ethernet/
afc_cfg.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 `AFC_CFG` reader"]
6pub struct R(crate::R<AFC_CFG_SPEC>);
7impl core::ops::Deref for R {
8    type Target = crate::R<AFC_CFG_SPEC>;
9    #[inline(always)]
10    fn deref(&self) -> &Self::Target {
11        &self.0
12    }
13}
14impl From<crate::R<AFC_CFG_SPEC>> for R {
15    #[inline(always)]
16    fn from(reader: crate::R<AFC_CFG_SPEC>) -> Self {
17        R(reader)
18    }
19}
20#[doc = "Register `AFC_CFG` writer"]
21pub struct W(crate::W<AFC_CFG_SPEC>);
22impl core::ops::Deref for W {
23    type Target = crate::W<AFC_CFG_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<AFC_CFG_SPEC>> for W {
36    #[inline(always)]
37    fn from(writer: crate::W<AFC_CFG_SPEC>) -> Self {
38        W(writer)
39    }
40}
41#[doc = "Field `FCANY` reader - Flow Control on Any Frame"]
42pub type FCANY_R = crate::BitReader<bool>;
43#[doc = "Field `FCANY` writer - Flow Control on Any Frame"]
44pub type FCANY_W<'a, const O: u8> = crate::BitWriter<'a, u32, AFC_CFG_SPEC, bool, O>;
45#[doc = "Field `FCADD` reader - Flow Control on Address Decode"]
46pub type FCADD_R = crate::BitReader<bool>;
47#[doc = "Field `FCADD` writer - Flow Control on Address Decode"]
48pub type FCADD_W<'a, const O: u8> = crate::BitWriter<'a, u32, AFC_CFG_SPEC, bool, O>;
49#[doc = "Field `FCBRD` reader - Flow Control on Broadcast Frame"]
50pub type FCBRD_R = crate::BitReader<bool>;
51#[doc = "Field `FCBRD` writer - Flow Control on Broadcast Frame"]
52pub type FCBRD_W<'a, const O: u8> = crate::BitWriter<'a, u32, AFC_CFG_SPEC, bool, O>;
53#[doc = "Field `FCMULT` reader - Flow Control on Multicast Frame"]
54pub type FCMULT_R = crate::BitReader<bool>;
55#[doc = "Field `FCMULT` writer - Flow Control on Multicast Frame"]
56pub type FCMULT_W<'a, const O: u8> = crate::BitWriter<'a, u32, AFC_CFG_SPEC, bool, O>;
57#[doc = "Field `BACK_DUR` reader - Backpresure duration"]
58pub type BACK_DUR_R = crate::FieldReader<u8, u8>;
59#[doc = "Field `BACK_DUR` writer - Backpresure duration"]
60pub type BACK_DUR_W<'a, const O: u8> = crate::FieldWriter<'a, u32, AFC_CFG_SPEC, u8, u8, 4, O>;
61#[doc = "Field `AFC_LO` reader - Automatic Flow Control Low Level"]
62pub type AFC_LO_R = crate::FieldReader<u8, u8>;
63#[doc = "Field `AFC_LO` writer - Automatic Flow Control Low Level"]
64pub type AFC_LO_W<'a, const O: u8> = crate::FieldWriter<'a, u32, AFC_CFG_SPEC, u8, u8, 8, O>;
65#[doc = "Field `AFC_HI` reader - Automatic Flow Control High Level"]
66pub type AFC_HI_R = crate::FieldReader<u8, u8>;
67#[doc = "Field `AFC_HI` writer - Automatic Flow Control High Level"]
68pub type AFC_HI_W<'a, const O: u8> = crate::FieldWriter<'a, u32, AFC_CFG_SPEC, u8, u8, 8, O>;
69impl R {
70    #[doc = "Bit 0 - Flow Control on Any Frame"]
71    #[inline(always)]
72    pub fn fcany(&self) -> FCANY_R {
73        FCANY_R::new((self.bits & 1) != 0)
74    }
75    #[doc = "Bit 1 - Flow Control on Address Decode"]
76    #[inline(always)]
77    pub fn fcadd(&self) -> FCADD_R {
78        FCADD_R::new(((self.bits >> 1) & 1) != 0)
79    }
80    #[doc = "Bit 2 - Flow Control on Broadcast Frame"]
81    #[inline(always)]
82    pub fn fcbrd(&self) -> FCBRD_R {
83        FCBRD_R::new(((self.bits >> 2) & 1) != 0)
84    }
85    #[doc = "Bit 3 - Flow Control on Multicast Frame"]
86    #[inline(always)]
87    pub fn fcmult(&self) -> FCMULT_R {
88        FCMULT_R::new(((self.bits >> 3) & 1) != 0)
89    }
90    #[doc = "Bits 4:7 - Backpresure duration"]
91    #[inline(always)]
92    pub fn back_dur(&self) -> BACK_DUR_R {
93        BACK_DUR_R::new(((self.bits >> 4) & 0x0f) as u8)
94    }
95    #[doc = "Bits 8:15 - Automatic Flow Control Low Level"]
96    #[inline(always)]
97    pub fn afc_lo(&self) -> AFC_LO_R {
98        AFC_LO_R::new(((self.bits >> 8) & 0xff) as u8)
99    }
100    #[doc = "Bits 16:23 - Automatic Flow Control High Level"]
101    #[inline(always)]
102    pub fn afc_hi(&self) -> AFC_HI_R {
103        AFC_HI_R::new(((self.bits >> 16) & 0xff) as u8)
104    }
105}
106impl W {
107    #[doc = "Bit 0 - Flow Control on Any Frame"]
108    #[inline(always)]
109    pub fn fcany(&mut self) -> FCANY_W<0> {
110        FCANY_W::new(self)
111    }
112    #[doc = "Bit 1 - Flow Control on Address Decode"]
113    #[inline(always)]
114    pub fn fcadd(&mut self) -> FCADD_W<1> {
115        FCADD_W::new(self)
116    }
117    #[doc = "Bit 2 - Flow Control on Broadcast Frame"]
118    #[inline(always)]
119    pub fn fcbrd(&mut self) -> FCBRD_W<2> {
120        FCBRD_W::new(self)
121    }
122    #[doc = "Bit 3 - Flow Control on Multicast Frame"]
123    #[inline(always)]
124    pub fn fcmult(&mut self) -> FCMULT_W<3> {
125        FCMULT_W::new(self)
126    }
127    #[doc = "Bits 4:7 - Backpresure duration"]
128    #[inline(always)]
129    pub fn back_dur(&mut self) -> BACK_DUR_W<4> {
130        BACK_DUR_W::new(self)
131    }
132    #[doc = "Bits 8:15 - Automatic Flow Control Low Level"]
133    #[inline(always)]
134    pub fn afc_lo(&mut self) -> AFC_LO_W<8> {
135        AFC_LO_W::new(self)
136    }
137    #[doc = "Bits 16:23 - Automatic Flow Control High Level"]
138    #[inline(always)]
139    pub fn afc_hi(&mut self) -> AFC_HI_W<16> {
140        AFC_HI_W::new(self)
141    }
142    #[doc = "Writes raw bits to the register."]
143    #[inline(always)]
144    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
145        self.0.bits(bits);
146        self
147    }
148}
149#[doc = "Automatic Flow Control Configuration\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 [afc_cfg](index.html) module"]
150pub struct AFC_CFG_SPEC;
151impl crate::RegisterSpec for AFC_CFG_SPEC {
152    type Ux = u32;
153}
154#[doc = "`read()` method returns [afc_cfg::R](R) reader structure"]
155impl crate::Readable for AFC_CFG_SPEC {
156    type Reader = R;
157}
158#[doc = "`write(|w| ..)` method takes [afc_cfg::W](W) writer structure"]
159impl crate::Writable for AFC_CFG_SPEC {
160    type Writer = W;
161}
162#[doc = "`reset()` method sets AFC_CFG to value 0"]
163impl crate::Resettable for AFC_CFG_SPEC {
164    #[inline(always)]
165    fn reset_value() -> Self::Ux {
166        0
167    }
168}