diff options
Diffstat (limited to 'include/hw/qdev-core.h')
-rw-r--r-- | include/hw/qdev-core.h | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index dbe473c344..ae31575577 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -131,6 +131,17 @@ typedef struct DeviceClass { const char *bus_type; } DeviceClass; +typedef struct NamedGPIOList NamedGPIOList; + +struct NamedGPIOList { + char *name; + qemu_irq *in; + int num_in; + qemu_irq *out; + int num_out; + QLIST_ENTRY(NamedGPIOList) node; +}; + /** * DeviceState: * @realized: Indicates whether the device has been fully constructed. @@ -148,10 +159,7 @@ struct DeviceState { QemuOpts *opts; int hotplugged; BusState *parent_bus; - int num_gpio_out; - qemu_irq *gpio_out; - int num_gpio_in; - qemu_irq *gpio_in; + QLIST_HEAD(, NamedGPIOList) gpios; QLIST_HEAD(, BusState) child_bus; int num_child_bus; int instance_id_alias; @@ -252,7 +260,11 @@ 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_in_named(DeviceState *dev, const char *name, int n); + void qdev_connect_gpio_out(DeviceState *dev, int n, qemu_irq pin); +void qdev_connect_gpio_out_named(DeviceState *dev, const char *name, int n, + qemu_irq pin); BusState *qdev_get_child_bus(DeviceState *dev, const char *name); @@ -262,6 +274,10 @@ BusState *qdev_get_child_bus(DeviceState *dev, const char *name); /* GPIO inputs also double as IRQ sinks. */ void qdev_init_gpio_in(DeviceState *dev, qemu_irq_handler handler, int n); void qdev_init_gpio_out(DeviceState *dev, qemu_irq *pins, int n); +void qdev_init_gpio_in_named(DeviceState *dev, qemu_irq_handler handler, + const char *name, int n); +void qdev_init_gpio_out_named(DeviceState *dev, qemu_irq *pins, + const char *name, int n); BusState *qdev_get_parent_bus(DeviceState *dev); |