@@ -12,18 +12,22 @@
#include "hw/sysbus.h"
#include "qemu/log.h"
-//#define DEBUG_PL061 1
-
-#ifdef DEBUG_PL061
-#define DPRINTF(fmt, ...) \
-do { printf("pl061: " fmt , ## __VA_ARGS__); } while (0)
-#define BADF(fmt, ...) \
-do { fprintf(stderr, "pl061: error: " fmt , ## __VA_ARGS__); exit(1);}
while (0)
-#else
-#define DPRINTF(fmt, ...) do {} while(0)
-#define BADF(fmt, ...) \
-do { fprintf(stderr, "pl061: error: " fmt , ## __VA_ARGS__);} while (0)
-#endif
+#ifndef DEBUG_PL061
+#define DEBUG_PL061 0
+#endif
+
+#define DPRINTF(fmt, ...) do { \
+ if (DEBUG_PL061) { \
+ fprintf(stderr, "pl061: " fmt , ## __VA_ARGS__); \
+ } \
+} while (0);
+
+#define BADF(fmt, ...) do { \
+ fprintf(stderr, "pl061: error: " fmt , ## __VA_ARGS__); \
+ if (DEBUG_PL061) { \
+ exit(1); \
+ } \
+} while (0);
static const uint8_t pl061_id[12] =
{ 0x00, 0x00, 0x00, 0x00, 0x61, 0x10, 0x04, 0x00, 0x0d, 0xf0, 0x05, 0xb1
};
@@ -46,9 +46,9 @@ static uint64_t puv3_gpio_read(void *opaque, hwaddr
offset,
ret = s->reg_GPIR;
break;
default:
- DPRINTF("Bad offset 0x%x\n", offset);
+ DPRINTF("Bad offset 0x%lx\n", offset);
}
- DPRINTF("offset 0x%x, value 0x%x\n", offset, ret);
+ DPRINTF("offset 0x%lx, value 0x%x\n", offset, ret);
return ret;