lpc82x_pac/mtb_sfr/
flow.rs

1#[doc = "Register `FLOW` reader"]
2pub struct R(crate::R<FLOW_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<FLOW_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<FLOW_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<FLOW_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `FLOW` writer"]
17pub struct W(crate::W<FLOW_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<FLOW_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<FLOW_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<FLOW_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `AUTOSTOP` reader - If this bit is 1 and WATERMARK is equal to POSITION.POINTER, then the MASTER.EN bit is automatically set to 0. This stops tracing."]
38pub struct AUTOSTOP_R(crate::FieldReader<bool, bool>);
39impl AUTOSTOP_R {
40    pub(crate) fn new(bits: bool) -> Self {
41        AUTOSTOP_R(crate::FieldReader::new(bits))
42    }
43}
44impl core::ops::Deref for AUTOSTOP_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 `AUTOSTOP` writer - If this bit is 1 and WATERMARK is equal to POSITION.POINTER, then the MASTER.EN bit is automatically set to 0. This stops tracing."]
52pub struct AUTOSTOP_W<'a> {
53    w: &'a mut W,
54}
55impl<'a> AUTOSTOP_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 `AUTOHALT` reader - If this bit is 1 and WATERMARK is equal to POSITION.POINTER, then the MASTER.HALTREQ bit is automatically set to 1. If the DBGEN signal is HIGH, the MTB asserts this halt request to the Cortex-M0+ processor by asserting the EDBGRQ signal."]
74pub struct AUTOHALT_R(crate::FieldReader<bool, bool>);
75impl AUTOHALT_R {
76    pub(crate) fn new(bits: bool) -> Self {
77        AUTOHALT_R(crate::FieldReader::new(bits))
78    }
79}
80impl core::ops::Deref for AUTOHALT_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 `AUTOHALT` writer - If this bit is 1 and WATERMARK is equal to POSITION.POINTER, then the MASTER.HALTREQ bit is automatically set to 1. If the DBGEN signal is HIGH, the MTB asserts this halt request to the Cortex-M0+ processor by asserting the EDBGRQ signal."]
88pub struct AUTOHALT_W<'a> {
89    w: &'a mut W,
90}
91impl<'a> AUTOHALT_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}
109#[doc = "Field `WATERMARK` reader - WATERMARK value. This field contains an address in the same format as the POSITION.POINTER field. When the POSITION.POINTER matches the WATERMARK field value, actions defined by the AUTOHALT and AUTOSTOP bits are performed."]
110pub struct WATERMARK_R(crate::FieldReader<u32, u32>);
111impl WATERMARK_R {
112    pub(crate) fn new(bits: u32) -> Self {
113        WATERMARK_R(crate::FieldReader::new(bits))
114    }
115}
116impl core::ops::Deref for WATERMARK_R {
117    type Target = crate::FieldReader<u32, u32>;
118    #[inline(always)]
119    fn deref(&self) -> &Self::Target {
120        &self.0
121    }
122}
123#[doc = "Field `WATERMARK` writer - WATERMARK value. This field contains an address in the same format as the POSITION.POINTER field. When the POSITION.POINTER matches the WATERMARK field value, actions defined by the AUTOHALT and AUTOSTOP bits are performed."]
124pub struct WATERMARK_W<'a> {
125    w: &'a mut W,
126}
127impl<'a> WATERMARK_W<'a> {
128    #[doc = r"Writes raw bits to the field"]
129    #[inline(always)]
130    pub unsafe fn bits(self, value: u32) -> &'a mut W {
131        self.w.bits = (self.w.bits & !(0x1fff_ffff << 3)) | ((value as u32 & 0x1fff_ffff) << 3);
132        self.w
133    }
134}
135impl R {
136    #[doc = "Bit 0 - If this bit is 1 and WATERMARK is equal to POSITION.POINTER, then the MASTER.EN bit is automatically set to 0. This stops tracing."]
137    #[inline(always)]
138    pub fn autostop(&self) -> AUTOSTOP_R {
139        AUTOSTOP_R::new((self.bits & 0x01) != 0)
140    }
141    #[doc = "Bit 1 - If this bit is 1 and WATERMARK is equal to POSITION.POINTER, then the MASTER.HALTREQ bit is automatically set to 1. If the DBGEN signal is HIGH, the MTB asserts this halt request to the Cortex-M0+ processor by asserting the EDBGRQ signal."]
142    #[inline(always)]
143    pub fn autohalt(&self) -> AUTOHALT_R {
144        AUTOHALT_R::new(((self.bits >> 1) & 0x01) != 0)
145    }
146    #[doc = "Bits 3:31 - WATERMARK value. This field contains an address in the same format as the POSITION.POINTER field. When the POSITION.POINTER matches the WATERMARK field value, actions defined by the AUTOHALT and AUTOSTOP bits are performed."]
147    #[inline(always)]
148    pub fn watermark(&self) -> WATERMARK_R {
149        WATERMARK_R::new(((self.bits >> 3) & 0x1fff_ffff) as u32)
150    }
151}
152impl W {
153    #[doc = "Bit 0 - If this bit is 1 and WATERMARK is equal to POSITION.POINTER, then the MASTER.EN bit is automatically set to 0. This stops tracing."]
154    #[inline(always)]
155    pub fn autostop(&mut self) -> AUTOSTOP_W {
156        AUTOSTOP_W { w: self }
157    }
158    #[doc = "Bit 1 - If this bit is 1 and WATERMARK is equal to POSITION.POINTER, then the MASTER.HALTREQ bit is automatically set to 1. If the DBGEN signal is HIGH, the MTB asserts this halt request to the Cortex-M0+ processor by asserting the EDBGRQ signal."]
159    #[inline(always)]
160    pub fn autohalt(&mut self) -> AUTOHALT_W {
161        AUTOHALT_W { w: self }
162    }
163    #[doc = "Bits 3:31 - WATERMARK value. This field contains an address in the same format as the POSITION.POINTER field. When the POSITION.POINTER matches the WATERMARK field value, actions defined by the AUTOHALT and AUTOSTOP bits are performed."]
164    #[inline(always)]
165    pub fn watermark(&mut self) -> WATERMARK_W {
166        WATERMARK_W { w: self }
167    }
168    #[doc = "Writes raw bits to the register."]
169    #[inline(always)]
170    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
171        self.0.bits(bits);
172        self
173    }
174}
175#[doc = "FLOW 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 [flow](index.html) module"]
176pub struct FLOW_SPEC;
177impl crate::RegisterSpec for FLOW_SPEC {
178    type Ux = u32;
179}
180#[doc = "`read()` method returns [flow::R](R) reader structure"]
181impl crate::Readable for FLOW_SPEC {
182    type Reader = R;
183}
184#[doc = "`write(|w| ..)` method takes [flow::W](W) writer structure"]
185impl crate::Writable for FLOW_SPEC {
186    type Writer = W;
187}
188#[doc = "`reset()` method sets FLOW to value 0"]
189impl crate::Resettable for FLOW_SPEC {
190    #[inline(always)]
191    fn reset_value() -> Self::Ux {
192        0
193    }
194}