diff options
author | BenoƮt Canet <benoit.canet@gmail.com> | 2011-10-25 12:32:35 +0200 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2011-11-24 18:31:57 +0200 |
commit | e2ba99e9cd34a22e6d21ceb9783d0395b0a1d606 (patch) | |
tree | 1f14d34c05c0c85d183888e26828135f66064edb | |
parent | 2443fa274c49a1134625e892cd5f98f3f943ef74 (diff) |
marvell_88x8618_audio: convert to memory API
Signed-off-by: Benoit Canet <benoit.canet@gmail.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
-rw-r--r-- | hw/marvell_88w8618_audio.c | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/hw/marvell_88w8618_audio.c b/hw/marvell_88w8618_audio.c index f8c5242867..698235274d 100644 --- a/hw/marvell_88w8618_audio.c +++ b/hw/marvell_88w8618_audio.c @@ -36,6 +36,7 @@ typedef struct mv88w8618_audio_state { SysBusDevice busdev; + MemoryRegion iomem; qemu_irq irq; uint32_t playback_mode; uint32_t status; @@ -134,7 +135,8 @@ static void mv88w8618_audio_clock_update(mv88w8618_audio_state *s) wm8750_set_bclk_in(s->wm, rate); } -static uint32_t mv88w8618_audio_read(void *opaque, target_phys_addr_t offset) +static uint64_t mv88w8618_audio_read(void *opaque, target_phys_addr_t offset, + unsigned size) { mv88w8618_audio_state *s = opaque; @@ -160,7 +162,7 @@ static uint32_t mv88w8618_audio_read(void *opaque, target_phys_addr_t offset) } static void mv88w8618_audio_write(void *opaque, target_phys_addr_t offset, - uint32_t value) + uint64_t value, unsigned size) { mv88w8618_audio_state *s = opaque; @@ -227,31 +229,23 @@ static void mv88w8618_audio_reset(DeviceState *d) s->phys_buf = 0; } -static CPUReadMemoryFunc * const mv88w8618_audio_readfn[] = { - mv88w8618_audio_read, - mv88w8618_audio_read, - mv88w8618_audio_read -}; - -static CPUWriteMemoryFunc * const mv88w8618_audio_writefn[] = { - mv88w8618_audio_write, - mv88w8618_audio_write, - mv88w8618_audio_write +static const MemoryRegionOps mv88w8618_audio_ops = { + .read = mv88w8618_audio_read, + .write = mv88w8618_audio_write, + .endianness = DEVICE_NATIVE_ENDIAN, }; static int mv88w8618_audio_init(SysBusDevice *dev) { mv88w8618_audio_state *s = FROM_SYSBUS(mv88w8618_audio_state, dev); - int iomemtype; sysbus_init_irq(dev, &s->irq); wm8750_data_req_set(s->wm, mv88w8618_audio_callback, s); - iomemtype = cpu_register_io_memory(mv88w8618_audio_readfn, - mv88w8618_audio_writefn, s, - DEVICE_NATIVE_ENDIAN); - sysbus_init_mmio(dev, MP_AUDIO_SIZE, iomemtype); + memory_region_init_io(&s->iomem, &mv88w8618_audio_ops, s, + "audio", MP_AUDIO_SIZE); + sysbus_init_mmio_region(dev, &s->iomem); return 0; } |