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

📄 interrupt.c

📁 6410BSP3
💻 C
📖 第 1 页 / 共 2 页
字号:
void SVE_deinitialize_thread(void)
{
    SVEngineContext *pCtxt;

    VDE_MSG((_T("[VDE] ++SVE_initialize_thread()\n\r")));

    pCtxt = SVE_get_context();

    if (pCtxt->hDisplayIST != NULL)
    {
        pCtxt->bDispThrdExit = TRUE;
        SetEvent(pCtxt->hInterruptDisp);    // Wakeup Thread, then Exit
    }

    if (pCtxt->hPostIST != NULL)
    {
        pCtxt->bPostThrdExit = TRUE;    
        SetEvent(pCtxt->hInterruptPost);    // Wakeup Thread, then Exit 
    }

    if (pCtxt->hTVScalerIST != NULL)
    {
        pCtxt->bTVSCThrdExit = TRUE;        
        SetEvent(pCtxt->hInterruptTVSC);    // Wakeup Thread, then Exit
    }

    if (pCtxt->hRotatorIST != NULL)
    {
        pCtxt->bRotatorThrdExit = TRUE;
        SetEvent(pCtxt->hInterruptRotator); // Wakeup Thread, then Exit
    }
}

DWORD SVE_DisplayIntrThread(void)
{
    SVEngineContext *pCtxt;
    int iWinNum;

    VDE_MSG((_T("[VDE] ++SVE_DisplayIntrThread()\n\r")));

    pCtxt = SVE_get_context();

    CeSetThreadPriority(pCtxt->hDisplayIST, SVE_IST_PRIORITY);

    while(!pCtxt->bDispThrdExit)
    {
        WaitForSingleObject(pCtxt->hInterruptDisp, INFINITE);
        if(pCtxt->bDispThrdExit)
        {
            // Clear Interrupt Pending
            Disp_clear_interrupt_pending();

            InterruptDone(pCtxt->dwSysIntrDisp);
        
            break;
        }
        // Local Path can start without Interrupt
        //---------------------------
        // Processing Local Path Command
        //---------------------------

        // Command : Local Path for Win0 Disable
        if (pCtxt->LocalPathCmdCtxt.bCmdSetWin0Disable)
        {
            Disp_envid_onoff(DISP_ENVID_DIRECT_OFF);
            Post_processing_stop();
            Disp_window_onfoff(DISP_WIN0, DISP_WINDOW_OFF);
            Disp_envid_onoff(DISP_ENVID_ON);

            pCtxt->LocalPathCmdCtxt.bCmdSetWin0Disable = FALSE;
        }

        //-----------------------------------
        // Processing Display Controller Command
        //-----------------------------------
        for (iWinNum = DISP_WIN0; iWinNum < DISP_WIN4; iWinNum++)
        {
            // Command : Set Frame Buffer
            if (pCtxt->DispCmdCtxt[iWinNum].bCmdSetBuffer)
            {
                Disp_set_framebuffer(iWinNum, pCtxt->DispCmdCtxt[iWinNum].dwBuffer);

                pCtxt->DispCmdCtxt[iWinNum].bCmdSetBuffer = FALSE;
            }

            // Command : Set Position
            if (pCtxt->DispCmdCtxt[iWinNum].bCmdSetPosition)
            {
                Disp_set_window_position(iWinNum, pCtxt->DispCmdCtxt[iWinNum].dwOffsetX, pCtxt->DispCmdCtxt[iWinNum].dwOffsetY);

                pCtxt->DispCmdCtxt[iWinNum].bCmdSetPosition = FALSE;
            }
        }

        // Clear Interrupt Pending
        Disp_clear_interrupt_pending();

        InterruptDone(pCtxt->dwSysIntrDisp);

        PulseEvent(pCtxt->hDispCmdDone);
    }

    VDE_MSG((_T("[VDE] --SVE_DisplayIntrThread()\n\r")));

    return 0;
}

