diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 07:24:57 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 07:24:57 +0000 |
commit | 070852d8604cece0c31f28ff3eb8d21d9ba415fb (patch) | |
tree | 9097175a6a5b8b7e37af9a96269ac0b61a0189cd /decoder/include/interfaces | |
parent | Initial commit. (diff) | |
download | libopencsd-070852d8604cece0c31f28ff3eb8d21d9ba415fb.tar.xz libopencsd-070852d8604cece0c31f28ff3eb8d21d9ba415fb.zip |
Adding upstream version 1.3.3.upstream/1.3.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'decoder/include/interfaces')
-rw-r--r-- | decoder/include/interfaces/trc_abs_typed_base_i.h | 58 | ||||
-rw-r--r-- | decoder/include/interfaces/trc_data_raw_in_i.h | 84 | ||||
-rw-r--r-- | decoder/include/interfaces/trc_data_rawframe_in_i.h | 81 | ||||
-rw-r--r-- | decoder/include/interfaces/trc_error_log_i.h | 134 | ||||
-rw-r--r-- | decoder/include/interfaces/trc_gen_elem_in_i.h | 77 | ||||
-rw-r--r-- | decoder/include/interfaces/trc_indexer_pkt_i.h | 77 | ||||
-rw-r--r-- | decoder/include/interfaces/trc_indexer_src_i.h | 124 | ||||
-rw-r--r-- | decoder/include/interfaces/trc_instr_decode_i.h | 66 | ||||
-rw-r--r-- | decoder/include/interfaces/trc_pkt_in_i.h | 80 | ||||
-rw-r--r-- | decoder/include/interfaces/trc_pkt_raw_in_i.h | 83 | ||||
-rw-r--r-- | decoder/include/interfaces/trc_tgt_mem_access_i.h | 99 |
11 files changed, 963 insertions, 0 deletions
diff --git a/decoder/include/interfaces/trc_abs_typed_base_i.h b/decoder/include/interfaces/trc_abs_typed_base_i.h new file mode 100644 index 0000000..0db6077 --- /dev/null +++ b/decoder/include/interfaces/trc_abs_typed_base_i.h @@ -0,0 +1,58 @@ +/* + * \file trc_abs_typed_base_i.h + * \brief OpenCSD : + * + * \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_ABS_TYPED_BASE_I_H_INCLUDED +#define ARM_TRC_ABS_TYPED_BASE_I_H_INCLUDED + +/*! + * @class ITrcTypedBase + * @brief Abstract base class to for interfaces templated types. + * + * This class is used as an abstract base for any interfaces that are specialised using + * template<> types. + * + * Designed to allow interface objects to be passed through generic interfaces into type + * specific templated implmentation handlers and converted/checked using RTTI. + */ +class ITrcTypedBase +{ +public: + ITrcTypedBase() {}; + virtual ~ITrcTypedBase() {}; +}; + +#endif // ARM_TRC_ABS_TYPED_BASE_I_H_INCLUDED + +/* End of File trc_abs_typed_base_i.h */ diff --git a/decoder/include/interfaces/trc_data_raw_in_i.h b/decoder/include/interfaces/trc_data_raw_in_i.h new file mode 100644 index 0000000..bf020d7 --- /dev/null +++ b/decoder/include/interfaces/trc_data_raw_in_i.h @@ -0,0 +1,84 @@ +/* + * \file trc_data_raw_in_i.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_TRCDATA_RAW_IN_I_H_INCLUDED +#define ARM_TRCDATA_RAW_IN_I_H_INCLUDED + +#include "opencsd/ocsd_if_types.h" + +/** @class ITrcDataIn + * + * @brief Interface to either trace data frame deformatter or packet processor. + * + * @ingroup ocsd_interfaces + * + * Interface class to a processor that can consume raw formatted trace byte stream from a trace reader + * or raw source buffer into a deformatter object. + * + * Also used to interface a single trace source ID data stream into a packet processor. + * + */ +class ITrcDataIn { +public: + ITrcDataIn() {}; /**< Default constructor. */ + virtual ~ITrcDataIn() {}; /**< Default destructor. */ + + /*! + * Data input method for a component on the Trace decode datapath. + * Datapath operations passed to the component, which responds with data path response codes. + * + * This API is for raw trace data, which can be:- + * - CoreSight formatted frame data for input to the frame deformatter. + * - Single binary source data for input to a packet decoder. + * + * @param op : Data path operation. + * @param index : Byte index of start of pDataBlock data as offset from start of captured data. May be zero for none-data operation + * @param dataBlockSize : Size of data block. Zero for none-data operation. + * @param *pDataBlock : pointer to data block. Null for none-data operation + * @param *numBytesProcessed : Pointer to count of data used by processor. Set by processor on data operation. Null for none-data operation + * + * @return ocsd_datapath_resp_t : Standard data path response code. + */ + virtual ocsd_datapath_resp_t TraceDataIn( const ocsd_datapath_op_t op, + const ocsd_trc_index_t index, + const uint32_t dataBlockSize, + const uint8_t *pDataBlock, + uint32_t *numBytesProcessed) = 0; + +}; + +#endif // ARM_TRCDATA_RAW_IN_I_H_INCLUDED + + +/* End of File trc_data_raw_in_i.h */ diff --git a/decoder/include/interfaces/trc_data_rawframe_in_i.h b/decoder/include/interfaces/trc_data_rawframe_in_i.h new file mode 100644 index 0000000..9fc3531 --- /dev/null +++ b/decoder/include/interfaces/trc_data_rawframe_in_i.h @@ -0,0 +1,81 @@ +/* + * \file trc_data_rawframe_in_i.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_TRCDATA_RAWFRAME_IN_I_H_INCLUDED +#define ARM_TRCDATA_RAWFRAME_IN_I_H_INCLUDED + +#include "opencsd/ocsd_if_types.h" + +/*! + * @class ITrcRawFrameIn + * + * @brief Interface to monitor the raw frame decode progress.. + * + * @ingroup ocsd_interfaces + * + * This interface allows a program to monitor the contents of the CoreSight frames passing through the + * frame deformatter. + * + * + */ +class ITrcRawFrameIn { +public: + ITrcRawFrameIn() {}; /**< Default constructor. */ + virtual ~ITrcRawFrameIn() {}; /**< Default destructor. */ + + /*! + * Interface to monitor CoreSight frame data. Output as blocks of data. + * + * @param op : Data path operation. + * @param index : Byte index of start of pDataBlock data as offset from start of captured data. May be zero for none-data operation + * @param frame_element : Type of frame element being output. + * @param dataBlockSize : size of frame element. + * @param *pDataBlock : pointer to frame data. + * @param traceID : Trace ID when element type ID data. + * + * @return ocsd_err_t : Standard library erroc code. Monitor only, not on data path. + */ + virtual ocsd_err_t TraceRawFrameIn( const ocsd_datapath_op_t op, + const ocsd_trc_index_t index, + const ocsd_rawframe_elem_t frame_element, + const int dataBlockSize, + const uint8_t *pDataBlock, + const uint8_t traceID) = 0; +}; + + +#endif // ARM_TRCDATA_RAWFRAME_IN_I_H_INCLUDED + +/* End of File trc_data_rawframe_in_i.h */ diff --git a/decoder/include/interfaces/trc_error_log_i.h b/decoder/include/interfaces/trc_error_log_i.h new file mode 100644 index 0000000..cc65f63 --- /dev/null +++ b/decoder/include/interfaces/trc_error_log_i.h @@ -0,0 +1,134 @@ +/*! + * \file trc_error_log_i.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_ERROR_LOG_I_H_INCLUDED +#define ARM_TRC_ERROR_LOG_I_H_INCLUDED + +#include "opencsd/ocsd_if_types.h" +#include <string> + +class ocsdError; +class ocsdMsgLogger; + +/*! + * @class ITraceErrorLog + * @brief Error logging interface. + * @ingroup ocsd_interfaces + * + * This class provides a standard interface to the decoder error logger for all trace decode and + * reader components. + * + * Implementation will determine if and how the errors and messages are logged. + * + */ +class ITraceErrorLog +{ +public: + ITraceErrorLog() {}; + virtual ~ITraceErrorLog() {}; + + /*! + * Register a named component error source. Allows the logger to associate errors with components. + * returned handle to be used with subsequent error log calls. + * + * @param &component_name : name of the component. + * + * @return virtual const : Handle associated with the component. + */ + virtual const ocsd_hndl_err_log_t RegisterErrorSource(const std::string &component_name) = 0; + + /*! + * Return the verbosity level of the logger. Errors of the returned ocsd_err_severity_t severity + * or lower will be logged, others are ignored. + * + * @return ocsd_err_severity_t : Current logging severity level. + */ + virtual const ocsd_err_severity_t GetErrorLogVerbosity() const = 0; + + /*! + * Log an error. + * Pass an error object and the component or generic handle to associate with the error. + * Error will be saved for access by GetLastError(). + * + * If logger implementation has output print logging enabled then this may be printed to file or screen. + * + * @param handle : Component handle or standard generic handle + * @param *Error : Pointer to an error object. + */ + virtual void LogError(const ocsd_hndl_err_log_t handle, const ocsdError *Error) = 0; + + /*! + * Log a general message. Associated with component or use generic handle. + * Message logged to same output as errors if output enabled, but not saved for GetLastError() + * + * @param handle : Component handle or standard generic handle. + * @param filter_level : Verbosity filter. + * @param msg : Pointer to an error object. + */ + virtual void LogMessage(const ocsd_hndl_err_log_t handle, const ocsd_err_severity_t filter_level, const std::string &msg ) = 0; + + /*! + * Get a pointer to the last logged error. + * Returns 0 if no errors have been logged. + * + * @return ocsdError *: last error pointer. + */ + virtual ocsdError *GetLastError() = 0; + + /*! + * Get the last error associated with the given Trace source channel ID. + * returns a pointer to the error or 0 if no errors associated with the ID. + * + * @param chan_id : Trace Source Channel ID (CoreSight Trace ID). + * + * @return ocsdError *: last error pointer for ID or 0. + */ + virtual ocsdError *GetLastIDError(const uint8_t chan_id) = 0; + + virtual ocsdMsgLogger *getOutputLogger() = 0; + virtual void setOutputLogger(ocsdMsgLogger *pLogger) = 0; + + enum generic_handles { + HANDLE_GEN_ERR = 0, + HANDLE_GEN_WARN, + HANDLE_GEN_INFO, + /* last value in list */ + HANDLE_FIRST_REGISTERED_COMPONENT /**< 1st valid handle value for components registered with logger */ + }; +}; + +#endif // ARM_TRC_ERROR_LOG_I_H_INCLUDED + +/* End of File trc_error_log_i.h */ diff --git a/decoder/include/interfaces/trc_gen_elem_in_i.h b/decoder/include/interfaces/trc_gen_elem_in_i.h new file mode 100644 index 0000000..5bad293 --- /dev/null +++ b/decoder/include/interfaces/trc_gen_elem_in_i.h @@ -0,0 +1,77 @@ +/* + * \file trc_gen_elem_in_i.h + * \brief OpenCSD : Generic Trace Element interface. + * + * \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_GEN_ELEM_IN_I_H_INCLUDED +#define ARM_TRC_GEN_ELEM_IN_I_H_INCLUDED + +class OcsdTraceElement; + +/*! + * @class ITrcGenElemIn + + * @brief Interface for the input of generic trace elements. + * + * @ingroup ocsd_interfaces + * + * This interface is the principal output attachment point for the trace packet decoders. + * + */ +class ITrcGenElemIn +{ +public: + ITrcGenElemIn() {}; /**< Default constructor. */ + virtual ~ITrcGenElemIn() {}; /**< Default destructor. */ + + + /*! + * Interface for analysis blocks that take generic trace elements as their input. + * Final interface on the decode data path. The index provided is that for the generating + * trace packet. Multiple generic elements may be produced from a single packet so they will + * all have the same start index. + * + * @param index_sop : Trace index for start of packet generating this element. + * @param trc_chan_id : CoreSight Trace ID for this source. + * @param &elem : Generic trace element generated from the deocde data path + * + * @return ocsd_datapath_resp_t : Standard data path response. + */ + virtual ocsd_datapath_resp_t TraceElemIn(const ocsd_trc_index_t index_sop, + const uint8_t trc_chan_id, + const OcsdTraceElement &elem) = 0; +}; + +#endif // ARM_TRC_GEN_ELEM_IN_I_H_INCLUDED + +/* End of File trc_gen_elem_in_i.h */ diff --git a/decoder/include/interfaces/trc_indexer_pkt_i.h b/decoder/include/interfaces/trc_indexer_pkt_i.h new file mode 100644 index 0000000..02aecda --- /dev/null +++ b/decoder/include/interfaces/trc_indexer_pkt_i.h @@ -0,0 +1,77 @@ +/* + * \file trc_indexer_pkt_i.h + * \brief OpenCSD : Trace packet indexer + * + * \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_INDEXER_PKT_I_H_INCLUDED +#define ARM_TRC_INDEXER_PKT_I_H_INCLUDED + +#include "trc_abs_typed_base_i.h" + +/*! + * @class ITrcPktIndexer + + * @brief Templated interface class to index packet types. + * + * @ingroup ocsd_interfaces + * + * Each protocol version will have an associated indexer that will index significant + * packets such as synchronisation points, timestamps, trigger events. + * + * Creating an index is optional at runtime, but will allow any analysis program to synchronise the + * different trace streams. + * + * Indexes need to be created only once and can be saved for re-use. + * + * Packet processors should be created to support the attachment of an indexer. + * + */ +template <class Pt> +class ITrcPktIndexer : public ITrcTypedBase +{ +public: + ITrcPktIndexer() {}; /**< Default constructor. */ + virtual ~ITrcPktIndexer() {}; /**< Default destructor. */ + + /*! + * Interface method for trace packet indexing. Implementated by a channel packet indexer. + * + * @param index_sop : trace index at the start of the packet. + * @param *packet_type : The packet type being indexed. + */ + virtual void TracePktIndex(const ocsd_trc_index_t index_sop, const Pt *packet_type) = 0; +}; + +#endif // ARM_TRC_INDEXER_PKT_I_H_INCLUDED + +/* End of File trc_indexer_pkt_i.h */ diff --git a/decoder/include/interfaces/trc_indexer_src_i.h b/decoder/include/interfaces/trc_indexer_src_i.h new file mode 100644 index 0000000..078efa5 --- /dev/null +++ b/decoder/include/interfaces/trc_indexer_src_i.h @@ -0,0 +1,124 @@ +/* + * \file trc_indexer_src_i.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_INDEXER_SRC_I_H_INCLUDED +#define ARM_TRC_INDEXER_SRC_I_H_INCLUDED + +#include <vector> +#include "opencsd/ocsd_if_types.h" + +/*! + * @class ITrcSrcIndexCreator + * + * @brief Interface class to index the frame formatted trace stream + * + * @ingroup ocsd_interfaces + * + * This indexer creates an index of trace IDs present in the frame formatted trace stream. + * It will also index any trigger point markers indicated in the frame format. + * + * Indexing is optional at runtime. Indexes can be saved and re-used. + */ +class ITrcSrcIndexCreator +{ +public: + ITrcSrcIndexCreator() {}; /**< Default constructor. */ + virtual ~ITrcSrcIndexCreator() {}; /**< Default destructor. */ + + /*! + * The size of block that the indexer will split trace into - this is effectively the + * index granularity. The indexing will indicate if an indexed element - e.g. a source + * ID - is present in the block. Smaller granularity will mean a larger index but more + * resolution in IDs and event positions. + * + * Block sizes will be power of 2 aligned, not less 256 bytes (16 frames). + * Indexer will choose block size based on total trace size and desired granularity. + * + * @return uint32_t : Size of indexing block. + */ + virtual const uint32_t IndexBlockSize() const; + + /*! + * Index a single ID + * + * @param src_idx : trace index of source ID + * @param ID : The source ID. + * + * @return virtual ocsd_err_t : OCSD_OK if successful. + */ + virtual ocsd_err_t TrcIDIndex(const ocsd_trc_index_t src_idx, const uint8_t ID) = 0; + + /*! + * Index a set of IDs in a block. + * Block is assumed to be one of size IndexBlockSize() + * + * May be used by the deformatter to collate IDs and reduce indexing calls. + * May be used by hardware capture source that has its own index of IDs, to transfer + * indexing information into the decoder indexer. + * + * @param src_idx_start : Index of start of block. + * @param IDs : IDs within the block. + * + * @return virtual ocsd_err_t : OCSD_OK if successful. + */ + virtual ocsd_err_t TrcIDBlockMap(const ocsd_trc_index_t src_idx_start, const std::vector<uint8_t> IDs) = 0; + + /*! + * The CoreSight frame format can use a reserved ID to indicate trigger or other + * events programmed into the trace protocol generator. + * This call indexes these events. + * + * @param src_idx : trace index of the event. + * @param event_type : type of event. + * + * @return ocsd_err_t : OCSD_OK if indexed correctly, OCSD_ERR_INVALID_PARAM_VAL if incorrect value used. + */ + virtual ocsd_err_t TrcEventIndex(const ocsd_trc_index_t src_idx, const int event_type) = 0; + + + /*! + * When the frame formatter is using frame syncs (typically TPIU output captured on off chip capture + * device), this index call notes the position of these elements. + * + * @param src_idx : trace index of sync point. + */ + virtual void TrcSyncIndex(const ocsd_trc_index_t src_idx); + +}; + +#endif // ARM_TRC_INDEXER_SRC_I_H_INCLUDED + +/* End of File trc_indexer_src_i.h */ diff --git a/decoder/include/interfaces/trc_instr_decode_i.h b/decoder/include/interfaces/trc_instr_decode_i.h new file mode 100644 index 0000000..75af19f --- /dev/null +++ b/decoder/include/interfaces/trc_instr_decode_i.h @@ -0,0 +1,66 @@ +/* + * \file trc_instr_decode_i.h + * \brief OpenCSD : Interface for instruction decode. + * + * \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_INSTR_DECODE_I_H_INCLUDED +#define ARM_TRC_INSTR_DECODE_I_H_INCLUDED + +/*! + * @class IInstrDecode + * @ingroup ocsd_interfaces + * @brief Interface class to an instruction opcode decoder. + * + * The opcode decoder needs to be capable of limited decode required for trace + * execution flow determination. + * + */ +class IInstrDecode +{ +public: + IInstrDecode() {}; /**< Default constructor. */ + virtual ~IInstrDecode() {}; /**< Default destructor. */ + + /*! + * Instruction opcode decode for the packet trace decoder to follow the + * instruction execution flow. + * + * @param *instr_info : Structure to pass current opcode, and receive required decode information. + * + * @return ocsd_err_t : OCSD_OK if successful. + */ + virtual ocsd_err_t DecodeInstruction(ocsd_instr_info *instr_info) = 0; +}; + +#endif // ARM_TRC_INSTR_DECODE_I_H_INCLUDED + +/* End of File trc_instr_decode_i.h */ diff --git a/decoder/include/interfaces/trc_pkt_in_i.h b/decoder/include/interfaces/trc_pkt_in_i.h new file mode 100644 index 0000000..8f6c5ef --- /dev/null +++ b/decoder/include/interfaces/trc_pkt_in_i.h @@ -0,0 +1,80 @@ +/* + * \file trc_pkt_in_i.h + * \brief OpenCSD : Interface for trace protocol packet input + * + * \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_IN_I_H_INCLUDED +#define ARM_TRC_PKT_IN_I_H_INCLUDED + +#include "trc_abs_typed_base_i.h" + +/*! + * @class IPktDataIn + * @ingroup ocsd_interfaces + * @brief Interface class providing an input for discrete protocol packets. + * + * Implemented by trace protocol packet decoders to convert packets into + * generic trace elements. + * + * Packet class used will contain information on the latest packet, + * and any intra-packet state. + * + */ +template<class P> +class IPktDataIn : public ITrcTypedBase +{ +public: + IPktDataIn() {}; /**< Default constructor. */ + virtual ~IPktDataIn() {}; /**< Default destructor. */ + + /*! + * Interface function to process a single protocol packet. + * Pass a trace index for the start of packet and a pointer to a packet when the + * datapath operation is OCSD_OP_DATA. + * + * @param op : Datapath operation. + * @param index_sop : Trace index for the start of the packet, 0 if not OCSD_OP_DATA. + * @param *p_packet_in : Protocol Packet - when data path operation is OCSD_OP_DATA. null otherwise. + * + * @return ocsd_datapath_resp_t : Standard data path response. + */ + virtual ocsd_datapath_resp_t PacketDataIn( const ocsd_datapath_op_t op, + const ocsd_trc_index_t index_sop, + const P *p_packet_in) = 0; + + +}; + +#endif // ARM_TRC_PKT_IN_I_H_INCLUDED + +/* End of File trc_proc_pkt_in_i.h */ diff --git a/decoder/include/interfaces/trc_pkt_raw_in_i.h b/decoder/include/interfaces/trc_pkt_raw_in_i.h new file mode 100644 index 0000000..dfa7e05 --- /dev/null +++ b/decoder/include/interfaces/trc_pkt_raw_in_i.h @@ -0,0 +1,83 @@ +/* + * \file trc_pkt_raw_in_i.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_RAW_IN_I_H_INCLUDED +#define ARM_TRC_PKT_RAW_IN_I_H_INCLUDED + +#include "trc_abs_typed_base_i.h" + +/*! + * @class IPktRawDataMon + * + * @brief Interface class for packet processor monitor. + * + * @addtogroup ocsd_interfaces + * + * This interface provides a monitor point for the packet processor block. + * The templated interface is called with a complete packet of the given + * type, plus the raw packet bytes. Use for tools which need to display complete + * packets or require additional processing on raw packet data. + * + * This interface is not part of the data decode path and cannot provide feedback. + * + */ +template<class P> +class IPktRawDataMon : public ITrcTypedBase +{ +public: + IPktRawDataMon() {}; /**< Default constructor. */ + virtual ~IPktRawDataMon() {}; /**< Default destructor. */ + + /*! + * Interface monitor function called with a complete packet, or other + * data path operation. + * + * @param op : Datapath operation + * @param index_sop : start of packet index + * @param *pkt : The expanded packet + * @param size : size of packet data bytes + * @param *p_data : the packet data bytes. + * + */ + virtual void RawPacketDataMon( const ocsd_datapath_op_t op, + const ocsd_trc_index_t index_sop, + const P *pkt, + const uint32_t size, + const uint8_t *p_data) = 0; +}; + +#endif // ARM_TRC_PKT_RAW_IN_I_H_INCLUDED + +/* End of File trc_pkt_raw_in_i.h */ diff --git a/decoder/include/interfaces/trc_tgt_mem_access_i.h b/decoder/include/interfaces/trc_tgt_mem_access_i.h new file mode 100644 index 0000000..68a4e10 --- /dev/null +++ b/decoder/include/interfaces/trc_tgt_mem_access_i.h @@ -0,0 +1,99 @@ +/* + * \file trc_tgt_mem_access_i.h + * \brief OpenCSD : Target memory read interface. + * + * \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_TGT_MEM_ACCESS_I_H_INCLUDED +#define ARM_TRC_TGT_MEM_ACCESS_I_H_INCLUDED + +/*! + * @class ITargetMemAccess + * + * @brief Interface to target memory access. + * + * @ingroup ocsd_interfaces + * + * Read Target memory call is used by the decoder to access the memory location in the + * target memory space for the next instruction(s) to be traced. + * + * Memory data returned is to be little-endian. + * + * The implementator of this interface could either use file(s) containing dumps of memory + * locations from the target, be an elf file reader extracting code, or a live target + * connection, depending on the tool execution context. + * + * + */ +class ITargetMemAccess +{ +public: + ITargetMemAccess() {}; /**< default interface constructor */ + virtual ~ITargetMemAccess() {}; /**< default interface destructor */ + + /*! + * Read a block of target memory into supplied buffer. + * + * Bytes read set less than bytes required, along with a success return code indicates full memory + * location not accessible. Function will return all accessible bytes from the address up to the point + * where the first inaccessible location appears. + * + * The cs_trace_id associates a memory read with a core. Different cores may have different memory spaces, + * the memory access may take this into account. Access will first look in the registered memory areas + * associated with the ID, failing that will look into any global memory spaces. + * + * @param address : Address to access. + * @param cs_trace_id : protocol source trace ID. + * @param mem_space : Memory space to access, (secure, non-secure, optionally with EL, or any). + * @param num_bytes : [in] Number of bytes required. [out] Number of bytes actually read. + * @param *p_buffer : Buffer to fill with the bytes. + * + * @return ocsd_err_t : OCSD_OK on successful access (including memory not available) + */ + virtual ocsd_err_t ReadTargetMemory( const ocsd_vaddr_t address, + const uint8_t cs_trace_id, + const ocsd_mem_space_acc_t mem_space, + uint32_t *num_bytes, + uint8_t *p_buffer) = 0; + + /*! + * Invalidate any caching that the memory accessor functions are using. + * Generally called when a memory context changes in the trace. + * + * @param cs_trace_id : protocol source trace ID. + */ + virtual void InvalidateMemAccCache(const uint8_t cs_trace_id) = 0; +}; + + +#endif // ARM_TRC_TGT_MEM_ACCESS_I_H_INCLUDED + +/* End of File trc_tgt_mem_access_i.h */ |