]>
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 | * | |
8ed66016 | 7 | * SPDX-License-Identifier: GPL-2.0 |
35edb766 L |
8 | */ |
9 | ||
0c5890bb L |
10 | |
11 | #ifndef DEBUG_H_ | |
12 | #define DEBUG_H_ | |
13 | ||
7eecbdac L |
14 | #include "command.h" |
15 | ||
16 | command_ret_t do_dump_mem(cmd_tbl_t *, uint_fast8_t, int, char * const []); | |
17 | command_ret_t do_mem_mm_avr(cmd_tbl_t *, uint_fast8_t, int, char * const []); | |
18 | command_ret_t do_mem_nm_avr(cmd_tbl_t *, uint_fast8_t, int, char * const []); | |
19 | command_ret_t do_eep_cp(cmd_tbl_t *, uint_fast8_t, int, char * const []); | |
20 | command_ret_t do_pr_free_avr(cmd_tbl_t *, uint_fast8_t, int, char * const []); | |
b9aef06e | 21 | command_ret_t do_pr_heap_avr(cmd_tbl_t *, uint_fast8_t, int, char * const []); |
7eecbdac L |
22 | |
23 | void printfreelist(const char * title); | |
7439a2b5 | 24 | void dump_heap(void); |
7eecbdac | 25 | |
e7895944 | 26 | |
d684c216 L |
27 | #ifdef DEBUG |
28 | #define _DEBUG 1 | |
29 | #else | |
30 | #define _DEBUG 0 | |
31 | #endif | |
32 | ||
35edb766 L |
33 | /* |
34 | * Output a debug text when condition "cond" is met. The "cond" should be | |
35 | * computed by a preprocessor in the best case, allowing for the best | |
36 | * optimization. | |
37 | */ | |
d684c216 L |
38 | #define debug_cond(cond, fmt, args...) \ |
39 | do { \ | |
40 | if (cond) \ | |
41 | printf_P(PSTR(fmt), ##args); \ | |
42 | } while (0) | |
43 | ||
44 | #define debug(fmt, args...) \ | |
45 | debug_cond(_DEBUG, fmt, ##args) | |
46 | ||
47 | ||
48 | #if 1 | |
0c5890bb | 49 | #ifdef DEBUG |
e7895944 | 50 | #define DBG_P(lvl, format, ...) if (DEBUG>=lvl) \ |
9b6b4b31 | 51 | fprintf_P( stdout, PSTR(format), ##__VA_ARGS__ ) |
0c5890bb L |
52 | #else |
53 | #define DBG_P(lvl, ...) | |
54 | #endif | |
d684c216 | 55 | #endif /* 0 */ |
0c5890bb L |
56 | |
57 | #endif /* DEBUG_H_ */ |