From: "Benoît Canet" <benoit.canet@gmail.com>
To: qemu-devel@nongnu.org
Cc: "Benoît Canet" <benoit.canet@gmail.com>
Subject: [Qemu-devel] [PATCH 6/7] stellaris: convert adc to memory API
Date: Thu, 13 Oct 2011 21:45:18 +0200 [thread overview]
Message-ID: <1318535119-979-7-git-send-email-benoit.canet@gmail.com> (raw)
In-Reply-To: <1318535119-979-1-git-send-email-benoit.canet@gmail.com>
---
hw/stellaris.c | 30 ++++++++++++------------------
1 files changed, 12 insertions(+), 18 deletions(-)
diff --git a/hw/stellaris.c b/hw/stellaris.c
index 8061e74..8e1ffc6 100644
--- a/hw/stellaris.c
+++ b/hw/stellaris.c
@@ -892,6 +892,7 @@ static int stellaris_i2c_init(SysBusDevice * dev)
typedef struct
{
SysBusDevice busdev;
+ MemoryRegion iomem;
uint32_t actss;
uint32_t ris;
uint32_t im;
@@ -992,7 +993,8 @@ static void stellaris_adc_reset(stellaris_adc_state *s)
}
}
-static uint32_t stellaris_adc_read(void *opaque, target_phys_addr_t offset)
+static uint64_t stellaris_adc_read(void *opaque, target_phys_addr_t offset,
+ unsigned size)
{
stellaris_adc_state *s = (stellaris_adc_state *)opaque;
@@ -1040,7 +1042,7 @@ static uint32_t stellaris_adc_read(void *opaque, target_phys_addr_t offset)
}
static void stellaris_adc_write(void *opaque, target_phys_addr_t offset,
- uint32_t value)
+ uint64_t value, unsigned size)
{
stellaris_adc_state *s = (stellaris_adc_state *)opaque;
@@ -1054,7 +1056,7 @@ static void stellaris_adc_write(void *opaque, target_phys_addr_t offset,
return;
case 0x04: /* SSCTL */
if (value != 6) {
- hw_error("ADC: Unimplemented sequence %x\n",
+ hw_error("ADC: Unimplemented sequence %lx\n",
value);
}
s->ssctl[n] = value;
@@ -1097,16 +1099,10 @@ static void stellaris_adc_write(void *opaque, target_phys_addr_t offset,
stellaris_adc_update(s);
}
-static CPUReadMemoryFunc * const stellaris_adc_readfn[] = {
- stellaris_adc_read,
- stellaris_adc_read,
- stellaris_adc_read
-};
-
-static CPUWriteMemoryFunc * const stellaris_adc_writefn[] = {
- stellaris_adc_write,
- stellaris_adc_write,
- stellaris_adc_write
+static const MemoryRegionOps stellaris_adc_ops = {
+ .read = stellaris_adc_read,
+ .write = stellaris_adc_write,
+ .endianness = DEVICE_NATIVE_ENDIAN,
};
static const VMStateDescription vmstate_stellaris_adc = {
@@ -1147,17 +1143,15 @@ static const VMStateDescription vmstate_stellaris_adc = {
static int stellaris_adc_init(SysBusDevice *dev)
{
stellaris_adc_state *s = FROM_SYSBUS(stellaris_adc_state, dev);
- int iomemtype;
int n;
for (n = 0; n < 4; n++) {
sysbus_init_irq(dev, &s->irq[n]);
}
- iomemtype = cpu_register_io_memory(stellaris_adc_readfn,
- stellaris_adc_writefn, s,
- DEVICE_NATIVE_ENDIAN);
- sysbus_init_mmio(dev, 0x1000, iomemtype);
+ memory_region_init_io(&s->iomem, &stellaris_adc_ops, s,
+ "adc", 0x1000);
+ sysbus_init_mmio_region(dev, &s->iomem);
stellaris_adc_reset(s);
qdev_init_gpio_in(&dev->qdev, stellaris_adc_trigger, 1);
vmstate_register(&dev->qdev, -1, &vmstate_stellaris_adc, s);
--
1.7.5.4
next prev parent reply other threads:[~2011-10-13 19:55 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-13 19:45 [Qemu-devel] [PATCH] finish to convert integratorcp.c and stellaris.c to the new memory API Benoît Canet
2011-10-13 19:45 ` [Qemu-devel] [PATCH 1/7] integratorcp: convert core to " Benoît Canet
2011-10-17 14:14 ` Peter Maydell
2011-10-17 14:24 ` Avi Kivity
2011-10-13 19:45 ` [Qemu-devel] [PATCH 2/7] integratorcp: convert icp pic " Benoît Canet
2011-10-17 14:16 ` Peter Maydell
2011-10-13 19:45 ` [Qemu-devel] [PATCH 3/7] integratorcp: convert control " Benoît Canet
2011-10-17 14:17 ` Peter Maydell
2011-10-13 19:45 ` [Qemu-devel] [PATCH 4/7] stellaris: convert sys " Benoît Canet
2011-10-17 14:28 ` Peter Maydell
2011-10-13 19:45 ` [Qemu-devel] [PATCH 5/7] stellaris: convert i2c " Benoît Canet
2011-10-17 14:28 ` Peter Maydell
2011-10-13 19:45 ` Benoît Canet [this message]
2011-10-17 14:07 ` [Qemu-devel] [PATCH 6/7] stellaris: convert adc " Peter Maydell
2011-10-13 19:45 ` [Qemu-devel] [PATCH 7/7] stellaris: convert gptm " Benoît Canet
2011-10-17 14:29 ` Peter Maydell
-- strict thread matches above, loose matches on Subject: below --
2011-10-17 15:28 [Qemu-devel] [PATCH 0/7] V2. Finish to convert integratorcp and stellaris " Benoît Canet
2011-10-17 15:28 ` [Qemu-devel] [PATCH 6/7] stellaris: convert adc " Benoît Canet
2011-10-18 11:36 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1318535119-979-7-git-send-email-benoit.canet@gmail.com \
--to=benoit.canet@gmail.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).