Go to the documentation of this file.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
00034 #ifndef _TOMP_LOG_H_
00035 #define _TOMP_LOG_H_
00036
00038 #define tomp_LOG_WITH_PRINTF (1)
00039
00040 #if tomp_LOG_WITH_PRINTF
00041 #include <stdio.h>
00042 #endif
00043
00044 #include <stdlib.h>
00045
00046 extern void tomp_sendExitEvents(void);
00047
00049 typedef enum { tomp_ErrorKind_EM_ALLOC = 0,
00050 tomp_ErrorKind_EM_ALLOC_SIZE,
00051 tomp_ErrorKind_NULL_PTR,
00052 tomp_ErrorKind_OEM_INIT,
00053 tomp_ErrorKind_OMP_INIT,
00054 tomp_ErrorKind_QMSS
00055 } tomp_ErrorKind_e;
00056
00058 extern const char *tomp_ErrorString[];
00059
00060 #define GLOBAL_TIMESTAMP_ADRS (0x023101F0)
00061
00062 static inline unsigned long long getGlobalTimeStamp()
00063 {
00064 return _itoll( *(unsigned int *)(4+GLOBAL_TIMESTAMP_ADRS),
00065 *(unsigned int *)(GLOBAL_TIMESTAMP_ADRS));
00066 }
00067
00068
00073 static inline void tomp_logError(tomp_ErrorKind_e e,
00074 const char *file,
00075 int line)
00076 {
00077 #if tomp_LOG_WITH_PRINTF
00078 printf("INTERNAL ERROR: %s - %s, %d\n", tomp_ErrorString[e], file, line);
00079 #endif
00080 tomp_sendExitEvents();
00081 exit(1);
00082 }
00083
00088 static inline void tomp_logErrorStr(tomp_ErrorKind_e e,
00089 const char *str,
00090 const char *file,
00091 int line)
00092 {
00093 #if tomp_LOG_WITH_PRINTF
00094 printf("INTERNAL ERROR: %s (%s) - %s, %d\n", tomp_ErrorString[e],
00095 str, file, line);
00096 #endif
00097 tomp_sendExitEvents();
00098 exit(1);
00099 }
00100
00104 static inline void tomp_logDebug1(const char *fmt, int arg1)
00105 {
00106 #if defined (TOMP_TRACE_LEVEL) && (TOMP_TRACE_LEVEL > 0)
00107 #if tomp_LOG_WITH_PRINTF
00108 printf("(%016llu) ", getGlobalTimeStamp());
00109 printf(fmt, arg1);
00110 #endif
00111 #endif
00112 }
00113
00117 static inline void tomp_logDebug2(const char *fmt, int arg1, int arg2)
00118 {
00119 #if defined (TOMP_TRACE_LEVEL) && (TOMP_TRACE_LEVEL > 0)
00120 #if tomp_LOG_WITH_PRINTF
00121 printf("(%016llu) ", getGlobalTimeStamp());
00122 printf(fmt, arg1, arg2);
00123 #endif
00124 #endif
00125 }
00126
00130 static inline void tomp_logDebug3(const char *fmt, int arg1, int arg2, int arg3)
00131 {
00132 #if defined (TOMP_TRACE_LEVEL) && (TOMP_TRACE_LEVEL > 0)
00133 #if tomp_LOG_WITH_PRINTF
00134 printf("(%016llu) ", getGlobalTimeStamp());
00135 printf(fmt, arg1, arg2, arg3);
00136 #endif
00137 #endif
00138 }
00139
00140
00141
00142
00143
00144
00145 #ifdef TASK_STATS
00146
00147 typedef struct {
00148 unsigned short id;
00149 unsigned short parent_id;
00150 unsigned long long gen_cycle;
00151 unsigned int start_cycle_delta;
00152 unsigned int end_cycle_delta;
00153 unsigned char gen_core;
00154 unsigned char exec_core;
00155 } TaskStats;
00156
00157 extern TaskStats tomp_TaskStats[];
00158 #endif
00159
00160
00161 #endif
00162
00163