Loading...
Searching...
No Matches
trc_pkt_elem_ptm.h
Go to the documentation of this file.
/*
* \file trc_pkt_elem_ptm.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_PTM_H_INCLUDED
#define ARM_TRC_PKT_ELEM_PTM_H_INCLUDED
#include "trc_pkt_types_ptm.h"
#include "common/trc_printable_elem.h"
#include "common/trc_pkt_elem_base.h"
class PtmTrcPacket : public TrcPacketBase, public ocsd_ptm_pkt, trcPrintableElem
{
public:
PtmTrcPacket();
~PtmTrcPacket();
PtmTrcPacket &operator =(const ocsd_ptm_pkt* p_pkt);
virtual const void *c_pkt() const { return (const ocsd_ptm_pkt *)this; };
// update interface - set packet values
void Clear();
void ResetState();
void SetType(const ocsd_ptm_pkt_type p_type);
void SetErrType(const ocsd_ptm_pkt_type e_type);
void SetException( const ocsd_armv7_exception type,
const uint16_t number);
void SetISyncReason(const ocsd_iSync_reason reason);
void SetCycleCount(const uint32_t cycleCount);
void SetAtomFromPHdr(const uint8_t pHdr);
void SetCycleAccAtomFromPHdr(const uint8_t pHdr);
void UpdateAddress(const ocsd_vaddr_t partAddrVal, const int updateBits);
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);
// packet status interface
// get packet info.
const bool isBadPacket() const;
const ocsd_ptm_pkt_type getType() const;
// isa
const ocsd_isa getISA() const;
const bool ISAChanged() const { return (bool)(curr_isa != prev_isa); };
const uint8_t getAltISA() const { return context.curr_alt_isa; };
const uint8_t getNS() const { return context.curr_NS; };
const uint8_t getHyp() const { return context.curr_Hyp; };
// address
const ocsd_vaddr_t getAddrVal() const { return addr.val; };
// pe context information
const bool CtxtIDUpdated() const { return (bool)(context.updated_c == 1); };
const bool VMIDUpdated() const { return (bool)(context.updated_v == 1); };
const uint32_t getCtxtID() const { return context.ctxtID; };
const uint8_t getVMID() const { return context.VMID; };
const bool PEContextUpdated() const { return context.updated; };
// atom info
const ocsd_pkt_atom &getAtom() const { return atom; };
// branch address info
const bool isBranchExcepPacket() const { return (exception.bits.present == 1); };
const ocsd_armv7_exception excepType() const { return exception.type; };
const uint16_t excepNum() const { return exception.number; };
// isync
const ocsd_iSync_reason iSyncReason() const { return i_sync_reason; };
// cycle count
const bool hasCC() const { return (cc_valid == 1); };
const uint32_t getCCVal() const { return cycle_count; };
// printing
virtual void toString(std::string &str) const;
virtual void toStringFmt(const uint32_t fmtFlags, std::string &str) const;
private:
void packetTypeName(const ocsd_ptm_pkt_type pkt_type, std::string &name, std::string &desc) const;
void getAtomStr(std::string &valStr) const;
void getBranchAddressStr(std::string &valStr) const;
void getExcepStr(std::string &excepStr) const;
void getISAStr(std::string &isaStr) const;
void getCycleCountStr(std::string &subStr) const;
void getISyncStr(std::string &valStr) const;
void getTSStr(std::string &valStr) const;
};
//*** update interface - set packet values
inline void PtmTrcPacket::SetType(const ocsd_ptm_pkt_type p_type)
{
type = p_type;
}
inline void PtmTrcPacket::SetErrType(const ocsd_ptm_pkt_type e_type)
{
err_type = type;
type = e_type;
}
inline void PtmTrcPacket::UpdateNS(const int NS)
{
context.curr_NS = NS;
context.updated = 1;
};
inline void PtmTrcPacket::UpdateAltISA(const int AltISA)
{
context.curr_alt_isa = AltISA;
context.updated = 1;
}
inline void PtmTrcPacket::UpdateHyp(const int Hyp)
{
context.curr_Hyp = Hyp;
context.updated = 1;
}
inline void PtmTrcPacket::UpdateISA(const ocsd_isa isa)
{
prev_isa = curr_isa;
curr_isa = isa;
}
inline void PtmTrcPacket::UpdateContextID(const uint32_t contextID)
{
context.ctxtID = contextID;
context.updated_c = 1;
}
inline void PtmTrcPacket::UpdateVMID(const uint8_t VMID)
{
context.VMID = VMID;
context.updated_v = 1;
}
inline void PtmTrcPacket::SetException( const ocsd_armv7_exception type, const uint16_t number)
{
exception.bits.present = 1;
exception.number = number;
exception.type = type;
}
inline void PtmTrcPacket::SetISyncReason(const ocsd_iSync_reason reason)
{
i_sync_reason = reason;
}
inline void PtmTrcPacket::SetCycleCount(const uint32_t cycleCount)
{
cycle_count = cycleCount;
cc_valid = 1;
}
//*** packet status interface - get packet info.
inline const bool PtmTrcPacket::isBadPacket() const
{
return (bool)(type >= PTM_PKT_BAD_SEQUENCE);
}
inline const ocsd_ptm_pkt_type PtmTrcPacket::getType() const
{
return type;
}
inline const ocsd_isa PtmTrcPacket::getISA() const
{
return curr_isa;
}
#endif // ARM_TRC_PKT_ELEM_PTM_H_INCLUDED
/* End of File trc_pkt_elem_ptm.h */
PtmTrcPacket
Definition trc_pkt_elem_ptm.h:49
PtmTrcPacket::getVMID
const uint8_t getVMID() const
Definition trc_pkt_elem_ptm.h:102
PtmTrcPacket::PtmTrcPacket
PtmTrcPacket()
PtmTrcPacket::hasCC
const bool hasCC() const
Definition trc_pkt_elem_ptm.h:117
PtmTrcPacket::toStringFmt
virtual void toStringFmt(const uint32_t fmtFlags, std::string &str) const
PtmTrcPacket::operator=
PtmTrcPacket & operator=(const ocsd_ptm_pkt *p_pkt)
PtmTrcPacket::SetAtomFromPHdr
void SetAtomFromPHdr(const uint8_t pHdr)
PtmTrcPacket::c_pkt
virtual const void * c_pkt() const
return the underlying C API packet structure
Definition trc_pkt_elem_ptm.h:56
PtmTrcPacket::UpdateTimestamp
void UpdateTimestamp(const uint64_t tsVal, const uint8_t updateBits)
PtmTrcPacket::excepType
const ocsd_armv7_exception excepType() const
Definition trc_pkt_elem_ptm.h:110
PtmTrcPacket::getAddrVal
const ocsd_vaddr_t getAddrVal() const
Definition trc_pkt_elem_ptm.h:96
PtmTrcPacket::getCCVal
const uint32_t getCCVal() const
Definition trc_pkt_elem_ptm.h:118
PtmTrcPacket::~PtmTrcPacket
~PtmTrcPacket()
PtmTrcPacket::VMIDUpdated
const bool VMIDUpdated() const
Definition trc_pkt_elem_ptm.h:100
PtmTrcPacket::getCtxtID
const uint32_t getCtxtID() const
Definition trc_pkt_elem_ptm.h:101
PtmTrcPacket::Clear
void Clear()
clear update data in packet ready for new one.
PtmTrcPacket::ResetState
void ResetState()
reset intra packet state data - on full decoder reset.
PtmTrcPacket::UpdateAddress
void UpdateAddress(const ocsd_vaddr_t partAddrVal, const int updateBits)
PtmTrcPacket::getAtom
const ocsd_pkt_atom & getAtom() const
Definition trc_pkt_elem_ptm.h:106
PtmTrcPacket::iSyncReason
const ocsd_iSync_reason iSyncReason() const
Definition trc_pkt_elem_ptm.h:114
PtmTrcPacket::PEContextUpdated
const bool PEContextUpdated() const
Definition trc_pkt_elem_ptm.h:103
PtmTrcPacket::ISAChanged
const bool ISAChanged() const
Definition trc_pkt_elem_ptm.h:90
PtmTrcPacket::isBranchExcepPacket
const bool isBranchExcepPacket() const
Definition trc_pkt_elem_ptm.h:109
PtmTrcPacket::toString
virtual void toString(std::string &str) const
PtmTrcPacket::getAltISA
const uint8_t getAltISA() const
Definition trc_pkt_elem_ptm.h:91
PtmTrcPacket::getNS
const uint8_t getNS() const
Definition trc_pkt_elem_ptm.h:92
PtmTrcPacket::excepNum
const uint16_t excepNum() const
Definition trc_pkt_elem_ptm.h:111
PtmTrcPacket::CtxtIDUpdated
const bool CtxtIDUpdated() const
Definition trc_pkt_elem_ptm.h:99
PtmTrcPacket::SetCycleAccAtomFromPHdr
void SetCycleAccAtomFromPHdr(const uint8_t pHdr)
PtmTrcPacket::getHyp
const uint8_t getHyp() const
Definition trc_pkt_elem_ptm.h:93
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
PtmTrcPacket::SetISyncReason
void SetISyncReason(const ocsd_iSync_reason reason)
Definition trc_pkt_elem_ptm.h:191
PtmTrcPacket::SetCycleCount
void SetCycleCount(const uint32_t cycleCount)
Definition trc_pkt_elem_ptm.h:196
PtmTrcPacket::UpdateContextID
void UpdateContextID(const uint32_t contextID)
Definition trc_pkt_elem_ptm.h:172
PtmTrcPacket::UpdateAltISA
void UpdateAltISA(const int AltISA)
Definition trc_pkt_elem_ptm.h:154
PtmTrcPacket::getType
const ocsd_ptm_pkt_type getType() const
Definition trc_pkt_elem_ptm.h:208
PtmTrcPacket::UpdateHyp
void UpdateHyp(const int Hyp)
Definition trc_pkt_elem_ptm.h:160
PtmTrcPacket::UpdateISA
void UpdateISA(const ocsd_isa isa)
Definition trc_pkt_elem_ptm.h:166
ocsd_armv7_exception
enum _ocsd_armv7_exception ocsd_armv7_exception
ocsd_ptm_pkt_type
enum _ocsd_ptm_pkt_type ocsd_ptm_pkt_type
PtmTrcPacket::UpdateVMID
void UpdateVMID(const uint8_t VMID)
Definition trc_pkt_elem_ptm.h:178
PtmTrcPacket::getISA
const ocsd_isa getISA() const
Definition trc_pkt_elem_ptm.h:213
PtmTrcPacket::SetException
void SetException(const ocsd_armv7_exception type, const uint16_t number)
Definition trc_pkt_elem_ptm.h:184
PtmTrcPacket::UpdateNS
void UpdateNS(const int NS)
Definition trc_pkt_elem_ptm.h:148
ocsd_iSync_reason
enum _ocsd_iSync_reason ocsd_iSync_reason
PtmTrcPacket::SetType
void SetType(const ocsd_ptm_pkt_type p_type)
Definition trc_pkt_elem_ptm.h:137
PtmTrcPacket::isBadPacket
const bool isBadPacket() const
Definition trc_pkt_elem_ptm.h:203
PtmTrcPacket::SetErrType
void SetErrType(const ocsd_ptm_pkt_type e_type)
Definition trc_pkt_elem_ptm.h:142
PTM_PKT_BAD_SEQUENCE
@ PTM_PKT_BAD_SEQUENCE
invalid sequence for packet type
Definition trc_pkt_types_ptm.h:69
_ocsd_pkt_atom
Definition trc_pkt_types.h:85
_ocsd_pkt_vaddr::val
ocsd_vaddr_t val
Definition trc_pkt_types.h:61
_ocsd_ptm_excep::type
ocsd_armv7_exception type
Definition trc_pkt_types_ptm.h:88
_ocsd_ptm_excep::number
uint16_t number
Definition trc_pkt_types_ptm.h:89
_ocsd_ptm_excep::present
uint32_t present
Definition trc_pkt_types_ptm.h:91
_ocsd_ptm_excep::bits
struct _ocsd_ptm_excep::@28 bits
_ocsd_ptm_pkt
Definition trc_pkt_types_ptm.h:97
_ocsd_ptm_pkt::cycle_count
uint32_t cycle_count
Definition trc_pkt_types_ptm.h:109
_ocsd_ptm_pkt::cc_valid
uint8_t cc_valid
Definition trc_pkt_types_ptm.h:110
_ocsd_ptm_pkt::exception
ocsd_ptm_excep exception
Definition trc_pkt_types_ptm.h:115
_ocsd_ptm_pkt::curr_isa
ocsd_isa curr_isa
Definition trc_pkt_types_ptm.h:100
_ocsd_ptm_pkt::addr
ocsd_pkt_vaddr addr
Definition trc_pkt_types_ptm.h:103
_ocsd_ptm_pkt::context
ptm_context_t context
Definition trc_pkt_types_ptm.h:104
_ocsd_ptm_pkt::err_type
ocsd_ptm_pkt_type err_type
Definition trc_pkt_types_ptm.h:117
_ocsd_ptm_pkt::atom
ocsd_pkt_atom atom
Definition trc_pkt_types_ptm.h:105
_ocsd_ptm_pkt::type
ocsd_ptm_pkt_type type
Definition trc_pkt_types_ptm.h:98
_ocsd_ptm_pkt::i_sync_reason
ocsd_iSync_reason i_sync_reason
Definition trc_pkt_types_ptm.h:107
_ocsd_ptm_pkt::prev_isa
ocsd_isa prev_isa
Definition trc_pkt_types_ptm.h:101
_ptm_context_t::updated_v
uint32_t updated_v
Definition trc_pkt_types_ptm.h:81
_ptm_context_t::curr_NS
uint32_t curr_NS
Definition trc_pkt_types_ptm.h:77
_ptm_context_t::updated_c
uint32_t updated_c
Definition trc_pkt_types_ptm.h:80
_ptm_context_t::curr_Hyp
uint32_t curr_Hyp
Definition trc_pkt_types_ptm.h:78
_ptm_context_t::updated
uint32_t updated
Definition trc_pkt_types_ptm.h:79
_ptm_context_t::ctxtID
uint32_t ctxtID
Definition trc_pkt_types_ptm.h:83
_ptm_context_t::curr_alt_isa
uint32_t curr_alt_isa
Definition trc_pkt_types_ptm.h:76
_ptm_context_t::VMID
uint8_t VMID
Definition trc_pkt_types_ptm.h:84
trc_pkt_elem_base.h
trc_pkt_types_ptm.h
trc_printable_elem.h
OpenCSD : Standard printable element base class.