summaryrefslogtreecommitdiffstats
path: root/decoder/include/opencsd/ptm
diff options
context:
space:
mode:
Diffstat (limited to 'decoder/include/opencsd/ptm')
-rw-r--r--decoder/include/opencsd/ptm/ptm_decoder.h46
-rw-r--r--decoder/include/opencsd/ptm/trc_cmp_cfg_ptm.h210
-rw-r--r--decoder/include/opencsd/ptm/trc_dcd_mngr_ptm.h57
-rw-r--r--decoder/include/opencsd/ptm/trc_pkt_decode_ptm.h198
-rw-r--r--decoder/include/opencsd/ptm/trc_pkt_elem_ptm.h221
-rw-r--r--decoder/include/opencsd/ptm/trc_pkt_proc_ptm.h215
-rw-r--r--decoder/include/opencsd/ptm/trc_pkt_types_ptm.h137
7 files changed, 1084 insertions, 0 deletions
diff --git a/decoder/include/opencsd/ptm/ptm_decoder.h b/decoder/include/opencsd/ptm/ptm_decoder.h
new file mode 100644
index 0000000..80086d2
--- /dev/null
+++ b/decoder/include/opencsd/ptm/ptm_decoder.h
@@ -0,0 +1,46 @@
+/*
+ * \file ptm_decoder.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_PTM_DECODER_H_INCLUDED
+#define ARM_PTM_DECODER_H_INCLUDED
+
+#include "trc_cmp_cfg_ptm.h"
+#include "trc_pkt_elem_ptm.h"
+#include "trc_pkt_proc_ptm.h"
+#include "trc_pkt_types_ptm.h"
+#include "trc_pkt_decode_ptm.h"
+
+#endif // ARM_PTM_DECODER_H_INCLUDED
+
+/* End of File ptm_decoder.h */
diff --git a/decoder/include/opencsd/ptm/trc_cmp_cfg_ptm.h b/decoder/include/opencsd/ptm/trc_cmp_cfg_ptm.h
new file mode 100644
index 0000000..e086aae
--- /dev/null
+++ b/decoder/include/opencsd/ptm/trc_cmp_cfg_ptm.h
@@ -0,0 +1,210 @@
+/*
+ * \file trc_cmp_cfg_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_CMP_CFG_PTM_H_INCLUDED
+#define ARM_TRC_CMP_CFG_PTM_H_INCLUDED
+
+#include "trc_pkt_types_ptm.h"
+#include "common/trc_cs_config.h"
+
+/** @defgroup ocsd_protocol_cfg OpenCSD Library : Trace Source Protocol Configuration.
+
+ @brief Classes describing the trace capture time configuration of the trace source hardware.
+
+ Protocol configuration represents the trace capture time settings for the CoreSight hardware
+ component generating the trace. The packet processors and packet decoders require this configuration
+ information to correctly interpret packets and decode trace.
+
+@{*/
+
+/** @name PTM configuration
+@{*/
+
+/*!
+ * @class PtmConfig
+ * @brief Interpreter class for PTM Hardware configuration.
+ *
+ * Provides quick value interpretation methods for the PTM config register values.
+ * Primarily inlined for efficient code.
+ */
+class PtmConfig : public CSConfig // public ocsd_ptm_cfg
+{
+public:
+ PtmConfig(); /**< Default constructor */
+ PtmConfig(const ocsd_ptm_cfg *cfg_regs);
+ ~PtmConfig() {}; /**< Default destructor */
+
+ /* register bit constants. */
+ static const uint32_t CTRL_BRANCH_BCAST = (0x1 << 8);
+ static const uint32_t CTRL_CYCLEACC = (0x1 << 12);
+ static const uint32_t CTRL_TS_ENA = (0x1 << 28);
+ static const uint32_t CTRL_RETSTACK_ENA = (0x1 << 29);
+ static const uint32_t CTRL_VMID_ENA = (0x1 << 30);
+
+ static const uint32_t CCER_TS_IMPL = (0x1 << 22);
+ static const uint32_t CCER_RESTACK_IMPL = (0x1 << 23);
+ static const uint32_t CCER_DMSB_WPT = (0x1 << 24);
+ static const uint32_t CCER_TS_DMSB = (0x1 << 25);
+ static const uint32_t CCER_VIRTEXT = (0x1 << 26);
+ static const uint32_t CCER_TS_ENC_NAT = (0x1 << 28);
+ static const uint32_t CCER_TS_64BIT = (0x1 << 29);
+
+// operations to convert to and from C-API structure
+
+ //! copy assignment operator for base structure into class.
+ PtmConfig & operator=(const ocsd_ptm_cfg *p_cfg);
+
+ //! cast operator returning struct const reference
+ operator const ocsd_ptm_cfg &() const { return m_cfg; };
+ //! cast operator returning struct const pointer
+ operator const ocsd_ptm_cfg *() const { return &m_cfg; };
+
+// access functions
+
+ const bool enaBranchBCast() const; //!< Branch broadcast enabled.
+ const bool enaCycleAcc() const; //!< cycle accurate tracing enabled.
+
+ const bool enaRetStack() const; //!< return stack enabled.
+ const bool hasRetStack() const; //!< return stack implemented.
+
+ const int MinorRev() const; //!< return X revision in 1.X
+
+ const bool hasTS() const; //!< Timestamps implemented in trace.
+ const bool enaTS() const; //!< Timestamp trace is enabled.
+ const bool TSPkt64() const; //!< timestamp packet is 64 bits in size.
+ const bool TSBinEnc() const; //!< Timestamp encoded as natural binary number.
+
+ const int CtxtIDBytes() const; //!< number of context ID bytes traced 1,2,4;
+ const bool hasVirtExt() const; //!< processor has virtualisation extensions.
+ const bool enaVMID() const; //!< VMID tracing enabled.
+
+ const bool dmsbGenTS() const; //!< TS generated for DMB and DSB
+ const bool dmsbWayPt() const; //!< DMB and DSB are waypoint instructions.
+
+ virtual const uint8_t getTraceID() const; //!< CoreSight Trace ID for this device.
+
+ const ocsd_core_profile_t &coreProfile() const { return m_cfg.core_prof; };
+ const ocsd_arch_version_t &archVersion() const { return m_cfg.arch_ver; };
+
+private:
+ ocsd_ptm_cfg m_cfg;
+};
+
+/* inlines */
+
+inline PtmConfig & PtmConfig::operator=(const ocsd_ptm_cfg *p_cfg)
+{
+ // object of base class ocsd_ptm_cfg
+ m_cfg = *p_cfg;
+ return *this;
+}
+
+inline const bool PtmConfig::enaBranchBCast() const
+{
+ return (bool)((m_cfg.reg_ctrl & CTRL_BRANCH_BCAST) != 0);
+}
+
+inline const bool PtmConfig::enaCycleAcc() const
+{
+ return (bool)((m_cfg.reg_ctrl & CTRL_CYCLEACC) != 0);
+}
+
+inline const bool PtmConfig::enaRetStack() const
+{
+ return (bool)((m_cfg.reg_ctrl & CTRL_RETSTACK_ENA) != 0);
+}
+
+inline const bool PtmConfig::hasRetStack() const
+{
+ return (bool)((m_cfg.reg_ccer & CCER_RESTACK_IMPL) != 0);
+}
+
+inline const int PtmConfig::MinorRev() const
+{
+ return ((int)m_cfg.reg_idr & 0xF0) >> 4;
+}
+
+inline const bool PtmConfig::hasTS() const
+{
+ return (bool)((m_cfg.reg_ccer & CCER_TS_IMPL) != 0);
+}
+
+inline const bool PtmConfig::enaTS() const
+{
+ return (bool)((m_cfg.reg_ctrl & CTRL_TS_ENA) != 0);
+}
+
+inline const bool PtmConfig::TSPkt64() const
+{
+ if(MinorRev() == 0) return false;
+ return (bool)((m_cfg.reg_ccer & CCER_TS_64BIT) != 0);
+}
+
+inline const bool PtmConfig::TSBinEnc() const
+{
+ if(MinorRev() == 0) return false;
+ return (bool)((m_cfg.reg_ccer & CCER_TS_ENC_NAT) != 0);
+}
+
+inline const bool PtmConfig::hasVirtExt() const
+{
+ return (bool)((m_cfg.reg_ccer & CCER_VIRTEXT) != 0);
+}
+
+inline const bool PtmConfig::enaVMID() const
+{
+ return (bool)((m_cfg.reg_ctrl & CTRL_VMID_ENA) != 0);
+}
+
+inline const bool PtmConfig::dmsbGenTS() const
+{
+ return (bool)((m_cfg.reg_ccer & CCER_TS_DMSB) != 0);
+}
+
+inline const bool PtmConfig::dmsbWayPt() const
+{
+ return (bool)((m_cfg.reg_ccer & CCER_DMSB_WPT) != 0);
+}
+
+inline const uint8_t PtmConfig::getTraceID() const
+{
+ return (uint8_t)(m_cfg.reg_trc_id & 0x7F);
+}
+
+/** @}*/
+/** @}*/
+#endif // ARM_TRC_CMP_CFG_PTM_H_INCLUDED
+
+/* End of File trc_cmp_cfg_ptm.h */
diff --git a/decoder/include/opencsd/ptm/trc_dcd_mngr_ptm.h b/decoder/include/opencsd/ptm/trc_dcd_mngr_ptm.h
new file mode 100644
index 0000000..0defb0d
--- /dev/null
+++ b/decoder/include/opencsd/ptm/trc_dcd_mngr_ptm.h
@@ -0,0 +1,57 @@
+/*
+ * \file trc_dcd_mngr_ptm.h
+ * \brief OpenCSD : PTM decoder manager / handler specialisation
+ *
+ * \copyright Copyright (c) 2016, 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_DCD_MNGR_PTM_H_INCLUDED
+#define ARM_TRC_DCD_MNGR_PTM_H_INCLUDED
+
+#include "common/ocsd_dcd_mngr.h"
+#include "trc_pkt_decode_ptm.h"
+#include "trc_pkt_proc_ptm.h"
+#include "trc_cmp_cfg_ptm.h"
+#include "trc_pkt_types_ptm.h"
+
+class DecoderMngrPtm : public DecodeMngrFullDcd< PtmTrcPacket,
+ ocsd_ptm_pkt_type,
+ PtmConfig,
+ ocsd_ptm_cfg,
+ TrcPktProcPtm,
+ TrcPktDecodePtm>
+{
+public:
+ DecoderMngrPtm(const std::string &name) : DecodeMngrFullDcd(name,OCSD_PROTOCOL_PTM) {};
+ virtual ~DecoderMngrPtm() {};
+};
+
+#endif // ARM_TRC_DCD_MNGR_PTM_H_INCLUDED
+
+/* End of File trc_dcd_mngr_ptm.h */
diff --git a/decoder/include/opencsd/ptm/trc_pkt_decode_ptm.h b/decoder/include/opencsd/ptm/trc_pkt_decode_ptm.h
new file mode 100644
index 0000000..f9e1abe
--- /dev/null
+++ b/decoder/include/opencsd/ptm/trc_pkt_decode_ptm.h
@@ -0,0 +1,198 @@
+/*
+ * \file trc_pkt_decode_ptm.h
+ * \brief OpenCSD : PTM packet decoder.
+ *
+ * \copyright Copyright (c) 2016, 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_DECODE_PTM_H_INCLUDED
+#define ARM_TRC_PKT_DECODE_PTM_H_INCLUDED
+
+#include "common/trc_pkt_decode_base.h"
+#include "opencsd/ptm/trc_pkt_elem_ptm.h"
+#include "opencsd/ptm/trc_cmp_cfg_ptm.h"
+#include "common/trc_gen_elem.h"
+#include "common/trc_ret_stack.h"
+
+/**************** Atom handling class **************************************/
+class PtmAtoms
+{
+public:
+ PtmAtoms() {};
+ ~PtmAtoms() {};
+
+ //! initialise the atom and index values
+ void initAtomPkt(const ocsd_pkt_atom &atom, const ocsd_trc_index_t &root_index);
+
+ const ocsd_atm_val getCurrAtomVal() const;
+ const int numAtoms() const; //!< number of atoms
+ const ocsd_trc_index_t pktIndex() const; //!< originating packet index
+
+ void clearAtom(); //!< clear the current atom, set the next.
+ void clearAll(); //!< clear all
+
+private:
+ ocsd_pkt_atom m_atom;
+ ocsd_trc_index_t m_root_index; //!< root index for the atom packet
+};
+
+inline void PtmAtoms::initAtomPkt(const ocsd_pkt_atom &atom, const ocsd_trc_index_t &root_index)
+{
+ m_atom = atom;
+ m_root_index = root_index;
+}
+
+inline const ocsd_atm_val PtmAtoms::getCurrAtomVal() const
+{
+ return (m_atom.En_bits & 0x1) ? ATOM_E : ATOM_N;
+}
+
+inline const int PtmAtoms::numAtoms() const
+{
+ return m_atom.num;
+}
+
+inline const ocsd_trc_index_t PtmAtoms::pktIndex() const
+{
+ return m_root_index;
+}
+
+inline void PtmAtoms::clearAtom()
+{
+ if(m_atom.num)
+ {
+ m_atom.num--;
+ m_atom.En_bits >>=1;
+ }
+}
+
+inline void PtmAtoms::clearAll()
+{
+ m_atom.num = 0;
+}
+
+/********** Main decode class ****************************************************/
+class TrcPktDecodePtm : public TrcPktDecodeBase<PtmTrcPacket, PtmConfig>
+{
+public:
+ TrcPktDecodePtm();
+ TrcPktDecodePtm(int instIDNum);
+ virtual ~TrcPktDecodePtm();
+
+protected:
+ /* implementation packet decoding interface */
+ virtual ocsd_datapath_resp_t processPacket();
+ virtual ocsd_datapath_resp_t onEOT();
+ virtual ocsd_datapath_resp_t onReset();
+ virtual ocsd_datapath_resp_t onFlush();
+ virtual ocsd_err_t onProtocolConfig();
+ virtual const uint8_t getCoreSightTraceID() { return m_CSID; };
+
+ /* local decode methods */
+
+private:
+ /** operation for the trace instruction follower */
+ typedef enum {
+ TRACE_WAYPOINT, //!< standard operation - trace to waypoint - default op
+ TRACE_TO_ADDR_EXCL, //!< trace to supplied address - address is 1st instuction not executed.
+ TRACE_TO_ADDR_INCL //!< trace to supplied address - address is last instruction executed.
+ } waypoint_trace_t;
+
+ void initDecoder();
+ void resetDecoder();
+
+ ocsd_datapath_resp_t decodePacket();
+ ocsd_datapath_resp_t contProcess();
+ ocsd_datapath_resp_t processIsync();
+ ocsd_datapath_resp_t processBranch();
+ ocsd_datapath_resp_t processWPUpdate();
+ ocsd_datapath_resp_t processAtom();
+ ocsd_err_t traceInstrToWP(bool &bWPFound, const waypoint_trace_t traceWPOp = TRACE_WAYPOINT, const ocsd_vaddr_t nextAddrMatch = 0); //!< follow instructions from the current address to a WP. true if good, false if memory cannot be accessed.
+ ocsd_datapath_resp_t processAtomRange(const ocsd_atm_val A, const char *pkt_msg, const waypoint_trace_t traceWPOp = TRACE_WAYPOINT, const ocsd_vaddr_t nextAddrMatch = 0);
+ void checkPendingNacc(ocsd_datapath_resp_t &resp);
+
+ uint8_t m_CSID; //!< Coresight trace ID for this decoder.
+
+//** Other processor state;
+
+ // trace decode FSM
+ typedef enum {
+ NO_SYNC, //!< pre start trace - init state or after reset or overflow, loss of sync.
+ WAIT_SYNC, //!< waiting for sync packet.
+ WAIT_ISYNC, //!< waiting for isync packet after 1st ASYNC.
+ DECODE_PKTS, //!< processing input packet
+ CONT_ISYNC, //!< continue processing isync packet after WAIT.
+ CONT_ATOM, //!< continue processing atom packet after WAIT.
+ CONT_WPUP, //!< continue processing WP update packet after WAIT.
+ CONT_BRANCH, //!< continue processing Branch packet after WAIT.
+ } processor_state_t;
+
+ processor_state_t m_curr_state;
+ unsync_info_t m_unsync_info;
+
+ const bool processStateIsCont() const;
+
+ // PE decode state - address and isa
+
+ //! Structure to contain the PE addr and ISA state.
+ typedef struct _ptm_pe_addr_state {
+ ocsd_isa isa; //!< current isa.
+ ocsd_vaddr_t instr_addr; //!< current address.
+ bool valid; //!< address valid - false if we need an address to continue decode.
+ } ptm_pe_addr_state;
+
+ ptm_pe_addr_state m_curr_pe_state; //!< current instruction state for PTM decode.
+ ocsd_pe_context m_pe_context; //!< current context information
+
+ // packet decode state
+ bool m_need_isync; //!< need context to continue
+
+ ocsd_instr_info m_instr_info; //!< instruction info for code follower - in address is the next to be decoded.
+
+ bool m_mem_nacc_pending; //!< need to output a memory access failure packet
+ ocsd_vaddr_t m_nacc_addr; //!< address of memory access failure
+
+ bool m_i_sync_pe_ctxt; //!< isync has pe context.
+
+ PtmAtoms m_atoms; //!< atoms to process in an atom packet
+
+ TrcAddrReturnStack m_return_stack; //!< trace return stack.
+
+//** output element
+ OcsdTraceElement m_output_elem;
+};
+
+inline const bool TrcPktDecodePtm::processStateIsCont() const
+{
+ return (bool)(m_curr_state >= CONT_ISYNC);
+}
+
+#endif // ARM_TRC_PKT_DECODE_PTM_H_INCLUDED
+
+/* End of File trc_pkt_decode_ptm.h */
diff --git a/decoder/include/opencsd/ptm/trc_pkt_elem_ptm.h b/decoder/include/opencsd/ptm/trc_pkt_elem_ptm.h
new file mode 100644
index 0000000..266bd2b
--- /dev/null
+++ b/decoder/include/opencsd/ptm/trc_pkt_elem_ptm.h
@@ -0,0 +1,221 @@
+/*
+ * \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"
+
+/** @addtogroup trc_pkts
+@{*/
+
+
+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(); //!< clear update data in packet ready for new one.
+ void ResetState(); //!< reset intra packet state data - on full decoder reset.
+
+ 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 */
diff --git a/decoder/include/opencsd/ptm/trc_pkt_proc_ptm.h b/decoder/include/opencsd/ptm/trc_pkt_proc_ptm.h
new file mode 100644
index 0000000..87e933a
--- /dev/null
+++ b/decoder/include/opencsd/ptm/trc_pkt_proc_ptm.h
@@ -0,0 +1,215 @@
+/*
+ * \file trc_pkt_proc_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_PROC_PTM_H_INCLUDED
+#define ARM_TRC_PKT_PROC_PTM_H_INCLUDED
+
+#include "trc_pkt_types_ptm.h"
+#include "common/trc_pkt_proc_base.h"
+#include "trc_pkt_elem_ptm.h"
+#include "trc_cmp_cfg_ptm.h"
+
+class PtmTrcPacket;
+class PtmConfig;
+
+/** @addtogroup ocsd_pkt_proc
+@{*/
+
+
+
+class TrcPktProcPtm : public TrcPktProcBase< PtmTrcPacket, ocsd_ptm_pkt_type, PtmConfig>
+{
+public:
+ TrcPktProcPtm();
+ TrcPktProcPtm(int instIDNum);
+ virtual ~TrcPktProcPtm();
+
+protected:
+ /* implementation packet processing interface */
+ virtual ocsd_datapath_resp_t processData( const ocsd_trc_index_t index,
+ const uint32_t dataBlockSize,
+ const uint8_t *pDataBlock,
+ uint32_t *numBytesProcessed);
+ virtual ocsd_datapath_resp_t onEOT();
+ virtual ocsd_datapath_resp_t onReset();
+ virtual ocsd_datapath_resp_t onFlush();
+ virtual ocsd_err_t onProtocolConfig();
+ virtual const bool isBadPacket() const;
+
+ void InitPacketState(); // clear current packet state.
+ void InitProcessorState(); // clear all previous process state
+
+ ocsd_datapath_resp_t outputPacket();
+
+ typedef enum _process_state {
+ WAIT_SYNC,
+ PROC_HDR,
+ PROC_DATA,
+ SEND_PKT,
+ } process_state;
+
+ process_state m_process_state; // process algorithm state.
+
+ std::vector<uint8_t> m_currPacketData; // raw data
+ uint32_t m_currPktIdx; // index into packet when expanding
+ PtmTrcPacket m_curr_packet; // expanded packet
+ ocsd_trc_index_t m_curr_pkt_index; // trace index at start of packet.
+
+ const bool readByte(uint8_t &currByte);
+ const bool readByte(); // just read into buffer, don't need the value
+ void unReadByte(); // remove last byte from the buffer.
+
+ uint8_t m_chanIDCopy;
+
+ // current data block being processed.
+ const uint8_t *m_pDataIn;
+ uint32_t m_dataInLen;
+ uint32_t m_dataInProcessed;
+ ocsd_trc_index_t m_block_idx; // index start for current block
+
+ // processor synchronisation
+ const bool isSync() const;
+ ocsd_datapath_resp_t waitASync(); //!< look for first synchronisation point in the packet stream
+ bool m_waitASyncSOPkt;
+ bool m_bAsyncRawOp;
+ bool m_bOPNotSyncPkt; //!< true if output not sync packet when waiting for ASYNC
+
+ // ** packet processing functions.
+ void pktASync();
+ void pktISync();
+ void pktTrigger();
+ void pktWPointUpdate();
+ void pktIgnore();
+ void pktCtxtID();
+ void pktVMID();
+ void pktAtom();
+ void pktTimeStamp();
+ void pktExceptionRet();
+ void pktBranchAddr();
+ void pktReserved();
+
+ // async finder
+ typedef enum _async_result {
+ ASYNC, //!< pattern confirmed async 0x00 x 5, 0x80
+ NOT_ASYNC, //!< pattern confirmed not async
+ ASYNC_EXTRA_0, //!< pattern confirmed 0x00 x N + ASYNC
+ THROW_0, //!< long pattern of 0x00 - throw some away.
+ ASYNC_INCOMPLETE, //!< not enough input data.
+ } async_result_t;
+
+ async_result_t findAsync();
+
+ int m_async_0; // number of current consecutive async 0s
+
+ bool m_part_async;
+
+ // number of extra 0s before we throw 0 on async detect.
+ #define ASYNC_PAD_0_LIMIT 11
+ // number of 0s minimum to form an async
+ #define ASYNC_REQ_0 5
+
+ // extraction sub-routines
+ void extractCtxtID(int idx, uint32_t &ctxtID);
+ void extractCycleCount(int idx, uint32_t &cycleCount);
+ int extractTS(uint64_t &tsVal, uint8_t &tsUpdateBits);
+ uint32_t extractAddress(const int offset,uint8_t &total_bits);
+
+ // number of bytes required for a complete packet - used in some multi byte packets
+ int m_numPktBytesReq;
+
+ // packet processing state
+ bool m_needCycleCount;
+ bool m_gotCycleCount;
+ int m_gotCCBytes; // number of CC bytes read so far
+
+ int m_numCtxtIDBytes;
+ int m_gotCtxtIDBytes;
+
+ bool m_gotTSBytes; //!< got all TS bytes
+ int m_tsByteMax; //!< max size for TS portion of TS packet.
+
+ // branch address state
+ bool m_gotAddrBytes; //!< got all Addr bytes in branch packet
+ int m_numAddrBytes; //!< number of address bytes
+ bool m_gotExcepBytes; //!< got all needed exception bytes
+ int m_numExcepBytes; //!< got 1st exception byte
+ ocsd_isa m_addrPktIsa; //!< ISA of the branch address packet
+ int m_excepAltISA; //!< Alt ISA bit iff exception bytes
+
+ // bad packets
+ void throwMalformedPacketErr(const char *pszErrMsg);
+ void throwPacketHeaderErr(const char *pszErrMsg);
+
+
+ // packet processing function table
+ typedef void (TrcPktProcPtm::*PPKTFN)(void);
+ PPKTFN m_pIPktFn;
+
+ struct _pkt_i_table_t {
+ ocsd_ptm_pkt_type pkt_type;
+ PPKTFN pptkFn;
+ } m_i_table[256];
+
+ void BuildIPacketTable();
+
+};
+
+inline const bool TrcPktProcPtm::isSync() const
+{
+ return (bool)(m_curr_packet.getType() == PTM_PKT_NOTSYNC);
+}
+
+inline void TrcPktProcPtm::throwMalformedPacketErr(const char *pszErrMsg)
+{
+ m_curr_packet.SetErrType(PTM_PKT_BAD_SEQUENCE);
+ throw ocsdError(OCSD_ERR_SEV_ERROR,OCSD_ERR_BAD_PACKET_SEQ,m_curr_pkt_index,m_chanIDCopy,pszErrMsg);
+}
+
+inline void TrcPktProcPtm::throwPacketHeaderErr(const char *pszErrMsg)
+{
+ throw ocsdError(OCSD_ERR_SEV_ERROR,OCSD_ERR_INVALID_PCKT_HDR,m_curr_pkt_index,m_chanIDCopy,pszErrMsg);
+}
+
+inline const bool TrcPktProcPtm::readByte()
+{
+ uint8_t currByte;
+ return readByte(currByte);
+}
+
+/** @}*/
+
+#endif // ARM_TRC_PKT_PROC_PTM_H_INCLUDED
+
+/* End of File trc_pkt_proc_ptm.h */
diff --git a/decoder/include/opencsd/ptm/trc_pkt_types_ptm.h b/decoder/include/opencsd/ptm/trc_pkt_types_ptm.h
new file mode 100644
index 0000000..45d994d
--- /dev/null
+++ b/decoder/include/opencsd/ptm/trc_pkt_types_ptm.h
@@ -0,0 +1,137 @@
+/*
+ * \file trc_pkt_ptm_types.h
+ * \brief OpenCSD : PTM specific types
+ *
+ * \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_PTM_TYPES_H_INCLUDED
+#define ARM_TRC_PKT_PTM_TYPES_H_INCLUDED
+
+#include "opencsd/trc_pkt_types.h"
+
+/** @addtogroup trc_pkts
+@{*/
+
+/** @name PTM Packet Types
+@{*/
+
+typedef enum _ocsd_ptm_pkt_type
+{
+// markers for unknown packets
+ PTM_PKT_NOTSYNC, //!< no sync found yet
+ PTM_PKT_INCOMPLETE_EOT, //!< flushing incomplete packet at end of trace.
+ PTM_PKT_NOERROR, //!< no error base type packet.
+
+// markers for valid packets
+ PTM_PKT_BRANCH_ADDRESS, //!< Branch address with optional exception.
+ PTM_PKT_A_SYNC, //!< Alignment Synchronisation.
+ PTM_PKT_I_SYNC, //!< Instruction sync with address.
+ PTM_PKT_TRIGGER, //!< trigger packet
+ PTM_PKT_WPOINT_UPDATE, //!< Waypoint update.
+ PTM_PKT_IGNORE, //!< ignore packet.
+ PTM_PKT_CONTEXT_ID, //!< context id packet.
+ PTM_PKT_VMID, //!< VMID packet
+ PTM_PKT_ATOM, //!< atom waypoint packet.
+ PTM_PKT_TIMESTAMP, //!< timestamp packet.
+ PTM_PKT_EXCEPTION_RET, //!< exception return.
+ PTM_PKT_BRANCH_OR_BYPASS_EOT, // interpreter FSM 'state' : unsure if branch 0 packet or bypass flush end of trace
+ PTM_PKT_TPIU_PAD_EOB, // pad end of a buffer - no valid trace at this point
+
+// markers for bad packets
+ PTM_PKT_BAD_SEQUENCE, //!< invalid sequence for packet type
+ PTM_PKT_RESERVED, //!< Reserved packet encoding
+
+} ocsd_ptm_pkt_type;
+
+typedef struct _ptm_context_t {
+ struct {
+ uint32_t curr_alt_isa:1; /**< current Alt ISA flag for Tee / T32 (used if not in present packet) */
+ uint32_t curr_NS:1; /**< current NS flag (used if not in present packet) */
+ uint32_t curr_Hyp:1; /**< current Hyp flag (used if not in present packet) */
+ uint32_t updated:1; /**< context updated */
+ uint32_t updated_c:1; /**< updated CtxtID */
+ uint32_t updated_v:1; /**< updated VMID */
+ };
+ uint32_t ctxtID; /**< Context ID */
+ uint8_t VMID; /**< VMID */
+} ptm_context_t;
+
+typedef struct _ocsd_ptm_excep {
+ ocsd_armv7_exception type; /**< exception type. */
+ uint16_t number; /**< exception as number */
+ struct {
+ uint32_t present:1; /**< exception present in packet */
+ } bits;
+} ocsd_ptm_excep;
+
+
+typedef struct _ocsd_ptm_pkt
+{
+ ocsd_ptm_pkt_type type; /**< Primary packet type. */
+
+ ocsd_isa curr_isa; /**< current ISA. */
+ ocsd_isa prev_isa; /**< previous ISA */
+
+ ocsd_pkt_vaddr addr; /**< current address. */
+ ptm_context_t context; /**< current context. */
+ ocsd_pkt_atom atom;
+
+ ocsd_iSync_reason i_sync_reason; /**< reason for ISync Packet. */
+
+ uint32_t cycle_count; /**< cycle count value associated with this packet. */
+ uint8_t cc_valid; /**< cycle count value valid. */
+
+ uint64_t timestamp; /**< timestamp value. */
+ uint8_t ts_update_bits; /**< bits of ts updated this packet. (if TS packet) */
+
+ ocsd_ptm_excep exception; /**< exception information in packet */
+
+ ocsd_ptm_pkt_type err_type; /**< Basic packet type if primary type indicates error or incomplete. */
+
+} ocsd_ptm_pkt;
+
+typedef struct _ocsd_ptm_cfg
+{
+ uint32_t reg_idr; /**< PTM ID register */
+ uint32_t reg_ctrl; /**< Control Register */
+ uint32_t reg_ccer; /**< Condition code extension register */
+ uint32_t reg_trc_id; /**< CoreSight Trace ID register */
+ ocsd_arch_version_t arch_ver; /**< Architecture version */
+ ocsd_core_profile_t core_prof; /**< Core Profile */
+} ocsd_ptm_cfg;
+
+/** @}*/
+
+
+/** @}*/
+#endif // ARM_TRC_PKT_PTM_TYPES_H_INCLUDED
+
+/* End of File trc_pkt_ptm_types.h */