All of lore.kernel.org
 help / color / mirror / Atom feed
From: Frederic Konrad <fred.konrad@greensocs.com>
To: Alistair Francis <alistair.francis@xilinx.com>, qemu-devel@nongnu.org
Cc: edgar.iglesias@xilinx.com, peter.maydell@linaro.org,
	crosthwaitepeter@gmail.com, afaerber@suse.de,
	edgar.iglesias@gmail.com
Subject: Re: [Qemu-devel] [PATCH v2 11/16] qdev: Define qdev_get_gpio_out
Date: Thu, 28 Jan 2016 16:44:00 +0100	[thread overview]
Message-ID: <56AA3740.7060509@greensocs.com> (raw)
In-Reply-To: <081cdaf70459a467622cdebd83e30c72ae16f251.1453237258.git.alistair.francis@xilinx.com>

On 19/01/2016 23:35, Alistair Francis wrote:
> From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
>
> 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 <peter.crosthwaite@xilinx.com>
> Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
> ---
>
>  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,

  reply	other threads:[~2016-01-28 15:44 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-19 22:34 [Qemu-devel] [PATCH v2 00/16] data-driven device registers Alistair Francis
2016-01-19 22:34 ` [Qemu-devel] [PATCH v2 01/16] memory: Allow subregions to not be printed by info mtree Alistair Francis
2016-01-27 15:05   ` KONRAD Frederic
2016-01-19 22:34 ` [Qemu-devel] [PATCH v2 02/16] register: Add Register API Alistair Francis
2016-01-27 14:46   ` KONRAD Frederic
2016-01-28 21:57     ` Alistair Francis
2016-01-19 22:35 ` [Qemu-devel] [PATCH v2 03/16] register: Add Memory API glue Alistair Francis
2016-01-27 14:51   ` KONRAD Frederic
2016-01-30  0:25     ` Alistair Francis
2016-01-19 22:35 ` [Qemu-devel] [PATCH v2 04/16] register: Add support for decoding information Alistair Francis
2016-01-27 15:09   ` KONRAD Frederic
2016-01-29 23:30     ` Alistair Francis
2016-01-19 22:35 ` [Qemu-devel] [PATCH v2 05/16] register: Define REG and FIELD macros Alistair Francis
2016-01-19 22:35 ` [Qemu-devel] [PATCH v2 06/16] register: QOMify Alistair Francis
2016-01-27 15:14   ` KONRAD Frederic
2016-01-19 22:35 ` [Qemu-devel] [PATCH v2 07/16] register: Add block initialise helper Alistair Francis
2016-01-27 15:17   ` KONRAD Frederic
2016-01-19 22:35 ` [Qemu-devel] [PATCH v2 08/16] bitops: Add ONES macro Alistair Francis
2016-01-19 22:35 ` [Qemu-devel] [PATCH v2 09/16] dma: Add Xilinx Zynq devcfg device model Alistair Francis
2016-01-19 22:35 ` [Qemu-devel] [PATCH v2 10/16] xilinx_zynq: add devcfg to machine model Alistair Francis
2016-01-19 22:35 ` [Qemu-devel] [PATCH v2 11/16] qdev: Define qdev_get_gpio_out Alistair Francis
2016-01-28 15:44   ` Frederic Konrad [this message]
2016-01-30  0:23     ` Alistair Francis
2016-01-19 22:35 ` [Qemu-devel] [PATCH v2 12/16] qdev: Add qdev_pass_all_gpios API Alistair Francis
2016-01-19 22:35 ` [Qemu-devel] [PATCH v2 13/16] irq: Add opaque setter routine Alistair Francis
2016-01-19 22:35 ` [Qemu-devel] [PATCH v2 14/16] register: Add GPIO API Alistair Francis
2016-01-19 22:35 ` [Qemu-devel] [PATCH v2 15/16] misc: Introduce ZynqMP IOU SLCR Alistair Francis
2016-01-19 22:35 ` [Qemu-devel] [PATCH v2 16/16] xlnx-zynqmp: Connect the " Alistair Francis
2016-01-21  1:42 ` [Qemu-devel] [PATCH v2 00/16] data-driven device registers Alistair Francis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56AA3740.7060509@greensocs.com \
    --to=fred.konrad@greensocs.com \
    --cc=afaerber@suse.de \
    --cc=alistair.francis@xilinx.com \
    --cc=crosthwaitepeter@gmail.com \
    --cc=edgar.iglesias@gmail.com \
    --cc=edgar.iglesias@xilinx.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.