33 #define OK_STRING "OK"
34 #define NO_STRING "NO"
35 #define YES_STRING "YES"
36 #define FAIL_STRING "FAIL"
37 #define ERROR_STRING "ERROR"
38 #define REDUNDANT_STRING "REDUNDANT"
39 #define MAIN_STRING "MAIN"
40 #define ON_STRING "ON"
41 #define OFF_STRING "OFF"
42 #define SUSPEND_STRING "x"
43 #define FLAG_STRING "*"
44 #define SPACE_STRING " "
47 #define TRACE_LEVEL_OFF 0
48 #define TRACE_LEVEL_FATAL 1
49 #define TRACE_LEVEL_ERROR 2
50 #define TRACE_LEVEL_WARNING 3
51 #define TRACE_LEVEL_INFO 4
52 #define TRACE_LEVEL_DEBUG 5
53 #define TRACE_LEVEL_VERBOSE 6
57 #define TRACE_LEVEL TRACE_LEVEL_DEBUG
64 #define TRACE_PRINTF(...) osSuspendAllTasks(), print_debug(__VA_ARGS__), osResumeAllTasks()
68 #define TRACE_ARRAY(p, a, n) osSuspendAllTasks(), print_debug_array(p, a, n), osResumeAllTasks()
72 #define TRACE_MPI(p, a) osSuspendAllTasks(), mpiDump(stdout, p, a), osResumeAllTasks()
76 #if (TRACE_LEVEL >= TRACE_LEVEL_FATAL)
77 #define TRACE_FATAL(...) TRACE_PRINTF(__VA_ARGS__)
78 #define TRACE_FATAL_ARRAY(p, a, n) TRACE_ARRAY(p, a, n)
79 #define TRACE_FATAL_MPI(p, a) TRACE_MPI(p, a)
81 #define TRACE_FATAL(...)
82 #define TRACE_FATAL_ARRAY(p, a, n)
83 #define TRACE_FATAL_MPI(p, a)
86 #if (TRACE_LEVEL >= TRACE_LEVEL_ERROR)
87 #define TRACE_ERROR(...) TRACE_PRINTF(__VA_ARGS__)
88 #define TRACE_ERROR_ARRAY(p, a, n) TRACE_ARRAY(p, a, n)
89 #define TRACE_ERROR_MPI(p, a) TRACE_MPI(p, a)
91 #define TRACE_ERROR(...)
92 #define TRACE_ERROR_ARRAY(p, a, n)
93 #define TRACE_ERROR_MPI(p, a)
96 #if (TRACE_LEVEL >= TRACE_LEVEL_WARNING)
97 #define TRACE_WARNING(...) TRACE_PRINTF(__VA_ARGS__)
98 #define TRACE_WARNING_ARRAY(p, a, n) TRACE_ARRAY(p, a, n)
99 #define TRACE_WARNING_MPI(p, a) TRACE_MPI(p, a)
101 #define TRACE_WARNING(...)
102 #define TRACE_WARNING_ARRAY(p, a, n)
103 #define TRACE_WARNING_MPI(p, a)
106 #if (TRACE_LEVEL >= TRACE_LEVEL_INFO)
107 #define TRACE_INFO(...) TRACE_PRINTF(__VA_ARGS__)
108 #define TRACE_INFO_ARRAY(p, a, n) TRACE_ARRAY(p, a, n)
109 #define TRACE_INFO_NET_BUFFER(p, b, o, n)
110 #define TRACE_INFO_MPI(p, a) TRACE_MPI(p, a)
112 #define TRACE_INFO(...)
113 #define TRACE_INFO_ARRAY(p, a, n)
114 #define TRACE_INFO_NET_BUFFER(p, b, o, n)
115 #define TRACE_INFO_MPI(p, a)
118 #if (TRACE_LEVEL >= TRACE_LEVEL_DEBUG)
119 #define TRACE_DEBUG(...) TRACE_PRINTF(__VA_ARGS__)
120 #define TRACE_DEBUG_ARRAY(p, a, n) TRACE_ARRAY(p, a, n)
121 #define TRACE_DEBUG_NET_BUFFER(p, b, o, n)
122 #define TRACE_DEBUG_MPI(p, a) TRACE_MPI(p, a)
124 #define TRACE_DEBUG(...)
125 #define TRACE_DEBUG_ARRAY(p, a, n)
126 #define TRACE_DEBUG_NET_BUFFER(p, b, o, n)
127 #define TRACE_DEBUG_MPI(p, a)
130 #if (TRACE_LEVEL >= TRACE_LEVEL_VERBOSE)
131 #define TRACE_VERBOSE(...) TRACE_PRINTF(__VA_ARGS__)
132 #define TRACE_VERBOSE_ARRAY(p, a, n) TRACE_ARRAY(p, a, n)
133 #define TRACE_VERBOSE_NET_BUFFER(p, b, o, n)
134 #define TRACE_VERBOSE_MPI(p, a) TRACE_MPI(p, a)
136 #define TRACE_VERBOSE(...)
137 #define TRACE_VERBOSE_ARRAY(p, a, n)
138 #define TRACE_VERBOSE_NET_BUFFER(p, b, o, n)
139 #define TRACE_VERBOSE_MPI(p, a)
142 #define printError(error, ok_str, error_str) (error == NO_ERROR ? ok_str : error_str)
155 #define TRACE_LEVEL_NO_TRACE TRACE_LEVEL_OFF
void print_debug_array(const char *prepend, const void *data, size_t length)
Display the contents of an array.
void init_debug(uint32_t baudrate)
init serial monitor
void print_debug(const char *fmt,...)
Print debug from ram.