xref: /qemu/include/hw/input/stellaris_gamepad.h (revision 7c76f397fde313bcdfd3781d64fc28dae0e42df8)
198fa3327SPhilippe Mathieu-Daudé /*
298fa3327SPhilippe Mathieu-Daudé  * Gamepad style buttons connected to IRQ/GPIO lines
398fa3327SPhilippe Mathieu-Daudé  *
498fa3327SPhilippe Mathieu-Daudé  * Copyright (c) 2007 CodeSourcery.
598fa3327SPhilippe Mathieu-Daudé  * Written by Paul Brook
698fa3327SPhilippe Mathieu-Daudé  *
798fa3327SPhilippe Mathieu-Daudé  * This work is licensed under the terms of the GNU GPL, version 2 or later.
898fa3327SPhilippe Mathieu-Daudé  * See the COPYING file in the top-level directory.
998fa3327SPhilippe Mathieu-Daudé  */
1098fa3327SPhilippe Mathieu-Daudé 
11c45460deSPeter Maydell #ifndef HW_INPUT_STELLARIS_GAMEPAD_H
12c45460deSPeter Maydell #define HW_INPUT_STELLARIS_GAMEPAD_H
1398fa3327SPhilippe Mathieu-Daudé 
14a75f336bSPeter Maydell #include "hw/sysbus.h"
15a75f336bSPeter Maydell #include "qom/object.h"
1698fa3327SPhilippe Mathieu-Daudé 
17a75f336bSPeter Maydell /*
18a75f336bSPeter Maydell  * QEMU interface:
19a75f336bSPeter Maydell  *  + QOM array property "keycodes": uint32_t QEMU keycodes to handle
20*7c76f397SPeter Maydell  *    (these are QCodes, ie the Q_KEY_* values)
21a75f336bSPeter Maydell  *  + unnamed GPIO outputs: one per keycode, in the same order as the
22a75f336bSPeter Maydell  *    "keycodes" array property entries; asserted when key is down
23a75f336bSPeter Maydell  */
24a75f336bSPeter Maydell 
25a75f336bSPeter Maydell #define TYPE_STELLARIS_GAMEPAD "stellaris-gamepad"
26a75f336bSPeter Maydell OBJECT_DECLARE_SIMPLE_TYPE(StellarisGamepad, STELLARIS_GAMEPAD)
27a75f336bSPeter Maydell 
28a75f336bSPeter Maydell struct StellarisGamepad {
29a75f336bSPeter Maydell     SysBusDevice parent_obj;
30a75f336bSPeter Maydell 
31a75f336bSPeter Maydell     uint32_t num_buttons;
32a75f336bSPeter Maydell     qemu_irq *irqs;
33a75f336bSPeter Maydell     uint32_t *keycodes;
34a75f336bSPeter Maydell     uint8_t *pressed;
35a75f336bSPeter Maydell };
3698fa3327SPhilippe Mathieu-Daudé 
3798fa3327SPhilippe Mathieu-Daudé #endif
38