Loading...
Searching...
No Matches
ocsd_c_api_custom.h
Go to the documentation of this file.
/*
* \file ocsd_c_api_custom.h
* \brief OpenCSD : Custom decoder interface types and structures
*
* \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_OCSD_C_API_CUSTOM_H_INCLUDED
#define ARM_OCSD_C_API_CUSTOM_H_INCLUDED
#include "ocsd_c_api_types.h"
/* Custom decoder C-API interface types. */
typedef ocsd_datapath_resp_t (* fnTraceDataIn)( const void *decoder_handle,
const ocsd_datapath_op_t op,
const ocsd_trc_index_t index,
const uint32_t dataBlockSize,
const uint8_t *pDataBlock,
uint32_t *numBytesProcessed);
typedef void (* fnUpdatePktMonFlags)(const void *decoder_handle, const int flags);
#define OCSD_CUST_DCD_PKT_CB_USE_MON 0x1
#define OCSD_CUST_DCD_PKT_CB_USE_SINK 0x2
typedef struct _ocsd_extern_dcd_inst {
/* Mandatory decoder call back functions - library initialisation will fail without these. */
fnTraceDataIn fn_data_in;
fnUpdatePktMonFlags fn_update_pkt_mon;
/* Decoder instance data */
void *decoder_handle;
char *p_decoder_name;
uint8_t cs_id;
} ocsd_extern_dcd_inst_t;
typedef ocsd_datapath_resp_t (* fnGenElemOpCB)( const void *lib_context,
const ocsd_trc_index_t index_sop,
const uint8_t trc_chan_id,
const ocsd_generic_trace_elem *elem);
typedef void (* fnLogErrorCB)( const void *lib_context,
const ocsd_err_severity_t filter_level,
const ocsd_err_t code,
const ocsd_trc_index_t idx,
const uint8_t chan_id,
const char *pMsg);
typedef void (* fnLogMsgCB)(const void *lib_context, const ocsd_err_severity_t filter_level, const char *msg);
typedef ocsd_err_t (* fnDecodeArmInstCB)(const void *lib_context, ocsd_instr_info *instr_info);
typedef ocsd_err_t (* fnMemAccessCB)(const void *lib_context,
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);
typedef void (* fnPktMonCB)( const void *lib_context,
const ocsd_datapath_op_t op,
const ocsd_trc_index_t index_sop,
const void *pkt,
const uint32_t size,
const uint8_t *p_data);
typedef ocsd_datapath_resp_t (* fnPktDataSinkCB)( const void *lib_context,
const ocsd_datapath_op_t op,
const ocsd_trc_index_t index_sop,
const void *pkt);
typedef struct _ocsd_extern_dcd_cb_fns {
/* Callback functions */
fnGenElemOpCB fn_gen_elem_out;
fnLogErrorCB fn_log_error;
fnLogMsgCB fn_log_msg;
fnDecodeArmInstCB fn_arm_instruction_decode;
fnMemAccessCB fn_memory_access;
fnPktMonCB fn_packet_mon;
fnPktDataSinkCB fn_packet_data_sink;
/* CB in use flags. */
int packetCBFlags;
/* library context */
const void *lib_context;
} ocsd_extern_dcd_cb_fns;
typedef ocsd_err_t (* fnCreateCustomDecoder)(const int create_flags, const void *decoder_cfg, const ocsd_extern_dcd_cb_fns *p_lib_callbacks, ocsd_extern_dcd_inst_t *p_decoder_inst);
typedef ocsd_err_t (* fnDestroyCustomDecoder)(const void *decoder_handle);
typedef ocsd_err_t (* fnGetCSIDFromConfig)(const void *decoder_cfg, unsigned char *p_csid);
typedef ocsd_err_t (* fnPacketToString)(const void *trc_pkt, char *buffer, const int buflen);
typedef struct _ocsd_extern_dcd_fact {
fnCreateCustomDecoder createDecoder;
fnDestroyCustomDecoder destroyDecoder;
fnGetCSIDFromConfig csidFromConfig;
fnPacketToString pktToString;
ocsd_trace_protocol_t protocol_id;
} ocsd_extern_dcd_fact_t;
#endif // ARM_OCSD_C_API_CUSTOM_H_INCLUDED
/* End of File ocsd_c_api_custom.h */
fnDecodeArmInstCB
ocsd_err_t(* fnDecodeArmInstCB)(const void *lib_context, ocsd_instr_info *instr_info)
Definition ocsd_c_api_custom.h:135
fnPktDataSinkCB
ocsd_datapath_resp_t(* fnPktDataSinkCB)(const void *lib_context, const ocsd_datapath_op_t op, const ocsd_trc_index_t index_sop, const void *pkt)
Definition ocsd_c_api_custom.h:162
fnTraceDataIn
ocsd_datapath_resp_t(* fnTraceDataIn)(const void *decoder_handle, const ocsd_datapath_op_t op, const ocsd_trc_index_t index, const uint32_t dataBlockSize, const uint8_t *pDataBlock, uint32_t *numBytesProcessed)
Definition ocsd_c_api_custom.h:62
fnGenElemOpCB
ocsd_datapath_resp_t(* fnGenElemOpCB)(const void *lib_context, const ocsd_trc_index_t index_sop, const uint8_t trc_chan_id, const ocsd_generic_trace_elem *elem)
Definition ocsd_c_api_custom.h:112
ocsd_extern_dcd_inst_t
struct _ocsd_extern_dcd_inst ocsd_extern_dcd_inst_t
fnDestroyCustomDecoder
ocsd_err_t(* fnDestroyCustomDecoder)(const void *decoder_handle)
Definition ocsd_c_api_custom.h:212
fnUpdatePktMonFlags
void(* fnUpdatePktMonFlags)(const void *decoder_handle, const int flags)
Definition ocsd_c_api_custom.h:79
fnMemAccessCB
ocsd_err_t(* fnMemAccessCB)(const void *lib_context, 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)
Definition ocsd_c_api_custom.h:140
ocsd_extern_dcd_cb_fns
struct _ocsd_extern_dcd_cb_fns ocsd_extern_dcd_cb_fns
fnPktMonCB
void(* fnPktMonCB)(const void *lib_context, const ocsd_datapath_op_t op, const ocsd_trc_index_t index_sop, const void *pkt, const uint32_t size, const uint8_t *p_data)
Definition ocsd_c_api_custom.h:150
fnLogErrorCB
void(* fnLogErrorCB)(const void *lib_context, const ocsd_err_severity_t filter_level, const ocsd_err_t code, const ocsd_trc_index_t idx, const uint8_t chan_id, const char *pMsg)
Definition ocsd_c_api_custom.h:120
ocsd_extern_dcd_fact_t
struct _ocsd_extern_dcd_fact ocsd_extern_dcd_fact_t
fnPacketToString
ocsd_err_t(* fnPacketToString)(const void *trc_pkt, char *buffer, const int buflen)
Definition ocsd_c_api_custom.h:231
fnLogMsgCB
void(* fnLogMsgCB)(const void *lib_context, const ocsd_err_severity_t filter_level, const char *msg)
Definition ocsd_c_api_custom.h:130
fnCreateCustomDecoder
ocsd_err_t(* fnCreateCustomDecoder)(const int create_flags, const void *decoder_cfg, const ocsd_extern_dcd_cb_fns *p_lib_callbacks, ocsd_extern_dcd_inst_t *p_decoder_inst)
Definition ocsd_c_api_custom.h:204
fnGetCSIDFromConfig
ocsd_err_t(* fnGetCSIDFromConfig)(const void *decoder_cfg, unsigned char *p_csid)
Definition ocsd_c_api_custom.h:221
ocsd_trc_index_t
uint32_t ocsd_trc_index_t
Definition ocsd_if_types.h:59
ocsd_trace_protocol_t
enum _ocsd_trace_protocol_t ocsd_trace_protocol_t
ocsd_datapath_resp_t
enum _ocsd_datapath_resp_t ocsd_datapath_resp_t
ocsd_mem_space_acc_t
enum _ocsd_mem_space_acc_t ocsd_mem_space_acc_t
ocsd_datapath_op_t
enum _ocsd_datapath_op_t ocsd_datapath_op_t
ocsd_err_severity_t
enum _ocsd_err_severity_t ocsd_err_severity_t
ocsd_err_t
enum _ocsd_err_t ocsd_err_t
ocsd_vaddr_t
uint64_t ocsd_vaddr_t
Definition ocsd_if_types.h:306
ocsd_c_api_types.h
OpenCSD : Trace Decoder "C" API types.
_ocsd_extern_dcd_cb_fns
Definition ocsd_c_api_custom.h:168
_ocsd_extern_dcd_cb_fns::fn_packet_mon
fnPktMonCB fn_packet_mon
Definition ocsd_c_api_custom.h:175
_ocsd_extern_dcd_cb_fns::packetCBFlags
int packetCBFlags
Definition ocsd_c_api_custom.h:178
_ocsd_extern_dcd_cb_fns::lib_context
const void * lib_context
Definition ocsd_c_api_custom.h:180
_ocsd_extern_dcd_cb_fns::fn_arm_instruction_decode
fnDecodeArmInstCB fn_arm_instruction_decode
Definition ocsd_c_api_custom.h:173
_ocsd_extern_dcd_cb_fns::fn_packet_data_sink
fnPktDataSinkCB fn_packet_data_sink
Definition ocsd_c_api_custom.h:176
_ocsd_extern_dcd_cb_fns::fn_log_error
fnLogErrorCB fn_log_error
Definition ocsd_c_api_custom.h:171
_ocsd_extern_dcd_cb_fns::fn_memory_access
fnMemAccessCB fn_memory_access
Definition ocsd_c_api_custom.h:174
_ocsd_extern_dcd_cb_fns::fn_gen_elem_out
fnGenElemOpCB fn_gen_elem_out
Definition ocsd_c_api_custom.h:170
_ocsd_extern_dcd_cb_fns::fn_log_msg
fnLogMsgCB fn_log_msg
Definition ocsd_c_api_custom.h:172
_ocsd_extern_dcd_fact
Definition ocsd_c_api_custom.h:237
_ocsd_extern_dcd_fact::pktToString
fnPacketToString pktToString
Definition ocsd_c_api_custom.h:241
_ocsd_extern_dcd_fact::createDecoder
fnCreateCustomDecoder createDecoder
Definition ocsd_c_api_custom.h:238
_ocsd_extern_dcd_fact::destroyDecoder
fnDestroyCustomDecoder destroyDecoder
Definition ocsd_c_api_custom.h:239
_ocsd_extern_dcd_fact::csidFromConfig
fnGetCSIDFromConfig csidFromConfig
Definition ocsd_c_api_custom.h:240
_ocsd_extern_dcd_fact::protocol_id
ocsd_trace_protocol_t protocol_id
Definition ocsd_c_api_custom.h:243
_ocsd_extern_dcd_inst
Definition ocsd_c_api_custom.h:90
_ocsd_extern_dcd_inst::fn_data_in
fnTraceDataIn fn_data_in
Definition ocsd_c_api_custom.h:92
_ocsd_extern_dcd_inst::cs_id
uint8_t cs_id
Definition ocsd_c_api_custom.h:98
_ocsd_extern_dcd_inst::decoder_handle
void * decoder_handle
Definition ocsd_c_api_custom.h:96
_ocsd_extern_dcd_inst::fn_update_pkt_mon
fnUpdatePktMonFlags fn_update_pkt_mon
Definition ocsd_c_api_custom.h:93
_ocsd_extern_dcd_inst::p_decoder_name
char * p_decoder_name
Definition ocsd_c_api_custom.h:97
_ocsd_generic_trace_elem
Definition trc_gen_elem_types.h:114
_ocsd_instr_info
Definition ocsd_if_types.h:383