Philippe Mathieu-Daudé | 98fa332 | 2019-04-12 18:54:11 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Gamepad style buttons connected to IRQ/GPIO lines |
| 3 | * |
| 4 | * Copyright (c) 2007 CodeSourcery. |
| 5 | * Written by Paul Brook |
| 6 | * |
| 7 | * This work is licensed under the terms of the GNU GPL, version 2 or later. |
| 8 | * See the COPYING file in the top-level directory. |
| 9 | */ |
| 10 | |
Peter Maydell | c45460d | 2023-10-30 11:47:57 +0000 | [diff] [blame] | 11 | #ifndef HW_INPUT_STELLARIS_GAMEPAD_H |
| 12 | #define HW_INPUT_STELLARIS_GAMEPAD_H |
Philippe Mathieu-Daudé | 98fa332 | 2019-04-12 18:54:11 +0200 | [diff] [blame] | 13 | |
Peter Maydell | a75f336 | 2023-10-30 11:48:01 +0000 | [diff] [blame] | 14 | #include "hw/sysbus.h" |
| 15 | #include "qom/object.h" |
Philippe Mathieu-Daudé | 98fa332 | 2019-04-12 18:54:11 +0200 | [diff] [blame] | 16 | |
Peter Maydell | a75f336 | 2023-10-30 11:48:01 +0000 | [diff] [blame] | 17 | /* |
| 18 | * QEMU interface: |
| 19 | * + QOM array property "keycodes": uint32_t QEMU keycodes to handle |
Peter Maydell | 7c76f39 | 2023-10-30 11:48:02 +0000 | [diff] [blame] | 20 | * (these are QCodes, ie the Q_KEY_* values) |
Peter Maydell | a75f336 | 2023-10-30 11:48:01 +0000 | [diff] [blame] | 21 | * + unnamed GPIO outputs: one per keycode, in the same order as the |
| 22 | * "keycodes" array property entries; asserted when key is down |
| 23 | */ |
| 24 | |
| 25 | #define TYPE_STELLARIS_GAMEPAD "stellaris-gamepad" |
| 26 | OBJECT_DECLARE_SIMPLE_TYPE(StellarisGamepad, STELLARIS_GAMEPAD) |
| 27 | |
| 28 | struct StellarisGamepad { |
| 29 | SysBusDevice parent_obj; |
| 30 | |
| 31 | uint32_t num_buttons; |
| 32 | qemu_irq *irqs; |
| 33 | uint32_t *keycodes; |
| 34 | uint8_t *pressed; |
Peter Maydell | a75f336 | 2023-10-30 11:48:01 +0000 | [diff] [blame] | 35 | }; |
Philippe Mathieu-Daudé | 98fa332 | 2019-04-12 18:54:11 +0200 | [diff] [blame] | 36 | |
| 37 | #endif |