xref: /qemu/include/hw/input/lasips2.h (revision 212a3003033224d1821e7cecc70b38d7a7f08ff4)
12a6505b0SSven Schnelle /*
22a6505b0SSven Schnelle  * QEMU LASI PS/2 emulation
32a6505b0SSven Schnelle  *
42a6505b0SSven Schnelle  * Copyright (c) 2019 Sven Schnelle
52a6505b0SSven Schnelle  *
62a6505b0SSven Schnelle  */
7501f062eSMark Cave-Ayland 
8501f062eSMark Cave-Ayland /*
9501f062eSMark Cave-Ayland  * QEMU interface:
10501f062eSMark Cave-Ayland  * + sysbus MMIO region 0: MemoryRegion defining the LASI PS2 keyboard
11501f062eSMark Cave-Ayland  *   registers
12501f062eSMark Cave-Ayland  * + sysbus MMIO region 1: MemoryRegion defining the LASI PS2 mouse
13501f062eSMark Cave-Ayland  *   registers
14501f062eSMark Cave-Ayland  * + sysbus IRQ 0: LASI PS2 output irq
15*212a3003SMark Cave-Ayland  * + Named GPIO input "lasips2-port-input-irq[0..1]": set to 1 if the downstream
16*212a3003SMark Cave-Ayland  *   LASIPS2Port has asserted its irq
17501f062eSMark Cave-Ayland  */
18501f062eSMark Cave-Ayland 
192a6505b0SSven Schnelle #ifndef HW_INPUT_LASIPS2_H
202a6505b0SSven Schnelle #define HW_INPUT_LASIPS2_H
212a6505b0SSven Schnelle 
222a6505b0SSven Schnelle #include "exec/hwaddr.h"
2307c68b50SMark Cave-Ayland #include "hw/sysbus.h"
24f4907cb5SMark Cave-Ayland #include "hw/input/ps2.h"
2507c68b50SMark Cave-Ayland 
26f8d89a7dSMark Cave-Ayland #define TYPE_LASIPS2_PORT "lasips2-port"
2762201e43SMark Cave-Ayland OBJECT_DECLARE_TYPE(LASIPS2Port, LASIPS2PortDeviceClass, LASIPS2_PORT)
2862201e43SMark Cave-Ayland 
2962201e43SMark Cave-Ayland struct LASIPS2PortDeviceClass {
3062201e43SMark Cave-Ayland     DeviceClass parent;
31d0af5d6aSMark Cave-Ayland 
32d0af5d6aSMark Cave-Ayland     DeviceRealize parent_realize;
3362201e43SMark Cave-Ayland };
34f8d89a7dSMark Cave-Ayland 
35f8d89a7dSMark Cave-Ayland typedef struct LASIPS2State LASIPS2State;
36f8d89a7dSMark Cave-Ayland 
37f8d89a7dSMark Cave-Ayland struct LASIPS2Port {
38f8d89a7dSMark Cave-Ayland     DeviceState parent_obj;
39f8d89a7dSMark Cave-Ayland 
40f8d89a7dSMark Cave-Ayland     LASIPS2State *parent;
4107c68b50SMark Cave-Ayland     MemoryRegion reg;
42f4907cb5SMark Cave-Ayland     PS2State *ps2dev;
4307c68b50SMark Cave-Ayland     uint8_t id;
4407c68b50SMark Cave-Ayland     uint8_t control;
4507c68b50SMark Cave-Ayland     uint8_t buf;
4607c68b50SMark Cave-Ayland     bool loopback_rbne;
478db817beSMark Cave-Ayland     qemu_irq irq;
48f8d89a7dSMark Cave-Ayland };
4907c68b50SMark Cave-Ayland 
50ef90a06fSMark Cave-Ayland #define TYPE_LASIPS2_KBD_PORT "lasips2-kbd-port"
51ef90a06fSMark Cave-Ayland OBJECT_DECLARE_SIMPLE_TYPE(LASIPS2KbdPort, LASIPS2_KBD_PORT)
52ef90a06fSMark Cave-Ayland 
53ef90a06fSMark Cave-Ayland struct LASIPS2KbdPort {
54ef90a06fSMark Cave-Ayland     LASIPS2Port parent_obj;
55ef90a06fSMark Cave-Ayland };
56ef90a06fSMark Cave-Ayland 
57cb5827ceSMark Cave-Ayland #define TYPE_LASIPS2_MOUSE_PORT "lasips2-mouse-port"
58cb5827ceSMark Cave-Ayland OBJECT_DECLARE_SIMPLE_TYPE(LASIPS2MousePort, LASIPS2_MOUSE_PORT)
59cb5827ceSMark Cave-Ayland 
60cb5827ceSMark Cave-Ayland struct LASIPS2MousePort {
61cb5827ceSMark Cave-Ayland     LASIPS2Port parent_obj;
62cb5827ceSMark Cave-Ayland };
63cb5827ceSMark Cave-Ayland 
6407c68b50SMark Cave-Ayland struct LASIPS2State {
6507c68b50SMark Cave-Ayland     SysBusDevice parent_obj;
6607c68b50SMark Cave-Ayland 
67b7047733SMark Cave-Ayland     LASIPS2KbdPort kbd_port;
68a088ce9bSMark Cave-Ayland     LASIPS2MousePort mouse_port;
69ca735a81SMark Cave-Ayland     uint8_t int_status;
7007c68b50SMark Cave-Ayland     qemu_irq irq;
7107c68b50SMark Cave-Ayland };
722a6505b0SSven Schnelle 
732a6505b0SSven Schnelle #define TYPE_LASIPS2 "lasips2"
7407c68b50SMark Cave-Ayland OBJECT_DECLARE_SIMPLE_TYPE(LASIPS2State, LASIPS2)
752a6505b0SSven Schnelle 
762a6505b0SSven Schnelle #endif /* HW_INPUT_LASIPS2_H */
77