⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 navcmd.cpp

📁 这是DVD中伺服部分的核心代码
💻 CPP
📖 第 1 页 / 共 5 页
字号:
    /* Send command processor to the waiting state */
    hCmdProc->tState = CMDPROC_STATE_WAITING;

    /* signal that a transition needs to occur */
    hCmdProc->fTransitionPending = TRUE;

    return (CMDPROC_SUCCESS);
}

/**
 * NavCmdStillOn
 *
 * @param
 *      hCmdProc        -- handle to the command processor private data
 *      pCommand        -- pointer to the command to be executed
 *      pulStatusParam  -- pointer to the parameter associated with the return status
 *
 * @retval
 *      CMDPROC_STATUS
 */
CMDPROC_STATUS  NavCmdStillOn(CMDPROC_HANDLE *hCmdProc, MVOBJ_NAV_COMMAND *pCommand, ULONG *pulStatusParam)
{
#if DBG_ON(DBG_VERBOSE)
    DbgPrint(("NavCmdStillOn: ENTER\n"));
#endif

    /* check for valid handle */
    if (hCmdProc == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdStillOn: Invalid handle!\n"));
        return (CMDPROC_NULL_POINTER);
    }

    /* Only a button object can execute this command */
    if (hCmdProc->tState != CMDPROC_STATE_BUTTON_PROCESSING)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdStillOn: Command not allowed!\n"));
        return (CMDPROC_FAILURE);
    }

    /* Entering playback control critical section */
    PlayCtrlTakeSemaphore();

    /* tell playback control engine to freeze playback */
    if (PlayCtrlStillOn() != PLAYCTRL_SUCCESS)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdStillOn: Failed to freeze playback!\n"));
        PlayCtrlGiveSemaphore();
        return (CMDPROC_FAILURE);
    }

    /* Leaving playback control critical section */
    PlayCtrlGiveSemaphore();

    return (CMDPROC_SUCCESS);
}

/**
 * NavCmdStillOff
 *
 * @param
 *      hCmdProc        -- handle to the command processor private data
 *      pCommand        -- pointer to the command to be executed
 *      pulStatusParam  -- pointer to the parameter associated with the return status
 *
 * @retval
 *      CMDPROC_STATUS
 */
CMDPROC_STATUS  NavCmdStillOff(CMDPROC_HANDLE *hCmdProc, MVOBJ_NAV_COMMAND *pCommand, ULONG *pulStatusParam)
{
#if DBG_ON(DBG_VERBOSE)
    DbgPrint(("NavCmdStillOff: ENTER\n"));
#endif

    /* check for valid handle */
    if (hCmdProc == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdStillOff: Invalid handle!\n"));
        return (CMDPROC_NULL_POINTER);
    }

    /* Only a button object can execute this command */
    if (hCmdProc->tState != CMDPROC_STATE_BUTTON_PROCESSING)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdStillOff: Command not allowed!\n"));
        return (CMDPROC_FAILURE);
    }

    /* Entering playback control critical section */
    PlayCtrlTakeSemaphore();

    /* tell playback control engine to unfreeze playback */
    if (PlayCtrlStillOff() != PLAYCTRL_SUCCESS)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdStillOff: Failed to freeze playback!\n"));
        PlayCtrlGiveSemaphore();
        return (CMDPROC_FAILURE);
    }

    /* Leaving playback control critical section */
    PlayCtrlGiveSemaphore();

    return (CMDPROC_SUCCESS);
}

/**
 * NavCmdBC
 *
 * @param
 *      hCmdProc        -- handle to the command processor private data
 *      pCommand        -- pointer to the command to be executed
 *      pulStatusParam  -- pointer to the parameter associated with the return status
 *
 * @retval
 *      CMDPROC_STATUS
 */
