WIP FPC-III support
[linux/fpc-iii.git] / tools / perf / util / cs-etm-decoder / cs-etm-decoder.h
blob11f3391d06f2b1471ba89649d14d11ad22fe90ce
1 /*
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>
8 */
10 #ifndef INCLUDE__CS_ETM_DECODER_H__
11 #define INCLUDE__CS_ETM_DECODER_H__
13 #include <linux/types.h>
14 #include <stdio.h>
16 struct cs_etm_decoder;
17 struct cs_etm_packet;
18 struct cs_etm_packet_queue;
20 struct cs_etm_queue;
22 typedef u32 (*cs_etm_mem_cb_type)(struct cs_etm_queue *, u8, u64, size_t, u8 *);
24 struct cs_etmv3_trace_params {
25 u32 reg_ctrl;
26 u32 reg_trc_id;
27 u32 reg_ccer;
28 u32 reg_idr;
31 struct cs_etmv4_trace_params {
32 u32 reg_idr0;
33 u32 reg_idr1;
34 u32 reg_idr2;
35 u32 reg_idr8;
36 u32 reg_configr;
37 u32 reg_traceidr;
40 struct cs_etm_trace_params {
41 int protocol;
42 union {
43 struct cs_etmv3_trace_params etmv3;
44 struct cs_etmv4_trace_params etmv4;
48 struct cs_etm_decoder_params {
49 int operation;
50 void (*packet_printer)(const char *msg);
51 cs_etm_mem_cb_type mem_acc_cb;
52 u8 formatted;
53 u8 fsyncs;
54 u8 hsyncs;
55 u8 frame_aligned;
56 void *data;
60 * The following enums are indexed starting with 1 to align with the
61 * open source coresight trace decoder library.
63 enum {
64 CS_ETM_PROTO_ETMV3 = 1,
65 CS_ETM_PROTO_ETMV4i,
66 CS_ETM_PROTO_ETMV4d,
67 CS_ETM_PROTO_PTM,
70 enum cs_etm_decoder_operation {
71 CS_ETM_OPERATION_PRINT = 1,
72 CS_ETM_OPERATION_DECODE,
73 CS_ETM_OPERATION_MAX,
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,
88 u64 start, u64 end,
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__ */