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