diff options
author | balrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-10-29 10:59:29 +0000 |
---|---|---|
committer | balrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-10-29 10:59:29 +0000 |
commit | b50a6563d8590675905b730d32f17fa119664e0e (patch) | |
tree | 5f10c6b911a35969f7df2dbbb9dc097f93fd65bc | |
parent | 3efda49d150def64f69a79cbd8da760ea15a79b7 (diff) |
Add a qemu_irq_invert() shortcut for inverting a signal.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3485 c046a42c-6fe2-441c-8c8c-71466251a162
-rw-r--r-- | hw/irq.c | 11 | ||||
-rw-r--r-- | hw/irq.h | 2 | ||||
-rw-r--r-- | hw/palm.c | 24 |
3 files changed, 18 insertions, 19 deletions
@@ -55,3 +55,14 @@ qemu_irq *qemu_allocate_irqs(qemu_irq_handler handler, void *opaque, int n) return s; } +static void qemu_notirq(void *opaque, int line, int level) +{ + struct IRQState *irq = opaque; + + irq->handler(irq->opaque, irq->n, !level); +} + +qemu_irq qemu_irq_invert(qemu_irq irq) +{ + return qemu_allocate_irqs(qemu_notirq, irq, 1)[0]; +} @@ -19,3 +19,5 @@ static inline void qemu_irq_lower(qemu_irq irq) /* Returns an array of N IRQs. */ qemu_irq *qemu_allocate_irqs(qemu_irq_handler handler, void *opaque, int n); +/* Returns a new IRQ with opposite polarity. */ +qemu_irq qemu_irq_invert(qemu_irq irq); @@ -76,20 +76,13 @@ static CPUWriteMemoryFunc *static_writefn[] = { #define PALMTE_MMC2_GPIO 7 #define PALMTE_MMC3_GPIO 11 -static void palmte_pintdav(void *opaque, int line, int level) -{ - struct omap_mpu_state_s *cpu = (struct omap_mpu_state_s *) opaque; - - qemu_set_irq(omap_gpio_in_get(cpu->gpio)[PALMTE_PINTDAV_GPIO], - !level); -} - 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_allocate_irqs(palmte_pintdav, cpu, 1)[0]), + tsc2102_init(qemu_irq_invert(p_int)), 0); } @@ -122,14 +115,6 @@ static void palmte_button_event(void *opaque, int keycode) !(keycode & 0x80)); } -static void palmte_mmc_cover(void *opaque, int line, int level) -{ - struct omap_mpu_state_s *cpu = (struct omap_mpu_state_s *) opaque; - - qemu_set_irq(omap_mpuio_in_get(cpu->mpuio)[PALMTE_MMC_SWITCH_GPIO], - !level); -} - 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, @@ -174,7 +159,8 @@ static void palmte_init(int ram_size, int vga_ram_size, int boot_device, omap_mmc_handlers(cpu->mmc, omap_gpio_in_get(cpu->gpio)[PALMTE_MMC_WP_GPIO], - qemu_allocate_irqs(palmte_mmc_cover, cpu, 1)[0]); + qemu_irq_invert(omap_mpuio_in_get(cpu->mpuio) + [PALMTE_MMC_SWITCH_GPIO])); /* Setup initial (reset) machine state */ if (nb_option_roms) { |