From: Mike Leach mike.leach@arm.com
Add in the enum type describing the trace protocol to decoder managers and interface. Covers ARM built in decoders, with external / none ARM covered by external tag.
Signed-off-by: Mike Leach mike.leach@linaro.org --- decoder/include/common/ocsd_dcd_mngr.h | 21 +++++++++++++++------ decoder/include/common/ocsd_dcd_mngr_i.h | 3 +++ decoder/include/etmv3/trc_dcd_mngr_etmv3.h | 2 +- decoder/include/etmv4/trc_dcd_mngr_etmv4i.h | 2 +- decoder/include/ptm/trc_dcd_mngr_ptm.h | 2 +- decoder/include/stm/trc_dcd_mngr_stm.h | 2 +- 6 files changed, 22 insertions(+), 10 deletions(-)
diff --git a/decoder/include/common/ocsd_dcd_mngr.h b/decoder/include/common/ocsd_dcd_mngr.h index 3b58e60..0e6222a 100644 --- a/decoder/include/common/ocsd_dcd_mngr.h +++ b/decoder/include/common/ocsd_dcd_mngr.h @@ -45,16 +45,18 @@ template <class P, class Pt, class Pc> class DecoderMngrBase : public IDecoderMngr { public: - DecoderMngrBase(const std::string &decoderTypeName); + DecoderMngrBase(const std::string &decoderTypeName, ocsd_trace_protocol_t builtInProtocol); virtual ~DecoderMngrBase() {};
// create decoder interface. virtual ocsd_err_t createDecoder(const int create_flags, const int instID, const CSConfig *p_config, TraceComponent **p_component); virtual ocsd_err_t destroyDecoder(TraceComponent *p_component);
+ virtual const ocsd_trace_protocol_t getProtocolType() const { return m_builtInProtocol; } + // common virtual ocsd_err_t attachErrorLogger(TraceComponent *pComponent, ITraceErrorLog *pIErrorLog); - + // pkt decoder virtual ocsd_err_t attachInstrDecoder(TraceComponent *pComponent, IInstrDecode *pIInstrDec); virtual ocsd_err_t attachMemAccessor(TraceComponent *pComponent, ITargetMemAccess *pMemAccessor); @@ -71,17 +73,20 @@ public: // implemented by decoder handler derived classes virtual TraceComponent *createPktProc(const bool useInstID, const int instID) = 0; virtual TraceComponent *createPktDecode(const bool useInstID, const int instID) { return 0; }; + +private: + ocsd_trace_protocol_t m_builtInProtocol; //!< Protocol ID if built in type. };
template <class P, class Pt, class Pc> -DecoderMngrBase<P,Pt,Pc>::DecoderMngrBase(const std::string &decoderTypeName) +DecoderMngrBase<P,Pt,Pc>::DecoderMngrBase(const std::string &decoderTypeName, ocsd_trace_protocol_t builtInProtocol) { OcsdLibDcdRegister *pDcdReg = OcsdLibDcdRegister::getDecoderRegister(); if(pDcdReg) pDcdReg->registerDecoderTypeByName(decoderTypeName,this); + m_builtInProtocol = builtInProtocol; }
- template <class P, class Pt, class Pc> ocsd_err_t DecoderMngrBase<P,Pt,Pc>::createDecoder(const int create_flags, const int instID, const CSConfig *pConfig, TraceComponent **ppTrcComp) { @@ -306,7 +311,9 @@ template< class P, // Packet class. class DecodeMngrFullDcd : public DecoderMngrBase<P,Pt,Pc> { public: - DecodeMngrFullDcd (const std::string &name) : DecoderMngrBase(name) {}; + DecodeMngrFullDcd (const std::string &name, ocsd_trace_protocol_t builtInProtocol) + : DecoderMngrBase(name,builtInProtocol) {}; + virtual ~DecodeMngrFullDcd() {};
virtual TraceComponent *createPktProc(const bool useInstID, const int instID) @@ -341,7 +348,9 @@ template< class P, // Packet class. class DecodeMngrPktProc : public DecoderMngrBase<P,Pt,Pc> { public: - DecodeMngrPktProc (const std::string &name) : DecoderMngrBase(name) {}; + DecodeMngrPktProc (const std::string &name, ocsd_trace_protocol_t builtInProtocol) + : DecoderMngrBase(name,builtInProtocol) {}; + virtual ~DecodeMngrPktProc() {};
virtual TraceComponent *createPktProc(const bool useInstID, const int instID) diff --git a/decoder/include/common/ocsd_dcd_mngr_i.h b/decoder/include/common/ocsd_dcd_mngr_i.h index f7a6720..3e6abe2 100644 --- a/decoder/include/common/ocsd_dcd_mngr_i.h +++ b/decoder/include/common/ocsd_dcd_mngr_i.h @@ -56,6 +56,9 @@ public: virtual ocsd_err_t createDecoder(const int create_flags, const int instID, const CSConfig *p_config, TraceComponent **ppComponent) = 0; virtual ocsd_err_t destroyDecoder(TraceComponent *pComponent) = 0;
+ //! Get the built in protocol type ID managed by this instance - extern for custom decoders + virtual const ocsd_trace_protocol_t getProtocolType() const = 0; + // connect decoders to other components - (replace current / 0 pointer value to detach ); // compatible with all decoders //!attach error logger to ptk-processor, or both of pkt processor and pkt decoder pair diff --git a/decoder/include/etmv3/trc_dcd_mngr_etmv3.h b/decoder/include/etmv3/trc_dcd_mngr_etmv3.h index cbd1182..3ace535 100644 --- a/decoder/include/etmv3/trc_dcd_mngr_etmv3.h +++ b/decoder/include/etmv3/trc_dcd_mngr_etmv3.h @@ -47,7 +47,7 @@ class DecoderMngrEtmV3 : public DecodeMngrFullDcd< EtmV3TrcPacket, TrcPktDecodeEtmV3> { public: - DecoderMngrEtmV3(const std::string &name) : DecodeMngrFullDcd(name) {}; + DecoderMngrEtmV3(const std::string &name) : DecodeMngrFullDcd(name,OCSD_PROTOCOL_ETMV3) {}; virtual ~DecoderMngrEtmV3() {}; };
diff --git a/decoder/include/etmv4/trc_dcd_mngr_etmv4i.h b/decoder/include/etmv4/trc_dcd_mngr_etmv4i.h index 3aef842..7c4802f 100644 --- a/decoder/include/etmv4/trc_dcd_mngr_etmv4i.h +++ b/decoder/include/etmv4/trc_dcd_mngr_etmv4i.h @@ -21,7 +21,7 @@ class DecoderMngrEtmV4I : public DecodeMngrFullDcd< EtmV4ITrcPacket, TrcPktDecodeEtmV4I> { public: - DecoderMngrEtmV4I(const std::string &name) : DecodeMngrFullDcd(name) {}; + DecoderMngrEtmV4I(const std::string &name) : DecodeMngrFullDcd(name,OCSD_PROTOCOL_ETMV4I) {}; virtual ~DecoderMngrEtmV4I() {}; };
diff --git a/decoder/include/ptm/trc_dcd_mngr_ptm.h b/decoder/include/ptm/trc_dcd_mngr_ptm.h index 27fb270..121edfd 100644 --- a/decoder/include/ptm/trc_dcd_mngr_ptm.h +++ b/decoder/include/ptm/trc_dcd_mngr_ptm.h @@ -47,7 +47,7 @@ class DecoderMngrPtm : public DecodeMngrFullDcd< PtmTrcPacket, TrcPktDecodePtm> { public: - DecoderMngrPtm(const std::string &name) : DecodeMngrFullDcd(name) {}; + DecoderMngrPtm(const std::string &name) : DecodeMngrFullDcd(name,OCSD_PROTOCOL_PTM) {}; virtual ~DecoderMngrPtm() {}; };
diff --git a/decoder/include/stm/trc_dcd_mngr_stm.h b/decoder/include/stm/trc_dcd_mngr_stm.h index 356ed72..7705d3c 100644 --- a/decoder/include/stm/trc_dcd_mngr_stm.h +++ b/decoder/include/stm/trc_dcd_mngr_stm.h @@ -45,7 +45,7 @@ class DecoderMngrStm : public DecodeMngrPktProc< StmTrcPacket, TrcPktProcStm> { public: - DecoderMngrStm(const std::string &name) : DecodeMngrPktProc(name) {}; + DecoderMngrStm(const std::string &name) : DecodeMngrPktProc(name,OCSD_PROTOCOL_STM) {}; virtual ~DecoderMngrStm() {}; };