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" 2962201e43SMark Cave-Ayland OBJECT_DECLARE_TYPE(LASIPS2Port, LASIPS2PortDeviceClass, LASIPS2_PORT) 3062201e43SMark Cave-Ayland 3162201e43SMark Cave-Ayland struct LASIPS2PortDeviceClass { 3262201e43SMark Cave-Ayland DeviceClass parent; 33d0af5d6aSMark Cave-Ayland 34d0af5d6aSMark Cave-Ayland DeviceRealize parent_realize; 3562201e43SMark Cave-Ayland }; 36f8d89a7dSMark Cave-Ayland 37f8d89a7dSMark Cave-Ayland typedef struct LASIPS2State LASIPS2State; 38f8d89a7dSMark Cave-Ayland 39f8d89a7dSMark Cave-Ayland struct LASIPS2Port { 40f8d89a7dSMark Cave-Ayland DeviceState parent_obj; 41f8d89a7dSMark Cave-Ayland 42f8d89a7dSMark Cave-Ayland LASIPS2State *parent; 4307c68b50SMark Cave-Ayland MemoryRegion reg; 44f4907cb5SMark Cave-Ayland PS2State *ps2dev; 4507c68b50SMark Cave-Ayland uint8_t id; 4607c68b50SMark Cave-Ayland uint8_t control; 4707c68b50SMark Cave-Ayland uint8_t buf; 4807c68b50SMark Cave-Ayland bool loopback_rbne; 49c553d6c0SMark Cave-Ayland bool birq; 508db817beSMark Cave-Ayland qemu_irq irq; 51f8d89a7dSMark Cave-Ayland }; 5207c68b50SMark Cave-Ayland 53ef90a06fSMark Cave-Ayland #define TYPE_LASIPS2_KBD_PORT "lasips2-kbd-port" 54ef90a06fSMark Cave-Ayland OBJECT_DECLARE_SIMPLE_TYPE(LASIPS2KbdPort, LASIPS2_KBD_PORT) 55ef90a06fSMark Cave-Ayland 56ef90a06fSMark Cave-Ayland struct LASIPS2KbdPort { 57ef90a06fSMark Cave-Ayland LASIPS2Port parent_obj; 58ef90a06fSMark Cave-Ayland }; 59ef90a06fSMark Cave-Ayland 60cb5827ceSMark Cave-Ayland #define TYPE_LASIPS2_MOUSE_PORT "lasips2-mouse-port" 61cb5827ceSMark Cave-Ayland OBJECT_DECLARE_SIMPLE_TYPE(LASIPS2MousePort, LASIPS2_MOUSE_PORT) 62cb5827ceSMark Cave-Ayland 63cb5827ceSMark Cave-Ayland struct LASIPS2MousePort { 64cb5827ceSMark Cave-Ayland LASIPS2Port parent_obj; 65cb5827ceSMark Cave-Ayland }; 66cb5827ceSMark Cave-Ayland 6707c68b50SMark Cave-Ayland struct LASIPS2State { 6807c68b50SMark Cave-Ayland SysBusDevice parent_obj; 6907c68b50SMark Cave-Ayland 70b7047733SMark Cave-Ayland LASIPS2KbdPort kbd_port; 71a088ce9bSMark Cave-Ayland LASIPS2MousePort mouse_port; 72*ca735a81SMark Cave-Ayland uint8_t int_status; 7307c68b50SMark Cave-Ayland qemu_irq irq; 7407c68b50SMark Cave-Ayland }; 752a6505b0SSven Schnelle 762a6505b0SSven Schnelle #define TYPE_LASIPS2 "lasips2" 7707c68b50SMark Cave-Ayland OBJECT_DECLARE_SIMPLE_TYPE(LASIPS2State, LASIPS2) 782a6505b0SSven Schnelle 792a6505b0SSven Schnelle #endif /* HW_INPUT_LASIPS2_H */ 80