mirror of https://gitee.com/openkylin/qemu.git
es1370: convert PIO to new memory api read/write
Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
parent
df6db5b32a
commit
f3726fd78d
46
hw/es1370.c
46
hw/es1370.c
|
@ -908,18 +908,44 @@ static void es1370_adc_callback (void *opaque, int avail)
|
||||||
es1370_run_channel (s, ADC_CHANNEL, avail);
|
es1370_run_channel (s, ADC_CHANNEL, avail);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const MemoryRegionPortio es1370_portio[] = {
|
static uint64_t es1370_read(void *opaque, hwaddr addr,
|
||||||
{ 0, 0x40 * 4, 1, .write = es1370_writeb, },
|
unsigned size)
|
||||||
{ 0, 0x40 * 2, 2, .write = es1370_writew, },
|
{
|
||||||
{ 0, 0x40, 4, .write = es1370_writel, },
|
switch (size) {
|
||||||
{ 0, 0x40 * 4, 1, .read = es1370_readb, },
|
case 1:
|
||||||
{ 0, 0x40 * 2, 2, .read = es1370_readw, },
|
return es1370_readb(opaque, addr);
|
||||||
{ 0, 0x40, 4, .read = es1370_readl, },
|
case 2:
|
||||||
PORTIO_END_OF_LIST ()
|
return es1370_readw(opaque, addr);
|
||||||
};
|
case 4:
|
||||||
|
return es1370_readl(opaque, addr);
|
||||||
|
default:
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void es1370_write(void *opaque, hwaddr addr, uint64_t val,
|
||||||
|
unsigned size)
|
||||||
|
{
|
||||||
|
switch (size) {
|
||||||
|
case 1:
|
||||||
|
es1370_writeb(opaque, addr, val);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
es1370_writew(opaque, addr, val);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
es1370_writel(opaque, addr, val);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static const MemoryRegionOps es1370_io_ops = {
|
static const MemoryRegionOps es1370_io_ops = {
|
||||||
.old_portio = es1370_portio,
|
.read = es1370_read,
|
||||||
|
.write = es1370_write,
|
||||||
|
.impl = {
|
||||||
|
.min_access_size = 1,
|
||||||
|
.max_access_size = 4,
|
||||||
|
},
|
||||||
.endianness = DEVICE_LITTLE_ENDIAN,
|
.endianness = DEVICE_LITTLE_ENDIAN,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue