vout.c
上传用户:fy98168
上传日期:2015-06-26
资源大小:13771k
文件大小:5k
源码类别:

DVD

开发平台:

C/C++

  1. /*****************************************************************************
  2. File name  : vout.c
  3. Description: VOUT functions
  4. COPYRIGHT (C) STMicroelectronics 2004.
  5. *****************************************************************************/
  6. /* Includes --------------------------------------------------------------- */
  7. #include <string.h>
  8. #include "stddefs.h"
  9. #include "stlite.h"
  10. #include "stdevice.h"
  11. #include "sttbx.h"
  12. #include "section.h"   /* memory partitions */
  13. #include "denc.h"
  14. #include "vout.h"
  15. #include "errors.h"
  16. /* Private Types ---------------------------------------------------------- */
  17. /* Private Constants ------------------------------------------------------ */
  18. /* Private Variables ------------------------------------------------------ */
  19. /* Private Macros --------------------------------------------------------- */
  20. /* Private Function prototypes -------------------------------------------- */
  21. /* Global Variables ------------------------------------------------------- */
  22. STVOUT_Handle_t     g_KB_VoutHandle[KB_VOUT_MAX_DEVICES]     = 0;
  23. ST_DeviceName_t     g_KB_VoutDeviceName[KB_VOUT_MAX_DEVICES] = { "VOUT_CVBS", "VOUT_RGB" };
  24. STVOUT_OutputType_t VOUT_OutputType[KB_VOUT_MAX_DEVICES] = { STVOUT_OUTPUT_ANALOG_CVBS, STVOUT_OUTPUT_ANALOG_RGB };
  25. /* Functions -------------------------------------------------------------- */
  26. /*-------------------------------------------------------------------------
  27.  * Function : KB_VoutSetup
  28.  * Input    : None
  29.  * Output   :
  30.  * Return   : Error Code
  31.  * ----------------------------------------------------------------------*/
  32. ST_ErrorCode_t KB_VoutSetup(void)
  33. {
  34.     ST_ErrorCode_t          ST_ErrorCode;
  35.     STVOUT_InitParams_t     VOUTInitParams;
  36.     STVOUT_OpenParams_t     VOUTOpenParams;
  37.     U8                      Index,
  38.                             NoOfDevices;
  39.     if( KB_VOUT_OUTPUT_TYPE == STVOUT_OUTPUT_ANALOG_CVBS )
  40.     {
  41.         NoOfDevices = 1;
  42.         strcpy (g_KB_VoutDeviceName[1], "" );
  43.     }
  44.     else
  45.     {
  46.         NoOfDevices = 2;
  47.     }
  48.     VOUTInitParams.CPUPartition_p  = SystemPartition;
  49.     VOUTInitParams.MaxOpen         = 3;
  50.     VOUTInitParams.DeviceType      = KB_VOUT_DEVICE_TYPE;
  51.     memset((char*)&VOUTOpenParams, 0, sizeof(STVOUT_OpenParams_t));
  52.     for( Index = 0; Index < NoOfDevices; Index++ )
  53.     {
  54.         VOUTInitParams.OutputType      = VOUT_OutputType[Index];
  55.         switch ( VOUTInitParams.DeviceType )
  56.         {
  57.             case STVOUT_DEVICE_TYPE_DENC:
  58.                 strcpy( VOUTInitParams.Target.DencName, g_KB_DENCDeviceName);
  59.                 break;
  60.             case STVOUT_DEVICE_TYPE_V13:
  61.                 VOUTInitParams.Target.DualTriDacCell.BaseAddress_p = (void*)VOUT_BASE_ADDRESS;
  62.                 VOUTInitParams.Target.DualTriDacCell.DeviceBaseAddress_p = (void*)KB_VOUT_DEVICE_BASE_ADDRESS;
  63.                 strcpy( VOUTInitParams.Target.DualTriDacCell.DencName, g_KB_DENCDeviceName);
  64.                 switch (VOUTInitParams.OutputType)
  65.                 {
  66.                     case STVOUT_OUTPUT_ANALOG_RGB :
  67.                     case STVOUT_OUTPUT_ANALOG_YUV :
  68.                         VOUTInitParams.Target.DualTriDacCell.DacSelect = STVOUT_DAC_1 | STVOUT_DAC_2 | STVOUT_DAC_3;
  69.                         break;
  70.                     case STVOUT_OUTPUT_ANALOG_YC :
  71.                         VOUTInitParams.Target.DualTriDacCell.DacSelect = STVOUT_DAC_1 | STVOUT_DAC_2;
  72.                         break;
  73.                     default:
  74.                     case STVOUT_OUTPUT_ANALOG_CVBS :
  75.                         VOUTInitParams.Target.DualTriDacCell.DacSelect = STVOUT_DAC_4;
  76.                         break;
  77.                 }
  78.                 break;
  79.             default :
  80.                 break;
  81.         }
  82.         STTBX_Print(("KB_VoutSetup(%s)=", g_KB_VoutDeviceName[Index] ));
  83.         ST_ErrorCode = STVOUT_Init(g_KB_VoutDeviceName[Index], &VOUTInitParams);
  84.         if (ST_ErrorCode != ST_NO_ERROR)
  85.         {
  86.             STTBX_Print(("%sn", KB_ErrorGetText(ST_ErrorCode) ));
  87.             return( ST_ErrorCode );
  88.         }
  89.         STTBX_Print(("%sn", STVOUT_GetRevision() ));
  90.         ST_ErrorCode = STVOUT_Open(g_KB_VoutDeviceName[Index], &VOUTOpenParams, &g_KB_VoutHandle[Index]);
  91.         STTBX_Print(("VOUT_Open=%sn", KB_ErrorGetText(ST_ErrorCode) ));
  92.         if (ST_ErrorCode != ST_NO_ERROR) return(ST_ErrorCode);
  93.         ST_ErrorCode = STVOUT_Enable(g_KB_VoutHandle[Index]);
  94.         if (ST_ErrorCode != ST_NO_ERROR) return(ST_ErrorCode);
  95.     }
  96.     return( ST_ErrorCode );
  97. }
  98. /* EOF --------------------------------------------------------------------- */