corstone300_pac/ethernet/
pmt_ctrl.rs1#[doc = "Register `PMT_CTRL` reader"]
6pub struct R(crate::R<PMT_CTRL_SPEC>);
7impl core::ops::Deref for R {
8 type Target = crate::R<PMT_CTRL_SPEC>;
9 #[inline(always)]
10 fn deref(&self) -> &Self::Target {
11 &self.0
12 }
13}
14impl From<crate::R<PMT_CTRL_SPEC>> for R {
15 #[inline(always)]
16 fn from(reader: crate::R<PMT_CTRL_SPEC>) -> Self {
17 R(reader)
18 }
19}
20#[doc = "Register `PMT_CTRL` writer"]
21pub struct W(crate::W<PMT_CTRL_SPEC>);
22impl core::ops::Deref for W {
23 type Target = crate::W<PMT_CTRL_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<PMT_CTRL_SPEC>> for W {
36 #[inline(always)]
37 fn from(writer: crate::W<PMT_CTRL_SPEC>) -> Self {
38 W(writer)
39 }
40}
41#[doc = "Field `READY` reader - Device Ready"]
42pub type READY_R = crate::BitReader<bool>;
43#[doc = "Field `PME_EN` reader - PME Enable"]
44pub type PME_EN_R = crate::BitReader<bool>;
45#[doc = "Field `PME_EN` writer - PME Enable"]
46pub type PME_EN_W<'a, const O: u8> = crate::BitWriter<'a, u32, PMT_CTRL_SPEC, bool, O>;
47#[doc = "Field `PME_POL` reader - PME Polarity"]
48pub type PME_POL_R = crate::BitReader<bool>;
49#[doc = "Field `PME_POL` writer - PME Polarity"]
50pub type PME_POL_W<'a, const O: u8> = crate::BitWriter<'a, u32, PMT_CTRL_SPEC, bool, O>;
51#[doc = "Field `PME_IND` reader - PME Indication"]
52pub type PME_IND_R = crate::BitReader<bool>;
53#[doc = "Field `PME_IND` writer - PME Indication"]
54pub type PME_IND_W<'a, const O: u8> = crate::BitWriter<'a, u32, PMT_CTRL_SPEC, bool, O>;
55#[doc = "Field `WUPS` reader - WAKE-UP Status"]
56pub type WUPS_R = crate::FieldReader<u8, WUPS_A>;
57#[doc = "WAKE-UP Status\n\nValue on reset: 0"]
58#[derive(Clone, Copy, Debug, PartialEq, Eq)]
59#[repr(u8)]
60pub enum WUPS_A {
61 #[doc = "0: `0`"]
62 NO_WAKE_UP = 0,
63 #[doc = "1: `1`"]
64 ENERGY = 1,
65 #[doc = "2: `10`"]
66 WAKE_UP_OR_MAGIC_PACKET = 2,
67 #[doc = "3: `11`"]
68 MULTIPLE = 3,
69}
70impl From<WUPS_A> for u8 {
71 #[inline(always)]
72 fn from(variant: WUPS_A) -> Self {
73 variant as _
74 }
75}
76impl WUPS_R {
77 #[doc = "Get enumerated values variant"]
78 #[inline(always)]
79 pub fn variant(&self) -> WUPS_A {
80 match self.bits {
81 0 => WUPS_A::NO_WAKE_UP,
82 1 => WUPS_A::ENERGY,
83 2 => WUPS_A::WAKE_UP_OR_MAGIC_PACKET,
84 3 => WUPS_A::MULTIPLE,
85 _ => unreachable!(),
86 }
87 }
88 #[doc = "Checks if the value of the field is `NO_WAKE_UP`"]
89 #[inline(always)]
90 pub fn is_no_wake_up(&self) -> bool {
91 *self == WUPS_A::NO_WAKE_UP
92 }
93 #[doc = "Checks if the value of the field is `ENERGY`"]
94 #[inline(always)]
95 pub fn is_energy(&self) -> bool {
96 *self == WUPS_A::ENERGY
97 }
98 #[doc = "Checks if the value of the field is `WAKE_UP_OR_MAGIC_PACKET`"]
99 #[inline(always)]
100 pub fn is_wake_up_or_magic_packet(&self) -> bool {
101 *self == WUPS_A::WAKE_UP_OR_MAGIC_PACKET
102 }
103 #[doc = "Checks if the value of the field is `MULTIPLE`"]
104 #[inline(always)]
105 pub fn is_multiple(&self) -> bool {
106 *self == WUPS_A::MULTIPLE
107 }
108}
109#[doc = "Field `WUPS` writer - WAKE-UP Status"]
110pub type WUPS_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u32, PMT_CTRL_SPEC, u8, WUPS_A, 2, O>;
111impl<'a, const O: u8> WUPS_W<'a, O> {
112 #[doc = "`0`"]
113 #[inline(always)]
114 pub fn no_wake_up(self) -> &'a mut W {
115 self.variant(WUPS_A::NO_WAKE_UP)
116 }
117 #[doc = "`1`"]
118 #[inline(always)]
119 pub fn energy(self) -> &'a mut W {
120 self.variant(WUPS_A::ENERGY)
121 }
122 #[doc = "`10`"]
123 #[inline(always)]
124 pub fn wake_up_or_magic_packet(self) -> &'a mut W {
125 self.variant(WUPS_A::WAKE_UP_OR_MAGIC_PACKET)
126 }
127 #[doc = "`11`"]
128 #[inline(always)]
129 pub fn multiple(self) -> &'a mut W {
130 self.variant(WUPS_A::MULTIPLE)
131 }
132}
133#[doc = "Field `PME_TYPE` reader - PME Buffer Type"]
134pub type PME_TYPE_R = crate::BitReader<bool>;
135#[doc = "Field `PME_TYPE` writer - PME Buffer Type"]
136pub type PME_TYPE_W<'a, const O: u8> = crate::BitWriter<'a, u32, PMT_CTRL_SPEC, bool, O>;
137#[doc = "Field `ED_EN` reader - Energy Detect Enable"]
138pub type ED_EN_R = crate::BitReader<bool>;
139#[doc = "Field `ED_EN` writer - Energy Detect Enable"]
140pub type ED_EN_W<'a, const O: u8> = crate::BitWriter<'a, u32, PMT_CTRL_SPEC, bool, O>;
141#[doc = "Field `WOL_EN` reader - Wake-On-Lan Enable"]
142pub type WOL_EN_R = crate::BitReader<bool>;
143#[doc = "Field `WOL_EN` writer - Wake-On-Lan Enable"]
144pub type WOL_EN_W<'a, const O: u8> = crate::BitWriter<'a, u32, PMT_CTRL_SPEC, bool, O>;
145#[doc = "Field `PHY_RST` reader - PHY Reset"]
146pub type PHY_RST_R = crate::BitReader<bool>;
147#[doc = "Field `PHY_RST` writer - PHY Reset"]
148pub type PHY_RST_W<'a, const O: u8> = crate::BitWriter<'a, u32, PMT_CTRL_SPEC, bool, O>;
149#[doc = "Field `PM_MODE` reader - Power Management Mode"]
150pub type PM_MODE_R = crate::FieldReader<u8, PM_MODE_A>;
151#[doc = "Power Management Mode\n\nValue on reset: 0"]
152#[derive(Clone, Copy, Debug, PartialEq, Eq)]
153#[repr(u8)]
154pub enum PM_MODE_A {
155 #[doc = "0: `0`"]
156 NORMAL = 0,
157 #[doc = "1: `1`"]
158 WAKE_UP_OR_MAGIC_PACKET = 1,
159 #[doc = "2: `10`"]
160 CAN_ENERGY_DETECT = 2,
161}
162impl From<PM_MODE_A> for u8 {
163 #[inline(always)]
164 fn from(variant: PM_MODE_A) -> Self {
165 variant as _
166 }
167}
168impl PM_MODE_R {
169 #[doc = "Get enumerated values variant"]
170 #[inline(always)]
171 pub fn variant(&self) -> Option<PM_MODE_A> {
172 match self.bits {
173 0 => Some(PM_MODE_A::NORMAL),
174 1 => Some(PM_MODE_A::WAKE_UP_OR_MAGIC_PACKET),
175 2 => Some(PM_MODE_A::CAN_ENERGY_DETECT),
176 _ => None,
177 }
178 }
179 #[doc = "Checks if the value of the field is `NORMAL`"]
180 #[inline(always)]
181 pub fn is_normal(&self) -> bool {
182 *self == PM_MODE_A::NORMAL
183 }
184 #[doc = "Checks if the value of the field is `WAKE_UP_OR_MAGIC_PACKET`"]
185 #[inline(always)]
186 pub fn is_wake_up_or_magic_packet(&self) -> bool {
187 *self == PM_MODE_A::WAKE_UP_OR_MAGIC_PACKET
188 }
189 #[doc = "Checks if the value of the field is `CAN_ENERGY_DETECT`"]
190 #[inline(always)]
191 pub fn is_can_energy_detect(&self) -> bool {
192 *self == PM_MODE_A::CAN_ENERGY_DETECT
193 }
194}
195#[doc = "Field `PM_MODE` writer - Power Management Mode"]
196pub type PM_MODE_W<'a, const O: u8> =
197 crate::FieldWriter<'a, u32, PMT_CTRL_SPEC, u8, PM_MODE_A, 2, O>;
198impl<'a, const O: u8> PM_MODE_W<'a, O> {
199 #[doc = "`0`"]
200 #[inline(always)]
201 pub fn normal(self) -> &'a mut W {
202 self.variant(PM_MODE_A::NORMAL)
203 }
204 #[doc = "`1`"]
205 #[inline(always)]
206 pub fn wake_up_or_magic_packet(self) -> &'a mut W {
207 self.variant(PM_MODE_A::WAKE_UP_OR_MAGIC_PACKET)
208 }
209 #[doc = "`10`"]
210 #[inline(always)]
211 pub fn can_energy_detect(self) -> &'a mut W {
212 self.variant(PM_MODE_A::CAN_ENERGY_DETECT)
213 }
214}
215impl R {
216 #[doc = "Bit 0 - Device Ready"]
217 #[inline(always)]
218 pub fn ready(&self) -> READY_R {
219 READY_R::new((self.bits & 1) != 0)
220 }
221 #[doc = "Bit 1 - PME Enable"]
222 #[inline(always)]
223 pub fn pme_en(&self) -> PME_EN_R {
224 PME_EN_R::new(((self.bits >> 1) & 1) != 0)
225 }
226 #[doc = "Bit 2 - PME Polarity"]
227 #[inline(always)]
228 pub fn pme_pol(&self) -> PME_POL_R {
229 PME_POL_R::new(((self.bits >> 2) & 1) != 0)
230 }
231 #[doc = "Bit 3 - PME Indication"]
232 #[inline(always)]
233 pub fn pme_ind(&self) -> PME_IND_R {
234 PME_IND_R::new(((self.bits >> 3) & 1) != 0)
235 }
236 #[doc = "Bits 4:5 - WAKE-UP Status"]
237 #[inline(always)]
238 pub fn wups(&self) -> WUPS_R {
239 WUPS_R::new(((self.bits >> 4) & 3) as u8)
240 }
241 #[doc = "Bit 6 - PME Buffer Type"]
242 #[inline(always)]
243 pub fn pme_type(&self) -> PME_TYPE_R {
244 PME_TYPE_R::new(((self.bits >> 6) & 1) != 0)
245 }
246 #[doc = "Bit 8 - Energy Detect Enable"]
247 #[inline(always)]
248 pub fn ed_en(&self) -> ED_EN_R {
249 ED_EN_R::new(((self.bits >> 8) & 1) != 0)
250 }
251 #[doc = "Bit 9 - Wake-On-Lan Enable"]
252 #[inline(always)]
253 pub fn wol_en(&self) -> WOL_EN_R {
254 WOL_EN_R::new(((self.bits >> 9) & 1) != 0)
255 }
256 #[doc = "Bit 10 - PHY Reset"]
257 #[inline(always)]
258 pub fn phy_rst(&self) -> PHY_RST_R {
259 PHY_RST_R::new(((self.bits >> 10) & 1) != 0)
260 }
261 #[doc = "Bits 12:13 - Power Management Mode"]
262 #[inline(always)]
263 pub fn pm_mode(&self) -> PM_MODE_R {
264 PM_MODE_R::new(((self.bits >> 12) & 3) as u8)
265 }
266}
267impl W {
268 #[doc = "Bit 1 - PME Enable"]
269 #[inline(always)]
270 pub fn pme_en(&mut self) -> PME_EN_W<1> {
271 PME_EN_W::new(self)
272 }
273 #[doc = "Bit 2 - PME Polarity"]
274 #[inline(always)]
275 pub fn pme_pol(&mut self) -> PME_POL_W<2> {
276 PME_POL_W::new(self)
277 }
278 #[doc = "Bit 3 - PME Indication"]
279 #[inline(always)]
280 pub fn pme_ind(&mut self) -> PME_IND_W<3> {
281 PME_IND_W::new(self)
282 }
283 #[doc = "Bits 4:5 - WAKE-UP Status"]
284 #[inline(always)]
285 pub fn wups(&mut self) -> WUPS_W<4> {
286 WUPS_W::new(self)
287 }
288 #[doc = "Bit 6 - PME Buffer Type"]
289 #[inline(always)]
290 pub fn pme_type(&mut self) -> PME_TYPE_W<6> {
291 PME_TYPE_W::new(self)
292 }
293 #[doc = "Bit 8 - Energy Detect Enable"]
294 #[inline(always)]
295 pub fn ed_en(&mut self) -> ED_EN_W<8> {
296 ED_EN_W::new(self)
297 }
298 #[doc = "Bit 9 - Wake-On-Lan Enable"]
299 #[inline(always)]
300 pub fn wol_en(&mut self) -> WOL_EN_W<9> {
301 WOL_EN_W::new(self)
302 }
303 #[doc = "Bit 10 - PHY Reset"]
304 #[inline(always)]
305 pub fn phy_rst(&mut self) -> PHY_RST_W<10> {
306 PHY_RST_W::new(self)
307 }
308 #[doc = "Bits 12:13 - Power Management Mode"]
309 #[inline(always)]
310 pub fn pm_mode(&mut self) -> PM_MODE_W<12> {
311 PM_MODE_W::new(self)
312 }
313 #[doc = "Writes raw bits to the register."]
314 #[inline(always)]
315 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
316 self.0.bits(bits);
317 self
318 }
319}
320#[doc = "Power Management Control\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 [pmt_ctrl](index.html) module"]
321pub struct PMT_CTRL_SPEC;
322impl crate::RegisterSpec for PMT_CTRL_SPEC {
323 type Ux = u32;
324}
325#[doc = "`read()` method returns [pmt_ctrl::R](R) reader structure"]
326impl crate::Readable for PMT_CTRL_SPEC {
327 type Reader = R;
328}
329#[doc = "`write(|w| ..)` method takes [pmt_ctrl::W](W) writer structure"]
330impl crate::Writable for PMT_CTRL_SPEC {
331 type Writer = W;
332}
333#[doc = "`reset()` method sets PMT_CTRL to value 0"]
334impl crate::Resettable for PMT_CTRL_SPEC {
335 #[inline(always)]
336 fn reset_value() -> Self::Ux {
337 0
338 }
339}