Debug Console

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)

Detailed Description

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.

Note:
When the current debug level is set to DEBUG_NONE, no debug messages will be sent to the backend, not even messages with severity DEBUG_NONE.

Define Documentation

#define dbg_error ( ...   )     dbg_printf_level(DEBUG_ERROR, __VA_ARGS__)

Display a error message.

See also:
dbg_printf_level()

Definition at line 226 of file debug.h.

Referenced by at90usb_udc_configure_ep().

#define dbg_info ( ...   )     dbg_printf_level(DEBUG_INFO, __VA_ARGS__)

Display an informational message.

See also:
dbg_printf_level()

Definition at line 238 of file debug.h.

Referenced by main().

#define dbg_panic ( ...   )     dbg_printf_level(DEBUG_PANIC, __VA_ARGS__)

Display a panic message.

See also:
dbg_printf_level()

Definition at line 220 of file debug.h.

Referenced by main().

#define dbg_printf_level ( level,
...   ) 
Value:
(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.)

Parameters:
level Debug level at which to show the message
... Format specification and arguments
Returns:
The number of characters printed.

Definition at line 170 of file debug.h.

#define dbg_priv_check_level ( level   )     (DEBUG_LEVEL != DEBUG_NONE && (level) <= DEBUG_LEVEL)

For internal use only.

Return true if level is less than or equal to the current debug level.

Definition at line 135 of file debug.h.

#define dbg_putchar (  )     dbg_putchar_level(DEBUG_VERBOSE, c)

Output character at DEBUG_VERBOSE level.

See also:
dbg_putchar_level()

Definition at line 213 of file debug.h.

#define dbg_putchar_level ( level,
 ) 
Value:
(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.

Parameters:
level Debug level at which to show the message
c The character to write.
Returns:
c as an unsigned char cast to an int.

Definition at line 198 of file debug.h.

#define dbg_putstr ( str   )     dbg_putstr_level(DEBUG_VERBOSE, str)

Output string at DEBUG_VERBOSE level.

See also:
dbg_putstr_level()

Definition at line 207 of file debug.h.

#define dbg_putstr_level ( level,
str   ) 
Value:
(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.

Parameters:
level Debug level at which to show the message
str NUL-terminated string.
Returns:
The number of characters written.

Definition at line 184 of file debug.h.

#define dbg_verbose ( ...   )     dbg_printf_level(DEBUG_VERBOSE, __VA_ARGS__)
#define dbg_vprintf_level ( level,
format,
ap   ) 
Value:
(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.)

Parameters:
level Debug level at which to show the message
format Format specification.
ap Format arguments.
Returns:
The number of characters printed.

Definition at line 152 of file debug.h.

#define dbg_warning ( ...   )     dbg_printf_level(DEBUG_WARNING, __VA_ARGS__)

Display a warning message.

See also:
dbg_printf_level()

Definition at line 232 of file debug.h.

Referenced by block_alloc_request(), and dataflash_detect().


Enumeration Type Documentation

Severity level of debugging messages.

Enumerator:
DEBUG_NONE 

No debugging messages.

DEBUG_PANIC 

System panic (fatal exceptions, etc.).

DEBUG_ASSERT 

Assertion failures.

DEBUG_ERROR 

Major errors which may be recoverable.

DEBUG_WARNING 

Things that might cause problems.

DEBUG_INFO 

Informational messages.

DEBUG_VERBOSE 

Verbose debugging messages.

Definition at line 88 of file debug.h.


Function Documentation

static int dbg_priv_retzero ( void   )  [inline, static]

For internal use only.

Dummy function which simply returns 0. Simply having a macro evaluating to zero produces "statement with no effect" warnings with gcc, so we're using an inline function call instead.

Definition at line 125 of file debug.h.

Generated on Thu Apr 29 14:10:34 2010 for xplain-bc by  doxygen 1.6.3