Revision 38a34e1d hw/palm.c

b/hw/palm.c
61 61
{
62 62
}
63 63

  
64
static struct {
65
    int row;
66
    int column;
67
} palmte_keymap[0x80] = {
68
    [0 ... 0x7f] = { -1, -1 },
69
    [0x3b] = { 0, 0 },	/* F1	-> Calendar */
70
    [0x3c] = { 1, 0 },	/* F2	-> Contacts */
71
    [0x3d] = { 2, 0 },	/* F3	-> Tasks List */
72
    [0x3e] = { 3, 0 },	/* F4	-> Note Pad */
73
    [0x01] = { 4, 0 },	/* Esc	-> Power */
74
    [0x4b] = { 0, 1 },	/* 	   Left */
75
    [0x50] = { 1, 1 },	/* 	   Down */
76
    [0x48] = { 2, 1 },	/*	   Up */
77
    [0x4d] = { 3, 1 },	/*	   Right */
78
    [0x4c] = { 4, 1 },	/* 	   Centre */
79
    [0x39] = { 4, 1 },	/* Spc	-> Centre */
80
};
81

  
82
static void palmte_button_event(void *opaque, int keycode)
83
{
84
    struct omap_mpu_state_s *cpu = (struct omap_mpu_state_s *) opaque;
85

  
86
    if (palmte_keymap[keycode & 0x7f].row != -1)
87
        omap_mpuio_key(cpu->mpuio,
88
                        palmte_keymap[keycode & 0x7f].row,
89
                        palmte_keymap[keycode & 0x7f].column,
90
                        !(keycode & 0x80));
91
}
92

  
64 93
static void palmte_init(int ram_size, int vga_ram_size, int boot_device,
65 94
                DisplayState *ds, const char **fd_filename, int snapshot,
66 95
                const char *kernel_filename, const char *kernel_cmdline,
......
101 130

  
102 131
    palmte_microwire_setup(cpu);
103 132

  
133
    qemu_add_kbd_event_handler(palmte_button_event, cpu);
134

  
104 135
    /* Setup initial (reset) machine state */
105 136
    if (nb_option_roms) {
106 137
        rom_size = get_image_size(option_rom[0]);

Also available in: Unified diff