[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 06/17] hw/misc/max111x: provide QOM properties for setting in
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PATCH 06/17] hw/misc/max111x: provide QOM properties for setting initial values |
Date: |
Mon, 29 Jun 2020 11:01:20 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 |
On 6/28/20 4:24 PM, Peter Maydell wrote:
> Add some QOM properties to the max111x ADC device to allow the
> initial values to be configured. Currently this is done by
> board code calling max111x_set_input() after it creates the
> device, which doesn't work on system reset.
>
> This requires us to implement a reset method for this device,
> so while we're doing that make sure we reset the other parts
> of the device state.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> hw/misc/max111x.c | 57 ++++++++++++++++++++++++++++++++++++++---------
> 1 file changed, 47 insertions(+), 10 deletions(-)
>
> diff --git a/hw/misc/max111x.c b/hw/misc/max111x.c
> index 2b87bdee5b7..d0e5534e4f5 100644
> --- a/hw/misc/max111x.c
> +++ b/hw/misc/max111x.c
> @@ -15,11 +15,15 @@
> #include "hw/ssi/ssi.h"
> #include "migration/vmstate.h"
> #include "qemu/module.h"
> +#include "hw/qdev-properties.h"
>
> typedef struct {
> SSISlave parent_obj;
>
> qemu_irq interrupt;
> + /* Values of inputs at system reset (settable by QOM property) */
> + uint8_t reset_input[8];
> +
> uint8_t tb1, rb2, rb3;
> int cycle;
>
An eventual improvement is to make 'inputs' a class property:
MAX111xClass {
SSISlaveClass parent_obj;
unsigned input_count;
}
"eventual" because from a QOM point it is cleaner, but we'd have
to add more boiler-plate casts, so code less clear.
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
- Re: [PATCH 02/17] hw/arm/spitz: Create SpitzMachineClass abstract base class, (continued)
- [PATCH 05/17] hw/arm/spitz: Implement inbound GPIO lines for bit5 and power signals, Peter Maydell, 2020/06/28
- [PATCH 04/17] hw/arm/spitz: Keep pointers to scp0, scp1 in SpitzMachineState, Peter Maydell, 2020/06/28
- [PATCH 07/17] hw/misc/max111x: Don't use vmstate_register(), Peter Maydell, 2020/06/28
- [PATCH 06/17] hw/misc/max111x: provide QOM properties for setting initial values, Peter Maydell, 2020/06/28
- [PATCH 08/17] ssi: Add ssi_realize_and_unref(), Peter Maydell, 2020/06/28
- [PATCH 09/17] hw/arm/spitz: Use max111x properties to set initial values, Peter Maydell, 2020/06/28
- [PATCH 10/17] hw/misc/max111x: Use GPIO lines rather than max111x_set_input(), Peter Maydell, 2020/06/28
- [PATCH 11/17] hw/misc/max111x: Create header file for documentation, TYPE_ macros, Peter Maydell, 2020/06/28