Changeset 68100 in vbox for trunk/src/VBox/Devices/Input
- Timestamp:
- Jul 25, 2017 9:20:08 AM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 117150
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Input/PS2M.cpp
r68089 r68100 105 105 #define IN_PS2M 106 106 #include "PS2Dev.h" 107 108 107 109 108 /********************************************************************************************************************************* … … 296 295 #ifndef VBOX_DEVICE_STRUCT_TESTCASE 297 296 297 298 /********************************************************************************************************************************* 299 * Test code function declarations * 300 *********************************************************************************************************************************/ 301 #if defined(RT_STRICT) && defined(IN_RING3) 302 static void ps2mTestAccumulation(void); 303 #endif 298 304 299 305 /********************************************************************************************************************************* … … 998 1004 } 999 1005 1006 /* -=-=-=-=-=- Mouse: IMousePort -=-=-=-=-=- */ 1007 1008 /** 1009 * @interface_method_impl{PDMIMOUSEPORT,pfnPutEvent} 1010 */ 1011 static DECLCALLBACK(int) ps2mPutEvent(PPDMIMOUSEPORT pInterface, int32_t dx, int32_t dy, 1012 int32_t dz, int32_t dw, uint32_t fButtons) 1013 { 1014 PPS2M pThis = RT_FROM_MEMBER(pInterface, PS2M, Mouse.IPort); 1015 int rc = PDMCritSectEnter(pThis->pCritSectR3, VERR_SEM_BUSY); 1016 AssertReleaseRC(rc); 1017 1018 LogRelFlowFunc(("dX=%d dY=%d dZ=%d dW=%d buttons=%02X\n", dx, dy, dz, dw, fButtons)); 1019 /* NB: The PS/2 Y axis direction is inverted relative to ours. */ 1020 ps2mPutEventWorker(pThis, dx, -dy, dz, dw, fButtons); 1021 1022 PDMCritSectLeave(pThis->pCritSectR3); 1023 return VINF_SUCCESS; 1024 } 1025 1026 /** 1027 * @interface_method_impl{PDMIMOUSEPORT,pfnPutEventAbs} 1028 */ 1029 static DECLCALLBACK(int) ps2mPutEventAbs(PPDMIMOUSEPORT pInterface, uint32_t x, uint32_t y, 1030 int32_t dz, int32_t dw, uint32_t fButtons) 1031 { 1032 AssertFailedReturn(VERR_NOT_SUPPORTED); 1033 NOREF(pInterface); NOREF(x); NOREF(y); NOREF(dz); NOREF(dw); NOREF(fButtons); 1034 } 1035 1036 /** 1037 * @interface_method_impl{PDMIMOUSEPORT,pfnPutEventMultiTouch} 1038 */ 1039 static DECLCALLBACK(int) ps2mPutEventMT(PPDMIMOUSEPORT pInterface, uint8_t cContacts, 1040 const uint64_t *pau64Contacts, uint32_t u32ScanTime) 1041 { 1042 AssertFailedReturn(VERR_NOT_SUPPORTED); 1043 NOREF(pInterface); NOREF(cContacts); NOREF(pau64Contacts); NOREF(u32ScanTime); 1044 } 1045 1046 1047 1048 /** 1049 * Attach command. 1050 * 1051 * This is called to let the device attach to a driver for a 1052 * specified LUN. 1053 * 1054 * This is like plugging in the mouse after turning on the 1055 * system. 1056 * 1057 * @returns VBox status code. 1058 * @param pThis The PS/2 auxiliary device instance data. 1059 * @param pDevIns The device instance. 1060 * @param iLUN The logical unit which is being detached. 1061 * @param fFlags Flags, combination of the PDMDEVATT_FLAGS_* \#defines. 1062 */ 1063 int PS2MAttach(PPS2M pThis, PPDMDEVINS pDevIns, unsigned iLUN, uint32_t fFlags) 1064 { 1065 int rc; 1066 1067 /* The LUN must be 1, i.e. mouse. */ 1068 Assert(iLUN == 1); 1069 AssertMsgReturn(fFlags & PDM_TACH_FLAGS_NOT_HOT_PLUG, 1070 ("PS/2 mouse does not support hotplugging\n"), 1071 VERR_INVALID_PARAMETER); 1072 1073 LogFlowFunc(("iLUN=%d\n", iLUN)); 1074 1075 rc = PDMDevHlpDriverAttach(pDevIns, iLUN, &pThis->Mouse.IBase, &pThis->Mouse.pDrvBase, "Mouse Port"); 1076 if (RT_SUCCESS(rc)) 1077 { 1078 pThis->Mouse.pDrv = PDMIBASE_QUERY_INTERFACE(pThis->Mouse.pDrvBase, PDMIMOUSECONNECTOR); 1079 if (!pThis->Mouse.pDrv) 1080 { 1081 AssertLogRelMsgFailed(("LUN #1 doesn't have a mouse interface! rc=%Rrc\n", rc)); 1082 rc = VERR_PDM_MISSING_INTERFACE; 1083 } 1084 } 1085 else if (rc == VERR_PDM_NO_ATTACHED_DRIVER) 1086 { 1087 Log(("%s/%d: warning: no driver attached to LUN #1!\n", pDevIns->pReg->szName, pDevIns->iInstance)); 1088 rc = VINF_SUCCESS; 1089 } 1090 else 1091 AssertLogRelMsgFailed(("Failed to attach LUN #1! rc=%Rrc\n", rc)); 1092 1093 return rc; 1094 } 1095 1096 void PS2MSaveState(PPS2M pThis, PSSMHANDLE pSSM) 1097 { 1098 LogFlowFunc(("Saving PS2M state\n")); 1099 1100 /* Save the core auxiliary device state. */ 1101 SSMR3PutU8(pSSM, pThis->u8State); 1102 SSMR3PutU8(pSSM, pThis->u8SampleRate); 1103 SSMR3PutU8(pSSM, pThis->u8Resolution); 1104 SSMR3PutU8(pSSM, pThis->u8CurrCmd); 1105 SSMR3PutU8(pSSM, pThis->enmMode); 1106 SSMR3PutU8(pSSM, pThis->enmProtocol); 1107 SSMR3PutU8(pSSM, pThis->enmKnockState); 1108 1109 /* Save the command and event queues. */ 1110 ps2kSaveQueue(pSSM, (GeneriQ *)&pThis->cmdQ); 1111 ps2kSaveQueue(pSSM, (GeneriQ *)&pThis->evtQ); 1112 1113 /* Save the command delay timer. Note that the rate throttling 1114 * timer is *not* saved. 1115 */ 1116 TMR3TimerSave(pThis->CTX_SUFF(pDelayTimer), pSSM); 1117 } 1118 1119 int PS2MLoadState(PPS2M pThis, PSSMHANDLE pSSM, uint32_t uVersion) 1120 { 1121 uint8_t u8; 1122 int rc; 1123 1124 NOREF(uVersion); 1125 LogFlowFunc(("Loading PS2M state version %u\n", uVersion)); 1126 1127 /* Load the basic auxiliary device state. */ 1128 SSMR3GetU8(pSSM, &pThis->u8State); 1129 SSMR3GetU8(pSSM, &pThis->u8SampleRate); 1130 SSMR3GetU8(pSSM, &pThis->u8Resolution); 1131 SSMR3GetU8(pSSM, &pThis->u8CurrCmd); 1132 SSMR3GetU8(pSSM, &u8); 1133 pThis->enmMode = (PS2M_MODE)u8; 1134 SSMR3GetU8(pSSM, &u8); 1135 pThis->enmProtocol = (PS2M_PROTO)u8; 1136 SSMR3GetU8(pSSM, &u8); 1137 pThis->enmKnockState = (PS2M_KNOCK_STATE)u8; 1138 1139 /* Load the command and event queues. */ 1140 rc = ps2kLoadQueue(pSSM, (GeneriQ *)&pThis->cmdQ); 1141 AssertRCReturn(rc, rc); 1142 rc = ps2kLoadQueue(pSSM, (GeneriQ *)&pThis->evtQ); 1143 AssertRCReturn(rc, rc); 1144 1145 /* Load the command delay timer, just in case. */ 1146 rc = TMR3TimerLoad(pThis->CTX_SUFF(pDelayTimer), pSSM); 1147 AssertRCReturn(rc, rc); 1148 1149 /* Recalculate the throttling delay. */ 1150 ps2mSetRate(pThis, pThis->u8SampleRate); 1151 1152 ps2mSetDriverState(pThis, !!(pThis->u8State & AUX_STATE_ENABLED)); 1153 1154 return rc; 1155 } 1156 1157 void PS2MFixupState(PPS2M pThis, uint8_t u8State, uint8_t u8Rate, uint8_t u8Proto) 1158 { 1159 LogFlowFunc(("Fixing up old PS2M state version\n")); 1160 1161 /* Load the basic auxiliary device state. */ 1162 pThis->u8State = u8State; 1163 pThis->u8SampleRate = u8Rate ? u8Rate : 40; /* In case it wasn't saved right. */ 1164 pThis->enmProtocol = (PS2M_PROTO)u8Proto; 1165 1166 /* Recalculate the throttling delay. */ 1167 ps2mSetRate(pThis, pThis->u8SampleRate); 1168 1169 ps2mSetDriverState(pThis, !!(pThis->u8State & AUX_STATE_ENABLED)); 1170 } 1171 1172 void PS2MReset(PPS2M pThis) 1173 { 1174 LogFlowFunc(("Resetting PS2M\n")); 1175 1176 pThis->u8CurrCmd = 0; 1177 1178 /* Clear the queues. */ 1179 ps2kClearQueue((GeneriQ *)&pThis->cmdQ); 1180 ps2mSetDefaults(pThis); /* Also clears event queue. */ 1181 1182 /* Activate the PS/2 mouse by default. */ 1183 // if (pThis->Mouse.pDrv) 1184 // pThis->Mouse.pDrv->pfnSetActive(pThis->Mouse.pDrv, true); 1185 } 1186 1187 void PS2MRelocate(PPS2M pThis, RTGCINTPTR offDelta, PPDMDEVINS pDevIns) 1188 { 1189 RT_NOREF2(pDevIns, offDelta); 1190 LogFlowFunc(("Relocating PS2M\n")); 1191 pThis->pDelayTimerRC = TMTimerRCPtr(pThis->pDelayTimerR3); 1192 pThis->pThrottleTimerRC = TMTimerRCPtr(pThis->pThrottleTimerR3); 1193 } 1194 1195 int PS2MConstruct(PPS2M pThis, PPDMDEVINS pDevIns, void *pParent, int iInstance) 1196 { 1197 RT_NOREF1(iInstance); 1198 1199 LogFlowFunc(("iInstance=%d\n", iInstance)); 1200 1000 1201 #ifdef RT_STRICT 1202 ps2mTestAccumulation(); 1203 #endif 1204 1205 pThis->pParent = pParent; 1206 1207 /* Initialize the queues. */ 1208 pThis->evtQ.cSize = AUX_EVT_QUEUE_SIZE; 1209 pThis->cmdQ.cSize = AUX_CMD_QUEUE_SIZE; 1210 1211 pThis->Mouse.IBase.pfnQueryInterface = ps2mQueryInterface; 1212 pThis->Mouse.IPort.pfnPutEvent = ps2mPutEvent; 1213 pThis->Mouse.IPort.pfnPutEventAbs = ps2mPutEventAbs; 1214 pThis->Mouse.IPort.pfnPutEventMultiTouch = ps2mPutEventMT; 1215 1216 /* 1217 * Initialize the critical section pointer(s). 1218 */ 1219 pThis->pCritSectR3 = pDevIns->pCritSectRoR3; 1220 1221 /* 1222 * Create the input rate throttling timer. Does not use virtual time! 1223 */ 1224 PTMTIMER pTimer; 1225 int rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_REAL, ps2mThrottleTimer, pThis, 1226 TMTIMER_FLAGS_DEFAULT_CRIT_SECT, "PS2M Throttle Timer", &pTimer); 1227 if (RT_FAILURE(rc)) 1228 return rc; 1229 1230 pThis->pThrottleTimerR3 = pTimer; 1231 pThis->pThrottleTimerR0 = TMTimerR0Ptr(pTimer); 1232 pThis->pThrottleTimerRC = TMTimerRCPtr(pTimer); 1233 1234 /* 1235 * Create the command delay timer. 1236 */ 1237 rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL, ps2mDelayTimer, pThis, 1238 TMTIMER_FLAGS_DEFAULT_CRIT_SECT, "PS2M Delay Timer", &pTimer); 1239 if (RT_FAILURE(rc)) 1240 return rc; 1241 1242 pThis->pDelayTimerR3 = pTimer; 1243 pThis->pDelayTimerR0 = TMTimerR0Ptr(pTimer); 1244 pThis->pDelayTimerRC = TMTimerRCPtr(pTimer); 1245 1246 /* 1247 * Register debugger info callbacks. 1248 */ 1249 PDMDevHlpDBGFInfoRegister(pDevIns, "ps2m", "Display PS/2 mouse state.", ps2mInfoState); 1250 1251 /// @todo Where should we do this? 1252 ps2mSetDriverState(pThis, true); 1253 pThis->u8State = 0; 1254 pThis->enmMode = AUX_MODE_STD; 1255 1256 return rc; 1257 } 1258 1259 #endif 1260 1261 #if defined(RT_STRICT) && defined(IN_RING3) 1262 /* -=-=-=-=-=- Test code -=-=-=-=-=- */ 1263 1001 1264 /** Test the event accumulation mechanism which we use to delay events going 1002 * to the guest to one per 50ms. This test depends on ps2mPutEventWorker() not 1003 * touching the timer if This.fThrottleActive is true. */ 1265 * to the guest to one per 10ms (the default PS/2 mouse event rate). This 1266 * test depends on ps2mPutEventWorker() not touching the timer if 1267 * This.fThrottleActive is true. */ 1004 1268 /** @todo if we add any more tests it might be worth using a table of test 1005 1269 * operations and checks. */ … … 1016 1280 This.fThrottleActive = true; 1017 1281 /* Certain Windows touch pad drivers report a double tap as a press, then 1018 * a release-press-release all within a single 50ms interval. Simulate1282 * a release-press-release all within a single 10ms interval. Simulate 1019 1283 * this to check that it is handled right. */ 1020 1284 ps2mPutEventWorker(&This, 0, 0, 0, 0, 1); … … 1058 1322 Assert(rc != VINF_SUCCESS); 1059 1323 } 1060 #endif /* RT_STRICT */ 1061 1062 /* -=-=-=-=-=- Mouse: IMousePort -=-=-=-=-=- */ 1063 1064 /** 1065 * @interface_method_impl{PDMIMOUSEPORT,pfnPutEvent} 1066 */ 1067 static DECLCALLBACK(int) ps2mPutEvent(PPDMIMOUSEPORT pInterface, int32_t dx, int32_t dy, 1068 int32_t dz, int32_t dw, uint32_t fButtons) 1069 { 1070 PPS2M pThis = RT_FROM_MEMBER(pInterface, PS2M, Mouse.IPort); 1071 int rc = PDMCritSectEnter(pThis->pCritSectR3, VERR_SEM_BUSY); 1072 AssertReleaseRC(rc); 1073 1074 LogRelFlowFunc(("dX=%d dY=%d dZ=%d dW=%d buttons=%02X\n", dx, dy, dz, dw, fButtons)); 1075 /* NB: The PS/2 Y axis direction is inverted relative to ours. */ 1076 ps2mPutEventWorker(pThis, dx, -dy, dz, dw, fButtons); 1077 1078 PDMCritSectLeave(pThis->pCritSectR3); 1079 return VINF_SUCCESS; 1080 } 1081 1082 /** 1083 * @interface_method_impl{PDMIMOUSEPORT,pfnPutEventAbs} 1084 */ 1085 static DECLCALLBACK(int) ps2mPutEventAbs(PPDMIMOUSEPORT pInterface, uint32_t x, uint32_t y, 1086 int32_t dz, int32_t dw, uint32_t fButtons) 1087 { 1088 AssertFailedReturn(VERR_NOT_SUPPORTED); 1089 NOREF(pInterface); NOREF(x); NOREF(y); NOREF(dz); NOREF(dw); NOREF(fButtons); 1090 } 1091 1092 /** 1093 * @interface_method_impl{PDMIMOUSEPORT,pfnPutEventMultiTouch} 1094 */ 1095 static DECLCALLBACK(int) ps2mPutEventMT(PPDMIMOUSEPORT pInterface, uint8_t cContacts, 1096 const uint64_t *pau64Contacts, uint32_t u32ScanTime) 1097 { 1098 AssertFailedReturn(VERR_NOT_SUPPORTED); 1099 NOREF(pInterface); NOREF(cContacts); NOREF(pau64Contacts); NOREF(u32ScanTime); 1100 } 1101 1102 1103 1104 /** 1105 * Attach command. 1106 * 1107 * This is called to let the device attach to a driver for a 1108 * specified LUN. 1109 * 1110 * This is like plugging in the mouse after turning on the 1111 * system. 1112 * 1113 * @returns VBox status code. 1114 * @param pThis The PS/2 auxiliary device instance data. 1115 * @param pDevIns The device instance. 1116 * @param iLUN The logical unit which is being detached. 1117 * @param fFlags Flags, combination of the PDMDEVATT_FLAGS_* \#defines. 1118 */ 1119 int PS2MAttach(PPS2M pThis, PPDMDEVINS pDevIns, unsigned iLUN, uint32_t fFlags) 1120 { 1121 int rc; 1122 1123 /* The LUN must be 1, i.e. mouse. */ 1124 Assert(iLUN == 1); 1125 AssertMsgReturn(fFlags & PDM_TACH_FLAGS_NOT_HOT_PLUG, 1126 ("PS/2 mouse does not support hotplugging\n"), 1127 VERR_INVALID_PARAMETER); 1128 1129 LogFlowFunc(("iLUN=%d\n", iLUN)); 1130 1131 rc = PDMDevHlpDriverAttach(pDevIns, iLUN, &pThis->Mouse.IBase, &pThis->Mouse.pDrvBase, "Mouse Port"); 1132 if (RT_SUCCESS(rc)) 1133 { 1134 pThis->Mouse.pDrv = PDMIBASE_QUERY_INTERFACE(pThis->Mouse.pDrvBase, PDMIMOUSECONNECTOR); 1135 if (!pThis->Mouse.pDrv) 1136 { 1137 AssertLogRelMsgFailed(("LUN #1 doesn't have a mouse interface! rc=%Rrc\n", rc)); 1138 rc = VERR_PDM_MISSING_INTERFACE; 1139 } 1140 } 1141 else if (rc == VERR_PDM_NO_ATTACHED_DRIVER) 1142 { 1143 Log(("%s/%d: warning: no driver attached to LUN #1!\n", pDevIns->pReg->szName, pDevIns->iInstance)); 1144 rc = VINF_SUCCESS; 1145 } 1146 else 1147 AssertLogRelMsgFailed(("Failed to attach LUN #1! rc=%Rrc\n", rc)); 1148 1149 return rc; 1150 } 1151 1152 void PS2MSaveState(PPS2M pThis, PSSMHANDLE pSSM) 1153 { 1154 LogFlowFunc(("Saving PS2M state\n")); 1155 1156 /* Save the core auxiliary device state. */ 1157 SSMR3PutU8(pSSM, pThis->u8State); 1158 SSMR3PutU8(pSSM, pThis->u8SampleRate); 1159 SSMR3PutU8(pSSM, pThis->u8Resolution); 1160 SSMR3PutU8(pSSM, pThis->u8CurrCmd); 1161 SSMR3PutU8(pSSM, pThis->enmMode); 1162 SSMR3PutU8(pSSM, pThis->enmProtocol); 1163 SSMR3PutU8(pSSM, pThis->enmKnockState); 1164 1165 /* Save the command and event queues. */ 1166 ps2kSaveQueue(pSSM, (GeneriQ *)&pThis->cmdQ); 1167 ps2kSaveQueue(pSSM, (GeneriQ *)&pThis->evtQ); 1168 1169 /* Save the command delay timer. Note that the rate throttling 1170 * timer is *not* saved. 1171 */ 1172 TMR3TimerSave(pThis->CTX_SUFF(pDelayTimer), pSSM); 1173 } 1174 1175 int PS2MLoadState(PPS2M pThis, PSSMHANDLE pSSM, uint32_t uVersion) 1176 { 1177 uint8_t u8; 1178 int rc; 1179 1180 NOREF(uVersion); 1181 LogFlowFunc(("Loading PS2M state version %u\n", uVersion)); 1182 1183 /* Load the basic auxiliary device state. */ 1184 SSMR3GetU8(pSSM, &pThis->u8State); 1185 SSMR3GetU8(pSSM, &pThis->u8SampleRate); 1186 SSMR3GetU8(pSSM, &pThis->u8Resolution); 1187 SSMR3GetU8(pSSM, &pThis->u8CurrCmd); 1188 SSMR3GetU8(pSSM, &u8); 1189 pThis->enmMode = (PS2M_MODE)u8; 1190 SSMR3GetU8(pSSM, &u8); 1191 pThis->enmProtocol = (PS2M_PROTO)u8; 1192 SSMR3GetU8(pSSM, &u8); 1193 pThis->enmKnockState = (PS2M_KNOCK_STATE)u8; 1194 1195 /* Load the command and event queues. */ 1196 rc = ps2kLoadQueue(pSSM, (GeneriQ *)&pThis->cmdQ); 1197 AssertRCReturn(rc, rc); 1198 rc = ps2kLoadQueue(pSSM, (GeneriQ *)&pThis->evtQ); 1199 AssertRCReturn(rc, rc); 1200 1201 /* Load the command delay timer, just in case. */ 1202 rc = TMR3TimerLoad(pThis->CTX_SUFF(pDelayTimer), pSSM); 1203 AssertRCReturn(rc, rc); 1204 1205 /* Recalculate the throttling delay. */ 1206 ps2mSetRate(pThis, pThis->u8SampleRate); 1207 1208 ps2mSetDriverState(pThis, !!(pThis->u8State & AUX_STATE_ENABLED)); 1209 1210 return rc; 1211 } 1212 1213 void PS2MFixupState(PPS2M pThis, uint8_t u8State, uint8_t u8Rate, uint8_t u8Proto) 1214 { 1215 LogFlowFunc(("Fixing up old PS2M state version\n")); 1216 1217 /* Load the basic auxiliary device state. */ 1218 pThis->u8State = u8State; 1219 pThis->u8SampleRate = u8Rate ? u8Rate : 40; /* In case it wasn't saved right. */ 1220 pThis->enmProtocol = (PS2M_PROTO)u8Proto; 1221 1222 /* Recalculate the throttling delay. */ 1223 ps2mSetRate(pThis, pThis->u8SampleRate); 1224 1225 ps2mSetDriverState(pThis, !!(pThis->u8State & AUX_STATE_ENABLED)); 1226 } 1227 1228 void PS2MReset(PPS2M pThis) 1229 { 1230 LogFlowFunc(("Resetting PS2M\n")); 1231 1232 pThis->u8CurrCmd = 0; 1233 1234 /* Clear the queues. */ 1235 ps2kClearQueue((GeneriQ *)&pThis->cmdQ); 1236 ps2mSetDefaults(pThis); /* Also clears event queue. */ 1237 1238 /* Activate the PS/2 mouse by default. */ 1239 // if (pThis->Mouse.pDrv) 1240 // pThis->Mouse.pDrv->pfnSetActive(pThis->Mouse.pDrv, true); 1241 } 1242 1243 void PS2MRelocate(PPS2M pThis, RTGCINTPTR offDelta, PPDMDEVINS pDevIns) 1244 { 1245 RT_NOREF2(pDevIns, offDelta); 1246 LogFlowFunc(("Relocating PS2M\n")); 1247 pThis->pDelayTimerRC = TMTimerRCPtr(pThis->pDelayTimerR3); 1248 pThis->pThrottleTimerRC = TMTimerRCPtr(pThis->pThrottleTimerR3); 1249 } 1250 1251 int PS2MConstruct(PPS2M pThis, PPDMDEVINS pDevIns, void *pParent, int iInstance) 1252 { 1253 RT_NOREF1(iInstance); 1254 1255 LogFlowFunc(("iInstance=%d\n", iInstance)); 1256 1257 #ifdef RT_STRICT 1258 ps2mTestAccumulation(); 1259 #endif 1260 1261 pThis->pParent = pParent; 1262 1263 /* Initialize the queues. */ 1264 pThis->evtQ.cSize = AUX_EVT_QUEUE_SIZE; 1265 pThis->cmdQ.cSize = AUX_CMD_QUEUE_SIZE; 1266 1267 pThis->Mouse.IBase.pfnQueryInterface = ps2mQueryInterface; 1268 pThis->Mouse.IPort.pfnPutEvent = ps2mPutEvent; 1269 pThis->Mouse.IPort.pfnPutEventAbs = ps2mPutEventAbs; 1270 pThis->Mouse.IPort.pfnPutEventMultiTouch = ps2mPutEventMT; 1271 1272 /* 1273 * Initialize the critical section pointer(s). 1274 */ 1275 pThis->pCritSectR3 = pDevIns->pCritSectRoR3; 1276 1277 /* 1278 * Create the input rate throttling timer. Does not use virtual time! 1279 */ 1280 PTMTIMER pTimer; 1281 int rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_REAL, ps2mThrottleTimer, pThis, 1282 TMTIMER_FLAGS_DEFAULT_CRIT_SECT, "PS2M Throttle Timer", &pTimer); 1283 if (RT_FAILURE(rc)) 1284 return rc; 1285 1286 pThis->pThrottleTimerR3 = pTimer; 1287 pThis->pThrottleTimerR0 = TMTimerR0Ptr(pTimer); 1288 pThis->pThrottleTimerRC = TMTimerRCPtr(pTimer); 1289 1290 /* 1291 * Create the command delay timer. 1292 */ 1293 rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL, ps2mDelayTimer, pThis, 1294 TMTIMER_FLAGS_DEFAULT_CRIT_SECT, "PS2M Delay Timer", &pTimer); 1295 if (RT_FAILURE(rc)) 1296 return rc; 1297 1298 pThis->pDelayTimerR3 = pTimer; 1299 pThis->pDelayTimerR0 = TMTimerR0Ptr(pTimer); 1300 pThis->pDelayTimerRC = TMTimerRCPtr(pTimer); 1301 1302 /* 1303 * Register debugger info callbacks. 1304 */ 1305 PDMDevHlpDBGFInfoRegister(pDevIns, "ps2m", "Display PS/2 mouse state.", ps2mInfoState); 1306 1307 /// @todo Where should we do this? 1308 ps2mSetDriverState(pThis, true); 1309 pThis->u8State = 0; 1310 pThis->enmMode = AUX_MODE_STD; 1311 1312 return rc; 1313 } 1314 1315 #endif 1324 #endif /* RT_STRICT && IN_RING3 */ 1316 1325 1317 1326 #endif /* !VBOX_DEVICE_STRUCT_TESTCASE */
Note:
See TracChangeset
for help on using the changeset viewer.