OpenCSD - CoreSight Trace Decode Library  0.14.1
ocsd_c_api_custom.h
Go to the documentation of this file.
1 /*
2  * \file ocsd_c_api_custom.h
3  * \brief OpenCSD : Custom decoder interface types and structures
4  *
5  * \copyright Copyright (c) 2016, ARM Limited. All Rights Reserved.
6  */
7 
8 /*
9  * Redistribution and use in source and binary forms, with or without modification,
10  * are permitted provided that the following conditions are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright notice,
13  * this list of conditions and the following disclaimer.
14  *
15  * 2. Redistributions in binary form must reproduce the above copyright notice,
16  * this list of conditions and the following disclaimer in the documentation
17  * and/or other materials provided with the distribution.
18  *
19  * 3. Neither the name of the copyright holder nor the names of its contributors
20  * may be used to endorse or promote products derived from this software without
21  * specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND
24  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26  * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
27  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33  */
34 #ifndef ARM_OCSD_C_API_CUSTOM_H_INCLUDED
35 #define ARM_OCSD_C_API_CUSTOM_H_INCLUDED
36 
37 #include "ocsd_c_api_types.h"
38 
39 
57 /* Custom decoder C-API interface types. */
58 
62 typedef ocsd_datapath_resp_t (* fnTraceDataIn)( const void *decoder_handle,
63  const ocsd_datapath_op_t op,
64  const ocsd_trc_index_t index,
65  const uint32_t dataBlockSize,
66  const uint8_t *pDataBlock,
67  uint32_t *numBytesProcessed);
68 
79 typedef void (* fnUpdatePktMonFlags)(const void *decoder_handle, const int flags);
80 
81 
82 
84 #define OCSD_CUST_DCD_PKT_CB_USE_MON 0x1
85 
87 #define OCSD_CUST_DCD_PKT_CB_USE_SINK 0x2
88 
90 typedef struct _ocsd_extern_dcd_inst {
91  /* Mandatory decoder call back functions - library initialisation will fail without these. */
95  /* Decoder instance data */
98  uint8_t cs_id;
101 
112 typedef ocsd_datapath_resp_t (* fnGenElemOpCB)( const void *lib_context,
113  const ocsd_trc_index_t index_sop,
114  const uint8_t trc_chan_id,
115  const ocsd_generic_trace_elem *elem);
116 
120 typedef void (* fnLogErrorCB)( const void *lib_context,
121  const ocsd_err_severity_t filter_level,
122  const ocsd_err_t code,
123  const ocsd_trc_index_t idx,
124  const uint8_t chan_id,
125  const char *pMsg);
126 
130 typedef void (* fnLogMsgCB)(const void *lib_context, const ocsd_err_severity_t filter_level, const char *msg);
131 
135 typedef ocsd_err_t (* fnDecodeArmInstCB)(const void *lib_context, ocsd_instr_info *instr_info);
136 
140 typedef ocsd_err_t (* fnMemAccessCB)(const void *lib_context,
141  const ocsd_vaddr_t address,
142  const uint8_t cs_trace_id,
143  const ocsd_mem_space_acc_t mem_space,
144  uint32_t *num_bytes,
145  uint8_t *p_buffer);
146 
150 typedef void (* fnPktMonCB)( const void *lib_context,
151  const ocsd_datapath_op_t op,
152  const ocsd_trc_index_t index_sop,
153  const void *pkt,
154  const uint32_t size,
155  const uint8_t *p_data);
156 
162 typedef ocsd_datapath_resp_t (* fnPktDataSinkCB)( const void *lib_context,
163  const ocsd_datapath_op_t op,
164  const ocsd_trc_index_t index_sop,
165  const void *pkt);
166 
168 typedef struct _ocsd_extern_dcd_cb_fns {
169 /* Callback functions */
177 /* CB in use flags. */
179 /* library context */
180  const void *lib_context;
182 
204 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);
205 
212 typedef ocsd_err_t (* fnDestroyCustomDecoder)(const void *decoder_handle);
213 
221 typedef ocsd_err_t (* fnGetCSIDFromConfig)(const void *decoder_cfg, unsigned char *p_csid);
222 
231 typedef ocsd_err_t (* fnPacketToString)(const void *trc_pkt, char *buffer, const int buflen);
232 
237 typedef struct _ocsd_extern_dcd_fact {
245 
251 #endif // ARM_OCSD_C_API_CUSTOM_H_INCLUDED
252 
253 /* End of File ocsd_c_api_custom.h */
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
_ocsd_extern_dcd_cb_fns::fn_log_error
fnLogErrorCB fn_log_error
Definition: ocsd_c_api_custom.h:171
ocsd_datapath_resp_t
enum _ocsd_datapath_resp_t ocsd_datapath_resp_t
_ocsd_extern_dcd_cb_fns::fn_packet_data_sink
fnPktDataSinkCB fn_packet_data_sink
Definition: ocsd_c_api_custom.h:176
_ocsd_instr_info
Definition: ocsd_if_types.h:382
_ocsd_extern_dcd_cb_fns
Definition: ocsd_c_api_custom.h:168
_ocsd_extern_dcd_cb_fns::fn_arm_instruction_decode
fnDecodeArmInstCB fn_arm_instruction_decode
Definition: ocsd_c_api_custom.h:173
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_inst::decoder_handle
void * decoder_handle
Definition: ocsd_c_api_custom.h:96
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
fnDestroyCustomDecoder
ocsd_err_t(* fnDestroyCustomDecoder)(const void *decoder_handle)
Definition: ocsd_c_api_custom.h:212
_ocsd_generic_trace_elem
Definition: trc_gen_elem_types.h:89
fnPacketToString
ocsd_err_t(* fnPacketToString)(const void *trc_pkt, char *buffer, const int buflen)
Definition: ocsd_c_api_custom.h:231
ocsd_c_api_types.h
OpenCSD : Trace Decoder "C" API types.
ocsd_vaddr_t
uint64_t ocsd_vaddr_t
Definition: ocsd_if_types.h:308
_ocsd_extern_dcd_inst::fn_data_in
fnTraceDataIn fn_data_in
Definition: ocsd_c_api_custom.h:92
fnDecodeArmInstCB
ocsd_err_t(* fnDecodeArmInstCB)(const void *lib_context, ocsd_instr_info *instr_info)
Definition: ocsd_c_api_custom.h:135
_ocsd_extern_dcd_cb_fns::lib_context
const void * lib_context
Definition: ocsd_c_api_custom.h:180
ocsd_err_t
enum _ocsd_err_t ocsd_err_t
_ocsd_extern_dcd_fact::destroyDecoder
fnDestroyCustomDecoder destroyDecoder
Definition: ocsd_c_api_custom.h:239
_ocsd_extern_dcd_inst::fn_update_pkt_mon
fnUpdatePktMonFlags fn_update_pkt_mon
Definition: ocsd_c_api_custom.h:93
_ocsd_extern_dcd_fact::protocol_id
ocsd_trace_protocol_t protocol_id
Definition: ocsd_c_api_custom.h:243
ocsd_datapath_op_t
enum _ocsd_datapath_op_t ocsd_datapath_op_t
_ocsd_extern_dcd_fact::csidFromConfig
fnGetCSIDFromConfig csidFromConfig
Definition: ocsd_c_api_custom.h:240
_ocsd_extern_dcd_fact
Definition: ocsd_c_api_custom.h:237
_ocsd_extern_dcd_cb_fns::packetCBFlags
int packetCBFlags
Definition: ocsd_c_api_custom.h:178
fnUpdatePktMonFlags
void(* fnUpdatePktMonFlags)(const void *decoder_handle, const int flags)
Definition: ocsd_c_api_custom.h:79
_ocsd_extern_dcd_inst
Definition: ocsd_c_api_custom.h:90
ocsd_trc_index_t
uint32_t ocsd_trc_index_t
Definition: ocsd_if_types.h:67
ocsd_err_severity_t
enum _ocsd_err_severity_t ocsd_err_severity_t
_ocsd_extern_dcd_cb_fns::fn_memory_access
fnMemAccessCB fn_memory_access
Definition: ocsd_c_api_custom.h:174
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_cb_fns::fn_packet_mon
fnPktMonCB fn_packet_mon
Definition: ocsd_c_api_custom.h:175
ocsd_mem_space_acc_t
enum _ocsd_mem_space_acc_t ocsd_mem_space_acc_t
_ocsd_extern_dcd_inst::cs_id
uint8_t cs_id
Definition: ocsd_c_api_custom.h:98
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_cb_fns::fn_log_msg
fnLogMsgCB fn_log_msg
Definition: ocsd_c_api_custom.h:172
fnGetCSIDFromConfig
ocsd_err_t(* fnGetCSIDFromConfig)(const void *decoder_cfg, unsigned char *p_csid)
Definition: ocsd_c_api_custom.h:221
ocsd_extern_dcd_fact_t
struct _ocsd_extern_dcd_fact ocsd_extern_dcd_fact_t
fnLogMsgCB
void(* fnLogMsgCB)(const void *lib_context, const ocsd_err_severity_t filter_level, const char *msg)
Definition: ocsd_c_api_custom.h:130
_ocsd_extern_dcd_inst::p_decoder_name
char * p_decoder_name
Definition: ocsd_c_api_custom.h:97
_ocsd_extern_dcd_fact::pktToString
fnPacketToString pktToString
Definition: ocsd_c_api_custom.h:241
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
ocsd_extern_dcd_cb_fns
struct _ocsd_extern_dcd_cb_fns ocsd_extern_dcd_cb_fns
ocsd_trace_protocol_t
enum _ocsd_trace_protocol_t ocsd_trace_protocol_t
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
_ocsd_extern_dcd_fact::createDecoder
fnCreateCustomDecoder createDecoder
Definition: ocsd_c_api_custom.h:238
_ocsd_extern_dcd_cb_fns::fn_gen_elem_out
fnGenElemOpCB fn_gen_elem_out
Definition: ocsd_c_api_custom.h:170
ocsd_extern_dcd_inst_t
struct _ocsd_extern_dcd_inst ocsd_extern_dcd_inst_t