7#ifndef __LIBDRAGON_DEBUG_H
8#define __LIBDRAGON_DEBUG_H
40#define DEBUG_FEATURE_LOG_USB (1 << 0)
61#define DEBUG_FEATURE_LOG_ISVIEWER (1 << 1)
94#define DEBUG_FEATURE_LOG_SD (1 << 2)
117#define DEBUG_FEATURE_FILE_SD (1 << 3)
130#define DEBUG_FEATURE_ALL 0xFF
157 static inline bool debug_init(
int features)
181 #define debugf(msg, ...) fprintf(stderr, msg, ##__VA_ARGS__)
196 #define assertf(expr, msg, ...) ({ \
197 if (!(expr)) debug_assert_func_f(__FILE__, __LINE__, __func__, #expr, msg, ##__VA_ARGS__); \
201 #define debug_init(ch) ({ false; })
202 #define debug_init_usblog() ({ false; })
203 #define debug_init_isviewer() ({ false; })
204 #define debug_init_sdlog(fn,fmt) ({ false; })
205 #define debug_init_sdfs(prefix,np) ({ false; })
206 #define debugf(msg, ...) ({ })
207 #define assertf(expr, msg, ...) ({ })
248void debug_assert_func_f(
const char *file,
int line,
const char *func,
const char *failedexpr,
const char *msg, ...)
249 __attribute__((noreturn, format(printf, 5, 6)));
#define DEBUG_FEATURE_LOG_ISVIEWER
Flag to activate the ISViewer logging channel.
Definition debug.h:61
#define DEBUG_FEATURE_FILE_SD
Flag to activate filesystem access to files on CompactFlash/SD.
Definition debug.h:117
bool debug_init_sdlog(const char *fn, const char *openfmt)
Initialize SD logging.
Definition debug.c:572
#define DEBUG_FEATURE_LOG_USB
Flag to activate the USB logging channel.
Definition debug.h:40
void debug_backtrace(void)
Dump a backtrace (call stack) via debugf.
Definition debug.c:711
#define DEBUG_FEATURE_LOG_SD
Flag to activate the logging on CompactFlash/SD card.
Definition debug.h:94
bool debug_init_isviewer(void)
Initialize ISViewer logging.
Definition debug.c:562
bool debug_init_sdfs(const char *prefix, int npart)
Initialize SD filesystem.
Definition debug.c:583
void debug_assert_func_f(const char *file, int line, const char *func, const char *failedexpr, const char *msg,...)
Underlying implementation function for assert() and assertf.
Definition debug.c:620
bool debug_init_usblog(void)
Initialize USB logging.
Definition debug.c:551
void debug_hexdump(const void *buffer, int size)
Do a hexdump of the specified buffer via debugf.
Definition debug.c:658
void debug_close_sdfs(void)
Shutdown SD filesystem.
Definition debug.c:611