atsamv71n21/gmac/
gmac_wol.rs

1#[doc = "Register `GMAC_WOL` reader"]
2pub struct R(crate::R<GMAC_WOL_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<GMAC_WOL_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<GMAC_WOL_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<GMAC_WOL_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `GMAC_WOL` writer"]
17pub struct W(crate::W<GMAC_WOL_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<GMAC_WOL_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<GMAC_WOL_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<GMAC_WOL_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `IP` reader - ARP Request IP Address"]
38pub struct IP_R(crate::FieldReader<u16, u16>);
39impl IP_R {
40    #[inline(always)]
41    pub(crate) fn new(bits: u16) -> Self {
42        IP_R(crate::FieldReader::new(bits))
43    }
44}
45impl core::ops::Deref for IP_R {
46    type Target = crate::FieldReader<u16, u16>;
47    #[inline(always)]
48    fn deref(&self) -> &Self::Target {
49        &self.0
50    }
51}
52#[doc = "Field `IP` writer - ARP Request IP Address"]
53pub struct IP_W<'a> {
54    w: &'a mut W,
55}
56impl<'a> IP_W<'a> {
57    #[doc = r"Writes raw bits to the field"]
58    #[inline(always)]
59    pub unsafe fn bits(self, value: u16) -> &'a mut W {
60        self.w.bits = (self.w.bits & !0xffff) | (value as u32 & 0xffff);
61        self.w
62    }
63}
64#[doc = "Field `MAG` reader - Magic Packet Event Enable"]
65pub struct MAG_R(crate::FieldReader<bool, bool>);
66impl MAG_R {
67    #[inline(always)]
68    pub(crate) fn new(bits: bool) -> Self {
69        MAG_R(crate::FieldReader::new(bits))
70    }
71}
72impl core::ops::Deref for MAG_R {
73    type Target = crate::FieldReader<bool, bool>;
74    #[inline(always)]
75    fn deref(&self) -> &Self::Target {
76        &self.0
77    }
78}
79#[doc = "Field `MAG` writer - Magic Packet Event Enable"]
80pub struct MAG_W<'a> {
81    w: &'a mut W,
82}
83impl<'a> MAG_W<'a> {
84    #[doc = r"Sets the field bit"]
85    #[inline(always)]
86    pub fn set_bit(self) -> &'a mut W {
87        self.bit(true)
88    }
89    #[doc = r"Clears the field bit"]
90    #[inline(always)]
91    pub fn clear_bit(self) -> &'a mut W {
92        self.bit(false)
93    }
94    #[doc = r"Writes raw bits to the field"]
95    #[inline(always)]
96    pub fn bit(self, value: bool) -> &'a mut W {
97        self.w.bits = (self.w.bits & !(0x01 << 16)) | ((value as u32 & 0x01) << 16);
98        self.w
99    }
100}
101#[doc = "Field `ARP` reader - ARP Request IP Address"]
102pub struct ARP_R(crate::FieldReader<bool, bool>);
103impl ARP_R {
104    #[inline(always)]
105    pub(crate) fn new(bits: bool) -> Self {
106        ARP_R(crate::FieldReader::new(bits))
107    }
108}
109impl core::ops::Deref for ARP_R {
110    type Target = crate::FieldReader<bool, bool>;
111    #[inline(always)]
112    fn deref(&self) -> &Self::Target {
113        &self.0
114    }
115}
116#[doc = "Field `ARP` writer - ARP Request IP Address"]
117pub struct ARP_W<'a> {
118    w: &'a mut W,
119}
120impl<'a> ARP_W<'a> {
121    #[doc = r"Sets the field bit"]
122    #[inline(always)]
123    pub fn set_bit(self) -> &'a mut W {
124        self.bit(true)
125    }
126    #[doc = r"Clears the field bit"]
127    #[inline(always)]
128    pub fn clear_bit(self) -> &'a mut W {
129        self.bit(false)
130    }
131    #[doc = r"Writes raw bits to the field"]
132    #[inline(always)]
133    pub fn bit(self, value: bool) -> &'a mut W {
134        self.w.bits = (self.w.bits & !(0x01 << 17)) | ((value as u32 & 0x01) << 17);
135        self.w
136    }
137}
138#[doc = "Field `SA1` reader - Specific Address Register 1 Event Enable"]
139pub struct SA1_R(crate::FieldReader<bool, bool>);
140impl SA1_R {
141    #[inline(always)]
142    pub(crate) fn new(bits: bool) -> Self {
143        SA1_R(crate::FieldReader::new(bits))
144    }
145}
146impl core::ops::Deref for SA1_R {
147    type Target = crate::FieldReader<bool, bool>;
148    #[inline(always)]
149    fn deref(&self) -> &Self::Target {
150        &self.0
151    }
152}
153#[doc = "Field `SA1` writer - Specific Address Register 1 Event Enable"]
154pub struct SA1_W<'a> {
155    w: &'a mut W,
156}
157impl<'a> SA1_W<'a> {
158    #[doc = r"Sets the field bit"]
159    #[inline(always)]
160    pub fn set_bit(self) -> &'a mut W {
161        self.bit(true)
162    }
163    #[doc = r"Clears the field bit"]
164    #[inline(always)]
165    pub fn clear_bit(self) -> &'a mut W {
166        self.bit(false)
167    }
168    #[doc = r"Writes raw bits to the field"]
169    #[inline(always)]
170    pub fn bit(self, value: bool) -> &'a mut W {
171        self.w.bits = (self.w.bits & !(0x01 << 18)) | ((value as u32 & 0x01) << 18);
172        self.w
173    }
174}
175#[doc = "Field `MTI` reader - Multicast Hash Event Enable"]
176pub struct MTI_R(crate::FieldReader<bool, bool>);
177impl MTI_R {
178    #[inline(always)]
179    pub(crate) fn new(bits: bool) -> Self {
180        MTI_R(crate::FieldReader::new(bits))
181    }
182}
183impl core::ops::Deref for MTI_R {
184    type Target = crate::FieldReader<bool, bool>;
185    #[inline(always)]
186    fn deref(&self) -> &Self::Target {
187        &self.0
188    }
189}
190#[doc = "Field `MTI` writer - Multicast Hash Event Enable"]
191pub struct MTI_W<'a> {
192    w: &'a mut W,
193}
194impl<'a> MTI_W<'a> {
195    #[doc = r"Sets the field bit"]
196    #[inline(always)]
197    pub fn set_bit(self) -> &'a mut W {
198        self.bit(true)
199    }
200    #[doc = r"Clears the field bit"]
201    #[inline(always)]
202    pub fn clear_bit(self) -> &'a mut W {
203        self.bit(false)
204    }
205    #[doc = r"Writes raw bits to the field"]
206    #[inline(always)]
207    pub fn bit(self, value: bool) -> &'a mut W {
208        self.w.bits = (self.w.bits & !(0x01 << 19)) | ((value as u32 & 0x01) << 19);
209        self.w
210    }
211}
212impl R {
213    #[doc = "Bits 0:15 - ARP Request IP Address"]
214    #[inline(always)]
215    pub fn ip(&self) -> IP_R {
216        IP_R::new((self.bits & 0xffff) as u16)
217    }
218    #[doc = "Bit 16 - Magic Packet Event Enable"]
219    #[inline(always)]
220    pub fn mag(&self) -> MAG_R {
221        MAG_R::new(((self.bits >> 16) & 0x01) != 0)
222    }
223    #[doc = "Bit 17 - ARP Request IP Address"]
224    #[inline(always)]
225    pub fn arp(&self) -> ARP_R {
226        ARP_R::new(((self.bits >> 17) & 0x01) != 0)
227    }
228    #[doc = "Bit 18 - Specific Address Register 1 Event Enable"]
229    #[inline(always)]
230    pub fn sa1(&self) -> SA1_R {
231        SA1_R::new(((self.bits >> 18) & 0x01) != 0)
232    }
233    #[doc = "Bit 19 - Multicast Hash Event Enable"]
234    #[inline(always)]
235    pub fn mti(&self) -> MTI_R {
236        MTI_R::new(((self.bits >> 19) & 0x01) != 0)
237    }
238}
239impl W {
240    #[doc = "Bits 0:15 - ARP Request IP Address"]
241    #[inline(always)]
242    pub fn ip(&mut self) -> IP_W {
243        IP_W { w: self }
244    }
245    #[doc = "Bit 16 - Magic Packet Event Enable"]
246    #[inline(always)]
247    pub fn mag(&mut self) -> MAG_W {
248        MAG_W { w: self }
249    }
250    #[doc = "Bit 17 - ARP Request IP Address"]
251    #[inline(always)]
252    pub fn arp(&mut self) -> ARP_W {
253        ARP_W { w: self }
254    }
255    #[doc = "Bit 18 - Specific Address Register 1 Event Enable"]
256    #[inline(always)]
257    pub fn sa1(&mut self) -> SA1_W {
258        SA1_W { w: self }
259    }
260    #[doc = "Bit 19 - Multicast Hash Event Enable"]
261    #[inline(always)]
262    pub fn mti(&mut self) -> MTI_W {
263        MTI_W { w: self }
264    }
265    #[doc = "Writes raw bits to the register."]
266    #[inline(always)]
267    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
268        self.0.bits(bits);
269        self
270    }
271}
272#[doc = "Wake on LAN 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 [gmac_wol](index.html) module"]
273pub struct GMAC_WOL_SPEC;
274impl crate::RegisterSpec for GMAC_WOL_SPEC {
275    type Ux = u32;
276}
277#[doc = "`read()` method returns [gmac_wol::R](R) reader structure"]
278impl crate::Readable for GMAC_WOL_SPEC {
279    type Reader = R;
280}
281#[doc = "`write(|w| ..)` method takes [gmac_wol::W](W) writer structure"]
282impl crate::Writable for GMAC_WOL_SPEC {
283    type Writer = W;
284}
285#[doc = "`reset()` method sets GMAC_WOL to value 0"]
286impl crate::Resettable for GMAC_WOL_SPEC {
287    #[inline(always)]
288    fn reset_value() -> Self::Ux {
289        0
290    }
291}