diff options
Diffstat (limited to 'lib/chibios-contrib/os/various/dbgtrace.h')
-rw-r--r-- | lib/chibios-contrib/os/various/dbgtrace.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/lib/chibios-contrib/os/various/dbgtrace.h b/lib/chibios-contrib/os/various/dbgtrace.h new file mode 100644 index 000000000..b1fc2979e --- /dev/null +++ b/lib/chibios-contrib/os/various/dbgtrace.h | |||
@@ -0,0 +1,41 @@ | |||
1 | #ifndef DBGTRACE_H_ | ||
2 | #define DBGTRACE_H_ | ||
3 | |||
4 | #include "chprintf.h" | ||
5 | |||
6 | #if !defined(DEBUG_TRACE_PRINT) | ||
7 | #define DEBUG_TRACE_PRINT FALSE | ||
8 | #endif | ||
9 | |||
10 | #if !defined(DEBUG_TRACE_WARNING) | ||
11 | #define DEBUG_TRACE_WARNING FALSE | ||
12 | #endif | ||
13 | |||
14 | #if !defined(DEBUG_TRACE_ERROR) | ||
15 | #define DEBUG_TRACE_ERROR FALSE | ||
16 | #endif | ||
17 | |||
18 | /* user must provide correctly initialized pointer to print channel */ | ||
19 | #if DEBUG_TRACE_PRINT || DEBUG_TRACE_WARNING || DEBUG_TRACE_ERROR | ||
20 | extern BaseSequentialStream *GlobalDebugChannel; | ||
21 | #endif | ||
22 | |||
23 | #if DEBUG_TRACE_PRINT | ||
24 | #define dbgprintf(fmt, ...) chprintf(GlobalDebugChannel, fmt, ##__VA_ARGS__) | ||
25 | #else | ||
26 | #define dbgprintf(fmt, ...) do {} while(0) | ||
27 | #endif | ||
28 | |||
29 | #if DEBUG_TRACE_WARNING | ||
30 | #define warnprintf(fmt, ...) chprintf(GlobalDebugChannel, fmt, ##__VA_ARGS__) | ||
31 | #else | ||
32 | #define warnprintf(fmt, ...) do {} while(0) | ||
33 | #endif | ||
34 | |||
35 | #if DEBUG_TRACE_ERROR | ||
36 | #define errprintf(fmt, ...) chprintf(GlobalDebugChannel, fmt, ##__VA_ARGS__) | ||
37 | #else | ||
38 | #define errprintf(fmt, ...) do {} while(0) | ||
39 | #endif | ||
40 | |||
41 | #endif /* DBGTRACE_H_ */ | ||