blob: f259b7ad7ca3ef8fedf3ae8b76ab9814eca1bbfc [file] [log] [blame]
rjw1f884582022-01-06 17:20:42 +08001/*
2 * Copyright (C) 2018 MediaTek Inc.
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
14#ifndef _TRACE_H_
15#define _TRACE_H_
16
17
18extern void (*mp_cp_ptr)(unsigned long long timestamp,
19 struct task_struct *task,
20 unsigned long program_counter,
21 unsigned long dcookie,
22 unsigned long offset,
23 unsigned char cnt, unsigned int *value);
24
25#define MP_FMT1 "%x\n"
26#define MP_FMT2 "%x,%x\n"
27#define MP_FMT3 "%x,%x,%x\n"
28#define MP_FMT4 "%x,%x,%x,%x\n"
29#define MP_FMT5 "%x,%x,%x,%x,%x\n"
30#define MP_FMT6 "%x,%x,%x,%x,%x,%x\n"
31#define MP_FMT7 "%x,%x,%x,%x,%x,%x,%x\n"
32#define MP_FMT8 "%x,%x,%x,%x,%x,%x,%x,%x\n"
33#define MP_FMT9 "%x,%x,%x,%x,%x,%x,%x,%x,%x\n"
34#define MP_FMT10 "%x,%x,%x,%x,%x,%x,%x,%x,%x,%x\n"
35#define MP_FMT11 "%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x\n"
36#define MP_FMT12 "%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x\n"
37#define MP_FMT13 "%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x\n"
38#define MP_FMT14 "%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x\n"
39#define MP_FMT15 "%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x\n"
40
41#define MET_GENERAL_PRINT(FUNC, count, value) \
42do { \
43 switch (count) { \
44 case 1: { \
45 FUNC(MP_FMT1, value[0]); \
46 } \
47 break; \
48 case 2: { \
49 FUNC(MP_FMT2, value[0], value[1]); \
50 } \
51 break; \
52 case 3: { \
53 FUNC(MP_FMT3, value[0], value[1], value[2]); \
54 } \
55 break; \
56 case 4: { \
57 FUNC(MP_FMT4, value[0], value[1], value[2], value[3]); \
58 } \
59 break; \
60 case 5: { \
61 FUNC(MP_FMT5, value[0], value[1], value[2], value[3], value[4]); \
62 } \
63 break; \
64 case 6: { \
65 FUNC(MP_FMT6, value[0], value[1], value[2], value[3], value[4], value[5]); \
66 } \
67 break; \
68 case 7: { \
69 FUNC(MP_FMT7, value[0], value[1], value[2], value[3], value[4], value[5], value[6]); \
70 } \
71 break; \
72 case 8: { \
73 FUNC(MP_FMT8, value[0], value[1], value[2], value[3], value[4], value[5], value[6], value[7]); \
74 } \
75 break; \
76 case 9: { \
77 FUNC(MP_FMT9, value[0], value[1], value[2], value[3], value[4], value[5], value[6], value[7], \
78 value[8]); \
79 } \
80 break; \
81 case 10: { \
82 FUNC(MP_FMT10, value[0], value[1], value[2], value[3], value[4], value[5], value[6], value[7], \
83 value[8], value[9]); \
84 } \
85 break; \
86 case 11: { \
87 FUNC(MP_FMT11, value[0], value[1], value[2], value[3], value[4], value[5], value[6], value[7], \
88 value[8], value[9], value[10]); \
89 } \
90 break; \
91 case 12: { \
92 FUNC(MP_FMT12, value[0], value[1], value[2], value[3], value[4], value[5], value[6], value[7], \
93 value[8], value[9], value[10], value[11]); \
94 } \
95 break; \
96 case 13: { \
97 FUNC(MP_FMT13, value[0], value[1], value[2], value[3], value[4], value[5], value[6], value[7], \
98 value[8], value[9], value[10], value[11], value[12]); \
99 } \
100 break; \
101 case 14: { \
102 FUNC(MP_FMT14, value[0], value[1], value[2], value[3], value[4], value[5], value[6], value[7], \
103 value[8], value[9], value[10], value[11], value[12], value[13]); \
104 } \
105 break; \
106 case 15: { \
107 FUNC(MP_FMT15, value[0], value[1], value[2], value[3], value[4], value[5], value[6], value[7], \
108 value[8], value[9], value[10], value[11], value[12], value[13], value[14]); \
109 } \
110 break; \
111 } \
112} while (0)
113#endif /* _TRACE_H_ */