| 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 | |
| 11 | #ifndef HW_INPUT_STELLARIS_GAMEPAD_H |
| 12 | #define HW_INPUT_STELLARIS_GAMEPAD_H |
| 13 | |
| 14 | #include "hw/core/sysbus.h" |
| 15 | #include "qom/object.h" |
| 16 | #include "ui/input.h" |
| 17 | |
| 18 | /* |
| 19 | * QEMU interface: |
| 20 | * + QOM array property "keycodes": uint32_t QEMU keycodes to handle |
| 21 | * (these are QCodes, ie the Q_KEY_* values) |
| 22 | * + unnamed GPIO outputs: one per keycode, in the same order as the |
| 23 | * "keycodes" array property entries; asserted when key is down |
| 24 | */ |
| 25 | |
| 26 | #define TYPE_STELLARIS_GAMEPAD "stellaris-gamepad" |
| 27 | OBJECT_DECLARE_SIMPLE_TYPE(StellarisGamepad, STELLARIS_GAMEPAD) |
| 28 | |
| 29 | struct StellarisGamepad { |
| 30 | SysBusDevice parent_obj; |
| 31 | |
| 32 | QemuInputHandlerState *hs; |
| 33 | uint32_t num_buttons; |
| 34 | qemu_irq *irqs; |
| 35 | uint32_t *keycodes; |
| 36 | uint8_t *pressed; |
| 37 | }; |
| 38 | |
| 39 | #endif |