diff options
author | Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | 2011-02-11 23:57:33 +0300 |
---|---|---|
committer | Andrzej Zaborowski <balrog@zabor.org> | 2011-02-11 23:31:16 +0100 |
commit | 7fe63a170addbfadd785b70c6a1e9a49d113c89b (patch) | |
tree | 2434d0be9f90f7d5fe6e2f9bc44ee4d8485dc8bf /hw/zaurus.c | |
parent | f23c1b2a38b1c77261c761cc2b9795d98065386f (diff) |
Add scoop post_load callback that sets IRQs to loaded levels
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
Diffstat (limited to 'hw/zaurus.c')
-rw-r--r-- | hw/zaurus.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/hw/zaurus.c b/hw/zaurus.c index fca11a5333..fb5e22859d 100644 --- a/hw/zaurus.c +++ b/hw/zaurus.c @@ -181,17 +181,34 @@ static int scoop_init(SysBusDevice *dev) return 0; } +static int scoop_post_load(void *opaque, int version_id) +{ + ScoopInfo *s = (ScoopInfo *) opaque; + int i; + uint32_t level; + + level = s->gpio_level & s->gpio_dir; + + for (i = 0; i < 16; i++) { + qemu_set_irq(s->handler[i], (level >> i) & 1); + } + + s->prev_level = level; + + return 0; +} + static bool is_version_0 (void *opaque, int version_id) { return version_id == 0; } - static const VMStateDescription vmstate_scoop_regs = { .name = "scoop", .version_id = 1, .minimum_version_id = 0, .minimum_version_id_old = 0, + .post_load = scoop_post_load, .fields = (VMStateField []) { VMSTATE_UINT16(status, ScoopInfo), VMSTATE_UINT16(power, ScoopInfo), |