📄 power.c
字号:
TVSC_processing_start();
}
}
//---------------------------
// Local Path Reconfiguration
//---------------------------
if (pPMCtxt->bLocalPathWin0Enable)
{
Post_enable_interrupt();
Post_processing_start();
Disp_set_framebuffer(DISP_WIN0, IMAGE_FRAMEBUFFER_PA_START); // Safe Frame Bufer Address for Local Path
Disp_window_onfoff(DISP_WIN0, DISP_WINDOW_ON);
pCtxt->bWindowEnable[DISP_WIN0] = TRUE;
}
if (pPMCtxt->bLocalPathWin1Enable)
{
// This require enabling CamIF MSDMA or TV Scaler
// attatched to Display controller through LocalPath FIFO in caller process
pCtxt->bWindowEnable[DISP_WIN1] = TRUE;
}
if (pPMCtxt->bLocalPathWin2Enable)
{
// This require enabling CamIF MSDMA or TV Scaler
// attatched to Display controller through LocalPath FIFO in caller process
pCtxt->bWindowEnable[DISP_WIN2] = TRUE;
}
//---------------------------
// Image Rotator Reconfiguration
//---------------------------
if (pPMCtxt->bRotatorParam)
{
SVE_hw_power_control(HWPWR_ROTATOR_ON);
SVE_hw_clock_control(HWCLK_ROTATOR_ON);
Rotator_initialize(pPMCtxt->tRotatorParam.dwImgFormat,
pPMCtxt->tRotatorParam.dwOpType,
pPMCtxt->tRotatorParam.dwSrcWidth,
pPMCtxt->tRotatorParam.dwSrcHeight);
if (pPMCtxt->bRotatorSrcBuffer)
{
Rotator_set_source_buffer(pPMCtxt->tRotatorSrcBuffer.dwBufferRGBY,
pPMCtxt->tRotatorSrcBuffer.dwBufferCb,
pPMCtxt->tRotatorSrcBuffer.dwBufferCr);
}
if (pPMCtxt->bRotatorDstBuffer)
{
Rotator_set_destination_buffer(pPMCtxt->tRotatorDstBuffer.dwBufferRGBY,
pPMCtxt->tRotatorDstBuffer.dwBufferCb,
pPMCtxt->tRotatorDstBuffer.dwBufferCr);
}
if (pPMCtxt->bRotatorStart)
{
pPMCtxt->bRotatorStart = FALSE;
pCtxt->bRotatorBusy = TRUE;
Rotator_enable_interrupt();
Rotator_start();
}
}
//---------------------------
// TV Encoder Reconfiguration
//---------------------------
if (pPMCtxt->bTVEncParam)
{
TVEnc_initialize(pPMCtxt->tTVEncParam.dwOutputType,
pPMCtxt->tTVEncParam.dwOutputStandard, pPMCtxt->tTVEncParam.dwMVisionPattern,
pPMCtxt->tTVEncParam.dwSrcWidth, pPMCtxt->tTVEncParam.dwSrcHeight);
}
//-------------------
// Enable Video Output
//-------------------
if (pPMCtxt->bTVEncEnable)
{
// TV Encoder On
TVEnc_output_onoff(TVENC_ENCODER_ON);
// TV Scaler Start
TVSC_enable_interrupt();
TVSC_processing_start();
}
if (pPMCtxt->bFIMDOutputEnable)
{
// Enable Interrupt
Disp_set_frame_interrupt(DISP_FRMINT_FRONTPORCH);
Disp_enable_frame_interrupt();
// Video Output Enable
Disp_envid_onoff(DISP_ENVID_ON);
pCtxt->bVideoEnable = TRUE;
}
//-------------------
// Update Power State
//-------------------
pPMCtxt->bPowerOn = TRUE;
CleanUp:
VDE_MSG((_T("[VDE] --SVE_video_engine_power_on()\r\n")));
}
void SVE_video_engine_power_off(void)
{
SVEngineContext *pCtxt;
SVEnginePowerContext *pPMCtxt;
DEBUGMSG(VDE_ZONE_ENTER, (_T("[VDE] ++SVE_video_engine_power_off()\r\n")));
pCtxt = SVE_get_context();
pPMCtxt = SVE_get_power_context();
if (!pPMCtxt->bPowerOn)
{
DEBUGMSG(VDE_ZONE_TEMP,(_T("[VDE:INF] SVE_video_engine_power_off() : Video Engine is Already Power Off\r\n")));
goto CleanUp;
}
//-----------------------
// Disable Video Engine HW
//-----------------------
// Disable All Interrupt
Disp_disable_frame_interrupt();
Post_disable_interrupt();
Rotator_disable_interrupt();
TVSC_disable_interrupt();
// Clear All Interrupt Pending
Disp_clear_interrupt_pending();
Post_clear_interrupt_pending();
Rotator_clear_interrupt_pending();
TVSC_clear_interrupt_pending();
// Disable FIMD output
Disp_envid_onoff(DISP_ENVID_DIRECT_OFF);
pCtxt->bVideoEnable = FALSE;
pCtxt->bWindowEnable[DISP_WIN0] = FALSE;
pCtxt->bWindowEnable[DISP_WIN1] = FALSE;
pCtxt->bWindowEnable[DISP_WIN2] = FALSE;
pCtxt->bWindowEnable[DISP_WIN3] = FALSE;
pCtxt->bWindowEnable[DISP_WIN4] = FALSE;
// Disable TV Scaler Operation
TVSC_processing_stop();
// Disable TV Encoder Operation
TVEnc_output_onoff(TVENC_ENCODER_OFF);
// Disable Post Processor Operation
Post_processing_stop();
// Disable Rotator Operation
Rotator_stop();
pCtxt->bRotatorBusy = FALSE;
//----------------------
// Clear Command Context
//----------------------
pCtxt->DispCmdCtxt[DISP_WIN0].bCmdSetBuffer = FALSE;
pCtxt->DispCmdCtxt[DISP_WIN0].bCmdSetPosition = FALSE;
pCtxt->DispCmdCtxt[DISP_WIN1].bCmdSetBuffer = FALSE;
pCtxt->DispCmdCtxt[DISP_WIN1].bCmdSetPosition = FALSE;
pCtxt->DispCmdCtxt[DISP_WIN2].bCmdSetBuffer = FALSE;
pCtxt->DispCmdCtxt[DISP_WIN2].bCmdSetPosition = FALSE;
pCtxt->DispCmdCtxt[DISP_WIN3].bCmdSetBuffer = FALSE;
pCtxt->DispCmdCtxt[DISP_WIN3].bCmdSetPosition = FALSE;
pCtxt->DispCmdCtxt[DISP_WIN4].bCmdSetBuffer = FALSE;
pCtxt->DispCmdCtxt[DISP_WIN4].bCmdSetPosition = FALSE;
pCtxt->PostCmdCtxt.bCmdSetSrcBuffer = FALSE;
pCtxt->PostCmdCtxt.bCmdSetDstBuffer = FALSE;
pCtxt->LocalPathCmdCtxt.bCmdSetWin0Disable = FALSE;
pCtxt->LocalPathCmdCtxt.bCmdSetWin1Disable = FALSE;
pCtxt->LocalPathCmdCtxt.bCmdSetWin2Disable = FALSE;
pCtxt->TVSCCmdCtxt.bCmdSetSrcBuffer = FALSE;
pCtxt->TVSCCmdCtxt.bCmdSetDstBuffer = FALSE;
//-------------------------------
// HW Clock Off and Block Power Off
//-------------------------------
SVE_hw_clock_control(HWCLK_ALL_OFF);
SVE_hw_power_control(HWPWR_ALL_OFF);
//-------------------
// Update Power State
//-------------------
pPMCtxt->bPowerOn = FALSE;
CleanUp:
VDE_MSG((_T("[VDE] --SVE_video_engine_power_off()\r\n")));
}
BOOL SVE_initialize_power_control(void)
{
SVEngineContext *pCtxt;
VDE_MSG((_T("[VDE] ++SVE_initialize_power_control()\r\n")));
pCtxt = SVE_get_context();
// Open Device Power Control Driver
pCtxt->hPowerControl = CreateFile( L"PWC0:", GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0);
if (pCtxt->hPowerControl == INVALID_HANDLE_VALUE)
{
VDE_ERR((_T("[VDE:ERR] SVE_initialize_video_engine() : PWC0 Open Device Failed\r\n")));
goto CleanUp;
}
VDE_MSG((_T("[VDE] ++SVE_initialize_power_control()\r\n")));
return TRUE;
CleanUp:
VDE_ERR((_T("[VDE:ERR] --SVE_initialize_power_control() : Failed\r\n")));
return FALSE;
}
void SVE_deinitialize_power_control(void)
{
SVEngineContext *pCtxt;
VDE_MSG((_T("[VDE] ++SVE_deinitialize_power_control()\r\n")));
pCtxt = SVE_get_context();
if (pCtxt->hPowerControl !=INVALID_HANDLE_VALUE)
{
CloseHandle(pCtxt->hPowerControl);
}
VDE_MSG((_T("[VDE] ++SVE_deinitialize_power_control()\r\n")));
}
BOOL SVE_hw_clock_control(HWCLK_GATING eParams)
{
SVEngineContext *pCtxt;
BOOL bRet = TRUE;
VDE_MSG((_T("[VDE] ++SVE_hw_clock_control(%d)\r\n"), eParams));
pCtxt = SVE_get_context();
switch(eParams)
{
case HWCLK_ALL_ON:
pCtxt->pSysConReg->HCLK_GATE |= (1<<15) // MSM I/F
|(1<<9) // TV Scaler
|(1<<8) // 2D
|(1<<7) // TV Encoder
|(1<<5) // Post Processor
|(1<<4) // Image Rotator
|(1<<3); // Display Controller
pCtxt->pSysConReg->SCLK_GATE |= (1<<19) // DAC 27MHz
|(1<<18) // TV Encoder 27MHz
//|(1<<17) // TV Scaler 27MHz
|(1<<16) // TV Scaler
|(1<<15) // Display Controller 27MHz
|(1<<14) // Display Controller
//|(1<<13) // Post Processor 1 27MHz
//|(1<<12) // Post Processor 0 27MHz
//|(1<<11) // Post Processor 1
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -