OpenCSD - CoreSight Trace Decode Library 1.5.1
Loading...
Searching...
No Matches
opencsd_c_api.h
Go to the documentation of this file.
1
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
35#ifndef ARM_OPENCSD_C_API_H_INCLUDED
36#define ARM_OPENCSD_C_API_H_INCLUDED
37
46/* ensure C bindings */
47
48#if defined(WIN32) /* windows bindings */
50 #ifdef _OCSD_C_API_DLL_EXPORT
51 #ifdef __cplusplus
52 #define OCSD_C_API extern "C" __declspec(dllexport)
53 #else
54 #define OCSD_C_API __declspec(dllexport)
55 #endif
56 #else
58 #if defined(_LIB) || defined(OCSD_USE_STATIC_C_API)
59 #ifdef __cplusplus
60 #define OCSD_C_API extern "C"
61 #else
62 #define OCSD_C_API
63 #endif
64 #else
66 #ifdef __cplusplus
67 #define OCSD_C_API extern "C" __declspec(dllimport)
68 #else
69 #define OCSD_C_API __declspec(dllimport)
70 #endif
71 #endif
72 #endif
73#else /* linux bindings */
74 #ifdef __cplusplus
75 #define OCSD_C_API extern "C"
76 #else
77 #define OCSD_C_API
78 #endif
79#endif
80
81#include "ocsd_c_api_types.h"
82#include "ocsd_c_api_custom.h"
83
89
94/*---------------------- Trace Decode Tree ----------------------------------------------------------------------------------*/
95
107OCSD_C_API dcd_tree_handle_t ocsd_create_dcd_tree(const ocsd_dcd_tree_src_t src_type, const uint32_t deformatterCfgFlags);
108
117
133 const ocsd_datapath_op_t op,
134 const ocsd_trc_index_t index,
135 const uint32_t dataBlockSize,
136 const uint8_t *pDataBlock,
137 uint32_t *numBytesProcessed);
138
139
140/*---------------------- Generic Trace Element Output --------------------------------------------------------------*/
141
157
158/*---------------------- Trace Decoders ----------------------------------------------------------------------------------*/
174 const char *decoder_name,
175 const int create_flags,
176 const void *decoder_cfg,
177 unsigned char *pCSID
178 );
179
189 const unsigned char CSID);
190
191
207 const unsigned char CSID,
208 const ocsd_c_api_cb_types callback_type,
209 void *p_fn_callback_data,
210 const void *p_context);
211
212
226 const unsigned char CSID,
227 ocsd_decode_stats_t **p_stats_block);
228
229
241 const unsigned char CSID);
242
244/*---------------------- Memory Access for traced opcodes ----------------------------------------------------------------------------------*/
265OCSD_C_API ocsd_err_t ocsd_dt_add_binfile_mem_acc(const dcd_tree_handle_t handle, const ocsd_vaddr_t address, const ocsd_mem_space_acc_t mem_space, const char *filepath);
266
284OCSD_C_API ocsd_err_t ocsd_dt_add_binfile_region_mem_acc(const dcd_tree_handle_t handle, const ocsd_file_mem_region_t *region_array, const int num_regions, const ocsd_mem_space_acc_t mem_space, const char *filepath);
285
297OCSD_C_API ocsd_err_t ocsd_dt_add_buffer_mem_acc(const dcd_tree_handle_t handle, const ocsd_vaddr_t address, const ocsd_mem_space_acc_t mem_space, const uint8_t *p_mem_buffer, const uint32_t mem_length);
298
299
313OCSD_C_API ocsd_err_t ocsd_dt_add_callback_mem_acc(const dcd_tree_handle_t handle, const ocsd_vaddr_t st_address, const ocsd_vaddr_t en_address, const ocsd_mem_space_acc_t mem_space, Fn_MemAcc_CB p_cb_func, const void *p_context);
314
315
329OCSD_C_API ocsd_err_t ocsd_dt_add_callback_trcid_mem_acc(const dcd_tree_handle_t handle, const ocsd_vaddr_t st_address, const ocsd_vaddr_t en_address, const ocsd_mem_space_acc_t mem_space, Fn_MemAccID_CB p_cb_func, const void *p_context);
330
331
342
343/*
344 * Print the mapped memory accessor ranges to the configured logger.
345 *
346 * @param handle : Handle to decode tree.
347 */
349
360/*---------------------- Library Logging and debug ----------------------------------------------------------------------------------*/
371OCSD_C_API ocsd_err_t ocsd_def_errlog_init(const ocsd_err_severity_t verbosity, const int create_output_logger);
372
382OCSD_C_API ocsd_err_t ocsd_def_errlog_config_output(const int output_flags, const char *log_file_name);
383
393
400OCSD_C_API void ocsd_def_errlog_msgout(const char *msg);
401
409OCSD_C_API void ocsd_err_str(const ocsd_err_t err, char *buffer, const int buffer_size);
410
423OCSD_C_API ocsd_err_t ocsd_get_last_err(ocsd_trc_index_t *index, uint8_t *chan_id, char *message, const int message_len);
424
443OCSD_C_API ocsd_err_t ocsd_pkt_str(const ocsd_trace_protocol_t pkt_protocol, const void *p_pkt, char *buffer, const int buffer_size);
444
454OCSD_C_API ocsd_err_t ocsd_gen_elem_str(const ocsd_generic_trace_elem *p_pkt, char *buffer, const int buffer_size);
455
456
461
483
492
504
520
526
541OCSD_C_API ocsd_err_t ocsd_cust_protocol_to_str(const ocsd_trace_protocol_t pkt_protocol, const void *trc_pkt, char *buffer, const int buflen);
542
548#endif // ARM_OPENCSD_C_API_H_INCLUDED
549
550/* End of File opencsd_c_api.h */
enum _ocsd_gen_trc_elem_t ocsd_gen_trc_elem_t
void * dcd_tree_handle_t
OCSD_C_API void ocsd_err_str(const ocsd_err_t err, char *buffer, const int buffer_size)
#define OCSD_C_API
OCSD_C_API void ocsd_def_errlog_msgout(const char *msg)
OCSD_C_API ocsd_err_t ocsd_dt_add_binfile_region_mem_acc(const dcd_tree_handle_t handle, const ocsd_file_mem_region_t *region_array, const int num_regions, const ocsd_mem_space_acc_t mem_space, const char *filepath)
OCSD_C_API ocsd_err_t ocsd_dt_add_callback_mem_acc(const dcd_tree_handle_t handle, const ocsd_vaddr_t st_address, const ocsd_vaddr_t en_address, const ocsd_mem_space_acc_t mem_space, Fn_MemAcc_CB p_cb_func, const void *p_context)
OCSD_C_API ocsd_err_t ocsd_dt_set_gen_elem_outfn(const dcd_tree_handle_t handle, FnTraceElemIn pFn, const void *p_context)
OCSD_C_API ocsd_err_t ocsd_register_custom_decoder(const char *name, ocsd_extern_dcd_fact_t *p_dcd_fact)
OCSD_C_API ocsd_err_t ocsd_cust_protocol_to_str(const ocsd_trace_protocol_t pkt_protocol, const void *trc_pkt, char *buffer, const int buflen)
OCSD_C_API ocsd_err_t ocsd_def_errlog_init(const ocsd_err_severity_t verbosity, const int create_output_logger)
OCSD_C_API ocsd_datapath_resp_t ocsd_dt_process_data(const dcd_tree_handle_t 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_C_API ocsd_err_t ocsd_dt_add_binfile_mem_acc(const dcd_tree_handle_t handle, const ocsd_vaddr_t address, const ocsd_mem_space_acc_t mem_space, const char *filepath)
OCSD_C_API ocsd_err_t ocsd_deregister_decoders(void)
OCSD_C_API ocsd_err_t ocsd_dt_add_buffer_mem_acc(const dcd_tree_handle_t handle, const ocsd_vaddr_t address, const ocsd_mem_space_acc_t mem_space, const uint8_t *p_mem_buffer, const uint32_t mem_length)
OCSD_C_API void ocsd_destroy_dcd_tree(const dcd_tree_handle_t handle)
OCSD_C_API uint32_t ocsd_get_version(void)
OCSD_C_API ocsd_err_t ocsd_dt_add_callback_trcid_mem_acc(const dcd_tree_handle_t handle, const ocsd_vaddr_t st_address, const ocsd_vaddr_t en_address, const ocsd_mem_space_acc_t mem_space, Fn_MemAccID_CB p_cb_func, const void *p_context)
OCSD_C_API dcd_tree_handle_t ocsd_create_dcd_tree(const ocsd_dcd_tree_src_t src_type, const uint32_t deformatterCfgFlags)
OCSD_C_API void ocsd_gen_elem_init(ocsd_generic_trace_elem *p_pkt, const ocsd_gen_trc_elem_t elem_type)
OCSD_C_API ocsd_err_t ocsd_dt_reset_decode_stats(const dcd_tree_handle_t handle, const unsigned char CSID)
OCSD_C_API void ocsd_tl_log_mapped_mem_ranges(const dcd_tree_handle_t handle)
OCSD_C_API ocsd_err_t ocsd_dt_set_raw_frame_printer(const dcd_tree_handle_t handle, int flags)
OCSD_C_API ocsd_err_t ocsd_dt_get_decode_stats(const dcd_tree_handle_t handle, const unsigned char CSID, ocsd_decode_stats_t **p_stats_block)
OCSD_C_API ocsd_err_t ocsd_get_last_err(ocsd_trc_index_t *index, uint8_t *chan_id, char *message, const int message_len)
OCSD_C_API ocsd_err_t ocsd_gen_elem_str(const ocsd_generic_trace_elem *p_pkt, char *buffer, const int buffer_size)
OCSD_C_API ocsd_err_t ocsd_dt_set_pkt_protocol_printer(const dcd_tree_handle_t handle, uint8_t cs_id, int monitor)
OCSD_C_API ocsd_err_t ocsd_dt_remove_decoder(const dcd_tree_handle_t handle, const unsigned char CSID)
OCSD_C_API ocsd_err_t ocsd_dt_remove_mem_acc(const dcd_tree_handle_t handle, const ocsd_vaddr_t st_address, const ocsd_mem_space_acc_t mem_space)
OCSD_C_API ocsd_err_t ocsd_pkt_str(const ocsd_trace_protocol_t pkt_protocol, const void *p_pkt, char *buffer, const int buffer_size)
OCSD_C_API ocsd_err_t ocsd_def_errlog_config_output(const int output_flags, const char *log_file_name)
OCSD_C_API ocsd_err_t ocsd_dt_set_gen_elem_printer(const dcd_tree_handle_t handle)
OCSD_C_API const char * ocsd_get_version_str(void)
OCSD_C_API ocsd_err_t ocsd_def_errlog_set_strprint_cb(const dcd_tree_handle_t handle, void *p_context, FnDefLoggerPrintStrCB p_str_print_cb)
OCSD_C_API ocsd_err_t ocsd_dt_attach_packet_callback(const dcd_tree_handle_t handle, const unsigned char CSID, const ocsd_c_api_cb_types callback_type, void *p_fn_callback_data, const void *p_context)
OCSD_C_API ocsd_err_t ocsd_dt_create_decoder(const dcd_tree_handle_t handle, const char *decoder_name, const int create_flags, const void *decoder_cfg, unsigned char *pCSID)
enum _ocsd_dcd_tree_src_t ocsd_dcd_tree_src_t
uint32_t ocsd_trc_index_t
uint32_t(* Fn_MemAccID_CB)(const void *p_context, const ocsd_vaddr_t address, const ocsd_mem_space_acc_t mem_space, const uint8_t trcID, const uint32_t reqBytes, uint8_t *byteBuffer)
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
uint32_t(* Fn_MemAcc_CB)(const void *p_context, const ocsd_vaddr_t address, const ocsd_mem_space_acc_t mem_space, const uint32_t reqBytes, uint8_t *byteBuffer)
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.
void(* FnDefLoggerPrintStrCB)(const void *p_context, const char *psz_msg_str, const int str_len)
enum _ocsd_c_api_cb_types ocsd_c_api_cb_types
ocsd_datapath_resp_t(* FnTraceElemIn)(const void *p_context, const ocsd_trc_index_t index_sop, const uint8_t trc_chan_id, const ocsd_generic_trace_elem *elem)