Revision 5493e33f hw/ssd0323.c

b/hw/ssd0323.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
#include "devices.h"
13
#include "ssi.h"
15 14
#include "console.h"
16 15

  
17 16
//#define DEBUG_SSD0323 1
......
43 42
};
44 43

  
45 44
typedef struct {
45
    SSISlave ssidev;
46 46
    DisplayState *ds;
47 47

  
48 48
    int cmd_len;
......
60 60
    uint8_t framebuffer[128 * 80 / 2];
61 61
} ssd0323_state;
62 62

  
63
int ssd0323_xfer_ssi(void *opaque, int data)
63
static uint32_t ssd0323_transfer(SSISlave *dev, uint32_t data)
64 64
{
65
    ssd0323_state *s = (ssd0323_state *)opaque;
65
    ssd0323_state *s = FROM_SSI_SLAVE(ssd0323_state, dev);
66

  
66 67
    switch (s->mode) {
67 68
    case SSD0323_DATA:
68 69
        DPRINTF("data 0x%02x\n", data);
......
321 322
    return 0;
322 323
}
323 324

  
324
void *ssd0323_init(qemu_irq *cmd_p)
325
static void ssd0323_init(SSISlave *dev)
325 326
{
326
    ssd0323_state *s;
327
    qemu_irq *cmd;
327
    ssd0323_state *s = FROM_SSI_SLAVE(ssd0323_state, dev);
328 328

  
329
    s = (ssd0323_state *)qemu_mallocz(sizeof(ssd0323_state));
330 329
    s->col_end = 63;
331 330
    s->row_end = 79;
332 331
    s->ds = graphic_console_init(ssd0323_update_display,
......
334 333
                                 NULL, NULL, s);
335 334
    qemu_console_resize(s->ds, 128 * MAGNIFY, 64 * MAGNIFY);
336 335

  
337
    cmd = qemu_allocate_irqs(ssd0323_cd, s, 1);
338
    *cmd_p = *cmd;
336
    qdev_init_gpio_in(&dev->qdev, ssd0323_cd, 1);
339 337

  
340 338
    register_savevm("ssd0323_oled", -1, 1, ssd0323_save, ssd0323_load, s);
339
}
341 340

  
342
    return s;
341
static SSISlaveInfo ssd0323_info = {
342
    .init = ssd0323_init,
343
    .transfer = ssd0323_transfer
344
};
345

  
346
static void ssd03232_register_devices(void)
347
{
348
    ssi_register_slave("ssd0323", sizeof(ssd0323_state), &ssd0323_info);
343 349
}
350

  
351
device_init(ssd03232_register_devices)

Also available in: Unified diff