- Timestamp:
- Nov 25, 2019 1:00:55 PM (5 years ago)
- Location:
- trunk/src/VBox/Devices
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Input/DevPS2.cpp
r82170 r82173 125 125 126 126 127 /**128 * The keyboard controller/device state.129 *130 * @note We use the default critical section for serialize data access.131 */132 typedef struct KBDState133 {134 uint8_t write_cmd; /* if non zero, write data to port 60 is expected */135 uint8_t status;136 uint8_t mode;137 uint8_t dbbout; /* data buffer byte */138 /* keyboard state */139 int32_t translate;140 int32_t xlat_state;141 142 /** Pointer to the device instance - RC. */143 PPDMDEVINSRC pDevInsRC;144 /** Pointer to the device instance - R3 . */145 PPDMDEVINSR3 pDevInsR3;146 /** Pointer to the device instance. */147 PPDMDEVINSR0 pDevInsR0;148 149 /** Keyboard state (implemented in separate PS2K module). */150 #ifdef VBOX_DEVICE_STRUCT_TESTCASE151 uint8_t KbdFiller[PS2K_STRUCT_FILLER];152 #else153 PS2K Kbd;154 #endif155 156 /** Mouse state (implemented in separate PS2M module). */157 #ifdef VBOX_DEVICE_STRUCT_TESTCASE158 uint8_t AuxFiller[PS2M_STRUCT_FILLER];159 #else160 PS2M Aux;161 #endif162 } KBDState;163 164 #ifndef VBOX_DEVICE_STRUCT_TESTCASE165 127 166 128 /* update irq and KBD_STAT_[MOUSE_]OBF */ … … 1118 1080 }; 1119 1081 1120 #endif /* !VBOX_DEVICE_STRUCT_TESTCASE */1121 -
trunk/src/VBox/Devices/Input/DevPS2.h
r82170 r82173 16 16 */ 17 17 18 #ifndef VBOX_INCLUDED_SRC_Input_ PS2Dev_h19 #define VBOX_INCLUDED_SRC_Input_ PS2Dev_h18 #ifndef VBOX_INCLUDED_SRC_Input_DevPS2_h 19 #define VBOX_INCLUDED_SRC_Input_DevPS2_h 20 20 #ifndef RT_WITHOUT_PRAGMA_ONCE 21 21 # pragma once 22 22 #endif 23 23 24 /** The size of the PS2K/PS2M structure fillers. 25 * @note Must be at least as big as the real struct. Compile time assert 26 * makes sure this is so. */ 27 #define PS2K_STRUCT_FILLER 512 28 #define PS2M_STRUCT_FILLER 512 29 30 /* Hide the internal structure. */ 31 #if !(defined(IN_PS2K) || defined(VBOX_DEVICE_STRUCT_TESTCASE)) 24 /** @defgroup grp_devps2 PS/2 Device 25 * @{ 26 */ 27 28 /** Pointer to the shared keyboard (PS/2) controller / device state. */ 29 typedef struct KBDSTATE *PKBDSTATE; 30 31 /** Define a simple PS/2 input device queue. */ 32 #define DEF_PS2Q_TYPE(name, size) \ 33 typedef struct { \ 34 uint32_t rpos; \ 35 uint32_t wpos; \ 36 uint32_t cUsed; \ 37 uint32_t cSize; \ 38 uint8_t abQueue[size]; \ 39 } name 40 41 DEF_PS2Q_TYPE(GeneriQ, 1); 42 43 44 /** @defgroup grp_devps2k DevPS2K - Keyboard 45 * @{ 46 */ 47 48 /** @name HID modifier range. 49 * @{ */ 50 #define HID_MODIFIER_FIRST 0xE0 51 #define HID_MODIFIER_LAST 0xE8 52 /** @} */ 53 54 /** @name USB HID additional constants 55 * @{ */ 56 /** The highest USB usage code reported by VirtualBox. */ 57 #define VBOX_USB_MAX_USAGE_CODE 0xE7 58 /** The size of an array needed to store all USB usage codes */ 59 #define VBOX_USB_USAGE_ARRAY_SIZE (VBOX_USB_MAX_USAGE_CODE + 1) 60 /** USB HID Keyboard Usage Page. */ 61 #define USB_HID_KB_PAGE 7 62 /** USB HID Consumer Control Usage Page. */ 63 #define USB_HID_CC_PAGE 12 64 /** @} */ 65 66 /* Internal keyboard queue sizes. The input queue doesn't need to be 67 * extra huge and the command queue only needs to handle a few bytes. 68 */ 69 #define KBD_KEY_QUEUE_SIZE 64 70 #define KBD_CMD_QUEUE_SIZE 4 71 72 DEF_PS2Q_TYPE(KbdKeyQ, KBD_KEY_QUEUE_SIZE); 73 DEF_PS2Q_TYPE(KbdCmdQ, KBD_CMD_QUEUE_SIZE); 74 75 /** Typematic state. */ 76 typedef enum { 77 KBD_TMS_IDLE = 0, /* No typematic key active. */ 78 KBD_TMS_DELAY = 1, /* In the initial delay period. */ 79 KBD_TMS_REPEAT = 2, /* Key repeating at set rate. */ 80 KBD_TMS_32BIT_HACK = 0x7fffffff 81 } tmatic_state_t; 82 83 84 /** 85 * The shared PS/2 keyboard instance data. 86 */ 32 87 typedef struct PS2K 33 88 { 34 uint8_t abFiller[PS2K_STRUCT_FILLER]; 89 /** Pointer to parent device (keyboard controller). */ 90 R3PTRTYPE(PKBDSTATE) pParent; 91 /** Set if keyboard is enabled ('scans' for input). */ 92 bool fScanning; 93 /** Set NumLock is on. */ 94 bool fNumLockOn; 95 /** Selected scan set. */ 96 uint8_t u8ScanSet; 97 /** Modifier key state. */ 98 uint8_t u8Modifiers; 99 /** Currently processed command (if any). */ 100 uint8_t u8CurrCmd; 101 /** Status indicator (LED) state. */ 102 uint8_t u8LEDs; 103 /** Selected typematic delay/rate. */ 104 uint8_t u8TypematicCfg; 105 /** Usage code of current typematic key, if any. */ 106 uint32_t u32TypematicKey; 107 /** Current typematic repeat state. */ 108 tmatic_state_t enmTypematicState; 109 /** Buffer holding scan codes to be sent to the host. */ 110 KbdKeyQ keyQ; 111 /** Command response queue (priority). */ 112 KbdCmdQ cmdQ; 113 /** Currently depressed keys. */ 114 uint8_t abDepressedKeys[VBOX_USB_USAGE_ARRAY_SIZE]; 115 /** Typematic delay in milliseconds. */ 116 unsigned uTypematicDelay; 117 /** Typematic repeat period in milliseconds. */ 118 unsigned uTypematicRepeat; 119 /** Set if the throttle delay is currently active. */ 120 bool fThrottleActive; 121 /** Set if the input rate should be throttled. */ 122 bool fThrottleEnabled; 123 124 uint8_t Alignment0[2]; 125 126 /** Command delay timer - RC Ptr. */ 127 PTMTIMERRC pKbdDelayTimerRC; 128 /** Typematic timer - RC Ptr. */ 129 PTMTIMERRC pKbdTypematicTimerRC; 130 /** Input throttle timer - RC Ptr. */ 131 PTMTIMERRC pThrottleTimerRC; 132 133 /** The device critical section protecting everything - R3 Ptr */ 134 R3PTRTYPE(PPDMCRITSECT) pCritSectR3; 135 136 /** Command delay timer - R3 Ptr. */ 137 PTMTIMERR3 pKbdDelayTimerR3; 138 /** Typematic timer - R3 Ptr. */ 139 PTMTIMERR3 pKbdTypematicTimerR3; 140 /** Input throttle timer - R3 Ptr. */ 141 PTMTIMERR3 pThrottleTimerR3; 142 143 /** Command delay timer - R0 Ptr. */ 144 PTMTIMERR0 pKbdDelayTimerR0; 145 /** Typematic timer - R0 Ptr. */ 146 PTMTIMERR0 pKbdTypematicTimerR0; 147 /** Input throttle timer - R0 Ptr. */ 148 PTMTIMERR0 pThrottleTimerR0; 149 150 /** 151 * Keyboard port - LUN#0. 152 * 153 * @implements PDMIBASE 154 * @implements PDMIKEYBOARDPORT 155 */ 156 struct 157 { 158 /** The base interface for the keyboard port. */ 159 PDMIBASE IBase; 160 /** The keyboard port base interface. */ 161 PDMIKEYBOARDPORT IPort; 162 163 /** The base interface of the attached keyboard driver. */ 164 R3PTRTYPE(PPDMIBASE) pDrvBase; 165 /** The keyboard interface of the attached keyboard driver. */ 166 R3PTRTYPE(PPDMIKEYBOARDCONNECTOR) pDrv; 167 } Keyboard; 35 168 } PS2K; 36 #endif 37 38 #if !(defined(IN_PS2M) || defined(VBOX_DEVICE_STRUCT_TESTCASE)) 39 typedef struct PS2M 40 { 41 uint8_t abFiller[PS2M_STRUCT_FILLER]; 42 } PS2M; 43 #endif 44 45 /* Internal PS/2 Keyboard interface. */ 46 typedef struct PS2K *PPS2K; 169 /** Pointer to the PS/2 keyboard instance data. */ 170 typedef PS2K *PPS2K; 171 47 172 48 173 int PS2KByteToKbd(PPS2K pThis, uint8_t cmd); 49 174 int PS2KByteFromKbd(PPS2K pThis, uint8_t *pVal); 50 175 51 int PS2KConstruct(PPS2K pThis, PPDMDEVINS pDevIns, void *pParent, intiInstance, PCFGMNODE pCfg);176 int PS2KConstruct(PPS2K pThis, PPDMDEVINS pDevIns, PKBDSTATE pParent, unsigned iInstance, PCFGMNODE pCfg); 52 177 int PS2KAttach(PPS2K pThis, PPDMDEVINS pDevIns, unsigned iLUN, uint32_t fFlags); 53 178 void PS2KReset(PPS2K pThis); … … 59 184 PS2K *KBDGetPS2KFromDevIns(PPDMDEVINS pDevIns); 60 185 61 62 /* Internal PS/2 Auxiliary device interface. */ 63 typedef struct PS2M *PPS2M; 186 /** @} */ 187 188 189 /** @defgroup grp_devps2m DevPS2M - Auxiliary Device (Mouse) 190 * @{ 191 */ 192 193 /* Internal mouse queue sizes. The input queue is relatively large, 194 * but the command queue only needs to handle a few bytes. 195 */ 196 #define AUX_EVT_QUEUE_SIZE 256 197 #define AUX_CMD_QUEUE_SIZE 8 198 199 DEF_PS2Q_TYPE(AuxEvtQ, AUX_EVT_QUEUE_SIZE); 200 DEF_PS2Q_TYPE(AuxCmdQ, AUX_CMD_QUEUE_SIZE); 201 202 /** Auxiliary device special modes of operation. */ 203 typedef enum { 204 AUX_MODE_STD, /* Standard operation. */ 205 AUX_MODE_RESET, /* Currently in reset. */ 206 AUX_MODE_WRAP /* Wrap mode (echoing input). */ 207 } PS2M_MODE; 208 209 /** Auxiliary device operational state. */ 210 typedef enum { 211 AUX_STATE_RATE_ERR = RT_BIT(0), /* Invalid rate received. */ 212 AUX_STATE_RES_ERR = RT_BIT(1), /* Invalid resolution received. */ 213 AUX_STATE_SCALING = RT_BIT(4), /* 2:1 scaling in effect. */ 214 AUX_STATE_ENABLED = RT_BIT(5), /* Reporting enabled in stream mode. */ 215 AUX_STATE_REMOTE = RT_BIT(6) /* Remote mode (reports on request). */ 216 } PS2M_STATE; 217 218 /** Externally visible state bits. */ 219 #define AUX_STATE_EXTERNAL (AUX_STATE_SCALING | AUX_STATE_ENABLED | AUX_STATE_REMOTE) 220 221 /** Protocols supported by the PS/2 mouse. */ 222 typedef enum { 223 PS2M_PROTO_PS2STD = 0, /* Standard PS/2 mouse protocol. */ 224 PS2M_PROTO_IMPS2 = 3, /* IntelliMouse PS/2 protocol. */ 225 PS2M_PROTO_IMEX = 4, /* IntelliMouse Explorer protocol. */ 226 PS2M_PROTO_IMEX_HORZ = 5 /* IntelliMouse Explorer with horizontal reports. */ 227 } PS2M_PROTO; 228 229 /** Protocol selection 'knock' states. */ 230 typedef enum { 231 PS2M_KNOCK_INITIAL, 232 PS2M_KNOCK_1ST, 233 PS2M_KNOCK_IMPS2_2ND, 234 PS2M_KNOCK_IMEX_2ND, 235 PS2M_KNOCK_IMEX_HORZ_2ND 236 } PS2M_KNOCK_STATE; 237 238 /** 239 * The PS/2 auxiliary device instance data. 240 */ 241 typedef struct PS2M 242 { 243 /** Pointer to parent device (keyboard controller). */ 244 R3PTRTYPE(PKBDSTATE) pParent; 245 /** Operational state. */ 246 uint8_t u8State; 247 /** Configured sampling rate. */ 248 uint8_t u8SampleRate; 249 /** Configured resolution. */ 250 uint8_t u8Resolution; 251 /** Currently processed command (if any). */ 252 uint8_t u8CurrCmd; 253 /** Set if the throttle delay is active. */ 254 bool fThrottleActive; 255 /** Set if the throttle delay is active. */ 256 bool fDelayReset; 257 /** Operational mode. */ 258 PS2M_MODE enmMode; 259 /** Currently used protocol. */ 260 PS2M_PROTO enmProtocol; 261 /** Currently used protocol. */ 262 PS2M_KNOCK_STATE enmKnockState; 263 /** Buffer holding mouse events to be sent to the host. */ 264 AuxEvtQ evtQ; 265 /** Command response queue (priority). */ 266 AuxCmdQ cmdQ; 267 /** Accumulated horizontal movement. */ 268 int32_t iAccumX; 269 /** Accumulated vertical movement. */ 270 int32_t iAccumY; 271 /** Accumulated Z axis (vertical scroll) movement. */ 272 int32_t iAccumZ; 273 /** Accumulated W axis (horizontal scroll) movement. */ 274 int32_t iAccumW; 275 /** Accumulated button presses. */ 276 uint32_t fAccumB; 277 /** Instantaneous button data. */ 278 uint32_t fCurrB; 279 /** Button state last sent to the guest. */ 280 uint32_t fReportedB; 281 /** Throttling delay in milliseconds. */ 282 uint32_t uThrottleDelay; 283 284 /** The device critical section protecting everything - R3 Ptr */ 285 R3PTRTYPE(PPDMCRITSECT) pCritSectR3; 286 /** Command delay timer - R3 Ptr. */ 287 PTMTIMERR3 pDelayTimerR3; 288 /** Interrupt throttling timer - R3 Ptr. */ 289 PTMTIMERR3 pThrottleTimerR3; 290 RTR3PTR Alignment1; 291 292 /** Command delay timer - RC Ptr. */ 293 PTMTIMERRC pDelayTimerRC; 294 /** Interrupt throttling timer - RC Ptr. */ 295 PTMTIMERRC pThrottleTimerRC; 296 297 /** Command delay timer - R0 Ptr. */ 298 PTMTIMERR0 pDelayTimerR0; 299 /** Interrupt throttling timer - R0 Ptr. */ 300 PTMTIMERR0 pThrottleTimerR0; 301 302 /** 303 * Mouse port - LUN#1. 304 * 305 * @implements PDMIBASE 306 * @implements PDMIMOUSEPORT 307 */ 308 struct 309 { 310 /** The base interface for the mouse port. */ 311 PDMIBASE IBase; 312 /** The keyboard port base interface. */ 313 PDMIMOUSEPORT IPort; 314 315 /** The base interface of the attached mouse driver. */ 316 R3PTRTYPE(PPDMIBASE) pDrvBase; 317 /** The keyboard interface of the attached mouse driver. */ 318 R3PTRTYPE(PPDMIMOUSECONNECTOR) pDrv; 319 } Mouse; 320 } PS2M; 321 /** Pointer to the PS/2 auxiliary device instance data. */ 322 typedef PS2M *PPS2M; 64 323 65 324 int PS2MByteToAux(PPS2M pThis, uint8_t cmd); 66 325 int PS2MByteFromAux(PPS2M pThis, uint8_t *pVal); 67 326 68 int PS2MConstruct(PPS2M pThis, PPDMDEVINS pDevIns, void *pParent, intiInstance);327 int PS2MConstruct(PPS2M pThis, PPDMDEVINS pDevIns, PKBDSTATE pParent, unsigned iInstance); 69 328 int PS2MAttach(PPS2M pThis, PPDMDEVINS pDevIns, unsigned iLUN, uint32_t fFlags); 70 329 void PS2MReset(PPS2M pThis); … … 75 334 76 335 PS2M *KBDGetPS2MFromDevIns(PPDMDEVINS pDevIns); 336 337 /** @} */ 338 339 340 /** 341 * The shared keyboard controller/device state. 342 * 343 * @note We use the default critical section for serialize data access. 344 */ 345 typedef struct KBDSTATE 346 { 347 uint8_t write_cmd; /* if non zero, write data to port 60 is expected */ 348 uint8_t status; 349 uint8_t mode; 350 uint8_t dbbout; /* data buffer byte */ 351 /* keyboard state */ 352 int32_t translate; 353 int32_t xlat_state; 354 355 /** Pointer to the device instance - RC. */ 356 PPDMDEVINSRC pDevInsRC; 357 /** Pointer to the device instance - R3 . */ 358 PPDMDEVINSR3 pDevInsR3; 359 /** Pointer to the device instance. */ 360 PPDMDEVINSR0 pDevInsR0; 361 362 /** Keyboard state (implemented in separate PS2K module). */ 363 PS2K Kbd; 364 365 /** Mouse state (implemented in separate PS2M module). */ 366 PS2M Aux; 367 } KBDSTATE, KBDState; 77 368 78 369 … … 92 383 int32_t XlateAT2PC(int32_t state, uint8_t scanIn, uint8_t *pScanOut); 93 384 94 #endif /* !VBOX_INCLUDED_SRC_Input_PS2Dev_h */ 385 /** @} */ 386 387 #endif /* !VBOX_INCLUDED_SRC_Input_DevPS2_h */ 388 -
trunk/src/VBox/Devices/Input/DevPS2K.cpp
r82170 r82173 86 86 /** @} */ 87 87 88 /** @name HID modifier range.89 * @{ */90 #define HID_MODIFIER_FIRST 0xE091 #define HID_MODIFIER_LAST 0xE892 /** @} */93 94 /** @name USB HID additional constants95 * @{ */96 /** The highest USB usage code reported by VirtualBox. */97 #define VBOX_USB_MAX_USAGE_CODE 0xE798 /** The size of an array needed to store all USB usage codes */99 #define VBOX_USB_USAGE_ARRAY_SIZE (VBOX_USB_MAX_USAGE_CODE + 1)100 /** USB HID Keyboard Usage Page. */101 #define USB_HID_KB_PAGE 7102 /** USB HID Consumer Control Usage Page. */103 #define USB_HID_CC_PAGE 12104 /** @} */105 106 88 /** @name Modifier key states. Sorted in USB HID code order. 107 89 * @{ */ … … 122 104 #define KBD_THROTTLE_DELAY 1 123 105 124 /** Define a simple PS/2 input device queue. */125 #define DEF_PS2Q_TYPE(name, size) \126 typedef struct { \127 uint32_t rpos; \128 uint32_t wpos; \129 uint32_t cUsed; \130 uint32_t cSize; \131 uint8_t abQueue[size]; \132 } name133 134 /* Internal keyboard queue sizes. The input queue doesn't need to be135 * extra huge and the command queue only needs to handle a few bytes.136 */137 #define KBD_KEY_QUEUE_SIZE 64138 #define KBD_CMD_QUEUE_SIZE 4139 140 106 141 107 /********************************************************************************************************************************* 142 108 * Structures and Typedefs * 143 109 *********************************************************************************************************************************/ 144 145 /** Typematic state. */146 typedef enum {147 KBD_TMS_IDLE = 0, /* No typematic key active. */148 KBD_TMS_DELAY = 1, /* In the initial delay period. */149 KBD_TMS_REPEAT = 2, /* Key repeating at set rate. */150 KBD_TMS_32BIT_HACK = 0x7fffffff151 } tmatic_state_t;152 153 154 DEF_PS2Q_TYPE(KbdKeyQ, KBD_KEY_QUEUE_SIZE);155 DEF_PS2Q_TYPE(KbdCmdQ, KBD_CMD_QUEUE_SIZE);156 DEF_PS2Q_TYPE(GeneriQ, 1);157 158 /**159 * The PS/2 keyboard instance data.160 */161 typedef struct PS2K162 {163 /** Pointer to parent device (keyboard controller). */164 R3PTRTYPE(void *) pParent;165 /** Set if keyboard is enabled ('scans' for input). */166 bool fScanning;167 /** Set NumLock is on. */168 bool fNumLockOn;169 /** Selected scan set. */170 uint8_t u8ScanSet;171 /** Modifier key state. */172 uint8_t u8Modifiers;173 /** Currently processed command (if any). */174 uint8_t u8CurrCmd;175 /** Status indicator (LED) state. */176 uint8_t u8LEDs;177 /** Selected typematic delay/rate. */178 uint8_t u8TypematicCfg;179 /** Usage code of current typematic key, if any. */180 uint32_t u32TypematicKey;181 /** Current typematic repeat state. */182 tmatic_state_t enmTypematicState;183 /** Buffer holding scan codes to be sent to the host. */184 KbdKeyQ keyQ;185 /** Command response queue (priority). */186 KbdCmdQ cmdQ;187 /** Currently depressed keys. */188 uint8_t abDepressedKeys[VBOX_USB_USAGE_ARRAY_SIZE];189 /** Typematic delay in milliseconds. */190 unsigned uTypematicDelay;191 /** Typematic repeat period in milliseconds. */192 unsigned uTypematicRepeat;193 /** Set if the throttle delay is currently active. */194 bool fThrottleActive;195 /** Set if the input rate should be throttled. */196 bool fThrottleEnabled;197 198 uint8_t Alignment0[2];199 200 /** Command delay timer - RC Ptr. */201 PTMTIMERRC pKbdDelayTimerRC;202 /** Typematic timer - RC Ptr. */203 PTMTIMERRC pKbdTypematicTimerRC;204 /** Input throttle timer - RC Ptr. */205 PTMTIMERRC pThrottleTimerRC;206 207 /** The device critical section protecting everything - R3 Ptr */208 R3PTRTYPE(PPDMCRITSECT) pCritSectR3;209 210 /** Command delay timer - R3 Ptr. */211 PTMTIMERR3 pKbdDelayTimerR3;212 /** Typematic timer - R3 Ptr. */213 PTMTIMERR3 pKbdTypematicTimerR3;214 /** Input throttle timer - R3 Ptr. */215 PTMTIMERR3 pThrottleTimerR3;216 217 /** Command delay timer - R0 Ptr. */218 PTMTIMERR0 pKbdDelayTimerR0;219 /** Typematic timer - R0 Ptr. */220 PTMTIMERR0 pKbdTypematicTimerR0;221 /** Input throttle timer - R0 Ptr. */222 PTMTIMERR0 pThrottleTimerR0;223 224 /**225 * Keyboard port - LUN#0.226 *227 * @implements PDMIBASE228 * @implements PDMIKEYBOARDPORT229 */230 struct231 {232 /** The base interface for the keyboard port. */233 PDMIBASE IBase;234 /** The keyboard port base interface. */235 PDMIKEYBOARDPORT IPort;236 237 /** The base interface of the attached keyboard driver. */238 R3PTRTYPE(PPDMIBASE) pDrvBase;239 /** The keyboard interface of the attached keyboard driver. */240 R3PTRTYPE(PPDMIKEYBOARDCONNECTOR) pDrv;241 } Keyboard;242 } PS2K, *PPS2K;243 244 AssertCompile(PS2K_STRUCT_FILLER >= sizeof(PS2K));245 246 110 #ifndef VBOX_DEVICE_STRUCT_TESTCASE 247 111 … … 1181 1045 static DECLCALLBACK(void) ps2kThrottleTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser) 1182 1046 { 1183 RT_NOREF 2(pDevIns, pTimer);1047 RT_NOREF(pDevIns, pTimer); 1184 1048 PPS2K pThis = (PS2K *)pvUser; 1185 1049 unsigned uHaveData; … … 1206 1070 static DECLCALLBACK(void) ps2kTypematicTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser) 1207 1071 { 1208 RT_NOREF 2(pDevIns, pTimer);1072 RT_NOREF(pDevIns, pTimer); 1209 1073 PPS2K pThis = (PS2K *)pvUser; 1210 1074 LogFlowFunc(("Typematic state=%d, key %08X\n", pThis->enmTypematicState, pThis->u32TypematicKey)); … … 1231 1095 static DECLCALLBACK(void) ps2kDelayTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser) 1232 1096 { 1233 RT_NOREF 2(pDevIns, pTimer);1097 RT_NOREF(pDevIns, pTimer); 1234 1098 PPS2K pThis = (PS2K *)pvUser; 1235 1099 … … 1553 1417 int PS2KLoadDone(PPS2K pThis, PSSMHANDLE pSSM) 1554 1418 { 1555 RT_NOREF 1(pSSM);1419 RT_NOREF(pSSM); 1556 1420 1557 1421 /* This *must* be done after the inital load because it may trigger … … 1587 1451 void PS2KRelocate(PPS2K pThis, RTGCINTPTR offDelta, PPDMDEVINS pDevIns) 1588 1452 { 1589 RT_NOREF 1(pDevIns);1453 RT_NOREF(pDevIns); 1590 1454 LogFlowFunc(("Relocating PS2K\n")); 1591 1455 pThis->pKbdDelayTimerRC = TMTimerRCPtr(pThis->pKbdDelayTimerR3); … … 1595 1459 } 1596 1460 1597 int PS2KConstruct(PPS2K pThis, PPDMDEVINS pDevIns, void *pParent, intiInstance, PCFGMNODE pCfg)1598 { 1599 RT_NOREF 2(pDevIns, iInstance);1600 LogFlowFunc(("iInstance=% d\n", iInstance));1461 int PS2KConstruct(PPS2K pThis, PPDMDEVINS pDevIns, PKBDSTATE pParent, unsigned iInstance, PCFGMNODE pCfg) 1462 { 1463 RT_NOREF(pDevIns, iInstance); 1464 LogFlowFunc(("iInstance=%u\n", iInstance)); 1601 1465 1602 1466 pThis->pParent = pParent; -
trunk/src/VBox/Devices/Input/DevPS2M.cpp
r82170 r82173 197 197 /** @} */ 198 198 199 /** Define a simple PS/2 input device queue. */200 #define DEF_PS2Q_TYPE(name, size) \201 typedef struct { \202 uint32_t rpos; \203 uint32_t wpos; \204 uint32_t cUsed; \205 uint32_t cSize; \206 uint8_t abQueue[size]; \207 } name208 209 /* Internal mouse queue sizes. The input queue is relatively large,210 * but the command queue only needs to handle a few bytes.211 */212 #define AUX_EVT_QUEUE_SIZE 256213 #define AUX_CMD_QUEUE_SIZE 8214 215 216 /*********************************************************************************************************************************217 * Structures and Typedefs *218 *********************************************************************************************************************************/219 220 DEF_PS2Q_TYPE(AuxEvtQ, AUX_EVT_QUEUE_SIZE);221 DEF_PS2Q_TYPE(AuxCmdQ, AUX_CMD_QUEUE_SIZE);222 #ifndef VBOX_DEVICE_STRUCT_TESTCASE /// @todo hack223 DEF_PS2Q_TYPE(GeneriQ, 1);224 #endif225 226 /* Auxiliary device special modes of operation. */227 typedef enum {228 AUX_MODE_STD, /* Standard operation. */229 AUX_MODE_RESET, /* Currently in reset. */230 AUX_MODE_WRAP /* Wrap mode (echoing input). */231 } PS2M_MODE;232 233 /* Auxiliary device operational state. */234 typedef enum {235 AUX_STATE_RATE_ERR = RT_BIT(0), /* Invalid rate received. */236 AUX_STATE_RES_ERR = RT_BIT(1), /* Invalid resolution received. */237 AUX_STATE_SCALING = RT_BIT(4), /* 2:1 scaling in effect. */238 AUX_STATE_ENABLED = RT_BIT(5), /* Reporting enabled in stream mode. */239 AUX_STATE_REMOTE = RT_BIT(6) /* Remote mode (reports on request). */240 } PS2M_STATE;241 242 /* Externally visible state bits. */243 #define AUX_STATE_EXTERNAL (AUX_STATE_SCALING | AUX_STATE_ENABLED | AUX_STATE_REMOTE)244 245 /* Protocols supported by the PS/2 mouse. */246 typedef enum {247 PS2M_PROTO_PS2STD = 0, /* Standard PS/2 mouse protocol. */248 PS2M_PROTO_IMPS2 = 3, /* IntelliMouse PS/2 protocol. */249 PS2M_PROTO_IMEX = 4, /* IntelliMouse Explorer protocol. */250 PS2M_PROTO_IMEX_HORZ = 5 /* IntelliMouse Explorer with horizontal reports. */251 } PS2M_PROTO;252 253 /* Protocol selection 'knock' states. */254 typedef enum {255 PS2M_KNOCK_INITIAL,256 PS2M_KNOCK_1ST,257 PS2M_KNOCK_IMPS2_2ND,258 PS2M_KNOCK_IMEX_2ND,259 PS2M_KNOCK_IMEX_HORZ_2ND260 } PS2M_KNOCK_STATE;261 262 /**263 * The PS/2 auxiliary device instance data.264 */265 typedef struct PS2M266 {267 /** Pointer to parent device (keyboard controller). */268 R3PTRTYPE(void *) pParent;269 /** Operational state. */270 uint8_t u8State;271 /** Configured sampling rate. */272 uint8_t u8SampleRate;273 /** Configured resolution. */274 uint8_t u8Resolution;275 /** Currently processed command (if any). */276 uint8_t u8CurrCmd;277 /** Set if the throttle delay is active. */278 bool fThrottleActive;279 /** Set if the throttle delay is active. */280 bool fDelayReset;281 /** Operational mode. */282 PS2M_MODE enmMode;283 /** Currently used protocol. */284 PS2M_PROTO enmProtocol;285 /** Currently used protocol. */286 PS2M_KNOCK_STATE enmKnockState;287 /** Buffer holding mouse events to be sent to the host. */288 AuxEvtQ evtQ;289 /** Command response queue (priority). */290 AuxCmdQ cmdQ;291 /** Accumulated horizontal movement. */292 int32_t iAccumX;293 /** Accumulated vertical movement. */294 int32_t iAccumY;295 /** Accumulated Z axis (vertical scroll) movement. */296 int32_t iAccumZ;297 /** Accumulated W axis (horizontal scroll) movement. */298 int32_t iAccumW;299 /** Accumulated button presses. */300 uint32_t fAccumB;301 /** Instantaneous button data. */302 uint32_t fCurrB;303 /** Button state last sent to the guest. */304 uint32_t fReportedB;305 /** Throttling delay in milliseconds. */306 uint32_t uThrottleDelay;307 308 /** The device critical section protecting everything - R3 Ptr */309 R3PTRTYPE(PPDMCRITSECT) pCritSectR3;310 /** Command delay timer - R3 Ptr. */311 PTMTIMERR3 pDelayTimerR3;312 /** Interrupt throttling timer - R3 Ptr. */313 PTMTIMERR3 pThrottleTimerR3;314 RTR3PTR Alignment1;315 316 /** Command delay timer - RC Ptr. */317 PTMTIMERRC pDelayTimerRC;318 /** Interrupt throttling timer - RC Ptr. */319 PTMTIMERRC pThrottleTimerRC;320 321 /** Command delay timer - R0 Ptr. */322 PTMTIMERR0 pDelayTimerR0;323 /** Interrupt throttling timer - R0 Ptr. */324 PTMTIMERR0 pThrottleTimerR0;325 326 /**327 * Mouse port - LUN#1.328 *329 * @implements PDMIBASE330 * @implements PDMIMOUSEPORT331 */332 struct333 {334 /** The base interface for the mouse port. */335 PDMIBASE IBase;336 /** The keyboard port base interface. */337 PDMIMOUSEPORT IPort;338 339 /** The base interface of the attached mouse driver. */340 R3PTRTYPE(PPDMIBASE) pDrvBase;341 /** The keyboard interface of the attached mouse driver. */342 R3PTRTYPE(PPDMIMOUSECONNECTOR) pDrv;343 } Mouse;344 } PS2M, *PPS2M;345 346 AssertCompile(PS2M_STRUCT_FILLER >= sizeof(PS2M));347 199 348 200 #ifndef VBOX_DEVICE_STRUCT_TESTCASE … … 355 207 static void ps2mTestAccumulation(void); 356 208 #endif 357 358 359 /*********************************************************************************************************************************360 * Global Variables *361 *********************************************************************************************************************************/362 363 364 /*********************************************************************************************************************************365 * Internal Functions *366 *********************************************************************************************************************************/367 209 368 210 … … 952 794 static DECLCALLBACK(void) ps2mThrottleTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser) 953 795 { 954 RT_NOREF 2(pDevIns, pTimer);796 RT_NOREF(pDevIns, pTimer); 955 797 PPS2M pThis = (PS2M *)pvUser; 956 798 uint32_t uHaveEvents; … … 982 824 static DECLCALLBACK(void) ps2mDelayTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser) 983 825 { 984 RT_NOREF 2(pDevIns, pTimer);826 RT_NOREF(pDevIns, pTimer); 985 827 PPS2M pThis = (PS2M *)pvUser; 986 828 … … 1275 1117 void PS2MRelocate(PPS2M pThis, RTGCINTPTR offDelta, PPDMDEVINS pDevIns) 1276 1118 { 1277 RT_NOREF 2(pDevIns, offDelta);1119 RT_NOREF(pDevIns, offDelta); 1278 1120 LogFlowFunc(("Relocating PS2M\n")); 1279 1121 pThis->pDelayTimerRC = TMTimerRCPtr(pThis->pDelayTimerR3); … … 1281 1123 } 1282 1124 1283 int PS2MConstruct(PPS2M pThis, PPDMDEVINS pDevIns, void *pParent, intiInstance)1284 { 1285 RT_NOREF 1(iInstance);1286 1287 LogFlowFunc(("iInstance=% d\n", iInstance));1125 int PS2MConstruct(PPS2M pThis, PPDMDEVINS pDevIns, PKBDSTATE pParent, unsigned iInstance) 1126 { 1127 RT_NOREF(iInstance); 1128 1129 LogFlowFunc(("iInstance=%u\n", iInstance)); 1288 1130 1289 1131 #ifdef RT_STRICT -
trunk/src/VBox/Devices/testcase/tstDeviceStructSize.cpp
r82170 r82173 58 58 #include "../Graphics/DevVGA.cpp" 59 59 #undef LOG_GROUP 60 #include "../Input/DevPS2.cpp" 61 #undef LOG_GROUP 62 #include "../Input/DevPS2K.cpp" 63 #undef LOG_GROUP 64 #include "../Input/DevPS2M.cpp" 60 #include "../Input/DevPS2.h" 65 61 #ifdef VBOX_WITH_E1000 66 62 # undef LOG_GROUP
Note:
See TracChangeset
for help on using the changeset viewer.