vout.c
上传用户:fy98168
上传日期:2015-06-26
资源大小:13771k
文件大小:5k
- /*****************************************************************************
- File name : vout.c
- Description: VOUT functions
- COPYRIGHT (C) STMicroelectronics 2004.
- *****************************************************************************/
- /* Includes --------------------------------------------------------------- */
- #include <string.h>
- #include "stddefs.h"
- #include "stlite.h"
- #include "stdevice.h"
- #include "sttbx.h"
- #include "section.h" /* memory partitions */
- #include "denc.h"
- #include "vout.h"
- #include "errors.h"
- /* Private Types ---------------------------------------------------------- */
- /* Private Constants ------------------------------------------------------ */
- /* Private Variables ------------------------------------------------------ */
- /* Private Macros --------------------------------------------------------- */
- /* Private Function prototypes -------------------------------------------- */
- /* Global Variables ------------------------------------------------------- */
- STVOUT_Handle_t g_KB_VoutHandle[KB_VOUT_MAX_DEVICES] = 0;
- ST_DeviceName_t g_KB_VoutDeviceName[KB_VOUT_MAX_DEVICES] = { "VOUT_CVBS", "VOUT_RGB" };
- STVOUT_OutputType_t VOUT_OutputType[KB_VOUT_MAX_DEVICES] = { STVOUT_OUTPUT_ANALOG_CVBS, STVOUT_OUTPUT_ANALOG_RGB };
- /* Functions -------------------------------------------------------------- */
- /*-------------------------------------------------------------------------
- * Function : KB_VoutSetup
- * Input : None
- * Output :
- * Return : Error Code
- * ----------------------------------------------------------------------*/
- ST_ErrorCode_t KB_VoutSetup(void)
- {
- ST_ErrorCode_t ST_ErrorCode;
- STVOUT_InitParams_t VOUTInitParams;
- STVOUT_OpenParams_t VOUTOpenParams;
- U8 Index,
- NoOfDevices;
- if( KB_VOUT_OUTPUT_TYPE == STVOUT_OUTPUT_ANALOG_CVBS )
- {
- NoOfDevices = 1;
- strcpy (g_KB_VoutDeviceName[1], "" );
- }
- else
- {
- NoOfDevices = 2;
- }
- VOUTInitParams.CPUPartition_p = SystemPartition;
- VOUTInitParams.MaxOpen = 3;
- VOUTInitParams.DeviceType = KB_VOUT_DEVICE_TYPE;
- memset((char*)&VOUTOpenParams, 0, sizeof(STVOUT_OpenParams_t));
- for( Index = 0; Index < NoOfDevices; Index++ )
- {
- VOUTInitParams.OutputType = VOUT_OutputType[Index];
- switch ( VOUTInitParams.DeviceType )
- {
- case STVOUT_DEVICE_TYPE_DENC:
- strcpy( VOUTInitParams.Target.DencName, g_KB_DENCDeviceName);
- break;
- case STVOUT_DEVICE_TYPE_V13:
- VOUTInitParams.Target.DualTriDacCell.BaseAddress_p = (void*)VOUT_BASE_ADDRESS;
- VOUTInitParams.Target.DualTriDacCell.DeviceBaseAddress_p = (void*)KB_VOUT_DEVICE_BASE_ADDRESS;
- strcpy( VOUTInitParams.Target.DualTriDacCell.DencName, g_KB_DENCDeviceName);
- switch (VOUTInitParams.OutputType)
- {
- case STVOUT_OUTPUT_ANALOG_RGB :
- case STVOUT_OUTPUT_ANALOG_YUV :
- VOUTInitParams.Target.DualTriDacCell.DacSelect = STVOUT_DAC_1 | STVOUT_DAC_2 | STVOUT_DAC_3;
- break;
- case STVOUT_OUTPUT_ANALOG_YC :
- VOUTInitParams.Target.DualTriDacCell.DacSelect = STVOUT_DAC_1 | STVOUT_DAC_2;
- break;
- default:
- case STVOUT_OUTPUT_ANALOG_CVBS :
- VOUTInitParams.Target.DualTriDacCell.DacSelect = STVOUT_DAC_4;
- break;
- }
- break;
- default :
- break;
- }
- STTBX_Print(("KB_VoutSetup(%s)=", g_KB_VoutDeviceName[Index] ));
- ST_ErrorCode = STVOUT_Init(g_KB_VoutDeviceName[Index], &VOUTInitParams);
- if (ST_ErrorCode != ST_NO_ERROR)
- {
- STTBX_Print(("%sn", KB_ErrorGetText(ST_ErrorCode) ));
- return( ST_ErrorCode );
- }
- STTBX_Print(("%sn", STVOUT_GetRevision() ));
- ST_ErrorCode = STVOUT_Open(g_KB_VoutDeviceName[Index], &VOUTOpenParams, &g_KB_VoutHandle[Index]);
- STTBX_Print(("VOUT_Open=%sn", KB_ErrorGetText(ST_ErrorCode) ));
- if (ST_ErrorCode != ST_NO_ERROR) return(ST_ErrorCode);
- ST_ErrorCode = STVOUT_Enable(g_KB_VoutHandle[Index]);
- if (ST_ErrorCode != ST_NO_ERROR) return(ST_ErrorCode);
- }
- return( ST_ErrorCode );
- }
- /* EOF --------------------------------------------------------------------- */