trace.h

Go to the documentation of this file.
00001 /* 
00002  * Copyright (c) 2012, Texas Instruments Incorporated
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  *
00009  * *  Redistributions of source code must retain the above copyright
00010  *    notice, this list of conditions and the following disclaimer.
00011  *
00012  * *  Redistributions in binary form must reproduce the above copyright
00013  *    notice, this list of conditions and the following disclaimer in the
00014  *    documentation and/or other materials provided with the distribution.
00015  *
00016  * *  Neither the name of Texas Instruments Incorporated nor the names of
00017  *    its contributors may be used to endorse or promote products derived
00018  *    from this software without specific prior written permission.
00019  *
00020  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00021  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
00022  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00023  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
00024  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00025  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00026  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
00027  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
00028  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
00029  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
00030  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00031  * 
00032  */
00033 /*
00034  *  ======== trace.h ========
00035  */
00036 
00052 /*  Note        There are two definitions that affect which portions of trace
00053  *              are actually compiled into the client: @c XDAIS_TRACE_OUT and
00054  *              @c XDAIS_TRACE_ASSERT. If @c XDAIS_TRACE_OUT is set to 0 then all trace
00055  *              statements (except for assertions) will be compiled
00056  *              out of the client. If @c XDAIS_TRACE_ASSERT is set to 0 then
00057  *              assertions will be compiled out of the
00058  *              client.
00059  */
00060 
00061 #ifndef ti_xdais_TRACE_
00062 #define ti_xdais_TRACE_
00063 
00064 #ifdef __cplusplus
00065 extern "C" {
00066 #endif
00067 
00070 
00071 #include <ti/xdais/xdas.h>
00072 #include <ti/xdais/ialg.h>
00073 
00075 #ifndef XDAIS_TRACE_OUT
00076 #define XDAIS_TRACE_OUT 0 /* 0 = "trace compiled out"; 1 = "trace active" */
00077 #endif
00078 
00079 #ifndef XDAIS_TRACE_ASSERT
00080 #define XDAIS_TRACE_ASSERT 0 /* 0 = "trace-asserts compiled out"; 1 = "active"*/
00081 #endif
00082 
00085 /*
00086  *  New trace Class definitions.
00087  *
00088  * New proposal for how we should use different tracing classes: {
00089  *
00090  * - TRACE_ENTER (class 0): On entry to *and exit from* functions: consider
00091  *                       in general this class to be of interest to users
00092  * - TRACE_1CLASS : debugging info of interest to module developer only
00093  *
00094  * - TRACE_2CLASS : info for developer that *might* be of interest to users
00095  *
00096  * - TRACE_3CLASS : open (module developer can creatively use this one)
00097  *
00098  * - TRACE_4CLASS : info for developer that's likely to be important to the user
00099  *
00100  * - TRACE_5CLASS : benchmarking
00101  *
00102  * - TRACE_6CLASS : warnings
00103  *
00104  * - TRACE_7CLASS : errors
00105  *
00106  * }
00107  */
00108 
00112 #define TRACE_ENTER        ((UInt8)0x01)
00113 #define TRACE_1CLASS       ((UInt8)0x02)   
00114 #define TRACE_2CLASS       ((UInt8)0x04)   
00115 #define TRACE_3CLASS       ((UInt8)0x08)   
00116 #define TRACE_4CLASS       ((UInt8)0x10)   
00122 #define TRACE_5CLASS       ((UInt8)0x20)
00123 
00128 #define TRACE_6CLASS       ((UInt8)0x40)
00129 
00134 #define TRACE_7CLASS       ((UInt8)0x80)
00135 
00139 typedef XDAS_Int32 (* XDAIS_TRACE_AssertFxn)(IALG_Handle alg,
00140         XDAS_Int32 classId, String format, String arg1, XDAS_Int32 arg2);
00141 
00145 typedef XDAS_Int32 (* XDAIS_TRACE_PrintFxn)(IALG_Handle alg, XDAS_Int32 classId,
00146         String format, ...);
00147 /*
00148  *  ======== XDAIS_TRACE_print ========
00149  */
00171 #if (XDAIS_TRACE_OUT == 1)
00172 extern XDAIS_TRACE_PrintFxn XDAIS_TRACE_print;
00173 #endif
00174 
00195 #if (XDAIS_TRACE_ASSERT == 1)
00196 extern XDAIS_TRACE_AssertFxn XDAIS_TRACE_assert;
00197 #endif
00198 
00199 #if XDAIS_TRACE_ASSERT == 0
00200 
00202 #define TRACE_assert( alg, classId, expr )
00203 
00205 #else   /* XDAIS_TRACE_ASSERT == 1 */
00206 
00207 
00208 #define TRACE_assert(alg, classId, expr) \
00209         (!(expr) ? \
00210                 XDAIS_TRACE_assert((alg), (classId), "assertion violation: %s, \
00211         line %d\n", FILE__, __LINE__), NULL : NULL)
00212 
00213 #endif
00214 
00215 
00216 #if XDAIS_TRACE_OUT == 0
00217 
00220 #define TRACE_0print( alg, classId, format )
00221 #define TRACE_1print( alg, classId, format, arg1 )
00222 #define TRACE_2print( alg, classId, format, arg1, arg2 )
00223 #define TRACE_3print( alg, classId, format, arg1, arg2, arg3 )
00224 #define TRACE_4print( alg, classId, format, arg1, arg2, arg3, arg4 )
00225 #define TRACE_5print( alg, classId, format, arg1, arg2, arg3, arg4, arg5 )
00226 #define TRACE_6print( alg, classId, format, arg1, arg2, arg3, arg4, arg5, arg6 )
00227 
00230 #else   /* XDAIS_TRACE_OUT == 1 */
00231 
00235 #define TRACE_0print(alg, classId,  format) \
00236         XDAIS_TRACE_print((alg), (classId), (format))
00237 
00241 #define TRACE_1print(alg, classId, format, arg1) \
00242         XDAIS_TRACE_print((alg), (classId), (format), (arg1))
00243 
00247 #define TRACE_2print(alg, classId, format, arg1, arg2) \
00248         XDAIS_TRACE_print((alg), (classId), (format), (arg1), (arg2))
00249 
00253 #define TRACE_3print(alg, classId, format, arg1, arg2, arg3) \
00254         XDAIS_TRACE_print((alg), (classId), (format), (arg1), (arg2), (arg3))
00255 
00259 #define TRACE_4print(alg, classId, format, arg1, arg2, arg3, arg4) \
00260         XDAIS_TRACE_print((alg), (classId), (format), (arg1), (arg2), (arg3), \
00261         (arg4))
00262 
00266 #define TRACE_5print(alg, classId, format, arg1, arg2, arg3, arg4, arg5) \
00267         XDAIS_TRACE_print((alg), (classId), (format), (arg1), (arg2), (arg3), \
00268         (arg4), (arg5))
00269 
00273 #define TRACE_6print(alg, classId, format, arg1, arg2, arg3, arg4, arg5, arg6)\
00274         XDAIS_TRACE_print((alg), (classId), (format), (arg1),               \
00275         (arg2), (arg3), (arg4), (arg5), (arg6))
00276 
00277 
00278 
00279 #endif /* XDAIS_TRACE_OUT */
00280   /* ingroup */
00282 
00283 #ifdef __cplusplus
00284 }
00285 #endif
00286 
00287 #endif
00288 /*
00289  *  @(#) ti.xdais; 1, 2.0, 1,1; 6-19-2012 17:57:46; /db/wtree/library/trees/dais/dais-w06/src/ xlibrary
00290 
00291  */
00292 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines

Copyright 2012, Texas Instruments Incorporated