Skip to main content

atsamd21e18a/dmac/
qosctrl.rs

1#[doc = "Reader of register QOSCTRL"]
2pub type R = crate::R<u8, super::QOSCTRL>;
3#[doc = "Writer for register QOSCTRL"]
4pub type W = crate::W<u8, super::QOSCTRL>;
5#[doc = "Register QOSCTRL `reset()`'s with value 0x15"]
6impl crate::ResetValue for super::QOSCTRL {
7    type Type = u8;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0x15
11    }
12}
13#[doc = "Write-Back Quality of Service\n\nValue on reset: 1"]
14#[derive(Clone, Copy, Debug, PartialEq)]
15#[repr(u8)]
16pub enum WRBQOS_A {
17    #[doc = "0: Background (no sensitive operation)"]
18    DISABLE = 0,
19    #[doc = "1: Sensitive Bandwidth"]
20    LOW = 1,
21    #[doc = "2: Sensitive Latency"]
22    MEDIUM = 2,
23    #[doc = "3: Critical Latency"]
24    HIGH = 3,
25}
26impl From<WRBQOS_A> for u8 {
27    #[inline(always)]
28    fn from(variant: WRBQOS_A) -> Self {
29        variant as _
30    }
31}
32#[doc = "Reader of field `WRBQOS`"]
33pub type WRBQOS_R = crate::R<u8, WRBQOS_A>;
34impl WRBQOS_R {
35    #[doc = r"Get enumerated values variant"]
36    #[inline(always)]
37    pub fn variant(&self) -> WRBQOS_A {
38        match self.bits {
39            0 => WRBQOS_A::DISABLE,
40            1 => WRBQOS_A::LOW,
41            2 => WRBQOS_A::MEDIUM,
42            3 => WRBQOS_A::HIGH,
43            _ => unreachable!(),
44        }
45    }
46    #[doc = "Checks if the value of the field is `DISABLE`"]
47    #[inline(always)]
48    pub fn is_disable(&self) -> bool {
49        *self == WRBQOS_A::DISABLE
50    }
51    #[doc = "Checks if the value of the field is `LOW`"]
52    #[inline(always)]
53    pub fn is_low(&self) -> bool {
54        *self == WRBQOS_A::LOW
55    }
56    #[doc = "Checks if the value of the field is `MEDIUM`"]
57    #[inline(always)]
58    pub fn is_medium(&self) -> bool {
59        *self == WRBQOS_A::MEDIUM
60    }
61    #[doc = "Checks if the value of the field is `HIGH`"]
62    #[inline(always)]
63    pub fn is_high(&self) -> bool {
64        *self == WRBQOS_A::HIGH
65    }
66}
67#[doc = "Write proxy for field `WRBQOS`"]
68pub struct WRBQOS_W<'a> {
69    w: &'a mut W,
70}
71impl<'a> WRBQOS_W<'a> {
72    #[doc = r"Writes `variant` to the field"]
73    #[inline(always)]
74    pub fn variant(self, variant: WRBQOS_A) -> &'a mut W {
75        {
76            self.bits(variant.into())
77        }
78    }
79    #[doc = "Background (no sensitive operation)"]
80    #[inline(always)]
81    pub fn disable(self) -> &'a mut W {
82        self.variant(WRBQOS_A::DISABLE)
83    }
84    #[doc = "Sensitive Bandwidth"]
85    #[inline(always)]
86    pub fn low(self) -> &'a mut W {
87        self.variant(WRBQOS_A::LOW)
88    }
89    #[doc = "Sensitive Latency"]
90    #[inline(always)]
91    pub fn medium(self) -> &'a mut W {
92        self.variant(WRBQOS_A::MEDIUM)
93    }
94    #[doc = "Critical Latency"]
95    #[inline(always)]
96    pub fn high(self) -> &'a mut W {
97        self.variant(WRBQOS_A::HIGH)
98    }
99    #[doc = r"Writes raw bits to the field"]
100    #[inline(always)]
101    pub fn bits(self, value: u8) -> &'a mut W {
102        self.w.bits = (self.w.bits & !0x03) | ((value as u8) & 0x03);
103        self.w
104    }
105}
106#[doc = "Fetch Quality of Service\n\nValue on reset: 1"]
107#[derive(Clone, Copy, Debug, PartialEq)]
108#[repr(u8)]
109pub enum FQOS_A {
110    #[doc = "0: Background (no sensitive operation)"]
111    DISABLE = 0,
112    #[doc = "1: Sensitive Bandwidth"]
113    LOW = 1,
114    #[doc = "2: Sensitive Latency"]
115    MEDIUM = 2,
116    #[doc = "3: Critical Latency"]
117    HIGH = 3,
118}
119impl From<FQOS_A> for u8 {
120    #[inline(always)]
121    fn from(variant: FQOS_A) -> Self {
122        variant as _
123    }
124}
125#[doc = "Reader of field `FQOS`"]
126pub type FQOS_R = crate::R<u8, FQOS_A>;
127impl FQOS_R {
128    #[doc = r"Get enumerated values variant"]
129    #[inline(always)]
130    pub fn variant(&self) -> FQOS_A {
131        match self.bits {
132            0 => FQOS_A::DISABLE,
133            1 => FQOS_A::LOW,
134            2 => FQOS_A::MEDIUM,
135            3 => FQOS_A::HIGH,
136            _ => unreachable!(),
137        }
138    }
139    #[doc = "Checks if the value of the field is `DISABLE`"]
140    #[inline(always)]
141    pub fn is_disable(&self) -> bool {
142        *self == FQOS_A::DISABLE
143    }
144    #[doc = "Checks if the value of the field is `LOW`"]
145    #[inline(always)]
146    pub fn is_low(&self) -> bool {
147        *self == FQOS_A::LOW
148    }
149    #[doc = "Checks if the value of the field is `MEDIUM`"]
150    #[inline(always)]
151    pub fn is_medium(&self) -> bool {
152        *self == FQOS_A::MEDIUM
153    }
154    #[doc = "Checks if the value of the field is `HIGH`"]
155    #[inline(always)]
156    pub fn is_high(&self) -> bool {
157        *self == FQOS_A::HIGH
158    }
159}
160#[doc = "Write proxy for field `FQOS`"]
161pub struct FQOS_W<'a> {
162    w: &'a mut W,
163}
164impl<'a> FQOS_W<'a> {
165    #[doc = r"Writes `variant` to the field"]
166    #[inline(always)]
167    pub fn variant(self, variant: FQOS_A) -> &'a mut W {
168        {
169            self.bits(variant.into())
170        }
171    }
172    #[doc = "Background (no sensitive operation)"]
173    #[inline(always)]
174    pub fn disable(self) -> &'a mut W {
175        self.variant(FQOS_A::DISABLE)
176    }
177    #[doc = "Sensitive Bandwidth"]
178    #[inline(always)]
179    pub fn low(self) -> &'a mut W {
180        self.variant(FQOS_A::LOW)
181    }
182    #[doc = "Sensitive Latency"]
183    #[inline(always)]
184    pub fn medium(self) -> &'a mut W {
185        self.variant(FQOS_A::MEDIUM)
186    }
187    #[doc = "Critical Latency"]
188    #[inline(always)]
189    pub fn high(self) -> &'a mut W {
190        self.variant(FQOS_A::HIGH)
191    }
192    #[doc = r"Writes raw bits to the field"]
193    #[inline(always)]
194    pub fn bits(self, value: u8) -> &'a mut W {
195        self.w.bits = (self.w.bits & !(0x03 << 2)) | (((value as u8) & 0x03) << 2);
196        self.w
197    }
198}
199#[doc = "Data Transfer Quality of Service\n\nValue on reset: 1"]
200#[derive(Clone, Copy, Debug, PartialEq)]
201#[repr(u8)]
202pub enum DQOS_A {
203    #[doc = "0: Background (no sensitive operation)"]
204    DISABLE = 0,
205    #[doc = "1: Sensitive Bandwidth"]
206    LOW = 1,
207    #[doc = "2: Sensitive Latency"]
208    MEDIUM = 2,
209    #[doc = "3: Critical Latency"]
210    HIGH = 3,
211}
212impl From<DQOS_A> for u8 {
213    #[inline(always)]
214    fn from(variant: DQOS_A) -> Self {
215        variant as _
216    }
217}
218#[doc = "Reader of field `DQOS`"]
219pub type DQOS_R = crate::R<u8, DQOS_A>;
220impl DQOS_R {
221    #[doc = r"Get enumerated values variant"]
222    #[inline(always)]
223    pub fn variant(&self) -> DQOS_A {
224        match self.bits {
225            0 => DQOS_A::DISABLE,
226            1 => DQOS_A::LOW,
227            2 => DQOS_A::MEDIUM,
228            3 => DQOS_A::HIGH,
229            _ => unreachable!(),
230        }
231    }
232    #[doc = "Checks if the value of the field is `DISABLE`"]
233    #[inline(always)]
234    pub fn is_disable(&self) -> bool {
235        *self == DQOS_A::DISABLE
236    }
237    #[doc = "Checks if the value of the field is `LOW`"]
238    #[inline(always)]
239    pub fn is_low(&self) -> bool {
240        *self == DQOS_A::LOW
241    }
242    #[doc = "Checks if the value of the field is `MEDIUM`"]
243    #[inline(always)]
244    pub fn is_medium(&self) -> bool {
245        *self == DQOS_A::MEDIUM
246    }
247    #[doc = "Checks if the value of the field is `HIGH`"]
248    #[inline(always)]
249    pub fn is_high(&self) -> bool {
250        *self == DQOS_A::HIGH
251    }
252}
253#[doc = "Write proxy for field `DQOS`"]
254pub struct DQOS_W<'a> {
255    w: &'a mut W,
256}
257impl<'a> DQOS_W<'a> {
258    #[doc = r"Writes `variant` to the field"]
259    #[inline(always)]
260    pub fn variant(self, variant: DQOS_A) -> &'a mut W {
261        {
262            self.bits(variant.into())
263        }
264    }
265    #[doc = "Background (no sensitive operation)"]
266    #[inline(always)]
267    pub fn disable(self) -> &'a mut W {
268        self.variant(DQOS_A::DISABLE)
269    }
270    #[doc = "Sensitive Bandwidth"]
271    #[inline(always)]
272    pub fn low(self) -> &'a mut W {
273        self.variant(DQOS_A::LOW)
274    }
275    #[doc = "Sensitive Latency"]
276    #[inline(always)]
277    pub fn medium(self) -> &'a mut W {
278        self.variant(DQOS_A::MEDIUM)
279    }
280    #[doc = "Critical Latency"]
281    #[inline(always)]
282    pub fn high(self) -> &'a mut W {
283        self.variant(DQOS_A::HIGH)
284    }
285    #[doc = r"Writes raw bits to the field"]
286    #[inline(always)]
287    pub fn bits(self, value: u8) -> &'a mut W {
288        self.w.bits = (self.w.bits & !(0x03 << 4)) | (((value as u8) & 0x03) << 4);
289        self.w
290    }
291}
292impl R {
293    #[doc = "Bits 0:1 - Write-Back Quality of Service"]
294    #[inline(always)]
295    pub fn wrbqos(&self) -> WRBQOS_R {
296        WRBQOS_R::new((self.bits & 0x03) as u8)
297    }
298    #[doc = "Bits 2:3 - Fetch Quality of Service"]
299    #[inline(always)]
300    pub fn fqos(&self) -> FQOS_R {
301        FQOS_R::new(((self.bits >> 2) & 0x03) as u8)
302    }
303    #[doc = "Bits 4:5 - Data Transfer Quality of Service"]
304    #[inline(always)]
305    pub fn dqos(&self) -> DQOS_R {
306        DQOS_R::new(((self.bits >> 4) & 0x03) as u8)
307    }
308}
309impl W {
310    #[doc = "Bits 0:1 - Write-Back Quality of Service"]
311    #[inline(always)]
312    pub fn wrbqos(&mut self) -> WRBQOS_W {
313        WRBQOS_W { w: self }
314    }
315    #[doc = "Bits 2:3 - Fetch Quality of Service"]
316    #[inline(always)]
317    pub fn fqos(&mut self) -> FQOS_W {
318        FQOS_W { w: self }
319    }
320    #[doc = "Bits 4:5 - Data Transfer Quality of Service"]
321    #[inline(always)]
322    pub fn dqos(&mut self) -> DQOS_W {
323        DQOS_W { w: self }
324    }
325}