]> cloudbase.mooo.com Git - z180-stamp.git/blob - include/debug.h
45a1d504e0499d280917327687c9b88b3c1d8e32
[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 dump_eep(const uint8_t *addr, unsigned int len, char *title);
34 void dump_ram(const uint8_t *addr, unsigned int len, char *title);
35 void printfreelist(const char * title);
36
37
38 #endif /* DEBUG_H_ */
39