OpenCSD - CoreSight Trace Decode Library
1.8.3
Toggle main menu visibility
Loading...
Searching...
No Matches
include
opencsd
stm
trc_pkt_elem_stm.h
Go to the documentation of this file.
1
7
8
/*
9
* Redistribution and use in source and binary forms, with or without modification,
10
* are permitted provided that the following conditions are met:
11
*
12
* 1. Redistributions of source code must retain the above copyright notice,
13
* this list of conditions and the following disclaimer.
14
*
15
* 2. Redistributions in binary form must reproduce the above copyright notice,
16
* this list of conditions and the following disclaimer in the documentation
17
* and/or other materials provided with the distribution.
18
*
19
* 3. Neither the name of the copyright holder nor the names of its contributors
20
* may be used to endorse or promote products derived from this software without
21
* specific prior written permission.
22
*
23
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND
24
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
27
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
*/
34
35
#ifndef ARM_TRC_PKT_ELEM_STM_H_INCLUDED
36
#define ARM_TRC_PKT_ELEM_STM_H_INCLUDED
37
38
#include "
trc_pkt_types_stm.h
"
39
#include "
common/trc_printable_elem.h
"
40
#include "
common/trc_pkt_elem_base.h
"
41
53
class
StmTrcPacket
:
public
TrcPacketBase
,
public
ocsd_stm_pkt
,
public
trcPrintableElem
54
{
55
public
:
56
StmTrcPacket
();
57
~StmTrcPacket
() {};
58
59
StmTrcPacket
&
operator =
(
const
ocsd_stm_pkt
*p_pkt);
60
61
virtual
const
void
*
c_pkt
()
const
{
return
(
const
ocsd_stm_pkt
*)
this
; };
62
63
void
initStartState
();
64
void
initNextPacket
();
65
66
void
setPacketType
(
const
ocsd_stm_pkt_type
type
,
const
bool
bMarker);
67
void
updateErrType
(
const
ocsd_stm_pkt_type
err_type
);
68
void
setMaster
(
const
uint8_t
master
);
69
void
setChannel
(
const
uint16_t
channel
,
const
bool
b8Bit);
70
void
setTS
(
const
uint64_t ts_val,
const
uint8_t updatedBits);
71
void
onVersionPkt
(
const
ocsd_stm_ts_type
type
);
72
73
void
setD4Payload
(
const
uint8_t value);
74
void
setD8Payload
(
const
uint8_t value);
75
void
setD16Payload
(
const
uint16_t value);
76
void
setD32Payload
(
const
uint32_t value);
77
void
setD64Payload
(
const
uint64_t value);
78
79
const
bool
isMarkerPkt
()
const
;
80
const
bool
isTSPkt
()
const
;
81
82
const
ocsd_stm_pkt_type
getPktType
()
const
;
83
const
ocsd_stm_pkt_type
getPktErrType
()
const
;
84
const
uint8_t
getMaster
()
const
;
85
const
uint16_t
getChannel
()
const
;
86
const
ocsd_stm_ts_type
getTSType
()
const
;
87
const
uint64_t
getTSVal
()
const
;
88
89
const
uint8_t
getD4Val
()
const
;
90
const
uint8_t
getD8Val
()
const
;
91
const
uint16_t
getD16Val
()
const
;
92
const
uint32_t
getD32Val
()
const
;
93
const
uint64_t
getD64Val
()
const
;
94
95
const
bool
isBadPacket
()
const
;
96
97
// printing
98
virtual
void
toString
(std::string &str)
const
;
99
virtual
void
toStringFmt
(
const
uint32_t fmtFlags, std::string &str)
const
;
100
101
102
private
:
103
void
pktTypeName(
const
ocsd_stm_pkt_type
pkt_type, std::string &name, std::string &desc)
const
;
104
};
105
106
inline
void
StmTrcPacket::setPacketType
(
const
ocsd_stm_pkt_type
type
,
const
bool
bMarker)
107
{
108
this->type =
type
;
109
if
(bMarker)
110
pkt_has_marker
= 1;
111
}
112
113
inline
void
StmTrcPacket::updateErrType
(
const
ocsd_stm_pkt_type
err_type
)
114
{
115
this->err_type = this->
type
;
// original type is the err type;
116
this->
type
=
err_type
;
// mark main type as an error.
117
}
118
119
inline
void
StmTrcPacket::setMaster
(
const
uint8_t
master
)
120
{
121
this->master =
master
;
122
channel
= 0;
// M8 forces current channel to 0.
123
}
124
125
inline
void
StmTrcPacket::setChannel
(
const
uint16_t
channel
,
const
bool
b8Bit)
126
{
127
if
(b8Bit)
128
this->channel = (this->channel & 0xFF00) | (
channel
& 0xFF);
129
else
130
this->channel =
channel
;
131
}
132
133
inline
void
StmTrcPacket::onVersionPkt
(
const
ocsd_stm_ts_type
type
)
134
{
135
this->
ts_type
=
type
;
136
master
= 0;
137
channel
= 0;
138
}
139
140
inline
void
StmTrcPacket::setD4Payload
(
const
uint8_t value)
141
{
142
payload
.D8 = value & 0xF;
143
}
144
145
inline
void
StmTrcPacket::setD8Payload
(
const
uint8_t value)
146
{
147
payload
.D8 = value;
148
}
149
150
inline
void
StmTrcPacket::setD16Payload
(
const
uint16_t value)
151
{
152
payload
.D16 = value;
153
}
154
155
inline
void
StmTrcPacket::setD32Payload
(
const
uint32_t value)
156
{
157
payload
.D32 = value;
158
}
159
160
inline
void
StmTrcPacket::setD64Payload
(
const
uint64_t value)
161
{
162
payload
.D64 = value;
163
}
164
165
inline
const
bool
StmTrcPacket::isMarkerPkt
()
const
166
{
167
return
(
pkt_has_marker
!= 0);
168
}
169
170
inline
const
bool
StmTrcPacket::isTSPkt
()
const
171
{
172
return
(
pkt_has_ts
!= 0);
173
}
174
175
inline
const
ocsd_stm_pkt_type
StmTrcPacket::getPktType
()
const
176
{
177
return
type
;
178
}
179
180
inline
const
ocsd_stm_pkt_type
StmTrcPacket::getPktErrType
()
const
181
{
182
return
err_type
;
183
}
184
185
inline
const
uint8_t
StmTrcPacket::getMaster
()
const
186
{
187
return
master
;
188
}
189
190
inline
const
uint16_t
StmTrcPacket::getChannel
()
const
191
{
192
return
channel
;
193
}
194
195
inline
const
ocsd_stm_ts_type
StmTrcPacket::getTSType
()
const
196
{
197
return
ts_type
;
198
}
199
200
inline
const
uint64_t
StmTrcPacket::getTSVal
()
const
201
{
202
return
timestamp
;
203
}
204
205
inline
const
uint8_t
StmTrcPacket::getD4Val
()
const
206
{
207
return
payload
.D8;
208
}
209
210
inline
const
uint8_t
StmTrcPacket::getD8Val
()
const
211
{
212
return
payload
.D8;
213
}
214
215
inline
const
uint16_t
StmTrcPacket::getD16Val
()
const
216
{
217
return
payload
.D16;
218
}
219
220
inline
const
uint32_t
StmTrcPacket::getD32Val
()
const
221
{
222
return
payload
.D32;
223
}
224
225
inline
const
uint64_t
StmTrcPacket::getD64Val
()
const
226
{
227
return
payload
.D64;
228
}
229
230
inline
const
bool
StmTrcPacket::isBadPacket
()
const
231
{
232
return
(
bool
)(
type
>=
STM_PKT_BAD_SEQUENCE
);
233
}
234
235
236
#endif
// ARM_TRC_PKT_ELEM_STM_H_INCLUDED
237
238
/* End of File trc_pkt_elem_stm.h */
StmTrcPacket::c_pkt
virtual const void * c_pkt() const
return the underlying C API packet structure
Definition
trc_pkt_elem_stm.h:61
StmTrcPacket::getPktType
const ocsd_stm_pkt_type getPktType() const
Definition
trc_pkt_elem_stm.h:175
StmTrcPacket::isTSPkt
const bool isTSPkt() const
Definition
trc_pkt_elem_stm.h:170
StmTrcPacket::~StmTrcPacket
~StmTrcPacket()
Definition
trc_pkt_elem_stm.h:57
StmTrcPacket::setD16Payload
void setD16Payload(const uint16_t value)
Definition
trc_pkt_elem_stm.h:150
StmTrcPacket::onVersionPkt
void onVersionPkt(const ocsd_stm_ts_type type)
Definition
trc_pkt_elem_stm.h:133
StmTrcPacket::StmTrcPacket
StmTrcPacket()
StmTrcPacket::setMaster
void setMaster(const uint8_t master)
Definition
trc_pkt_elem_stm.h:119
StmTrcPacket::isMarkerPkt
const bool isMarkerPkt() const
Definition
trc_pkt_elem_stm.h:165
StmTrcPacket::toString
virtual void toString(std::string &str) const
StmTrcPacket::getChannel
const uint16_t getChannel() const
Definition
trc_pkt_elem_stm.h:190
StmTrcPacket::operator=
StmTrcPacket & operator=(const ocsd_stm_pkt *p_pkt)
StmTrcPacket::setD32Payload
void setD32Payload(const uint32_t value)
Definition
trc_pkt_elem_stm.h:155
StmTrcPacket::getD32Val
const uint32_t getD32Val() const
Definition
trc_pkt_elem_stm.h:220
StmTrcPacket::getD16Val
const uint16_t getD16Val() const
Definition
trc_pkt_elem_stm.h:215
StmTrcPacket::setTS
void setTS(const uint64_t ts_val, const uint8_t updatedBits)
StmTrcPacket::updateErrType
void updateErrType(const ocsd_stm_pkt_type err_type)
Definition
trc_pkt_elem_stm.h:113
StmTrcPacket::setD4Payload
void setD4Payload(const uint8_t value)
Definition
trc_pkt_elem_stm.h:140
StmTrcPacket::setChannel
void setChannel(const uint16_t channel, const bool b8Bit)
Definition
trc_pkt_elem_stm.h:125
StmTrcPacket::setD64Payload
void setD64Payload(const uint64_t value)
Definition
trc_pkt_elem_stm.h:160
StmTrcPacket::getMaster
const uint8_t getMaster() const
Definition
trc_pkt_elem_stm.h:185
StmTrcPacket::getTSVal
const uint64_t getTSVal() const
Definition
trc_pkt_elem_stm.h:200
StmTrcPacket::getPktErrType
const ocsd_stm_pkt_type getPktErrType() const
Definition
trc_pkt_elem_stm.h:180
StmTrcPacket::initNextPacket
void initNextPacket()
Initialise state for next packet.
StmTrcPacket::setPacketType
void setPacketType(const ocsd_stm_pkt_type type, const bool bMarker)
Definition
trc_pkt_elem_stm.h:106
StmTrcPacket::getD64Val
const uint64_t getD64Val() const
Definition
trc_pkt_elem_stm.h:225
StmTrcPacket::isBadPacket
const bool isBadPacket() const
Definition
trc_pkt_elem_stm.h:230
StmTrcPacket::getTSType
const ocsd_stm_ts_type getTSType() const
Definition
trc_pkt_elem_stm.h:195
StmTrcPacket::getD4Val
const uint8_t getD4Val() const
Definition
trc_pkt_elem_stm.h:205
StmTrcPacket::getD8Val
const uint8_t getD8Val() const
Definition
trc_pkt_elem_stm.h:210
StmTrcPacket::toStringFmt
virtual void toStringFmt(const uint32_t fmtFlags, std::string &str) const
StmTrcPacket::setD8Payload
void setD8Payload(const uint8_t value)
Definition
trc_pkt_elem_stm.h:145
StmTrcPacket::initStartState
void initStartState()
Initialise packet state at start of decoder.
TrcPacketBase::TrcPacketBase
TrcPacketBase()
Definition
trc_pkt_elem_base.h:40
trcPrintableElem::trcPrintableElem
trcPrintableElem()
Definition
trc_printable_elem.h:58
ocsd_stm_pkt
struct _ocsd_stm_pkt ocsd_stm_pkt
ocsd_stm_ts_type
enum _ocsd_stm_ts_type ocsd_stm_ts_type
ocsd_stm_pkt_type
enum _ocsd_stm_pkt_type ocsd_stm_pkt_type
STM_PKT_BAD_SEQUENCE
@ STM_PKT_BAD_SEQUENCE
Definition
trc_pkt_types_stm.h:79
_ocsd_stm_pkt::err_type
ocsd_stm_pkt_type err_type
Definition
trc_pkt_types_stm.h:122
_ocsd_stm_pkt::type
ocsd_stm_pkt_type type
Definition
trc_pkt_types_stm.h:102
_ocsd_stm_pkt::timestamp
uint64_t timestamp
Definition
trc_pkt_types_stm.h:107
_ocsd_stm_pkt::master
uint8_t master
Definition
trc_pkt_types_stm.h:104
_ocsd_stm_pkt::pkt_has_ts
uint8_t pkt_has_ts
Definition
trc_pkt_types_stm.h:109
_ocsd_stm_pkt::channel
uint16_t channel
Definition
trc_pkt_types_stm.h:105
_ocsd_stm_pkt::ts_type
ocsd_stm_ts_type ts_type
Definition
trc_pkt_types_stm.h:111
_ocsd_stm_pkt::payload
union _ocsd_stm_pkt::@331125040257235126277264316007301250240206337037 payload
_ocsd_stm_pkt::pkt_has_marker
uint8_t pkt_has_marker
Definition
trc_pkt_types_stm.h:113
trc_pkt_elem_base.h
trc_pkt_types_stm.h
trc_printable_elem.h
OpenCSD : Standard printable element base class.
Generated on
for OpenCSD - CoreSight Trace Decode Library by
1.17.0