qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH for-2.1 v1 1/3] qdev: Define qdev_get_gpio_out


From: Peter Crosthwaite
Subject: [Qemu-devel] [PATCH for-2.1 v1 1/3] qdev: Define qdev_get_gpio_out
Date: Tue, 8 Apr 2014 16:45:02 -0700

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 <address@hidden>
---

 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]