-
-
Notifications
You must be signed in to change notification settings - Fork 46
/
trice64.h
299 lines (264 loc) Β· 15.7 KB
/
trice64.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
/*! \file internalTrice64.h
\author thomas.hoehenleitner [at] seerose.net
*******************************************************************************/
#if TRICE_DEFAULT_PARAMETER_BIT_WIDTH == 64
// #define TRICE_0 TRICE64_0 //!< Default parameter bit width for 0 parameter count TRICE is 64.
#define TRICE_1 TRICE64_1 //!< Default parameter bit width for 1 parameter count TRICE is 64.
#define TRICE_2 TRICE64_2 //!< Default parameter bit width for 2 parameter count TRICE is 64.
#define TRICE_3 TRICE64_3 //!< Default parameter bit width for 3 parameter count TRICE is 64.
#define TRICE_4 TRICE64_4 //!< Default parameter bit width for 4 parameter count TRICE is 64.
#define TRICE_5 TRICE64_5 //!< Default parameter bit width for 5 parameter count TRICE is 64.
#define TRICE_6 TRICE64_6 //!< Default parameter bit width for 6 parameter count TRICE is 64.
#define TRICE_7 TRICE64_7 //!< Default parameter bit width for 7 parameter count TRICE is 64.
#define TRICE_8 TRICE64_8 //!< Default parameter bit width for 8 parameter count TRICE is 64.
#define TRICE_9 TRICE64_9 //!< Default parameter bit width for 9 parameter count TRICE is 64.
#define TRICE_10 TRICE64_10 //!< Default parameter bit width for 10 parameter count TRICE is 64.
#define TRICE_11 TRICE64_11 //!< Default parameter bit width for 11 parameter count TRICE is 64.
#define TRICE_12 TRICE64_12 //!< Default parameter bit width for 12 parameter count TRICE is 64.
// #define trice_0 trice64_0 //!< Default parameter bit width for 1 parameter count trice is 64.
#define trice_1 trice64_1 //!< Default parameter bit width for 1 parameter count trice is 64.
#define trice_2 trice64_2 //!< Default parameter bit width for 2 parameter count trice is 64.
#define trice_3 trice64_3 //!< Default parameter bit width for 3 parameter count trice is 64.
#define trice_4 trice64_4 //!< Default parameter bit width for 4 parameter count trice is 64.
#define trice_5 trice64_5 //!< Default parameter bit width for 5 parameter count trice is 64.
#define trice_6 trice64_6 //!< Default parameter bit width for 6 parameter count trice is 64.
#define trice_7 trice64_7 //!< Default parameter bit width for 7 parameter count trice is 64.
#define trice_8 trice64_8 //!< Default parameter bit width for 8 parameter count trice is 64.
#define trice_9 trice64_9 //!< Default parameter bit width for 9 parameter count trice is 64.
#define trice_10 trice64_10 //!< Default parameter bit width for 10 parameter count trice is 64.
#define trice_11 trice64_11 //!< Default parameter bit width for 11 parameter count trice is 64.
#define trice_12 trice64_12 //!< Default parameter bit width for 12 parameter count trice is 64.
// #define Trice_0 Trice64_0 //!< Default parameter bit width for 0 parameter count Trice is 64.
#define Trice_1 Trice64_1 //!< Default parameter bit width for 1 parameter count Trice is 64.
#define Trice_2 Trice64_2 //!< Default parameter bit width for 2 parameter count Trice is 64.
#define Trice_3 Trice64_3 //!< Default parameter bit width for 3 parameter count Trice is 64.
#define Trice_4 Trice64_4 //!< Default parameter bit width for 4 parameter count Trice is 64.
#define Trice_5 Trice64_5 //!< Default parameter bit width for 5 parameter count Trice is 64.
#define Trice_6 Trice64_6 //!< Default parameter bit width for 6 parameter count Trice is 64.
#define Trice_7 Trice64_7 //!< Default parameter bit width for 7 parameter count Trice is 64.
#define Trice_8 Trice64_8 //!< Default parameter bit width for 8 parameter count Trice is 64.
#define Trice_9 Trice64_9 //!< Default parameter bit width for 9 parameter count Trice is 64.
#define Trice_10 Trice64_10 //!< Default parameter bit width for 10 parameter count Trice is 64.
#define Trice_11 Trice64_11 //!< Default parameter bit width for 11 parameter count Trice is 64.
#define Trice_12 Trice64_12 //!< Default parameter bit width for 12 parameter count Trice is 64.
// #define TRice_0 TRice64_0 //!< Default parameter bit width for 0 parameter count TRice is 64.
#define TRice_1 TRice64_1 //!< Default parameter bit width for 1 parameter count TRice is 64.
#define TRice_2 TRice64_2 //!< Default parameter bit width for 2 parameter count TRice is 64.
#define TRice_3 TRice64_3 //!< Default parameter bit width for 3 parameter count TRice is 64.
#define TRice_4 TRice64_4 //!< Default parameter bit width for 4 parameter count TRice is 64.
#define TRice_5 TRice64_5 //!< Default parameter bit width for 5 parameter count TRice is 64.
#define TRice_6 TRice64_6 //!< Default parameter bit width for 6 parameter count TRice is 64.
#define TRice_7 TRice64_7 //!< Default parameter bit width for 7 parameter count TRice is 64.
#define TRice_8 TRice64_8 //!< Default parameter bit width for 8 parameter count TRice is 64.
#define TRice_9 TRice64_9 //!< Default parameter bit width for 9 parameter count TRice is 64.
#define TRice_10 TRice64_10 //!< Default parameter bit width for 10 parameter count TRice is 64.
#define TRice_11 TRice64_11 //!< Default parameter bit width for 11 parameter count TRice is 64.
#define TRice_12 TRice64_12 //!< Default parameter bit width for 12 parameter count TRice is 64.
#endif // #if TRICE_DEFAULT_PARAMETER_BIT_WIDTH == 64
#define TRICE64(tid, fmt, ...) TRICE_CONCAT2(TRICE64_, TRICE_COUNT_ARGUMENTS(__VA_ARGS__))(tid, fmt, ##__VA_ARGS__)
//! TRICE64_B expects inside pFmt only one format specifier, which is used n times by using pFmt n times.
//! It is usable for showing n 64-bit values.
#define TRICE64_B(id, pFmt, buf, n) \
do { \
TRICE_N(id, pFmt, buf, 8 * n); \
} while (0)
//! TRICE64_F expects inside pFmt just a string which is assumed to be a remote function name.
//! The trice tool displays the pFmt string followed by n times (64-bit value i).
//! The idea behind is to generate an id - function pointer referece list from the generated til.json file to
//! compile it into a remote device and execute the inside pFmt named function remotely.
//! Look for "TRICE64_F example" inside triceCheck.c.
#define TRICE64_F TRICE64_B
#define TRICE_PUT64_1(v0) TRICE_PUT64(v0);
#define TRICE_PUT64_2(v0, v1) \
TRICE_PUT64(v0); \
TRICE_PUT64(v1);
#define TRICE_PUT64_3(v0, v1, v2) \
TRICE_PUT64(v0); \
TRICE_PUT64(v1); \
TRICE_PUT64(v2);
#define TRICE_PUT64_4(v0, v1, v2, v3) \
TRICE_PUT64(v0); \
TRICE_PUT64(v1); \
TRICE_PUT64(v2); \
TRICE_PUT64(v3);
#define TRICE_PUT64_5(v0, v1, v2, v3, v4) \
TRICE_PUT64(v0); \
TRICE_PUT64(v1); \
TRICE_PUT64(v2); \
TRICE_PUT64(v3); \
TRICE_PUT64(v4);
#define TRICE_PUT64_6(v0, v1, v2, v3, v4, v5) \
TRICE_PUT64(v0); \
TRICE_PUT64(v1); \
TRICE_PUT64(v2); \
TRICE_PUT64(v3); \
TRICE_PUT64(v4); \
TRICE_PUT64(v5);
#define TRICE_PUT64_7(v0, v1, v2, v3, v4, v5, v6) \
TRICE_PUT64(v0); \
TRICE_PUT64(v1); \
TRICE_PUT64(v2); \
TRICE_PUT64(v3); \
TRICE_PUT64(v4); \
TRICE_PUT64(v5); \
TRICE_PUT64(v6);
#define TRICE_PUT64_8(v0, v1, v2, v3, v4, v5, v6, v7) \
TRICE_PUT64(v0); \
TRICE_PUT64(v1); \
TRICE_PUT64(v2); \
TRICE_PUT64(v3); \
TRICE_PUT64(v4); \
TRICE_PUT64(v5); \
TRICE_PUT64(v6); \
TRICE_PUT64(v7);
#define TRICE_PUT64_9(v0, v1, v2, v3, v4, v5, v6, v7, v8) \
TRICE_PUT64(v0); \
TRICE_PUT64(v1); \
TRICE_PUT64(v2); \
TRICE_PUT64(v3); \
TRICE_PUT64(v4); \
TRICE_PUT64(v5); \
TRICE_PUT64(v6); \
TRICE_PUT64(v7); \
TRICE_PUT64(v8);
#define TRICE_PUT64_10(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) \
TRICE_PUT64(v0); \
TRICE_PUT64(v1); \
TRICE_PUT64(v2); \
TRICE_PUT64(v3); \
TRICE_PUT64(v4); \
TRICE_PUT64(v5); \
TRICE_PUT64(v6); \
TRICE_PUT64(v7); \
TRICE_PUT64(v8); \
TRICE_PUT64(v9);
#define TRICE_PUT64_11(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10) \
TRICE_PUT64(v0); \
TRICE_PUT64(v1); \
TRICE_PUT64(v2); \
TRICE_PUT64(v3); \
TRICE_PUT64(v4); \
TRICE_PUT64(v5); \
TRICE_PUT64(v6); \
TRICE_PUT64(v7); \
TRICE_PUT64(v8); \
TRICE_PUT64(v9); \
TRICE_PUT64(v10);
#define TRICE_PUT64_12(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) \
TRICE_PUT64(v0); \
TRICE_PUT64(v1); \
TRICE_PUT64(v2); \
TRICE_PUT64(v3); \
TRICE_PUT64(v4); \
TRICE_PUT64(v5); \
TRICE_PUT64(v6); \
TRICE_PUT64(v7); \
TRICE_PUT64(v8); \
TRICE_PUT64(v9); \
TRICE_PUT64(v10); \
TRICE_PUT64(v11);
// The following `TRICE` macro definitions uses the C preprocess to concatenate the code behind the sub-macros.
// The sequence `tid` in this context is executable code `id(n)`, `Id(n)` or `ID(n)` defined in trice.h.
// This works only with tid=`id(n)`, `Id(n)`, `ID(n)`.
//! TRICE64_0 writes trice data as fast as possible in a buffer.
//! \param tid is a 16 bit Trice id in upper 2 bytes of a 32 bit value
#define TRICE64_0(tid, pFmt) \
TRICE_ENTER tid; \
TRICE_CNTC(0); \
TRICE_LEAVE
//! TRICE64_1 writes trice data as fast as possible in a buffer.
//! \param tid is a 16 bit Trice id in upper 2 bytes of a 32 bit value
//! \param v0 a 64 bit value
#define TRICE64_1(tid, pFmt, v0) \
TRICE_ENTER tid; \
TRICE_CNTC(8); \
TRICE_PUT64_1(v0) \
TRICE_LEAVE
//! TRICE64_2 writes trice data as fast as possible in a buffer.
//! \param tid is a 16 bit Trice id in upper 2 bytes of a 32 bit value
//! \param v0 - v1 are 64 bit values
#define TRICE64_2(id, pFmt, v0, v1) \
TRICE_ENTER id; \
TRICE_CNTC(16); \
TRICE_PUT64_2(v0, v1); \
TRICE_LEAVE
//! TRICE64_3 writes trice data as fast as possible in a buffer.
//! \param tid is a 16 bit Trice id in upper 2 bytes of a 32 bit value
//! \param v0 - v2 are 64 bit values
#define TRICE64_3(id, pFmt, v0, v1, v2) \
TRICE_ENTER id; \
TRICE_CNTC(24); \
TRICE_PUT64_3(v0, v1, v2); \
TRICE_LEAVE
//! TRICE64_4 writes trice data as fast as possible in a buffer.
//! \param tid is a 16 bit Trice id in upper 2 bytes of a 32 bit value
//! \param v0 - v3 are 64 bit values
#define TRICE64_4(id, pFmt, v0, v1, v2, v3) \
TRICE_ENTER id; \
TRICE_CNTC(32); \
TRICE_PUT64_4(v0, v1, v2, v3); \
TRICE_LEAVE
//! TRICE64_5 writes trice data as fast as possible in a buffer.
//! \param tid is a 16 bit Trice id in upper 2 bytes of a 32 bit value
//! \param v0 - v4 are 64 bit values
#define TRICE64_5(id, pFmt, v0, v1, v2, v3, v4) \
TRICE_ENTER id; \
TRICE_CNTC(40); \
TRICE_PUT64_5(v0, v1, v2, v3, v4); \
TRICE_LEAVE
//! TRICE64_6 writes trice data as fast as possible in a buffer.
//! \param tid is a 16 bit Trice id in upper 2 bytes of a 32 bit value
//! \param v0 - v5 are 64 bit values
#define TRICE64_6(id, pFmt, v0, v1, v2, v3, v4, v5) \
TRICE_ENTER id; \
TRICE_CNTC(48); \
TRICE_PUT64_6(v0, v1, v2, v3, v4, v5); \
TRICE_LEAVE
//! TRICE64_8 writes trice data as fast as possible in a buffer.
//! \param tid is a 16 bit Trice id in upper 2 bytes of a 32 bit value
//! \param v0 - v6 are 64 bit values
#define TRICE64_7(id, pFmt, v0, v1, v2, v3, v4, v5, v6) \
TRICE_ENTER id; \
TRICE_CNTC(56); \
TRICE_PUT64_7(v0, v1, v2, v3, v4, v5, v6); \
TRICE_LEAVE
//! TRICE64_8 writes trice data as fast as possible in a buffer.
//! \param tid is a 16 bit Trice id in upper 2 bytes of a 32 bit value
//! \param v0 - v7 are 64 bit values
#define TRICE64_8(id, pFmt, v0, v1, v2, v3, v4, v5, v6, v7) \
TRICE_ENTER id; \
TRICE_CNTC(64); \
TRICE_PUT64_8(v0, v1, v2, v3, v4, v5, v6, v7); \
TRICE_LEAVE
//! TRICE64_8 writes trice data as fast as possible in a buffer.
//! \param tid is a 16 bit Trice id in upper 2 bytes of a 32 bit value
//! \param v0 - v7 are 64 bit values
#define TRICE64_9(id, pFmt, v0, v1, v2, v3, v4, v5, v6, v7, v8) \
TRICE_ENTER id; \
TRICE_CNTC(72); \
TRICE_PUT64_9(v0, v1, v2, v3, v4, v5, v6, v7, v8); \
TRICE_LEAVE
//! TRICE64_8 writes trice data as fast as possible in a buffer.
//! \param tid is a 16 bit Trice id in upper 2 bytes of a 32 bit value
//! \param v0 - v7 are 64 bit values
#define TRICE64_10(id, pFmt, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) \
TRICE_ENTER id; \
TRICE_CNTC(80); \
TRICE_PUT64_10(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9); \
TRICE_LEAVE
//! TRICE64_8 writes trice data as fast as possible in a buffer.
//! \param tid is a 16 bit Trice id in upper 2 bytes of a 32 bit value
//! \param v0 - v7 are 64 bit values
#define TRICE64_11(id, pFmt, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10) \
TRICE_ENTER id; \
TRICE_CNTC(88); \
TRICE_PUT64_11(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10); \
TRICE_LEAVE
//! TRICE64_12 writes trice data as fast as possible in a buffer.
//! \param tid is a 16 bit Trice id in upper 2 bytes of a 32 bit value
//! \param v0 - v11 are 64 bit values
#define TRICE64_12(id, pFmt, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) \
TRICE_ENTER id; \
TRICE_CNTC(96); \
TRICE_PUT64_12(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) \
TRICE_LEAVE