DWORD SVE_PostIntrThread(void)
{
    SVEngineContext *pCtxt;

    VDE_MSG((_T("[VDE] ++SVE_PostIntrThread()\n\r")));

    pCtxt = SVE_get_context();

    CeSetThreadPriority(pCtxt->hPostIST, SVE_IST_PRIORITY);

    while(!pCtxt->bPostThrdExit)
    {
        WaitForSingleObject(pCtxt->hInterruptPost, INFINITE);
        if(pCtxt->bPostThrdExit)
        {
            break;
        }

        //-----------------------------------
        // Processing Post Processor Command
        //-----------------------------------

        // Command : Set Src Buffer
        if (pCtxt->PostCmdCtxt.bCmdSetSrcBuffer)
        {
            // At this time we can not update current address from next address
            // Because current address is updated at the start of interrupt
            // So, in the IST we can change only current address to make affect
            pCtxt->PostCmdCtxt.bCmdSetSrcBuffer = FALSE;
        }

        // Command : Set Dst Buffer
        if (pCtxt->PostCmdCtxt.bCmdSetDstBuffer)
        {
            // At this time we can not update current address from next address
            // Because current address is updated at the start of interrupt
            // So, in the IST we can change only current address to make affect
            pCtxt->PostCmdCtxt.bCmdSetDstBuffer = FALSE;
        }

        // Clear Interrupt Pending
        Post_clear_interrupt_pending();

        InterruptDone(pCtxt->dwSysIntrPost);

        PulseEvent(pCtxt->hPostCmdDone);
    }

    VDE_MSG((_T("[VDE] --SVE_PostIntrThread()\n\r")));

    return 0;
}

DWORD SVE_RotatorIntrThread(void)
{
    SVEngineContext *pCtxt;
    BOOL bIntPending;

    VDE_MSG((_T("[VDE] ++SVE_RotatorIntrThread()\n\r")));

    pCtxt = SVE_get_context();

    CeSetThreadPriority(pCtxt->hRotatorIST, SVE_IST_PRIORITY);

    while(!pCtxt->bRotatorThrdExit)
    {
        WaitForSingleObject(pCtxt->hInterruptRotator, INFINITE);
        if(pCtxt->bRotatorThrdExit)
        {
            break;
        }

        // Clear Interrupt Pending
        bIntPending = Rotator_clear_interrupt_pending();
        if (!bIntPending)
        {
            VDE_ERR((_T("[VDE:ERR] SVE_RotatorIntrThread() : Interrupt Occurs, But Pending Bit was not Set\n\r")));
        }

        // Image Rotator Operation Finished
        pCtxt->bRotatorBusy = FALSE;

        InterruptDone(pCtxt->dwSysIntrRotator);

        PulseEvent(pCtxt->hRotatorFinish);
    }

    VDE_MSG((_T("[VDE] --SVE_RotatorIntrThread()\n\r")));

    return 0;
}

DWORD SVE_TVScalerIntrThread(void)
{
    SVEngineContext *pCtxt;

    VDE_MSG((_T("[VDE] ++SVE_TVScalerIntrThread()\n\r")));

    pCtxt = SVE_get_context();

    CeSetThreadPriority(pCtxt->hTVScalerIST, SVE_IST_PRIORITY);

    while(!pCtxt->bTVSCThrdExit)
    {
        WaitForSingleObject(pCtxt->hInterruptTVSC, INFINITE);
        if(pCtxt->bTVSCThrdExit)
        {
            break;
        }

        //-----------------------------------
        // Processing TV Scaler Command
        //-----------------------------------

        // Command : Set Src Buffer
        if (pCtxt->TVSCCmdCtxt.bCmdSetSrcBuffer)
        {
            // At this time we can not update current address from next address
            // Because current address is updated at the start of interrupt
            // So, in the IST we can change only current address to make affect

            pCtxt->TVSCCmdCtxt.bCmdSetSrcBuffer = FALSE;
        }

        // Command : Set Dst Buffer
        if (pCtxt->TVSCCmdCtxt.bCmdSetDstBuffer)
        {
            // At this time we can not update current address from next address
            // Because current address is updated at the start of interrupt
            // So, in the IST we can change only current address to make affect

            pCtxt->TVSCCmdCtxt.bCmdSetDstBuffer = FALSE;
        }

        // Clear Interrupt Pending
        TVSC_clear_interrupt_pending();

        InterruptDone(pCtxt->dwSysIntrTVSC);

        PulseEvent(pCtxt->hTVSCCmdDone);
    }

    VDE_MSG((_T("[VDE] --SVE_TVScalerIntrThread()\n\r")));

    return 0;
}

DWORD SVE_wait_disp_cmd_done(void)
{
    return WaitForSingleObject(SVE_get_context()->hDispCmdDone, SVE_DISP_CMD_TIMEOUT);
}

DWORD SVE_wait_post_cmd_done(void)
{
    return WaitForSingleObject(SVE_get_context()->hPostCmdDone, SVE_POST_CMD_TIMEOUT);
}

DWORD SVE_wait_tvsc_cmd_done(void)
{
    return WaitForSingleObject(SVE_get_context()->hTVSCCmdDone, SVE_TVSC_CMD_TIMEOUT);
}

DWORD SVE_wait_rotator_finish(void)
{
    return WaitForSingleObject(SVE_get_context()->hRotatorFinish, SVE_ROTATOR_FINISH_TIMEOUT);
}

⌨️ 快捷键说明

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