 |
mTower
|
34 #include <trace_levels.h> 36 #define MAX_PRINT_SIZE 256 37 #define MAX_FUNC_PRINT_SIZE 32 40 #define TRACE_LEVEL TRACE_MAX 46 extern int trace_level;
47 extern const char trace_ext_prefix[];
48 void trace_ext_puts(
const char *str);
49 int trace_ext_get_thread_id(
void);
50 void trace_set_level(
int level);
51 int trace_get_level(
void);
57 #define trace_printf_helper(level, level_ok, ...) \ 58 trace_printf(__FUNCTION__, __LINE__, (level), (level_ok), \ 62 #if (TRACE_LEVEL <= 0) 63 #define MSG(...) (void)0 65 #define MSG(...) trace_printf_helper(0, false, __VA_ARGS__) 69 #if (TRACE_LEVEL < TRACE_ERROR) 70 #define EMSG(...) (void)0 72 #define EMSG(...) trace_printf_helper(TRACE_ERROR, true, __VA_ARGS__) 76 #if (TRACE_LEVEL < TRACE_INFO) 77 #define IMSG(...) (void)0 79 #define IMSG(...) trace_printf_helper(TRACE_INFO, true, __VA_ARGS__) 83 #if (TRACE_LEVEL < TRACE_DEBUG) 84 #define DMSG(...) (void)0 86 #define DMSG(...) trace_printf_helper(TRACE_DEBUG, true, __VA_ARGS__) 90 #if (TRACE_LEVEL < TRACE_FLOW) 91 #define FMSG(...) (void)0 93 #define FMSG(...) trace_printf_helper(TRACE_FLOW, true, __VA_ARGS__) 97 #define INMSG(...) FMSG("> " __VA_ARGS__) 99 #define OUTMSG(...) FMSG("< " __VA_ARGS__) 104 OUTMSG("r=[%x]", r); \ 108 void dhex_dump(
const char *
function,
int line,
int level,
109 const void *buf,
int len);
110 #if (TRACE_LEVEL < TRACE_DEBUG) 111 #define DHEXDUMP(buf, len) (void)0 113 #define DHEXDUMP(buf, len) dhex_dump(__func__, __LINE__, TRACE_DEBUG, \ 120 #define trace_printf_helper_raw(level, level_ok, ...) \ 121 trace_printf(NULL, 0, (level), (level_ok), __VA_ARGS__) 124 #if (TRACE_LEVEL <= 0) 125 #define MSG_RAW(...) (void)0 127 #define MSG_RAW(...) trace_printf_helper_raw(0, false, __VA_ARGS__) 131 #if (TRACE_LEVEL < TRACE_ERROR) 132 #define EMSG_RAW(...) (void)0 134 #define EMSG_RAW(...) trace_printf_helper_raw(TRACE_ERROR, true, __VA_ARGS__) 138 #if (TRACE_LEVEL < TRACE_INFO) 139 #define IMSG_RAW(...) (void)0 141 #define IMSG_RAW(...) trace_printf_helper_raw(TRACE_INFO, true, __VA_ARGS__) 145 #if (TRACE_LEVEL < TRACE_DEBUG) 146 #define DMSG_RAW(...) (void)0 148 #define DMSG_RAW(...) trace_printf_helper_raw(TRACE_DEBUG, true, __VA_ARGS__) 152 #if (TRACE_LEVEL < TRACE_FLOW) 153 #define FMSG_RAW(...) (void)0 155 #define FMSG_RAW(...) trace_printf_helper_raw(TRACE_FLOW, true, __VA_ARGS__) 158 #if (TRACE_LEVEL <= 0) 159 #define SMSG(...) (void)0 167 trace_printf(__func__, __LINE__, TRACE_ERROR, true, __VA_ARGS__) 171 #if defined(__KERNEL__) && defined(CFG_UNWIND) 172 #include <kernel/unwind.h> 176 #if defined(_PRINT_STACK) && (TRACE_LEVEL >= TRACE_ERROR) 177 #define EPRINT_STACK() print_kernel_stack(TRACE_ERROR) 179 #define EPRINT_STACK() (void)0 182 #if defined(_PRINT_STACK) && (TRACE_LEVEL >= TRACE_INFO) 183 #define IPRINT_STACK() print_kernel_stack(TRACE_INFO) 185 #define IPRINT_STACK() (void)0 188 #if defined(_PRINT_STACK) && (TRACE_LEVEL >= TRACE_DEBUG) 189 #define DPRINT_STACK() print_kernel_stack(TRACE_DEBUG) 191 #define DPRINT_STACK() (void)0 194 #if defined(_PRINT_STACK) && (TRACE_LEVEL >= TRACE_FLOW) 195 #define FPRINT_STACK() print_kernel_stack(TRACE_FLOW) 197 #define FPRINT_STACK() (void)0 200 #if defined(__KERNEL__) && defined(CFG_UNWIND)