]>
Commit | Line | Data |
---|---|---|
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 | ||
10 | ||
11 | #ifndef DEBUG_H_ | |
12 | #define DEBUG_H_ | |
13 | ||
14 | #include "common.h" | |
15 | ||
16 | #ifdef DEBUG | |
17 | #define _DEBUG 1 | |
18 | #else | |
19 | #define _DEBUG 0 | |
20 | #endif | |
21 | ||
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 | */ | |
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 | |
38 | #ifdef DEBUG | |
39 | #define DBG_P(lvl, format, ...) if (DEBUG>=lvl) \ | |
40 | fprintf_P( stdout, PSTR(format), ##__VA_ARGS__ ) | |
41 | #else | |
42 | #define DBG_P(lvl, ...) | |
43 | #endif | |
44 | #endif /* 0 */ | |
45 | ||
46 | ||
47 | void printfreelist(const char * title); | |
48 | ||
49 | ||
50 | #endif /* DEBUG_H_ */ |