OpenCSD - CoreSight Trace Decode Library  1.3.3
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 */
ocsd_err_t(* fnDecodeArmInstCB)(const void *lib_context, ocsd_instr_info *instr_info)
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)
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)
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)
struct _ocsd_extern_dcd_inst ocsd_extern_dcd_inst_t
ocsd_err_t(* fnDestroyCustomDecoder)(const void *decoder_handle)
void(* fnUpdatePktMonFlags)(const void *decoder_handle, const int flags)
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)
struct _ocsd_extern_dcd_cb_fns ocsd_extern_dcd_cb_fns
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)
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)
struct _ocsd_extern_dcd_fact ocsd_extern_dcd_fact_t
ocsd_err_t(* fnPacketToString)(const void *trc_pkt, char *buffer, const int buflen)
void(* fnLogMsgCB)(const void *lib_context, const ocsd_err_severity_t filter_level, const char *msg)
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)
ocsd_err_t(* fnGetCSIDFromConfig)(const void *decoder_cfg, unsigned char *p_csid)
uint32_t ocsd_trc_index_t
Definition: ocsd_if_types.h:67
enum _ocsd_trace_protocol_t ocsd_trace_protocol_t
enum _ocsd_datapath_resp_t ocsd_datapath_resp_t
enum _ocsd_mem_space_acc_t ocsd_mem_space_acc_t
enum _ocsd_datapath_op_t ocsd_datapath_op_t
enum _ocsd_err_severity_t ocsd_err_severity_t
enum _ocsd_err_t ocsd_err_t
uint64_t ocsd_vaddr_t
OpenCSD : Trace Decoder "C" API types.
fnDecodeArmInstCB fn_arm_instruction_decode
fnPktDataSinkCB fn_packet_data_sink
fnPacketToString pktToString
fnCreateCustomDecoder createDecoder
fnDestroyCustomDecoder destroyDecoder
fnGetCSIDFromConfig csidFromConfig
ocsd_trace_protocol_t protocol_id
fnUpdatePktMonFlags fn_update_pkt_mon