[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 11/16] qdev: Define qdev_get_gpio_out
From: |
Frederic Konrad |
Subject: |
Re: [Qemu-devel] [PATCH v2 11/16] qdev: Define qdev_get_gpio_out |
Date: |
Thu, 28 Jan 2016 16:44:00 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 |
On 19/01/2016 23:35, Alistair Francis wrote:
> From: Peter Crosthwaite <address@hidden>
>
> An API similar to the existing qdev_get_gpio_in() except gets outputs.
> Useful for:
>
> 1: Implementing lightweight devices that don't want to keep pointers
> to their own GPIOs. They can get their GPIO pointers at runtime from
> QOM using this API.
>
> 2: 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>
> Signed-off-by: Alistair Francis <address@hidden>
> ---
>
> hw/core/qdev.c | 12 ++++++++++++
> include/hw/qdev-core.h | 2 ++
> 2 files changed, 14 insertions(+)
>
> diff --git a/hw/core/qdev.c b/hw/core/qdev.c
> index 2c7101d..308e4a1 100644
> --- a/hw/core/qdev.c
> +++ b/hw/core/qdev.c
> @@ -489,6 +489,18 @@ qemu_irq qdev_get_gpio_in(DeviceState *dev, int n)
> return qdev_get_gpio_in_named(dev, NULL, n);
> }
>
> +qemu_irq qdev_get_gpio_out_named(DeviceState *dev, const char *name, int n)
> +{
> + char *propname = g_strdup_printf("%s[%d]",
> + name ? name : "unnamed-gpio-out", n);
> + return (qemu_irq)object_property_get_link(OBJECT(dev), propname, NULL);
> +}
Why don't we have the same implementation than qdev_get_gpio_in_named ?
qemu_irq qdev_get_gpio_in_named(DeviceState *dev, const char *name, int n)
{
NamedGPIOList *gpio_list = qdev_get_named_gpio_list(dev, name);
assert(n >= 0 && n < gpio_list->num_in);
return gpio_list->in[n];
}
Thanks,
Fred
> +
> +qemu_irq qdev_get_gpio_out(DeviceState *dev, int n)
> +{
> + return qdev_get_gpio_out_named(dev, NULL, n);
> +}
> +
> void qdev_connect_gpio_out_named(DeviceState *dev, const char *name, int n,
> qemu_irq pin)
> {
> diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
> index abcdee8..0a09b8a 100644
> --- a/include/hw/qdev-core.h
> +++ b/include/hw/qdev-core.h
> @@ -287,6 +287,8 @@ 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);
> +qemu_irq qdev_get_gpio_out(DeviceState *dev, int n);
> +qemu_irq qdev_get_gpio_out_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,
- Re: [Qemu-devel] [PATCH v2 04/16] register: Add support for decoding information, (continued)
- [Qemu-devel] [PATCH v2 05/16] register: Define REG and FIELD macros, Alistair Francis, 2016/01/19
- [Qemu-devel] [PATCH v2 06/16] register: QOMify, Alistair Francis, 2016/01/19
- [Qemu-devel] [PATCH v2 07/16] register: Add block initialise helper, Alistair Francis, 2016/01/19
- [Qemu-devel] [PATCH v2 08/16] bitops: Add ONES macro, Alistair Francis, 2016/01/19
- [Qemu-devel] [PATCH v2 09/16] dma: Add Xilinx Zynq devcfg device model, Alistair Francis, 2016/01/19
- [Qemu-devel] [PATCH v2 10/16] xilinx_zynq: add devcfg to machine model, Alistair Francis, 2016/01/19
- [Qemu-devel] [PATCH v2 11/16] qdev: Define qdev_get_gpio_out, Alistair Francis, 2016/01/19
- Re: [Qemu-devel] [PATCH v2 11/16] qdev: Define qdev_get_gpio_out,
Frederic Konrad <=
- [Qemu-devel] [PATCH v2 13/16] irq: Add opaque setter routine, Alistair Francis, 2016/01/19
- [Qemu-devel] [PATCH v2 12/16] qdev: Add qdev_pass_all_gpios API, Alistair Francis, 2016/01/19
- [Qemu-devel] [PATCH v2 14/16] register: Add GPIO API, Alistair Francis, 2016/01/19
- [Qemu-devel] [PATCH v2 15/16] misc: Introduce ZynqMP IOU SLCR, Alistair Francis, 2016/01/19
- [Qemu-devel] [PATCH v2 16/16] xlnx-zynqmp: Connect the ZynqMP IOU SLCR, Alistair Francis, 2016/01/19
- Re: [Qemu-devel] [PATCH v2 00/16] data-driven device registers, Alistair Francis, 2016/01/20