-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathdebug.h
More file actions
23 lines (18 loc) · 684 Bytes
/
debug.h
File metadata and controls
23 lines (18 loc) · 684 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#ifndef DEBUG_H
#define DEBUG_H
// Define different levels of debug printing
// print nothing
#define DEBUG_PRINT_OFF 0
// print only when something goes wrong
#define DEBUG_PRINT_ERR 1
// print occasional messages about interesting things
#define DEBUG_PRINT_INFO 2
// print a good amount of debugging output
#define DEBUG_PRINT_DBG 3
// Defines the level of debug output
extern uint8_t debug_print;
// Define the printk macros.
#define ERR(x) do {if (debug_print >= DEBUG_PRINT_ERR) { printk x; }} while (0)
#define INFO(x) do {if (debug_print >= DEBUG_PRINT_INFO) { printk x; }} while (0)
#define DBG(x) do {if (debug_print >= DEBUG_PRINT_DBG) { printk x; }} while (0)
#endif