diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2011-02-21 20:57:52 +0000 |
---|---|---|
committer | Aurelien Jarno <aurelien@aurel32.net> | 2011-03-06 19:01:31 +0100 |
commit | 9793212bb02b9fdc2de188a42b93b17ca2689c9a (patch) | |
tree | f0015b4cc4481c063ba17eba30e035f83bf619c4 /hw/irq.c | |
parent | 7063f49f59807ac6f32c69281cf956d14d6c0310 (diff) |
hw/irq: Add qemu_irq_split() so one GPIO output can feed two inputs
Add a qemu_irq_split() function which allows a board to wire a single
GPIO output up to two GPIO inputs. This is needed for realview boards,
where the MMC card status is visible both in a system register and
via a PL061 GPIO module.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Diffstat (limited to 'hw/irq.c')
-rw-r--r-- | hw/irq.c | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -75,3 +75,18 @@ qemu_irq qemu_irq_invert(qemu_irq irq) qemu_irq_raise(irq); return qemu_allocate_irqs(qemu_notirq, irq, 1)[0]; } + +static void qemu_splitirq(void *opaque, int line, int level) +{ + struct IRQState **irq = opaque; + irq[0]->handler(irq[0]->opaque, irq[0]->n, level); + irq[1]->handler(irq[1]->opaque, irq[1]->n, level); +} + +qemu_irq qemu_irq_split(qemu_irq irq1, qemu_irq irq2) +{ + qemu_irq *s = qemu_mallocz(2 * sizeof(qemu_irq)); + s[0] = irq1; + s[1] = irq2; + return qemu_allocate_irqs(qemu_splitirq, s, 1)[0]; +} |