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

📄 navcmd.cpp

📁 这是DVD中伺服部分的核心代码
💻 CPP
📖 第 1 页 / 共 5 页
字号:
    /* check for valid handle */
    if (hCmdProc == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdGE: Invalid handle!\n"));
        return (CMDPROC_NULL_POINTER);
    }

    /* check for valid command pointer */
    if (pCommand == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdGE: 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), ("NavCmdGE: 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), ("NavCmdGE: 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);
}

/**
 * NavCmdGT
 *
 * @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  NavCmdGT(CMDPROC_HANDLE *hCmdProc, MVOBJ_NAV_COMMAND *pCommand, ULONG *pulStatusParam)
{
    uint32 uiDstType;
    uint32 uiSrcType;
    uint32 uiDst;
    uint32 uiSrc;

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

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

    /* check for valid command pointer */
    if (pCommand == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdGT: 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), ("NavCmdGT: 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), ("NavCmdGT: 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);
}

/**
 * NavCmdLE
 *
 * @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  NavCmdLE(CMDPROC_HANDLE *hCmdProc, MVOBJ_NAV_COMMAND *pCommand, ULONG *pulStatusParam)
{
    uint32 uiDstType;
    uint32 uiSrcType;
    uint32 uiDst;
    uint32 uiSrc;

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

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

    /* check for valid command pointer */
    if (pCommand == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdLE: 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), ("NavCmdLE: 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), ("NavCmdLE: 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);
}

/**
 * NavCmdLT
 *
 * @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  NavCmdLT(CMDPROC_HANDLE *hCmdProc, MVOBJ_NAV_COMMAND *pCommand, ULONG *pulStatusParam)
{
    uint32 uiDstType;
    uint32 uiSrcType;
    uint32 uiDst;
    uint32 uiSrc;

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

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

    /* check for valid command pointer */
    if (pCommand == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdLT: 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), ("NavCmdLT: 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), ("NavCmdLT: 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);
}

/**
 * NavCmdMove
 *
 * @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  NavCmdMove(CMDPROC_HANDLE *hCmdProc, MVOBJ_NAV_COMMAND *pCommand, ULONG *pulStatusParam)
{
    uint32 uiDstType;
    uint32 uiSrcType;
    uint32 uiSrc;

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

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

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

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

    /*
     * Destination operand MUST be a GPR number.
     * If it is not then return an error.
     

⌨️ 快捷键说明

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