XDAIS
dais-x04
Main Page
Modules
Data Structures
Files
Related Pages
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Groups
Pages
packages
ti
xdais
trace.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2006-2012, Texas Instruments Incorporated
3
* All rights reserved.
4
*
5
* Redistribution and use in source and binary forms, with or without
6
* modification, are permitted provided that the following conditions
7
* are met:
8
*
9
* * Redistributions of source code must retain the above copyright
10
* notice, this list of conditions and the following disclaimer.
11
*
12
* * Redistributions in binary form must reproduce the above copyright
13
* notice, this list of conditions and the following disclaimer in the
14
* documentation and/or other materials provided with the distribution.
15
*
16
* * Neither the name of Texas Instruments Incorporated nor the names of
17
* its contributors may be used to endorse or promote products derived
18
* from this software without specific prior written permission.
19
*
20
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
*
32
*/
33
/*
34
* ======== trace.h ========
35
*/
36
52
/* Note There are two definitions that affect which portions of trace
53
* are actually compiled into the client: @c XDAIS_TRACE_OUT and
54
* @c XDAIS_TRACE_ASSERT. If @c XDAIS_TRACE_OUT is set to 0 then all trace
55
* statements (except for assertions) will be compiled
56
* out of the client. If @c XDAIS_TRACE_ASSERT is set to 0 then
57
* assertions will be compiled out of the
58
* client.
59
*/
60
61
#ifndef ti_xdais_TRACE_
62
#define ti_xdais_TRACE_
63
64
#ifdef __cplusplus
65
extern
"C"
{
66
#endif
67
70
71
#include <
ti/xdais/xdas.h
>
72
#include <
ti/xdais/ialg.h
>
73
75
#ifndef XDAIS_TRACE_OUT
76
#define XDAIS_TRACE_OUT 0
/* 0 = "trace compiled out"; 1 = "trace active" */
77
#endif
78
79
#ifndef XDAIS_TRACE_ASSERT
80
#define XDAIS_TRACE_ASSERT 0
/* 0 = "trace-asserts compiled out"; 1 = "active"*/
81
#endif
82
85
/*
86
* New trace Class definitions.
87
*
88
* New proposal for how we should use different tracing classes: {
89
*
90
* - TRACE_ENTER (class 0): On entry to *and exit from* functions: consider
91
* in general this class to be of interest to users
92
* - TRACE_1CLASS : debugging info of interest to module developer only
93
*
94
* - TRACE_2CLASS : info for developer that *might* be of interest to users
95
*
96
* - TRACE_3CLASS : open (module developer can creatively use this one)
97
*
98
* - TRACE_4CLASS : info for developer that's likely to be important to the user
99
*
100
* - TRACE_5CLASS : benchmarking
101
*
102
* - TRACE_6CLASS : warnings
103
*
104
* - TRACE_7CLASS : errors
105
*
106
* }
107
*/
108
112
#define TRACE_ENTER ((UInt8)0x01)
113
#define TRACE_1CLASS ((UInt8)0x02)
114
#define TRACE_2CLASS ((UInt8)0x04)
115
#define TRACE_3CLASS ((UInt8)0x08)
116
#define TRACE_4CLASS ((UInt8)0x10)
122
#define TRACE_5CLASS ((UInt8)0x20)
123
128
#define TRACE_6CLASS ((UInt8)0x40)
129
134
#define TRACE_7CLASS ((UInt8)0x80)
135
139
typedef
XDAS_Int32
(*
XDAIS_TRACE_AssertFxn
)(
IALG_Handle
alg,
140
XDAS_Int32
classId, String format, String arg1,
XDAS_Int32
arg2);
141
145
typedef
XDAS_Int32
(*
XDAIS_TRACE_PrintFxn
)(
IALG_Handle
alg,
XDAS_Int32
classId,
146
String format, ...);
147
/*
148
* ======== XDAIS_TRACE_print ========
149
*/
171
#if (XDAIS_TRACE_OUT == 1)
172
extern
XDAIS_TRACE_PrintFxn
XDAIS_TRACE_print;
173
#endif
174
195
#if (XDAIS_TRACE_ASSERT == 1)
196
extern
XDAIS_TRACE_AssertFxn
XDAIS_TRACE_assert;
197
#endif
198
199
#if XDAIS_TRACE_ASSERT == 0
200
202
#define TRACE_assert( alg, classId, expr )
203
205
#else
/* XDAIS_TRACE_ASSERT == 1 */
206
207
208
#define TRACE_assert(alg, classId, expr) \
209
(!(expr) ? \
210
XDAIS_TRACE_assert((alg), (classId), "assertion violation: %s, \
211
line %d\n", FILE__, __LINE__), NULL : NULL)
212
213
#endif
214
215
216
#if XDAIS_TRACE_OUT == 0
217
220
#define TRACE_0print( alg, classId, format )
221
#define TRACE_1print( alg, classId, format, arg1 )
222
#define TRACE_2print( alg, classId, format, arg1, arg2 )
223
#define TRACE_3print( alg, classId, format, arg1, arg2, arg3 )
224
#define TRACE_4print( alg, classId, format, arg1, arg2, arg3, arg4 )
225
#define TRACE_5print( alg, classId, format, arg1, arg2, arg3, arg4, arg5 )
226
#define TRACE_6print( alg, classId, format, arg1, arg2, arg3, arg4, arg5, arg6 )
227
230
#else
/* XDAIS_TRACE_OUT == 1 */
231
235
#define TRACE_0print(alg, classId, format) \
236
XDAIS_TRACE_print((alg), (classId), (format))
237
241
#define TRACE_1print(alg, classId, format, arg1) \
242
XDAIS_TRACE_print((alg), (classId), (format), (arg1))
243
247
#define TRACE_2print(alg, classId, format, arg1, arg2) \
248
XDAIS_TRACE_print((alg), (classId), (format), (arg1), (arg2))
249
253
#define TRACE_3print(alg, classId, format, arg1, arg2, arg3) \
254
XDAIS_TRACE_print((alg), (classId), (format), (arg1), (arg2), (arg3))
255
259
#define TRACE_4print(alg, classId, format, arg1, arg2, arg3, arg4) \
260
XDAIS_TRACE_print((alg), (classId), (format), (arg1), (arg2), (arg3), \
261
(arg4))
262
266
#define TRACE_5print(alg, classId, format, arg1, arg2, arg3, arg4, arg5) \
267
XDAIS_TRACE_print((alg), (classId), (format), (arg1), (arg2), (arg3), \
268
(arg4), (arg5))
269
273
#define TRACE_6print(alg, classId, format, arg1, arg2, arg3, arg4, arg5, arg6)\
274
XDAIS_TRACE_print((alg), (classId), (format), (arg1), \
275
(arg2), (arg3), (arg4), (arg5), (arg6))
276
277
278
279
#endif
/* XDAIS_TRACE_OUT */
280
/* ingroup */
282
283
#ifdef __cplusplus
284
}
285
#endif
286
287
#endif
Copyright 2013, Texas Instruments Incorporated