aboutsummaryrefslogtreecommitdiff
path: root/hw/timer
diff options
context:
space:
mode:
Diffstat (limited to 'hw/timer')
-rw-r--r--hw/timer/omap_gptimer.c22
-rw-r--r--hw/timer/omap_synctimer.c4
-rw-r--r--hw/timer/xilinx_timer.c27
3 files changed, 25 insertions, 28 deletions
diff --git a/hw/timer/omap_gptimer.c b/hw/timer/omap_gptimer.c
index c407190..34e6af7 100644
--- a/hw/timer/omap_gptimer.c
+++ b/hw/timer/omap_gptimer.c
@@ -159,7 +159,7 @@ static inline void omap_gp_timer_trigger(struct omap_gp_timer_s *timer)
static void omap_gp_timer_tick(void *opaque)
{
- struct omap_gp_timer_s *timer = (struct omap_gp_timer_s *) opaque;
+ struct omap_gp_timer_s *timer = opaque;
if (!timer->ar) {
timer->st = 0;
@@ -179,7 +179,7 @@ static void omap_gp_timer_tick(void *opaque)
static void omap_gp_timer_match(void *opaque)
{
- struct omap_gp_timer_s *timer = (struct omap_gp_timer_s *) opaque;
+ struct omap_gp_timer_s *timer = opaque;
if (timer->trigger == gpt_trigger_both)
omap_gp_timer_trigger(timer);
@@ -189,7 +189,7 @@ static void omap_gp_timer_match(void *opaque)
static void omap_gp_timer_input(void *opaque, int line, int on)
{
- struct omap_gp_timer_s *s = (struct omap_gp_timer_s *) opaque;
+ struct omap_gp_timer_s *s = opaque;
int trigger;
switch (s->capture) {
@@ -219,7 +219,7 @@ static void omap_gp_timer_input(void *opaque, int line, int on)
static void omap_gp_timer_clk_update(void *opaque, int line, int on)
{
- struct omap_gp_timer_s *timer = (struct omap_gp_timer_s *) opaque;
+ struct omap_gp_timer_s *timer = opaque;
omap_gp_timer_sync(timer);
timer->rate = on ? omap_clk_getrate(timer->clk) : 0;
@@ -262,7 +262,7 @@ void omap_gp_timer_reset(struct omap_gp_timer_s *s)
static uint32_t omap_gp_timer_readw(void *opaque, hwaddr addr)
{
- struct omap_gp_timer_s *s = (struct omap_gp_timer_s *) opaque;
+ struct omap_gp_timer_s *s = opaque;
switch (addr) {
case 0x00: /* TIDR */
@@ -328,7 +328,7 @@ static uint32_t omap_gp_timer_readw(void *opaque, hwaddr addr)
static uint32_t omap_gp_timer_readh(void *opaque, hwaddr addr)
{
- struct omap_gp_timer_s *s = (struct omap_gp_timer_s *) opaque;
+ struct omap_gp_timer_s *s = opaque;
uint32_t ret;
if (addr & 2)
@@ -340,10 +340,9 @@ static uint32_t omap_gp_timer_readh(void *opaque, hwaddr addr)
}
}
-static void omap_gp_timer_write(void *opaque, hwaddr addr,
- uint32_t value)
+static void omap_gp_timer_write(void *opaque, hwaddr addr, uint32_t value)
{
- struct omap_gp_timer_s *s = (struct omap_gp_timer_s *) opaque;
+ struct omap_gp_timer_s *s = opaque;
switch (addr) {
case 0x00: /* TIDR */
@@ -440,10 +439,9 @@ static void omap_gp_timer_write(void *opaque, hwaddr addr,
}
}
-static void omap_gp_timer_writeh(void *opaque, hwaddr addr,
- uint32_t value)
+static void omap_gp_timer_writeh(void *opaque, hwaddr addr, uint32_t value)
{
- struct omap_gp_timer_s *s = (struct omap_gp_timer_s *) opaque;
+ struct omap_gp_timer_s *s = opaque;
if (addr & 2)
omap_gp_timer_write(opaque, addr, (value << 16) | s->writeh);
diff --git a/hw/timer/omap_synctimer.c b/hw/timer/omap_synctimer.c
index 72b9979..d93a934 100644
--- a/hw/timer/omap_synctimer.c
+++ b/hw/timer/omap_synctimer.c
@@ -39,7 +39,7 @@ void omap_synctimer_reset(struct omap_synctimer_s *s)
static uint32_t omap_synctimer_readw(void *opaque, hwaddr addr)
{
- struct omap_synctimer_s *s = (struct omap_synctimer_s *) opaque;
+ struct omap_synctimer_s *s = opaque;
switch (addr) {
case 0x00: /* 32KSYNCNT_REV */
@@ -55,7 +55,7 @@ static uint32_t omap_synctimer_readw(void *opaque, hwaddr addr)
static uint32_t omap_synctimer_readh(void *opaque, hwaddr addr)
{
- struct omap_synctimer_s *s = (struct omap_synctimer_s *) opaque;
+ struct omap_synctimer_s *s = opaque;
uint32_t ret;
if (addr & 2)
diff --git a/hw/timer/xilinx_timer.c b/hw/timer/xilinx_timer.c
index c7f17cd..32a9df6 100644
--- a/hw/timer/xilinx_timer.c
+++ b/hw/timer/xilinx_timer.c
@@ -62,10 +62,10 @@ struct xlx_timer
};
#define TYPE_XILINX_TIMER "xlnx.xps-timer"
-DECLARE_INSTANCE_CHECKER(struct timerblock, XILINX_TIMER,
- TYPE_XILINX_TIMER)
+typedef struct XpsTimerState XpsTimerState;
+DECLARE_INSTANCE_CHECKER(XpsTimerState, XILINX_TIMER, TYPE_XILINX_TIMER)
-struct timerblock
+struct XpsTimerState
{
SysBusDevice parent_obj;
@@ -76,7 +76,7 @@ struct timerblock
struct xlx_timer *timers;
};
-static inline unsigned int num_timers(struct timerblock *t)
+static inline unsigned int num_timers(XpsTimerState *t)
{
return 2 - t->one_timer_only;
}
@@ -87,7 +87,7 @@ static inline unsigned int timer_from_addr(hwaddr addr)
return addr >> 2;
}
-static void timer_update_irq(struct timerblock *t)
+static void timer_update_irq(XpsTimerState *t)
{
unsigned int i, irq = 0;
uint32_t csr;
@@ -104,7 +104,7 @@ static void timer_update_irq(struct timerblock *t)
static uint64_t
timer_read(void *opaque, hwaddr addr, unsigned int size)
{
- struct timerblock *t = opaque;
+ XpsTimerState *t = opaque;
struct xlx_timer *xt;
uint32_t r = 0;
unsigned int timer;
@@ -155,7 +155,7 @@ static void
timer_write(void *opaque, hwaddr addr,
uint64_t val64, unsigned int size)
{
- struct timerblock *t = opaque;
+ XpsTimerState *t = opaque;
struct xlx_timer *xt;
unsigned int timer;
uint32_t value = val64;
@@ -202,7 +202,7 @@ static const MemoryRegionOps timer_ops = {
static void timer_hit(void *opaque)
{
struct xlx_timer *xt = opaque;
- struct timerblock *t = xt->parent;
+ XpsTimerState *t = xt->parent;
D(fprintf(stderr, "%s %d\n", __func__, xt->nr));
xt->regs[R_TCSR] |= TCSR_TINT;
@@ -213,7 +213,7 @@ static void timer_hit(void *opaque)
static void xilinx_timer_realize(DeviceState *dev, Error **errp)
{
- struct timerblock *t = XILINX_TIMER(dev);
+ XpsTimerState *t = XILINX_TIMER(dev);
unsigned int i;
/* Init all the ptimers. */
@@ -236,16 +236,15 @@ static void xilinx_timer_realize(DeviceState *dev, Error **errp)
static void xilinx_timer_init(Object *obj)
{
- struct timerblock *t = XILINX_TIMER(obj);
+ XpsTimerState *t = XILINX_TIMER(obj);
/* All timers share a single irq line. */
sysbus_init_irq(SYS_BUS_DEVICE(obj), &t->irq);
}
static Property xilinx_timer_properties[] = {
- DEFINE_PROP_UINT32("clock-frequency", struct timerblock, freq_hz,
- 62 * 1000000),
- DEFINE_PROP_UINT8("one-timer-only", struct timerblock, one_timer_only, 0),
+ DEFINE_PROP_UINT32("clock-frequency", XpsTimerState, freq_hz, 62 * 1000000),
+ DEFINE_PROP_UINT8("one-timer-only", XpsTimerState, one_timer_only, 0),
DEFINE_PROP_END_OF_LIST(),
};
@@ -260,7 +259,7 @@ static void xilinx_timer_class_init(ObjectClass *klass, void *data)
static const TypeInfo xilinx_timer_info = {
.name = TYPE_XILINX_TIMER,
.parent = TYPE_SYS_BUS_DEVICE,
- .instance_size = sizeof(struct timerblock),
+ .instance_size = sizeof(XpsTimerState),
.instance_init = xilinx_timer_init,
.class_init = xilinx_timer_class_init,
};