summaryrefslogtreecommitdiff
path: root/hw/ads7846.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/ads7846.c
parent3f6c925f37cd8a1dddb8a8fbbcef4630ea347775 (diff)
downloadqemu-aa941b944500bf77f0bdbfa0a7112b4e89670ff1.tar.gz
qemu-aa941b944500bf77f0bdbfa0a7112b4e89670ff1.tar.bz2
qemu-aa941b944500bf77f0bdbfa0a7112b4e89670ff1.zip
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/ads7846.c')
-rw-r--r--hw/ads7846.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/hw/ads7846.c b/hw/ads7846.c
index d63a915419..8eeb143b11 100644
--- a/hw/ads7846.c
+++ b/hw/ads7846.c
@@ -104,10 +104,41 @@ static void ads7846_ts_event(void *opaque,
if (s->pressure == !buttons_state) {
s->pressure = !!buttons_state;
- ads7846_int_update(s);
+ ads7846_int_update(s);
}
}
+static void ads7846_save(QEMUFile *f, void *opaque)
+{
+ struct ads7846_state_s *s = (struct ads7846_state_s *) opaque;
+ int i;
+
+ for (i = 0; i < 8; i ++)
+ qemu_put_be32(f, s->input[i]);
+ qemu_put_be32(f, s->noise);
+ qemu_put_be32(f, s->cycle);
+ qemu_put_be32(f, s->output);
+}
+
+static int ads7846_load(QEMUFile *f, void *opaque, int version_id)
+{
+ struct ads7846_state_s *s = (struct ads7846_state_s *) opaque;
+ int i;
+
+ for (i = 0; i < 8; i ++)
+ s->input[i] = qemu_get_be32(f);
+ s->noise = qemu_get_be32(f);
+ s->cycle = qemu_get_be32(f);
+ s->output = qemu_get_be32(f);
+
+ s->pressure = 0;
+ ads7846_int_update(s);
+
+ return 0;
+}
+
+static int ads7846_iid = 0;
+
struct ads7846_state_s *ads7846_init(qemu_irq penirq)
{
struct ads7846_state_s *s;
@@ -127,5 +158,9 @@ struct ads7846_state_s *ads7846_init(qemu_irq penirq)
"QEMU ADS7846-driven Touchscreen");
ads7846_int_update(s);
+
+ register_savevm("ads7846", ads7846_iid ++, 0,
+ ads7846_save, ads7846_load, s);
+
return s;
}