Changeset 82190 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Nov 25, 2019 5:44:40 PM (5 years ago)
- Location:
- trunk/src/VBox/Devices/Input
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Input/DevPS2.cpp
r82189 r82190 745 745 } 746 746 747 /** 748 * Retrieve a byte from a queue. 749 * 750 * @param pQ Pointer to the queue. 751 * @param pVal Pointer to storage for the byte. 752 * 753 * @retval VINF_TRY_AGAIN if queue is empty, 754 * @retval VINF_SUCCESS if a byte was read. 755 */ 756 int PS2CmnRemoveQueue(GeneriQ *pQ, uint8_t *pVal) 757 { 758 int rc; 759 760 Assert(pVal); 761 if (pQ->cUsed) 762 { 763 *pVal = pQ->abQueue[pQ->rpos]; 764 if (++pQ->rpos == pQ->cSize) 765 pQ->rpos = 0; /* Roll over. */ 766 --pQ->cUsed; 767 LogFlowFunc(("removed 0x%02X from queue %p\n", *pVal, pQ)); 768 rc = VINF_SUCCESS; 769 } 770 else 771 { 772 LogFlowFunc(("queue %p empty\n", pQ)); 773 rc = VINF_TRY_AGAIN; 774 } 775 return rc; 776 } 777 747 778 #ifdef IN_RING3 748 779 … … 778 809 * @param pQ Pointer to the queue. 779 810 * 780 * @return intVBox status/error code.811 * @returns VBox status/error code. 781 812 */ 782 813 int PS2CmnR3LoadQueue(PCPDMDEVHLPR3 pHlp, PSSMHANDLE pSSM, GeneriQ *pQ) -
trunk/src/VBox/Devices/Input/DevPS2.h
r82189 r82190 42 42 void PS2CmnClearQueue(GeneriQ *pQ); 43 43 void PS2CmnInsertQueue(GeneriQ *pQ, uint8_t val); 44 int PS2CmnRemoveQueue(GeneriQ *pQ, uint8_t *pVal); 44 45 void PS2CmnR3SaveQueue(PCPDMDEVHLPR3 pHlp, PSSMHANDLE pSSM, GeneriQ *pQ); 45 46 int PS2CmnR3LoadQueue(PCPDMDEVHLPR3 pHlp, PSSMHANDLE pSSM, GeneriQ *pQ); -
trunk/src/VBox/Devices/Input/DevPS2K.cpp
r82189 r82190 450 450 #endif /* IN_RING3 */ 451 451 452 /** 453 * Retrieve a byte from a queue. 454 * 455 * @param pQ Pointer to the queue. 456 * @param pVal Pointer to storage for the byte. 457 * 458 * @return int VINF_TRY_AGAIN if queue is empty, 459 * VINF_SUCCESS if a byte was read. 460 */ 461 static int ps2kRemoveQueue(GeneriQ *pQ, uint8_t *pVal) 462 { 463 int rc = VINF_TRY_AGAIN; 464 465 Assert(pVal); 466 if (pQ->cUsed) 467 { 468 *pVal = pQ->abQueue[pQ->rpos]; 469 if (++pQ->rpos == pQ->cSize) 470 pQ->rpos = 0; /* Roll over. */ 471 --pQ->cUsed; 472 rc = VINF_SUCCESS; 473 LogFlowFunc(("removed 0x%02X from queue %p\n", *pVal, pQ)); 474 } else 475 LogFlowFunc(("queue %p empty\n", pQ)); 476 return rc; 477 } 478 479 /* Clears the currently active typematic key, if any. */ 452 /** Clears the currently active typematic key, if any. */ 480 453 static void ps2kStopTypematicRepeat(PPS2K pThis) 481 454 { … … 489 462 } 490 463 491 /* Convert encoded typematic value to milliseconds. Note that the values are rated464 /** Convert encoded typematic value to milliseconds. Note that the values are rated 492 465 * with +/- 20% accuracy, so there's no need for high precision. 493 466 */ … … 668 641 * the command queue is empty. 669 642 */ 670 rc = ps2kRemoveQueue((GeneriQ *)&pThis->cmdQ, pb);643 rc = PS2CmnRemoveQueue((GeneriQ *)&pThis->cmdQ, pb); 671 644 if (rc != VINF_SUCCESS && !pThis->u8CurrCmd && pThis->fScanning) 672 645 if (!pThis->fThrottleActive) 673 646 { 674 rc = ps2kRemoveQueue((GeneriQ *)&pThis->keyQ, pb);647 rc = PS2CmnRemoveQueue((GeneriQ *)&pThis->keyQ, pb); 675 648 if (pThis->fThrottleEnabled) { 676 649 pThis->fThrottleActive = true; -
trunk/src/VBox/Devices/Input/DevPS2M.cpp
r82189 r82190 232 232 233 233 #endif /* IN_RING3 */ 234 235 /**236 * Retrieve a byte from a queue.237 *238 * @param pQ Pointer to the queue.239 * @param pVal Pointer to storage for the byte.240 *241 * @return int VINF_TRY_AGAIN if queue is empty,242 * VINF_SUCCESS if a byte was read.243 */244 static int ps2kRemoveQueue(GeneriQ *pQ, uint8_t *pVal)245 {246 int rc = VINF_TRY_AGAIN;247 248 Assert(pVal);249 if (pQ->cUsed)250 {251 *pVal = pQ->abQueue[pQ->rpos];252 if (++pQ->rpos == pQ->cSize)253 pQ->rpos = 0; /* Roll over. */254 --pQ->cUsed;255 rc = VINF_SUCCESS;256 LogFlowFunc(("removed 0x%02X from queue %p\n", *pVal, pQ));257 } else258 LogFlowFunc(("queue %p empty\n", pQ));259 return rc;260 }261 234 262 235 static void ps2mSetRate(PPS2M pThis, uint8_t rate) … … 683 656 */ 684 657 /// @todo Probably should flush/not fill queue if stream mode reporting disabled?! 685 rc = ps2kRemoveQueue((GeneriQ *)&pThis->cmdQ, pb);658 rc = PS2CmnRemoveQueue((GeneriQ *)&pThis->cmdQ, pb); 686 659 if (rc != VINF_SUCCESS && !pThis->u8CurrCmd && (pThis->u8State & AUX_STATE_ENABLED)) 687 rc = ps2kRemoveQueue((GeneriQ *)&pThis->evtQ, pb);660 rc = PS2CmnRemoveQueue((GeneriQ *)&pThis->evtQ, pb); 688 661 689 662 LogFlowFunc(("mouse sends 0x%02x (%svalid data)\n", *pb, rc == VINF_SUCCESS ? "" : "not "));
Note:
See TracChangeset
for help on using the changeset viewer.