An API similar to the existing qdev_get_gpio_in() except gets outputs. Useful for testing or debugging code which may wish to override the hardware generated value of of a GPIO with a user specified value (E.G. interrupt injection).
Signed-off-by: Peter Crosthwaite <peter.crosthwa...@xilinx.com> --- hw/core/qdev.c | 6 ++++++ include/hw/qdev-core.h | 1 + 2 files changed, 7 insertions(+) diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 60f9df1..ce7588b 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -332,6 +332,12 @@ qemu_irq qdev_get_gpio_in(DeviceState *dev, int n) return dev->gpio_in[n]; } +qemu_irq qdev_get_gpio_out(DeviceState *dev, int n) +{ + assert(n >= 0 && n < dev->num_gpio_out); + return dev->gpio_out[n]; +} + void qdev_connect_gpio_out(DeviceState * dev, int n, qemu_irq pin) { assert(n >= 0 && n < dev->num_gpio_out); diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index dbe473c..ed3a628 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -252,6 +252,7 @@ void qdev_machine_creation_done(void); bool qdev_machine_modified(void); qemu_irq qdev_get_gpio_in(DeviceState *dev, int n); +qemu_irq qdev_get_gpio_out(DeviceState *dev, int n); void qdev_connect_gpio_out(DeviceState *dev, int n, qemu_irq pin); BusState *qdev_get_child_bus(DeviceState *dev, const char *name); -- 1.9.1.1.gbb9f595