summaryrefslogtreecommitdiff
path: root/hw/max111x.c
diff options
context:
space:
mode:
authorbalrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162>2007-05-24 18:50:09 +0000
committerbalrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162>2007-05-24 18:50:09 +0000
commitaa941b944500bf77f0bdbfa0a7112b4e89670ff1 (patch)
tree59f1c3e46b42022a3966e108752ca92531169380 /hw/max111x.c
parent3f6c925f37cd8a1dddb8a8fbbcef4630ea347775 (diff)
Savevm/loadvm bits for ARM core, the PXA2xx peripherals and Spitz hardware.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2857 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/max111x.c')
-rw-r--r--hw/max111x.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/hw/max111x.c b/hw/max111x.c
index 69019de7a..8425bee57 100644
--- a/hw/max111x.c
+++ b/hw/max111x.c
@@ -89,6 +89,39 @@ void max111x_write(void *opaque, uint32_t value)
qemu_irq_raise(s->interrupt);
}
+static void max111x_save(QEMUFile *f, void *opaque)
+{
+ struct max111x_s *s = (struct max111x_s *) opaque;
+ int i;
+
+ qemu_put_8s(f, &s->tb1);
+ qemu_put_8s(f, &s->rb2);
+ qemu_put_8s(f, &s->rb3);
+ qemu_put_be32(f, s->inputs);
+ qemu_put_be32(f, s->com);
+ for (i = 0; i < s->inputs; i ++)
+ qemu_put_byte(f, s->input[i]);
+}
+
+static int max111x_load(QEMUFile *f, void *opaque, int version_id)
+{
+ struct max111x_s *s = (struct max111x_s *) opaque;
+ int i;
+
+ qemu_get_8s(f, &s->tb1);
+ qemu_get_8s(f, &s->rb2);
+ qemu_get_8s(f, &s->rb3);
+ if (s->inputs != qemu_get_be32(f))
+ return -EINVAL;
+ s->com = qemu_get_be32(f);
+ for (i = 0; i < s->inputs; i ++)
+ s->input[i] = qemu_get_byte(f);
+
+ return 0;
+}
+
+static int max111x_iid = 0;
+
static struct max111x_s *max111x_init(qemu_irq cb)
{
struct max111x_s *s;
@@ -108,6 +141,10 @@ static struct max111x_s *max111x_init(qemu_irq cb)
s->input[6] = 0x90;
s->input[7] = 0x80;
s->com = 0;
+
+ register_savevm("max111x", max111x_iid ++, 0,
+ max111x_save, max111x_load, s);
+
return s;
}