master
h 78 lines 1.62 KB
Raw
1 /*
2 * QEMU LASI PS/2 emulation
3 *
4 * Copyright (c) 2019 Sven Schnelle
5 *
6 */
7
8 /*
9 * QEMU interface:
10 * + sysbus MMIO region 0: MemoryRegion defining the LASI PS2 keyboard
11 * registers
12 * + sysbus MMIO region 1: MemoryRegion defining the LASI PS2 mouse
13 * registers
14 * + sysbus IRQ 0: LASI PS2 output irq
15 * + Named GPIO input "lasips2-port-input-irq[0..1]": set to 1 if the downstream
16 * LASIPS2Port has asserted its irq
17 */
18
19 #ifndef HW_INPUT_LASIPS2_H
20 #define HW_INPUT_LASIPS2_H
21
22 #include "exec/hwaddr.h"
23 #include "hw/core/sysbus.h"
24 #include "hw/input/ps2.h"
25
26 #define TYPE_LASIPS2_PORT "lasips2-port"
27 OBJECT_DECLARE_TYPE(LASIPS2Port, LASIPS2PortDeviceClass, LASIPS2_PORT)
28
29 struct LASIPS2PortDeviceClass {
30 DeviceClass parent;
31
32 DeviceRealize parent_realize;
33 };
34
35 #define TYPE_LASIPS2 "lasips2"
36 OBJECT_DECLARE_SIMPLE_TYPE(LASIPS2State, LASIPS2)
37
38 struct LASIPS2Port {
39 DeviceState parent_obj;
40
41 LASIPS2State *lasips2;
42 MemoryRegion reg;
43 PS2State *ps2dev;
44 uint8_t id;
45 uint8_t control;
46 uint8_t buf;
47 bool loopback_rbne;
48 qemu_irq irq;
49 };
50
51 #define TYPE_LASIPS2_KBD_PORT "lasips2-kbd-port"
52 OBJECT_DECLARE_SIMPLE_TYPE(LASIPS2KbdPort, LASIPS2_KBD_PORT)
53
54 struct LASIPS2KbdPort {
55 LASIPS2Port parent_obj;
56
57 PS2KbdState kbd;
58 };
59
60 #define TYPE_LASIPS2_MOUSE_PORT "lasips2-mouse-port"
61 OBJECT_DECLARE_SIMPLE_TYPE(LASIPS2MousePort, LASIPS2_MOUSE_PORT)
62
63 struct LASIPS2MousePort {
64 LASIPS2Port parent_obj;
65
66 PS2MouseState mouse;
67 };
68
69 struct LASIPS2State {
70 SysBusDevice parent_obj;
71
72 LASIPS2KbdPort kbd_port;
73 LASIPS2MousePort mouse_port;
74 uint8_t int_status;
75 qemu_irq irq;
76 };
77
78 #endif /* HW_INPUT_LASIPS2_H */