atsamd21g/usb/host/
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 = "Configuration Quality of Service\n\nValue on reset: 1"]
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7#[repr(u8)]
8pub enum Cqosselect {
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<Cqosselect> for u8 {
19 #[inline(always)]
20 fn from(variant: Cqosselect) -> Self {
21 variant as _
22 }
23}
24impl crate::FieldSpec for Cqosselect {
25 type Ux = u8;
26}
27impl crate::IsEnum for Cqosselect {}
28#[doc = "Field `CQOS` reader - Configuration Quality of Service"]
29pub type CqosR = crate::FieldReader<Cqosselect>;
30impl CqosR {
31 #[doc = "Get enumerated values variant"]
32 #[inline(always)]
33 pub const fn variant(&self) -> Cqosselect {
34 match self.bits {
35 0 => Cqosselect::Disable,
36 1 => Cqosselect::Low,
37 2 => Cqosselect::Medium,
38 3 => Cqosselect::High,
39 _ => unreachable!(),
40 }
41 }
42 #[doc = "Background (no sensitive operation)"]
43 #[inline(always)]
44 pub fn is_disable(&self) -> bool {
45 *self == Cqosselect::Disable
46 }
47 #[doc = "Sensitive Bandwidth"]
48 #[inline(always)]
49 pub fn is_low(&self) -> bool {
50 *self == Cqosselect::Low
51 }
52 #[doc = "Sensitive Latency"]
53 #[inline(always)]
54 pub fn is_medium(&self) -> bool {
55 *self == Cqosselect::Medium
56 }
57 #[doc = "Critical Latency"]
58 #[inline(always)]
59 pub fn is_high(&self) -> bool {
60 *self == Cqosselect::High
61 }
62}
63#[doc = "Field `CQOS` writer - Configuration Quality of Service"]
64pub type CqosW<'a, REG> = crate::FieldWriter<'a, REG, 2, Cqosselect, crate::Safe>;
65impl<'a, REG> CqosW<'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(Cqosselect::Disable)
74 }
75 #[doc = "Sensitive Bandwidth"]
76 #[inline(always)]
77 pub fn low(self) -> &'a mut crate::W<REG> {
78 self.variant(Cqosselect::Low)
79 }
80 #[doc = "Sensitive Latency"]
81 #[inline(always)]
82 pub fn medium(self) -> &'a mut crate::W<REG> {
83 self.variant(Cqosselect::Medium)
84 }
85 #[doc = "Critical Latency"]
86 #[inline(always)]
87 pub fn high(self) -> &'a mut crate::W<REG> {
88 self.variant(Cqosselect::High)
89 }
90}
91#[doc = "Data Quality of Service\n\nValue on reset: 1"]
92#[derive(Clone, Copy, Debug, PartialEq, Eq)]
93#[repr(u8)]
94pub enum Dqosselect {
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<Dqosselect> for u8 {
105 #[inline(always)]
106 fn from(variant: Dqosselect) -> Self {
107 variant as _
108 }
109}
110impl crate::FieldSpec for Dqosselect {
111 type Ux = u8;
112}
113impl crate::IsEnum for Dqosselect {}
114#[doc = "Field `DQOS` reader - Data Quality of Service"]
115pub type DqosR = crate::FieldReader<Dqosselect>;
116impl DqosR {
117 #[doc = "Get enumerated values variant"]
118 #[inline(always)]
119 pub const fn variant(&self) -> Dqosselect {
120 match self.bits {
121 0 => Dqosselect::Disable,
122 1 => Dqosselect::Low,
123 2 => Dqosselect::Medium,
124 3 => Dqosselect::High,
125 _ => unreachable!(),
126 }
127 }
128 #[doc = "Background (no sensitive operation)"]
129 #[inline(always)]
130 pub fn is_disable(&self) -> bool {
131 *self == Dqosselect::Disable
132 }
133 #[doc = "Sensitive Bandwidth"]
134 #[inline(always)]
135 pub fn is_low(&self) -> bool {
136 *self == Dqosselect::Low
137 }
138 #[doc = "Sensitive Latency"]
139 #[inline(always)]
140 pub fn is_medium(&self) -> bool {
141 *self == Dqosselect::Medium
142 }
143 #[doc = "Critical Latency"]
144 #[inline(always)]
145 pub fn is_high(&self) -> bool {
146 *self == Dqosselect::High
147 }
148}
149#[doc = "Field `DQOS` writer - Data Quality of Service"]
150pub type DqosW<'a, REG> = crate::FieldWriter<'a, REG, 2, Dqosselect, crate::Safe>;
151impl<'a, REG> DqosW<'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(Dqosselect::Disable)
160 }
161 #[doc = "Sensitive Bandwidth"]
162 #[inline(always)]
163 pub fn low(self) -> &'a mut crate::W<REG> {
164 self.variant(Dqosselect::Low)
165 }
166 #[doc = "Sensitive Latency"]
167 #[inline(always)]
168 pub fn medium(self) -> &'a mut crate::W<REG> {
169 self.variant(Dqosselect::Medium)
170 }
171 #[doc = "Critical Latency"]
172 #[inline(always)]
173 pub fn high(self) -> &'a mut crate::W<REG> {
174 self.variant(Dqosselect::High)
175 }
176}
177impl R {
178 #[doc = "Bits 0:1 - Configuration Quality of Service"]
179 #[inline(always)]
180 pub fn cqos(&self) -> CqosR {
181 CqosR::new(self.bits & 3)
182 }
183 #[doc = "Bits 2:3 - Data Quality of Service"]
184 #[inline(always)]
185 pub fn dqos(&self) -> DqosR {
186 DqosR::new((self.bits >> 2) & 3)
187 }
188}
189impl W {
190 #[doc = "Bits 0:1 - Configuration Quality of Service"]
191 #[inline(always)]
192 #[must_use]
193 pub fn cqos(&mut self) -> CqosW<QosctrlSpec> {
194 CqosW::new(self, 0)
195 }
196 #[doc = "Bits 2:3 - Data Quality of Service"]
197 #[inline(always)]
198 #[must_use]
199 pub fn dqos(&mut self) -> DqosW<QosctrlSpec> {
200 DqosW::new(self, 2)
201 }
202}
203#[doc = "USB Quality Of Service\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)."]
204pub struct QosctrlSpec;
205impl crate::RegisterSpec for QosctrlSpec {
206 type Ux = u8;
207}
208#[doc = "`read()` method returns [`qosctrl::R`](R) reader structure"]
209impl crate::Readable for QosctrlSpec {}
210#[doc = "`write(|w| ..)` method takes [`qosctrl::W`](W) writer structure"]
211impl crate::Writable for QosctrlSpec {
212 type Safety = crate::Unsafe;
213 const ZERO_TO_MODIFY_FIELDS_BITMAP: u8 = 0;
214 const ONE_TO_MODIFY_FIELDS_BITMAP: u8 = 0;
215}
216#[doc = "`reset()` method sets QOSCTRL to value 0x05"]
217impl crate::Resettable for QosctrlSpec {
218 const RESET_VALUE: u8 = 0x05;
219}