diff options
author | pbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-11-18 14:36:08 +0000 |
---|---|---|
committer | pbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-11-18 14:36:08 +0000 |
commit | cf0dbb21156f2fabdbe8b846b16dfc9825d8b23c (patch) | |
tree | 3a2291abc8655a6c6cc99cc51fc6346e547e3c1c /hw/stellaris.c | |
parent | f090c9d4ad5812fb92843d6470a1111c15190c4c (diff) |
Luminary board input support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3689 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/stellaris.c')
-rw-r--r-- | hw/stellaris.c | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/hw/stellaris.c b/hw/stellaris.c index 878c7f84e5..3dbb2ced62 100644 --- a/hw/stellaris.c +++ b/hw/stellaris.c @@ -16,6 +16,18 @@ #include "sysemu.h" #include "boards.h" +#define GPIO_A 0 +#define GPIO_B 1 +#define GPIO_C 2 +#define GPIO_D 3 +#define GPIO_E 4 +#define GPIO_F 5 +#define GPIO_G 6 + +#define BP_OLED_I2C 0x01 +#define BP_OLED_SSI 0x02 +#define BP_GAMEPAD 0x04 + typedef const struct { const char *name; uint32_t did0; @@ -25,7 +37,7 @@ typedef const struct { uint32_t dc2; uint32_t dc3; uint32_t dc4; - enum {OLED_I2C, OLED_SSI} oled; + uint32_t peripherals; } stellaris_board_info; /* General purpose timer module. */ @@ -991,7 +1003,7 @@ static stellaris_board_info stellaris_boards[] = { 0x01071013, 0x3f0f01ff, 0x0000001f, - OLED_I2C + BP_OLED_I2C }, { "LM3S6965EVB", 0x10010002, @@ -1001,7 +1013,7 @@ static stellaris_board_info stellaris_boards[] = { 0x030f5317, 0x0f0f87ff, 0x5000007f, - OLED_SSI + BP_OLED_SSI | BP_GAMEPAD } }; @@ -1052,7 +1064,7 @@ static void stellaris_init(const char *kernel_filename, const char *cpu_model, if (board->dc2 & (1 << 12)) { i2c = i2c_init_bus(); stellaris_i2c_init(0x40020000, pic[8], i2c); - if (board->oled == OLED_I2C) { + if (board->peripherals & BP_OLED_I2C) { ssd0303_init(ds, i2c, 0x3d); } } @@ -1064,15 +1076,27 @@ static void stellaris_init(const char *kernel_filename, const char *cpu_model, } } if (board->dc2 & (1 << 4)) { - if (board->oled == OLED_SSI) { + if (board->peripherals & BP_OLED_SSI) { void * oled; /* FIXME: Implement chip select for OLED/MMC. */ - oled = ssd0323_init(ds, &gpio_out[2][7]); + oled = ssd0323_init(ds, &gpio_out[GPIO_C][7]); pl022_init(0x40008000, pic[7], ssd0323_xfer_ssi, oled); } else { pl022_init(0x40008000, pic[7], NULL, NULL); } } + if (board->peripherals & BP_GAMEPAD) { + qemu_irq gpad_irq[5]; + static const int gpad_keycode[5] = { 0xc8, 0xd0, 0xcb, 0xcd, 0x1d }; + + gpad_irq[0] = qemu_irq_invert(gpio_in[GPIO_E][0]); /* up */ + gpad_irq[1] = qemu_irq_invert(gpio_in[GPIO_E][1]); /* down */ + gpad_irq[2] = qemu_irq_invert(gpio_in[GPIO_E][2]); /* left */ + gpad_irq[3] = qemu_irq_invert(gpio_in[GPIO_E][3]); /* right */ + gpad_irq[4] = qemu_irq_invert(gpio_in[GPIO_F][1]); /* select */ + + stellaris_gamepad_init(5, gpad_irq, gpad_keycode); + } } /* FIXME: Figure out how to generate these from stellaris_boards. */ |