CMDPROC_STATUS  NavCmdBC(CMDPROC_HANDLE *hCmdProc, MVOBJ_NAV_COMMAND *pCommand, ULONG *pulStatusParam)
{
    uint32 uiDstType;
    uint32 uiSrcType;
    uint32 uiDst;
    uint32 uiSrc;

#if DBG_ON(DBG_VERBOSE)
    DbgPrint(("NavCmdBC: ENTER\n"));
#endif

    /* check for valid handle */
    if (hCmdProc == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdBC: Invalid handle!\n"));
        return (CMDPROC_NULL_POINTER);
    }

    /* check for valid command pointer */
    if (pCommand == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdBC: Invalid command pointer!\n"));
        return (CMDPROC_NULL_POINTER);
    }

    /* get destination operand type */
    uiDstType = NavCmdGetDstOperandType(pCommand->ulOpCode);

    /*
     * If Destination operand is a register number, get the register value.
     * If it is an immediate value, then use that value.
     * Otherwise, return an error.
     */
    if (uiDstType == NAVCMD_OPERAND_REG)
    {
        /* Get destination operand value from specified register */
        uiDst = NavCmdGetRegisterValue(pCommand->ulDstOperand);
    }
    else if (uiDstType == NAVCMD_OPERAND_IMM)
    {
        /* Set destination operand value to the immediate value */
        uiDst = pCommand->ulDstOperand;
    }
    else
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdBC: Invalid operand type!\n"));
        return (CMDPROC_FAILURE);
    }

    /* get source operand type */
    uiSrcType = NavCmdGetSrcOperandType(pCommand->ulOpCode);

    /*
     * If Source operand is a register number, get the register value.
     * If it is an immediate value, then use that value.
     * Otherwise, return an error.
     */
    if (uiSrcType == NAVCMD_OPERAND_REG)
    {
        /* Get source operand value from specified register */
        uiSrc = NavCmdGetRegisterValue(pCommand->ulSrcOperand);
    }
    else if (uiSrcType == NAVCMD_OPERAND_IMM)
    {
        /* Set source operand value to the immediate value */
        uiSrc = pCommand->ulSrcOperand;
    }
    else
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdBC: Invalid operand type!\n"));
        return (CMDPROC_FAILURE);
    }

    /*
     * If the result of the comparison is not true, then skip over the next
     * instruction.  Otherwise, proceed to the next instruction.
     */
    if ( (uiDst & uiSrc) == FALSE)
    {
        /* skip over the next command */
        if (hCmdProc->tState == CMDPROC_STATE_MOVIE_PROCESSING)
        {
            hCmdProc->MoviePrgm.ulCurrentCmdID++;
        }
        else
        {
            hCmdProc->ButtonPrgm.ulCurrentCmdID++;
        }
    }

    return (CMDPROC_SUCCESS);
}

/**
 * NavCmdEQ
 *
 * @param
 *      hCmdProc        -- handle to the command processor private data
 *      pCommand        -- pointer to the command to be executed
 *      pulStatusParam  -- pointer to the parameter associated with the return status
 *
 * @retval
 *      CMDPROC_STATUS
 */
CMDPROC_STATUS  NavCmdEQ(CMDPROC_HANDLE *hCmdProc, MVOBJ_NAV_COMMAND *pCommand, ULONG *pulStatusParam)
{
    uint32 uiDstType;
    uint32 uiSrcType;
    uint32 uiDst;
    uint32 uiSrc;

#if DBG_ON(DBG_VERBOSE)
    DbgPrint(("NavCmdEQ: ENTER\n"));
#endif

    /* check for valid handle */
    if (hCmdProc == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdEQ: Invalid handle!\n"));
        return (CMDPROC_NULL_POINTER);
    }

    /* check for valid command pointer */
    if (pCommand == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdEQ: Invalid command pointer!\n"));
        return (CMDPROC_NULL_POINTER);
    }

    /* get destination operand type */
    uiDstType = NavCmdGetDstOperandType(pCommand->ulOpCode);

    /*
     * If Destination operand is a register number, get the register value.
     * If it is an immediate value, then use that value.
     * Otherwise, return an error.
     */
    if (uiDstType == NAVCMD_OPERAND_REG)
    {
        /* Get destination operand value from specified register */
        uiDst = NavCmdGetRegisterValue(pCommand->ulDstOperand);
    }
    else if (uiDstType == NAVCMD_OPERAND_IMM)
    {
        /* Set destination operand value to the immediate value */
        uiDst = pCommand->ulDstOperand;
    }
    else
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdEQ: Invalid operand type!\n"));
        return (CMDPROC_FAILURE);
    }

    /* get source operand type */
    uiSrcType = NavCmdGetSrcOperandType(pCommand->ulOpCode);

    /*
     * If Source operand is a register number, get the register value.
     * If it is an immediate value, then use that value.
     * Otherwise, return an error.
     */
    if (uiSrcType == NAVCMD_OPERAND_REG)
    {
        /* Get source operand value from specified register */
        uiSrc = NavCmdGetRegisterValue(pCommand->ulSrcOperand);
    }
    else if (uiSrcType == NAVCMD_OPERAND_IMM)
    {
        /* Set source operand value to the immediate value */
        uiSrc = pCommand->ulSrcOperand;
    }
    else
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdEQ: Invalid operand type!\n"));
        return (CMDPROC_FAILURE);
    }

    /*
     * If the result of the comparison is not true, then skip over the next
     * instruction.  Otherwise, proceed to the next instruction.
     */
    if ( (uiDst == uiSrc) == FALSE)
    {
        /* skip over the next command */
        if (hCmdProc->tState == CMDPROC_STATE_MOVIE_PROCESSING)
        {
            hCmdProc->MoviePrgm.ulCurrentCmdID++;
        }
        else
        {
            hCmdProc->ButtonPrgm.ulCurrentCmdID++;
        }
    }

    return (CMDPROC_SUCCESS);
}

