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/pxa2xx_gpio.c | |
parent | 3f6c925f37cd8a1dddb8a8fbbcef4630ea347775 (diff) | |
download | qemu-aa941b944500bf77f0bdbfa0a7112b4e89670ff1.zip qemu-aa941b944500bf77f0bdbfa0a7112b4e89670ff1.tar.gz qemu-aa941b944500bf77f0bdbfa0a7112b4e89670ff1.tar.bz2 |
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/pxa2xx_gpio.c')
-rw-r--r-- | hw/pxa2xx_gpio.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/hw/pxa2xx_gpio.c b/hw/pxa2xx_gpio.c index eab2e72..0e32329 100644 --- a/hw/pxa2xx_gpio.c +++ b/hw/pxa2xx_gpio.c @@ -247,6 +247,51 @@ static CPUWriteMemoryFunc *pxa2xx_gpio_writefn[] = { pxa2xx_gpio_write }; +static void pxa2xx_gpio_save(QEMUFile *f, void *opaque) +{ + struct pxa2xx_gpio_info_s *s = (struct pxa2xx_gpio_info_s *) opaque; + int i; + + qemu_put_be32(f, s->lines); + + for (i = 0; i < PXA2XX_GPIO_BANKS; i ++) { + qemu_put_be32s(f, &s->ilevel[i]); + qemu_put_be32s(f, &s->olevel[i]); + qemu_put_be32s(f, &s->dir[i]); + qemu_put_be32s(f, &s->rising[i]); + qemu_put_be32s(f, &s->falling[i]); + qemu_put_be32s(f, &s->status[i]); + qemu_put_be32s(f, &s->gafr[i * 2 + 0]); + qemu_put_be32s(f, &s->gafr[i * 2 + 1]); + + qemu_put_be32s(f, &s->prev_level[i]); + } +} + +static int pxa2xx_gpio_load(QEMUFile *f, void *opaque, int version_id) +{ + struct pxa2xx_gpio_info_s *s = (struct pxa2xx_gpio_info_s *) opaque; + int i; + + if (qemu_get_be32(f) != s->lines) + return -EINVAL; + + for (i = 0; i < PXA2XX_GPIO_BANKS; i ++) { + qemu_get_be32s(f, &s->ilevel[i]); + qemu_get_be32s(f, &s->olevel[i]); + qemu_get_be32s(f, &s->dir[i]); + qemu_get_be32s(f, &s->rising[i]); + qemu_get_be32s(f, &s->falling[i]); + qemu_get_be32s(f, &s->status[i]); + qemu_get_be32s(f, &s->gafr[i * 2 + 0]); + qemu_get_be32s(f, &s->gafr[i * 2 + 1]); + + qemu_get_be32s(f, &s->prev_level[i]); + } + + return 0; +} + struct pxa2xx_gpio_info_s *pxa2xx_gpio_init(target_phys_addr_t base, CPUState *env, qemu_irq *pic, int lines) { @@ -265,6 +310,9 @@ struct pxa2xx_gpio_info_s *pxa2xx_gpio_init(target_phys_addr_t base, pxa2xx_gpio_writefn, s); cpu_register_physical_memory(base, 0x00000fff, iomemtype); + register_savevm("pxa2xx_gpio", 0, 0, + pxa2xx_gpio_save, pxa2xx_gpio_load, s); + return s; } |