@@ -13,14 +13,16 @@
#include "qemu/bitops.h"
#include "sysemu/char.h"
-/* #define DEBUG_IPOCTAL */
-#ifdef DEBUG_IPOCTAL
-#define DPRINTF2(fmt, ...) \
- do { fprintf(stderr, fmt, ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF2(fmt, ...) do { } while (0)
-#endif
+#ifndef DEBUG_IPOCTAL
+#define DEBUG_IPOCTAL 0
+#endif
+
+#define DPRINTF2(fmt, ...) do { \
+ if (DEBUG_IPOCTAL) { \
+ fprintf(stderr, fmt, ## __VA_ARGS__); \
+ } \
+} while (0);
#define DPRINTF(fmt, ...) DPRINTF2("IP-Octal: " fmt, ## __VA_ARGS__)
@@ -504,11 +506,11 @@ static void hostdev_event(void *opaque, int event)
SCC2698Channel *ch = opaque;
switch (event) {
case CHR_EVENT_OPENED:
- DPRINTF("Device %s opened\n", ch->dev->label);
+ DPRINTF("Device %s opened\n", ch->dev.chr->label);
break;
case CHR_EVENT_BREAK: {
uint8_t zero = 0;
- DPRINTF("Device %s received break\n", ch->dev->label);
+ DPRINTF("Device %s received break\n", ch->dev.chr->label);
if (!(ch->sr & SR_BREAK)) {
IPOctalState *dev = ch->ipoctal;
@@ -528,7 +530,7 @@ static void hostdev_event(void *opaque, int event)
}
break;
default:
- DPRINTF("Device %s received event %d\n", ch->dev->label, event);
+ DPRINTF("Device %s received event %d\n", ch->dev.chr->label,
event);
}
}
@@ -546,7 +548,7 @@ static void ipoctal_realize(DeviceState *dev, Error
**errp)
qemu_chr_fe_set_handlers(&ch->dev, hostdev_can_receive,
hostdev_receive, hostdev_event,
ch, NULL, true);
- DPRINTF("Redirecting channel %u to %s\n", i, ch->dev->label);
+ DPRINTF("Redirecting channel %u to %s\n", i,
ch->dev.chr->label);
} else {
DPRINTF("Could not redirect channel %u, no chardev set\n", i);
}
@@ -97,13 +97,15 @@
#define MAX_XMIT_RETRY 4
-#ifdef DEBUG_SERIAL
-#define DPRINTF(fmt, ...) \
-do { fprintf(stderr, "serial: " fmt , ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF(fmt, ...) \
-do {} while (0)
-#endif
+#ifndef DEBUG_SERIAL
+#define DEBUG_SERIAL 0
+#endif
+
+#define DPRINTF(fmt, ...) do { \
+ if (DEBUG_SERIAL) { \
+ fprintf(stderr, "serial: " fmt , ## __VA_ARGS__); \
+ } \
+} while (0);
static void serial_receive1(void *opaque, const uint8_t *buf, int size);
static void serial_xmit(SerialState *s);