OpenCSD - CoreSight Trace Decode Library 1.4.1
Loading...
Searching...
No Matches
trc_pkt_elem_ptm.h
Go to the documentation of this file.
1/*
2 * \file trc_pkt_elem_ptm.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
37#ifndef ARM_TRC_PKT_ELEM_PTM_H_INCLUDED
38#define ARM_TRC_PKT_ELEM_PTM_H_INCLUDED
39
40#include "trc_pkt_types_ptm.h"
43
49{
50public:
53
55
56 virtual const void *c_pkt() const { return (const ocsd_ptm_pkt *)this; };
57
58 // update interface - set packet values
59
60 void Clear();
61 void ResetState();
62
63 void SetType(const ocsd_ptm_pkt_type p_type);
64 void SetErrType(const ocsd_ptm_pkt_type e_type);
65
67 const uint16_t number);
68 void SetISyncReason(const ocsd_iSync_reason reason);
69 void SetCycleCount(const uint32_t cycleCount);
70 void SetAtomFromPHdr(const uint8_t pHdr);
71 void SetCycleAccAtomFromPHdr(const uint8_t pHdr);
72
73 void UpdateAddress(const ocsd_vaddr_t partAddrVal, const int updateBits);
74 void UpdateNS(const int NS);
75 void UpdateAltISA(const int AltISA);
76 void UpdateHyp(const int Hyp);
77 void UpdateISA(const ocsd_isa isa);
78 void UpdateContextID(const uint32_t contextID);
79 void UpdateVMID(const uint8_t VMID);
80 void UpdateTimestamp(const uint64_t tsVal, const uint8_t updateBits);
81
82 // packet status interface
83
84 // get packet info.
85 const bool isBadPacket() const;
86 const ocsd_ptm_pkt_type getType() const;
87
88 // isa
89 const ocsd_isa getISA() const;
90 const bool ISAChanged() const { return (bool)(curr_isa != prev_isa); };
91 const uint8_t getAltISA() const { return context.curr_alt_isa; };
92 const uint8_t getNS() const { return context.curr_NS; };
93 const uint8_t getHyp() const { return context.curr_Hyp; };
94
95 // address
96 const ocsd_vaddr_t getAddrVal() const { return addr.val; };
97
98 // pe context information
99 const bool CtxtIDUpdated() const { return (bool)(context.updated_c == 1); };
100 const bool VMIDUpdated() const { return (bool)(context.updated_v == 1); };
101 const uint32_t getCtxtID() const { return context.ctxtID; };
102 const uint8_t getVMID() const { return context.VMID; };
103 const bool PEContextUpdated() const { return context.updated; };
104
105 // atom info
106 const ocsd_pkt_atom &getAtom() const { return atom; };
107
108 // branch address info
109 const bool isBranchExcepPacket() const { return (exception.bits.present == 1); };
110 const ocsd_armv7_exception excepType() const { return exception.type; };
111 const uint16_t excepNum() const { return exception.number; };
112
113 // isync
114 const ocsd_iSync_reason iSyncReason() const { return i_sync_reason; };
115
116 // cycle count
117 const bool hasCC() const { return (cc_valid == 1); };
118 const uint32_t getCCVal() const { return cycle_count; };
119
120 // printing
121 virtual void toString(std::string &str) const;
122 virtual void toStringFmt(const uint32_t fmtFlags, std::string &str) const;
123
124private:
125 void packetTypeName(const ocsd_ptm_pkt_type pkt_type, std::string &name, std::string &desc) const;
126 void getAtomStr(std::string &valStr) const;
127 void getBranchAddressStr(std::string &valStr) const;
128 void getExcepStr(std::string &excepStr) const;
129 void getISAStr(std::string &isaStr) const;
130 void getCycleCountStr(std::string &subStr) const;
131 void getISyncStr(std::string &valStr) const;
132 void getTSStr(std::string &valStr) const;
133};
134
135
136//*** update interface - set packet values
138{
139 type = p_type;
140}
141
143{
144 err_type = type;
145 type = e_type;
146}
147
148inline void PtmTrcPacket::UpdateNS(const int NS)
149{
150 context.curr_NS = NS;
151 context.updated = 1;
152};
153
154inline void PtmTrcPacket::UpdateAltISA(const int AltISA)
155{
156 context.curr_alt_isa = AltISA;
157 context.updated = 1;
158}
159
160inline void PtmTrcPacket::UpdateHyp(const int Hyp)
161{
162 context.curr_Hyp = Hyp;
163 context.updated = 1;
164}
165
166inline void PtmTrcPacket::UpdateISA(const ocsd_isa isa)
167{
169 curr_isa = isa;
170}
171
172inline void PtmTrcPacket::UpdateContextID(const uint32_t contextID)
173{
174 context.ctxtID = contextID;
175 context.updated_c = 1;
176}
177
178inline void PtmTrcPacket::UpdateVMID(const uint8_t VMID)
179{
180 context.VMID = VMID;
181 context.updated_v = 1;
182}
183
184inline void PtmTrcPacket::SetException( const ocsd_armv7_exception type, const uint16_t number)
185{
187 exception.number = number;
189}
190
192{
193 i_sync_reason = reason;
194}
195
196inline void PtmTrcPacket::SetCycleCount(const uint32_t cycleCount)
197{
198 cycle_count = cycleCount;
199 cc_valid = 1;
200}
201
202//*** packet status interface - get packet info.
203inline const bool PtmTrcPacket::isBadPacket() const
204{
205 return (bool)(type >= PTM_PKT_BAD_SEQUENCE);
206}
207
209{
210 return type;
211}
212
213inline const ocsd_isa PtmTrcPacket::getISA() const
214{
215 return curr_isa;
216}
217
219#endif // ARM_TRC_PKT_ELEM_PTM_H_INCLUDED
220
221/* End of File trc_pkt_elem_ptm.h */
const uint8_t getVMID() const
const bool hasCC() const
virtual void toStringFmt(const uint32_t fmtFlags, std::string &str) const
PtmTrcPacket & operator=(const ocsd_ptm_pkt *p_pkt)
void SetAtomFromPHdr(const uint8_t pHdr)
virtual const void * c_pkt() const
return the underlying C API packet structure
void UpdateTimestamp(const uint64_t tsVal, const uint8_t updateBits)
const ocsd_armv7_exception excepType() const
const ocsd_vaddr_t getAddrVal() const
const uint32_t getCCVal() const
const bool VMIDUpdated() const
const uint32_t getCtxtID() const
void Clear()
clear update data in packet ready for new one.
void ResetState()
reset intra packet state data - on full decoder reset.
void UpdateAddress(const ocsd_vaddr_t partAddrVal, const int updateBits)
const ocsd_pkt_atom & getAtom() const
const ocsd_iSync_reason iSyncReason() const
const bool PEContextUpdated() const
const bool ISAChanged() const
const bool isBranchExcepPacket() const
virtual void toString(std::string &str) const
const uint8_t getAltISA() const
const uint8_t getNS() const
const uint16_t excepNum() const
const bool CtxtIDUpdated() const
void SetCycleAccAtomFromPHdr(const uint8_t pHdr)
const uint8_t getHyp() 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)
void SetCycleCount(const uint32_t cycleCount)
void UpdateContextID(const uint32_t contextID)
void UpdateAltISA(const int AltISA)
const ocsd_ptm_pkt_type getType() const
void UpdateHyp(const int Hyp)
void UpdateISA(const ocsd_isa isa)
enum _ocsd_armv7_exception ocsd_armv7_exception
enum _ocsd_ptm_pkt_type ocsd_ptm_pkt_type
void UpdateVMID(const uint8_t VMID)
const ocsd_isa getISA() const
void SetException(const ocsd_armv7_exception type, const uint16_t number)
void UpdateNS(const int NS)
enum _ocsd_iSync_reason ocsd_iSync_reason
void SetType(const ocsd_ptm_pkt_type p_type)
const bool isBadPacket() const
void SetErrType(const ocsd_ptm_pkt_type e_type)
@ PTM_PKT_BAD_SEQUENCE
invalid sequence for packet type
ocsd_vaddr_t val
ocsd_armv7_exception type
struct _ocsd_ptm_excep::@28 bits
ocsd_ptm_excep exception
ocsd_pkt_vaddr addr
ptm_context_t context
ocsd_ptm_pkt_type err_type
ocsd_pkt_atom atom
ocsd_ptm_pkt_type type
ocsd_iSync_reason i_sync_reason
OpenCSD : Standard printable element base class.