efm32hg310_pac/prs/
tracectrl.rs1#[doc = "Register `TRACECTRL` reader"]
2pub struct R(crate::R<TRACECTRL_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<TRACECTRL_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<TRACECTRL_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<TRACECTRL_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `TRACECTRL` writer"]
17pub struct W(crate::W<TRACECTRL_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<TRACECTRL_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<TRACECTRL_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<TRACECTRL_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `TSTARTEN` reader - PRS TSTART Enable"]
38pub type TSTARTEN_R = crate::BitReader<bool>;
39#[doc = "Field `TSTARTEN` writer - PRS TSTART Enable"]
40pub type TSTARTEN_W<'a> = crate::BitWriter<'a, u32, TRACECTRL_SPEC, bool, 0>;
41#[doc = "MTB TSTART PRS select\n\nValue on reset: 0"]
42#[derive(Clone, Copy, Debug, PartialEq)]
43#[repr(u8)]
44pub enum TSTART_A {
45 #[doc = "0: PRS ch 0 is controlling TSTART."]
46 PRSCH0 = 0,
47 #[doc = "1: PRS ch 1 is controlling TSTART."]
48 PRSCH1 = 1,
49 #[doc = "2: PRS ch 2 is controlling TSTART."]
50 PRSCH2 = 2,
51 #[doc = "3: PRS ch 3 is controlling TSTART."]
52 PRSCH3 = 3,
53 #[doc = "4: PRS ch 4 is controlling TSTART."]
54 PRSCH4 = 4,
55 #[doc = "5: PRS ch 5 is controlling TSTART."]
56 PRSCH5 = 5,
57}
58impl From<TSTART_A> for u8 {
59 #[inline(always)]
60 fn from(variant: TSTART_A) -> Self {
61 variant as _
62 }
63}
64#[doc = "Field `TSTART` reader - MTB TSTART PRS select"]
65pub type TSTART_R = crate::FieldReader<u8, TSTART_A>;
66impl TSTART_R {
67 #[doc = "Get enumerated values variant"]
68 #[inline(always)]
69 pub fn variant(&self) -> Option<TSTART_A> {
70 match self.bits {
71 0 => Some(TSTART_A::PRSCH0),
72 1 => Some(TSTART_A::PRSCH1),
73 2 => Some(TSTART_A::PRSCH2),
74 3 => Some(TSTART_A::PRSCH3),
75 4 => Some(TSTART_A::PRSCH4),
76 5 => Some(TSTART_A::PRSCH5),
77 _ => None,
78 }
79 }
80 #[doc = "Checks if the value of the field is `PRSCH0`"]
81 #[inline(always)]
82 pub fn is_prsch0(&self) -> bool {
83 *self == TSTART_A::PRSCH0
84 }
85 #[doc = "Checks if the value of the field is `PRSCH1`"]
86 #[inline(always)]
87 pub fn is_prsch1(&self) -> bool {
88 *self == TSTART_A::PRSCH1
89 }
90 #[doc = "Checks if the value of the field is `PRSCH2`"]
91 #[inline(always)]
92 pub fn is_prsch2(&self) -> bool {
93 *self == TSTART_A::PRSCH2
94 }
95 #[doc = "Checks if the value of the field is `PRSCH3`"]
96 #[inline(always)]
97 pub fn is_prsch3(&self) -> bool {
98 *self == TSTART_A::PRSCH3
99 }
100 #[doc = "Checks if the value of the field is `PRSCH4`"]
101 #[inline(always)]
102 pub fn is_prsch4(&self) -> bool {
103 *self == TSTART_A::PRSCH4
104 }
105 #[doc = "Checks if the value of the field is `PRSCH5`"]
106 #[inline(always)]
107 pub fn is_prsch5(&self) -> bool {
108 *self == TSTART_A::PRSCH5
109 }
110}
111#[doc = "Field `TSTART` writer - MTB TSTART PRS select"]
112pub type TSTART_W<'a> = crate::FieldWriter<'a, u32, TRACECTRL_SPEC, u8, TSTART_A, 3, 1>;
113impl<'a> TSTART_W<'a> {
114 #[doc = "PRS ch 0 is controlling TSTART."]
115 #[inline(always)]
116 pub fn prsch0(self) -> &'a mut W {
117 self.variant(TSTART_A::PRSCH0)
118 }
119 #[doc = "PRS ch 1 is controlling TSTART."]
120 #[inline(always)]
121 pub fn prsch1(self) -> &'a mut W {
122 self.variant(TSTART_A::PRSCH1)
123 }
124 #[doc = "PRS ch 2 is controlling TSTART."]
125 #[inline(always)]
126 pub fn prsch2(self) -> &'a mut W {
127 self.variant(TSTART_A::PRSCH2)
128 }
129 #[doc = "PRS ch 3 is controlling TSTART."]
130 #[inline(always)]
131 pub fn prsch3(self) -> &'a mut W {
132 self.variant(TSTART_A::PRSCH3)
133 }
134 #[doc = "PRS ch 4 is controlling TSTART."]
135 #[inline(always)]
136 pub fn prsch4(self) -> &'a mut W {
137 self.variant(TSTART_A::PRSCH4)
138 }
139 #[doc = "PRS ch 5 is controlling TSTART."]
140 #[inline(always)]
141 pub fn prsch5(self) -> &'a mut W {
142 self.variant(TSTART_A::PRSCH5)
143 }
144}
145#[doc = "Field `TSTOPEN` reader - PRS TSTOP Enable"]
146pub type TSTOPEN_R = crate::BitReader<bool>;
147#[doc = "Field `TSTOPEN` writer - PRS TSTOP Enable"]
148pub type TSTOPEN_W<'a> = crate::BitWriter<'a, u32, TRACECTRL_SPEC, bool, 8>;
149#[doc = "MTB TSTOP PRS select\n\nValue on reset: 0"]
150#[derive(Clone, Copy, Debug, PartialEq)]
151#[repr(u8)]
152pub enum TSTOP_A {
153 #[doc = "0: PRS ch 0 is controlling TSTOP."]
154 PRSCH0 = 0,
155 #[doc = "1: PRS ch 1 is controlling TSTOP."]
156 PRSCH1 = 1,
157 #[doc = "2: PRS ch 2 is controlling TSTOP."]
158 PRSCH2 = 2,
159 #[doc = "3: PRS ch 3 is controlling TSTOP."]
160 PRSCH3 = 3,
161 #[doc = "4: PRS ch 4 is controlling TSTOP."]
162 PRSCH4 = 4,
163 #[doc = "5: PRS ch 5 is controlling TSTOP."]
164 PRSCH5 = 5,
165}
166impl From<TSTOP_A> for u8 {
167 #[inline(always)]
168 fn from(variant: TSTOP_A) -> Self {
169 variant as _
170 }
171}
172#[doc = "Field `TSTOP` reader - MTB TSTOP PRS select"]
173pub type TSTOP_R = crate::FieldReader<u8, TSTOP_A>;
174impl TSTOP_R {
175 #[doc = "Get enumerated values variant"]
176 #[inline(always)]
177 pub fn variant(&self) -> Option<TSTOP_A> {
178 match self.bits {
179 0 => Some(TSTOP_A::PRSCH0),
180 1 => Some(TSTOP_A::PRSCH1),
181 2 => Some(TSTOP_A::PRSCH2),
182 3 => Some(TSTOP_A::PRSCH3),
183 4 => Some(TSTOP_A::PRSCH4),
184 5 => Some(TSTOP_A::PRSCH5),
185 _ => None,
186 }
187 }
188 #[doc = "Checks if the value of the field is `PRSCH0`"]
189 #[inline(always)]
190 pub fn is_prsch0(&self) -> bool {
191 *self == TSTOP_A::PRSCH0
192 }
193 #[doc = "Checks if the value of the field is `PRSCH1`"]
194 #[inline(always)]
195 pub fn is_prsch1(&self) -> bool {
196 *self == TSTOP_A::PRSCH1
197 }
198 #[doc = "Checks if the value of the field is `PRSCH2`"]
199 #[inline(always)]
200 pub fn is_prsch2(&self) -> bool {
201 *self == TSTOP_A::PRSCH2
202 }
203 #[doc = "Checks if the value of the field is `PRSCH3`"]
204 #[inline(always)]
205 pub fn is_prsch3(&self) -> bool {
206 *self == TSTOP_A::PRSCH3
207 }
208 #[doc = "Checks if the value of the field is `PRSCH4`"]
209 #[inline(always)]
210 pub fn is_prsch4(&self) -> bool {
211 *self == TSTOP_A::PRSCH4
212 }
213 #[doc = "Checks if the value of the field is `PRSCH5`"]
214 #[inline(always)]
215 pub fn is_prsch5(&self) -> bool {
216 *self == TSTOP_A::PRSCH5
217 }
218}
219#[doc = "Field `TSTOP` writer - MTB TSTOP PRS select"]
220pub type TSTOP_W<'a> = crate::FieldWriter<'a, u32, TRACECTRL_SPEC, u8, TSTOP_A, 3, 9>;
221impl<'a> TSTOP_W<'a> {
222 #[doc = "PRS ch 0 is controlling TSTOP."]
223 #[inline(always)]
224 pub fn prsch0(self) -> &'a mut W {
225 self.variant(TSTOP_A::PRSCH0)
226 }
227 #[doc = "PRS ch 1 is controlling TSTOP."]
228 #[inline(always)]
229 pub fn prsch1(self) -> &'a mut W {
230 self.variant(TSTOP_A::PRSCH1)
231 }
232 #[doc = "PRS ch 2 is controlling TSTOP."]
233 #[inline(always)]
234 pub fn prsch2(self) -> &'a mut W {
235 self.variant(TSTOP_A::PRSCH2)
236 }
237 #[doc = "PRS ch 3 is controlling TSTOP."]
238 #[inline(always)]
239 pub fn prsch3(self) -> &'a mut W {
240 self.variant(TSTOP_A::PRSCH3)
241 }
242 #[doc = "PRS ch 4 is controlling TSTOP."]
243 #[inline(always)]
244 pub fn prsch4(self) -> &'a mut W {
245 self.variant(TSTOP_A::PRSCH4)
246 }
247 #[doc = "PRS ch 5 is controlling TSTOP."]
248 #[inline(always)]
249 pub fn prsch5(self) -> &'a mut W {
250 self.variant(TSTOP_A::PRSCH5)
251 }
252}
253impl R {
254 #[doc = "Bit 0 - PRS TSTART Enable"]
255 #[inline(always)]
256 pub fn tstarten(&self) -> TSTARTEN_R {
257 TSTARTEN_R::new((self.bits & 1) != 0)
258 }
259 #[doc = "Bits 1:3 - MTB TSTART PRS select"]
260 #[inline(always)]
261 pub fn tstart(&self) -> TSTART_R {
262 TSTART_R::new(((self.bits >> 1) & 7) as u8)
263 }
264 #[doc = "Bit 8 - PRS TSTOP Enable"]
265 #[inline(always)]
266 pub fn tstopen(&self) -> TSTOPEN_R {
267 TSTOPEN_R::new(((self.bits >> 8) & 1) != 0)
268 }
269 #[doc = "Bits 9:11 - MTB TSTOP PRS select"]
270 #[inline(always)]
271 pub fn tstop(&self) -> TSTOP_R {
272 TSTOP_R::new(((self.bits >> 9) & 7) as u8)
273 }
274}
275impl W {
276 #[doc = "Bit 0 - PRS TSTART Enable"]
277 #[inline(always)]
278 pub fn tstarten(&mut self) -> TSTARTEN_W {
279 TSTARTEN_W::new(self)
280 }
281 #[doc = "Bits 1:3 - MTB TSTART PRS select"]
282 #[inline(always)]
283 pub fn tstart(&mut self) -> TSTART_W {
284 TSTART_W::new(self)
285 }
286 #[doc = "Bit 8 - PRS TSTOP Enable"]
287 #[inline(always)]
288 pub fn tstopen(&mut self) -> TSTOPEN_W {
289 TSTOPEN_W::new(self)
290 }
291 #[doc = "Bits 9:11 - MTB TSTOP PRS select"]
292 #[inline(always)]
293 pub fn tstop(&mut self) -> TSTOP_W {
294 TSTOP_W::new(self)
295 }
296 #[doc = "Writes raw bits to the register."]
297 #[inline(always)]
298 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
299 self.0.bits(bits);
300 self
301 }
302}
303#[doc = "MTB Trace 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 [tracectrl](index.html) module"]
304pub struct TRACECTRL_SPEC;
305impl crate::RegisterSpec for TRACECTRL_SPEC {
306 type Ux = u32;
307}
308#[doc = "`read()` method returns [tracectrl::R](R) reader structure"]
309impl crate::Readable for TRACECTRL_SPEC {
310 type Reader = R;
311}
312#[doc = "`write(|w| ..)` method takes [tracectrl::W](W) writer structure"]
313impl crate::Writable for TRACECTRL_SPEC {
314 type Writer = W;
315}
316#[doc = "`reset()` method sets TRACECTRL to value 0"]
317impl crate::Resettable for TRACECTRL_SPEC {
318 #[inline(always)]
319 fn reset_value() -> Self::Ux {
320 0
321 }
322}