]> cloudbase.mooo.com Git - z180-stamp.git/blob - include/debug.h
da8e9a060ee89437c2bfd0b1ad0d2436869d6ac8
[z180-stamp.git] / include / debug.h
1
2 #ifndef DEBUG_H_
3 #define DEBUG_H_
4
5 #include "common.h"
6
7 #ifdef DEBUG
8 #define _DEBUG 1
9 #else
10 #define _DEBUG 0
11 #endif
12
13 #define debug_cond(cond, fmt, args...) \
14 do { \
15 if (cond) \
16 printf_P(PSTR(fmt), ##args); \
17 } while (0)
18
19 #define debug(fmt, args...) \
20 debug_cond(_DEBUG, fmt, ##args)
21
22
23 #if 1
24 #ifdef DEBUG
25 #define DBG_P(lvl, format, ...) if (DEBUG>=lvl) \
26 fprintf_P( stdout, PSTR(format), ##__VA_ARGS__ )
27 #else
28 #define DBG_P(lvl, ...)
29 #endif
30 #endif /* 0 */
31
32
33 void printfreelist(const char * title);
34
35
36 #endif /* DEBUG_H_ */