aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBlue Swirl <blauwirbel@gmail.com>2010-05-29 20:23:19 +0000
committerBlue Swirl <blauwirbel@gmail.com>2010-05-29 20:23:19 +0000
commit8ac02ff882d48e40571c5b346ceda44dc3925f1b (patch)
tree9f44242d57dde85c3785183e2f61569e24c99448
parent03ae77d6d2ba949fa8d0ceaac588a1075b6257b3 (diff)
downloadqemu-8ac02ff882d48e40571c5b346ceda44dc3925f1b.zip
qemu-8ac02ff882d48e40571c5b346ceda44dc3925f1b.tar.gz
qemu-8ac02ff882d48e40571c5b346ceda44dc3925f1b.tar.bz2
i8259: improve debugging
Add a DPRINTF macro. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
-rw-r--r--hw/i8259.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/hw/i8259.c b/hw/i8259.c
index ea48e0e..a995280 100644
--- a/hw/i8259.c
+++ b/hw/i8259.c
@@ -30,6 +30,13 @@
/* debug PIC */
//#define DEBUG_PIC
+#ifdef DEBUG_PIC
+#define DPRINTF(fmt, ...) \
+ do { printf("pic: " fmt , ## __VA_ARGS__); } while (0)
+#else
+#define DPRINTF(fmt, ...)
+#endif
+
//#define DEBUG_IRQ_LATENCY
//#define DEBUG_IRQ_COUNT
@@ -185,9 +192,7 @@ static void i8259_set_irq(void *opaque, int irq, int level)
#if defined(DEBUG_PIC) || defined(DEBUG_IRQ_COUNT)
if (level != irq_level[irq]) {
-#if defined(DEBUG_PIC)
- printf("i8259_set_irq: irq=%d level=%d\n", irq, level);
-#endif
+ DPRINTF("i8259_set_irq: irq=%d level=%d\n", irq, level);
irq_level[irq] = level;
#ifdef DEBUG_IRQ_COUNT
if (level == 1)
@@ -253,9 +258,7 @@ int pic_read_irq(PicState2 *s)
(double)(qemu_get_clock(vm_clock) -
irq_time[irq]) * 1000000.0 / get_ticks_per_sec());
#endif
-#if defined(DEBUG_PIC)
- printf("pic_interrupt: irq=%d\n", irq);
-#endif
+ DPRINTF("pic_interrupt: irq=%d\n", irq);
return intno;
}
@@ -286,9 +289,7 @@ static void pic_ioport_write(void *opaque, uint32_t addr, uint32_t val)
PicState *s = opaque;
int priority, cmd, irq;
-#ifdef DEBUG_PIC
- printf("pic_write: addr=0x%02x val=0x%02x\n", addr, val);
-#endif
+ DPRINTF("write: addr=0x%02x val=0x%02x\n", addr, val);
addr &= 1;
if (addr == 0) {
if (val & 0x10) {
@@ -416,9 +417,7 @@ static uint32_t pic_ioport_read(void *opaque, uint32_t addr1)
ret = s->imr;
}
}
-#ifdef DEBUG_PIC
- printf("pic_read: addr=0x%02x val=0x%02x\n", addr1, ret);
-#endif
+ DPRINTF("read: addr=0x%02x val=0x%02x\n", addr1, ret);
return ret;
}