diff options
author | Paul Brook <paul@codesourcery.com> | 2009-05-14 22:35:09 +0100 |
---|---|---|
committer | Paul Brook <paul@codesourcery.com> | 2009-05-14 22:35:09 +0100 |
commit | 5493e33f12b75207f8b1bb993ba97e47b3d8de85 (patch) | |
tree | af7cad82e49aa2d0aaf227f9d2bac88bb3bf5f27 /hw/ssd0323.c | |
parent | 90d37239d4051281d2882117efc73020046c32ca (diff) | |
download | qemu-5493e33f12b75207f8b1bb993ba97e47b3d8de85.zip qemu-5493e33f12b75207f8b1bb993ba97e47b3d8de85.tar.gz qemu-5493e33f12b75207f8b1bb993ba97e47b3d8de85.tar.bz2 |
Stellaris SSI qdev conversion
Signed-off-by: Paul Brook <paul@codesourcery.com>
Diffstat (limited to 'hw/ssd0323.c')
-rw-r--r-- | hw/ssd0323.c | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/hw/ssd0323.c b/hw/ssd0323.c index 5b83d27..c083d9a 100644 --- a/hw/ssd0323.c +++ b/hw/ssd0323.c @@ -10,8 +10,7 @@ /* 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 "devices.h" +#include "ssi.h" #include "console.h" //#define DEBUG_SSD0323 1 @@ -43,6 +42,7 @@ enum ssd0323_mode }; typedef struct { + SSISlave ssidev; DisplayState *ds; int cmd_len; @@ -60,9 +60,10 @@ typedef struct { uint8_t framebuffer[128 * 80 / 2]; } ssd0323_state; -int ssd0323_xfer_ssi(void *opaque, int data) +static uint32_t ssd0323_transfer(SSISlave *dev, uint32_t data) { - ssd0323_state *s = (ssd0323_state *)opaque; + ssd0323_state *s = FROM_SSI_SLAVE(ssd0323_state, dev); + switch (s->mode) { case SSD0323_DATA: DPRINTF("data 0x%02x\n", data); @@ -321,12 +322,10 @@ static int ssd0323_load(QEMUFile *f, void *opaque, int version_id) return 0; } -void *ssd0323_init(qemu_irq *cmd_p) +static void ssd0323_init(SSISlave *dev) { - ssd0323_state *s; - qemu_irq *cmd; + ssd0323_state *s = FROM_SSI_SLAVE(ssd0323_state, dev); - s = (ssd0323_state *)qemu_mallocz(sizeof(ssd0323_state)); s->col_end = 63; s->row_end = 79; s->ds = graphic_console_init(ssd0323_update_display, @@ -334,10 +333,19 @@ void *ssd0323_init(qemu_irq *cmd_p) NULL, NULL, s); qemu_console_resize(s->ds, 128 * MAGNIFY, 64 * MAGNIFY); - cmd = qemu_allocate_irqs(ssd0323_cd, s, 1); - *cmd_p = *cmd; + qdev_init_gpio_in(&dev->qdev, ssd0323_cd, 1); register_savevm("ssd0323_oled", -1, 1, ssd0323_save, ssd0323_load, s); +} - return s; +static SSISlaveInfo ssd0323_info = { + .init = ssd0323_init, + .transfer = ssd0323_transfer +}; + +static void ssd03232_register_devices(void) +{ + ssi_register_slave("ssd0323", sizeof(ssd0323_state), &ssd0323_info); } + +device_init(ssd03232_register_devices) |