mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-28 21:03:54 -06:00
qdev: Implement named GPIOs
Implement named GPIOs on the Device layer. Listifies the existing GPIOs stuff using string keys. Legacy un-named GPIOs are preserved by using a NULL name string - they are just a single matchable element in the name list. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
parent
6b1b144019
commit
a5f54290ce
4 changed files with 120 additions and 24 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue