SSD0303 qdev conversion
Signed-off-by: Paul Brook <paul@codesourcery.com>
This commit is contained in:
parent
fe8de49258
commit
d2199005d5
3
hw/i2c.h
3
hw/i2c.h
@ -91,9 +91,6 @@ void *wm8750_dac_buffer(void *opaque, int samples);
|
||||
void wm8750_dac_commit(void *opaque);
|
||||
void wm8750_set_bclk_in(void *opaque, int new_hz);
|
||||
|
||||
/* ssd0303.c */
|
||||
void ssd0303_init(i2c_bus *bus, int address);
|
||||
|
||||
/* twl92230.c */
|
||||
i2c_slave *twl92230_init(i2c_bus *bus, qemu_irq irq);
|
||||
qemu_irq *twl92230_gpio_in_get(i2c_slave *i2c);
|
||||
|
23
hw/ssd0303.c
23
hw/ssd0303.c
@ -10,7 +10,6 @@
|
||||
/* The controller can support a variety of different displays, but we only
|
||||
implement one. Most of the commends relating to brightness and geometry
|
||||
setup are ignored. */
|
||||
#include "hw.h"
|
||||
#include "i2c.h"
|
||||
#include "console.h"
|
||||
|
||||
@ -305,17 +304,27 @@ static int ssd0303_load(QEMUFile *f, void *opaque, int version_id)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ssd0303_init(i2c_bus *bus, int address)
|
||||
static void ssd0303_init(i2c_slave *i2c)
|
||||
{
|
||||
ssd0303_state *s;
|
||||
ssd0303_state *s = FROM_I2C_SLAVE(ssd0303_state, i2c);
|
||||
|
||||
s = (ssd0303_state *)i2c_slave_init(bus, address, sizeof(ssd0303_state));
|
||||
s->i2c.event = ssd0303_event;
|
||||
s->i2c.recv = ssd0303_recv;
|
||||
s->i2c.send = ssd0303_send;
|
||||
s->ds = graphic_console_init(ssd0303_update_display,
|
||||
ssd0303_invalidate_display,
|
||||
NULL, NULL, s);
|
||||
qemu_console_resize(s->ds, 96 * MAGNIFY, 16 * MAGNIFY);
|
||||
register_savevm("ssd0303_oled", -1, 1, ssd0303_save, ssd0303_load, s);
|
||||
}
|
||||
|
||||
static I2CSlaveInfo ssd0303_info = {
|
||||
.init = ssd0303_init,
|
||||
.event = ssd0303_event,
|
||||
.recv = ssd0303_recv,
|
||||
.send = ssd0303_send
|
||||
};
|
||||
|
||||
static void ssd0303_register_devices(void)
|
||||
{
|
||||
i2c_register_slave("ssd0303", sizeof(ssd0303_state), &ssd0303_info);
|
||||
}
|
||||
|
||||
device_init(ssd0303_register_devices)
|
||||
|
@ -1324,7 +1324,7 @@ static void stellaris_init(const char *kernel_filename, const char *cpu_model,
|
||||
i2c = i2c_init_bus();
|
||||
stellaris_i2c_init(0x40020000, pic[8], i2c);
|
||||
if (board->peripherals & BP_OLED_I2C) {
|
||||
ssd0303_init(i2c, 0x3d);
|
||||
i2c_create_slave(i2c, "ssd0303", 0x3d);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user