aboutsummaryrefslogtreecommitdiff
path: root/hw/palm.c
diff options
context:
space:
mode:
authorbalrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162>2007-10-28 18:29:04 +0000
committerbalrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162>2007-10-28 18:29:04 +0000
commit38a34e1d7aa1ac64c2615952ee732da47eee9f14 (patch)
treebb5721fe771542ee76e038cc2caa640173bdc72e /hw/palm.c
parentfe71e81aba0f0cc10cd807a1b3f7a2978db255ce (diff)
downloadqemu-38a34e1d7aa1ac64c2615952ee732da47eee9f14.zip
qemu-38a34e1d7aa1ac64c2615952ee732da47eee9f14.tar.gz
qemu-38a34e1d7aa1ac64c2615952ee732da47eee9f14.tar.bz2
Add PalmT|E matrix keypad connected to OMAP GPIOs.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3470 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/palm.c')
-rw-r--r--hw/palm.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/hw/palm.c b/hw/palm.c
index 623fcd6..ead9cfd 100644
--- a/hw/palm.c
+++ b/hw/palm.c
@@ -61,6 +61,35 @@ static void palmte_microwire_setup(struct omap_mpu_state_s *cpu)
{
}
+static struct {
+ int row;
+ int column;
+} palmte_keymap[0x80] = {
+ [0 ... 0x7f] = { -1, -1 },
+ [0x3b] = { 0, 0 }, /* F1 -> Calendar */
+ [0x3c] = { 1, 0 }, /* F2 -> Contacts */
+ [0x3d] = { 2, 0 }, /* F3 -> Tasks List */
+ [0x3e] = { 3, 0 }, /* F4 -> Note Pad */
+ [0x01] = { 4, 0 }, /* Esc -> Power */
+ [0x4b] = { 0, 1 }, /* Left */
+ [0x50] = { 1, 1 }, /* Down */
+ [0x48] = { 2, 1 }, /* Up */
+ [0x4d] = { 3, 1 }, /* Right */
+ [0x4c] = { 4, 1 }, /* Centre */
+ [0x39] = { 4, 1 }, /* Spc -> Centre */
+};
+
+static void palmte_button_event(void *opaque, int keycode)
+{
+ struct omap_mpu_state_s *cpu = (struct omap_mpu_state_s *) opaque;
+
+ if (palmte_keymap[keycode & 0x7f].row != -1)
+ omap_mpuio_key(cpu->mpuio,
+ palmte_keymap[keycode & 0x7f].row,
+ palmte_keymap[keycode & 0x7f].column,
+ !(keycode & 0x80));
+}
+
static void palmte_init(int ram_size, int vga_ram_size, int boot_device,
DisplayState *ds, const char **fd_filename, int snapshot,
const char *kernel_filename, const char *kernel_cmdline,
@@ -101,6 +130,8 @@ static void palmte_init(int ram_size, int vga_ram_size, int boot_device,
palmte_microwire_setup(cpu);
+ qemu_add_kbd_event_handler(palmte_button_event, cpu);
+
/* Setup initial (reset) machine state */
if (nb_option_roms) {
rom_size = get_image_size(option_rom[0]);