mirror of https://github.com/xemu-project/xemu.git
omap_synctimer: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
This commit is contained in:
parent
0a9ee1a7d5
commit
fcb40162bf
|
@ -21,6 +21,7 @@
|
||||||
#include "qemu-timer.h"
|
#include "qemu-timer.h"
|
||||||
#include "omap.h"
|
#include "omap.h"
|
||||||
struct omap_synctimer_s {
|
struct omap_synctimer_s {
|
||||||
|
MemoryRegion iomem;
|
||||||
uint32_t val;
|
uint32_t val;
|
||||||
uint16_t readh;
|
uint16_t readh;
|
||||||
};
|
};
|
||||||
|
@ -65,22 +66,26 @@ static uint32_t omap_synctimer_readh(void *opaque, target_phys_addr_t addr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static CPUReadMemoryFunc * const omap_synctimer_readfn[] = {
|
|
||||||
omap_badwidth_read32,
|
|
||||||
omap_synctimer_readh,
|
|
||||||
omap_synctimer_readw,
|
|
||||||
};
|
|
||||||
|
|
||||||
static void omap_synctimer_write(void *opaque, target_phys_addr_t addr,
|
static void omap_synctimer_write(void *opaque, target_phys_addr_t addr,
|
||||||
uint32_t value)
|
uint32_t value)
|
||||||
{
|
{
|
||||||
OMAP_BAD_REG(addr);
|
OMAP_BAD_REG(addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static CPUWriteMemoryFunc * const omap_synctimer_writefn[] = {
|
static const MemoryRegionOps omap_synctimer_ops = {
|
||||||
omap_badwidth_write32,
|
.old_mmio = {
|
||||||
omap_synctimer_write,
|
.read = {
|
||||||
omap_synctimer_write,
|
omap_badwidth_read32,
|
||||||
|
omap_synctimer_readh,
|
||||||
|
omap_synctimer_readw,
|
||||||
|
},
|
||||||
|
.write = {
|
||||||
|
omap_badwidth_write32,
|
||||||
|
omap_synctimer_write,
|
||||||
|
omap_synctimer_write,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
.endianness = DEVICE_NATIVE_ENDIAN,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct omap_synctimer_s *omap_synctimer_init(struct omap_target_agent_s *ta,
|
struct omap_synctimer_s *omap_synctimer_init(struct omap_target_agent_s *ta,
|
||||||
|
@ -89,9 +94,9 @@ struct omap_synctimer_s *omap_synctimer_init(struct omap_target_agent_s *ta,
|
||||||
struct omap_synctimer_s *s = g_malloc0(sizeof(*s));
|
struct omap_synctimer_s *s = g_malloc0(sizeof(*s));
|
||||||
|
|
||||||
omap_synctimer_reset(s);
|
omap_synctimer_reset(s);
|
||||||
omap_l4_attach(ta, 0, cpu_register_io_memory(
|
memory_region_init_io(&s->iomem, &omap_synctimer_ops, s, "omap.synctimer",
|
||||||
omap_synctimer_readfn, omap_synctimer_writefn, s,
|
omap_l4_region_size(ta, 0));
|
||||||
DEVICE_NATIVE_ENDIAN));
|
omap_l4_attach_region(ta, 0, &s->iomem);
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue