atsame70q21/gmac/
gmac_cbscr.rs

1#[doc = "Register `GMAC_CBSCR` reader"]
2pub struct R(crate::R<GMAC_CBSCR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<GMAC_CBSCR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<GMAC_CBSCR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<GMAC_CBSCR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `GMAC_CBSCR` writer"]
17pub struct W(crate::W<GMAC_CBSCR_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<GMAC_CBSCR_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_CBSCR_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<GMAC_CBSCR_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `QBE` reader - Queue B CBS Enable"]
38pub struct QBE_R(crate::FieldReader<bool, bool>);
39impl QBE_R {
40    #[inline(always)]
41    pub(crate) fn new(bits: bool) -> Self {
42        QBE_R(crate::FieldReader::new(bits))
43    }
44}
45impl core::ops::Deref for QBE_R {
46    type Target = crate::FieldReader<bool, bool>;
47    #[inline(always)]
48    fn deref(&self) -> &Self::Target {
49        &self.0
50    }
51}
52#[doc = "Field `QBE` writer - Queue B CBS Enable"]
53pub struct QBE_W<'a> {
54    w: &'a mut W,
55}
56impl<'a> QBE_W<'a> {
57    #[doc = r"Sets the field bit"]
58    #[inline(always)]
59    pub fn set_bit(self) -> &'a mut W {
60        self.bit(true)
61    }
62    #[doc = r"Clears the field bit"]
63    #[inline(always)]
64    pub fn clear_bit(self) -> &'a mut W {
65        self.bit(false)
66    }
67    #[doc = r"Writes raw bits to the field"]
68    #[inline(always)]
69    pub fn bit(self, value: bool) -> &'a mut W {
70        self.w.bits = (self.w.bits & !0x01) | (value as u32 & 0x01);
71        self.w
72    }
73}
74#[doc = "Field `QAE` reader - Queue A CBS Enable"]
75pub struct QAE_R(crate::FieldReader<bool, bool>);
76impl QAE_R {
77    #[inline(always)]
78    pub(crate) fn new(bits: bool) -> Self {
79        QAE_R(crate::FieldReader::new(bits))
80    }
81}
82impl core::ops::Deref for QAE_R {
83    type Target = crate::FieldReader<bool, bool>;
84    #[inline(always)]
85    fn deref(&self) -> &Self::Target {
86        &self.0
87    }
88}
89#[doc = "Field `QAE` writer - Queue A CBS Enable"]
90pub struct QAE_W<'a> {
91    w: &'a mut W,
92}
93impl<'a> QAE_W<'a> {
94    #[doc = r"Sets the field bit"]
95    #[inline(always)]
96    pub fn set_bit(self) -> &'a mut W {
97        self.bit(true)
98    }
99    #[doc = r"Clears the field bit"]
100    #[inline(always)]
101    pub fn clear_bit(self) -> &'a mut W {
102        self.bit(false)
103    }
104    #[doc = r"Writes raw bits to the field"]
105    #[inline(always)]
106    pub fn bit(self, value: bool) -> &'a mut W {
107        self.w.bits = (self.w.bits & !(0x01 << 1)) | ((value as u32 & 0x01) << 1);
108        self.w
109    }
110}
111impl R {
112    #[doc = "Bit 0 - Queue B CBS Enable"]
113    #[inline(always)]
114    pub fn qbe(&self) -> QBE_R {
115        QBE_R::new((self.bits & 0x01) != 0)
116    }
117    #[doc = "Bit 1 - Queue A CBS Enable"]
118    #[inline(always)]
119    pub fn qae(&self) -> QAE_R {
120        QAE_R::new(((self.bits >> 1) & 0x01) != 0)
121    }
122}
123impl W {
124    #[doc = "Bit 0 - Queue B CBS Enable"]
125    #[inline(always)]
126    pub fn qbe(&mut self) -> QBE_W {
127        QBE_W { w: self }
128    }
129    #[doc = "Bit 1 - Queue A CBS Enable"]
130    #[inline(always)]
131    pub fn qae(&mut self) -> QAE_W {
132        QAE_W { w: self }
133    }
134    #[doc = "Writes raw bits to the register."]
135    #[inline(always)]
136    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
137        self.0.bits(bits);
138        self
139    }
140}
141#[doc = "Credit-Based Shaping Control 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_cbscr](index.html) module"]
142pub struct GMAC_CBSCR_SPEC;
143impl crate::RegisterSpec for GMAC_CBSCR_SPEC {
144    type Ux = u32;
145}
146#[doc = "`read()` method returns [gmac_cbscr::R](R) reader structure"]
147impl crate::Readable for GMAC_CBSCR_SPEC {
148    type Reader = R;
149}
150#[doc = "`write(|w| ..)` method takes [gmac_cbscr::W](W) writer structure"]
151impl crate::Writable for GMAC_CBSCR_SPEC {
152    type Writer = W;
153}
154#[doc = "`reset()` method sets GMAC_CBSCR to value 0"]
155impl crate::Resettable for GMAC_CBSCR_SPEC {
156    #[inline(always)]
157    fn reset_value() -> Self::Ux {
158        0
159    }
160}