lpc82x_pac/mtb_sfr/
position.rs1#[doc = "Register `POSITION` reader"]
2pub struct R(crate::R<POSITION_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<POSITION_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<POSITION_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<POSITION_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `POSITION` writer"]
17pub struct W(crate::W<POSITION_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<POSITION_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<POSITION_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<POSITION_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `WRAP` reader - This bit is set to 1 automatically when the POINTER value wraps as determined by the MASTER.MASK field in the MASTER Trace Control Register."]
38pub struct WRAP_R(crate::FieldReader<bool, bool>);
39impl WRAP_R {
40 pub(crate) fn new(bits: bool) -> Self {
41 WRAP_R(crate::FieldReader::new(bits))
42 }
43}
44impl core::ops::Deref for WRAP_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 `WRAP` writer - This bit is set to 1 automatically when the POINTER value wraps as determined by the MASTER.MASK field in the MASTER Trace Control Register."]
52pub struct WRAP_W<'a> {
53 w: &'a mut W,
54}
55impl<'a> WRAP_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 << 2)) | ((value as u32 & 0x01) << 2);
70 self.w
71 }
72}
73#[doc = "Field `POINTER` reader - Trace packet location pointer. Because a packet consists of two words, the POINTER field is the location of the first word of a packet. This field contains bits \\[31:3\\]
74of the address, in the SRAM, where the next trace packet will be written. The field points to an unused location and is automatically incremented. A debug agent can calculate the system address, on the AHB-Lite bus, of the SRAM location pointed to by the POSITION register using the following equation: system address = BASE + ((P + (2AWIDTH - (BASE MOD 2AWIDTH))) MOD 2AWIDTH). Where P = POSITION AND 0xFFFF_FFF8. Where BASE is the BASE register value"]
75pub struct POINTER_R(crate::FieldReader<u32, u32>);
76impl POINTER_R {
77 pub(crate) fn new(bits: u32) -> Self {
78 POINTER_R(crate::FieldReader::new(bits))
79 }
80}
81impl core::ops::Deref for POINTER_R {
82 type Target = crate::FieldReader<u32, u32>;
83 #[inline(always)]
84 fn deref(&self) -> &Self::Target {
85 &self.0
86 }
87}
88#[doc = "Field `POINTER` writer - Trace packet location pointer. Because a packet consists of two words, the POINTER field is the location of the first word of a packet. This field contains bits \\[31:3\\]
89of the address, in the SRAM, where the next trace packet will be written. The field points to an unused location and is automatically incremented. A debug agent can calculate the system address, on the AHB-Lite bus, of the SRAM location pointed to by the POSITION register using the following equation: system address = BASE + ((P + (2AWIDTH - (BASE MOD 2AWIDTH))) MOD 2AWIDTH). Where P = POSITION AND 0xFFFF_FFF8. Where BASE is the BASE register value"]
90pub struct POINTER_W<'a> {
91 w: &'a mut W,
92}
93impl<'a> POINTER_W<'a> {
94 #[doc = r"Writes raw bits to the field"]
95 #[inline(always)]
96 pub unsafe fn bits(self, value: u32) -> &'a mut W {
97 self.w.bits = (self.w.bits & !(0x1fff_ffff << 3)) | ((value as u32 & 0x1fff_ffff) << 3);
98 self.w
99 }
100}
101impl R {
102 #[doc = "Bit 2 - This bit is set to 1 automatically when the POINTER value wraps as determined by the MASTER.MASK field in the MASTER Trace Control Register."]
103 #[inline(always)]
104 pub fn wrap(&self) -> WRAP_R {
105 WRAP_R::new(((self.bits >> 2) & 0x01) != 0)
106 }
107 #[doc = "Bits 3:31 - Trace packet location pointer. Because a packet consists of two words, the POINTER field is the location of the first word of a packet. This field contains bits \\[31:3\\]
108of the address, in the SRAM, where the next trace packet will be written. The field points to an unused location and is automatically incremented. A debug agent can calculate the system address, on the AHB-Lite bus, of the SRAM location pointed to by the POSITION register using the following equation: system address = BASE + ((P + (2AWIDTH - (BASE MOD 2AWIDTH))) MOD 2AWIDTH). Where P = POSITION AND 0xFFFF_FFF8. Where BASE is the BASE register value"]
109 #[inline(always)]
110 pub fn pointer(&self) -> POINTER_R {
111 POINTER_R::new(((self.bits >> 3) & 0x1fff_ffff) as u32)
112 }
113}
114impl W {
115 #[doc = "Bit 2 - This bit is set to 1 automatically when the POINTER value wraps as determined by the MASTER.MASK field in the MASTER Trace Control Register."]
116 #[inline(always)]
117 pub fn wrap(&mut self) -> WRAP_W {
118 WRAP_W { w: self }
119 }
120 #[doc = "Bits 3:31 - Trace packet location pointer. Because a packet consists of two words, the POINTER field is the location of the first word of a packet. This field contains bits \\[31:3\\]
121of the address, in the SRAM, where the next trace packet will be written. The field points to an unused location and is automatically incremented. A debug agent can calculate the system address, on the AHB-Lite bus, of the SRAM location pointed to by the POSITION register using the following equation: system address = BASE + ((P + (2AWIDTH - (BASE MOD 2AWIDTH))) MOD 2AWIDTH). Where P = POSITION AND 0xFFFF_FFF8. Where BASE is the BASE register value"]
122 #[inline(always)]
123 pub fn pointer(&mut self) -> POINTER_W {
124 POINTER_W { w: self }
125 }
126 #[doc = "Writes raw bits to the register."]
127 #[inline(always)]
128 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
129 self.0.bits(bits);
130 self
131 }
132}
133#[doc = "POSITION 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 [position](index.html) module"]
134pub struct POSITION_SPEC;
135impl crate::RegisterSpec for POSITION_SPEC {
136 type Ux = u32;
137}
138#[doc = "`read()` method returns [position::R](R) reader structure"]
139impl crate::Readable for POSITION_SPEC {
140 type Reader = R;
141}
142#[doc = "`write(|w| ..)` method takes [position::W](W) writer structure"]
143impl crate::Writable for POSITION_SPEC {
144 type Writer = W;
145}
146#[doc = "`reset()` method sets POSITION to value 0"]
147impl crate::Resettable for POSITION_SPEC {
148 #[inline(always)]
149 fn reset_value() -> Self::Ux {
150 0
151 }
152}