X-Git-Url: http://cloudbase.mooo.com/gitweb/z180-stamp.git/blobdiff_plain/0c5890bb8c70f34026315c9c5a1878cfd0bbea0d..69988dc1f60ce27d2192eb2aa579962f585fffc8:/avr/debug.h diff --git a/avr/debug.h b/avr/debug.h index 39ae55c..7c19e40 100644 --- a/avr/debug.h +++ b/avr/debug.h @@ -2,10 +2,37 @@ #ifndef DEBUG_H_ #define DEBUG_H_ +#include "common.h" +#include + +#ifdef DEBUG +#define _DEBUG 1 +#else +#define _DEBUG 0 +#endif + +#define debug_cond(cond, fmt, args...) \ + do { \ + if (cond) \ + printf_P(PSTR(fmt), ##args); \ + } while (0) + +#define debug(fmt, args...) \ + debug_cond(_DEBUG, fmt, ##args) + + +#if 1 #ifdef DEBUG -#define DBG_P(lvl, ...) if (DEBUG>=lvl) fprintf_P( stderr, __VA_ARGS__ ) +#define DBG_P(lvl, format, ...) if (DEBUG>=lvl) \ + fprintf_P( stdout, PSTR(format), ##__VA_ARGS__ ) #else #define DBG_P(lvl, ...) #endif +#endif /* 0 */ + + +void printfreelist(const char * title); + #endif /* DEBUG_H_ */ +