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>
16 struct cs_etm_decoder
;
18 struct cs_etm_packet_queue
;
22 typedef u32 (*cs_etm_mem_cb_type
)(struct cs_etm_queue
*, u8
, u64
, size_t, u8
*);
24 struct cs_etmv3_trace_params
{
31 struct cs_etmv4_trace_params
{
40 struct cs_etm_trace_params
{
43 struct cs_etmv3_trace_params etmv3
;
44 struct cs_etmv4_trace_params etmv4
;
48 struct cs_etm_decoder_params
{
50 void (*packet_printer
)(const char *msg
);
51 cs_etm_mem_cb_type mem_acc_cb
;
60 * The following enums are indexed starting with 1 to align with the
61 * open source coresight trace decoder library.
64 CS_ETM_PROTO_ETMV3
= 1,
70 enum cs_etm_decoder_operation
{
71 CS_ETM_OPERATION_PRINT
= 1,
72 CS_ETM_OPERATION_DECODE
,
76 int cs_etm_decoder__process_data_block(struct cs_etm_decoder
*decoder
,
77 u64 indx
, const u8
*buf
,
78 size_t len
, size_t *consumed
);
80 struct cs_etm_decoder
*
81 cs_etm_decoder__new(int num_cpu
,
82 struct cs_etm_decoder_params
*d_params
,
83 struct cs_etm_trace_params t_params
[]);
85 void cs_etm_decoder__free(struct cs_etm_decoder
*decoder
);
87 int cs_etm_decoder__add_mem_access_cb(struct cs_etm_decoder
*decoder
,
89 cs_etm_mem_cb_type cb_func
);
91 int cs_etm_decoder__get_packet(struct cs_etm_packet_queue
*packet_queue
,
92 struct cs_etm_packet
*packet
);
94 int cs_etm_decoder__reset(struct cs_etm_decoder
*decoder
);
96 #endif /* INCLUDE__CS_ETM_DECODER_H__ */