/**
 * NavCmdNE
 *
 * @param
 *      hCmdProc        -- handle to the command processor private data
 *      pCommand        -- pointer to the command to be executed
 *      pulStatusParam  -- pointer to the parameter associated with the return status
 *
 * @retval
 *      CMDPROC_STATUS
 */
CMDPROC_STATUS  NavCmdNE(CMDPROC_HANDLE *hCmdProc, MVOBJ_NAV_COMMAND *pCommand, ULONG *pulStatusParam)
{
    uint32 uiDstType;
    uint32 uiSrcType;
    uint32 uiDst;
    uint32 uiSrc;

#if DBG_ON(DBG_VERBOSE)
    DbgPrint(("NavCmdNE: ENTER\n"));
#endif

    /* check for valid handle */
    if (hCmdProc == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdNE: Invalid handle!\n"));
        return (CMDPROC_NULL_POINTER);
    }

    /* check for valid command pointer */
    if (pCommand == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdNE: Invalid command pointer!\n"));
        return (CMDPROC_NULL_POINTER);
    }

    /* get destination operand type */
    uiDstType = NavCmdGetDstOperandType(pCommand->ulOpCode);

    /*
     * If Destination operand is a register number, get the register value.
     * If it is an immediate value, then use that value.
     * Otherwise, return an error.
     */
    if (uiDstType == NAVCMD_OPERAND_REG)
    {
        /* Get destination operand value from specified register */
        uiDst = NavCmdGetRegisterValue(pCommand->ulDstOperand);
    }
    else if (uiDstType == NAVCMD_OPERAND_IMM)
    {
        /* Set destination operand value to the immediate value */
        uiDst = pCommand->ulDstOperand;
    }
    else
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdNE: Invalid operand type!\n"));
        return (CMDPROC_FAILURE);
    }

    /* get source operand type */
    uiSrcType = NavCmdGetSrcOperandType(pCommand->ulOpCode);

    /*
     * If Source operand is a register number, get the register value.
     * If it is an immediate value, then use that value.
     * Otherwise, return an error.
     */
    if (uiSrcType == NAVCMD_OPERAND_REG)
    {
        /* Get source operand value from specified register */
        uiSrc = NavCmdGetRegisterValue(pCommand->ulSrcOperand);
    }
    else if (uiSrcType == NAVCMD_OPERAND_IMM)
    {
        /* Set source operand value to the immediate value */
        uiSrc = pCommand->ulSrcOperand;
    }
    else
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdNE: Invalid operand type!\n"));
        return (CMDPROC_FAILURE);
    }

    /*
     * If the result of the comparison is not true, then skip over the next
     * instruction.  Otherwise, proceed to the next instruction.
     */
    if ( (uiDst != uiSrc) == FALSE)
    {
        /* skip over the next command */
        if (hCmdProc->tState == CMDPROC_STATE_MOVIE_PROCESSING)
        {
            hCmdProc->MoviePrgm.ulCurrentCmdID++;
        }
        else
        {
            hCmdProc->ButtonPrgm.ulCurrentCmdID++;
        }
    }

    return (CMDPROC_SUCCESS);
}

/**
 * NavCmdGE
 *
 * @param
 *      hCmdProc        -- handle to the command processor private data
 *      pCommand        -- pointer to the command to be executed
 *      pulStatusParam  -- pointer to the parameter associated with the return status
 *
 * @retval
 *      CMDPROC_STATUS
 */
CMDPROC_STATUS  NavCmdGE(CMDPROC_HANDLE *hCmdProc, MVOBJ_NAV_COMMAND *pCommand, ULONG *pulStatusParam)
{
    uint32 uiDstType ;
    uint32 uiSrcType;
    uint32 uiDst;
    uint32 uiSrc;

#if DBG_ON(DBG_VERBOSE)
    DbgPrint(("NavCmdGE: ENTER\n"));
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -