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