include/debug.h File Reference

Debug console. More...

#include <compiler.h>
#include <stdarg.h>

Include dependency graph for debug.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#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_vprintf(format, ap)   dbg_vprintf_level(DEBUG_VERBOSE, format, ap)
 Output formatted debug message at DEBUG_VERBOSE level.
#define dbg_printf(...)   dbg_printf_level(DEBUG_VERBOSE, __VA_ARGS__)
 Output formatted debug message at DEBUG_VERBOSE 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

void dbg_init (void)
 Initialize the debug console.
int dbg_priv_vprintf (const char *format, va_list ap)
 Formatted output conversion to the debug console.
int int dbg_priv_putstr (const char *str)
 Write a string to the debug console.
int dbg_priv_putchar (int c)
 Write a single character to the debug console.
static int dbg_priv_retzero (void)


Detailed Description

Debug console.

This is a simple debug console which can be used to dump information over a serial line when debugging a new application or driver.

Author:
Atmel Corporation: http://www.atmel.com
Support and FAQ: http://support.atmel.no/

Definition in file debug.h.


Define Documentation

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

Display a error message.

See also:
dbg_printf_level()

Definition at line 198 of file debug.h.

Referenced by journal_clean_last_entry(), sdmmc_cd_init(), and sdmmc_mcihost_load_data().

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

Display an informational message.

See also:
dbg_printf_level()

Definition at line 210 of file debug.h.

Referenced by watchdog_set_timeout().

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

Display a panic message.

See also:
dbg_printf_level()

Definition at line 192 of file debug.h.

Referenced by do_unknown_exception(), and sdmmc_mcihost_init().

#define dbg_printf ( ...   )     dbg_printf_level(DEBUG_VERBOSE, __VA_ARGS__)

#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 130 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 185 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 character
c The character to write.
Returns:
c as an unsigned char cast to an int.

Definition at line 158 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 179 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 string
str NUL-terminated string.
Returns:
The number of characters written.

Definition at line 144 of file debug.h.

#define dbg_verbose ( ...   )     dbg_printf_level(DEBUG_VERBOSE, __VA_ARGS__)

#define dbg_vprintf ( format,
ap   )     dbg_vprintf_level(DEBUG_VERBOSE, format, ap)

Output formatted debug message at DEBUG_VERBOSE level.

See also:
dbg_vprintf_level()

Definition at line 167 of file debug.h.

#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 112 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 204 of file debug.h.

Referenced by block_alloc_request(), and journal_init().


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 54 of file debug.h.


Function Documentation

void dbg_init ( void   ) 

Initialize the debug console.

This function must be called before any of the other debug console functions may be called. If the debug console is disabled, this function does nothing.

Definition at line 130 of file debug.c.

References debug_console, serial_console_init(), and SERIAL_ENABLE_TX.

Here is the call graph for this function:

int dbg_priv_putchar ( int  c  ) 

Write a single character to the debug console.

For internal use only.

Parameters:
c The character to write.
Returns:
c as an unsigned char cast to an int.

Definition at line 118 of file debug.c.

References console_putchar(), and debug_console.

Here is the call graph for this function:

int int dbg_priv_putstr ( const char *  str  ) 

Write a string to the debug console.

For internal use only.

Parameters:
str NUL-terminated string.
Returns:
The number of characters written.

Definition at line 105 of file debug.c.

References console_putstr(), and debug_console.

Here is the call graph for this function:

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 90 of file debug.h.

int dbg_priv_vprintf ( const char *  format,
va_list  ap 
)

Formatted output conversion to the debug console.

For internal use only.

Produce output according to format on the debug console. format is interpreted as a regular printf()-style format string with a few limitations (some specifiers are accepted but ignored.)

Parameters:
format Format specification.
ap Format arguments.
Returns:
The number of characters printed.

Definition at line 68 of file debug.c.

References console_vprintf(), and debug_console.

Referenced by dbg_priv_printf().

Here is the call graph for this function:


Generated on Tue Sep 15 10:21:02 2009 for libavr32 by  doxygen 1.5.8