@@ -26,13 +26,17 @@
#define LM4549_DUMP_DAC_INPUT 1
#endif
-#ifdef LM4549_DEBUG
-#define DPRINTF(fmt, ...) \
-do { printf("lm4549: " fmt , ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF(fmt, ...) do {} while (0)
+#ifndef LM4549_DEBUG
+#define LM4549_DEBUG 0
#endif
+#define DPRINTF(fmt, ...) \
+ do { \
+ if (LM4549_DEBUG) { \
+ fprintf(stderr, "lm4549: " fmt, ## __VA_ARGS__); \
+ } \
+ } while (0)
+
#if defined(LM4549_DUMP_DAC_INPUT)
static FILE *fp_dac_input;
#endif
@@ -159,7 +163,7 @@ uint32_t lm4549_read(lm4549_state *s, hwaddr offset)
assert(offset < 128);
value = regfile[offset];
- DPRINTF("read [0x%02x] = 0x%04x\n", offset, value);
+ DPRINTF("read [0x%02x] = 0x%04x\n", (int) offset, value);
return value;
}
@@ -170,7 +174,7 @@ void lm4549_write(lm4549_state *s,
uint16_t *regfile = s->regfile;
assert(offset < 128);
- DPRINTF("write [0x%02x] = 0x%04x\n", offset, value);
+ DPRINTF("write [0x%02x] = 0x%04x\n", (int) offset, value);
switch (offset) {
case LM4549_Reset: