diff options
| author | Peter Maydell <peter.maydell@linaro.org> | 2023-10-30 11:48:01 +0000 |
|---|---|---|
| committer | Peter Maydell <peter.maydell@linaro.org> | 2023-11-02 12:52:06 +0000 |
| commit | a75f336b97a643fc536ba847042f840890e9b378 (patch) | |
| tree | 8a0718fe4c5c7326dd503d7b69462d447fcd672e /include | |
| parent | 5f8d505e3a60b957530c7ad9b1214cc440d8b951 (diff) | |
| download | focaccia-qemu-a75f336b97a643fc536ba847042f840890e9b378.tar.gz focaccia-qemu-a75f336b97a643fc536ba847042f840890e9b378.zip | |
hw/input/stellaris_input: Convert to qdev
Convert the hw/input/stellaris_input device to qdev. The interface uses an array property for the board to specify the keycodes to use, so the s->keycodes memory is now allocated by the array-property machinery. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-id: 20231030114802.3671871-6-peter.maydell@linaro.org
Diffstat (limited to 'include')
| -rw-r--r-- | include/hw/input/stellaris_gamepad.h | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/include/hw/input/stellaris_gamepad.h b/include/hw/input/stellaris_gamepad.h index 23cfd3c95f..d6a6aecb06 100644 --- a/include/hw/input/stellaris_gamepad.h +++ b/include/hw/input/stellaris_gamepad.h @@ -11,8 +11,27 @@ #ifndef HW_INPUT_STELLARIS_GAMEPAD_H #define HW_INPUT_STELLARIS_GAMEPAD_H +#include "hw/sysbus.h" +#include "qom/object.h" -/* stellaris_gamepad.c */ -void stellaris_gamepad_init(int n, qemu_irq *irq, const int *keycode); +/* + * QEMU interface: + * + QOM array property "keycodes": uint32_t QEMU keycodes to handle + * + unnamed GPIO outputs: one per keycode, in the same order as the + * "keycodes" array property entries; asserted when key is down + */ + +#define TYPE_STELLARIS_GAMEPAD "stellaris-gamepad" +OBJECT_DECLARE_SIMPLE_TYPE(StellarisGamepad, STELLARIS_GAMEPAD) + +struct StellarisGamepad { + SysBusDevice parent_obj; + + uint32_t num_buttons; + qemu_irq *irqs; + uint32_t *keycodes; + uint8_t *pressed; + int extension; +}; #endif |