aboutsummaryrefslogtreecommitdiff
path: root/include/hw/timer
diff options
context:
space:
mode:
authorEduardo Habkost <ehabkost@redhat.com>2020-09-03 16:43:22 -0400
committerEduardo Habkost <ehabkost@redhat.com>2020-09-09 09:26:43 -0400
commitdb1015e92e04835c9eb50c29625fe566d1202dbd (patch)
tree41fbc0bf3e3f29b7ecb339224a049e3f2a7db8fa /include/hw/timer
parent1c8eef0227e2942264063f22f10a06b84e0d3fa9 (diff)
Move QOM typedefs and add missing includes
Some typedefs and macros are defined after the type check macros. This makes it difficult to automatically replace their definitions with OBJECT_DECLARE_TYPE. Patch generated using: $ ./scripts/codeconverter/converter.py -i \ --pattern=QOMStructTypedefSplit $(git grep -l '' -- '*.[ch]') which will split "typdef struct { ... } TypedefName" declarations. Followed by: $ ./scripts/codeconverter/converter.py -i --pattern=MoveSymbols \ $(git grep -l '' -- '*.[ch]') which will: - move the typedefs and #defines above the type check macros - add missing #include "qom/object.h" lines if necessary Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Message-Id: <20200831210740.126168-9-ehabkost@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Message-Id: <20200831210740.126168-10-ehabkost@redhat.com> Message-Id: <20200831210740.126168-11-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'include/hw/timer')
-rw-r--r--include/hw/timer/a9gtimer.h3
-rw-r--r--include/hw/timer/allwinner-a10-pit.h3
-rw-r--r--include/hw/timer/arm_mptimer.h6
-rw-r--r--include/hw/timer/armv7m_systick.h6
-rw-r--r--include/hw/timer/aspeed_timer.h13
-rw-r--r--include/hw/timer/avr_timer16.h6
-rw-r--r--include/hw/timer/bcm2835_systmr.h6
-rw-r--r--include/hw/timer/cmsdk-apb-dualtimer.h3
-rw-r--r--include/hw/timer/cmsdk-apb-timer.h6
-rw-r--r--include/hw/timer/digic-timer.h6
-rw-r--r--include/hw/timer/i8254.h1
-rw-r--r--include/hw/timer/imx_epit.h6
-rw-r--r--include/hw/timer/imx_gpt.h6
-rw-r--r--include/hw/timer/mss-timer.h6
-rw-r--r--include/hw/timer/nrf51_timer.h6
-rw-r--r--include/hw/timer/renesas_cmt.h6
-rw-r--r--include/hw/timer/renesas_tmr.h6
-rw-r--r--include/hw/timer/stm32f2xx_timer.h6
18 files changed, 67 insertions, 34 deletions
diff --git a/include/hw/timer/a9gtimer.h b/include/hw/timer/a9gtimer.h
index 81c4388784..88811c6c8f 100644
--- a/include/hw/timer/a9gtimer.h
+++ b/include/hw/timer/a9gtimer.h
@@ -24,10 +24,12 @@
#define A9GTIMER_H
#include "hw/sysbus.h"
+#include "qom/object.h"
#define A9_GTIMER_MAX_CPUS 4
#define TYPE_A9_GTIMER "arm.cortex-a9-global-timer"
+typedef struct A9GTimerState A9GTimerState;
#define A9_GTIMER(obj) OBJECT_CHECK(A9GTimerState, (obj), TYPE_A9_GTIMER)
#define R_COUNTER_LO 0x00
@@ -55,7 +57,6 @@
#define R_AUTO_INCREMENT 0x18
typedef struct A9GTimerPerCPU A9GTimerPerCPU;
-typedef struct A9GTimerState A9GTimerState;
struct A9GTimerPerCPU {
A9GTimerState *parent;
diff --git a/include/hw/timer/allwinner-a10-pit.h b/include/hw/timer/allwinner-a10-pit.h
index 871c95b512..fa060c684d 100644
--- a/include/hw/timer/allwinner-a10-pit.h
+++ b/include/hw/timer/allwinner-a10-pit.h
@@ -3,8 +3,10 @@
#include "hw/ptimer.h"
#include "hw/sysbus.h"
+#include "qom/object.h"
#define TYPE_AW_A10_PIT "allwinner-A10-timer"
+typedef struct AwA10PITState AwA10PITState;
#define AW_A10_PIT(obj) OBJECT_CHECK(AwA10PITState, (obj), TYPE_AW_A10_PIT)
#define AW_A10_PIT_TIMER_NR 6
@@ -36,7 +38,6 @@
#define AW_A10_PIT_DEFAULT_CLOCK 0x4
-typedef struct AwA10PITState AwA10PITState;
typedef struct AwA10TimerContext {
AwA10PITState *container;
diff --git a/include/hw/timer/arm_mptimer.h b/include/hw/timer/arm_mptimer.h
index c46d8d2309..643a256ecf 100644
--- a/include/hw/timer/arm_mptimer.h
+++ b/include/hw/timer/arm_mptimer.h
@@ -22,6 +22,7 @@
#define HW_TIMER_ARM_MPTIMER_H
#include "hw/sysbus.h"
+#include "qom/object.h"
#define ARM_MPTIMER_MAX_CPUS 4
@@ -35,10 +36,11 @@ typedef struct {
} TimerBlock;
#define TYPE_ARM_MPTIMER "arm_mptimer"
+typedef struct ARMMPTimerState ARMMPTimerState;
#define ARM_MPTIMER(obj) \
OBJECT_CHECK(ARMMPTimerState, (obj), TYPE_ARM_MPTIMER)
-typedef struct {
+struct ARMMPTimerState {
/*< private >*/
SysBusDevice parent_obj;
/*< public >*/
@@ -46,6 +48,6 @@ typedef struct {
uint32_t num_cpu;
TimerBlock timerblock[ARM_MPTIMER_MAX_CPUS];
MemoryRegion iomem;
-} ARMMPTimerState;
+};
#endif
diff --git a/include/hw/timer/armv7m_systick.h b/include/hw/timer/armv7m_systick.h
index 25e5ceacc8..33df057958 100644
--- a/include/hw/timer/armv7m_systick.h
+++ b/include/hw/timer/armv7m_systick.h
@@ -13,12 +13,14 @@
#define HW_TIMER_ARMV7M_SYSTICK_H
#include "hw/sysbus.h"
+#include "qom/object.h"
#define TYPE_SYSTICK "armv7m_systick"
+typedef struct SysTickState SysTickState;
#define SYSTICK(obj) OBJECT_CHECK(SysTickState, (obj), TYPE_SYSTICK)
-typedef struct SysTickState {
+struct SysTickState {
/*< private >*/
SysBusDevice parent_obj;
/*< public >*/
@@ -29,7 +31,7 @@ typedef struct SysTickState {
QEMUTimer *timer;
MemoryRegion iomem;
qemu_irq irq;
-} SysTickState;
+};
/*
* Multiplication factor to convert from system clock ticks to qemu timer
diff --git a/include/hw/timer/aspeed_timer.h b/include/hw/timer/aspeed_timer.h
index d7c7d8ad28..c890aaa949 100644
--- a/include/hw/timer/aspeed_timer.h
+++ b/include/hw/timer/aspeed_timer.h
@@ -24,10 +24,13 @@
#include "qemu/timer.h"
#include "hw/misc/aspeed_scu.h"
+#include "qom/object.h"
+#define TYPE_ASPEED_TIMER "aspeed.timer"
+typedef struct AspeedTimerClass AspeedTimerClass;
+typedef struct AspeedTimerCtrlState AspeedTimerCtrlState;
#define ASPEED_TIMER(obj) \
OBJECT_CHECK(AspeedTimerCtrlState, (obj), TYPE_ASPEED_TIMER)
-#define TYPE_ASPEED_TIMER "aspeed.timer"
#define TYPE_ASPEED_2400_TIMER TYPE_ASPEED_TIMER "-ast2400"
#define TYPE_ASPEED_2500_TIMER TYPE_ASPEED_TIMER "-ast2500"
#define TYPE_ASPEED_2600_TIMER TYPE_ASPEED_TIMER "-ast2600"
@@ -50,7 +53,7 @@ typedef struct AspeedTimer {
uint64_t start;
} AspeedTimer;
-typedef struct AspeedTimerCtrlState {
+struct AspeedTimerCtrlState {
/*< private >*/
SysBusDevice parent;
@@ -64,18 +67,18 @@ typedef struct AspeedTimerCtrlState {
AspeedTimer timers[ASPEED_TIMER_NR_TIMERS];
AspeedSCUState *scu;
-} AspeedTimerCtrlState;
+};
#define ASPEED_TIMER_CLASS(klass) \
OBJECT_CLASS_CHECK(AspeedTimerClass, (klass), TYPE_ASPEED_TIMER)
#define ASPEED_TIMER_GET_CLASS(obj) \
OBJECT_GET_CLASS(AspeedTimerClass, (obj), TYPE_ASPEED_TIMER)
-typedef struct AspeedTimerClass {
+struct AspeedTimerClass {
SysBusDeviceClass parent_class;
uint64_t (*read)(AspeedTimerCtrlState *s, hwaddr offset);
void (*write)(AspeedTimerCtrlState *s, hwaddr offset, uint64_t value);
-} AspeedTimerClass;
+};
#endif /* ASPEED_TIMER_H */
diff --git a/include/hw/timer/avr_timer16.h b/include/hw/timer/avr_timer16.h
index 982019d242..9efe75ce5e 100644
--- a/include/hw/timer/avr_timer16.h
+++ b/include/hw/timer/avr_timer16.h
@@ -31,6 +31,7 @@
#include "hw/sysbus.h"
#include "qemu/timer.h"
#include "hw/hw.h"
+#include "qom/object.h"
enum NextInterrupt {
OVERFLOW,
@@ -41,10 +42,11 @@ enum NextInterrupt {
};
#define TYPE_AVR_TIMER16 "avr-timer16"
+typedef struct AVRTimer16State AVRTimer16State;
#define AVR_TIMER16(obj) \
OBJECT_CHECK(AVRTimer16State, (obj), TYPE_AVR_TIMER16)
-typedef struct AVRTimer16State {
+struct AVRTimer16State {
/* <private> */
SysBusDevice parent_obj;
@@ -89,6 +91,6 @@ typedef struct AVRTimer16State {
uint64_t period_ns;
uint64_t reset_time_ns;
enum NextInterrupt next_interrupt;
-} AVRTimer16State;
+};
#endif /* HW_TIMER_AVR_TIMER16_H */
diff --git a/include/hw/timer/bcm2835_systmr.h b/include/hw/timer/bcm2835_systmr.h
index c0bc5c8127..796f62cf88 100644
--- a/include/hw/timer/bcm2835_systmr.h
+++ b/include/hw/timer/bcm2835_systmr.h
@@ -11,12 +11,14 @@
#include "hw/sysbus.h"
#include "hw/irq.h"
+#include "qom/object.h"
#define TYPE_BCM2835_SYSTIMER "bcm2835-sys-timer"
+typedef struct BCM2835SystemTimerState BCM2835SystemTimerState;
#define BCM2835_SYSTIMER(obj) \
OBJECT_CHECK(BCM2835SystemTimerState, (obj), TYPE_BCM2835_SYSTIMER)
-typedef struct {
+struct BCM2835SystemTimerState {
/*< private >*/
SysBusDevice parent_obj;
@@ -28,6 +30,6 @@ typedef struct {
uint32_t status;
uint32_t compare[4];
} reg;
-} BCM2835SystemTimerState;
+};
#endif
diff --git a/include/hw/timer/cmsdk-apb-dualtimer.h b/include/hw/timer/cmsdk-apb-dualtimer.h
index 9843a9dbb1..8a1137aec7 100644
--- a/include/hw/timer/cmsdk-apb-dualtimer.h
+++ b/include/hw/timer/cmsdk-apb-dualtimer.h
@@ -28,12 +28,13 @@
#include "hw/sysbus.h"
#include "hw/ptimer.h"
+#include "qom/object.h"
#define TYPE_CMSDK_APB_DUALTIMER "cmsdk-apb-dualtimer"
+typedef struct CMSDKAPBDualTimer CMSDKAPBDualTimer;
#define CMSDK_APB_DUALTIMER(obj) OBJECT_CHECK(CMSDKAPBDualTimer, (obj), \
TYPE_CMSDK_APB_DUALTIMER)
-typedef struct CMSDKAPBDualTimer CMSDKAPBDualTimer;
/* One of the two identical timer modules in the dual-timer module */
typedef struct CMSDKAPBDualTimerModule {
diff --git a/include/hw/timer/cmsdk-apb-timer.h b/include/hw/timer/cmsdk-apb-timer.h
index f24bda6a46..a7ca523529 100644
--- a/include/hw/timer/cmsdk-apb-timer.h
+++ b/include/hw/timer/cmsdk-apb-timer.h
@@ -15,12 +15,14 @@
#include "hw/qdev-properties.h"
#include "hw/sysbus.h"
#include "hw/ptimer.h"
+#include "qom/object.h"
#define TYPE_CMSDK_APB_TIMER "cmsdk-apb-timer"
+typedef struct CMSDKAPBTIMER CMSDKAPBTIMER;
#define CMSDK_APB_TIMER(obj) OBJECT_CHECK(CMSDKAPBTIMER, (obj), \
TYPE_CMSDK_APB_TIMER)
-typedef struct {
+struct CMSDKAPBTIMER {
/*< private >*/
SysBusDevice parent_obj;
@@ -34,7 +36,7 @@ typedef struct {
uint32_t value;
uint32_t reload;
uint32_t intstatus;
-} CMSDKAPBTIMER;
+};
/**
* cmsdk_apb_timer_create - convenience function to create TYPE_CMSDK_APB_TIMER
diff --git a/include/hw/timer/digic-timer.h b/include/hw/timer/digic-timer.h
index d9e67fe291..543bf8c6be 100644
--- a/include/hw/timer/digic-timer.h
+++ b/include/hw/timer/digic-timer.h
@@ -20,8 +20,10 @@
#include "hw/sysbus.h"
#include "hw/ptimer.h"
+#include "qom/object.h"
#define TYPE_DIGIC_TIMER "digic-timer"
+typedef struct DigicTimerState DigicTimerState;
#define DIGIC_TIMER(obj) OBJECT_CHECK(DigicTimerState, (obj), TYPE_DIGIC_TIMER)
#define DIGIC_TIMER_CONTROL 0x00
@@ -30,7 +32,7 @@
#define DIGIC_TIMER_RELVALUE 0x08
#define DIGIC_TIMER_VALUE 0x0c
-typedef struct DigicTimerState {
+struct DigicTimerState {
/*< private >*/
SysBusDevice parent_obj;
/*< public >*/
@@ -40,6 +42,6 @@ typedef struct DigicTimerState {
uint32_t control;
uint32_t relvalue;
-} DigicTimerState;
+};
#endif /* HW_TIMER_DIGIC_TIMER_H */
diff --git a/include/hw/timer/i8254.h b/include/hw/timer/i8254.h
index 206b8f8464..6adbc31e7e 100644
--- a/include/hw/timer/i8254.h
+++ b/include/hw/timer/i8254.h
@@ -28,6 +28,7 @@
#include "hw/qdev-properties.h"
#include "hw/isa/isa.h"
#include "qapi/error.h"
+#include "qom/object.h"
#define PIT_FREQ 1193182
diff --git a/include/hw/timer/imx_epit.h b/include/hw/timer/imx_epit.h
index 0730ac35e6..1ca110caf5 100644
--- a/include/hw/timer/imx_epit.h
+++ b/include/hw/timer/imx_epit.h
@@ -32,6 +32,7 @@
#include "hw/sysbus.h"
#include "hw/ptimer.h"
#include "hw/misc/imx_ccm.h"
+#include "qom/object.h"
/*
* EPIT: Enhanced periodic interrupt timer
@@ -55,9 +56,10 @@
#define EPIT_TIMER_MAX 0XFFFFFFFFUL
#define TYPE_IMX_EPIT "imx.epit"
+typedef struct IMXEPITState IMXEPITState;
#define IMX_EPIT(obj) OBJECT_CHECK(IMXEPITState, (obj), TYPE_IMX_EPIT)
-typedef struct IMXEPITState{
+struct IMXEPITState {
/*< private >*/
SysBusDevice parent_obj;
@@ -75,6 +77,6 @@ typedef struct IMXEPITState{
uint32_t freq;
qemu_irq irq;
-} IMXEPITState;
+};
#endif /* IMX_EPIT_H */
diff --git a/include/hw/timer/imx_gpt.h b/include/hw/timer/imx_gpt.h
index 20ccb327c4..b96633d8b2 100644
--- a/include/hw/timer/imx_gpt.h
+++ b/include/hw/timer/imx_gpt.h
@@ -32,6 +32,7 @@
#include "hw/sysbus.h"
#include "hw/ptimer.h"
#include "hw/misc/imx_ccm.h"
+#include "qom/object.h"
/*
* GPT : General purpose timer
@@ -81,9 +82,10 @@
#define TYPE_IMX_GPT TYPE_IMX25_GPT
+typedef struct IMXGPTState IMXGPTState;
#define IMX_GPT(obj) OBJECT_CHECK(IMXGPTState, (obj), TYPE_IMX_GPT)
-typedef struct IMXGPTState{
+struct IMXGPTState {
/*< private >*/
SysBusDevice parent_obj;
@@ -111,6 +113,6 @@ typedef struct IMXGPTState{
qemu_irq irq;
const IMXClk *clocks;
-} IMXGPTState;
+};
#endif /* IMX_GPT_H */
diff --git a/include/hw/timer/mss-timer.h b/include/hw/timer/mss-timer.h
index e5a784b27e..011c5f1ba9 100644
--- a/include/hw/timer/mss-timer.h
+++ b/include/hw/timer/mss-timer.h
@@ -27,8 +27,10 @@
#include "hw/sysbus.h"
#include "hw/ptimer.h"
+#include "qom/object.h"
#define TYPE_MSS_TIMER "mss-timer"
+typedef struct MSSTimerState MSSTimerState;
#define MSS_TIMER(obj) OBJECT_CHECK(MSSTimerState, \
(obj), TYPE_MSS_TIMER)
@@ -52,12 +54,12 @@ struct Msf2Timer {
qemu_irq irq;
};
-typedef struct MSSTimerState {
+struct MSSTimerState {
SysBusDevice parent_obj;
MemoryRegion mmio;
uint32_t freq_hz;
struct Msf2Timer timers[NUM_TIMERS];
-} MSSTimerState;
+};
#endif /* HW_MSS_TIMER_H */
diff --git a/include/hw/timer/nrf51_timer.h b/include/hw/timer/nrf51_timer.h
index eb6815f21d..b4eb29bd76 100644
--- a/include/hw/timer/nrf51_timer.h
+++ b/include/hw/timer/nrf51_timer.h
@@ -15,7 +15,9 @@
#include "hw/sysbus.h"
#include "qemu/timer.h"
+#include "qom/object.h"
#define TYPE_NRF51_TIMER "nrf51_soc.timer"
+typedef struct NRF51TimerState NRF51TimerState;
#define NRF51_TIMER(obj) OBJECT_CHECK(NRF51TimerState, (obj), TYPE_NRF51_TIMER)
#define NRF51_TIMER_REG_COUNT 4
@@ -53,7 +55,7 @@
#define NRF51_TIMER_REG_CC0 0x540
#define NRF51_TIMER_REG_CC3 0x54C
-typedef struct NRF51TimerState {
+struct NRF51TimerState {
SysBusDevice parent_obj;
MemoryRegion iomem;
@@ -75,7 +77,7 @@ typedef struct NRF51TimerState {
uint32_t bitmode;
uint32_t prescaler;
-} NRF51TimerState;
+};
#endif
diff --git a/include/hw/timer/renesas_cmt.h b/include/hw/timer/renesas_cmt.h
index e28a15cb38..313f9e1965 100644
--- a/include/hw/timer/renesas_cmt.h
+++ b/include/hw/timer/renesas_cmt.h
@@ -11,8 +11,10 @@
#include "qemu/timer.h"
#include "hw/sysbus.h"
+#include "qom/object.h"
#define TYPE_RENESAS_CMT "renesas-cmt"
+typedef struct RCMTState RCMTState;
#define RCMT(obj) OBJECT_CHECK(RCMTState, (obj), TYPE_RENESAS_CMT)
enum {
@@ -20,7 +22,7 @@ enum {
CMT_NR_IRQ = 1 * CMT_CH
};
-typedef struct RCMTState {
+struct RCMTState {
/*< private >*/
SysBusDevice parent_obj;
/*< public >*/
@@ -35,6 +37,6 @@ typedef struct RCMTState {
int64_t tick[CMT_CH];
qemu_irq cmi[CMT_CH];
QEMUTimer timer[CMT_CH];
-} RCMTState;
+};
#endif
diff --git a/include/hw/timer/renesas_tmr.h b/include/hw/timer/renesas_tmr.h
index cf3baa7a28..e2abcb13ad 100644
--- a/include/hw/timer/renesas_tmr.h
+++ b/include/hw/timer/renesas_tmr.h
@@ -11,8 +11,10 @@
#include "qemu/timer.h"
#include "hw/sysbus.h"
+#include "qom/object.h"
#define TYPE_RENESAS_TMR "renesas-tmr"
+typedef struct RTMRState RTMRState;
#define RTMR(obj) OBJECT_CHECK(RTMRState, (obj), TYPE_RENESAS_TMR)
enum timer_event {
@@ -28,7 +30,7 @@ enum {
TMR_NR_IRQ = 3 * TMR_CH
};
-typedef struct RTMRState {
+struct RTMRState {
/*< private >*/
SysBusDevice parent_obj;
/*< public >*/
@@ -50,6 +52,6 @@ typedef struct RTMRState {
qemu_irq cmib[TMR_CH];
qemu_irq ovi[TMR_CH];
QEMUTimer timer[TMR_CH];
-} RTMRState;
+};
#endif
diff --git a/include/hw/timer/stm32f2xx_timer.h b/include/hw/timer/stm32f2xx_timer.h
index a96bc08b1b..9eb9201085 100644
--- a/include/hw/timer/stm32f2xx_timer.h
+++ b/include/hw/timer/stm32f2xx_timer.h
@@ -27,6 +27,7 @@
#include "hw/sysbus.h"
#include "qemu/timer.h"
+#include "qom/object.h"
#define TIM_CR1 0x00
#define TIM_CR2 0x04
@@ -61,10 +62,11 @@
#define TIM_DIER_UIE 1
#define TYPE_STM32F2XX_TIMER "stm32f2xx-timer"
+typedef struct STM32F2XXTimerState STM32F2XXTimerState;
#define STM32F2XXTIMER(obj) OBJECT_CHECK(STM32F2XXTimerState, \
(obj), TYPE_STM32F2XX_TIMER)
-typedef struct STM32F2XXTimerState {
+struct STM32F2XXTimerState {
/* <private> */
SysBusDevice parent_obj;
@@ -95,6 +97,6 @@ typedef struct STM32F2XXTimerState {
uint32_t tim_dcr;
uint32_t tim_dmar;
uint32_t tim_or;
-} STM32F2XXTimerState;
+};
#endif /* HW_STM32F2XX_TIMER_H */