6#ifndef __LIBDRAGON_DEBUG_H
7#define __LIBDRAGON_DEBUG_H
39#define DEBUG_FEATURE_LOG_USB (1 << 0)
60#define DEBUG_FEATURE_LOG_ISVIEWER (1 << 1)
93#define DEBUG_FEATURE_LOG_SD (1 << 2)
116#define DEBUG_FEATURE_FILE_SD (1 << 3)
129#define DEBUG_FEATURE_ALL 0xFF
156 static inline bool debug_init(
int features)
180 #define debugf(msg, ...) fprintf(stderr, msg, ##__VA_ARGS__)
195 #define assertf(expr, msg, ...) ({ \
196 if (!(expr)) debug_assert_func_f(__FILE__, __LINE__, __func__, #expr, msg, ##__VA_ARGS__); \
200 #define debug_init(ch) ({ false; })
201 #define debug_init_usblog() ({ false; })
202 #define debug_init_isviewer() ({ false; })
203 #define debug_init_sdlog(fn,fmt) ({ false; })
204 #define debug_init_sdfs(prefix,np) ({ false; })
205 #define debugf(msg, ...) ({ })
206 #define assertf(expr, msg, ...) ({ })
247void debug_assert_func_f(
const char *file,
int line,
const char *func,
const char *failedexpr,
const char *msg, ...)
248 __attribute__((noreturn, format(printf, 5, 6)));
#define DEBUG_FEATURE_LOG_ISVIEWER
Flag to activate the ISViewer logging channel.
Definition debug.h:60
#define DEBUG_FEATURE_FILE_SD
Flag to activate filesystem access to files on CompactFlash/SD.
Definition debug.h:116
bool debug_init_sdlog(const char *fn, const char *openfmt)
Initialize SD logging.
Definition debug.c:571
#define DEBUG_FEATURE_LOG_USB
Flag to activate the USB logging channel.
Definition debug.h:39
void debug_backtrace(void)
Dump a backtrace (call stack) via debugf.
Definition debug.c:710
#define DEBUG_FEATURE_LOG_SD
Flag to activate the logging on CompactFlash/SD card.
Definition debug.h:93
bool debug_init_isviewer(void)
Initialize ISViewer logging.
Definition debug.c:561
bool debug_init_sdfs(const char *prefix, int npart)
Initialize SD filesystem.
Definition debug.c:582
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:619
bool debug_init_usblog(void)
Initialize USB logging.
Definition debug.c:550
void debug_hexdump(const void *buffer, int size)
Do a hexdump of the specified buffer via debugf.
Definition debug.c:657
void debug_close_sdfs(void)
Shutdown SD filesystem.
Definition debug.c:610