SysLink API Reference
2.21.03.11
Main Page
Data Structures
Files
Related Pages
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
ti
syslink
utils
Trace.h
Go to the documentation of this file.
1
12
/*
13
* ============================================================================
14
*
15
* Copyright (c) 2008-2012, Texas Instruments Incorporated
16
*
17
* Redistribution and use in source and binary forms, with or without
18
* modification, are permitted provided that the following conditions
19
* are met:
20
*
21
* * Redistributions of source code must retain the above copyright
22
* notice, this list of conditions and the following disclaimer.
23
*
24
* * Redistributions in binary form must reproduce the above copyright
25
* notice, this list of conditions and the following disclaimer in the
26
* documentation and/or other materials provided with the distribution.
27
*
28
* * Neither the name of Texas Instruments Incorporated nor the names of
29
* its contributors may be used to endorse or promote products derived
30
* from this software without specific prior written permission.
31
*
32
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
33
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
34
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
35
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
36
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
37
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
38
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
39
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
40
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
41
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
42
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43
* Contact information for paper mail:
44
* Texas Instruments
45
* Post Office Box 655303
46
* Dallas, Texas 75265
47
* Contact information:
48
* http://www-k.ext.ti.com/sc/technical-support/product-information-centers.htm?
49
* DCMP=TIHomeTracking&HQS=Other+OT+home_d_contact
50
* ============================================================================
51
*
52
*/
53
54
55
#ifndef OSALTRACE_H_0xDA50
56
#define OSALTRACE_H_0xDA50
57
58
/* OSAL and utils headers */
59
#include <
ti/syslink/utils/OsalPrint.h
>
60
61
#if defined (__cplusplus)
62
extern
"C"
{
63
#endif
64
65
70
#define OSALTRACE_MODULEID (UInt16) 0xDA50
71
72
77
#define GT_TRACESTATE_MASK 0x0000000F
78
83
#define GT_TRACESTATE_SHIFT 0u
84
89
#define GT_TRACEENTER_MASK 0x000000F0
90
95
#define GT_TRACEENTER_SHIFT 4u
96
101
#define GT_TRACESETFAILURE_MASK 0x00000F00
102
107
#define GT_TRACESETFAILURE_SHIFT 8u
108
113
#define GT_TRACECLASS_MASK 0x000F0000
114
119
#define GT_TRACECLASS_SHIFT 16u
120
124
typedef
enum
{
125
GT_TraceState_Disable
= 0x00000000,
127
GT_TraceState_Enable
= 0x00000001,
129
GT_TraceState_EndValue
= 0x00000002
131
}
GT_TraceState
;
132
136
typedef
enum
{
137
GT_TraceEnter_Disable
= 0x00000000,
139
GT_TraceEnter_Enable
= 0x00000010,
141
GT_TraceEnter_EndValue
= 0x00000020
143
}
GT_TraceEnter
;
144
148
typedef
enum
{
149
GT_TraceSetFailure_Disable
= 0x00000000,
151
GT_TraceSetFailure_Enable
= 0x00000100,
153
GT_TraceSetFailure_EndValue
= 0x00000200
155
}
GT_TraceSetFailure
;
156
160
typedef
enum
{
161
GT_1CLASS
= 0x00010000,
163
GT_2CLASS
= 0x00020000,
165
GT_3CLASS
= 0x00030000,
167
GT_4CLASS
= 0x00040000,
169
GT_ENTER
= 0x00050000,
171
GT_LEAVE
= 0x00060000
173
}
GT_TraceClass
;
174
178
typedef
enum
{
179
GT_TraceType_User
= 0x00000000,
181
GT_TraceType_Kernel
= 0x00000001,
183
GT_TraceType_EndValue
= 0x00000003
185
}
GT_TraceType
;
186
187
188
#if defined(SYSLINK_BUILD_DEBUG)
189
#if defined(SYSLINK_BUILD_HLOS)
190
#define GT_assert(x, y) \
191
do { \
192
if (!(y)) { \
193
Osal_printf ("Assertion at Line no: %d in %s: %s : failed\n", \
194
__LINE__, __FILE__, #y); \
195
} \
196
} while (0);
197
#endif
/* defined(SYSLINK_BUILD_HLOS) */
198
199
#if defined(SYSLINK_BUILD_RTOS)
200
#define GT_assert(x, y) \
201
do { \
202
if (!(y)) { \
203
Osal_printf ("Assertion at Line no: %d in %s: %s : failed\n", \
204
__LINE__, __FILE__, #y); \
205
volatile int a =1; \
206
while(a); \
207
} \
208
} while (0);
209
#endif
/*#if defined(SYSLINK_BUILD_RTOS) */
210
#endif
/*#if defined(SYSLINK_BUILD_DEBUG) */
211
212
213
#if !defined(GT_assert)
214
#define GT_assert(x, y)
215
#endif
216
217
218
#if defined (SYSLINK_TRACE_ENABLE)
219
/* The global trace variable containing current trace configuration. */
220
extern
Int
curTrace;
221
222
UInt32
_GT_setTrace (
UInt32
mask,
GT_TraceType
type);
223
#define GT_setTrace(mask,type) _GT_setTrace(mask, type)
224
225
/* Function to report the syslink failure and log the trace. */
226
Void
_GT_setFailureReason (
Int
enableMask,
227
Char
* func,
228
Char
* fileName,
229
UInt32
lineNo,
230
Int32
status,
231
Char
* msg);
232
#define GT_setFailureReason(mask, classId, func, status, msg) \
233
_GT_setFailureReason(mask, func, \
234
__FILE__, __LINE__, status, (Char*) (msg"\n"))
235
236
237
/* Log the trace with zero parameters and information string. */
238
Void
_GT_0trace (
UInt32
maskType,
GT_TraceClass
classtype,
Char
* infoString);
239
#define GT_0trace(mask, classId, format) \
240
do { \
241
if (classId == GT_ENTER) { \
242
_GT_0trace(mask, classId, \
243
"Entered "format"\n"); \
244
} \
245
else if (classId == GT_LEAVE) { \
246
_GT_0trace(mask, classId, \
247
"Leaving "format"\n"); \
248
} \
249
else { \
250
_GT_0trace(mask, classId, \
251
format"\n"); \
252
} \
253
} while (0)
254
255
256
/* Function to log the trace with one additional parameter */
257
Void
_GT_1trace (
UInt32
maskType,
258
GT_TraceClass
classtype,
259
Char
* infoString,
260
UInt32
param);
261
#define GT_1trace(mask, classId, format, a) \
262
do { \
263
if (classId == GT_ENTER) { \
264
_GT_1trace(mask, classId, \
265
"Entered "format"\n\t"#a"\t[0x%x]\n", \
266
(UInt32) (a)); \
267
} \
268
else if (classId == GT_LEAVE) { \
269
_GT_1trace(mask, classId, \
270
"Leaving "format"\n\t"#a"\t[0x%x]\n", \
271
(UInt32) (a)); \
272
} \
273
else { \
274
_GT_1trace(mask, classId, \
275
format"\n", \
276
(UInt32) (a)); \
277
} \
278
} while (0)
279
280
281
/* Function to log the trace with two additional parameters */
282
Void
_GT_2trace (
UInt32
maskType,
283
GT_TraceClass
classtype,
284
Char
* infoString,
285
UInt32
param0,
286
UInt32
param1);
287
#define GT_2trace(mask, classId, format, a, b) \
288
do { \
289
if (classId == GT_ENTER) { \
290
_GT_2trace(mask, classId, \
291
"Entered "format"\n\t"#a"\t[0x%x]\n" \
292
"\t"#b"\t[0x%x]\n", \
293
(UInt32) (a), \
294
(UInt32) (b)); \
295
} \
296
else if (classId == GT_LEAVE) { \
297
_GT_2trace(mask, classId, \
298
"Leaving "format"\n\t"#a"\t[0x%x]\n" \
299
"\t"#b"\t[0x%x]\n", \
300
(UInt32) (a), \
301
(UInt32) (b)); \
302
} \
303
else { \
304
_GT_2trace(mask, classId, \
305
format"\n", \
306
(UInt32) (a), \
307
(UInt32) (b)); \
308
} \
309
} while (0)
310
311
312
/* Function to log the trace with three parameters. */
313
Void
_GT_3trace (
UInt32
maskType,
314
GT_TraceClass
classtype,
315
Char
* infoString,
316
UInt32
param0,
317
UInt32
param1,
318
UInt32
param2);
319
#define GT_3trace(mask, classId, format, a, b, c) \
320
do { \
321
if (classId == GT_ENTER) { \
322
_GT_3trace(mask, classId, \
323
"Entered "format"\n\t"#a"\t[0x%x]\n" \
324
"\t"#b"\t[0x%x]\n" \
325
"\t"#c"\t[0x%x]\n", \
326
(UInt32) (a), \
327
(UInt32) (b), \
328
(UInt32) (c)); \
329
} \
330
else if (classId == GT_LEAVE) { \
331
_GT_3trace(mask, classId, \
332
"Leaving "format"\n\t"#a"\t[0x%x]\n" \
333
"\t"#b"\t[0x%x]\n" \
334
"\t"#c"\t[0x%x]\n", \
335
(UInt32) (a), \
336
(UInt32) (b), \
337
(UInt32) (c)); \
338
} \
339
else { \
340
_GT_3trace(mask, classId, \
341
format"\n", \
342
(UInt32) (a), \
343
(UInt32) (b), \
344
(UInt32) (c)); \
345
} \
346
} while (0)
347
348
349
/* Function to log the trace with four parameters. */
350
Void
_GT_4trace (
UInt32
maskType,
351
GT_TraceClass
classtype,
352
Char
* infoString,
353
UInt32
param0,
354
UInt32
param1,
355
UInt32
param2,
356
UInt32
param3);
357
#define GT_4trace(mask, classId, format, a, b, c, d) \
358
do { \
359
if (classId == GT_ENTER) { \
360
_GT_4trace(mask, classId, \
361
"Entered "format"\n\t"#a"\t[0x%x]\n" \
362
"\t"#b"\t[0x%x]\n" \
363
"\t"#c"\t[0x%x]\n" \
364
"\t"#d"\t[0x%x]\n", \
365
(UInt32) (a), \
366
(UInt32) (b), \
367
(UInt32) (c), \
368
(UInt32) (d)); \
369
} \
370
else if (classId == GT_LEAVE) { \
371
_GT_4trace(mask, classId, \
372
"Leaving "format"\n\t"#a"\t[0x%x]\n" \
373
"\t"#b"\t[0x%x]\n" \
374
"\t"#c"\t[0x%x]\n" \
375
"\t"#d"\t[0x%x]\n", \
376
(UInt32) (a), \
377
(UInt32) (b), \
378
(UInt32) (c), \
379
(UInt32) (d)); \
380
} \
381
else { \
382
_GT_4trace(mask, classId, \
383
format"\n", \
384
(UInt32) (a), \
385
(UInt32) (b), \
386
(UInt32) (c), \
387
(UInt32) (d)); \
388
} \
389
} while (0)
390
391
392
/* Function to log the trace with five parameters. */
393
Void
_GT_5trace (
UInt32
maskType,
394
GT_TraceClass
classtype,
395
Char
* infoString,
396
UInt32
param0,
397
UInt32
param1,
398
UInt32
param2,
399
UInt32
param3,
400
UInt32
param4);
401
#define GT_5trace(mask, classId, format, a, b, c, d, e) \
402
do { \
403
if (classId == GT_ENTER) { \
404
_GT_5trace(mask, classId, \
405
"Entered "format"\n\t"#a"\t[0x%x]\n" \
406
"\t"#b"\t[0x%x]\n" \
407
"\t"#c"\t[0x%x]\n" \
408
"\t"#d"\t[0x%x]\n" \
409
"\t"#e"\t[0x%x]\n", \
410
(UInt32) (a), \
411
(UInt32) (b), \
412
(UInt32) (c), \
413
(UInt32) (d), \
414
(UInt32) (e)); \
415
} \
416
else if (classId == GT_LEAVE) { \
417
_GT_5trace(mask, classId, \
418
"Leaving "format"\n\t"#a"\t[0x%x]\n" \
419
"\t"#b"\t[0x%x]\n" \
420
"\t"#c"\t[0x%x]\n" \
421
"\t"#d"\t[0x%x]\n" \
422
"\t"#e"\t[0x%x]\n", \
423
(UInt32) (a), \
424
(UInt32) (b), \
425
(UInt32) (c), \
426
(UInt32) (d), \
427
(UInt32) (e)); \
428
} \
429
else { \
430
_GT_5trace(mask, classId, \
431
format"\n", \
432
(UInt32) (a), \
433
(UInt32) (b), \
434
(UInt32) (c), \
435
(UInt32) (d), \
436
(UInt32) (e)); \
437
} \
438
} while (0)
439
440
/* Function to log the trace with six parameters. */
441
Void
_GT_6trace (
UInt32
maskType,
442
GT_TraceClass
classtype,
443
Char
* infoString,
444
UInt32
param0,
445
UInt32
param1,
446
UInt32
param2,
447
UInt32
param3,
448
UInt32
param4,
449
UInt32
param5);
450
#define GT_6trace(mask, classId, format, a, b, c, d, e, f) \
451
do { \
452
if (classId == GT_ENTER) { \
453
_GT_6trace(mask, classId, \
454
"Entered "format"\n\t"#a"\t[0x%x]\n" \
455
"\t"#b"\t[0x%x]\n" \
456
"\t"#c"\t[0x%x]\n" \
457
"\t"#d"\t[0x%x]\n" \
458
"\t"#e"\t[0x%x]\n" \
459
"\t"#f"\t[0x%x]\n", \
460
(UInt32) (a), \
461
(UInt32) (b), \
462
(UInt32) (c), \
463
(UInt32) (d), \
464
(UInt32) (e), \
465
(UInt32) (f)); \
466
} \
467
else if (classId == GT_LEAVE) { \
468
_GT_6trace(mask, classId, \
469
"Leaving "format"\n\t"#a"\t[0x%x]\n" \
470
"\t"#b"\t[0x%x]\n" \
471
"\t"#c"\t[0x%x]\n" \
472
"\t"#d"\t[0x%x]\n" \
473
"\t"#e"\t[0x%x]\n" \
474
"\t"#f"\t[0x%x]\n", \
475
(UInt32) (a), \
476
(UInt32) (b), \
477
(UInt32) (c), \
478
(UInt32) (d), \
479
(UInt32) (e), \
480
(UInt32) (f)); \
481
} \
482
else { \
483
_GT_6trace(mask, classId, \
484
format"\n", \
485
(UInt32) (a), \
486
(UInt32) (b), \
487
(UInt32) (c), \
488
(UInt32) (d), \
489
(UInt32) (e), \
490
(UInt32) (f)); \
491
} \
492
} while (0)
493
494
#else
/* if defined (SYSLINK_TRACE_ENABLE) */
495
496
#define GT_setFailureReason(mask, classId, func, status, msg)
497
#define GT_0trace(mask, classId, format)
498
#define GT_1trace(mask, classId, format, arg1)
499
#define GT_2trace(mask, classId, format, arg1, arg2)
500
#define GT_3trace(mask, classId, format, arg1, arg2, arg3)
501
#define GT_4trace(mask, classId, format, arg1, arg2, arg3, arg4)
502
#define GT_5trace(mask, classId, format, arg1, arg2, arg3, arg4, arg5)
503
#define GT_6trace(mask, classId, format, arg1, arg2, arg3, arg4, arg5, arg6)
504
#define GT_setTrace(mask, type) 0
505
506
#endif
/* if defined (SYSLINK_TRACE_ENABLE) */
507
508
509
#if defined (__cplusplus)
510
}
511
#endif
/* defined (__cplusplus) */
512
513
#endif
/* ifndef OSALTRACE_H_0xDA50 */
Copyright 2014, Texas Instruments Incorporated