From 8ac02ff882d48e40571c5b346ceda44dc3925f1b Mon Sep 17 00:00:00 2001 From: Blue Swirl Date: Sat, 29 May 2010 20:23:19 +0000 Subject: [PATCH] i8259: improve debugging Add a DPRINTF macro. Signed-off-by: Blue Swirl --- hw/i8259.c | 23 +++++++++++------------ 1 file 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; } -- 2.11.4.GIT