]>
Commit | Line | Data |
---|---|---|
35edb766 L |
1 | /* |
2 | * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de> | |
3 | * | |
4 | * (C) Copyright 2000-2009 | |
5 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. | |
6 | * | |
7 | * SPDX-License-Identifier: GPL-2.0+ | |
8 | */ | |
9 | ||
0c5890bb L |
10 | |
11 | #ifndef DEBUG_H_ | |
12 | #define DEBUG_H_ | |
13 | ||
d684c216 | 14 | #include "common.h" |
e7895944 | 15 | |
d684c216 L |
16 | #ifdef DEBUG |
17 | #define _DEBUG 1 | |
18 | #else | |
19 | #define _DEBUG 0 | |
20 | #endif | |
21 | ||
35edb766 L |
22 | /* |
23 | * Output a debug text when condition "cond" is met. The "cond" should be | |
24 | * computed by a preprocessor in the best case, allowing for the best | |
25 | * optimization. | |
26 | */ | |
d684c216 L |
27 | #define debug_cond(cond, fmt, args...) \ |
28 | do { \ | |
29 | if (cond) \ | |
30 | printf_P(PSTR(fmt), ##args); \ | |
31 | } while (0) | |
32 | ||
33 | #define debug(fmt, args...) \ | |
34 | debug_cond(_DEBUG, fmt, ##args) | |
35 | ||
36 | ||
37 | #if 1 | |
0c5890bb | 38 | #ifdef DEBUG |
e7895944 | 39 | #define DBG_P(lvl, format, ...) if (DEBUG>=lvl) \ |
9b6b4b31 | 40 | fprintf_P( stdout, PSTR(format), ##__VA_ARGS__ ) |
0c5890bb L |
41 | #else |
42 | #define DBG_P(lvl, ...) | |
43 | #endif | |
d684c216 | 44 | #endif /* 0 */ |
0c5890bb | 45 | |
69988dc1 L |
46 | |
47 | void printfreelist(const char * title); | |
48 | ||
49 | ||
0c5890bb | 50 | #endif /* DEBUG_H_ */ |