summaryrefslogtreecommitdiff
path: root/include/debug.h
blob: da8e9a060ee89437c2bfd0b1ad0d2436869d6ac8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef DEBUG_H_
#define DEBUG_H_

#include "common.h"

#ifdef DEBUG
#define _DEBUG	1
#else
#define _DEBUG	0
#endif

#define debug_cond(cond, fmt, args...)		\
	do {					\
		if (cond)			\
			printf_P(PSTR(fmt), ##args);	\
	} while (0)

#define debug(fmt, args...)			\
	debug_cond(_DEBUG, fmt, ##args)


#if 1
#ifdef DEBUG
#define DBG_P(lvl, format, ...) if (DEBUG>=lvl) \
				fprintf_P( stdout, PSTR(format), ##__VA_ARGS__ )
#else
#define DBG_P(lvl, ...)
#endif
#endif /* 0 */


void printfreelist(const char * title);


#endif /* DEBUG_H_ */