summaryrefslogtreecommitdiff
path: root/hw
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
commit7d20f427ebaab3dec15de6689a89146d9cae54c0 (patch)
tree9f44242d57dde85c3785183e2f61569e24c99448 /hw
parentf5407bae297f0db0e453872d7de1e4a8f4da77b5 (diff)
downloadqemu-7d20f427ebaab3dec15de6689a89146d9cae54c0.tar.gz
qemu-7d20f427ebaab3dec15de6689a89146d9cae54c0.tar.bz2
qemu-7d20f427ebaab3dec15de6689a89146d9cae54c0.zip
i8259: improve debugging
Add a DPRINTF macro. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/i8259.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/hw/i8259.c b/hw/i8259.c
index ea48e0e045..a99528059e 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;
}