vbox的更動 25966 路徑 trunk/src/VBox/Devices/Input/DevPS2.cpp
- 時間撮記:
- 2010-1-22 上午11:15:43 (15 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Devices/Input/DevPS2.cpp
r25732 r25966 53 53 #include <VBox/pdmdev.h> 54 54 #include <iprt/assert.h> 55 #include <iprt/uuid.h> 55 56 56 57 #include "../Builtins.h" … … 221 222 /** 222 223 * Keyboard port - LUN#0. 224 * 225 * @implements PDMIBASE 226 * @implements PDMIKEYBOARDPORT 223 227 */ 224 228 struct … … 237 241 /** 238 242 * Mouse port - LUN#1. 243 * 244 * @implements PDMIBASE 245 * @implements PDMIMOUSEPORT 239 246 */ 240 247 struct … … 1349 1356 1350 1357 /** 1351 * Queries an interface to the driver. 1352 * 1353 * @returns Pointer to interface. 1354 * @returns NULL if the interface was not supported by the device. 1355 * @param pInterface Pointer to the keyboard port base interface (KBDState::Keyboard.Base). 1356 * @param enmInterface The requested interface identification. 1357 */ 1358 static DECLCALLBACK(void *) kbdKeyboardQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface) 1359 { 1360 KBDState *pThis = (KBDState *)((uintptr_t)pInterface - RT_OFFSETOF(KBDState, Keyboard.Base)); 1361 switch (enmInterface) 1362 { 1363 case PDMINTERFACE_BASE: 1364 return &pThis->Keyboard.Base; 1365 case PDMINTERFACE_KEYBOARD_PORT: 1366 return &pThis->Keyboard.Port; 1367 default: 1368 return NULL; 1369 } 1358 * @interface_method_impl{PDMIBASE,pfnQueryInterface} 1359 */ 1360 static DECLCALLBACK(void *) kbdKeyboardQueryInterface(PPDMIBASE pInterface, const char *pszIID) 1361 { 1362 KBDState *pThis = RT_FROM_MEMBER(pInterface, KBDState, Keyboard.Base); 1363 if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0) 1364 return &pThis->Keyboard.Base; 1365 if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_KEYBOARD_PORT) == 0) 1366 return &pThis->Keyboard.Port; 1367 return NULL; 1370 1368 } 1371 1369 1372 1370 1373 1371 /* -=-=-=-=-=- Keyboard: IKeyboardPort -=-=-=-=-=- */ 1374 1375 /** Converts a keyboard port interface pointer to a keyboard state pointer. */1376 #define IKEYBOARDPORT_2_KBDSTATE(pInterface) ( (KBDState *)((uintptr_t)pInterface - RT_OFFSETOF(KBDState, Keyboard.Port)) )1377 1372 1378 1373 /** … … 1385 1380 static DECLCALLBACK(int) kbdKeyboardPutEvent(PPDMIKEYBOARDPORT pInterface, uint8_t u8KeyCode) 1386 1381 { 1387 KBDState *pThis = IKEYBOARDPORT_2_KBDSTATE(pInterface);1382 KBDState *pThis = RT_FROM_MEMBER(pInterface, KBDState, Keyboard.Port); 1388 1383 int rc = PDMCritSectEnter(&pThis->CritSect, VERR_SEM_BUSY); 1389 1384 AssertReleaseRC(rc); 1385 1390 1386 pc_kbd_put_keycode(pThis, u8KeyCode); 1387 1391 1388 PDMCritSectLeave(&pThis->CritSect); 1392 1389 return VINF_SUCCESS; … … 1397 1394 1398 1395 /** 1399 * Queries an interface to the driver. 1400 * 1401 * @returns Pointer to interface. 1402 * @returns NULL if the interface was not supported by the device. 1403 * @param pInterface Pointer to the mouse port base interface (KBDState::Mouse.Base). 1404 * @param enmInterface The requested interface identification. 1405 */ 1406 static DECLCALLBACK(void *) kbdMouseQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface) 1407 { 1408 KBDState *pThis = (KBDState *)((uintptr_t)pInterface - RT_OFFSETOF(KBDState, Mouse.Base)); 1409 switch (enmInterface) 1410 { 1411 case PDMINTERFACE_BASE: 1412 return &pThis->Mouse.Base; 1413 case PDMINTERFACE_MOUSE_PORT: 1414 return &pThis->Mouse.Port; 1415 default: 1416 return NULL; 1417 } 1396 * @interface_method_impl{PDMIBASE,pfnQueryInterface} 1397 */ 1398 static DECLCALLBACK(void *) kbdMouseQueryInterface(PPDMIBASE pInterface, const char *pszIID) 1399 { 1400 KBDState *pThis = RT_FROM_MEMBER(pInterface, KBDState, Mouse.Base); 1401 if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0) 1402 return &pThis->Mouse.Base; 1403 if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_MOUSE_PORT) == 0) 1404 return &pThis->Mouse.Port; 1405 return NULL; 1418 1406 } 1419 1407 1420 1408 1421 1409 /* -=-=-=-=-=- Mouse: IMousePort -=-=-=-=-=- */ 1422 1423 /** Converts a mouse port interface pointer to a keyboard state pointer. */1424 #define IMOUSEPORT_2_KBDSTATE(pInterface) ( (KBDState *)((uintptr_t)pInterface - RT_OFFSETOF(KBDState, Mouse.Port)) )1425 1410 1426 1411 /** … … 1436 1421 static DECLCALLBACK(int) kbdMousePutEvent(PPDMIMOUSEPORT pInterface, int32_t i32DeltaX, int32_t i32DeltaY, int32_t i32DeltaZ, int32_t i32DeltaW, uint32_t fButtonStates) 1437 1422 { 1438 KBDState *pThis = IMOUSEPORT_2_KBDSTATE(pInterface);1423 KBDState *pThis = RT_FROM_MEMBER(pInterface, KBDState, Mouse.Port); 1439 1424 int rc = PDMCritSectEnter(&pThis->CritSect, VERR_SEM_BUSY); 1440 1425 AssertReleaseRC(rc); 1426 1441 1427 pc_kbd_mouse_event(pThis, i32DeltaX, i32DeltaY, i32DeltaZ, i32DeltaW, fButtonStates); 1428 1442 1429 PDMCritSectLeave(&pThis->CritSect); 1443 1430 return VINF_SUCCESS;
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器