35#ifndef DOXYGEN_SHOULD_SKIP_THIS
36#define MAX_PRINT_SIZE 256
37#define MAX_FUNC_PRINT_SIZE 32
40#define TRACE_LEVEL TRACE_MAX
55void trace_printf(
const char *func,
int line,
int level,
bool level_ok,
56 const char *fmt, ...) __printf(5, 6);
58#ifndef DOXYGEN_SHOULD_SKIP_THIS
59#define trace_printf_helper(level, level_ok, ...) \
60 trace_printf(__func__, __LINE__, (level), (level_ok), \
65#define MSG(...) (void)0
67#define MSG(...) trace_printf_helper(0, false, __VA_ARGS__)
71#if (TRACE_LEVEL < TRACE_ERROR)
72#define EMSG(...) (void)0
74#define EMSG(...) trace_printf_helper(TRACE_ERROR, true, __VA_ARGS__)
78#if (TRACE_LEVEL < TRACE_INFO)
79#define IMSG(...) (void)0
81#define IMSG(...) trace_printf_helper(TRACE_INFO, true, __VA_ARGS__)
85#if (TRACE_LEVEL < TRACE_DEBUG)
86#define DMSG(...) (void)0
88#define DMSG(...) trace_printf_helper(TRACE_DEBUG, true, __VA_ARGS__)
92#if (TRACE_LEVEL < TRACE_FLOW)
93#define FMSG(...) (void)0
95#define FMSG(...) trace_printf_helper(TRACE_FLOW, true, __VA_ARGS__)
99#define INMSG(...) FMSG("> " __VA_ARGS__)
101#define OUTMSG(...) FMSG("< " __VA_ARGS__)
106 OUTMSG("r=[%x]", r); \
112void dhex_dump(
const char *function,
int line,
int level,
113 const void *buf,
int len);
116#ifndef DOXYGEN_SHOULD_SKIP_THIS
117#if (TRACE_LEVEL < TRACE_DEBUG)
118#define DHEXDUMP(buf, len) (void)0
120#define DHEXDUMP(buf, len) dhex_dump(__func__, __LINE__, TRACE_DEBUG, \
127#define trace_printf_helper_raw(level, level_ok, ...) \
128 trace_printf(NULL, 0, (level), (level_ok), __VA_ARGS__)
131#if (TRACE_LEVEL <= 0)
132#define MSG_RAW(...) (void)0
134#define MSG_RAW(...) trace_printf_helper_raw(0, false, __VA_ARGS__)
138#if (TRACE_LEVEL < TRACE_ERROR)
139#define EMSG_RAW(...) (void)0
141#define EMSG_RAW(...) trace_printf_helper_raw(TRACE_ERROR, true, __VA_ARGS__)
145#if (TRACE_LEVEL < TRACE_INFO)
146#define IMSG_RAW(...) (void)0
148#define IMSG_RAW(...) trace_printf_helper_raw(TRACE_INFO, true, __VA_ARGS__)
152#if (TRACE_LEVEL < TRACE_DEBUG)
153#define DMSG_RAW(...) (void)0
155#define DMSG_RAW(...) trace_printf_helper_raw(TRACE_DEBUG, true, __VA_ARGS__)
159#if (TRACE_LEVEL < TRACE_FLOW)
160#define FMSG_RAW(...) (void)0
162#define FMSG_RAW(...) trace_printf_helper_raw(TRACE_FLOW, true, __VA_ARGS__)
165#if (TRACE_LEVEL <= 0)
166#define SMSG(...) (void)0
174 trace_printf(__func__, __LINE__, TRACE_ERROR, true, __VA_ARGS__)
178#if defined(__KERNEL__) && defined(CFG_UNWIND)
179#include <kernel/unwind.h>
183#if defined(_PRINT_STACK) && (TRACE_LEVEL >= TRACE_ERROR)
184#define EPRINT_STACK() print_kernel_stack(TRACE_ERROR)
186#define EPRINT_STACK() (void)0
189#if defined(_PRINT_STACK) && (TRACE_LEVEL >= TRACE_INFO)
190#define IPRINT_STACK() print_kernel_stack(TRACE_INFO)
192#define IPRINT_STACK() (void)0
195#if defined(_PRINT_STACK) && (TRACE_LEVEL >= TRACE_DEBUG)
196#define DPRINT_STACK() print_kernel_stack(TRACE_DEBUG)
198#define DPRINT_STACK() (void)0
201#if defined(_PRINT_STACK) && (TRACE_LEVEL >= TRACE_FLOW)
202#define FPRINT_STACK() print_kernel_stack(TRACE_FLOW)
204#define FPRINT_STACK() (void)0
207#if defined(__KERNEL__) && defined(CFG_UNWIND)
void trace_set_level(int level)
int trace_get_level(void)
const char trace_ext_prefix[]
void void dhex_dump(const char *function, int line, int level, const void *buf, int len)
int trace_ext_get_thread_id(void)
void trace_printf(const char *func, int line, int level, bool level_ok, const char *fmt,...) __printf(5
void trace_ext_puts(const char *str)