vmstate: port ssd0303 device
Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
0211364d37
commit
aed7278dbd
65
hw/ssd0303.c
65
hw/ssd0303.c
@ -261,48 +261,27 @@ static void ssd0303_invalidate_display(void * opaque)
|
|||||||
s->redraw = 1;
|
s->redraw = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ssd0303_save(QEMUFile *f, void *opaque)
|
static const VMStateDescription vmstate_ssd0303 = {
|
||||||
{
|
.name = "ssd0303_oled",
|
||||||
ssd0303_state *s = (ssd0303_state *)opaque;
|
.version_id = 1,
|
||||||
|
.minimum_version_id = 1,
|
||||||
qemu_put_be32(f, s->row);
|
.minimum_version_id_old = 1,
|
||||||
qemu_put_be32(f, s->col);
|
.fields = (VMStateField []) {
|
||||||
qemu_put_be32(f, s->start_line);
|
VMSTATE_INT32(row, ssd0303_state),
|
||||||
qemu_put_be32(f, s->mirror);
|
VMSTATE_INT32(col, ssd0303_state),
|
||||||
qemu_put_be32(f, s->flash);
|
VMSTATE_INT32(start_line, ssd0303_state),
|
||||||
qemu_put_be32(f, s->enabled);
|
VMSTATE_INT32(mirror, ssd0303_state),
|
||||||
qemu_put_be32(f, s->inverse);
|
VMSTATE_INT32(flash, ssd0303_state),
|
||||||
qemu_put_be32(f, s->redraw);
|
VMSTATE_INT32(enabled, ssd0303_state),
|
||||||
qemu_put_be32(f, s->mode);
|
VMSTATE_INT32(inverse, ssd0303_state),
|
||||||
qemu_put_be32(f, s->cmd_state);
|
VMSTATE_INT32(redraw, ssd0303_state),
|
||||||
qemu_put_buffer(f, s->framebuffer, sizeof(s->framebuffer));
|
VMSTATE_UINT32(mode, ssd0303_state),
|
||||||
|
VMSTATE_UINT32(cmd_state, ssd0303_state),
|
||||||
i2c_slave_save(f, &s->i2c);
|
VMSTATE_BUFFER(framebuffer, ssd0303_state),
|
||||||
}
|
VMSTATE_I2C_SLAVE(i2c, ssd0303_state),
|
||||||
|
VMSTATE_END_OF_LIST()
|
||||||
static int ssd0303_load(QEMUFile *f, void *opaque, int version_id)
|
}
|
||||||
{
|
};
|
||||||
ssd0303_state *s = (ssd0303_state *)opaque;
|
|
||||||
|
|
||||||
if (version_id != 1)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
s->row = qemu_get_be32(f);
|
|
||||||
s->col = qemu_get_be32(f);
|
|
||||||
s->start_line = qemu_get_be32(f);
|
|
||||||
s->mirror = qemu_get_be32(f);
|
|
||||||
s->flash = qemu_get_be32(f);
|
|
||||||
s->enabled = qemu_get_be32(f);
|
|
||||||
s->inverse = qemu_get_be32(f);
|
|
||||||
s->redraw = qemu_get_be32(f);
|
|
||||||
s->mode = qemu_get_be32(f);
|
|
||||||
s->cmd_state = qemu_get_be32(f);
|
|
||||||
qemu_get_buffer(f, s->framebuffer, sizeof(s->framebuffer));
|
|
||||||
|
|
||||||
i2c_slave_load(f, &s->i2c);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int ssd0303_init(i2c_slave *i2c)
|
static int ssd0303_init(i2c_slave *i2c)
|
||||||
{
|
{
|
||||||
@ -312,7 +291,7 @@ static int ssd0303_init(i2c_slave *i2c)
|
|||||||
ssd0303_invalidate_display,
|
ssd0303_invalidate_display,
|
||||||
NULL, NULL, s);
|
NULL, NULL, s);
|
||||||
qemu_console_resize(s->ds, 96 * MAGNIFY, 16 * MAGNIFY);
|
qemu_console_resize(s->ds, 96 * MAGNIFY, 16 * MAGNIFY);
|
||||||
register_savevm("ssd0303_oled", -1, 1, ssd0303_save, ssd0303_load, s);
|
vmstate_register(-1, &vmstate_ssd0303, s);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user