diff options
author | balrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-05-24 18:50:09 +0000 |
---|---|---|
committer | balrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-05-24 18:50:09 +0000 |
commit | aa941b944500bf77f0bdbfa0a7112b4e89670ff1 (patch) | |
tree | 59f1c3e46b42022a3966e108752ca92531169380 /hw/max7310.c | |
parent | 3f6c925f37cd8a1dddb8a8fbbcef4630ea347775 (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/max7310.c')
-rw-r--r-- | hw/max7310.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/hw/max7310.c b/hw/max7310.c index a4aaf17d29..6b180d9b6d 100644 --- a/hw/max7310.c +++ b/hw/max7310.c @@ -143,6 +143,41 @@ static void max7310_event(i2c_slave *i2c, enum i2c_event event) } } +static void max7310_save(QEMUFile *f, void *opaque) +{ + struct max7310_s *s = (struct max7310_s *) opaque; + + qemu_put_be32(f, s->i2c_command_byte); + qemu_put_be32(f, s->len); + + qemu_put_8s(f, &s->level); + qemu_put_8s(f, &s->direction); + qemu_put_8s(f, &s->polarity); + qemu_put_8s(f, &s->status); + qemu_put_8s(f, &s->command); + + i2c_slave_save(f, &s->i2c); +} + +static int max7310_load(QEMUFile *f, void *opaque, int version_id) +{ + struct max7310_s *s = (struct max7310_s *) opaque; + + s->i2c_command_byte = qemu_get_be32(f); + s->len = qemu_get_be32(f); + + qemu_get_8s(f, &s->level); + qemu_get_8s(f, &s->direction); + qemu_get_8s(f, &s->polarity); + qemu_get_8s(f, &s->status); + qemu_get_8s(f, &s->command); + + i2c_slave_load(f, &s->i2c); + return 0; +} + +static int max7310_iid = 0; + static void max7310_gpio_set(void *opaque, int line, int level) { struct max7310_s *s = (struct max7310_s *) opaque; @@ -169,6 +204,9 @@ struct i2c_slave *max7310_init(i2c_bus *bus) max7310_reset(&s->i2c); + register_savevm("max7310", max7310_iid ++, 0, + max7310_save, max7310_load, s); + return &s->i2c; } |