VirtualBox

Ignore:
Timestamp:
Nov 25, 2019 5:44:40 PM (5 years ago)
Author:
vboxsync
Message:

DevPS2: ps2kRemoveQueue is common to both DevPS2M.cpp and DevPS2K.cpp, share it! bugref:9218

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Input/DevPS2.cpp

    r82189 r82190  
    745745}
    746746
     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 */
     756int 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
    747778#ifdef IN_RING3
    748779
     
    778809 * @param   pQ                  Pointer to the queue.
    779810 *
    780  * @return  int                VBox status/error code.
     811 * @returns VBox status/error code.
    781812 */
    782813int PS2CmnR3LoadQueue(PCPDMDEVHLPR3 pHlp, PSSMHANDLE pSSM, GeneriQ *pQ)
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette