]> cloudbase.mooo.com Git - z180-stamp.git/blob - include/debug.h
_USE_LABEL --> FF_USE_LABEL
[z180-stamp.git] / include / debug.h
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 "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 []);
21 command_ret_t do_pr_heap_avr(cmd_tbl_t *, uint_fast8_t, int, char * const []);
22
23 void printfreelist(const char * title);
24
25
26 #ifdef DEBUG
27 #define _DEBUG 1
28 #else
29 #define _DEBUG 0
30 #endif
31
32 /*
33 * Output a debug text when condition "cond" is met. The "cond" should be
34 * computed by a preprocessor in the best case, allowing for the best
35 * optimization.
36 */
37 #define debug_cond(cond, fmt, args...) \
38 do { \
39 if (cond) \
40 printf_P(PSTR(fmt), ##args); \
41 } while (0)
42
43 #define debug(fmt, args...) \
44 debug_cond(_DEBUG, fmt, ##args)
45
46
47 #if 1
48 #ifdef DEBUG
49 #define DBG_P(lvl, format, ...) if (DEBUG>=lvl) \
50 fprintf_P( stdout, PSTR(format), ##__VA_ARGS__ )
51 #else
52 #define DBG_P(lvl, ...)
53 #endif
54 #endif /* 0 */
55
56 #endif /* DEBUG_H_ */