aboutsummaryrefslogtreecommitdiff
path: root/hw/timer/arm_timer.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/timer/arm_timer.c')
-rw-r--r--hw/timer/arm_timer.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/hw/timer/arm_timer.c b/hw/timer/arm_timer.c
index 9607366d78..79117f45b0 100644
--- a/hw/timer/arm_timer.c
+++ b/hw/timer/arm_timer.c
@@ -16,6 +16,7 @@
#include "hw/qdev-properties.h"
#include "qemu/module.h"
#include "qemu/log.h"
+#include "qom/object.h"
/* Common timer implementation. */
@@ -190,9 +191,11 @@ static arm_timer_state *arm_timer_init(uint32_t freq)
*/
#define TYPE_SP804 "sp804"
-#define SP804(obj) OBJECT_CHECK(SP804State, (obj), TYPE_SP804)
+typedef struct SP804State SP804State;
+DECLARE_INSTANCE_CHECKER(SP804State, SP804,
+ TYPE_SP804)
-typedef struct SP804State {
+struct SP804State {
SysBusDevice parent_obj;
MemoryRegion iomem;
@@ -200,7 +203,7 @@ typedef struct SP804State {
uint32_t freq0, freq1;
int level[2];
qemu_irq irq;
-} SP804State;
+};
static const uint8_t sp804_ids[] = {
/* Timer ID */
@@ -310,15 +313,16 @@ static void sp804_realize(DeviceState *dev, Error **errp)
/* Integrator/CP timer module. */
#define TYPE_INTEGRATOR_PIT "integrator_pit"
-#define INTEGRATOR_PIT(obj) \
- OBJECT_CHECK(icp_pit_state, (obj), TYPE_INTEGRATOR_PIT)
+typedef struct icp_pit_state icp_pit_state;
+DECLARE_INSTANCE_CHECKER(icp_pit_state, INTEGRATOR_PIT,
+ TYPE_INTEGRATOR_PIT)
-typedef struct {
+struct icp_pit_state {
SysBusDevice parent_obj;
MemoryRegion iomem;
arm_timer_state *timer[3];
-} icp_pit_state;
+};
static uint64_t icp_pit_read(void *opaque, hwaddr offset,
unsigned size)