2 * SPDX-License-Identifier: GPL-2.0
4 * Copyright(C) 2015-2018 Linaro Limited.
6 * Author: Tor Jeremiassen <tor@ti.com>
7 * Author: Mathieu Poirier <mathieu.poirier@linaro.org>
10 #ifndef INCLUDE__CS_ETM_DECODER_H__
11 #define INCLUDE__CS_ETM_DECODER_H__
13 #include <linux/types.h>
14 #include <opencsd/ocsd_if_types.h>
17 struct cs_etm_decoder
;
19 struct cs_etm_packet_queue
;
23 typedef u32 (*cs_etm_mem_cb_type
)(struct cs_etm_queue
*, u8
, u64
, size_t, u8
*,
24 const ocsd_mem_space_acc_t
);
26 struct cs_etmv3_trace_params
{
33 struct cs_etmv4_trace_params
{
42 struct cs_ete_trace_params
{
52 struct cs_etm_trace_params
{
55 struct cs_etmv3_trace_params etmv3
;
56 struct cs_etmv4_trace_params etmv4
;
57 struct cs_ete_trace_params ete
;
61 struct cs_etm_decoder_params
{
63 void (*packet_printer
)(const char *msg
, void *data
);
64 cs_etm_mem_cb_type mem_acc_cb
;
73 * The following enums are indexed starting with 1 to align with the
74 * open source coresight trace decoder library.
77 CS_ETM_PROTO_ETMV3
= 1,
84 enum cs_etm_decoder_operation
{
85 CS_ETM_OPERATION_PRINT
= 1,
86 CS_ETM_OPERATION_DECODE
,
90 int cs_etm_decoder__process_data_block(struct cs_etm_decoder
*decoder
,
91 u64 indx
, const u8
*buf
,
92 size_t len
, size_t *consumed
);
94 struct cs_etm_decoder
*
95 cs_etm_decoder__new(int num_cpu
,
96 struct cs_etm_decoder_params
*d_params
,
97 struct cs_etm_trace_params t_params
[]);
99 void cs_etm_decoder__free(struct cs_etm_decoder
*decoder
);
101 int cs_etm_decoder__add_mem_access_cb(struct cs_etm_decoder
*decoder
,
103 cs_etm_mem_cb_type cb_func
);
105 int cs_etm_decoder__get_packet(struct cs_etm_packet_queue
*packet_queue
,
106 struct cs_etm_packet
*packet
);
108 int cs_etm_decoder__reset(struct cs_etm_decoder
*decoder
);
109 const char *cs_etm_decoder__get_name(struct cs_etm_decoder
*decoder
);
111 #endif /* INCLUDE__CS_ETM_DECODER_H__ */