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