lpc82x_pac/syscon/
exttracecmd.rs

1#[doc = "Register `EXTTRACECMD` reader"]
2pub struct R(crate::R<EXTTRACECMD_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<EXTTRACECMD_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<EXTTRACECMD_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<EXTTRACECMD_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `EXTTRACECMD` writer"]
17pub struct W(crate::W<EXTTRACECMD_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<EXTTRACECMD_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<EXTTRACECMD_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<EXTTRACECMD_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `START` reader - Trace start command. Writing a one to this bit sets the TSTART signal to the MTB to HIGH and starts tracing if the TSTARTEN bit in the MTB master register is set to one as well."]
38pub struct START_R(crate::FieldReader<bool, bool>);
39impl START_R {
40    pub(crate) fn new(bits: bool) -> Self {
41        START_R(crate::FieldReader::new(bits))
42    }
43}
44impl core::ops::Deref for START_R {
45    type Target = crate::FieldReader<bool, bool>;
46    #[inline(always)]
47    fn deref(&self) -> &Self::Target {
48        &self.0
49    }
50}
51#[doc = "Field `START` writer - Trace start command. Writing a one to this bit sets the TSTART signal to the MTB to HIGH and starts tracing if the TSTARTEN bit in the MTB master register is set to one as well."]
52pub struct START_W<'a> {
53    w: &'a mut W,
54}
55impl<'a> START_W<'a> {
56    #[doc = r"Sets the field bit"]
57    #[inline(always)]
58    pub fn set_bit(self) -> &'a mut W {
59        self.bit(true)
60    }
61    #[doc = r"Clears the field bit"]
62    #[inline(always)]
63    pub fn clear_bit(self) -> &'a mut W {
64        self.bit(false)
65    }
66    #[doc = r"Writes raw bits to the field"]
67    #[inline(always)]
68    pub fn bit(self, value: bool) -> &'a mut W {
69        self.w.bits = (self.w.bits & !0x01) | (value as u32 & 0x01);
70        self.w
71    }
72}
73#[doc = "Field `STOP` reader - Trace stop command. Writing a one to this bit sets the TSTOP signal in the MTB to HIGH and stops tracing if the TSTOPEN bit in the MTB master register is set to one as well."]
74pub struct STOP_R(crate::FieldReader<bool, bool>);
75impl STOP_R {
76    pub(crate) fn new(bits: bool) -> Self {
77        STOP_R(crate::FieldReader::new(bits))
78    }
79}
80impl core::ops::Deref for STOP_R {
81    type Target = crate::FieldReader<bool, bool>;
82    #[inline(always)]
83    fn deref(&self) -> &Self::Target {
84        &self.0
85    }
86}
87#[doc = "Field `STOP` writer - Trace stop command. Writing a one to this bit sets the TSTOP signal in the MTB to HIGH and stops tracing if the TSTOPEN bit in the MTB master register is set to one as well."]
88pub struct STOP_W<'a> {
89    w: &'a mut W,
90}
91impl<'a> STOP_W<'a> {
92    #[doc = r"Sets the field bit"]
93    #[inline(always)]
94    pub fn set_bit(self) -> &'a mut W {
95        self.bit(true)
96    }
97    #[doc = r"Clears the field bit"]
98    #[inline(always)]
99    pub fn clear_bit(self) -> &'a mut W {
100        self.bit(false)
101    }
102    #[doc = r"Writes raw bits to the field"]
103    #[inline(always)]
104    pub fn bit(self, value: bool) -> &'a mut W {
105        self.w.bits = (self.w.bits & !(0x01 << 1)) | ((value as u32 & 0x01) << 1);
106        self.w
107    }
108}
109impl R {
110    #[doc = "Bit 0 - Trace start command. Writing a one to this bit sets the TSTART signal to the MTB to HIGH and starts tracing if the TSTARTEN bit in the MTB master register is set to one as well."]
111    #[inline(always)]
112    pub fn start(&self) -> START_R {
113        START_R::new((self.bits & 0x01) != 0)
114    }
115    #[doc = "Bit 1 - Trace stop command. Writing a one to this bit sets the TSTOP signal in the MTB to HIGH and stops tracing if the TSTOPEN bit in the MTB master register is set to one as well."]
116    #[inline(always)]
117    pub fn stop(&self) -> STOP_R {
118        STOP_R::new(((self.bits >> 1) & 0x01) != 0)
119    }
120}
121impl W {
122    #[doc = "Bit 0 - Trace start command. Writing a one to this bit sets the TSTART signal to the MTB to HIGH and starts tracing if the TSTARTEN bit in the MTB master register is set to one as well."]
123    #[inline(always)]
124    pub fn start(&mut self) -> START_W {
125        START_W { w: self }
126    }
127    #[doc = "Bit 1 - Trace stop command. Writing a one to this bit sets the TSTOP signal in the MTB to HIGH and stops tracing if the TSTOPEN bit in the MTB master register is set to one as well."]
128    #[inline(always)]
129    pub fn stop(&mut self) -> STOP_W {
130        STOP_W { w: self }
131    }
132    #[doc = "Writes raw bits to the register."]
133    #[inline(always)]
134    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
135        self.0.bits(bits);
136        self
137    }
138}
139#[doc = "External trace buffer command 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 [exttracecmd](index.html) module"]
140pub struct EXTTRACECMD_SPEC;
141impl crate::RegisterSpec for EXTTRACECMD_SPEC {
142    type Ux = u32;
143}
144#[doc = "`read()` method returns [exttracecmd::R](R) reader structure"]
145impl crate::Readable for EXTTRACECMD_SPEC {
146    type Reader = R;
147}
148#[doc = "`write(|w| ..)` method takes [exttracecmd::W](W) writer structure"]
149impl crate::Writable for EXTTRACECMD_SPEC {
150    type Writer = W;
151}
152#[doc = "`reset()` method sets EXTTRACECMD to value 0"]
153impl crate::Resettable for EXTTRACECMD_SPEC {
154    #[inline(always)]
155    fn reset_value() -> Self::Ux {
156        0
157    }
158}