Skip to main content

atsamv71n21/gmac/
gmac_tidm3.rs

1#[doc = "Register `GMAC_TIDM3` reader"]
2pub struct R(crate::R<GMAC_TIDM3_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<GMAC_TIDM3_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<GMAC_TIDM3_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<GMAC_TIDM3_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `GMAC_TIDM3` writer"]
17pub struct W(crate::W<GMAC_TIDM3_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<GMAC_TIDM3_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_TIDM3_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<GMAC_TIDM3_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `TID` reader - Type ID Match 3"]
38pub struct TID_R(crate::FieldReader<u16, u16>);
39impl TID_R {
40    #[inline(always)]
41    pub(crate) fn new(bits: u16) -> Self {
42        TID_R(crate::FieldReader::new(bits))
43    }
44}
45impl core::ops::Deref for TID_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 `TID` writer - Type ID Match 3"]
53pub struct TID_W<'a> {
54    w: &'a mut W,
55}
56impl<'a> TID_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 `ENID3` reader - Enable Copying of TID Matched Frames"]
65pub struct ENID3_R(crate::FieldReader<bool, bool>);
66impl ENID3_R {
67    #[inline(always)]
68    pub(crate) fn new(bits: bool) -> Self {
69        ENID3_R(crate::FieldReader::new(bits))
70    }
71}
72impl core::ops::Deref for ENID3_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 `ENID3` writer - Enable Copying of TID Matched Frames"]
80pub struct ENID3_W<'a> {
81    w: &'a mut W,
82}
83impl<'a> ENID3_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 << 31)) | ((value as u32 & 0x01) << 31);
98        self.w
99    }
100}
101impl R {
102    #[doc = "Bits 0:15 - Type ID Match 3"]
103    #[inline(always)]
104    pub fn tid(&self) -> TID_R {
105        TID_R::new((self.bits & 0xffff) as u16)
106    }
107    #[doc = "Bit 31 - Enable Copying of TID Matched Frames"]
108    #[inline(always)]
109    pub fn enid3(&self) -> ENID3_R {
110        ENID3_R::new(((self.bits >> 31) & 0x01) != 0)
111    }
112}
113impl W {
114    #[doc = "Bits 0:15 - Type ID Match 3"]
115    #[inline(always)]
116    pub fn tid(&mut self) -> TID_W {
117        TID_W { w: self }
118    }
119    #[doc = "Bit 31 - Enable Copying of TID Matched Frames"]
120    #[inline(always)]
121    pub fn enid3(&mut self) -> ENID3_W {
122        ENID3_W { w: self }
123    }
124    #[doc = "Writes raw bits to the register."]
125    #[inline(always)]
126    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
127        self.0.bits(bits);
128        self
129    }
130}
131#[doc = "Type ID Match 3 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_tidm3](index.html) module"]
132pub struct GMAC_TIDM3_SPEC;
133impl crate::RegisterSpec for GMAC_TIDM3_SPEC {
134    type Ux = u32;
135}
136#[doc = "`read()` method returns [gmac_tidm3::R](R) reader structure"]
137impl crate::Readable for GMAC_TIDM3_SPEC {
138    type Reader = R;
139}
140#[doc = "`write(|w| ..)` method takes [gmac_tidm3::W](W) writer structure"]
141impl crate::Writable for GMAC_TIDM3_SPEC {
142    type Writer = W;
143}
144#[doc = "`reset()` method sets GMAC_TIDM3 to value 0"]
145impl crate::Resettable for GMAC_TIDM3_SPEC {
146    #[inline(always)]
147    fn reset_value() -> Self::Ux {
148        0
149    }
150}