00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075 #ifndef ti_sdo_utils_trace_GT_
00076 #define ti_sdo_utils_trace_GT_
00077
00078 #ifdef __cplusplus
00079 extern "C" {
00080 #endif
00081
00084
00087 #ifndef GT_TRACE
00088 #define GT_TRACE 1
00089 #endif
00090
00091 #if !defined(GT_ASSERT) || GT_TRACE
00092 #define GT_ASSERT 1
00093 #endif
00094
00095 typedef Void (*GT_PrintFxn)(String fmt, ...);
00096 typedef Ptr (*GT_MallocFxn)(Int size);
00097 typedef Void (*GT_FreeFxn)(Ptr addr, Int size);
00098 typedef UInt32 (*GT_TimeFxn)(Void);
00099
00100 typedef struct {
00101 GT_PrintFxn PRINTFXN;
00102 Fxn PIDFXN;
00103 Fxn TIDFXN;
00104 GT_PrintFxn ERRORFXN;
00105 GT_MallocFxn MALLOCFXN;
00106 GT_FreeFxn FREEFXN;
00107 GT_TimeFxn TIMEFXN;
00108 Fxn LOCKFXN;
00109 Fxn UNLOCKFXN;
00110 Fxn INITFXN;
00111 } GT_Config;
00112
00113 #if (GT_TRACE != 0) || (GT_ASSERT !=0 )
00114 extern __FAR__ GT_Config *GT;
00115 #endif
00116
00131 typedef struct {
00132 String modName;
00133 UInt8 *flags;
00134 } GT_Mask;
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00165 #define GT_ENTER ((UInt8)0x01)
00166
00167 #define GT_1CLASS ((UInt8)0x02)
00168 #define GT_2CLASS ((UInt8)0x04)
00169 #define GT_3CLASS ((UInt8)0x08)
00170 #define GT_4CLASS ((UInt8)0x10)
00176 #define GT_5CLASS ((UInt8)0x20)
00177
00182 #define GT_6CLASS ((UInt8)0x40)
00183
00188 #define GT_7CLASS ((UInt8)0x80)
00189
00190
00191
00192
00212 extern Void _GT_create(GT_Mask *mask, String modName);
00213
00214
00217 extern UInt32 GT_curTime(Void);
00218
00219 #define GT_exit()
00220
00223
00224
00225
00232 extern Void GT_init(Void);
00233
00234
00235
00236
00237
00248 extern Void _GT_set(String str);
00249
00250
00251
00252
00253
00276 extern Int _GT_trace(GT_Mask *mask, Int classId, String format, ...);
00277
00279 extern Void GT_disable(Void);
00280 extern Void GT_enable(Void);
00281 extern Bool GT_getModNameFlags(String modName, UInt8 *flags);
00282
00283 #if GT_ASSERT == 0
00284
00285 #define GT_assert( mask, expr )
00286 #define GT_config( config )
00287 #define GT_configInit( config )
00288 #define GT_seterror( fxn )
00289
00290 #else
00291
00292 extern GT_Config _ti_sdo_utils_trace_GT_params;
00293
00294 #define GT_assert( mask, expr ) \
00295 (!(expr) ? \
00296 (*GT->ERRORFXN)("assertion violation: %s, line %d\n", \
00297 __FILE__, __LINE__), NULL : NULL)
00298
00299 #define GT_config(config) (_ti_sdo_utils_trace_GT_params = *(config))
00300 #define GT_configInit(config) (*(config) = _ti_sdo_utils_trace_GT_params)
00301 #define GT_seterror(fxn) (_ti_sdo_utils_trace_GT_params.ERRORFXN = (Fxn)(fxn))
00302
00303 #endif
00304
00307 #if GT_TRACE == 0
00308
00311 #define GT_curLine() ((MdUns)__LINE__)
00312 #define GT_curTime() ((UInt32)0)
00313 #define GT_create(mask, modName)
00314 #define GT_exit()
00315 #define GT_init()
00316 #define GT_set(str)
00317 #define GT_setprintf( fxn )
00318
00319 #define GT_query( mask, classId ) FALSE
00320
00321 #define GT_0trace( mask, classId, format )
00322 #define GT_1trace( mask, classId, format, arg1 )
00323 #define GT_2trace( mask, classId, format, arg1, arg2 )
00324 #define GT_3trace( mask, classId, format, arg1, arg2, arg3 )
00325 #define GT_4trace( mask, classId, format, arg1, arg2, arg3, arg4 )
00326 #define GT_5trace( mask, classId, format, arg1, arg2, arg3, arg4, arg5 )
00327 #define GT_6trace( mask, classId, format, arg1, arg2, arg3, arg4, arg5, arg6 )
00328
00331 #else
00332
00335 extern String GT_format;
00336
00337 #define GT_curLine() ((MdUns)__LINE__)
00338 #define GT_setprintf(fxn) (_ti_sdo_utils_trace_GT_params.PRINTFXN = (fxn))
00339
00340 #define GT_query(mask, classId) ((*(mask).flags & (classId)))
00341
00347 #define GT_create(mask, modName) _GT_create((mask), (modName))
00348
00352 #define GT_set(str) _GT_set(str)
00353
00357 #define GT_0trace( mask, classId, format ) \
00358 ((*(mask).flags & (classId)) ? \
00359 _GT_trace(&(mask), (classId), (format)) : 0)
00360
00364 #define GT_1trace( mask, classId, format, arg1 ) \
00365 ((*(mask).flags & (classId)) ? \
00366 _GT_trace(&(mask), (classId), (format), (arg1)) : 0)
00367
00371 #define GT_2trace( mask, classId, format, arg1, arg2 ) \
00372 ((*(mask).flags & (classId)) ? \
00373 _GT_trace(&(mask), (classId), (format), (arg1), (arg2)) : 0)
00374
00378 #define GT_3trace( mask, classId, format, arg1, arg2, arg3 ) \
00379 ((*(mask).flags & (classId)) ? \
00380 _GT_trace(&(mask), (classId), (format), (arg1), (arg2), (arg3)) : 0)
00381
00385 #define GT_4trace( mask, classId, format, arg1, arg2, arg3, arg4 ) \
00386 ((*(mask).flags & (classId)) ? \
00387 _GT_trace(&(mask), (classId), (format), (arg1), (arg2), (arg3), (arg4)) : 0)
00388
00392 #define GT_5trace( mask, classId, format, arg1, arg2, arg3, arg4, arg5 ) \
00393 ((*(mask).flags & (classId)) ? \
00394 _GT_trace(&(mask), (classId), (format), (arg1), (arg2), (arg3), (arg4), (arg5)) : 0)
00395
00399 #define GT_6trace( mask, classId, format, arg1, arg2, arg3, arg4, arg5, arg6 ) \
00400 ((*(mask).flags & (classId)) ? \
00401 _GT_trace(&(mask), (classId), (format), (arg1), (arg2), (arg3), (arg4), \
00402 (arg5), (arg6)) : 0)
00403
00404
00405
00406 #endif
00407
00409
00410 #ifdef __cplusplus
00411 }
00412 #endif
00413
00414 #endif
00415
00416
00417
00418
00419
00420
00421