diff options
-rw-r--r-- | hw/palm.c | 66 | ||||
-rw-r--r-- | hw/tsc210x.c | 8 |
2 files changed, 63 insertions, 11 deletions
@@ -78,11 +78,10 @@ static CPUWriteMemoryFunc *static_writefn[] = { static void palmte_microwire_setup(struct omap_mpu_state_s *cpu) { - qemu_irq p_int = omap_gpio_in_get(cpu->gpio)[PALMTE_PINTDAV_GPIO]; - omap_uwire_attach( cpu->microwire, - tsc2102_init(qemu_irq_invert(p_int)), + tsc2102_init( + omap_gpio_in_get(cpu->gpio)[PALMTE_PINTDAV_GPIO]), 0); } @@ -115,6 +114,62 @@ static void palmte_button_event(void *opaque, int keycode) !(keycode & 0x80)); } +static void palmte_onoff_gpios(void *opaque, int line, int level) +{ + switch (line) { + case 0: + printf("%s: current to MMC/SD card %sabled.\n", + __FUNCTION__, level ? "dis" : "en"); + break; + case 1: + printf("%s: internal speaker amplifier %s.\n", + __FUNCTION__, level ? "down" : "on"); + break; + + /* These LCD & Audio output signals have not been identified yet. */ + case 2: + case 3: + case 4: + printf("%s: LCD GPIO%i %s.\n", + __FUNCTION__, line - 1, level ? "high" : "low"); + break; + case 5: + case 6: + printf("%s: Audio GPIO%i %s.\n", + __FUNCTION__, line - 4, level ? "high" : "low"); + break; + } +} + +static void palmte_gpio_setup(struct omap_mpu_state_s *cpu) +{ + qemu_irq *misc_gpio; + + omap_mmc_handlers(cpu->mmc, + omap_gpio_in_get(cpu->gpio)[PALMTE_MMC_WP_GPIO], + qemu_irq_invert(omap_mpuio_in_get(cpu->mpuio) + [PALMTE_MMC_SWITCH_GPIO])); + + misc_gpio = qemu_allocate_irqs(palmte_onoff_gpios, cpu, 7); + omap_gpio_out_set(cpu->gpio, PALMTE_MMC_POWER_GPIO, misc_gpio[0]); + omap_gpio_out_set(cpu->gpio, PALMTE_SPEAKER_GPIO, misc_gpio[1]); + omap_gpio_out_set(cpu->gpio, 11, misc_gpio[2]); + omap_gpio_out_set(cpu->gpio, 12, misc_gpio[3]); + omap_gpio_out_set(cpu->gpio, 13, misc_gpio[4]); + omap_mpuio_out_set(cpu->mpuio, 1, misc_gpio[5]); + omap_mpuio_out_set(cpu->mpuio, 3, misc_gpio[6]); + + /* Reset some inputs to initial state. */ + qemu_irq_lower(omap_gpio_in_get(cpu->gpio)[PALMTE_USBDETECT_GPIO]); + qemu_irq_lower(omap_gpio_in_get(cpu->gpio)[PALMTE_USB_OR_DC_GPIO]); + qemu_irq_lower(omap_gpio_in_get(cpu->gpio)[4]); + qemu_irq_lower(omap_gpio_in_get(cpu->gpio)[PALMTE_HEADPHONES_GPIO]); + qemu_irq_lower(omap_mpuio_in_get(cpu->mpuio)[PALMTE_DC_GPIO]); + qemu_irq_raise(omap_mpuio_in_get(cpu->mpuio)[6]); + qemu_irq_raise(omap_mpuio_in_get(cpu->mpuio)[7]); + qemu_irq_raise(omap_mpuio_in_get(cpu->mpuio)[11]); +} + static void palmte_init(int ram_size, int vga_ram_size, const char *boot_device, DisplayState *ds, const char **fd_filename, int snapshot, @@ -158,10 +213,7 @@ static void palmte_init(int ram_size, int vga_ram_size, qemu_add_kbd_event_handler(palmte_button_event, cpu); - omap_mmc_handlers(cpu->mmc, - omap_gpio_in_get(cpu->gpio)[PALMTE_MMC_WP_GPIO], - qemu_irq_invert(omap_mpuio_in_get(cpu->mpuio) - [PALMTE_MMC_SWITCH_GPIO])); + palmte_gpio_setup(cpu); /* Setup initial (reset) machine state */ if (nb_option_roms) { diff --git a/hw/tsc210x.c b/hw/tsc210x.c index 6aa2bc8ad0..31cf3a444e 100644 --- a/hw/tsc210x.c +++ b/hw/tsc210x.c @@ -1,5 +1,5 @@ /* - * TI TSC2102 (touchscreen/sensors/audio controller) controller. + * TI TSC2102 (touchscreen/sensors/audio controller) emulator. * * Copyright (c) 2006 Andrzej Zaborowski <balrog@zabor.org> * @@ -171,7 +171,7 @@ static void tsc210x_reset(struct tsc210x_state_s *s) s->filter_data[0x12] = 0x7d83; s->filter_data[0x13] = 0x84ee; - qemu_set_irq(s->pint, s->irq); + qemu_set_irq(s->pint, !s->irq); } static uint16_t tsc2102_data_register_read(struct tsc210x_state_s *s, int reg) @@ -572,7 +572,7 @@ static void tsc210x_pin_update(struct tsc210x_state_s *s) if (pin_state != s->irq) { s->irq = pin_state; - qemu_set_irq(s->pint, s->irq); + qemu_set_irq(s->pint, !s->irq); } switch (s->nextfunction) { @@ -810,7 +810,7 @@ static int tsc210x_load(QEMUFile *f, void *opaque, int version_id) qemu_get_be16s(f, &s->filter_data[i]); s->busy = qemu_timer_pending(s->timer); - qemu_set_irq(s->pint, s->irq); + qemu_set_irq(s->pint, !s->irq); return 0; } |