Revision d2199005 hw/ssd0303.c
b/hw/ssd0303.c | ||
---|---|---|
10 | 10 |
/* The controller can support a variety of different displays, but we only |
11 | 11 |
implement one. Most of the commends relating to brightness and geometry |
12 | 12 |
setup are ignored. */ |
13 |
#include "hw.h" |
|
14 | 13 |
#include "i2c.h" |
15 | 14 |
#include "console.h" |
16 | 15 |
|
... | ... | |
305 | 304 |
return 0; |
306 | 305 |
} |
307 | 306 |
|
308 |
void ssd0303_init(i2c_bus *bus, int address)
|
|
307 |
static void ssd0303_init(i2c_slave *i2c)
|
|
309 | 308 |
{ |
310 |
ssd0303_state *s; |
|
309 |
ssd0303_state *s = FROM_I2C_SLAVE(ssd0303_state, i2c);
|
|
311 | 310 |
|
312 |
s = (ssd0303_state *)i2c_slave_init(bus, address, sizeof(ssd0303_state)); |
|
313 |
s->i2c.event = ssd0303_event; |
|
314 |
s->i2c.recv = ssd0303_recv; |
|
315 |
s->i2c.send = ssd0303_send; |
|
316 | 311 |
s->ds = graphic_console_init(ssd0303_update_display, |
317 | 312 |
ssd0303_invalidate_display, |
318 | 313 |
NULL, NULL, s); |
319 | 314 |
qemu_console_resize(s->ds, 96 * MAGNIFY, 16 * MAGNIFY); |
320 | 315 |
register_savevm("ssd0303_oled", -1, 1, ssd0303_save, ssd0303_load, s); |
321 | 316 |
} |
317 |
|
|
318 |
static I2CSlaveInfo ssd0303_info = { |
|
319 |
.init = ssd0303_init, |
|
320 |
.event = ssd0303_event, |
|
321 |
.recv = ssd0303_recv, |
|
322 |
.send = ssd0303_send |
|
323 |
}; |
|
324 |
|
|
325 |
static void ssd0303_register_devices(void) |
|
326 |
{ |
|
327 |
i2c_register_slave("ssd0303", sizeof(ssd0303_state), &ssd0303_info); |
|
328 |
} |
|
329 |
|
|
330 |
device_init(ssd0303_register_devices) |
Also available in: Unified diff