Loading...
Searching...
No Matches
trc_pkt_elem_etmv3.h
Go to the documentation of this file.
/*
* \file trc_pkt_elem_etmv3.h
* \brief OpenCSD :
*
* \copyright Copyright (c) 2015, ARM Limited. All Rights Reserved.
*/
/*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors
* may be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef ARM_TRC_PKT_ELEM_ETMV3_H_INCLUDED
#define ARM_TRC_PKT_ELEM_ETMV3_H_INCLUDED
#include "trc_pkt_types_etmv3.h"
#include "common/trc_printable_elem.h"
#include "common/trc_pkt_elem_base.h"
class EtmV3TrcPacket : public TrcPacketBase, public trcPrintableElem
{
public:
EtmV3TrcPacket();
~EtmV3TrcPacket();
// conversions between C-API struct and C++ object types
// assign from C-API struct
EtmV3TrcPacket &operator =(const ocsd_etmv3_pkt* p_pkt);
// allow const cast to C-API struct to pass C++ object
operator const ocsd_etmv3_pkt*() const { return &m_pkt_data; };
operator const ocsd_etmv3_pkt&() const { return m_pkt_data; };
// override c_pkt to pass out the packet data struct.
virtual const void *c_pkt() const { return &m_pkt_data; };
// update interface - set packet values
void Clear();
void ResetState();
void SetType(const ocsd_etmv3_pkt_type p_type);
void SetErrType(const ocsd_etmv3_pkt_type e_type);
void UpdateAddress(const ocsd_vaddr_t partAddrVal, const int updateBits);
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 UpdateNS(const int NS);
void UpdateAltISA(const int AltISA);
void UpdateHyp(const int Hyp);
void UpdateISA(const ocsd_isa isa);
void UpdateContextID(const uint32_t contextID);
void UpdateVMID(const uint8_t VMID);
void UpdateTimestamp(const uint64_t tsVal, const uint8_t updateBits);
bool UpdateAtomFromPHdr(const uint8_t pHdr, const bool cycleAccurate);
void SetDataOOOTag(const uint8_t tag);
void SetDataValue(const uint32_t value);
void UpdateDataAddress(const uint32_t value, const uint8_t valid_bits);
void UpdateDataEndian(const uint8_t BE_Val);
void SetCycleCount(const uint32_t cycleCount);
void SetISyncReason(const ocsd_iSync_reason reason);
void SetISyncHasCC();
void SetISyncIsLSiP();
void SetISyncNoAddr();
// packet status interface - get packet info.
const ocsd_etmv3_pkt_type getType() const { return m_pkt_data.type; };
const bool isBadPacket() const;
const int AltISA() const { return m_pkt_data.context.curr_alt_isa; };
const ocsd_isa ISA() const { return m_pkt_data.curr_isa; };
const bool changedISA() const { return m_pkt_data.curr_isa != m_pkt_data.prev_isa; };
// any of the context elements updated?
const bool isCtxtUpdated() const;
const bool isCtxtFlagsUpdated() const { return (m_pkt_data.context.updated == 1); };
const bool isNS() const { return m_pkt_data.context.curr_NS; };
const bool isHyp() const { return m_pkt_data.context.curr_Hyp; };
const bool isCtxtIDUpdated() const { return (m_pkt_data.context.updated_c == 1); }
const uint32_t getCtxtID() const { return m_pkt_data.context.ctxtID; };
const bool isVMIDUpdated() const { return (m_pkt_data.context.updated_v == 1); }
const uint32_t getVMID() const { return m_pkt_data.context.VMID; };
const uint32_t getCycleCount() const { return m_pkt_data.cycle_count; };
const uint64_t getTS() const { return m_pkt_data.timestamp; };
const bool isExcepPkt() const { return (m_pkt_data.exception.bits.present == 1); };
const ocsd_armv7_exception excepType() const { return m_pkt_data.exception.type; };
const uint16_t excepNum() const { return m_pkt_data.exception.number; };
const bool isExcepCancel() const { return (m_pkt_data.exception.bits.present == 1) && (m_pkt_data.exception.bits.cancel == 1); };
const ocsd_iSync_reason getISyncReason() const { return m_pkt_data.isync_info.reason; };
const bool getISyncHasCC() const { return m_pkt_data.isync_info.has_cycle_count; };
const bool getISyncIsLSiPAddr() const { return m_pkt_data.isync_info.has_LSipAddress; };
const bool getISyncNoAddr() const { return m_pkt_data.isync_info.no_address; };
const ocsd_vaddr_t getAddr() const { return m_pkt_data.addr.val; };
const ocsd_vaddr_t getDataAddr() const { return m_pkt_data.data.addr.val; };
const ocsd_pkt_atom &getAtom() const { return m_pkt_data.atom; };
const uint8_t getPHdrFmt() const { return m_pkt_data.p_hdr_fmt; };
// printing
virtual void toString(std::string &str) const;
virtual void toStringFmt(const uint32_t fmtFlags, std::string &str) const;
private:
const char *packetTypeName(const ocsd_etmv3_pkt_type type, const char **ppDesc) const;
void getBranchAddressStr(std::string &valStr) const;
void getAtomStr(std::string &valStr) const;
void getISyncStr(std::string &valStr) const;
void getISAStr(std::string &isaStr) const;
void getExcepStr(std::string &excepStr) const;
ocsd_etmv3_pkt m_pkt_data;
};
inline void EtmV3TrcPacket::UpdateNS(const int NS)
{
m_pkt_data.context.curr_NS = NS;
m_pkt_data.context.updated = 1;
};
inline void EtmV3TrcPacket::UpdateAltISA(const int AltISA)
{
m_pkt_data.context.curr_alt_isa = AltISA;
m_pkt_data.context.updated = 1;
}
inline void EtmV3TrcPacket::UpdateHyp(const int Hyp)
{
m_pkt_data.context.curr_Hyp = Hyp;
m_pkt_data.context.updated = 1;
}
inline void EtmV3TrcPacket::UpdateISA(const ocsd_isa isa)
{
m_pkt_data.prev_isa = m_pkt_data.curr_isa;
m_pkt_data.curr_isa = isa;
}
inline void EtmV3TrcPacket::SetType(const ocsd_etmv3_pkt_type p_type)
{
m_pkt_data.type = p_type;
}
inline void EtmV3TrcPacket::SetErrType(const ocsd_etmv3_pkt_type e_type)
{
m_pkt_data.err_type = m_pkt_data.type;
m_pkt_data.type = e_type;
}
inline const bool EtmV3TrcPacket::isBadPacket() const
{
return (m_pkt_data.type >= ETM3_PKT_BAD_SEQUENCE);
}
inline void EtmV3TrcPacket::SetDataOOOTag(const uint8_t tag)
{
m_pkt_data.data.ooo_tag = tag;
}
inline void EtmV3TrcPacket::SetDataValue(const uint32_t value)
{
m_pkt_data.data.value = value;
m_pkt_data.data.update_dval = 1;
}
inline void EtmV3TrcPacket::UpdateContextID(const uint32_t contextID)
{
m_pkt_data.context.updated_c = 1;
m_pkt_data.context.ctxtID = contextID;
}
inline void EtmV3TrcPacket::UpdateVMID(const uint8_t VMID)
{
m_pkt_data.context.updated_v = 1;
m_pkt_data.context.VMID = VMID;
}
inline void EtmV3TrcPacket::UpdateDataEndian(const uint8_t BE_Val)
{
m_pkt_data.data.be = BE_Val;
m_pkt_data.data.update_be = 1;
}
inline void EtmV3TrcPacket::SetCycleCount(const uint32_t cycleCount)
{
m_pkt_data.cycle_count = cycleCount;
}
inline void EtmV3TrcPacket::SetISyncReason(const ocsd_iSync_reason reason)
{
m_pkt_data.isync_info.reason = reason;
}
inline void EtmV3TrcPacket::SetISyncHasCC()
{
m_pkt_data.isync_info.has_cycle_count = 1;
}
inline void EtmV3TrcPacket::SetISyncIsLSiP()
{
m_pkt_data.isync_info.has_LSipAddress = 1;
}
inline void EtmV3TrcPacket::SetISyncNoAddr()
{
m_pkt_data.isync_info.no_address = 1;
}
inline const bool EtmV3TrcPacket::isCtxtUpdated() const
{
return (m_pkt_data.context.updated_v == 1) ||
(m_pkt_data.context.updated == 1) ||
(m_pkt_data.context.updated_c == 1);
}
#endif // ARM_TRC_PKT_ELEM_ETMV3_H_INCLUDED
/* End of File trc_pkt_elem_etmv3.h */
EtmV3TrcPacket
ETMv3 Trace Protocol Packet.
Definition trc_pkt_elem_etmv3.h:54
EtmV3TrcPacket::UpdateAtomFromPHdr
bool UpdateAtomFromPHdr(const uint8_t pHdr, const bool cycleAccurate)
Interpret P Hdr, return true if valid, false if not.
EtmV3TrcPacket::EtmV3TrcPacket
EtmV3TrcPacket()
EtmV3TrcPacket::AltISA
const int AltISA() const
Definition trc_pkt_elem_etmv3.h:107
EtmV3TrcPacket::isExcepCancel
const bool isExcepCancel() const
Definition trc_pkt_elem_etmv3.h:128
EtmV3TrcPacket::getPHdrFmt
const uint8_t getPHdrFmt() const
Definition trc_pkt_elem_etmv3.h:139
EtmV3TrcPacket::UpdateAddress
void UpdateAddress(const ocsd_vaddr_t partAddrVal, const int updateBits)
EtmV3TrcPacket::getCycleCount
const uint32_t getCycleCount() const
Definition trc_pkt_elem_etmv3.h:122
EtmV3TrcPacket::SetException
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)
EtmV3TrcPacket::ResetState
void ResetState()
reset intra packet state data -on full decoder reset.
EtmV3TrcPacket::getISyncHasCC
const bool getISyncHasCC() const
Definition trc_pkt_elem_etmv3.h:131
EtmV3TrcPacket::getVMID
const uint32_t getVMID() const
Definition trc_pkt_elem_etmv3.h:120
EtmV3TrcPacket::getISyncReason
const ocsd_iSync_reason getISyncReason() const
Definition trc_pkt_elem_etmv3.h:130
EtmV3TrcPacket::~EtmV3TrcPacket
~EtmV3TrcPacket()
EtmV3TrcPacket::getISyncIsLSiPAddr
const bool getISyncIsLSiPAddr() const
Definition trc_pkt_elem_etmv3.h:132
EtmV3TrcPacket::isVMIDUpdated
const bool isVMIDUpdated() const
Definition trc_pkt_elem_etmv3.h:119
EtmV3TrcPacket::isExcepPkt
const bool isExcepPkt() const
Definition trc_pkt_elem_etmv3.h:125
EtmV3TrcPacket::getTS
const uint64_t getTS() const
Definition trc_pkt_elem_etmv3.h:123
EtmV3TrcPacket::isHyp
const bool isHyp() const
Definition trc_pkt_elem_etmv3.h:115
EtmV3TrcPacket::getCtxtID
const uint32_t getCtxtID() const
Definition trc_pkt_elem_etmv3.h:118
EtmV3TrcPacket::UpdateDataAddress
void UpdateDataAddress(const uint32_t value, const uint8_t valid_bits)
EtmV3TrcPacket::operator=
EtmV3TrcPacket & operator=(const ocsd_etmv3_pkt *p_pkt)
EtmV3TrcPacket::getType
const ocsd_etmv3_pkt_type getType() const
Definition trc_pkt_elem_etmv3.h:104
EtmV3TrcPacket::c_pkt
virtual const void * c_pkt() const
return the underlying C API packet structure
Definition trc_pkt_elem_etmv3.h:68
EtmV3TrcPacket::toStringFmt
virtual void toStringFmt(const uint32_t fmtFlags, std::string &str) const
EtmV3TrcPacket::UpdateTimestamp
void UpdateTimestamp(const uint64_t tsVal, const uint8_t updateBits)
EtmV3TrcPacket::getAddr
const ocsd_vaddr_t getAddr() const
Definition trc_pkt_elem_etmv3.h:135
EtmV3TrcPacket::excepNum
const uint16_t excepNum() const
Definition trc_pkt_elem_etmv3.h:127
EtmV3TrcPacket::getAtom
const ocsd_pkt_atom & getAtom() const
Definition trc_pkt_elem_etmv3.h:138
EtmV3TrcPacket::toString
virtual void toString(std::string &str) const
EtmV3TrcPacket::isNS
const bool isNS() const
Definition trc_pkt_elem_etmv3.h:114
EtmV3TrcPacket::ISA
const ocsd_isa ISA() const
Definition trc_pkt_elem_etmv3.h:108
EtmV3TrcPacket::isCtxtIDUpdated
const bool isCtxtIDUpdated() const
Definition trc_pkt_elem_etmv3.h:117
EtmV3TrcPacket::changedISA
const bool changedISA() const
Definition trc_pkt_elem_etmv3.h:109
EtmV3TrcPacket::getDataAddr
const ocsd_vaddr_t getDataAddr() const
Definition trc_pkt_elem_etmv3.h:136
EtmV3TrcPacket::Clear
void Clear()
clear update data in packet ready for new one.
EtmV3TrcPacket::getISyncNoAddr
const bool getISyncNoAddr() const
Definition trc_pkt_elem_etmv3.h:133
EtmV3TrcPacket::excepType
const ocsd_armv7_exception excepType() const
Definition trc_pkt_elem_etmv3.h:126
EtmV3TrcPacket::isCtxtFlagsUpdated
const bool isCtxtFlagsUpdated() const
Definition trc_pkt_elem_etmv3.h:113
TrcPacketBase
Definition trc_pkt_elem_base.h:38
trcPrintableElem
Class to provide trace element strings for printing.
Definition trc_printable_elem.h:56
ocsd_isa
enum _ocsd_isa ocsd_isa
ocsd_vaddr_t
uint64_t ocsd_vaddr_t
Definition ocsd_if_types.h:310
EtmV3TrcPacket::SetISyncReason
void SetISyncReason(const ocsd_iSync_reason reason)
Definition trc_pkt_elem_etmv3.h:231
ocsd_etmv3_pkt_type
enum _ocsd_etmv3_pkt_type ocsd_etmv3_pkt_type
EtmV3TrcPacket::SetDataOOOTag
void SetDataOOOTag(const uint8_t tag)
Definition trc_pkt_elem_etmv3.h:197
EtmV3TrcPacket::SetISyncNoAddr
void SetISyncNoAddr()
Definition trc_pkt_elem_etmv3.h:246
EtmV3TrcPacket::UpdateAltISA
void UpdateAltISA(const int AltISA)
Definition trc_pkt_elem_etmv3.h:163
EtmV3TrcPacket::isBadPacket
const bool isBadPacket() const
Definition trc_pkt_elem_etmv3.h:192
ocsd_armv7_exception
enum _ocsd_armv7_exception ocsd_armv7_exception
EtmV3TrcPacket::UpdateContextID
void UpdateContextID(const uint32_t contextID)
Definition trc_pkt_elem_etmv3.h:208
EtmV3TrcPacket::UpdateISA
void UpdateISA(const ocsd_isa isa)
Definition trc_pkt_elem_etmv3.h:175
EtmV3TrcPacket::SetISyncHasCC
void SetISyncHasCC()
Definition trc_pkt_elem_etmv3.h:236
EtmV3TrcPacket::SetISyncIsLSiP
void SetISyncIsLSiP()
Definition trc_pkt_elem_etmv3.h:241
EtmV3TrcPacket::isCtxtUpdated
const bool isCtxtUpdated() const
Definition trc_pkt_elem_etmv3.h:251
EtmV3TrcPacket::SetDataValue
void SetDataValue(const uint32_t value)
Definition trc_pkt_elem_etmv3.h:202
EtmV3TrcPacket::UpdateHyp
void UpdateHyp(const int Hyp)
Definition trc_pkt_elem_etmv3.h:169
EtmV3TrcPacket::UpdateNS
void UpdateNS(const int NS)
Definition trc_pkt_elem_etmv3.h:157
EtmV3TrcPacket::SetCycleCount
void SetCycleCount(const uint32_t cycleCount)
Definition trc_pkt_elem_etmv3.h:226
EtmV3TrcPacket::UpdateDataEndian
void UpdateDataEndian(const uint8_t BE_Val)
Definition trc_pkt_elem_etmv3.h:220
EtmV3TrcPacket::SetErrType
void SetErrType(const ocsd_etmv3_pkt_type e_type)
Definition trc_pkt_elem_etmv3.h:186
ocsd_iSync_reason
enum _ocsd_iSync_reason ocsd_iSync_reason
EtmV3TrcPacket::SetType
void SetType(const ocsd_etmv3_pkt_type p_type)
Definition trc_pkt_elem_etmv3.h:181
EtmV3TrcPacket::UpdateVMID
void UpdateVMID(const uint8_t VMID)
Definition trc_pkt_elem_etmv3.h:214
ETM3_PKT_BAD_SEQUENCE
@ ETM3_PKT_BAD_SEQUENCE
invalid sequence for packet type
Definition trc_pkt_types_etmv3.h:79
_etmv3_context_t::ctxtID
uint32_t ctxtID
Definition trc_pkt_types_etmv3.h:106
_etmv3_context_t::updated
uint32_t updated
Definition trc_pkt_types_etmv3.h:102
_etmv3_context_t::curr_Hyp
uint32_t curr_Hyp
Definition trc_pkt_types_etmv3.h:101
_etmv3_context_t::curr_alt_isa
uint32_t curr_alt_isa
Definition trc_pkt_types_etmv3.h:99
_etmv3_context_t::curr_NS
uint32_t curr_NS
Definition trc_pkt_types_etmv3.h:100
_etmv3_context_t::updated_c
uint32_t updated_c
Definition trc_pkt_types_etmv3.h:103
_etmv3_context_t::updated_v
uint32_t updated_v
Definition trc_pkt_types_etmv3.h:104
_etmv3_context_t::VMID
uint8_t VMID
Definition trc_pkt_types_etmv3.h:107
_etmv3_data_t::value
uint32_t value
Definition trc_pkt_types_etmv3.h:113
_etmv3_data_t::ooo_tag
uint32_t ooo_tag
Definition trc_pkt_types_etmv3.h:117
_etmv3_data_t::update_dval
uint32_t update_dval
Definition trc_pkt_types_etmv3.h:121
_etmv3_data_t::be
uint32_t be
Definition trc_pkt_types_etmv3.h:118
_etmv3_data_t::addr
ocsd_pkt_vaddr addr
Definition trc_pkt_types_etmv3.h:114
_etmv3_data_t::update_be
uint32_t update_be
Definition trc_pkt_types_etmv3.h:119
_etmv3_isync_t::has_LSipAddress
uint32_t has_LSipAddress
Definition trc_pkt_types_etmv3.h:129
_etmv3_isync_t::has_cycle_count
uint32_t has_cycle_count
Definition trc_pkt_types_etmv3.h:128
_etmv3_isync_t::reason
ocsd_iSync_reason reason
Definition trc_pkt_types_etmv3.h:126
_etmv3_isync_t::no_address
uint32_t no_address
Definition trc_pkt_types_etmv3.h:130
_ocsd_etmv3_excep::type
ocsd_armv7_exception type
Definition trc_pkt_types_etmv3.h:86
_ocsd_etmv3_excep::present
uint32_t present
Definition trc_pkt_types_etmv3.h:89
_ocsd_etmv3_excep::cancel
uint32_t cancel
Definition trc_pkt_types_etmv3.h:90
_ocsd_etmv3_excep::bits
struct _ocsd_etmv3_excep::@1 bits
_ocsd_etmv3_excep::number
uint16_t number
Definition trc_pkt_types_etmv3.h:87
_ocsd_etmv3_pkt
Definition trc_pkt_types_etmv3.h:135
_ocsd_etmv3_pkt::exception
ocsd_etmv3_excep exception
Definition trc_pkt_types_etmv3.h:146
_ocsd_etmv3_pkt::addr
ocsd_pkt_vaddr addr
Definition trc_pkt_types_etmv3.h:142
_ocsd_etmv3_pkt::type
ocsd_etmv3_pkt_type type
Definition trc_pkt_types_etmv3.h:136
_ocsd_etmv3_pkt::curr_isa
ocsd_isa curr_isa
Definition trc_pkt_types_etmv3.h:138
_ocsd_etmv3_pkt::p_hdr_fmt
uint8_t p_hdr_fmt
Definition trc_pkt_types_etmv3.h:149
_ocsd_etmv3_pkt::context
etmv3_context_t context
Definition trc_pkt_types_etmv3.h:141
_ocsd_etmv3_pkt::err_type
ocsd_etmv3_pkt_type err_type
Definition trc_pkt_types_etmv3.h:157
_ocsd_etmv3_pkt::data
etmv3_data_t data
Definition trc_pkt_types_etmv3.h:155
_ocsd_etmv3_pkt::prev_isa
ocsd_isa prev_isa
Definition trc_pkt_types_etmv3.h:139
_ocsd_etmv3_pkt::timestamp
uint64_t timestamp
Definition trc_pkt_types_etmv3.h:152
_ocsd_etmv3_pkt::atom
ocsd_pkt_atom atom
Definition trc_pkt_types_etmv3.h:148
_ocsd_etmv3_pkt::isync_info
etmv3_isync_t isync_info
Definition trc_pkt_types_etmv3.h:144
_ocsd_etmv3_pkt::cycle_count
uint32_t cycle_count
Definition trc_pkt_types_etmv3.h:150
_ocsd_pkt_atom
Definition trc_pkt_types.h:85
_ocsd_pkt_vaddr::val
ocsd_vaddr_t val
Definition trc_pkt_types.h:61
trc_pkt_elem_base.h
trc_pkt_types_etmv3.h
trc_printable_elem.h
OpenCSD : Standard printable element base class.