コード例 #1
0
ファイル: Power.c プロジェクト: blueskycoco/BigStar
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;
}
コード例 #2
0
ファイル: video_driver.c プロジェクト: blueskycoco/w7
DWORD
VDE_Open(
    DWORD hDeviceContext,
    DWORD AccessCode,
    DWORD ShareMode
    )
{
    DWORD dwOpenContext;

    VDE_MSG((_T("[VDE] ++VDE_Open(0x%08x, 0x%08x, 0x%08x)\r\n"), hDeviceContext, AccessCode, ShareMode));

    if (hDeviceContext != SVE_get_driver_signature())
    {
        VDE_ERR((_T("[VDE:ERR] VDE_Open() : Invalid Driver Handle[0x%08x]\r\n"), hDeviceContext));
        goto CleanUp;
    }

    dwOpenContext = SVE_add_open_context();
    if (dwOpenContext == 0)
    {
        VDE_ERR((_T("[VDE:ERR] VDE_Open() : Allocating Open Context Failed\r\n")));
        goto CleanUp;
    }

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

    return dwOpenContext;

CleanUp:

    VDE_ERR((_T("[VDE:ERR] --VDE_Init() : Failed\r\n")));

    return 0;
}
コード例 #3
0
ファイル: ResourceAPI.c プロジェクト: hibive/sjmt6410pm090728
BOOL SVE_resource_request_FIMD_interface(DWORD dwOpenContext)
{
    SVEngineContext *pCtxt = SVE_get_context();
    SVEnginePowerContext *pPMCtxt = SVE_get_power_context();

    if (pCtxt->dwOccupantFIMD == 0)
    {
        pCtxt->dwOccupantFIMD = dwOpenContext;
        SVE_hw_power_control(HWPWR_DISPLAY_ON);
        SVE_hw_clock_control(HWCLK_DISPLAY_ON);
        pPMCtxt->bFIMDOutputParam = TRUE;
        VDE_MSG((_T("[VDE] SVE_resource_request_FIMD_interface() : OpenContext[0x%08x] have resource\r\n"), dwOpenContext));
        return TRUE;
    }
    else if (pCtxt->dwOccupantFIMD == dwOpenContext)
    {
        DEBUGMSG(VDE_ZONE_ERROR, (_T("[VDE:ERR] SVE_resource_request_FIMD_interface() : OpenContext[0x%08x] already have resource\r\n"), dwOpenContext));
        return TRUE;
    }
    else
    {
        VDE_ERR((_T("[VDE:ERR] SVE_resource_request_FIMD_interface() : Resource was occupied by other OpenContext\r\n")));
        return FALSE;
    }
}
コード例 #4
0
ファイル: SVEngine.c プロジェクト: hibive/sjmt6410pm090728
BOOL SVE_remove_open_context(DWORD dwOpenContext)
{
    SVEngineContext *pCtxt = SVE_get_context();

    if (pCtxt->dwOpenCount > 0)
    {
        // Release H/W Resource
        if (pCtxt->dwOccupantFIMD == dwOpenContext) pCtxt->dwOccupantFIMD = 0;
        if (pCtxt->dwOccupantFIMDWindow[0] == dwOpenContext) pCtxt->dwOccupantFIMDWindow[0] = 0;
        if (pCtxt->dwOccupantFIMDWindow[1] == dwOpenContext) pCtxt->dwOccupantFIMDWindow[1] = 0;
        if (pCtxt->dwOccupantFIMDWindow[2] == dwOpenContext) pCtxt->dwOccupantFIMDWindow[2] = 0;
        if (pCtxt->dwOccupantFIMDWindow[3] == dwOpenContext) pCtxt->dwOccupantFIMDWindow[3] = 0;
        if (pCtxt->dwOccupantFIMDWindow[4] == dwOpenContext) pCtxt->dwOccupantFIMDWindow[4] = 0;
        if (pCtxt->dwOccupantPost == dwOpenContext) pCtxt->dwOccupantPost = 0;
        if (pCtxt->dwOccupantRotator == dwOpenContext) pCtxt->dwOccupantRotator = 0;
        if (pCtxt->dwOccupantTVScalerTVEncoder == dwOpenContext) pCtxt->dwOccupantTVScalerTVEncoder = 0;

        pCtxt->dwOpenCount--;

        VDE_MSG((_T("[VDE] SVE_remove_open_context(0x%08x) : OpenCount = %d\r\n"), pCtxt->dwLastOpenContext, pCtxt->dwOpenCount));

        return TRUE;
    }
    else
    {
        VDE_ERR((_T("[VDE:ERR] SVE_remove_open_context() : Current Open Count is 0 !!!\r\n")));

        return FALSE;
    }
}
コード例 #5
0
ファイル: ResourceAPI.c プロジェクト: hibive/sjmt6410pm090728
BOOL SVE_resource_request_TVScaler_TVEncoder(DWORD dwOpenContext)
{
    SVEngineContext *pCtxt = SVE_get_context();
    SVEnginePowerContext *pPMCtxt = SVE_get_power_context();

    if (pCtxt->dwOccupantTVScalerTVEncoder == 0)
    {
        pCtxt->dwOccupantTVScalerTVEncoder = dwOpenContext;
        SVE_hw_power_control(HWPWR_TV_ON);
        SVE_hw_clock_control(HWCLK_TV_ON);
        pPMCtxt->bTVSCParam = TRUE;
        pPMCtxt->bTVEncParam = TRUE;
        VDE_MSG((_T("[VDE] SVE_resource_request_TVScaler_TVEncoder() : OpenContext[0x%08x] have resource\r\n"), dwOpenContext));
        return TRUE;
    }
    else if (pCtxt->dwOccupantTVScalerTVEncoder == dwOpenContext)
    {
        DEBUGMSG(VDE_ZONE_TEMP, (_T("[VDE:ERR] SVE_resource_request_TVScaler_TVEncoder() : OpenContext[0x%08x] already have resource\r\n"), dwOpenContext));
        return TRUE;
    }
    else
    {
        VDE_ERR((_T("[VDE:ERR] SVE_resource_request_TVScaler_TVEncoder() : Resource was occupied by other OpenContext\r\n")));
        return FALSE;
    }
}
コード例 #6
0
ファイル: video_driver.c プロジェクト: blueskycoco/w7
DWORD
VDE_Init(
    LPCTSTR pContext
    )
{
    VDE_MSG((_T("[VDE] ++VDE_Init(0x%08x)\r\n"), pContext));

    if (SVE_initialize_video_engine() == FALSE)
    {
        VDE_ERR((_T("[VDE:ERR] VDE_Init() : SVE_initialize_video_engine() Failed \n\r")));
        goto CleanUp;
    }

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

    return SVE_get_driver_signature();    // hDeviceContext

CleanUp:

    VDE_ERR((_T("[VDE:ERR] --VDE_Init() : Failed\r\n")));

    return 0;
}
コード例 #7
0
ファイル: ResourceAPI.c プロジェクト: hibive/sjmt6410pm090728
BOOL SVE_resource_compare_TVScaler_TVEncoder(DWORD dwOpenContext)
{
    SVEngineContext *pCtxt = SVE_get_context();

    if (pCtxt->dwOccupantTVScalerTVEncoder == dwOpenContext)
    {
        VDE_MSG((_T("[VDE] SVE_resource_compare_TVScaler_TVEncoder() : OpenContext[0x%08x] have resource\r\n"), dwOpenContext));
        return TRUE;
    }
    else
    {
        VDE_ERR((_T("[VDE:ERR] SVE_resource_compare_TVScaler_TVEncoder() : Resource was occupied by other OpenContext:0x%x\r\n"), pCtxt->dwOccupantTVScalerTVEncoder));
        return FALSE;
    }
}
コード例 #8
0
ファイル: ResourceAPI.c プロジェクト: hibive/sjmt6410pm090728
BOOL SVE_resource_compare_FIMD_interface(DWORD dwOpenContext)
{
    SVEngineContext *pCtxt = SVE_get_context();

    if (pCtxt->dwOccupantFIMD == dwOpenContext)
    {
        VDE_MSG((_T("[VDE] SVE_resource_compare_FIMD_interface() : OpenContext[0x%08x] have resource\r\n"), dwOpenContext));
        return TRUE;
    }
    else 
    {
        VDE_ERR((_T("[VDE:ERR] SVE_resource_request_FIMD_interface() : Resource was occupied by OpenContext: 0x%x\r\n"), pCtxt->dwOccupantFIMD));
        return FALSE;
    }
}
コード例 #9
0
ファイル: ResourceAPI.c プロジェクト: hibive/sjmt6410pm090728
BOOL SVE_resource_compare_FIMD_window(DWORD dwWinNum, DWORD dwOpenContext)
{
    SVEngineContext *pCtxt = SVE_get_context();

    if (pCtxt->dwOccupantFIMDWindow[dwWinNum] == dwOpenContext)
    {
        DEBUGMSG(VDE_ZONE_TEMP,(_T("[VDE] SVE_resource_compare_FIMD_window() : OpenContext[0x%08x] have resource Win[%d]\r\n"), dwOpenContext, dwWinNum));
        return TRUE;
    }
    else
    {
        VDE_ERR((_T("[VDE:ERR] SVE_resource_compare_FIMD_window() : Resource Win[%d]:0x%x was occupied by other OpenContext\r\n"), dwWinNum, pCtxt->dwOccupantFIMDWindow[dwWinNum]));
        return FALSE;
    }
}
コード例 #10
0
ファイル: video_driver.c プロジェクト: blueskycoco/w7
BOOL
VDE_Deinit(
    DWORD hDeviceContext
    )
{
    VDE_MSG((_T("[VDE] ++VDE_Deinit(0x%08x)\r\n"), hDeviceContext));

    if (hDeviceContext != SVE_get_driver_signature())
    {
        VDE_ERR((_T("[VDE:ERR] VDE_Deinit() : Invalid Driver Handle[0x%08x]\r\n"), hDeviceContext));
        return FALSE;
    }

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

    return TRUE;
}
コード例 #11
0
ファイル: video_driver.c プロジェクト: blueskycoco/w7
BOOL
VDE_Close(
    DWORD hOpenContext
    )
{
    BOOL bRet;

    VDE_MSG((_T("[VDE] ++VDE_Close(0x%08x)\r\n"), hOpenContext));

    bRet = SVE_remove_open_context(hOpenContext);
    if (!bRet)
    {
        VDE_ERR((_T("[VDE:ERR] VDE_Close() : Invalid Open Context !!!\r\n")));
    }

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

    return bRet;
}
コード例 #12
0
ファイル: ResourceAPI.c プロジェクト: hibive/sjmt6410pm090728
BOOL SVE_resource_release_Rotator(DWORD dwOpenContext)
{
    SVEngineContext *pCtxt = SVE_get_context();
    SVEnginePowerContext *pPMCtxt = SVE_get_power_context();

    if (pCtxt->dwOccupantRotator == dwOpenContext)
    {
        pCtxt->dwOccupantRotator = 0;
        SVE_hw_power_control(HWPWR_ROTATOR_OFF);
        SVE_hw_clock_control(HWCLK_ROTATOR_OFF);
        pPMCtxt->bRotatorParam = FALSE;
        VDE_MSG((_T("[VDE] SVE_resource_release_Rotator() : OpenContext[0x%08x] release resource\r\n"), dwOpenContext));
        return TRUE;
    }
    else
    {
        VDE_ERR((_T("[VDE:ERR] SVE_resource_release_Rotator() : Resource was occupied by other OpenContext\r\n")));
        return FALSE;
    }
}
コード例 #13
0
ファイル: tvencoderapi.c プロジェクト: blueskycoco/w7
BOOL SVE_TVEncoder_API_Proc(
    DWORD hOpenContext,
    DWORD dwCode,
    PBYTE pBufIn,
    DWORD dwLenIn,
    PBYTE pBufOut,
    DWORD dwLenOut,
    PDWORD pdwActualOut
    )
{
    SVEngineContext *pCtxt;
    SVEnginePowerContext *pPMCtxt;
    BOOL bRet = TRUE;

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

    pCtxt = SVE_get_context();
    pPMCtxt = SVE_get_power_context();

    //-------------------------------------------------------------
    // Check OpenContext of Caller have the right to access to H/W Resource
    //-------------------------------------------------------------
    switch(dwCode)
    {
    case SVE_TVENC_SET_INTERFACE_PARAM:
    case SVE_TVENC_SET_ENCODER_ON:
    case SVE_TVENC_SET_ENCODER_OFF:
    case SVE_TVENC_GET_INTERFACE_STATUS:
        bRet = SVE_resource_compare_TVScaler_TVEncoder(hOpenContext);
        if (!bRet)
        {
            VDE_ERR((_T("[VDE:ERR] SVE_TVEncoder_API_Proc(0x%08x) : No Right to Access to H/W Resource\r\n"), dwCode));
            goto CleanUp;
        }
        break;
    default:
        DEBUGMSG(VDE_ZONE_ERROR, (TEXT("[VDE:ERR] Invalid IOCTL code\n")));
        bRet = FALSE;
        goto CleanUp;
    }


    //--------------------------------
    // Processing IOCTL for TV Encoder
    //--------------------------------

    switch(dwCode)
    {
        case SVE_TVENC_SET_INTERFACE_PARAM:
        {
            SVEARG_TVENC_PARAMETER *pArg;

            VDE_MSG((_T("[VDE] SVE_TVEncoder_API_Proc() : SVE_TVENC_SET_INTERFACE_PARAM\n\r")));

            if(!pBufIn || dwLenIn < sizeof(SVEARG_TVENC_PARAMETER))
            {
                DEBUGMSG(VDE_ZONE_ERROR,(TEXT("Invalid Parameter : pBufIn:0x%x Length:%d\n"), pBufIn, dwLenIn));
                bRet = FALSE;
                break;
            }  
            
            pArg = (SVEARG_TVENC_PARAMETER *)pBufIn;

            if (pPMCtxt->bPowerOn)
            {
                if (TVEnc_get_output_state() == TVENC_ENCODER_ON)        // TV Encoder Running
                {
                    VDE_ERR((_T("[VDE:ERR] SVE_TVEncoder_API_Proc() : SVE_TVENC_SET_INTERFACE_PARAM : TV Encoder is Running\n\r")));
                    bRet = FALSE;
                    break;
                }

                TVEnc_initialize(pArg->dwOutputType, pArg->dwOutputStandard, pArg->dwMVisionPattern, pArg->dwSrcWidth, pArg->dwSrcHeight);
            }

            // Backup for PM
            memcpy(&pPMCtxt->tTVEncParam, pArg, sizeof(SVEARG_TVENC_PARAMETER));

            break;
        }

        case SVE_TVENC_SET_ENCODER_ON:    // Start TV Scaler & Enable TV Encoder
        {
            VDE_MSG((_T("[VDE] SVE_TVEncoder_API_Proc() : SVE_TVENC_SET_ENCODER_ON\n\r")));

            if (pPMCtxt->bPowerOn)
            {
                //------------------
                // Enable TV Encoder
                //------------------
                if (TVEnc_get_output_state() == TVENC_ENCODER_ON)        // TV Encoder Running
                {
                    VDE_ERR((_T("[VDE:ERR] SVE_TVEncoder_API_Proc() : SVE_TVENC_SET_ENCODER_ON : TV Encoder is Running\n\r")));
                    //bRet = FALSE;    // Treat this as Non-Error
                }
                else
                {
                    //TVEnc_disable_interrupt();
                    TVEnc_output_onoff(TVENC_ENCODER_ON);
                }

                //--------------
                // Start TV Scaler
                //--------------
                if (TVSC_get_processing_state() == TVSC_BUSY)        // TV Scaler Running
                {
                    VDE_ERR((_T("[VDE:ERR] SVE_TVEncoder_API_Proc() : SVE_TVENC_SET_ENCODER_ON : TV Scaler is Running\n\r")));
                    bRet = FALSE;
                    break;
                }

                TVSC_enable_interrupt();
                TVSC_processing_start();
            }

            // Backup for PM
            pPMCtxt->bTVEncEnable = TRUE;

            break;
        }

        case SVE_TVENC_SET_ENCODER_OFF:    // Stop TV Scaler & Disable TV Encoder
        {
            VDE_MSG((_T("[VDE] SVE_TVEncoder_API_Proc() : SVE_TVENC_SET_ENCODER_OFF\n\r")));

            if (pPMCtxt->bPowerOn)
            {
                //----------------
                // Stop TV Scaler
                //----------------
                TVSC_autoload_disable();
                if (TVSC_get_processing_state() == TVSC_BUSY)    // TV Scaler Running
                {
                    // Wait for Current Frame Finished
                    if (WAIT_TIMEOUT == SVE_wait_tvsc_cmd_done())
                    {
                        if (TVSC_get_processing_state() == TVSC_IDLE)
                        {
                            // Time Out, But TV Scaler Finished
                            VDE_MSG((_T("[VDE] SVE_TVEncoder_API_Proc() : SVE_TVENC_SET_ENCODER_OFF : SVE_wait_tvsc_cmd_done() TimeOut, But TV Scaler Finished\n\r")));
                        }
                        else
                        {
                            VDE_INF((_T("[VDE:INF] SVE_TVEncoder_API_Proc() : SVE_TVENC_SET_ENCODER_OFF : SVE_wait_tvsc_cmd_done() TimeOut\n\r")));
                            TVSC_processing_stop();
                        }
                    }
                }

                //------------------
                // Disable TV Encoder
                //------------------
                if (TVEnc_get_output_state() == TVENC_ENCODER_OFF)        // TV Encoder Not Running
                {
                    VDE_ERR((_T("[VDE:ERR] SVE_TVEncoder_API_Proc() : SVE_TVENC_SET_ENCODER_OFF : TV Encoder is Not Running\n\r")));
                    //bRet = FALSE;    // Treat this as Non-Error
                }
                else
                {
                    TVEnc_output_onoff(TVENC_ENCODER_OFF);
                }
            }

            // Backup for PM
            pPMCtxt->bTVEncEnable = FALSE;

            break;
        }

        case SVE_TVENC_GET_INTERFACE_STATUS:
            VDE_ERR((_T("[VDE:ERR] SVE_TVEncoder_API_Proc() : SVE_TVENC_GET_INTERFACE_STATUS : Not Implemented Yet...\n\r")));
            bRet = FALSE;
            break;
        default:    // This is filtered above switch statement
            bRet = FALSE;
            break;
            
    }

CleanUp:

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

    return bRet;
}
コード例 #14
0
ファイル: Power.c プロジェクト: blueskycoco/BigStar
BOOL SVE_hw_power_control(HWPWR_GATING eParams)
{
	SVEngineContext *pCtxt;
	DWORD dwIPIndex, dwBytes;
	BOOL bRet = TRUE;

	VDE_MSG((_T("[VDE] ++SVE_hw_power_control(%d)\r\n"), eParams));

	pCtxt = SVE_get_context();

	switch(eParams)
	{
	case HWPWR_ALL_ON:
		dwIPIndex = PWR_IP_DISPCON;	// Power On Display Controller
		if ( !DeviceIoControl(pCtxt->hPowerControl, IOCTL_PWRCON_SET_POWER_ON, &dwIPIndex, sizeof(DWORD), NULL, 0, &dwBytes, NULL) )
		{
			VDE_ERR((_T("[VDE:ERR] SVE_hw_power_control() : IOCTL_PWRCON_SET_POWER_ON Failed\n\r")));
			bRet = FALSE;
		}

		dwIPIndex = PWR_IP_POST;		// Power On Post Processor
		if ( !DeviceIoControl(pCtxt->hPowerControl, IOCTL_PWRCON_SET_POWER_ON, &dwIPIndex, sizeof(DWORD), NULL, 0, &dwBytes, NULL) )
		{
			VDE_ERR((_T("[VDE:ERR] SVE_hw_power_control() : IOCTL_PWRCON_SET_POWER_ON Failed\n\r")));
			bRet = FALSE;
		}

		dwIPIndex = PWR_IP_ROTATOR;	// Power On Image Rotator
		if ( !DeviceIoControl(pCtxt->hPowerControl, IOCTL_PWRCON_SET_POWER_ON, &dwIPIndex, sizeof(DWORD), NULL, 0, &dwBytes, NULL) )
		{
			VDE_ERR((_T("[VDE:ERR] SVE_hw_power_control() : IOCTL_PWRCON_SET_POWER_ON Failed\n\r")));
			bRet = FALSE;
		}

		dwIPIndex = PWR_IP_TVENC;	// Power On TV Encoder
		if ( !DeviceIoControl(pCtxt->hPowerControl, IOCTL_PWRCON_SET_POWER_ON, &dwIPIndex, sizeof(DWORD), NULL, 0, &dwBytes, NULL) )
		{
			VDE_ERR((_T("[VDE:ERR] SVE_hw_power_control() : IOCTL_PWRCON_SET_POWER_ON Failed\n\r")));
			bRet = FALSE;
		}
		dwIPIndex = PWR_IP_TVSC;		// Power On TV Scaler
		if ( !DeviceIoControl(pCtxt->hPowerControl, IOCTL_PWRCON_SET_POWER_ON, &dwIPIndex, sizeof(DWORD), NULL, 0, &dwBytes, NULL) )
		{
			VDE_ERR((_T("[VDE:ERR] SVE_hw_power_control() : IOCTL_PWRCON_SET_POWER_ON Failed\n\r")));
			bRet = FALSE;
		}
		break;

	case HWPWR_ALL_OFF:
		dwIPIndex = PWR_IP_DISPCON;	// Power Off Display Controller
		if ( !DeviceIoControl(pCtxt->hPowerControl, IOCTL_PWRCON_SET_POWER_OFF, &dwIPIndex, sizeof(DWORD), NULL, 0, &dwBytes, NULL) )
		{
			VDE_ERR((_T("[VDE:ERR] SVE_hw_power_control() : IOCTL_PWRCON_SET_POWER_OFF Failed\n\r")));
			bRet = FALSE;
		}

		dwIPIndex = PWR_IP_POST;		// Power Off Post Processor
		if ( !DeviceIoControl(pCtxt->hPowerControl, IOCTL_PWRCON_SET_POWER_OFF, &dwIPIndex, sizeof(DWORD), NULL, 0, &dwBytes, NULL) )
		{
			VDE_ERR((_T("[VDE:ERR] SVE_hw_power_control() : IOCTL_PWRCON_SET_POWER_OFF Failed\n\r")));
			bRet = FALSE;
		}

		dwIPIndex = PWR_IP_ROTATOR;	// Power Off Image Rotator
		if ( !DeviceIoControl(pCtxt->hPowerControl, IOCTL_PWRCON_SET_POWER_OFF, &dwIPIndex, sizeof(DWORD), NULL, 0, &dwBytes, NULL) )
		{
			VDE_ERR((_T("[VDE:ERR] SVE_hw_power_control() : IOCTL_PWRCON_SET_POWER_OFF Failed\n\r")));
			bRet = FALSE;
		}

		dwIPIndex = PWR_IP_TVENC;	// Power Off TV Encoder
		if ( !DeviceIoControl(pCtxt->hPowerControl, IOCTL_PWRCON_SET_POWER_OFF, &dwIPIndex, sizeof(DWORD), NULL, 0, &dwBytes, NULL) )
		{
			VDE_ERR((_T("[VDE:ERR] SVE_hw_power_control() : IOCTL_PWRCON_SET_POWER_OFF Failed\n\r")));
			bRet = FALSE;
		}

		dwIPIndex = PWR_IP_TVSC;		// Power Off TV Scaler
		if ( !DeviceIoControl(pCtxt->hPowerControl, IOCTL_PWRCON_SET_POWER_OFF, &dwIPIndex, sizeof(DWORD), NULL, 0, &dwBytes, NULL) )
		{
			VDE_ERR((_T("[VDE:ERR] SVE_hw_power_control() : IOCTL_PWRCON_SET_POWER_OFF Failed\n\r")));
			bRet = FALSE;
		}
		break;

	case HWPWR_DISPLAY_ON:
		dwIPIndex = PWR_IP_DISPCON;	// Power On Display Controller
		if ( !DeviceIoControl(pCtxt->hPowerControl, IOCTL_PWRCON_SET_POWER_ON, &dwIPIndex, sizeof(DWORD), NULL, 0, &dwBytes, NULL) )
		{
			VDE_ERR((_T("[VDE:ERR] SVE_hw_power_control() : IOCTL_PWRCON_SET_POWER_ON Failed\n\r")));
			bRet = FALSE;
		}
		break;

	case HWPWR_DISPLAY_OFF:
		dwIPIndex = PWR_IP_DISPCON;	// Power Off Display Controller
		if ( !DeviceIoControl(pCtxt->hPowerControl, IOCTL_PWRCON_SET_POWER_OFF, &dwIPIndex, sizeof(DWORD), NULL, 0, &dwBytes, NULL) )
		{
			VDE_ERR((_T("[VDE:ERR] SVE_hw_power_control() : IOCTL_PWRCON_SET_POWER_OFF Failed\n\r")));
			bRet = FALSE;
		}
		break;

	case HWPWR_POST_ON:
		dwIPIndex = PWR_IP_POST;		// Power On Post Processor
		if ( !DeviceIoControl(pCtxt->hPowerControl, IOCTL_PWRCON_SET_POWER_ON, &dwIPIndex, sizeof(DWORD), NULL, 0, &dwBytes, NULL) )
		{
			VDE_ERR((_T("[VDE:ERR] SVE_hw_power_control() : IOCTL_PWRCON_SET_POWER_ON Failed\n\r")));
			bRet = FALSE;
		}
		break;

	case HWPWR_POST_OFF:
		dwIPIndex = PWR_IP_POST;		// Power Off Post Processor
		if ( !DeviceIoControl(pCtxt->hPowerControl, IOCTL_PWRCON_SET_POWER_OFF, &dwIPIndex, sizeof(DWORD), NULL, 0, &dwBytes, NULL) )
		{
			VDE_ERR((_T("[VDE:ERR] SVE_hw_power_control() : IOCTL_PWRCON_SET_POWER_OFF Failed\n\r")));
			bRet = FALSE;
		}
		break;

	case HWPWR_ROTATOR_ON:
		dwIPIndex = PWR_IP_ROTATOR;	// Power On Image Rotator
		if ( !DeviceIoControl(pCtxt->hPowerControl, IOCTL_PWRCON_SET_POWER_ON, &dwIPIndex, sizeof(DWORD), NULL, 0, &dwBytes, NULL) )
		{
			VDE_ERR((_T("[VDE:ERR] SVE_hw_power_control() : IOCTL_PWRCON_SET_POWER_ON Failed\n\r")));
			bRet = FALSE;
		}
		break;

	case HWPWR_ROTATOR_OFF:
		dwIPIndex = PWR_IP_ROTATOR;	// Power Off Image Rotator
		if ( !DeviceIoControl(pCtxt->hPowerControl, IOCTL_PWRCON_SET_POWER_OFF, &dwIPIndex, sizeof(DWORD), NULL, 0, &dwBytes, NULL) )
		{
			VDE_ERR((_T("[VDE:ERR] SVE_hw_power_control() : IOCTL_PWRCON_SET_POWER_OFF Failed\n\r")));
			bRet = FALSE;
		}
		break;

	case HWPWR_TV_ON:
		dwIPIndex = PWR_IP_TVENC;	// Power On TV Encoder
		if ( !DeviceIoControl(pCtxt->hPowerControl, IOCTL_PWRCON_SET_POWER_ON, &dwIPIndex, sizeof(DWORD), NULL, 0, &dwBytes, NULL) )
		{
			VDE_ERR((_T("[VDE:ERR] SVE_hw_power_control() : IOCTL_PWRCON_SET_POWER_ON Failed\n\r")));
			bRet = FALSE;
		}
		dwIPIndex = PWR_IP_TVSC;		// Power On TV Scaler
		if ( !DeviceIoControl(pCtxt->hPowerControl, IOCTL_PWRCON_SET_POWER_ON, &dwIPIndex, sizeof(DWORD), NULL, 0, &dwBytes, NULL) )
		{
			VDE_ERR((_T("[VDE:ERR] SVE_hw_power_control() : IOCTL_PWRCON_SET_POWER_ON Failed\n\r")));
			bRet = FALSE;
		}
		break;

	case HWPWR_TV_OFF:
		dwIPIndex = PWR_IP_TVENC;	// Power Off TV Encoder
		if ( !DeviceIoControl(pCtxt->hPowerControl, IOCTL_PWRCON_SET_POWER_OFF, &dwIPIndex, sizeof(DWORD), NULL, 0, &dwBytes, NULL) )
		{
			VDE_ERR((_T("[VDE:ERR] SVE_hw_power_control() : IOCTL_PWRCON_SET_POWER_OFF Failed\n\r")));
			bRet = FALSE;
		}
		dwIPIndex = PWR_IP_TVSC;		// Power Off TV Scaler
		if ( !DeviceIoControl(pCtxt->hPowerControl, IOCTL_PWRCON_SET_POWER_OFF, &dwIPIndex, sizeof(DWORD), NULL, 0, &dwBytes, NULL) )
		{
			VDE_ERR((_T("[VDE:ERR] SVE_hw_power_control() : IOCTL_PWRCON_SET_POWER_OFF Failed\n\r")));
			bRet = FALSE;
		}
		break;

	case HWPWR_2D_ON:
		dwIPIndex = PWR_IP_2D;		// Power On FIMG 2D
		if ( !DeviceIoControl(pCtxt->hPowerControl, IOCTL_PWRCON_SET_POWER_ON, &dwIPIndex, sizeof(DWORD), NULL, 0, &dwBytes, NULL) )
		{
			VDE_ERR((_T("[VDE:ERR] SVE_hw_power_control() : IOCTL_PWRCON_SET_POWER_ON Failed\n\r")));
			bRet = FALSE;
		}
		break;

	case HWPWR_2D_OFF:
		dwIPIndex = PWR_IP_2D;		// Power Off FIMG 2D
		if ( !DeviceIoControl(pCtxt->hPowerControl, IOCTL_PWRCON_SET_POWER_OFF, &dwIPIndex, sizeof(DWORD), NULL, 0, &dwBytes, NULL) )
		{
			VDE_ERR((_T("[VDE:ERR] SVE_hw_power_control() : IOCTL_PWRCON_SET_POWER_OFF Failed\n\r")));
			bRet = FALSE;
		}
		break;

	default:
		VDE_ERR((_T("[VDE:ERR] SVE_hw_power_control() : Unknown Parameter = %d\n\r"), eParams));
		break;
	}

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

	return bRet;
}
コード例 #15
0
ファイル: Power.c プロジェクト: blueskycoco/BigStar
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
									|(1<<10);	// Post Processor 0
		break;

	case HWCLK_ALL_OFF:
		pCtxt->pSysConReg->HCLK_GATE &= ~((1<<15)|/*(1<<9)| */(1<<8)|(1<<7)|(1<<5)|(1<<4)|(1<<3));
		pCtxt->pSysConReg->SCLK_GATE &= ~((1<<19)|(1<<18)|(1<<16)|(1<<15)|(1<<14)|(1<<10));
		break;

	case HWCLK_DISPLAY_ON:
		pCtxt->pSysConReg->HCLK_GATE |= (1<<15)		// MSM I/F
									|(1<<3);		// Display Controller
		pCtxt->pSysConReg->SCLK_GATE |= (1<<14);	// Display Controller
		break;

	case HWCLK_DISPLAY_OFF:
		pCtxt->pSysConReg->HCLK_GATE &= ~((1<<15)|(1<<3));
		pCtxt->pSysConReg->SCLK_GATE &= ~(1<<14);
		break;

	case HWCLK_MSMIF_ON:
		pCtxt->pSysConReg->HCLK_GATE |= (1<<15);	// MSM I/F
		break;

	case HWCLK_MSMIF_OFF:
		pCtxt->pSysConReg->HCLK_GATE &= ~(1<<15);	// MSM I/F
		break;

	case HWCLK_POST_ON:
		pCtxt->pSysConReg->HCLK_GATE |= (1<<5);		// Post Processor
		pCtxt->pSysConReg->SCLK_GATE |= (1<<10);	// Post Processor 0
		break;

	case HWCLK_POST_OFF:
		pCtxt->pSysConReg->HCLK_GATE &= ~(1<<5);	// Post Processor
		pCtxt->pSysConReg->SCLK_GATE &= ~(1<<10);	// Post Processor 0
		break;

	case HWCLK_ROTATOR_ON:
		pCtxt->pSysConReg->HCLK_GATE |= (1<<4);		// Image Rotator
		break;

	case HWCLK_ROTATOR_OFF:
		pCtxt->pSysConReg->HCLK_GATE &= ~(1<<4);	// Image Rotator
		break;

	case HWCLK_TV_ON:
		pCtxt->pSysConReg->HCLK_GATE |= (1<<9)		// TV Scaler
									|(1<<7);		// TV Encoder
		pCtxt->pSysConReg->SCLK_GATE |= (1<<19)		// DAC 27MHz
									|(1<<18)	// TV Encoder 27MHz
									|(1<<16)	// TV Scaler
									|(1<<15);	// Display Controller 27MHz
		break;

	case HWCLK_TV_OFF:
		pCtxt->pSysConReg->HCLK_GATE &= ~((1<<9)|(1<<7));
		pCtxt->pSysConReg->SCLK_GATE &= ~((1<<19)|(1<<18)|(1<<16)|(1<<15));
		break;

	case HWCLK_2D_ON:
		pCtxt->pSysConReg->HCLK_GATE |= (1<<8);		// FIMG 2D
		break;

	case HWCLK_2D_OFF:
		pCtxt->pSysConReg->HCLK_GATE &= ~(1<<8);	// FIMG 2D
		break;

	default:
		VDE_ERR((_T("[VDE:ERR] SVE_hw_clock_control() : Unknown Parameter = %d\n\r"), eParams));
		bRet = FALSE;
		break;
	}

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

	return bRet;
}
コード例 #16
0
ファイル: RotatorAPI.c プロジェクト: HITEG/TenByTen6410_SLC
BOOL SVE_Rotator_API_Proc(
    DWORD hOpenContext,
    DWORD dwCode,
    PBYTE pBufIn,
    DWORD dwLenIn,
    PBYTE pBufOut,
    DWORD dwLenOut,
    PDWORD pdwActualOut
    )
{
    SVEngineContext *pCtxt;
    SVEnginePowerContext *pPMCtxt;
    BOOL bRet = TRUE;

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

    pCtxt = SVE_get_context();
    pPMCtxt = SVE_get_power_context();

    //-------------------------------------------------------------
    // Check OpenContext of Caller have the right to access to H/W Resource
    //-------------------------------------------------------------
    switch(dwCode)
    {
    case SVE_ROTATOR_SET_OPERATION_PARAM:
    case SVE_ROTATOR_SET_SOURCE_BUFFER:
    case SVE_ROTATOR_SET_DESTINATION_BUFFER:
    case SVE_ROTATOR_SET_OPERATION_START:
    case SVE_ROTATOR_SET_OPERATION_STOP:
    case SVE_ROTATOR_WAIT_OPERATION_DONE:
    case SVE_ROTATOR_GET_STATUS:
        bRet = SVE_resource_compare_Rotator(hOpenContext);
        if (!bRet)
        {
            VDE_ERR((_T("[VDE:ERR] SVE_Rotator_API_Proc(0x%08x) : No Right to Access to H/W Resource\r\n"), dwCode));
            goto CleanUp;
        }
        break;
    default:
        DEBUGMSG(VDE_ZONE_ERROR, (TEXT("[VDE:ERR] Invalid IOCTL code\n")));
        bRet = FALSE;
        goto CleanUp;
    }

    //--------------------------------
    // Processing IOCTL for Image Rotator
    //--------------------------------

    switch(dwCode)
    {
        case SVE_ROTATOR_SET_OPERATION_PARAM:
        {
            SVEARG_ROTATOR_PARAMETER *pArg;

            VDE_MSG((_T("[VDE] SVE_Rotator_API_Proc() : SVE_ROTATOR_SET_OPERATION_PARAM\n\r")));

            if(!pBufIn || dwLenIn < sizeof(SVEARG_ROTATOR_PARAMETER))
            {
                DEBUGMSG(VDE_ZONE_ERROR,(TEXT("Invalid Parameter : pBufIn:0x%x Length:%d\n"), pBufIn, dwLenIn));
                bRet = FALSE;
                break;
            }            

            pArg = (SVEARG_ROTATOR_PARAMETER *)pBufIn;

            if (pPMCtxt->bPowerOn)
            {
                if (pCtxt->bRotatorBusy)        // Check Rotator Running
                {
                    VDE_ERR((_T("[VDE:ERR] SVE_Rotator_API_Proc() : SVE_ROTATOR_SET_OPERATION_PARAM : Image Rotator is Running\n\r")));
                    bRet = FALSE;
                    break;
                }

                Rotator_initialize(pArg->dwImgFormat, pArg->dwOpType, pArg->dwSrcWidth, pArg->dwSrcHeight);
            }

            // Backup for PM
            memcpy(&pPMCtxt->tRotatorParam, pArg, sizeof(SVEARG_ROTATOR_PARAMETER));

            break;
        }

        case SVE_ROTATOR_SET_SOURCE_BUFFER:
        {
            SVEARG_ROTATOR_BUFFER *pArg;

            VDE_MSG((_T("[VDE] SVE_Rotator_API_Proc() : SVE_ROTATOR_SET_SOURCE_BUFFER\n\r")));

            if(!pBufIn || dwLenIn < sizeof(SVEARG_ROTATOR_BUFFER))
            {
                DEBUGMSG(VDE_ZONE_ERROR,(TEXT("Invalid Parameter : pBufIn:0x%x Length:%d\n"), pBufIn, dwLenIn));
                bRet = FALSE;
                break;
            }                   

            pArg = (SVEARG_ROTATOR_BUFFER *)pBufIn;

            if (pPMCtxt->bPowerOn)
            {
                if (pCtxt->bRotatorBusy)        // Check Rotator Running
                {
                    VDE_ERR((_T("[VDE:ERR] SVE_Rotator_API_Proc() : SVE_ROTATOR_SET_SOURCE_BUFFER : Image Rotator is Running\n\r")));
                    bRet = FALSE;
                    break;
                }

                Rotator_set_source_buffer(pArg->dwBufferRGBY, pArg->dwBufferCb, pArg->dwBufferCr);
            }

            // Backup for PM
            memcpy(&pPMCtxt->tRotatorSrcBuffer, pArg, sizeof(SVEARG_ROTATOR_BUFFER));
            pPMCtxt->bRotatorSrcBuffer = TRUE;

            break;
        }

        case SVE_ROTATOR_SET_DESTINATION_BUFFER:
        {
            SVEARG_ROTATOR_BUFFER *pArg;

            VDE_MSG((_T("[VDE] SVE_Rotator_API_Proc() : SVE_ROTATOR_SET_DESTINATION_BUFFER\n\r")));

            if(!pBufIn || dwLenIn < sizeof(SVEARG_ROTATOR_BUFFER))
            {
                DEBUGMSG(VDE_ZONE_ERROR,(TEXT("Invalid Parameter : pBufIn:0x%x Length:%d\n"), pBufIn, dwLenIn));
                bRet = FALSE;
                break;
            }                   

            pArg = (SVEARG_ROTATOR_BUFFER *)pBufIn;

            if (pPMCtxt->bPowerOn)
            {
                if (pCtxt->bRotatorBusy)        // Check Rotator Running
                {
                    VDE_ERR((_T("[VDE:ERR] SVE_Rotator_API_Proc() : SVE_ROTATOR_SET_DESTINATION_BUFFER : Image Rotator is Running\n\r")));
                    bRet = FALSE;
                    break;
                }

                Rotator_set_destination_buffer(pArg->dwBufferRGBY, pArg->dwBufferCb, pArg->dwBufferCr);
            }

            // Backup for PM
            memcpy(&pPMCtxt->tRotatorDstBuffer, pArg, sizeof(SVEARG_ROTATOR_BUFFER));
            pPMCtxt->bRotatorDstBuffer = TRUE;

            break;
        }

        case SVE_ROTATOR_SET_OPERATION_START:
        {
            VDE_MSG((_T("[VDE] SVE_Rotator_API_Proc() : SVE_ROTATOR_SET_OPERATION_START\n\r")));

            if (pPMCtxt->bPowerOn)
            {
                if (pCtxt->bRotatorBusy)        // Check Rotator Running
                {
                    VDE_ERR((_T("[VDE:ERR] SVE_Rotator_API_Proc() : SVE_ROTATOR_SET_OPERATION_START : Image Rotator is Running\n\r")));
                    bRet = FALSE;
                    break;
                }

                // Image Rotator Status Flag
                pCtxt->bRotatorBusy = TRUE;

                Rotator_enable_interrupt();
                Rotator_start();
            }

            // Backup for PM
            pPMCtxt->bRotatorStart = TRUE;

            break;
        }

        case SVE_ROTATOR_SET_OPERATION_STOP:
        {
            VDE_MSG((_T("[VDE] SVE_Rotator_API_Proc() : SVE_ROTATOR_SET_OPERATION_STOP\n\r")));

            if (pPMCtxt->bPowerOn)
            {
                if (pCtxt->bRotatorBusy)        // Check Rotator Running
                {
                    if (WAIT_TIMEOUT == SVE_wait_rotator_finish())
                    {
                        if (pCtxt->bRotatorBusy == FALSE)
                        {
                            // Time Out, But Rotator Finished...
                            VDE_MSG((_T("[VDE] SVE_Rotator_API_Proc() : SVE_ROTATOR_SET_OPERATION_STOP : SVE_wait_rotator_finish() TimeOut, But Rotator Finished\n\r")));
                        }
                        else
                        {
                            VDE_ERR((_T("[VDE:ERR] SVE_Rotator_API_Proc() : SVE_ROTATOR_SET_OPERATION_STOP : SVE_wait_rotator_finish() TimeOut\n\r")));
                            bRet = FALSE;
                        }
                    }
                }
                else
                {
                    VDE_MSG((_T("[VDE] SVE_Rotator_API_Proc() : SVE_ROTATOR_SET_OPERATION_START : Image Rotator Already Stopped\n\r")));
                }
            }

            // Backup for PM
            pPMCtxt->bRotatorStart = FALSE;

            break;
        }

        case SVE_ROTATOR_WAIT_OPERATION_DONE:    // Actually Same with SVE_ROTATOR_SET_OPERATION_STOP API
        {
            VDE_MSG((_T("[VDE] SVE_Rotator_API_Proc() : SVE_ROTATOR_WAIT_OPERATION_DONE\n\r")));

            if (pPMCtxt->bPowerOn)
            {
                if (pCtxt->bRotatorBusy)        // Check Rotator Running
                {
                    if (WAIT_TIMEOUT == SVE_wait_rotator_finish())
                    {
                        if (pCtxt->bRotatorBusy == FALSE)
                        {
                            // Time Out, But Rotator Finished...
                            VDE_MSG((_T("[VDE] SVE_Rotator_API_Proc() : SVE_ROTATOR_SET_OPERATION_STOP : SVE_wait_rotator_finish() TimeOut, But Rotator Finished\n\r")));
                        }
                        else
                        {
                            VDE_ERR((_T("[VDE:ERR] SVE_Rotator_API_Proc() : SVE_ROTATOR_SET_OPERATION_STOP : SVE_wait_rotator_finish() TimeOut\n\r")));
                            bRet = FALSE;
                        }
                    }
                }
                else
                {
                    VDE_MSG((_T("[VDE] SVE_Rotator_API_Proc() : SVE_ROTATOR_WAIT_OPERATION_DONE : Image Rotator Already Stopped\n\r")));
                }
            }

            // Backup for PM
            pPMCtxt->bRotatorStart = FALSE;

            break;
        }

        case SVE_ROTATOR_GET_STATUS:
            VDE_ERR((_T("[VDE:ERR] SVE_Rotator_API_Proc() : SVE_ROTATOR_GET_STATUS : Not Implemented Yet...\n\r")));
            bRet = FALSE;
            break;

        default:    // This is filtered above switch statement
            bRet = FALSE;
            break;            
    }

CleanUp:

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

    return bRet;
}
コード例 #17
0
ファイル: TVScalerAPI.c プロジェクト: hibive/sjmt6410pm090728
BOOL SVE_TVScaler_API_Proc(
    DWORD hOpenContext,
    DWORD dwCode,
    PBYTE pBufIn,
    DWORD dwLenIn,
    PBYTE pBufOut,
    DWORD dwLenOut,
    PDWORD pdwActualOut
    )
{
    SVEngineContext *pCtxt;
    SVEnginePowerContext *pPMCtxt;
    BOOL bRet = TRUE;

    //VDE_MSG((_T("[VDE] SVE_TVScaler_API_Proc(0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x)\r\n"),
    //            hOpenContext, dwCode, pBufIn, dwLenIn, pBufOut, dwLenOut, pdwActualOut));
    VDE_MSG((_T("[VDE] ++SVE_TVScaler_API_Proc()\n\r")));

    pCtxt = SVE_get_context();
    pPMCtxt = SVE_get_power_context();

    //-------------------------------------------------------------
    // Check OpenContext of Caller have the right to access to H/W Resource
    //-------------------------------------------------------------
    switch(dwCode)
    {
    case SVE_TVSC_SET_PROCESSING_PARAM:
    case SVE_TVSC_SET_SOURCE_BUFFER:
    case SVE_TVSC_SET_NEXT_SOURCE_BUFFER:
    case SVE_TVSC_SET_DESTINATION_BUFFER:
    case SVE_TVSC_SET_NEXT_DESTINATION_BUFFER:
    case SVE_TVSC_SET_PROCESSING_START:
    case SVE_TVSC_SET_PROCESSING_STOP:
    case SVE_TVSC_WAIT_PROCESSING_DONE:
    case SVE_TVSC_GET_PROCESSING_STATUS:
        bRet = SVE_resource_compare_TVScaler_TVEncoder(hOpenContext);
        if (!bRet)
        {
            VDE_ERR((_T("[VDE:ERR] SVE_TVScaler_API_Proc(0x%08x) : No Right to Access to H/W Resource\r\n"), dwCode));
            goto CleanUp;
        }
        break;
    default:
        bRet = FALSE;
        DEBUGMSG(VDE_ZONE_ERROR, (TEXT("[VDE:ERR] Invalid IOCTL code\n")));        
        goto CleanUp;
        break;
    }

    //--------------------------------
    // Processing IOCTL for TV Scaler
    //--------------------------------

    switch(dwCode)
    {
        case SVE_TVSC_SET_PROCESSING_PARAM:
        {
            SVEARG_TVSC_PARAMETER *pArg;

            VDE_MSG((_T("[VDE] SVE_TVScaler_API_Proc() : SVE_TVSC_SET_PROCESSING_PARAM\n\r")));

            if(!pBufIn)
            {
                DEBUGMSG(VDE_ZONE_ERROR,(TEXT("Invalid Buffer : pBufIn:0x%x\n"), pBufIn));
                bRet = FALSE;
                break;
            }            

            pArg = (SVEARG_TVSC_PARAMETER *)pBufIn;

            if (pPMCtxt->bPowerOn)
            {
                if (TVSC_get_processing_state() == TVSC_BUSY)        // TV Scaler Running
                {
                    VDE_ERR((_T("[VDE:ERR] SVE_TVScaler_API_Proc() : SVE_TVSC_SET_PROCESSING_START : TV Scaler is Running\n\r")));
                    bRet = FALSE;
                    break;
                }

                TVSC_initialize(pArg->dwOpMode, pArg->dwScanMode,
                            pArg->dwSrcType, pArg->dwSrcBaseWidth, pArg->dwSrcBaseHeight, pArg->dwSrcWidth, pArg->dwSrcHeight, pArg->dwSrcOffsetX, pArg->dwSrcOffsetY,
                            pArg->dwDstType, pArg->dwDstBaseWidth, pArg->dwDstBaseHeight, pArg->dwDstWidth, pArg->dwDstHeight, pArg->dwDstOffsetX, pArg->dwDstOffsetY);
            }

            // Backup for PM
            memcpy(&pPMCtxt->tTVSCParam, pArg, sizeof(SVEARG_TVSC_PARAMETER));

            break;
        }

        case SVE_TVSC_SET_SOURCE_BUFFER:
        {
            SVEARG_TVSC_BUFFER *pArg;

            VDE_MSG((_T("[VDE] SVE_TVScaler_API_Proc() : SVE_TVSC_SET_SOURCE_BUFFER\n\r")));

            pArg = (SVEARG_TVSC_BUFFER *)pBufIn;

            if (pPMCtxt->bPowerOn)
            {
                if (TVSC_get_processing_state() == TVSC_BUSY)        // TV Scaler Running
                {
                    VDE_ERR((_T("[VDE:ERR] SVE_TVScaler_API_Proc() : SVE_TVSC_SET_SOURCE_BUFFER : TV Scaler is Running\n\r")));
                    bRet = FALSE;
                    break;
                }

                TVSC_set_source_buffer(pArg->dwBufferRGBY, pArg->dwBufferCb, pArg->dwBufferCr);
            }

            // Backup for PM
            memcpy(&pPMCtxt->tTVSCSrcBuffer, pArg, sizeof(SVEARG_TVSC_BUFFER));
            pPMCtxt->bTVSCSrcBuffer = TRUE;

            break;
        }

        case SVE_TVSC_SET_NEXT_SOURCE_BUFFER:
        {
            SVEARG_TVSC_BUFFER *pArg;

            VDE_MSG((_T("[VDE] SVE_TVScaler_API_Proc() : SVE_TVSC_SET_NEXT_SOURCE_BUFFER\n\r")));

            pArg = (SVEARG_TVSC_BUFFER *)pBufIn;

            if (pPMCtxt->bPowerOn)
            {
                if (TVSC_get_processing_state() == TVSC_BUSY)        // TV Scaler Running
                {
                    BOOL bRetry = TRUE;

                    while(bRetry)
                    {
                        if (pCtxt->TVSCCmdCtxt.bCmdSetSrcBuffer == FALSE)
                        {
                            EnterCriticalSection(&pCtxt->TVSCCmdCtxt.csCmd);                        
                            // We can change buffer address here...
                            // But, after interrupt occurs, It can take effect..
                            TVSC_set_next_source_buffer(pArg->dwBufferRGBY, pArg->dwBufferCb, pArg->dwBufferCr);

                            pCtxt->TVSCCmdCtxt.bCmdSetSrcBuffer = TRUE;
                            bRetry = FALSE;
                            LeaveCriticalSection(&pCtxt->TVSCCmdCtxt.csCmd);                            
                        }

                        if (bRetry || pArg->bWaitForVSync)
                        {
                            if (WAIT_TIMEOUT == SVE_wait_tvsc_cmd_done())
                            {
                                VDE_ERR((_T("[VDE:ERR] SVE_TVScaler_API_Proc() : SVE_TVSC_SET_NEXT_SOURCE_BUFFER : SVE_wait_tvsc_cmd_done() TimeOut\n\r")));
                                bRetry = FALSE;
                                bRet = FALSE;
                            }
                        }
                    }
                }
                else
                {
                    TVSC_set_next_source_buffer(pArg->dwBufferRGBY, pArg->dwBufferCb, pArg->dwBufferCr);
                }
            }

            // Backup for PM
            memcpy(&pPMCtxt->tTVSCSrcBuffer, pArg, sizeof(SVEARG_TVSC_BUFFER));
            pPMCtxt->bTVSCSrcBuffer = TRUE;

            break;
        }

        case SVE_TVSC_SET_DESTINATION_BUFFER:
        {
            SVEARG_TVSC_BUFFER *pArg;

            VDE_MSG((_T("[VDE] SVE_TVScaler_API_Proc() : SVE_TVSC_SET_DESTINATION_BUFFER\n\r")));

            pArg = (SVEARG_TVSC_BUFFER *)pBufIn;

            if (pPMCtxt->bPowerOn)
            {
                if (TVSC_get_processing_state() == TVSC_BUSY)        // TV Scaler Running
                {
                    VDE_ERR((_T("[VDE:ERR] SVE_TVScaler_API_Proc() : SVE_TVSC_SET_DESTINATION_BUFFER : TV Scaler is Running\n\r")));
                    bRet = FALSE;
                    break;
                }

                TVSC_set_destination_buffer(pArg->dwBufferRGBY, pArg->dwBufferCb, pArg->dwBufferCr);
            }

            // Backup for PM
            memcpy(&pPMCtxt->tTVSCDstBuffer, pArg, sizeof(SVEARG_TVSC_BUFFER));
            pPMCtxt->bTVSCDstBuffer = TRUE;

            break;
        }

        case SVE_TVSC_SET_NEXT_DESTINATION_BUFFER:
        {
            SVEARG_TVSC_BUFFER *pArg;

            VDE_MSG((_T("[VDE] SVE_TVScaler_API_Proc() : SVE_TVSC_SET_NEXT_DESTINATION_BUFFER\n\r")));

            pArg = (SVEARG_TVSC_BUFFER *)pBufIn;

            if (pPMCtxt->bPowerOn)
            {
                if (TVSC_get_processing_state() == TVSC_BUSY)        // TV Scaler Running
                {
                    BOOL bRetry = TRUE;

                    while(bRetry)
                    {
                        if (pCtxt->TVSCCmdCtxt.bCmdSetDstBuffer == FALSE)
                        {
                            EnterCriticalSection(&pCtxt->TVSCCmdCtxt.csCmd);
                        
                            // We can change buffer address here...
                            // But, after interrupt occurs, It can take effect..
                            TVSC_set_next_destination_buffer(pArg->dwBufferRGBY, pArg->dwBufferCb, pArg->dwBufferCr);

                            pCtxt->TVSCCmdCtxt.bCmdSetDstBuffer = TRUE;
                            bRetry = FALSE;

                            LeaveCriticalSection(&pCtxt->TVSCCmdCtxt.csCmd);                            
                        }

                        if (bRetry || pArg->bWaitForVSync)
                        {
                            if (WAIT_TIMEOUT == SVE_wait_tvsc_cmd_done())
                            {
                                VDE_ERR((_T("[VDE:ERR] SVE_TVScaler_API_Proc() : SVE_TVSC_SET_NEXT_DESTINATION_BUFFER : SVE_wait_tvsc_cmd_done() TimeOut\n\r")));
                                bRetry = FALSE;
                                bRet = FALSE;
                            }
                        }
                    }
                }
                else
                {
                    TVSC_set_next_destination_buffer(pArg->dwBufferRGBY, pArg->dwBufferCb, pArg->dwBufferCr);
                }
            }

            // Backup for PM
            memcpy(&pPMCtxt->tTVSCDstBuffer, pArg, sizeof(SVEARG_TVSC_BUFFER));
            pPMCtxt->bTVSCDstBuffer = TRUE;

            break;
        }

        case SVE_TVSC_SET_PROCESSING_START:
        {
            VDE_MSG((_T("[VDE] SVE_TVScaler_API_Proc() : SVE_TVSC_SET_PROCESSING_START\n\r")));

            if (pPMCtxt->bPowerOn)
            {
                if (TVSC_get_processing_state() == TVSC_BUSY)        // TV Scaler Running
                {
                    VDE_ERR((_T("[VDE:ERR] SVE_TVScaler_API_Proc() : SVE_TVSC_SET_PROCESSING_START : TV Scaler is Running\n\r")));
                    bRet = FALSE;
                    break;
                }

                TVSC_enable_interrupt();
                TVSC_processing_start();
            }

            // Backup for PM
            pPMCtxt->bTVSCStart = TRUE;

            break;
        }

        case SVE_TVSC_SET_PROCESSING_STOP:
        {
            VDE_MSG((_T("[VDE] SVE_TVScaler_API_Proc() : SVE_TVSC_SET_PROCESSING_STOP\n\r")));

            if (pPMCtxt->bPowerOn)
            {
                TVSC_autoload_disable();

                if (TVSC_get_processing_state() == TVSC_BUSY)    // TV Scaler Running
                {
                    // Wait for Current Frame Finished
                    if (WAIT_TIMEOUT == SVE_wait_tvsc_cmd_done())
                    {
                        if (TVSC_get_processing_state() == TVSC_IDLE)
                        {
                            // Time Out, But TV Scaler Finished
                            VDE_MSG((_T("[VDE] SVE_TVScaler_API_Proc() : SVE_TVSC_SET_PROCESSING_STOP : SVE_wait_tvsc_cmd_done() TimeOut, But TV Scaler Finished\n\r")));
                        }
                        else
                        {
                            VDE_INF((_T("[VDE:INF] SVE_TVScaler_API_Proc() : SVE_TVSC_SET_PROCESSING_STOP : SVE_wait_tvsc_cmd_done() TimeOut\n\r")));
                            TVSC_processing_stop();
                        }
                    }
                }
            }

            // Backup for PM
            pPMCtxt->bTVSCStart = FALSE;

            break;
        }

        case SVE_TVSC_WAIT_PROCESSING_DONE:
        {
            VDE_MSG((_T("[VDE] SVE_TVScaler_API_Proc() : SVE_TVSC_WAIT_PROCESSING_DONE\n\r")));

            if (pPMCtxt->bPowerOn)
            {
                if (TVSC_get_processing_state() == TVSC_BUSY)        // TV Scaler Running
                {
                    if (WAIT_TIMEOUT == SVE_wait_tvsc_cmd_done())
                    {
                        if (TVSC_get_processing_state() == TVSC_IDLE)
                        {
                            // Time Out, But TV Scaler Finished
                            VDE_MSG((_T("[VDE] SVE_TVScaler_API_Proc() : SVE_TVSC_WAIT_PROCESSING_DONE : SVE_wait_tvsc_cmd_done() TimeOut, But TV Scaler Finished\n\r")));
                        }
                        else
                        {
                            VDE_INF((_T("[VDE:INF] SVE_TVScaler_API_Proc() : SVE_TVSC_WAIT_PROCESSING_DONE : SVE_wait_tvsc_cmd_done() TimeOut\n\r")));
                            bRet = FALSE;
                        }
                    }
                }
            }

            // Backup for PM
            pPMCtxt->bTVSCStart = FALSE;

            break;
        }

        case SVE_TVSC_GET_PROCESSING_STATUS:
        {
            DWORD *pArg;

            VDE_MSG((_T("[VDE] SVE_TVScaler_API_Proc() : SVE_TVSC_GET_PROCESSING_STATUS\n\r")));

            pArg = (DWORD *)pBufOut;

            if (pPMCtxt->bPowerOn)
            {
                *pArg = TVSC_get_processing_state();
            }
            else
            {
                *pArg = TVSC_IDLE;
            }

            *pdwActualOut = sizeof(DWORD);

            break;
        }
        default:    // This is filtered above switch statement
            bRet = FALSE;
            break;            
        
    }

CleanUp:

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

    return bRet;
}
コード例 #18
0
ファイル: video_driver.c プロジェクト: blueskycoco/w7
BOOL
VDE_IOControl(
    DWORD hOpenContext,
    DWORD dwCode,
    PBYTE pBufIn,
    DWORD dwLenIn,
    PBYTE pBufOut,
    DWORD dwLenOut,
    PDWORD pdwActualOut
    )
{
    SVEngineContext *pCtxt;
    BOOL bRet = TRUE;
    BYTE LocalBuffer[SVEARG_MAX_SIZE];
    PBYTE pBufInLocal = (PBYTE)&LocalBuffer;

    pCtxt = SVE_get_context();

    DEBUGMSG(VDE_ZONE_ENTER, (_T("[VDE] VDE_IOControl(0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x)\r\n"),
                hOpenContext, dwCode, pBufIn, dwLenIn, pBufOut, dwLenOut, pdwActualOut));

    memset(pBufInLocal, 0, SVEARG_MAX_SIZE);
    if (dwLenIn > SVEARG_MAX_SIZE ||
        !CeSafeCopyMemory(pBufInLocal, pBufIn, dwLenIn))
    {
        RETAILMSG(ZONEMASK_ERROR, (_T("VDE_IOControl: Failed to create a local copy of parameters.\r\n")) );
        return FALSE;        
    }

    EnterCriticalSection(&pCtxt->csProc);

    switch(dwCode)
    {
    case IOCTL_POWER_CAPABILITIES:
    case IOCTL_POWER_GET:
    case IOCTL_POWER_QUERY:
    case IOCTL_POWER_SET:
    case IOCTL_REGISTER_POWER_RELATIONSHIP:
        break;
    case IOCTL_SVE_PM_SET_POWER_ON:
        SVE_video_engine_power_on();
        break;

    case IOCTL_SVE_PM_SET_POWER_OFF:
        //if caller is not kernel mode, do not allow setting power state to off
        if (GetDirectCallerProcessId() != GetCurrentProcessId()){
            return FALSE;
        }
        SVE_video_engine_power_off();
        break;
        
    case IOCTL_SVE_RSC_REQUEST_FIMD_INTERFACE:
    case IOCTL_SVE_RSC_RELEASE_FIMD_INTERFACE:
    case IOCTL_SVE_RSC_REQUEST_FIMD_WIN0:
    case IOCTL_SVE_RSC_RELEASE_FIMD_WIN0:
    case IOCTL_SVE_RSC_REQUEST_FIMD_WIN1:
    case IOCTL_SVE_RSC_RELEASE_FIMD_WIN1:
    case IOCTL_SVE_RSC_REQUEST_FIMD_WIN2:
    case IOCTL_SVE_RSC_RELEASE_FIMD_WIN2:
    case IOCTL_SVE_RSC_REQUEST_FIMD_WIN3:
    case IOCTL_SVE_RSC_RELEASE_FIMD_WIN3:
    case IOCTL_SVE_RSC_REQUEST_FIMD_WIN4:
    case IOCTL_SVE_RSC_RELEASE_FIMD_WIN4:
    case IOCTL_SVE_RSC_REQUEST_POST:
    case IOCTL_SVE_RSC_RELEASE_POST:
    case IOCTL_SVE_RSC_REQUEST_ROTATOR:
    case IOCTL_SVE_RSC_RELEASE_ROTATOR:
    case IOCTL_SVE_RSC_REQUEST_TVSCALER_TVENCODER:
    case IOCTL_SVE_RSC_RELEASE_TVSCALER_TVENCODER:
        __try
        {
            bRet = SVE_Resource_API_Proc(hOpenContext, SVE_get_api_function_code(dwCode), pBufInLocal, dwLenIn, pBufOut, dwLenOut, pdwActualOut);
        }
        __except ( EXCEPTION_EXECUTE_HANDLER )
        {
            RETAILMSG( 1, ( _T("VDE_IOControl: exception in IOCTL_SVE_RSC_REQUEST_FIMD_INTERFACE\n")) );
            LeaveCriticalSection(&pCtxt->csProc);
            return FALSE;
        }
        break;

    case IOCTL_SVE_FIMD_SET_INTERFACE_PARAM:
    case IOCTL_SVE_FIMD_SET_OUTPUT_RGBIF:
    case IOCTL_SVE_FIMD_SET_OUTPUT_TV:
    case IOCTL_SVE_FIMD_SET_OUTPUT_ENABLE:
    case IOCTL_SVE_FIMD_SET_OUTPUT_DISABLE:
    case IOCTL_SVE_FIMD_SET_WINDOW_MODE:
    case IOCTL_SVE_FIMD_SET_WINDOW_POSITION:
    case IOCTL_SVE_FIMD_SET_WINDOW_FRAMEBUFFER:
    case IOCTL_SVE_FIMD_SET_WINDOW_COLORMAP:
    case IOCTL_SVE_FIMD_SET_WINDOW_ENABLE:
    case IOCTL_SVE_FIMD_SET_WINDOW_DISABLE:
    case IOCTL_SVE_FIMD_SET_WINDOW_BLEND_DISABLE:
    case IOCTL_SVE_FIMD_SET_WINDOW_BLEND_COLORKEY:
    case IOCTL_SVE_FIMD_SET_WINDOW_BLEND_ALPHA:
    case IOCTL_SVE_FIMD_WAIT_FRAME_INTERRUPT:
    case IOCTL_SVE_FIMD_GET_OUTPUT_STATUS:
    case IOCTL_SVE_FIMD_GET_WINDOW_STATUS:
        __try
        {
            bRet = SVE_DispCon_API_Proc(hOpenContext, SVE_get_api_function_code(dwCode), pBufInLocal, dwLenIn, pBufOut, dwLenOut, pdwActualOut);
        }
        __except ( EXCEPTION_EXECUTE_HANDLER )
        {
            RETAILMSG( 1, ( _T("VDE_IOControl: exception in IOCTL_SVE_RSC_REQUEST_FIMD_INTERFACE\n")) );
            LeaveCriticalSection(&pCtxt->csProc);
            return FALSE;
        }
        break;

    case IOCTL_SVE_POST_SET_PROCESSING_PARAM:
    case IOCTL_SVE_POST_SET_SOURCE_BUFFER:
    case IOCTL_SVE_POST_SET_NEXT_SOURCE_BUFFER:
    case IOCTL_SVE_POST_SET_DESTINATION_BUFFER:
    case IOCTL_SVE_POST_SET_NEXT_DESTINATION_BUFFER:
    case IOCTL_SVE_POST_SET_PROCESSING_START:
    case IOCTL_SVE_POST_SET_PROCESSING_STOP:
    case IOCTL_SVE_POST_WAIT_PROCESSING_DONE:
    case IOCTL_SVE_POST_GET_PROCESSING_STATUS:
        __try
        {
            bRet = SVE_Post_API_Proc(hOpenContext, SVE_get_api_function_code(dwCode), pBufInLocal, dwLenIn, pBufOut, dwLenOut, pdwActualOut);
        }
        __except ( EXCEPTION_EXECUTE_HANDLER )
        {
            RETAILMSG( 1, ( _T("VDE_IOControl: exception in IOCTL_SVE_RSC_REQUEST_FIMD_INTERFACE\n")) );
            LeaveCriticalSection(&pCtxt->csProc);
            return FALSE;
        }
        break;


    case IOCTL_SVE_LOCALPATH_SET_WIN0_START:
    case IOCTL_SVE_LOCALPATH_SET_WIN0_STOP:
    case IOCTL_SVE_LOCALPATH_SET_WIN1_START:
    case IOCTL_SVE_LOCALPATH_SET_WIN1_STOP:
    case IOCTL_SVE_LOCALPATH_SET_WIN2_START:
    case IOCTL_SVE_LOCALPATH_SET_WIN2_STOP:
        __try
        {
            bRet = SVE_LocalPath_API_Proc(hOpenContext, SVE_get_api_function_code(dwCode), pBufInLocal, dwLenIn, pBufOut, dwLenOut, pdwActualOut);
        }
        __except ( EXCEPTION_EXECUTE_HANDLER )
        {
            RETAILMSG( 1, ( _T("VDE_IOControl: exception in IOCTL_SVE_RSC_REQUEST_FIMD_INTERFACE\n")) );
            LeaveCriticalSection(&pCtxt->csProc);
            return FALSE;
        }
        break;

    case IOCTL_SVE_ROTATOR_SET_OPERATION_PARAM:
    case IOCTL_SVE_ROTATOR_SET_SOURCE_BUFFER:
    case IOCTL_SVE_ROTATOR_SET_DESTINATION_BUFFER:
    case IOCTL_SVE_ROTATOR_SET_OPERATION_START:
    case IOCTL_SVE_ROTATOR_SET_OPERATION_STOP:
    case IOCTL_SVE_ROTATOR_WAIT_OPERATION_DONE:
    case IOCTL_SVE_ROTATOR_GET_STATUS:
        __try
        {
            bRet = SVE_Rotator_API_Proc(hOpenContext, SVE_get_api_function_code(dwCode), pBufInLocal, dwLenIn, pBufOut, dwLenOut, pdwActualOut);
        }
        __except ( EXCEPTION_EXECUTE_HANDLER )
        {
            RETAILMSG( 1, ( _T("VDE_IOControl: exception in IOCTL_SVE_RSC_REQUEST_FIMD_INTERFACE\n")) );
            LeaveCriticalSection(&pCtxt->csProc);
            return FALSE;
        }
        break;

    case IOCTL_SVE_TVSC_SET_PROCESSING_PARAM:
    case IOCTL_SVE_TVSC_SET_SOURCE_BUFFER:
    case IOCTL_SVE_TVSC_SET_NEXT_SOURCE_BUFFER:
    case IOCTL_SVE_TVSC_SET_DESTINATION_BUFFER:
    case IOCTL_SVE_TVSC_SET_NEXT_DESTINATION_BUFFER:
    case IOCTL_SVE_TVSC_SET_PROCESSING_START:
    case IOCTL_SVE_TVSC_SET_PROCESSING_STOP:
    case IOCTL_SVE_TVSC_WAIT_PROCESSING_DONE:
    case IOCTL_SVE_TVSC_GET_PROCESSING_STATUS:
        __try
        {
            bRet = SVE_TVScaler_API_Proc(hOpenContext, SVE_get_api_function_code(dwCode), pBufInLocal, dwLenIn, pBufOut, dwLenOut, pdwActualOut);
        }
        __except ( EXCEPTION_EXECUTE_HANDLER )
        {
            RETAILMSG( 1, ( _T("VDE_IOControl: exception in IOCTL_SVE_RSC_REQUEST_FIMD_INTERFACE\n")) );
            LeaveCriticalSection(&pCtxt->csProc);
            return FALSE;
        }
        break;

    case IOCTL_SVE_TVENC_SET_INTERFACE_PARAM:
    case IOCTL_SVE_TVENC_SET_ENCODER_ON:
    case IOCTL_SVE_TVENC_SET_ENCODER_OFF:
    case IOCTL_SVE_TVENC_GET_INTERFACE_STATUS:
        __try
        {
            bRet = SVE_TVEncoder_API_Proc(hOpenContext, SVE_get_api_function_code(dwCode), pBufInLocal, dwLenIn, pBufOut, dwLenOut, pdwActualOut);
        }
        __except ( EXCEPTION_EXECUTE_HANDLER )
        {
            RETAILMSG( 1, ( _T("VDE_IOControl: exception in IOCTL_SVE_RSC_REQUEST_FIMD_INTERFACE\n")) );
            LeaveCriticalSection(&pCtxt->csProc);
            return FALSE;
        }
        break;
    case IOCTL_SVE_FIMD_VSYNC_ENABLE:

        __try
        {
            Disp_VSync_Enable();
            bRet=TRUE;
        }
        __except ( EXCEPTION_EXECUTE_HANDLER )
        {
            RETAILMSG( 1, ( _T("VDE_IOControl: exception in IOCTL_SVE_FIMD_VSYNC_ENABLE\n")) );
            LeaveCriticalSection(&pCtxt->csProc);
            return FALSE;
        }
        break;


    case IOCTL_SVE_FIMD_GET_FLIPSTATUS:

        __try
        {
            if(Disp_GetFlipStatus())
            {
                bRet=TRUE;
            }
            else
            {
                bRet=FALSE;
            }
        }
        __except ( EXCEPTION_EXECUTE_HANDLER )
        {
            RETAILMSG( 1, ( _T("VDE_IOControl: exception in IOCTL_SVE_FIMD_GET_FLIPSTATUS\n")) );
            LeaveCriticalSection(&pCtxt->csProc);
            return FALSE;
        }
        break;


    case IOCTL_SVE_PM_GET_POWER_STATUS:

    default:
        VDE_ERR((_T("[VDE:ERR] VDE_IOControl() : Unknown IOCTL [0x%08x]\r\n"), dwCode));
        SetLastError (ERROR_INVALID_ACCESS);
        bRet = FALSE;
        break;
    }

    LeaveCriticalSection(&pCtxt->csProc);

    DEBUGMSG(VDE_ZONE_ENTER, (_T("[VDE] --VDE_IOControl()\r\n")));

    return bRet;
}
コード例 #19
0
ファイル: ResourceAPI.c プロジェクト: hibive/sjmt6410pm090728
BOOL SVE_Resource_API_Proc(
    DWORD hOpenContext,
    DWORD dwCode,
    PBYTE pBufIn,
    DWORD dwLenIn,
    PBYTE pBufOut,
    DWORD dwLenOut,
    PDWORD pdwActualOut
    )
{
    BOOL bRet = TRUE;

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

    switch(dwCode)
    {
    case SVE_RSC_REQUEST_FIMD_INTERFACE:
        bRet = SVE_resource_request_FIMD_interface(hOpenContext);
        break;
    case SVE_RSC_RELEASE_FIMD_INTERFACE:
        bRet = SVE_resource_release_FIMD_interface(hOpenContext);
        break;
    case SVE_RSC_REQUEST_FIMD_WIN0:
        bRet = SVE_resource_request_FIMD_window(DISP_WIN0, hOpenContext);
        break;
    case SVE_RSC_RELEASE_FIMD_WIN0:
        bRet = SVE_resource_release_FIMD_window(DISP_WIN0, hOpenContext);
        break;
    case SVE_RSC_REQUEST_FIMD_WIN1:
        bRet = SVE_resource_request_FIMD_window(DISP_WIN1, hOpenContext);
        break;
    case SVE_RSC_RELEASE_FIMD_WIN1:
        bRet = SVE_resource_release_FIMD_window(DISP_WIN1, hOpenContext);
        break;
    case SVE_RSC_REQUEST_FIMD_WIN2:
        bRet = SVE_resource_request_FIMD_window(DISP_WIN2, hOpenContext);
        break;
    case SVE_RSC_RELEASE_FIMD_WIN2:
        bRet = SVE_resource_release_FIMD_window(DISP_WIN2, hOpenContext);
        break;
    case SVE_RSC_REQUEST_FIMD_WIN3:
        bRet = SVE_resource_request_FIMD_window(DISP_WIN3, hOpenContext);
        break;
    case SVE_RSC_RELEASE_FIMD_WIN3:
        bRet = SVE_resource_release_FIMD_window(DISP_WIN3, hOpenContext);
        break;
    case SVE_RSC_REQUEST_FIMD_WIN4:
        bRet = SVE_resource_request_FIMD_window(DISP_WIN4, hOpenContext);
        break;
    case SVE_RSC_RELEASE_FIMD_WIN4:
        bRet = SVE_resource_release_FIMD_window(DISP_WIN4, hOpenContext);
        break;
    case SVE_RSC_REQUEST_POST:
        bRet = SVE_resource_request_Post(hOpenContext);
        break;
    case SVE_RSC_RELEASE_POST:
        bRet = SVE_resource_release_Post(hOpenContext);
        break;
    case SVE_RSC_REQUEST_ROTATOR:
        bRet = SVE_resource_request_Rotator(hOpenContext);
        break;
    case SVE_RSC_RELEASE_ROTATOR:
        bRet = SVE_resource_release_Rotator(hOpenContext);
        break;
    case SVE_RSC_REQUEST_TVSCALER_TVENCODER:
        bRet = SVE_resource_request_TVScaler_TVEncoder(hOpenContext);
        break;
    case SVE_RSC_RELEASE_TVSCALER_TVENCODER:
        bRet = SVE_resource_release_TVScaler_TVEncoder(hOpenContext);
        break;
    }

    if (bRet == FALSE)
    {
        VDE_ERR((_T("[VDE:ERR] SVE_Resource_API_Proc() : dwCode[0x%08x] Failed\n\r")));
    }

    return bRet;
}
コード例 #20
0
ファイル: SVEngine.c プロジェクト: hibive/sjmt6410pm090728
BOOL SVE_map_device_address(void)
{
    SVEngineContext *pCtxt;
    PHYSICAL_ADDRESS    ioPhysicalBase = { 0,0};

    VDE_MSG((_T("[VDE] ++%s\r\n"),__func__));

    pCtxt = SVE_get_context();

    // Translate to System Address.
    ioPhysicalBase.LowPart = S3C6410_BASE_REG_PA_DISPLAY;
    pCtxt->pDispConReg = (S3C6410_DISPLAY_REG *)MmMapIoSpace(ioPhysicalBase, sizeof(S3C6410_DISPLAY_REG), FALSE);
    if (pCtxt->pDispConReg == NULL)
    {
        goto CleanUp;  
    }

    ioPhysicalBase.LowPart = S3C6410_BASE_REG_PA_POST;
    pCtxt->pPostReg = (S3C6410_POST_REG *)MmMapIoSpace(ioPhysicalBase, sizeof(S3C6410_POST_REG), FALSE);
    if (pCtxt->pPostReg == NULL)
    {
        goto CleanUp;
    }

    ioPhysicalBase.LowPart = S3C6410_BASE_REG_PA_ROTATOR;
    pCtxt->pRotatorReg = (S3C6410_ROTATOR_REG *)MmMapIoSpace(ioPhysicalBase, sizeof(S3C6410_ROTATOR_REG), FALSE);
    if (pCtxt->pRotatorReg == NULL)
    {
        goto CleanUp;
    }

    ioPhysicalBase.LowPart = S3C6410_BASE_REG_PA_TVSC;
    pCtxt->pTVSCReg = (S3C6410_TVSC_REG *)MmMapIoSpace(ioPhysicalBase, sizeof(S3C6410_TVSC_REG), FALSE);
    if (pCtxt->pTVSCReg == NULL)
    {
        goto CleanUp;
    }

    ioPhysicalBase.LowPart = S3C6410_BASE_REG_PA_TVENC;
    pCtxt->pTVEncReg = (S3C6410_TVENC_REG *)MmMapIoSpace(ioPhysicalBase, sizeof(S3C6410_TVENC_REG), FALSE);
    if (pCtxt->pTVEncReg == NULL)
    {
        goto CleanUp;
    }

    ioPhysicalBase.LowPart = S3C6410_BASE_REG_PA_MSMIF_SFR;
    pCtxt->pMSMIFReg = (S3C6410_MSMIF_REG *)MmMapIoSpace(ioPhysicalBase, sizeof(S3C6410_MSMIF_REG), FALSE);
    if (pCtxt->pMSMIFReg == NULL)
    {
        goto CleanUp;
    }

    ioPhysicalBase.LowPart = S3C6410_BASE_REG_PA_SYSCON;
    pCtxt->pSysConReg = (S3C6410_SYSCON_REG *)MmMapIoSpace(ioPhysicalBase, sizeof(S3C6410_SYSCON_REG), FALSE);
    if (pCtxt->pSysConReg == NULL)
    {
        goto CleanUp;
    }

    ioPhysicalBase.LowPart = S3C6410_BASE_REG_PA_GPIO;
    pCtxt->pGPIOReg = (S3C6410_GPIO_REG *)MmMapIoSpace(ioPhysicalBase, sizeof(S3C6410_GPIO_REG), FALSE);
    if (pCtxt->pGPIOReg == NULL)
    {
        goto CleanUp;
    }

    ioPhysicalBase.LowPart = S3C6410_BASE_REG_PA_SPI0;
    pCtxt->pSPIReg = (S3C6410_SPI_REG *)MmMapIoSpace(ioPhysicalBase, sizeof(S3C6410_SPI_REG), FALSE);
    if (pCtxt->pSPIReg == NULL)
    {
        goto CleanUp;
    }

    VDE_MSG((_T("[VDE] --%s\r\n"),__func__));

    return TRUE;

CleanUp:

    VDE_ERR((_T("[VDE:ERR] --%s : Failed, ioPhysicalBase(0x%x,0x%x)\r\n"), _T(__FUNCTION__), ioPhysicalBase.LowPart, ioPhysicalBase.HighPart));

    return FALSE;
}
コード例 #21
0
ファイル: SVEngine.c プロジェクト: hibive/sjmt6410pm090728
BOOL SVE_initialize_video_engine(void)
{
    SVEngineContext *pCtxt;

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

    pCtxt = SVE_get_context();

    // Clear Context
    SVE_initialize_context();
    SVE_initialize_power_context();

    // map device SFR address
    if (SVE_map_device_address() == FALSE)
    {
        VDE_ERR((_T("[VDE:ERR] SVE_initialize_video_engine() : SVE_map_device_address() Failed\r\n")));
        goto CleanUp;
    }

    // Intialize interrupt
    if (SVE_initialize_interrupt() == FALSE)
    {
        VDE_ERR((_T("[VDE:ERR] SVE_initialize_video_engine() : SVE_intialize_interrupt() Failed\r\n")));
        goto CleanUp;
    }

    // Create Interrupt Thread
    if (SVE_initialize_thread() == FALSE)
    {
        VDE_ERR((_T("[VDE:ERR] SVE_initialize_video_engine() : SVE_initialize_thread() Failed\r\n")));
        goto CleanUp;
    }

    // Open Power Control Driver
    if (SVE_initialize_power_control() == FALSE)
    {
        VDE_ERR((_T("[VDE:ERR] SVE_initialize_video_engine() : SVE_initialize_power_control() Failed\r\n")));
        goto CleanUp;
    }

    // Initialize SFR Address of Sub Module
    LDI_initialize_register_address((void *)pCtxt->pSPIReg, (void *)pCtxt->pDispConReg, (void *)pCtxt->pGPIOReg);
    Disp_initialize_register_address((void *)pCtxt->pDispConReg, (void *)pCtxt->pMSMIFReg, (void *)pCtxt->pGPIOReg);
    Post_initialize_register_address((void *)pCtxt->pPostReg);
    Rotator_initialize_register_address((void *)pCtxt->pRotatorReg);
    TVSC_initialize_register_address((void *)pCtxt->pTVSCReg);
    TVEnc_initialize_register_address((void *)pCtxt->pTVEncReg, (void *)pCtxt->pGPIOReg);

    SVE_hw_power_control(HWPWR_DISPLAY_ON);
    SVE_hw_power_control(HWPWR_2D_ON);

    SVE_hw_clock_control(HWCLK_DISPLAY_ON);
    SVE_hw_clock_control(HWCLK_2D_ON);

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

    return TRUE;

CleanUp:

    SVE_deinitialize_video_engine();

    VDE_ERR((_T("[VDE:ERR] --SVE_initialize_video_engine() : Failed\r\n")));


    return FALSE;
}