corstone300_pac/ethernet/
e2p_cmd.rs1#[doc = "Register `E2P_CMD` reader"]
6pub struct R(crate::R<E2P_CMD_SPEC>);
7impl core::ops::Deref for R {
8 type Target = crate::R<E2P_CMD_SPEC>;
9 #[inline(always)]
10 fn deref(&self) -> &Self::Target {
11 &self.0
12 }
13}
14impl From<crate::R<E2P_CMD_SPEC>> for R {
15 #[inline(always)]
16 fn from(reader: crate::R<E2P_CMD_SPEC>) -> Self {
17 R(reader)
18 }
19}
20#[doc = "Register `E2P_CMD` writer"]
21pub struct W(crate::W<E2P_CMD_SPEC>);
22impl core::ops::Deref for W {
23 type Target = crate::W<E2P_CMD_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<E2P_CMD_SPEC>> for W {
36 #[inline(always)]
37 fn from(writer: crate::W<E2P_CMD_SPEC>) -> Self {
38 W(writer)
39 }
40}
41#[doc = "Field `Addr` reader - EPC Address"]
42pub type ADDR_R = crate::FieldReader<u8, u8>;
43#[doc = "Field `Addr` writer - EPC Address"]
44pub type ADDR_W<'a, const O: u8> = crate::FieldWriter<'a, u32, E2P_CMD_SPEC, u8, u8, 8, O>;
45#[doc = "Field `MAC_LDR` reader - MAC Address Loaded"]
46pub type MAC_LDR_R = crate::BitReader<bool>;
47#[doc = "Field `MAC_LDR` writer - MAC Address Loaded"]
48pub type MAC_LDR_W<'a, const O: u8> = crate::BitWriter<'a, u32, E2P_CMD_SPEC, bool, O>;
49#[doc = "Field `TIME_OUT` reader - EPC Time-out"]
50pub type TIME_OUT_R = crate::BitReader<bool>;
51#[doc = "Field `TIME_OUT` writer - EPC Time-out"]
52pub type TIME_OUT_W<'a, const O: u8> = crate::BitWriter<'a, u32, E2P_CMD_SPEC, bool, O>;
53#[doc = "Field `CMD` reader - EPC Command"]
54pub type CMD_R = crate::FieldReader<u8, CMD_A>;
55#[doc = "EPC Command\n\nValue on reset: 0"]
56#[derive(Clone, Copy, Debug, PartialEq, Eq)]
57#[repr(u8)]
58pub enum CMD_A {
59 #[doc = "0: `0`"]
60 READ = 0,
61 #[doc = "1: Erase/Write Disable"]
62 EWDS = 1,
63 #[doc = "2: Erase/Write Enable"]
64 EWEN = 2,
65 #[doc = "3: `11`"]
66 WRITE = 3,
67 #[doc = "4: Write All"]
68 WRAL = 4,
69 #[doc = "5: `101`"]
70 ERASE = 5,
71 #[doc = "6: Erase All"]
72 ERAL = 6,
73 #[doc = "7: MAC Address Reload"]
74 RELOAD = 7,
75}
76impl From<CMD_A> for u8 {
77 #[inline(always)]
78 fn from(variant: CMD_A) -> Self {
79 variant as _
80 }
81}
82impl CMD_R {
83 #[doc = "Get enumerated values variant"]
84 #[inline(always)]
85 pub fn variant(&self) -> CMD_A {
86 match self.bits {
87 0 => CMD_A::READ,
88 1 => CMD_A::EWDS,
89 2 => CMD_A::EWEN,
90 3 => CMD_A::WRITE,
91 4 => CMD_A::WRAL,
92 5 => CMD_A::ERASE,
93 6 => CMD_A::ERAL,
94 7 => CMD_A::RELOAD,
95 _ => unreachable!(),
96 }
97 }
98 #[doc = "Checks if the value of the field is `READ`"]
99 #[inline(always)]
100 pub fn is_read(&self) -> bool {
101 *self == CMD_A::READ
102 }
103 #[doc = "Checks if the value of the field is `EWDS`"]
104 #[inline(always)]
105 pub fn is_ewds(&self) -> bool {
106 *self == CMD_A::EWDS
107 }
108 #[doc = "Checks if the value of the field is `EWEN`"]
109 #[inline(always)]
110 pub fn is_ewen(&self) -> bool {
111 *self == CMD_A::EWEN
112 }
113 #[doc = "Checks if the value of the field is `WRITE`"]
114 #[inline(always)]
115 pub fn is_write(&self) -> bool {
116 *self == CMD_A::WRITE
117 }
118 #[doc = "Checks if the value of the field is `WRAL`"]
119 #[inline(always)]
120 pub fn is_wral(&self) -> bool {
121 *self == CMD_A::WRAL
122 }
123 #[doc = "Checks if the value of the field is `ERASE`"]
124 #[inline(always)]
125 pub fn is_erase(&self) -> bool {
126 *self == CMD_A::ERASE
127 }
128 #[doc = "Checks if the value of the field is `ERAL`"]
129 #[inline(always)]
130 pub fn is_eral(&self) -> bool {
131 *self == CMD_A::ERAL
132 }
133 #[doc = "Checks if the value of the field is `RELOAD`"]
134 #[inline(always)]
135 pub fn is_reload(&self) -> bool {
136 *self == CMD_A::RELOAD
137 }
138}
139#[doc = "Field `CMD` writer - EPC Command"]
140pub type CMD_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u32, E2P_CMD_SPEC, u8, CMD_A, 3, O>;
141impl<'a, const O: u8> CMD_W<'a, O> {
142 #[doc = "`0`"]
143 #[inline(always)]
144 pub fn read(self) -> &'a mut W {
145 self.variant(CMD_A::READ)
146 }
147 #[doc = "Erase/Write Disable"]
148 #[inline(always)]
149 pub fn ewds(self) -> &'a mut W {
150 self.variant(CMD_A::EWDS)
151 }
152 #[doc = "Erase/Write Enable"]
153 #[inline(always)]
154 pub fn ewen(self) -> &'a mut W {
155 self.variant(CMD_A::EWEN)
156 }
157 #[doc = "`11`"]
158 #[inline(always)]
159 pub fn write(self) -> &'a mut W {
160 self.variant(CMD_A::WRITE)
161 }
162 #[doc = "Write All"]
163 #[inline(always)]
164 pub fn wral(self) -> &'a mut W {
165 self.variant(CMD_A::WRAL)
166 }
167 #[doc = "`101`"]
168 #[inline(always)]
169 pub fn erase(self) -> &'a mut W {
170 self.variant(CMD_A::ERASE)
171 }
172 #[doc = "Erase All"]
173 #[inline(always)]
174 pub fn eral(self) -> &'a mut W {
175 self.variant(CMD_A::ERAL)
176 }
177 #[doc = "MAC Address Reload"]
178 #[inline(always)]
179 pub fn reload(self) -> &'a mut W {
180 self.variant(CMD_A::RELOAD)
181 }
182}
183#[doc = "Field `BSY` reader - EPC Busy"]
184pub type BSY_R = crate::BitReader<bool>;
185#[doc = "Field `BSY` writer - EPC Busy"]
186pub type BSY_W<'a, const O: u8> = crate::BitWriter<'a, u32, E2P_CMD_SPEC, bool, O>;
187impl R {
188 #[doc = "Bits 0:7 - EPC Address"]
189 #[inline(always)]
190 pub fn addr(&self) -> ADDR_R {
191 ADDR_R::new((self.bits & 0xff) as u8)
192 }
193 #[doc = "Bit 8 - MAC Address Loaded"]
194 #[inline(always)]
195 pub fn mac_ldr(&self) -> MAC_LDR_R {
196 MAC_LDR_R::new(((self.bits >> 8) & 1) != 0)
197 }
198 #[doc = "Bit 9 - EPC Time-out"]
199 #[inline(always)]
200 pub fn time_out(&self) -> TIME_OUT_R {
201 TIME_OUT_R::new(((self.bits >> 9) & 1) != 0)
202 }
203 #[doc = "Bits 28:30 - EPC Command"]
204 #[inline(always)]
205 pub fn cmd(&self) -> CMD_R {
206 CMD_R::new(((self.bits >> 28) & 7) as u8)
207 }
208 #[doc = "Bit 31 - EPC Busy"]
209 #[inline(always)]
210 pub fn bsy(&self) -> BSY_R {
211 BSY_R::new(((self.bits >> 31) & 1) != 0)
212 }
213}
214impl W {
215 #[doc = "Bits 0:7 - EPC Address"]
216 #[inline(always)]
217 pub fn addr(&mut self) -> ADDR_W<0> {
218 ADDR_W::new(self)
219 }
220 #[doc = "Bit 8 - MAC Address Loaded"]
221 #[inline(always)]
222 pub fn mac_ldr(&mut self) -> MAC_LDR_W<8> {
223 MAC_LDR_W::new(self)
224 }
225 #[doc = "Bit 9 - EPC Time-out"]
226 #[inline(always)]
227 pub fn time_out(&mut self) -> TIME_OUT_W<9> {
228 TIME_OUT_W::new(self)
229 }
230 #[doc = "Bits 28:30 - EPC Command"]
231 #[inline(always)]
232 pub fn cmd(&mut self) -> CMD_W<28> {
233 CMD_W::new(self)
234 }
235 #[doc = "Bit 31 - EPC Busy"]
236 #[inline(always)]
237 pub fn bsy(&mut self) -> BSY_W<31> {
238 BSY_W::new(self)
239 }
240 #[doc = "Writes raw bits to the register."]
241 #[inline(always)]
242 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
243 self.0.bits(bits);
244 self
245 }
246}
247#[doc = "EEPROM Command\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 [e2p_cmd](index.html) module"]
248pub struct E2P_CMD_SPEC;
249impl crate::RegisterSpec for E2P_CMD_SPEC {
250 type Ux = u32;
251}
252#[doc = "`read()` method returns [e2p_cmd::R](R) reader structure"]
253impl crate::Readable for E2P_CMD_SPEC {
254 type Reader = R;
255}
256#[doc = "`write(|w| ..)` method takes [e2p_cmd::W](W) writer structure"]
257impl crate::Writable for E2P_CMD_SPEC {
258 type Writer = W;
259}
260#[doc = "`reset()` method sets E2P_CMD to value 0"]
261impl crate::Resettable for E2P_CMD_SPEC {
262 #[inline(always)]
263 fn reset_value() -> Self::Ux {
264 0
265 }
266}