Merge branch 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[cris-mirror.git] / tools / perf / util / cs-etm-decoder / cs-etm-decoder.h
blob3d2e6205d1863bbd8296c3cf301044ae37755a41
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;
18 struct cs_etm_buffer {
19 const unsigned char *buf;
20 size_t len;
21 u64 offset;
22 u64 ref_timestamp;
25 enum cs_etm_sample_type {
26 CS_ETM_RANGE = 1 << 0,
29 struct cs_etm_packet {
30 enum cs_etm_sample_type sample_type;
31 u64 start_addr;
32 u64 end_addr;
33 u8 exc;
34 u8 exc_ret;
35 int cpu;
38 struct cs_etm_queue;
40 typedef u32 (*cs_etm_mem_cb_type)(struct cs_etm_queue *, u64,
41 size_t, u8 *);
43 struct cs_etmv4_trace_params {
44 u32 reg_idr0;
45 u32 reg_idr1;
46 u32 reg_idr2;
47 u32 reg_idr8;
48 u32 reg_configr;
49 u32 reg_traceidr;
52 struct cs_etm_trace_params {
53 int protocol;
54 union {
55 struct cs_etmv4_trace_params etmv4;
59 struct cs_etm_decoder_params {
60 int operation;
61 void (*packet_printer)(const char *msg);
62 cs_etm_mem_cb_type mem_acc_cb;
63 u8 formatted;
64 u8 fsyncs;
65 u8 hsyncs;
66 u8 frame_aligned;
67 void *data;
71 * The following enums are indexed starting with 1 to align with the
72 * open source coresight trace decoder library.
74 enum {
75 CS_ETM_PROTO_ETMV3 = 1,
76 CS_ETM_PROTO_ETMV4i,
77 CS_ETM_PROTO_ETMV4d,
80 enum {
81 CS_ETM_OPERATION_PRINT = 1,
82 CS_ETM_OPERATION_DECODE,
85 int cs_etm_decoder__process_data_block(struct cs_etm_decoder *decoder,
86 u64 indx, const u8 *buf,
87 size_t len, size_t *consumed);
89 struct cs_etm_decoder *
90 cs_etm_decoder__new(int num_cpu,
91 struct cs_etm_decoder_params *d_params,
92 struct cs_etm_trace_params t_params[]);
94 void cs_etm_decoder__free(struct cs_etm_decoder *decoder);
96 int cs_etm_decoder__add_mem_access_cb(struct cs_etm_decoder *decoder,
97 u64 start, u64 end,
98 cs_etm_mem_cb_type cb_func);
100 int cs_etm_decoder__get_packet(struct cs_etm_decoder *decoder,
101 struct cs_etm_packet *packet);
103 int cs_etm_decoder__reset(struct cs_etm_decoder *decoder);
105 #endif /* INCLUDE__CS_ETM_DECODER_H__ */