Defines | |
| #define | dbg_priv_check_level(level) (DEBUG_LEVEL != DEBUG_NONE && (level) <= DEBUG_LEVEL) |
| #define | dbg_vprintf_level(level, format, ap) |
| Formatted output conversion to the debug console. | |
| #define | dbg_printf_level(level,...) |
| Formatted output conversion to the debug console. | |
| #define | dbg_putstr_level(level, str) |
| Write a string to the debug console if the current debug level is higher or equal to level. | |
| #define | dbg_putchar_level(level, c) |
| Write a single character to the debug console if the current debug level is higher or equal to level. | |
| #define | dbg_putstr(str) dbg_putstr_level(DEBUG_VERBOSE, str) |
| Output string at DEBUG_VERBOSE level. | |
| #define | dbg_putchar(c) dbg_putchar_level(DEBUG_VERBOSE, c) |
| Output character at DEBUG_VERBOSE level. | |
| #define | dbg_panic(...) dbg_printf_level(DEBUG_PANIC, __VA_ARGS__) |
| Display a panic message. | |
| #define | dbg_error(...) dbg_printf_level(DEBUG_ERROR, __VA_ARGS__) |
| Display a error message. | |
| #define | dbg_warning(...) dbg_printf_level(DEBUG_WARNING, __VA_ARGS__) |
| Display a warning message. | |
| #define | dbg_info(...) dbg_printf_level(DEBUG_INFO, __VA_ARGS__) |
| Display an informational message. | |
| #define | dbg_verbose(...) dbg_printf_level(DEBUG_VERBOSE, __VA_ARGS__) |
| Display a verbose debugging message. | |
Enumerations | |
| enum | debug_level { DEBUG_NONE = 0, DEBUG_PANIC, DEBUG_ASSERT, DEBUG_ERROR, DEBUG_WARNING, DEBUG_INFO, DEBUG_VERBOSE } |
Severity level of debugging messages. More... | |
Functions | |
| static int | dbg_priv_retzero (void) |
The debug console allows applications, drivers or pretty much anything to log messages to a predefined console backend. The backend may be a UART driver which sends the message over the serial line, or a simple ring buffer which allows the messages to be read out for forensics.
Each message sent to the debug console has a severity associated with it, specified as one of the values in debug_level. A lower number indicates higher severity, and if the severity level of the message is numberically higher than the current debug level, the message is dropped. The current debug level is determined as follows:
If a message is dropped, the compiler should be able to eliminate the debug function call as well as any references to its parameters (format strings, etc.) This allows drivers, etc. to use dbg_verbose() liberally without affecting the performance or code size when verbose debugging is disabled.
| #define dbg_error | ( | ... | ) | dbg_printf_level(DEBUG_ERROR, __VA_ARGS__) |
| #define dbg_info | ( | ... | ) | dbg_printf_level(DEBUG_INFO, __VA_ARGS__) |
Display an informational message.
| #define dbg_panic | ( | ... | ) | dbg_printf_level(DEBUG_PANIC, __VA_ARGS__) |
| #define dbg_printf_level | ( | level, | |||
| ... | ) |
(dbg_priv_check_level(level) \ ? dbg_priv_printf(__VA_ARGS__) \ : dbg_priv_retzero())
Formatted output conversion to the debug console.
Produce output according to format on the debug console if the current debug level is higher or equal to level. format is interpreted as a regular printf()-style format string with a few limitations (some specifiers are accepted but ignored.)
| level | Debug level at which to show the message | |
| ... | Format specification and arguments |
| #define dbg_priv_check_level | ( | level | ) | (DEBUG_LEVEL != DEBUG_NONE && (level) <= DEBUG_LEVEL) |
| #define dbg_putchar | ( | c | ) | dbg_putchar_level(DEBUG_VERBOSE, c) |
Output character at DEBUG_VERBOSE level.
| #define dbg_putchar_level | ( | level, | |||
| c | ) |
(dbg_priv_check_level(level) \ ? dbg_priv_putchar(c) \ : dbg_priv_retzero())
Write a single character to the debug console if the current debug level is higher or equal to level.
| level | Debug level at which to show the message | |
| c | The character to write. |
| #define dbg_putstr | ( | str | ) | dbg_putstr_level(DEBUG_VERBOSE, str) |
Output string at DEBUG_VERBOSE level.
| #define dbg_putstr_level | ( | level, | |||
| str | ) |
(dbg_priv_check_level(level) \ ? dbg_priv_putstr(str) \ : dbg_priv_retzero())
Write a string to the debug console if the current debug level is higher or equal to level.
| level | Debug level at which to show the message | |
| str | NUL-terminated string. |
| #define dbg_verbose | ( | ... | ) | dbg_printf_level(DEBUG_VERBOSE, __VA_ARGS__) |
Display a verbose debugging message.
| #define dbg_vprintf_level | ( | level, | |||
| format, | |||||
| ap | ) |
(dbg_priv_check_level(level) \ ? dbg_priv_vprintf(format, ap) \ : dbg_priv_retzero())
Formatted output conversion to the debug console.
Produce output according to format on the debug console if the current debug level is higher or equal to level. format is interpreted as a regular printf()-style format string with a few limitations (some specifiers are accepted but ignored.)
| level | Debug level at which to show the message | |
| format | Format specification. | |
| ap | Format arguments. |
| #define dbg_warning | ( | ... | ) | dbg_printf_level(DEBUG_WARNING, __VA_ARGS__) |
| enum debug_level |
Severity level of debugging messages.
1.6.3