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 15212a3003SMark Cave-Ayland * + Named GPIO input "lasips2-port-input-irq[0..1]": set to 1 if the downstream 16212a3003SMark 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 4001f6c546SMark Cave-Ayland LASIPS2State *lasips2; 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; 55e2b50aeaSMark Cave-Ayland 56e2b50aeaSMark Cave-Ayland PS2KbdState kbd; 57ef90a06fSMark Cave-Ayland }; 58ef90a06fSMark Cave-Ayland 59cb5827ceSMark Cave-Ayland #define TYPE_LASIPS2_MOUSE_PORT "lasips2-mouse-port" 60cb5827ceSMark Cave-Ayland OBJECT_DECLARE_SIMPLE_TYPE(LASIPS2MousePort, LASIPS2_MOUSE_PORT) 61cb5827ceSMark Cave-Ayland 62cb5827ceSMark Cave-Ayland struct LASIPS2MousePort { 63cb5827ceSMark Cave-Ayland LASIPS2Port parent_obj; 64*d316983cSMark Cave-Ayland 65*d316983cSMark Cave-Ayland PS2MouseState mouse; 66cb5827ceSMark Cave-Ayland }; 67cb5827ceSMark Cave-Ayland 6807c68b50SMark Cave-Ayland struct LASIPS2State { 6907c68b50SMark Cave-Ayland SysBusDevice parent_obj; 7007c68b50SMark Cave-Ayland 71b7047733SMark Cave-Ayland LASIPS2KbdPort kbd_port; 72a088ce9bSMark Cave-Ayland LASIPS2MousePort mouse_port; 73ca735a81SMark Cave-Ayland uint8_t int_status; 7407c68b50SMark Cave-Ayland qemu_irq irq; 7507c68b50SMark Cave-Ayland }; 762a6505b0SSven Schnelle 772a6505b0SSven Schnelle #define TYPE_LASIPS2 "lasips2" 7807c68b50SMark Cave-Ayland OBJECT_DECLARE_SIMPLE_TYPE(LASIPS2State, LASIPS2) 792a6505b0SSven Schnelle 802a6505b0SSven Schnelle #endif /* HW_INPUT_LASIPS2_H */ 81