OpenCSD - CoreSight Trace Decode Library 1.5.2
Loading...
Searching...
No Matches
trc_pkt_elem_etmv3.h
Go to the documentation of this file.
1/*
2 * \file trc_pkt_elem_etmv3.h
3 * \brief OpenCSD :
4 *
5 * \copyright Copyright (c) 2015, ARM Limited. All Rights Reserved.
6 */
7
8
9/*
10 * Redistribution and use in source and binary forms, with or without modification,
11 * are permitted provided that the following conditions are met:
12 *
13 * 1. Redistributions of source code must retain the above copyright notice,
14 * this list of conditions and the following disclaimer.
15 *
16 * 2. Redistributions in binary form must reproduce the above copyright notice,
17 * this list of conditions and the following disclaimer in the documentation
18 * and/or other materials provided with the distribution.
19 *
20 * 3. Neither the name of the copyright holder nor the names of its contributors
21 * may be used to endorse or promote products derived from this software without
22 * specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
27 * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
28 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
31 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 */
35
36#ifndef ARM_TRC_PKT_ELEM_ETMV3_H_INCLUDED
37#define ARM_TRC_PKT_ELEM_ETMV3_H_INCLUDED
38
39#include "trc_pkt_types_etmv3.h"
42
54{
55public:
58
59// conversions between C-API struct and C++ object types
60 // assign from C-API struct
62
63 // allow const cast to C-API struct to pass C++ object
64 operator const ocsd_etmv3_pkt*() const { return &m_pkt_data; };
65 operator const ocsd_etmv3_pkt&() const { return m_pkt_data; };
66
67 // override c_pkt to pass out the packet data struct.
68 virtual const void *c_pkt() const { return &m_pkt_data; };
69
70// update interface - set packet values
71 void Clear();
72 void ResetState();
73
74 void SetType(const ocsd_etmv3_pkt_type p_type);
75 void SetErrType(const ocsd_etmv3_pkt_type e_type);
76 void UpdateAddress(const ocsd_vaddr_t partAddrVal, const int updateBits);
78 const uint16_t number,
79 const bool cancel,
80 const bool cm_type,
81 const int irq_n = 0,
82 const int resume = 0);
83 void UpdateNS(const int NS);
84 void UpdateAltISA(const int AltISA);
85 void UpdateHyp(const int Hyp);
86 void UpdateISA(const ocsd_isa isa);
87 void UpdateContextID(const uint32_t contextID);
88 void UpdateVMID(const uint8_t VMID);
89 void UpdateTimestamp(const uint64_t tsVal, const uint8_t updateBits);
90
91 bool UpdateAtomFromPHdr(const uint8_t pHdr, const bool cycleAccurate);
92
93 void SetDataOOOTag(const uint8_t tag);
94 void SetDataValue(const uint32_t value);
95 void UpdateDataAddress(const uint32_t value, const uint8_t valid_bits);
96 void UpdateDataEndian(const uint8_t BE_Val);
97 void SetCycleCount(const uint32_t cycleCount);
98 void SetISyncReason(const ocsd_iSync_reason reason);
99 void SetISyncHasCC();
100 void SetISyncIsLSiP();
101 void SetISyncNoAddr();
102
103// packet status interface - get packet info.
104 const ocsd_etmv3_pkt_type getType() const { return m_pkt_data.type; };
105 const bool isBadPacket() const;
106
107 const int AltISA() const { return m_pkt_data.context.curr_alt_isa; };
108 const ocsd_isa ISA() const { return m_pkt_data.curr_isa; };
109 const bool changedISA() const { return m_pkt_data.curr_isa != m_pkt_data.prev_isa; };
110
111 // any of the context elements updated?
112 const bool isCtxtUpdated() const;
113 const bool isCtxtFlagsUpdated() const { return (m_pkt_data.context.updated == 1); };
114 const bool isNS() const { return m_pkt_data.context.curr_NS; };
115 const bool isHyp() const { return m_pkt_data.context.curr_Hyp; };
116
117 const bool isCtxtIDUpdated() const { return (m_pkt_data.context.updated_c == 1); }
118 const uint32_t getCtxtID() const { return m_pkt_data.context.ctxtID; };
119 const bool isVMIDUpdated() const { return (m_pkt_data.context.updated_v == 1); }
120 const uint32_t getVMID() const { return m_pkt_data.context.VMID; };
121
122 const uint32_t getCycleCount() const { return m_pkt_data.cycle_count; };
123 const uint64_t getTS() const { return m_pkt_data.timestamp; };
124
125 const bool isExcepPkt() const { return (m_pkt_data.exception.bits.present == 1); };
126 const ocsd_armv7_exception excepType() const { return m_pkt_data.exception.type; };
127 const uint16_t excepNum() const { return m_pkt_data.exception.number; };
128 const bool isExcepCancel() const { return (m_pkt_data.exception.bits.present == 1) && (m_pkt_data.exception.bits.cancel == 1); };
129
130 const ocsd_iSync_reason getISyncReason() const { return m_pkt_data.isync_info.reason; };
131 const bool getISyncHasCC() const { return m_pkt_data.isync_info.has_cycle_count; };
132 const bool getISyncIsLSiPAddr() const { return m_pkt_data.isync_info.has_LSipAddress; };
133 const bool getISyncNoAddr() const { return m_pkt_data.isync_info.no_address; };
134
135 const ocsd_vaddr_t getAddr() const { return m_pkt_data.addr.val; };
136 const ocsd_vaddr_t getDataAddr() const { return m_pkt_data.data.addr.val; };
137
138 const ocsd_pkt_atom &getAtom() const { return m_pkt_data.atom; };
139 const uint8_t getPHdrFmt() const { return m_pkt_data.p_hdr_fmt; };
140
141
142// printing
143 virtual void toString(std::string &str) const;
144 virtual void toStringFmt(const uint32_t fmtFlags, std::string &str) const;
145
146private:
147 const char *packetTypeName(const ocsd_etmv3_pkt_type type, const char **ppDesc) const;
148 void getBranchAddressStr(std::string &valStr) const;
149 void getAtomStr(std::string &valStr) const;
150 void getISyncStr(std::string &valStr) const;
151 void getISAStr(std::string &isaStr) const;
152 void getExcepStr(std::string &excepStr) const;
153
154 ocsd_etmv3_pkt m_pkt_data;
155};
156
157inline void EtmV3TrcPacket::UpdateNS(const int NS)
158{
159 m_pkt_data.context.curr_NS = NS;
160 m_pkt_data.context.updated = 1;
161};
162
163inline void EtmV3TrcPacket::UpdateAltISA(const int AltISA)
164{
165 m_pkt_data.context.curr_alt_isa = AltISA;
166 m_pkt_data.context.updated = 1;
167}
168
169inline void EtmV3TrcPacket::UpdateHyp(const int Hyp)
170{
171 m_pkt_data.context.curr_Hyp = Hyp;
172 m_pkt_data.context.updated = 1;
173}
174
176{
177 m_pkt_data.prev_isa = m_pkt_data.curr_isa;
178 m_pkt_data.curr_isa = isa;
179}
180
182{
183 m_pkt_data.type = p_type;
184}
185
187{
188 m_pkt_data.err_type = m_pkt_data.type;
189 m_pkt_data.type = e_type;
190}
191
192inline const bool EtmV3TrcPacket::isBadPacket() const
193{
194 return (m_pkt_data.type >= ETM3_PKT_BAD_SEQUENCE);
195}
196
197inline void EtmV3TrcPacket::SetDataOOOTag(const uint8_t tag)
198{
199 m_pkt_data.data.ooo_tag = tag;
200}
201
202inline void EtmV3TrcPacket::SetDataValue(const uint32_t value)
203{
204 m_pkt_data.data.value = value;
205 m_pkt_data.data.update_dval = 1;
206}
207
208inline void EtmV3TrcPacket::UpdateContextID(const uint32_t contextID)
209{
210 m_pkt_data.context.updated_c = 1;
211 m_pkt_data.context.ctxtID = contextID;
212}
213
214inline void EtmV3TrcPacket::UpdateVMID(const uint8_t VMID)
215{
216 m_pkt_data.context.updated_v = 1;
217 m_pkt_data.context.VMID = VMID;
218}
219
220inline void EtmV3TrcPacket::UpdateDataEndian(const uint8_t BE_Val)
221{
222 m_pkt_data.data.be = BE_Val;
223 m_pkt_data.data.update_be = 1;
224}
225
226inline void EtmV3TrcPacket::SetCycleCount(const uint32_t cycleCount)
227{
228 m_pkt_data.cycle_count = cycleCount;
229}
230
232{
233 m_pkt_data.isync_info.reason = reason;
234}
235
237{
238 m_pkt_data.isync_info.has_cycle_count = 1;
239}
240
242{
243 m_pkt_data.isync_info.has_LSipAddress = 1;
244}
245
247{
248 m_pkt_data.isync_info.no_address = 1;
249}
250
251inline const bool EtmV3TrcPacket::isCtxtUpdated() const
252{
253 return (m_pkt_data.context.updated_v == 1) ||
254 (m_pkt_data.context.updated == 1) ||
255 (m_pkt_data.context.updated_c == 1);
256}
257
259#endif // ARM_TRC_PKT_ELEM_ETMV3_H_INCLUDED
260
261/* End of File trc_pkt_elem_etmv3.h */
ETMv3 Trace Protocol Packet.
bool UpdateAtomFromPHdr(const uint8_t pHdr, const bool cycleAccurate)
Interpret P Hdr, return true if valid, false if not.
const int AltISA() const
const bool isExcepCancel() const
const uint8_t getPHdrFmt() const
void UpdateAddress(const ocsd_vaddr_t partAddrVal, const int updateBits)
const uint32_t getCycleCount() const
void SetException(const ocsd_armv7_exception type, const uint16_t number, const bool cancel, const bool cm_type, const int irq_n=0, const int resume=0)
void ResetState()
reset intra packet state data -on full decoder reset.
const bool getISyncHasCC() const
const uint32_t getVMID() const
const ocsd_iSync_reason getISyncReason() const
const bool getISyncIsLSiPAddr() const
const bool isVMIDUpdated() const
const bool isExcepPkt() const
const uint64_t getTS() const
const bool isHyp() const
const uint32_t getCtxtID() const
void UpdateDataAddress(const uint32_t value, const uint8_t valid_bits)
EtmV3TrcPacket & operator=(const ocsd_etmv3_pkt *p_pkt)
const ocsd_etmv3_pkt_type getType() const
virtual const void * c_pkt() const
return the underlying C API packet structure
virtual void toStringFmt(const uint32_t fmtFlags, std::string &str) const
void UpdateTimestamp(const uint64_t tsVal, const uint8_t updateBits)
const ocsd_vaddr_t getAddr() const
const uint16_t excepNum() const
const ocsd_pkt_atom & getAtom() const
virtual void toString(std::string &str) const
const bool isNS() const
const ocsd_isa ISA() const
const bool isCtxtIDUpdated() const
const bool changedISA() const
const ocsd_vaddr_t getDataAddr() const
void Clear()
clear update data in packet ready for new one.
const bool getISyncNoAddr() const
const ocsd_armv7_exception excepType() const
const bool isCtxtFlagsUpdated() const
Class to provide trace element strings for printing.
enum _ocsd_isa ocsd_isa
uint64_t ocsd_vaddr_t
void SetISyncReason(const ocsd_iSync_reason reason)
enum _ocsd_etmv3_pkt_type ocsd_etmv3_pkt_type
void SetDataOOOTag(const uint8_t tag)
void UpdateAltISA(const int AltISA)
const bool isBadPacket() const
enum _ocsd_armv7_exception ocsd_armv7_exception
void UpdateContextID(const uint32_t contextID)
void UpdateISA(const ocsd_isa isa)
const bool isCtxtUpdated() const
void SetDataValue(const uint32_t value)
void UpdateHyp(const int Hyp)
void UpdateNS(const int NS)
void SetCycleCount(const uint32_t cycleCount)
void UpdateDataEndian(const uint8_t BE_Val)
void SetErrType(const ocsd_etmv3_pkt_type e_type)
enum _ocsd_iSync_reason ocsd_iSync_reason
void SetType(const ocsd_etmv3_pkt_type p_type)
void UpdateVMID(const uint8_t VMID)
@ ETM3_PKT_BAD_SEQUENCE
invalid sequence for packet type
ocsd_pkt_vaddr addr
ocsd_iSync_reason reason
ocsd_armv7_exception type
struct _ocsd_etmv3_excep::@1 bits
ocsd_etmv3_excep exception
ocsd_etmv3_pkt_type type
etmv3_context_t context
ocsd_etmv3_pkt_type err_type
etmv3_isync_t isync_info
ocsd_vaddr_t val
OpenCSD : Standard printable element base class.