efm32tg11b540_pac/prs/
tracectrl.rs

1#[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    #[doc = "6: PRS ch 6 is controlling TSTART."]
58    PRSCH6 = 6,
59    #[doc = "7: PRS ch 7 is controlling TSTART."]
60    PRSCH7 = 7,
61}
62impl From<TSTART_A> for u8 {
63    #[inline(always)]
64    fn from(variant: TSTART_A) -> Self {
65        variant as _
66    }
67}
68#[doc = "Field `TSTART` reader - MTB TSTART PRS Select"]
69pub type TSTART_R = crate::FieldReader<u8, TSTART_A>;
70impl TSTART_R {
71    #[doc = "Get enumerated values variant"]
72    #[inline(always)]
73    pub fn variant(&self) -> TSTART_A {
74        match self.bits {
75            0 => TSTART_A::PRSCH0,
76            1 => TSTART_A::PRSCH1,
77            2 => TSTART_A::PRSCH2,
78            3 => TSTART_A::PRSCH3,
79            4 => TSTART_A::PRSCH4,
80            5 => TSTART_A::PRSCH5,
81            6 => TSTART_A::PRSCH6,
82            7 => TSTART_A::PRSCH7,
83            _ => unreachable!(),
84        }
85    }
86    #[doc = "Checks if the value of the field is `PRSCH0`"]
87    #[inline(always)]
88    pub fn is_prsch0(&self) -> bool {
89        *self == TSTART_A::PRSCH0
90    }
91    #[doc = "Checks if the value of the field is `PRSCH1`"]
92    #[inline(always)]
93    pub fn is_prsch1(&self) -> bool {
94        *self == TSTART_A::PRSCH1
95    }
96    #[doc = "Checks if the value of the field is `PRSCH2`"]
97    #[inline(always)]
98    pub fn is_prsch2(&self) -> bool {
99        *self == TSTART_A::PRSCH2
100    }
101    #[doc = "Checks if the value of the field is `PRSCH3`"]
102    #[inline(always)]
103    pub fn is_prsch3(&self) -> bool {
104        *self == TSTART_A::PRSCH3
105    }
106    #[doc = "Checks if the value of the field is `PRSCH4`"]
107    #[inline(always)]
108    pub fn is_prsch4(&self) -> bool {
109        *self == TSTART_A::PRSCH4
110    }
111    #[doc = "Checks if the value of the field is `PRSCH5`"]
112    #[inline(always)]
113    pub fn is_prsch5(&self) -> bool {
114        *self == TSTART_A::PRSCH5
115    }
116    #[doc = "Checks if the value of the field is `PRSCH6`"]
117    #[inline(always)]
118    pub fn is_prsch6(&self) -> bool {
119        *self == TSTART_A::PRSCH6
120    }
121    #[doc = "Checks if the value of the field is `PRSCH7`"]
122    #[inline(always)]
123    pub fn is_prsch7(&self) -> bool {
124        *self == TSTART_A::PRSCH7
125    }
126}
127#[doc = "Field `TSTART` writer - MTB TSTART PRS Select"]
128pub type TSTART_W<'a> = crate::FieldWriterSafe<'a, u32, TRACECTRL_SPEC, u8, TSTART_A, 3, 1>;
129impl<'a> TSTART_W<'a> {
130    #[doc = "PRS ch 0 is controlling TSTART."]
131    #[inline(always)]
132    pub fn prsch0(self) -> &'a mut W {
133        self.variant(TSTART_A::PRSCH0)
134    }
135    #[doc = "PRS ch 1 is controlling TSTART."]
136    #[inline(always)]
137    pub fn prsch1(self) -> &'a mut W {
138        self.variant(TSTART_A::PRSCH1)
139    }
140    #[doc = "PRS ch 2 is controlling TSTART."]
141    #[inline(always)]
142    pub fn prsch2(self) -> &'a mut W {
143        self.variant(TSTART_A::PRSCH2)
144    }
145    #[doc = "PRS ch 3 is controlling TSTART."]
146    #[inline(always)]
147    pub fn prsch3(self) -> &'a mut W {
148        self.variant(TSTART_A::PRSCH3)
149    }
150    #[doc = "PRS ch 4 is controlling TSTART."]
151    #[inline(always)]
152    pub fn prsch4(self) -> &'a mut W {
153        self.variant(TSTART_A::PRSCH4)
154    }
155    #[doc = "PRS ch 5 is controlling TSTART."]
156    #[inline(always)]
157    pub fn prsch5(self) -> &'a mut W {
158        self.variant(TSTART_A::PRSCH5)
159    }
160    #[doc = "PRS ch 6 is controlling TSTART."]
161    #[inline(always)]
162    pub fn prsch6(self) -> &'a mut W {
163        self.variant(TSTART_A::PRSCH6)
164    }
165    #[doc = "PRS ch 7 is controlling TSTART."]
166    #[inline(always)]
167    pub fn prsch7(self) -> &'a mut W {
168        self.variant(TSTART_A::PRSCH7)
169    }
170}
171#[doc = "Field `TSTOPEN` reader - PRS TSTOP Enable"]
172pub type TSTOPEN_R = crate::BitReader<bool>;
173#[doc = "Field `TSTOPEN` writer - PRS TSTOP Enable"]
174pub type TSTOPEN_W<'a> = crate::BitWriter<'a, u32, TRACECTRL_SPEC, bool, 8>;
175#[doc = "MTB TSTOP PRS Select\n\nValue on reset: 0"]
176#[derive(Clone, Copy, Debug, PartialEq)]
177#[repr(u8)]
178pub enum TSTOP_A {
179    #[doc = "0: PRS ch 0 is controlling TSTOP."]
180    PRSCH0 = 0,
181    #[doc = "1: PRS ch 1 is controlling TSTOP."]
182    PRSCH1 = 1,
183    #[doc = "2: PRS ch 2 is controlling TSTOP."]
184    PRSCH2 = 2,
185    #[doc = "3: PRS ch 3 is controlling TSTOP."]
186    PRSCH3 = 3,
187    #[doc = "4: PRS ch 4 is controlling TSTOP."]
188    PRSCH4 = 4,
189    #[doc = "5: PRS ch 5 is controlling TSTOP."]
190    PRSCH5 = 5,
191    #[doc = "6: PRS ch 6 is controlling TSTOP."]
192    PRSCH6 = 6,
193    #[doc = "7: PRS ch 7 is controlling TSTOP."]
194    PRSCH7 = 7,
195}
196impl From<TSTOP_A> for u8 {
197    #[inline(always)]
198    fn from(variant: TSTOP_A) -> Self {
199        variant as _
200    }
201}
202#[doc = "Field `TSTOP` reader - MTB TSTOP PRS Select"]
203pub type TSTOP_R = crate::FieldReader<u8, TSTOP_A>;
204impl TSTOP_R {
205    #[doc = "Get enumerated values variant"]
206    #[inline(always)]
207    pub fn variant(&self) -> TSTOP_A {
208        match self.bits {
209            0 => TSTOP_A::PRSCH0,
210            1 => TSTOP_A::PRSCH1,
211            2 => TSTOP_A::PRSCH2,
212            3 => TSTOP_A::PRSCH3,
213            4 => TSTOP_A::PRSCH4,
214            5 => TSTOP_A::PRSCH5,
215            6 => TSTOP_A::PRSCH6,
216            7 => TSTOP_A::PRSCH7,
217            _ => unreachable!(),
218        }
219    }
220    #[doc = "Checks if the value of the field is `PRSCH0`"]
221    #[inline(always)]
222    pub fn is_prsch0(&self) -> bool {
223        *self == TSTOP_A::PRSCH0
224    }
225    #[doc = "Checks if the value of the field is `PRSCH1`"]
226    #[inline(always)]
227    pub fn is_prsch1(&self) -> bool {
228        *self == TSTOP_A::PRSCH1
229    }
230    #[doc = "Checks if the value of the field is `PRSCH2`"]
231    #[inline(always)]
232    pub fn is_prsch2(&self) -> bool {
233        *self == TSTOP_A::PRSCH2
234    }
235    #[doc = "Checks if the value of the field is `PRSCH3`"]
236    #[inline(always)]
237    pub fn is_prsch3(&self) -> bool {
238        *self == TSTOP_A::PRSCH3
239    }
240    #[doc = "Checks if the value of the field is `PRSCH4`"]
241    #[inline(always)]
242    pub fn is_prsch4(&self) -> bool {
243        *self == TSTOP_A::PRSCH4
244    }
245    #[doc = "Checks if the value of the field is `PRSCH5`"]
246    #[inline(always)]
247    pub fn is_prsch5(&self) -> bool {
248        *self == TSTOP_A::PRSCH5
249    }
250    #[doc = "Checks if the value of the field is `PRSCH6`"]
251    #[inline(always)]
252    pub fn is_prsch6(&self) -> bool {
253        *self == TSTOP_A::PRSCH6
254    }
255    #[doc = "Checks if the value of the field is `PRSCH7`"]
256    #[inline(always)]
257    pub fn is_prsch7(&self) -> bool {
258        *self == TSTOP_A::PRSCH7
259    }
260}
261#[doc = "Field `TSTOP` writer - MTB TSTOP PRS Select"]
262pub type TSTOP_W<'a> = crate::FieldWriterSafe<'a, u32, TRACECTRL_SPEC, u8, TSTOP_A, 3, 9>;
263impl<'a> TSTOP_W<'a> {
264    #[doc = "PRS ch 0 is controlling TSTOP."]
265    #[inline(always)]
266    pub fn prsch0(self) -> &'a mut W {
267        self.variant(TSTOP_A::PRSCH0)
268    }
269    #[doc = "PRS ch 1 is controlling TSTOP."]
270    #[inline(always)]
271    pub fn prsch1(self) -> &'a mut W {
272        self.variant(TSTOP_A::PRSCH1)
273    }
274    #[doc = "PRS ch 2 is controlling TSTOP."]
275    #[inline(always)]
276    pub fn prsch2(self) -> &'a mut W {
277        self.variant(TSTOP_A::PRSCH2)
278    }
279    #[doc = "PRS ch 3 is controlling TSTOP."]
280    #[inline(always)]
281    pub fn prsch3(self) -> &'a mut W {
282        self.variant(TSTOP_A::PRSCH3)
283    }
284    #[doc = "PRS ch 4 is controlling TSTOP."]
285    #[inline(always)]
286    pub fn prsch4(self) -> &'a mut W {
287        self.variant(TSTOP_A::PRSCH4)
288    }
289    #[doc = "PRS ch 5 is controlling TSTOP."]
290    #[inline(always)]
291    pub fn prsch5(self) -> &'a mut W {
292        self.variant(TSTOP_A::PRSCH5)
293    }
294    #[doc = "PRS ch 6 is controlling TSTOP."]
295    #[inline(always)]
296    pub fn prsch6(self) -> &'a mut W {
297        self.variant(TSTOP_A::PRSCH6)
298    }
299    #[doc = "PRS ch 7 is controlling TSTOP."]
300    #[inline(always)]
301    pub fn prsch7(self) -> &'a mut W {
302        self.variant(TSTOP_A::PRSCH7)
303    }
304}
305impl R {
306    #[doc = "Bit 0 - PRS TSTART Enable"]
307    #[inline(always)]
308    pub fn tstarten(&self) -> TSTARTEN_R {
309        TSTARTEN_R::new((self.bits & 1) != 0)
310    }
311    #[doc = "Bits 1:3 - MTB TSTART PRS Select"]
312    #[inline(always)]
313    pub fn tstart(&self) -> TSTART_R {
314        TSTART_R::new(((self.bits >> 1) & 7) as u8)
315    }
316    #[doc = "Bit 8 - PRS TSTOP Enable"]
317    #[inline(always)]
318    pub fn tstopen(&self) -> TSTOPEN_R {
319        TSTOPEN_R::new(((self.bits >> 8) & 1) != 0)
320    }
321    #[doc = "Bits 9:11 - MTB TSTOP PRS Select"]
322    #[inline(always)]
323    pub fn tstop(&self) -> TSTOP_R {
324        TSTOP_R::new(((self.bits >> 9) & 7) as u8)
325    }
326}
327impl W {
328    #[doc = "Bit 0 - PRS TSTART Enable"]
329    #[inline(always)]
330    pub fn tstarten(&mut self) -> TSTARTEN_W {
331        TSTARTEN_W::new(self)
332    }
333    #[doc = "Bits 1:3 - MTB TSTART PRS Select"]
334    #[inline(always)]
335    pub fn tstart(&mut self) -> TSTART_W {
336        TSTART_W::new(self)
337    }
338    #[doc = "Bit 8 - PRS TSTOP Enable"]
339    #[inline(always)]
340    pub fn tstopen(&mut self) -> TSTOPEN_W {
341        TSTOPEN_W::new(self)
342    }
343    #[doc = "Bits 9:11 - MTB TSTOP PRS Select"]
344    #[inline(always)]
345    pub fn tstop(&mut self) -> TSTOP_W {
346        TSTOP_W::new(self)
347    }
348    #[doc = "Writes raw bits to the register."]
349    #[inline(always)]
350    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
351        self.0.bits(bits);
352        self
353    }
354}
355#[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"]
356pub struct TRACECTRL_SPEC;
357impl crate::RegisterSpec for TRACECTRL_SPEC {
358    type Ux = u32;
359}
360#[doc = "`read()` method returns [tracectrl::R](R) reader structure"]
361impl crate::Readable for TRACECTRL_SPEC {
362    type Reader = R;
363}
364#[doc = "`write(|w| ..)` method takes [tracectrl::W](W) writer structure"]
365impl crate::Writable for TRACECTRL_SPEC {
366    type Writer = W;
367}
368#[doc = "`reset()` method sets TRACECTRL to value 0"]
369impl crate::Resettable for TRACECTRL_SPEC {
370    #[inline(always)]
371    fn reset_value() -> Self::Ux {
372        0
373    }
374}