aboutsummaryrefslogtreecommitdiffstats
path: root/os/various/dbgtrace.h
diff options
context:
space:
mode:
authorwalkerstop <walkerstop@gmail.com>2018-05-01 01:00:33 -0700
committerGitHub <noreply@github.com>2018-05-01 01:00:33 -0700
commit40db44f540436398e0840544044154d13eee63b6 (patch)
treedad3f1f3b6ac3927484ee22002a947662a8a0173 /os/various/dbgtrace.h
parent4e9f077fb10255dced1da4d5d2ad9f8ae41442a2 (diff)
parentd4d384557df0e8e7a8071553448b0c42849f98c0 (diff)
downloadChibiOS-Contrib-40db44f540436398e0840544044154d13eee63b6.tar.gz
ChibiOS-Contrib-40db44f540436398e0840544044154d13eee63b6.tar.bz2
ChibiOS-Contrib-40db44f540436398e0840544044154d13eee63b6.zip
Merge branch 'master' into master
Diffstat (limited to 'os/various/dbgtrace.h')
-rw-r--r--os/various/dbgtrace.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/os/various/dbgtrace.h b/os/various/dbgtrace.h
new file mode 100644
index 0000000..b1fc297
--- /dev/null
+++ b/os/various/dbgtrace.h
@@ -0,0 +1,41 @@
+#ifndef DBGTRACE_H_
+#define DBGTRACE_H_
+
+#include "chprintf.h"
+
+#if !defined(DEBUG_TRACE_PRINT)
+#define DEBUG_TRACE_PRINT FALSE
+#endif
+
+#if !defined(DEBUG_TRACE_WARNING)
+#define DEBUG_TRACE_WARNING FALSE
+#endif
+
+#if !defined(DEBUG_TRACE_ERROR)
+#define DEBUG_TRACE_ERROR FALSE
+#endif
+
+/* user must provide correctly initialized pointer to print channel */
+#if DEBUG_TRACE_PRINT || DEBUG_TRACE_WARNING || DEBUG_TRACE_ERROR
+extern BaseSequentialStream *GlobalDebugChannel;
+#endif
+
+#if DEBUG_TRACE_PRINT
+#define dbgprintf(fmt, ...) chprintf(GlobalDebugChannel, fmt, ##__VA_ARGS__)
+#else
+#define dbgprintf(fmt, ...) do {} while(0)
+#endif
+
+#if DEBUG_TRACE_WARNING
+#define warnprintf(fmt, ...) chprintf(GlobalDebugChannel, fmt, ##__VA_ARGS__)
+#else
+#define warnprintf(fmt, ...) do {} while(0)
+#endif
+
+#if DEBUG_TRACE_ERROR
+#define errprintf(fmt, ...) chprintf(GlobalDebugChannel, fmt, ##__VA_ARGS__)
+#else
+#define errprintf(fmt, ...) do {} while(0)
+#endif
+
+#endif /* DBGTRACE_H_ */