diff options
author | Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 2022-06-24 14:40:30 +0100 |
---|---|---|
committer | Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 2022-06-26 18:40:11 +0100 |
commit | eca9e8702b7d071a8e2f94bd1096d846d91ca3d8 (patch) | |
tree | 388551a08696a1a70927bbb334e8f5a206c3a591 /hw/input | |
parent | 600f71109d8a0c10205d0f9c344c47d5a7962eed (diff) | |
download | qemu-eca9e8702b7d071a8e2f94bd1096d846d91ca3d8.zip qemu-eca9e8702b7d071a8e2f94bd1096d846d91ca3d8.tar.gz qemu-eca9e8702b7d071a8e2f94bd1096d846d91ca3d8.tar.bz2 |
pl050: split pl050_update_irq() into separate pl050_set_irq() and pl050_update_irq() functions
This will soon allow pl050_set_irq() to be used as a GPIO input function.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Helge Deller <deller@gmx.de>
Message-Id: <20220624134109.881989-16-mark.cave-ayland@ilande.co.uk>
Diffstat (limited to 'hw/input')
-rw-r--r-- | hw/input/pl050.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/hw/input/pl050.c b/hw/input/pl050.c index 889a067..66f8c20 100644 --- a/hw/input/pl050.c +++ b/hw/input/pl050.c @@ -57,15 +57,20 @@ static const unsigned char pl050_id[] = { 0x50, 0x10, 0x04, 0x00, 0x0d, 0xf0, 0x05, 0xb1 }; -static void pl050_update(void *opaque, int level) +static void pl050_update_irq(PL050State *s) +{ + int level = (s->pending && (s->cr & 0x10) != 0) + || (s->cr & 0x08) != 0; + + qemu_set_irq(s->irq, level); +} + +static void pl050_set_irq(void *opaque, int level) { PL050State *s = (PL050State *)opaque; - int raise; s->pending = level; - raise = (s->pending && (s->cr & 0x10) != 0) - || (s->cr & 0x08) != 0; - qemu_set_irq(s->irq, raise); + pl050_update_irq(s); } static uint64_t pl050_read(void *opaque, hwaddr offset, @@ -124,7 +129,7 @@ static void pl050_write(void *opaque, hwaddr offset, switch (offset >> 2) { case 0: /* KMICR */ s->cr = value; - pl050_update(s, s->pending); + pl050_update_irq(s); /* ??? Need to implement the enable/disable bit. */ break; case 2: /* KMIDATA */ @@ -159,9 +164,9 @@ static void pl050_realize(DeviceState *dev, Error **errp) sysbus_init_mmio(sbd, &s->iomem); sysbus_init_irq(sbd, &s->irq); if (s->is_mouse) { - s->dev = ps2_mouse_init(pl050_update, s); + s->dev = ps2_mouse_init(pl050_set_irq, s); } else { - s->dev = ps2_kbd_init(pl050_update, s); + s->dev = ps2_kbd_init(pl050_set_irq, s); } } |