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>
This commit is contained in:
parent
f23c1b2a38
commit
7fe63a170a
19
hw/zaurus.c
19
hw/zaurus.c
@ -181,17 +181,34 @@ static int scoop_init(SysBusDevice *dev)
|
|||||||
return 0;
|
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)
|
static bool is_version_0 (void *opaque, int version_id)
|
||||||
{
|
{
|
||||||
return version_id == 0;
|
return version_id == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static const VMStateDescription vmstate_scoop_regs = {
|
static const VMStateDescription vmstate_scoop_regs = {
|
||||||
.name = "scoop",
|
.name = "scoop",
|
||||||
.version_id = 1,
|
.version_id = 1,
|
||||||
.minimum_version_id = 0,
|
.minimum_version_id = 0,
|
||||||
.minimum_version_id_old = 0,
|
.minimum_version_id_old = 0,
|
||||||
|
.post_load = scoop_post_load,
|
||||||
.fields = (VMStateField []) {
|
.fields = (VMStateField []) {
|
||||||
VMSTATE_UINT16(status, ScoopInfo),
|
VMSTATE_UINT16(status, ScoopInfo),
|
||||||
VMSTATE_UINT16(power, ScoopInfo),
|
VMSTATE_UINT16(power, ScoopInfo),
|
||||||
|
Loading…
Reference in New Issue
Block a user