Go to the documentation of this file. 63 #ifndef _USBLIB_TRACE_H 64 #define _USBLIB_TRACE_H 70 #include "conf_stdio.h" 77 #define USBLIB_VERSION "1.0" 79 #define TRACE_LEVEL_DEBUG 5 80 #define TRACE_LEVEL_INFO 4 81 #define TRACE_LEVEL_WARNING 3 82 #define TRACE_LEVEL_ERROR 2 83 #define TRACE_LEVEL_FATAL 1 84 #define TRACE_LEVEL_NO_TRACE 0 87 #if !defined(TRACE_LEVEL) 88 #define TRACE_LEVEL TRACE_LEVEL_INFO 92 #if !defined(DYN_TRACES) 97 #error "Error: NOTRACE has to be not defined !" 102 #if (TRACE_LEVEL == TRACE_LEVEL_NO_TRACE) 127 #define TRACE_DEBUG(...) { } 128 #define TRACE_INFO(...) { } 129 #define TRACE_WARNING(...) { } 130 #define TRACE_ERROR(...) { } 131 #define TRACE_FATAL(...) { while (1); } 133 #define TRACE_DEBUG_WP(...) { } 134 #define TRACE_INFO_WP(...) { } 135 #define TRACE_WARNING_WP(...) { } 136 #define TRACE_ERROR_WP(...) { } 137 #define TRACE_FATAL_WP(...) { while (1); } 139 #elif (DYN_TRACES == 1) 142 #define TRACE_DEBUG(...) { if (dwTraceLevel >= TRACE_LEVEL_DEBUG) { printf("-D- " __VA_ARGS__); } } 143 #define TRACE_INFO(...) { if (dwTraceLevel >= TRACE_LEVEL_INFO) { printf("-I- " __VA_ARGS__); } } 144 #define TRACE_WARNING(...) { if (dwTraceLevel >= TRACE_LEVEL_WARNING) { printf("-W- " __VA_ARGS__); } } 145 #define TRACE_ERROR(...) { if (dwTraceLevel >= TRACE_LEVEL_ERROR) { printf("-E- " __VA_ARGS__); } } 146 #define TRACE_FATAL(...) { if (dwTraceLevel >= TRACE_LEVEL_FATAL) { printf("-F- " __VA_ARGS__); while (1); } } 148 #define TRACE_DEBUG_WP(...) { if (dwTraceLevel >= TRACE_LEVEL_DEBUG) { printf(__VA_ARGS__); } } 149 #define TRACE_INFO_WP(...) { if (dwTraceLevel >= TRACE_LEVEL_INFO) { printf(__VA_ARGS__); } } 150 #define TRACE_WARNING_WP(...) { if (dwTraceLevel >= TRACE_LEVEL_WARNING) { printf(__VA_ARGS__); } } 151 #define TRACE_ERROR_WP(...) { if (dwTraceLevel >= TRACE_LEVEL_ERROR) { printf(__VA_ARGS__); } } 152 #define TRACE_FATAL_WP(...) { if (dwTraceLevel >= TRACE_LEVEL_FATAL) { printf(__VA_ARGS__); while (1); } } 157 #if (TRACE_LEVEL >= TRACE_LEVEL_DEBUG) 158 #define TRACE_DEBUG(...) { printf("-D- " __VA_ARGS__); } 159 #define TRACE_DEBUG_WP(...) { printf(__VA_ARGS__); } 161 #define TRACE_DEBUG(...) { } 162 #define TRACE_DEBUG_WP(...) { } 165 #if (TRACE_LEVEL >= TRACE_LEVEL_INFO) 166 #define TRACE_INFO(...) { printf("-I- " __VA_ARGS__); } 167 #define TRACE_INFO_WP(...) { printf(__VA_ARGS__); } 169 #define TRACE_INFO(...) { } 170 #define TRACE_INFO_WP(...) { } 173 #if (TRACE_LEVEL >= TRACE_LEVEL_WARNING) 174 #define TRACE_WARNING(...) { printf("-W- " __VA_ARGS__); } 175 #define TRACE_WARNING_WP(...) { printf(__VA_ARGS__); } 177 #define TRACE_WARNING(...) { } 178 #define TRACE_WARNING_WP(...) { } 181 #if (TRACE_LEVEL >= TRACE_LEVEL_ERROR) 182 #define TRACE_ERROR(...) { printf("-E- " __VA_ARGS__); } 183 #define TRACE_ERROR_WP(...) { printf(__VA_ARGS__); } 185 #define TRACE_ERROR(...) { } 186 #define TRACE_ERROR_WP(...) { } 189 #if (TRACE_LEVEL >= TRACE_LEVEL_FATAL) 190 #define TRACE_FATAL(...) { printf("-F- " __VA_ARGS__); while (1); } 191 #define TRACE_FATAL_WP(...) { printf(__VA_ARGS__); while (1); } 193 #define TRACE_FATAL(...) { while (1); } 194 #define TRACE_FATAL_WP(...) { while (1); } 204 #if !defined(NOTRACE) && (DYN_TRACES == 1) 205 extern uint32_t dwTraceLevel;