marvell_88x8618_audio: convert to memory API

Signed-off-by: Benoit Canet <benoit.canet@gmail.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
This commit is contained in:
Benoît Canet 2011-10-25 12:32:35 +02:00 committed by Avi Kivity
parent 2443fa274c
commit e2ba99e9cd

View File

@ -36,6 +36,7 @@
typedef struct mv88w8618_audio_state { typedef struct mv88w8618_audio_state {
SysBusDevice busdev; SysBusDevice busdev;
MemoryRegion iomem;
qemu_irq irq; qemu_irq irq;
uint32_t playback_mode; uint32_t playback_mode;
uint32_t status; uint32_t status;
@ -134,7 +135,8 @@ static void mv88w8618_audio_clock_update(mv88w8618_audio_state *s)
wm8750_set_bclk_in(s->wm, rate); 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; 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, 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; mv88w8618_audio_state *s = opaque;
@ -227,31 +229,23 @@ static void mv88w8618_audio_reset(DeviceState *d)
s->phys_buf = 0; s->phys_buf = 0;
} }
static CPUReadMemoryFunc * const mv88w8618_audio_readfn[] = { static const MemoryRegionOps mv88w8618_audio_ops = {
mv88w8618_audio_read, .read = mv88w8618_audio_read,
mv88w8618_audio_read, .write = mv88w8618_audio_write,
mv88w8618_audio_read .endianness = DEVICE_NATIVE_ENDIAN,
};
static CPUWriteMemoryFunc * const mv88w8618_audio_writefn[] = {
mv88w8618_audio_write,
mv88w8618_audio_write,
mv88w8618_audio_write
}; };
static int mv88w8618_audio_init(SysBusDevice *dev) static int mv88w8618_audio_init(SysBusDevice *dev)
{ {
mv88w8618_audio_state *s = FROM_SYSBUS(mv88w8618_audio_state, dev); mv88w8618_audio_state *s = FROM_SYSBUS(mv88w8618_audio_state, dev);
int iomemtype;
sysbus_init_irq(dev, &s->irq); sysbus_init_irq(dev, &s->irq);
wm8750_data_req_set(s->wm, mv88w8618_audio_callback, s); wm8750_data_req_set(s->wm, mv88w8618_audio_callback, s);
iomemtype = cpu_register_io_memory(mv88w8618_audio_readfn, memory_region_init_io(&s->iomem, &mv88w8618_audio_ops, s,
mv88w8618_audio_writefn, s, "audio", MP_AUDIO_SIZE);
DEVICE_NATIVE_ENDIAN); sysbus_init_mmio_region(dev, &s->iomem);
sysbus_init_mmio(dev, MP_AUDIO_SIZE, iomemtype);
return 0; return 0;
} }