aboutsummaryrefslogtreecommitdiffstats
path: root/firmware/debug_uart.h
blob: 8225dbd631c6a6976508f634f6bf7da8b866d5ef (plain)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
#ifndef DEBUG_UART_H_
#define DEBUG_UART_H_

#include "util.h"
#include "fixpt.h"

#include <stdint.h>


#if CONF_DEBUG

#define DEBUG_PREFIX1(prefix0)		prefix0, NULL
#define DEBUG_PREFIX2(prefix0, prefix1)	prefix0, prefix1

#define DEBUG_PFX1(prefix0)		DEBUG_PREFIX1(PSTR(prefix0))
#define DEBUG_PFX2(prefix0, prefix1)	DEBUG_PREFIX2(PSTR(prefix0), PSTR(prefix1))


void debug_print_int32(const char __flash *prefix0,
		       const char __flash *prefix1,
		       int32_t value);
void debug_print_int24(const char __flash *prefix0,
		       const char __flash *prefix1,
		       int24_t value);
void debug_print_int16(const char __flash *prefix0,
		       const char __flash *prefix1,
		       int16_t value);
void debug_print_int8(const char __flash *prefix0,
		      const char __flash *prefix1,
		      int8_t value);
void debug_print_fixpt(const char __flash *prefix0,
		       const char __flash *prefix1,
		       fixpt_t value);

void debug_report_int32(const char __flash *prefix0,
			const char __flash *prefix1,
			int32_t *old_value,
			int32_t new_value);
void debug_report_int24(const char __flash *prefix0,
			const char __flash *prefix1,
			int24_t *old_value,
			int24_t new_value);
void debug_report_int16(const char __flash *prefix0,
			const char __flash *prefix1,
			int16_t *old_value,
			int16_t new_value);
void debug_report_int8(const char __flash *prefix0,
		       const char __flash *prefix1,
		       int8_t *old_value,
		       int8_t new_value);
void debug_report_fixpt(const char __flash *prefix0,
			const char __flash *prefix1,
			fixpt_t *old_value,
			fixpt_t new_value);

void debug_enable(bool enable);
bool debug_is_enabled(void);

void debug_uart_init(void);


#else /* CONF_DEBUG */


#define DEBUG_PREFIX1(prefix0)		NULL, NULL
#define DEBUG_PREFIX2(prefix0, prefix1)	NULL, NULL

#define DEBUG_PFX1(prefix0)		DEBUG_PREFIX1(NULL)
#define DEBUG_PFX2(prefix0, prefix1)	DEBUG_PREFIX2(NULL, NULL)


static inline
void debug_print_int32(const char __flash *prefix0,
		       const char __flash *prefix1,
		       int32_t value)
{
}

static inline
void debug_print_int24(const char __flash *prefix0,
		       const char __flash *prefix1,
		       int24_t value)
{
}

static inline
void debug_print_int16(const char __flash *prefix0,
		       const char __flash *prefix1,
		       int16_t value)
{
}

static inline
void debug_print_int8(const char __flash *prefix0,
		      const char __flash *prefix1,
		      int8_t value)
{
}

static inline
void debug_print_fixpt(const char __flash *prefix0,
		       const char __flash *prefix1,
		       fixpt_t value)
{
}

static inline
void debug_report_int32(const char __flash *prefix0,
			const char __flash *prefix1,
			int32_t *old_value,
			int32_t new_value)
{
}

static inline
void debug_report_int24(const char __flash *prefix0,
			const char __flash *prefix1,
			int24_t *old_value,
			int24_t new_value)
{
}

static inline
void debug_report_int16(const char __flash *prefix0,
			const char __flash *prefix1,
			int16_t *old_value,
			int16_t new_value)
{
}

static inline
void debug_report_int8(const char __flash *prefix0,
		       const char __flash *prefix1,
		       int8_t *old_value,
		       int8_t new_value)
{
}

static inline
void debug_report_fixpt(const char __flash *prefix0,
			const char __flash *prefix1,
			fixpt_t *old_value,
			fixpt_t new_value)
{
}

static inline
void debug_enable(bool enable)
{
}

static inline
bool debug_is_enabled(void)
{
	return false;
}

static inline
void debug_uart_init(void)
{
}


#endif /* CONF_DEBUG */
#endif /* DEBUG_UART_H_ */
bues.ch cgit interface