atsamd11d/dmac/
qosctrl.rs

1#[doc = "Register `QOSCTRL` reader"]
2pub type R = crate::R<QosctrlSpec>;
3#[doc = "Register `QOSCTRL` writer"]
4pub type W = crate::W<QosctrlSpec>;
5#[doc = "Write-Back Quality of Service\n\nValue on reset: 1"]
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7#[repr(u8)]
8pub enum Wrbqosselect {
9    #[doc = "0: Background (no sensitive operation)"]
10    Disable = 0,
11    #[doc = "1: Sensitive Bandwidth"]
12    Low = 1,
13    #[doc = "2: Sensitive Latency"]
14    Medium = 2,
15    #[doc = "3: Critical Latency"]
16    High = 3,
17}
18impl From<Wrbqosselect> for u8 {
19    #[inline(always)]
20    fn from(variant: Wrbqosselect) -> Self {
21        variant as _
22    }
23}
24impl crate::FieldSpec for Wrbqosselect {
25    type Ux = u8;
26}
27impl crate::IsEnum for Wrbqosselect {}
28#[doc = "Field `WRBQOS` reader - Write-Back Quality of Service"]
29pub type WrbqosR = crate::FieldReader<Wrbqosselect>;
30impl WrbqosR {
31    #[doc = "Get enumerated values variant"]
32    #[inline(always)]
33    pub const fn variant(&self) -> Wrbqosselect {
34        match self.bits {
35            0 => Wrbqosselect::Disable,
36            1 => Wrbqosselect::Low,
37            2 => Wrbqosselect::Medium,
38            3 => Wrbqosselect::High,
39            _ => unreachable!(),
40        }
41    }
42    #[doc = "Background (no sensitive operation)"]
43    #[inline(always)]
44    pub fn is_disable(&self) -> bool {
45        *self == Wrbqosselect::Disable
46    }
47    #[doc = "Sensitive Bandwidth"]
48    #[inline(always)]
49    pub fn is_low(&self) -> bool {
50        *self == Wrbqosselect::Low
51    }
52    #[doc = "Sensitive Latency"]
53    #[inline(always)]
54    pub fn is_medium(&self) -> bool {
55        *self == Wrbqosselect::Medium
56    }
57    #[doc = "Critical Latency"]
58    #[inline(always)]
59    pub fn is_high(&self) -> bool {
60        *self == Wrbqosselect::High
61    }
62}
63#[doc = "Field `WRBQOS` writer - Write-Back Quality of Service"]
64pub type WrbqosW<'a, REG> = crate::FieldWriter<'a, REG, 2, Wrbqosselect, crate::Safe>;
65impl<'a, REG> WrbqosW<'a, REG>
66where
67    REG: crate::Writable + crate::RegisterSpec,
68    REG::Ux: From<u8>,
69{
70    #[doc = "Background (no sensitive operation)"]
71    #[inline(always)]
72    pub fn disable(self) -> &'a mut crate::W<REG> {
73        self.variant(Wrbqosselect::Disable)
74    }
75    #[doc = "Sensitive Bandwidth"]
76    #[inline(always)]
77    pub fn low(self) -> &'a mut crate::W<REG> {
78        self.variant(Wrbqosselect::Low)
79    }
80    #[doc = "Sensitive Latency"]
81    #[inline(always)]
82    pub fn medium(self) -> &'a mut crate::W<REG> {
83        self.variant(Wrbqosselect::Medium)
84    }
85    #[doc = "Critical Latency"]
86    #[inline(always)]
87    pub fn high(self) -> &'a mut crate::W<REG> {
88        self.variant(Wrbqosselect::High)
89    }
90}
91#[doc = "Fetch Quality of Service\n\nValue on reset: 1"]
92#[derive(Clone, Copy, Debug, PartialEq, Eq)]
93#[repr(u8)]
94pub enum Fqosselect {
95    #[doc = "0: Background (no sensitive operation)"]
96    Disable = 0,
97    #[doc = "1: Sensitive Bandwidth"]
98    Low = 1,
99    #[doc = "2: Sensitive Latency"]
100    Medium = 2,
101    #[doc = "3: Critical Latency"]
102    High = 3,
103}
104impl From<Fqosselect> for u8 {
105    #[inline(always)]
106    fn from(variant: Fqosselect) -> Self {
107        variant as _
108    }
109}
110impl crate::FieldSpec for Fqosselect {
111    type Ux = u8;
112}
113impl crate::IsEnum for Fqosselect {}
114#[doc = "Field `FQOS` reader - Fetch Quality of Service"]
115pub type FqosR = crate::FieldReader<Fqosselect>;
116impl FqosR {
117    #[doc = "Get enumerated values variant"]
118    #[inline(always)]
119    pub const fn variant(&self) -> Fqosselect {
120        match self.bits {
121            0 => Fqosselect::Disable,
122            1 => Fqosselect::Low,
123            2 => Fqosselect::Medium,
124            3 => Fqosselect::High,
125            _ => unreachable!(),
126        }
127    }
128    #[doc = "Background (no sensitive operation)"]
129    #[inline(always)]
130    pub fn is_disable(&self) -> bool {
131        *self == Fqosselect::Disable
132    }
133    #[doc = "Sensitive Bandwidth"]
134    #[inline(always)]
135    pub fn is_low(&self) -> bool {
136        *self == Fqosselect::Low
137    }
138    #[doc = "Sensitive Latency"]
139    #[inline(always)]
140    pub fn is_medium(&self) -> bool {
141        *self == Fqosselect::Medium
142    }
143    #[doc = "Critical Latency"]
144    #[inline(always)]
145    pub fn is_high(&self) -> bool {
146        *self == Fqosselect::High
147    }
148}
149#[doc = "Field `FQOS` writer - Fetch Quality of Service"]
150pub type FqosW<'a, REG> = crate::FieldWriter<'a, REG, 2, Fqosselect, crate::Safe>;
151impl<'a, REG> FqosW<'a, REG>
152where
153    REG: crate::Writable + crate::RegisterSpec,
154    REG::Ux: From<u8>,
155{
156    #[doc = "Background (no sensitive operation)"]
157    #[inline(always)]
158    pub fn disable(self) -> &'a mut crate::W<REG> {
159        self.variant(Fqosselect::Disable)
160    }
161    #[doc = "Sensitive Bandwidth"]
162    #[inline(always)]
163    pub fn low(self) -> &'a mut crate::W<REG> {
164        self.variant(Fqosselect::Low)
165    }
166    #[doc = "Sensitive Latency"]
167    #[inline(always)]
168    pub fn medium(self) -> &'a mut crate::W<REG> {
169        self.variant(Fqosselect::Medium)
170    }
171    #[doc = "Critical Latency"]
172    #[inline(always)]
173    pub fn high(self) -> &'a mut crate::W<REG> {
174        self.variant(Fqosselect::High)
175    }
176}
177#[doc = "Data Transfer Quality of Service\n\nValue on reset: 1"]
178#[derive(Clone, Copy, Debug, PartialEq, Eq)]
179#[repr(u8)]
180pub enum Dqosselect {
181    #[doc = "0: Background (no sensitive operation)"]
182    Disable = 0,
183    #[doc = "1: Sensitive Bandwidth"]
184    Low = 1,
185    #[doc = "2: Sensitive Latency"]
186    Medium = 2,
187    #[doc = "3: Critical Latency"]
188    High = 3,
189}
190impl From<Dqosselect> for u8 {
191    #[inline(always)]
192    fn from(variant: Dqosselect) -> Self {
193        variant as _
194    }
195}
196impl crate::FieldSpec for Dqosselect {
197    type Ux = u8;
198}
199impl crate::IsEnum for Dqosselect {}
200#[doc = "Field `DQOS` reader - Data Transfer Quality of Service"]
201pub type DqosR = crate::FieldReader<Dqosselect>;
202impl DqosR {
203    #[doc = "Get enumerated values variant"]
204    #[inline(always)]
205    pub const fn variant(&self) -> Dqosselect {
206        match self.bits {
207            0 => Dqosselect::Disable,
208            1 => Dqosselect::Low,
209            2 => Dqosselect::Medium,
210            3 => Dqosselect::High,
211            _ => unreachable!(),
212        }
213    }
214    #[doc = "Background (no sensitive operation)"]
215    #[inline(always)]
216    pub fn is_disable(&self) -> bool {
217        *self == Dqosselect::Disable
218    }
219    #[doc = "Sensitive Bandwidth"]
220    #[inline(always)]
221    pub fn is_low(&self) -> bool {
222        *self == Dqosselect::Low
223    }
224    #[doc = "Sensitive Latency"]
225    #[inline(always)]
226    pub fn is_medium(&self) -> bool {
227        *self == Dqosselect::Medium
228    }
229    #[doc = "Critical Latency"]
230    #[inline(always)]
231    pub fn is_high(&self) -> bool {
232        *self == Dqosselect::High
233    }
234}
235#[doc = "Field `DQOS` writer - Data Transfer Quality of Service"]
236pub type DqosW<'a, REG> = crate::FieldWriter<'a, REG, 2, Dqosselect, crate::Safe>;
237impl<'a, REG> DqosW<'a, REG>
238where
239    REG: crate::Writable + crate::RegisterSpec,
240    REG::Ux: From<u8>,
241{
242    #[doc = "Background (no sensitive operation)"]
243    #[inline(always)]
244    pub fn disable(self) -> &'a mut crate::W<REG> {
245        self.variant(Dqosselect::Disable)
246    }
247    #[doc = "Sensitive Bandwidth"]
248    #[inline(always)]
249    pub fn low(self) -> &'a mut crate::W<REG> {
250        self.variant(Dqosselect::Low)
251    }
252    #[doc = "Sensitive Latency"]
253    #[inline(always)]
254    pub fn medium(self) -> &'a mut crate::W<REG> {
255        self.variant(Dqosselect::Medium)
256    }
257    #[doc = "Critical Latency"]
258    #[inline(always)]
259    pub fn high(self) -> &'a mut crate::W<REG> {
260        self.variant(Dqosselect::High)
261    }
262}
263impl R {
264    #[doc = "Bits 0:1 - Write-Back Quality of Service"]
265    #[inline(always)]
266    pub fn wrbqos(&self) -> WrbqosR {
267        WrbqosR::new(self.bits & 3)
268    }
269    #[doc = "Bits 2:3 - Fetch Quality of Service"]
270    #[inline(always)]
271    pub fn fqos(&self) -> FqosR {
272        FqosR::new((self.bits >> 2) & 3)
273    }
274    #[doc = "Bits 4:5 - Data Transfer Quality of Service"]
275    #[inline(always)]
276    pub fn dqos(&self) -> DqosR {
277        DqosR::new((self.bits >> 4) & 3)
278    }
279}
280impl W {
281    #[doc = "Bits 0:1 - Write-Back Quality of Service"]
282    #[inline(always)]
283    #[must_use]
284    pub fn wrbqos(&mut self) -> WrbqosW<QosctrlSpec> {
285        WrbqosW::new(self, 0)
286    }
287    #[doc = "Bits 2:3 - Fetch Quality of Service"]
288    #[inline(always)]
289    #[must_use]
290    pub fn fqos(&mut self) -> FqosW<QosctrlSpec> {
291        FqosW::new(self, 2)
292    }
293    #[doc = "Bits 4:5 - Data Transfer Quality of Service"]
294    #[inline(always)]
295    #[must_use]
296    pub fn dqos(&mut self) -> DqosW<QosctrlSpec> {
297        DqosW::new(self, 4)
298    }
299}
300#[doc = "QOS Control\n\nYou can [`read`](crate::Reg::read) this register and get [`qosctrl::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`qosctrl::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
301pub struct QosctrlSpec;
302impl crate::RegisterSpec for QosctrlSpec {
303    type Ux = u8;
304}
305#[doc = "`read()` method returns [`qosctrl::R`](R) reader structure"]
306impl crate::Readable for QosctrlSpec {}
307#[doc = "`write(|w| ..)` method takes [`qosctrl::W`](W) writer structure"]
308impl crate::Writable for QosctrlSpec {
309    type Safety = crate::Unsafe;
310    const ZERO_TO_MODIFY_FIELDS_BITMAP: u8 = 0;
311    const ONE_TO_MODIFY_FIELDS_BITMAP: u8 = 0;
312}
313#[doc = "`reset()` method sets QOSCTRL to value 0x15"]
314impl crate::Resettable for QosctrlSpec {
315    const RESET_VALUE: u8 = 0x15;
316}