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