Merge tag 'pull-loongarch-20241016' of https://gitlab.com/gaosong/qemu into staging
[qemu/armbru.git] / include / hw / input / lasips2.h
blob01911c50f9b1fdf3a0785f6b168b3d6c7b90960b
1 /*
2 * QEMU LASI PS/2 emulation
4 * Copyright (c) 2019 Sven Schnelle
6 */
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
19 #ifndef HW_INPUT_LASIPS2_H
20 #define HW_INPUT_LASIPS2_H
22 #include "exec/hwaddr.h"
23 #include "hw/sysbus.h"
24 #include "hw/input/ps2.h"
26 #define TYPE_LASIPS2_PORT "lasips2-port"
27 OBJECT_DECLARE_TYPE(LASIPS2Port, LASIPS2PortDeviceClass, LASIPS2_PORT)
29 struct LASIPS2PortDeviceClass {
30 DeviceClass parent;
32 DeviceRealize parent_realize;
35 typedef struct LASIPS2State LASIPS2State;
37 struct LASIPS2Port {
38 DeviceState parent_obj;
40 LASIPS2State *lasips2;
41 MemoryRegion reg;
42 PS2State *ps2dev;
43 uint8_t id;
44 uint8_t control;
45 uint8_t buf;
46 bool loopback_rbne;
47 qemu_irq irq;
50 #define TYPE_LASIPS2_KBD_PORT "lasips2-kbd-port"
51 OBJECT_DECLARE_SIMPLE_TYPE(LASIPS2KbdPort, LASIPS2_KBD_PORT)
53 struct LASIPS2KbdPort {
54 LASIPS2Port parent_obj;
56 PS2KbdState kbd;
59 #define TYPE_LASIPS2_MOUSE_PORT "lasips2-mouse-port"
60 OBJECT_DECLARE_SIMPLE_TYPE(LASIPS2MousePort, LASIPS2_MOUSE_PORT)
62 struct LASIPS2MousePort {
63 LASIPS2Port parent_obj;
65 PS2MouseState mouse;
68 struct LASIPS2State {
69 SysBusDevice parent_obj;
71 LASIPS2KbdPort kbd_port;
72 LASIPS2MousePort mouse_port;
73 uint8_t int_status;
74 qemu_irq irq;
77 #define TYPE_LASIPS2 "lasips2"
78 OBJECT_DECLARE_SIMPLE_TYPE(LASIPS2State, LASIPS2)
80 #endif /* HW_INPUT_LASIPS2_H */