10 #ifndef __DEBUG_LEVEL__
12 #define __DEBUG_LEVEL__ LOGLEVEL_NOTICE
15 #ifndef __DEBUG_HEADER__
17 #define __DEBUG_HEADER__ 0
21 #define __FILENAME__ (__builtin_strrchr(__FILE__, '/') ? __builtin_strrchr(__FILE__, '/') + 1 : __FILE__)
47 void dbg_printf(
const char *file,
const char *fun,
int line,
char *header,
short log_level,
const char *format, ...);
58 const char *
dec_to_binary(
unsigned long value,
unsigned length);
61 #define pr_default(...) dbg_printf(__FILENAME__, __func__, __LINE__, __DEBUG_HEADER__, LOGLEVEL_DEFAULT, __VA_ARGS__)
64 #if __DEBUG_LEVEL__ >= LOGLEVEL_EMERG
65 #define pr_emerg(...) dbg_printf(__FILENAME__, __func__, __LINE__, __DEBUG_HEADER__, LOGLEVEL_EMERG, __VA_ARGS__)
71 #if __DEBUG_LEVEL__ >= LOGLEVEL_ALERT
72 #define pr_alert(...) dbg_printf(__FILENAME__, __func__, __LINE__, __DEBUG_HEADER__, LOGLEVEL_ALERT, __VA_ARGS__)
78 #if __DEBUG_LEVEL__ >= LOGLEVEL_CRIT
79 #define pr_crit(...) dbg_printf(__FILENAME__, __func__, __LINE__, __DEBUG_HEADER__, LOGLEVEL_CRIT, __VA_ARGS__)
85 #if __DEBUG_LEVEL__ >= LOGLEVEL_ERR
86 #define pr_err(...) dbg_printf(__FILENAME__, __func__, __LINE__, __DEBUG_HEADER__, LOGLEVEL_ERR, __VA_ARGS__)
92 #if __DEBUG_LEVEL__ >= LOGLEVEL_WARNING
93 #define pr_warning(...) dbg_printf(__FILENAME__, __func__, __LINE__, __DEBUG_HEADER__, LOGLEVEL_WARNING, __VA_ARGS__)
95 #define pr_warning(...)
99 #if __DEBUG_LEVEL__ >= LOGLEVEL_NOTICE
100 #define pr_notice(...) dbg_printf(__FILENAME__, __func__, __LINE__, __DEBUG_HEADER__, LOGLEVEL_NOTICE, __VA_ARGS__)
102 #define pr_notice(...)
106 #if __DEBUG_LEVEL__ >= LOGLEVEL_INFO
107 #define pr_info(...) dbg_printf(__FILENAME__, __func__, __LINE__, __DEBUG_HEADER__, LOGLEVEL_INFO, __VA_ARGS__)
113 #if __DEBUG_LEVEL__ >= LOGLEVEL_DEBUG
114 #define pr_debug(...) dbg_printf(__FILENAME__, __func__, __LINE__, __DEBUG_HEADER__, LOGLEVEL_DEBUG, __VA_ARGS__)
116 #define pr_debug(...)
void dbg_puts(const char *s)
Prints the given string to debug output.
Definition: debug.c:25
void dbg_printf(const char *file, const char *fun, int line, char *header, short log_level, const char *format,...)
Prints the given string to the debug output.
Definition: debug.c:99
const char * dec_to_binary(unsigned long value, unsigned length)
Transforms the given value to a binary string.
Definition: debug.c:155
void dbg_putchar(char c)
Prints the given character to debug output.
Definition: debug.c:20
const char * to_human_size(unsigned long bytes)
Transforms the given amount of bytes to a readable string.
Definition: debug.c:139
void set_log_level(int level)
Sets the loglevel.
Definition: debug.c:87
int get_log_level(void)
Returns the current loglevel.
Definition: debug.c:94
void dbg_print_regs(pt_regs *frame)
Prints the registers.
Definition: debug.c:171
Interrupt stack frame.
Definition: kernel.h:24