00001
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
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055 #ifndef OSALTRACE_H_0xDA50
00056 #define OSALTRACE_H_0xDA50
00057
00058
00059 #include <ti/syslink/utils/OsalPrint.h>
00060
00061 #if defined (__cplusplus)
00062 extern "C" {
00063 #endif
00064
00065
00070 #define OSALTRACE_MODULEID (UInt16) 0xDA50
00071
00072
00077 #define GT_TRACESTATE_MASK 0x0000000F
00078
00083 #define GT_TRACESTATE_SHIFT 0u
00084
00089 #define GT_TRACEENTER_MASK 0x000000F0
00090
00095 #define GT_TRACEENTER_SHIFT 4u
00096
00101 #define GT_TRACESETFAILURE_MASK 0x00000F00
00102
00107 #define GT_TRACESETFAILURE_SHIFT 8u
00108
00113 #define GT_TRACECLASS_MASK 0x000F0000
00114
00119 #define GT_TRACECLASS_SHIFT 16u
00120
00124 typedef enum {
00125 GT_TraceState_Disable = 0x00000000,
00127 GT_TraceState_Enable = 0x00000001,
00129 GT_TraceState_EndValue = 0x00000002
00131 } GT_TraceState;
00132
00136 typedef enum {
00137 GT_TraceEnter_Disable = 0x00000000,
00139 GT_TraceEnter_Enable = 0x00000010,
00141 GT_TraceEnter_EndValue = 0x00000020
00143 } GT_TraceEnter;
00144
00148 typedef enum {
00149 GT_TraceSetFailure_Disable = 0x00000000,
00151 GT_TraceSetFailure_Enable = 0x00000100,
00153 GT_TraceSetFailure_EndValue = 0x00000200
00155 } GT_TraceSetFailure;
00156
00160 typedef enum {
00161 GT_1CLASS = 0x00010000,
00163 GT_2CLASS = 0x00020000,
00165 GT_3CLASS = 0x00030000,
00167 GT_4CLASS = 0x00040000,
00169 GT_ENTER = 0x00050000,
00171 GT_LEAVE = 0x00060000
00173 } GT_TraceClass;
00174
00178 typedef enum {
00179 GT_TraceType_User = 0x00000000,
00181 GT_TraceType_Kernel = 0x00000001,
00183 GT_TraceType_EndValue = 0x00000003
00185 } GT_TraceType;
00186
00187
00188 #if defined(SYSLINK_BUILD_DEBUG)
00189 #if defined(SYSLINK_BUILD_HLOS)
00190 #define GT_assert(x, y) \
00191 do { \
00192 if (!(y)) { \
00193 Osal_printf ("Assertion at Line no: %d in %s: %s : failed\n", \
00194 __LINE__, __FILE__, #y); \
00195 } \
00196 } while (0);
00197 #endif
00198
00199 #if defined(SYSLINK_BUILD_RTOS)
00200 #define GT_assert(x, y) \
00201 do { \
00202 if (!(y)) { \
00203 Osal_printf ("Assertion at Line no: %d in %s: %s : failed\n", \
00204 __LINE__, __FILE__, #y); \
00205 volatile int a =1; \
00206 while(a); \
00207 } \
00208 } while (0);
00209 #endif
00210 #endif
00211
00212
00213 #if !defined(GT_assert)
00214 #define GT_assert(x, y)
00215 #endif
00216
00217
00218 #if defined (SYSLINK_TRACE_ENABLE)
00219
00220 extern Int curTrace;
00221
00222 UInt32 _GT_setTrace (UInt32 mask, GT_TraceType type);
00223 #define GT_setTrace(mask,type) _GT_setTrace(mask, type)
00224
00225
00226 Void _GT_setFailureReason (Int enableMask,
00227 Char * func,
00228 Char * fileName,
00229 UInt32 lineNo,
00230 Int32 status,
00231 Char * msg);
00232 #define GT_setFailureReason(mask, classId, func, status, msg) \
00233 _GT_setFailureReason(mask, func, \
00234 __FILE__, __LINE__, status, (Char*) (msg"\n"))
00235
00236
00237
00238 Void _GT_0trace (UInt32 maskType, GT_TraceClass classtype, Char* infoString);
00239 #define GT_0trace(mask, classId, format) \
00240 do { \
00241 if (classId == GT_ENTER) { \
00242 _GT_0trace(mask, classId, \
00243 "Entered "format"\n"); \
00244 } \
00245 else if (classId == GT_LEAVE) { \
00246 _GT_0trace(mask, classId, \
00247 "Leaving "format"\n"); \
00248 } \
00249 else { \
00250 _GT_0trace(mask, classId, \
00251 format"\n"); \
00252 } \
00253 } while (0)
00254
00255
00256
00257 Void _GT_1trace (UInt32 maskType,
00258 GT_TraceClass classtype,
00259 Char * infoString,
00260 UInt32 param);
00261 #define GT_1trace(mask, classId, format, a) \
00262 do { \
00263 if (classId == GT_ENTER) { \
00264 _GT_1trace(mask, classId, \
00265 "Entered "format"\n\t"#a"\t[0x%x]\n", \
00266 (UInt32) (a)); \
00267 } \
00268 else if (classId == GT_LEAVE) { \
00269 _GT_1trace(mask, classId, \
00270 "Leaving "format"\n\t"#a"\t[0x%x]\n", \
00271 (UInt32) (a)); \
00272 } \
00273 else { \
00274 _GT_1trace(mask, classId, \
00275 format"\n", \
00276 (UInt32) (a)); \
00277 } \
00278 } while (0)
00279
00280
00281
00282 Void _GT_2trace (UInt32 maskType,
00283 GT_TraceClass classtype,
00284 Char * infoString,
00285 UInt32 param0,
00286 UInt32 param1);
00287 #define GT_2trace(mask, classId, format, a, b) \
00288 do { \
00289 if (classId == GT_ENTER) { \
00290 _GT_2trace(mask, classId, \
00291 "Entered "format"\n\t"#a"\t[0x%x]\n" \
00292 "\t"#b"\t[0x%x]\n", \
00293 (UInt32) (a), \
00294 (UInt32) (b)); \
00295 } \
00296 else if (classId == GT_LEAVE) { \
00297 _GT_2trace(mask, classId, \
00298 "Leaving "format"\n\t"#a"\t[0x%x]\n" \
00299 "\t"#b"\t[0x%x]\n", \
00300 (UInt32) (a), \
00301 (UInt32) (b)); \
00302 } \
00303 else { \
00304 _GT_2trace(mask, classId, \
00305 format"\n", \
00306 (UInt32) (a), \
00307 (UInt32) (b)); \
00308 } \
00309 } while (0)
00310
00311
00312
00313 Void _GT_3trace (UInt32 maskType,
00314 GT_TraceClass classtype,
00315 Char* infoString,
00316 UInt32 param0,
00317 UInt32 param1,
00318 UInt32 param2);
00319 #define GT_3trace(mask, classId, format, a, b, c) \
00320 do { \
00321 if (classId == GT_ENTER) { \
00322 _GT_3trace(mask, classId, \
00323 "Entered "format"\n\t"#a"\t[0x%x]\n" \
00324 "\t"#b"\t[0x%x]\n" \
00325 "\t"#c"\t[0x%x]\n", \
00326 (UInt32) (a), \
00327 (UInt32) (b), \
00328 (UInt32) (c)); \
00329 } \
00330 else if (classId == GT_LEAVE) { \
00331 _GT_3trace(mask, classId, \
00332 "Leaving "format"\n\t"#a"\t[0x%x]\n" \
00333 "\t"#b"\t[0x%x]\n" \
00334 "\t"#c"\t[0x%x]\n", \
00335 (UInt32) (a), \
00336 (UInt32) (b), \
00337 (UInt32) (c)); \
00338 } \
00339 else { \
00340 _GT_3trace(mask, classId, \
00341 format"\n", \
00342 (UInt32) (a), \
00343 (UInt32) (b), \
00344 (UInt32) (c)); \
00345 } \
00346 } while (0)
00347
00348
00349
00350 Void _GT_4trace (UInt32 maskType,
00351 GT_TraceClass classtype,
00352 Char* infoString,
00353 UInt32 param0,
00354 UInt32 param1,
00355 UInt32 param2,
00356 UInt32 param3);
00357 #define GT_4trace(mask, classId, format, a, b, c, d) \
00358 do { \
00359 if (classId == GT_ENTER) { \
00360 _GT_4trace(mask, classId, \
00361 "Entered "format"\n\t"#a"\t[0x%x]\n" \
00362 "\t"#b"\t[0x%x]\n" \
00363 "\t"#c"\t[0x%x]\n" \
00364 "\t"#d"\t[0x%x]\n", \
00365 (UInt32) (a), \
00366 (UInt32) (b), \
00367 (UInt32) (c), \
00368 (UInt32) (d)); \
00369 } \
00370 else if (classId == GT_LEAVE) { \
00371 _GT_4trace(mask, classId, \
00372 "Leaving "format"\n\t"#a"\t[0x%x]\n" \
00373 "\t"#b"\t[0x%x]\n" \
00374 "\t"#c"\t[0x%x]\n" \
00375 "\t"#d"\t[0x%x]\n", \
00376 (UInt32) (a), \
00377 (UInt32) (b), \
00378 (UInt32) (c), \
00379 (UInt32) (d)); \
00380 } \
00381 else { \
00382 _GT_4trace(mask, classId, \
00383 format"\n", \
00384 (UInt32) (a), \
00385 (UInt32) (b), \
00386 (UInt32) (c), \
00387 (UInt32) (d)); \
00388 } \
00389 } while (0)
00390
00391
00392
00393 Void _GT_5trace (UInt32 maskType,
00394 GT_TraceClass classtype,
00395 Char* infoString,
00396 UInt32 param0,
00397 UInt32 param1,
00398 UInt32 param2,
00399 UInt32 param3,
00400 UInt32 param4);
00401 #define GT_5trace(mask, classId, format, a, b, c, d, e) \
00402 do { \
00403 if (classId == GT_ENTER) { \
00404 _GT_5trace(mask, classId, \
00405 "Entered "format"\n\t"#a"\t[0x%x]\n" \
00406 "\t"#b"\t[0x%x]\n" \
00407 "\t"#c"\t[0x%x]\n" \
00408 "\t"#d"\t[0x%x]\n" \
00409 "\t"#e"\t[0x%x]\n", \
00410 (UInt32) (a), \
00411 (UInt32) (b), \
00412 (UInt32) (c), \
00413 (UInt32) (d), \
00414 (UInt32) (e)); \
00415 } \
00416 else if (classId == GT_LEAVE) { \
00417 _GT_5trace(mask, classId, \
00418 "Leaving "format"\n\t"#a"\t[0x%x]\n" \
00419 "\t"#b"\t[0x%x]\n" \
00420 "\t"#c"\t[0x%x]\n" \
00421 "\t"#d"\t[0x%x]\n" \
00422 "\t"#e"\t[0x%x]\n", \
00423 (UInt32) (a), \
00424 (UInt32) (b), \
00425 (UInt32) (c), \
00426 (UInt32) (d), \
00427 (UInt32) (e)); \
00428 } \
00429 else { \
00430 _GT_5trace(mask, classId, \
00431 format"\n", \
00432 (UInt32) (a), \
00433 (UInt32) (b), \
00434 (UInt32) (c), \
00435 (UInt32) (d), \
00436 (UInt32) (e)); \
00437 } \
00438 } while (0)
00439
00440 #else
00441
00442 #define GT_setFailureReason(mask, classId, func, status, msg)
00443 #define GT_0trace(mask, classId, format)
00444 #define GT_1trace(mask, classId, format, arg1)
00445 #define GT_2trace(mask, classId, format, arg1, arg2)
00446 #define GT_3trace(mask, classId, format, arg1, arg2, arg3)
00447 #define GT_4trace(mask, classId, format, arg1, arg2, arg3, arg4)
00448 #define GT_5trace(mask, classId, format, arg1, arg2, arg3, arg4, arg5)
00449 #define GT_setTrace(mask, type) 0
00450
00451 #endif
00452
00453
00454 #if defined (__cplusplus)
00455 }
00456 #endif
00457
00458 #endif