-
Notifications
You must be signed in to change notification settings - Fork 0
/
kernel_log.h
58 lines (50 loc) · 1.32 KB
/
kernel_log.h
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
/* Define DEBUG to turn on debug output. When DEBUG is not
defined, the extra code will be taken care of (removed) by
the compiler. */
void port_log_init(void);
void port_log_putchar(char c);
void port_log_puthex(uint8_t v);
void port_log_putstring(const char *string);
#ifdef DEBUG
#define DEBUG_LOG 1
#else
#define DEBUG_LOG 0
#endif
#define log_init() \
do { \
if (DEBUG_LOG) { \
port_log_init(); \
} \
} while (0)
#define task_line(string) \
do { \
if (DEBUG_LOG) { \
port_log_putstring("\n"); \
port_log_putstring(running_task->name); \
port_log_putchar(':'); \
port_log_putstring(__func__); \
port_log_putstring("(): "); \
port_log_putstring(string); \
} \
} while (0)
#define log_hex(n) \
do { \
if (DEBUG_LOG) { \
port_log_puthex(n); \
} \
} while (0)
#define log_string(string) \
do { \
if (DEBUG_LOG) { \
port_log_putstring(string); \
} \
} while (0)
#define log_line(string) \
do { \
if (DEBUG_LOG) { \
port_log_putstring("\n" __FILE__ ":"); \
port_log_putstring(__func__); \
port_log_putstring("(): "); \
port_log_putstring(string); \
} \
} while (0)