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 15501f062eSMark Cave-Ayland * + Named GPIO input "ps2-kbd-input-irq": set to 1 if the downstream PS2 16501f062eSMark Cave-Ayland * keyboard device has asserted its irq 17501f062eSMark Cave-Ayland * + Named GPIO input "ps2-mouse-input-irq": set to 1 if the downstream PS2 18501f062eSMark Cave-Ayland * mouse device has asserted its irq 19501f062eSMark Cave-Ayland */ 20501f062eSMark Cave-Ayland 212a6505b0SSven Schnelle #ifndef HW_INPUT_LASIPS2_H 222a6505b0SSven Schnelle #define HW_INPUT_LASIPS2_H 232a6505b0SSven Schnelle 242a6505b0SSven Schnelle #include "exec/hwaddr.h" 2507c68b50SMark Cave-Ayland #include "hw/sysbus.h" 26f4907cb5SMark Cave-Ayland #include "hw/input/ps2.h" 2707c68b50SMark Cave-Ayland 28f8d89a7dSMark Cave-Ayland #define TYPE_LASIPS2_PORT "lasips2-port" 29*62201e43SMark Cave-Ayland OBJECT_DECLARE_TYPE(LASIPS2Port, LASIPS2PortDeviceClass, LASIPS2_PORT) 30*62201e43SMark Cave-Ayland 31*62201e43SMark Cave-Ayland struct LASIPS2PortDeviceClass { 32*62201e43SMark Cave-Ayland DeviceClass parent; 33*62201e43SMark 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; 47c553d6c0SMark Cave-Ayland bool birq; 488db817beSMark Cave-Ayland qemu_irq irq; 49f8d89a7dSMark Cave-Ayland }; 5007c68b50SMark Cave-Ayland 51ef90a06fSMark Cave-Ayland #define TYPE_LASIPS2_KBD_PORT "lasips2-kbd-port" 52ef90a06fSMark Cave-Ayland OBJECT_DECLARE_SIMPLE_TYPE(LASIPS2KbdPort, LASIPS2_KBD_PORT) 53ef90a06fSMark Cave-Ayland 54ef90a06fSMark Cave-Ayland struct LASIPS2KbdPort { 55ef90a06fSMark Cave-Ayland LASIPS2Port parent_obj; 56ef90a06fSMark Cave-Ayland }; 57ef90a06fSMark Cave-Ayland 58cb5827ceSMark Cave-Ayland #define TYPE_LASIPS2_MOUSE_PORT "lasips2-mouse-port" 59cb5827ceSMark Cave-Ayland OBJECT_DECLARE_SIMPLE_TYPE(LASIPS2MousePort, LASIPS2_MOUSE_PORT) 60cb5827ceSMark Cave-Ayland 61cb5827ceSMark Cave-Ayland struct LASIPS2MousePort { 62cb5827ceSMark Cave-Ayland LASIPS2Port parent_obj; 63cb5827ceSMark Cave-Ayland }; 64cb5827ceSMark Cave-Ayland 6507c68b50SMark Cave-Ayland struct LASIPS2State { 6607c68b50SMark Cave-Ayland SysBusDevice parent_obj; 6707c68b50SMark Cave-Ayland 68b7047733SMark Cave-Ayland LASIPS2KbdPort kbd_port; 69a088ce9bSMark Cave-Ayland LASIPS2MousePort mouse_port; 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