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

📄 drvtvencoder.h

📁 mstar 776 开发的车载dvd
💻 H
字号:
////////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2006-2007 MStar Semiconductor, Inc.
// All rights reserved.
//
// Unless otherwise stipulated in writing, any and all information contained
// herein regardless in any format shall remain the sole proprietary of
// MStar Semiconductor Inc. and be kept in strict confidence
// (!!∮MStar Confidential Information!!L) by the recipient.
// Any unauthorized act including without limitation unauthorized disclosure,
// copying, use, reproduction, sale, distribution, modification, disassembling,
// reverse engineering and compiling of the contents of MStar Confidential
// Information is unlawful and strictly prohibited. MStar hereby reserves the
// rights to any and all damages, losses, costs and expenses resulting therefrom.
//
// Description:
//
////////////////////////////////////////////////////////////////////////////////

#ifndef _DRVTVENCODER_H
#define _DRVTVENCODER_H


#include "drvAnalog_DataType.h"

#define _END_OF_TBL_ -1
#define _REG_BASE_TBL -2

#define REG_BASE_VE_SOURCE      (0x3B00)
#define REG_BASE_VE_ENCODER     (0x3E00) //(0x7E00) //change base in S2

 // For table use
#define BK_REG_MASK      0xFFFF0000
#define BK_LOW_BIT       0x0001
#define BK_HIGH_BIT      0x0002
#define BK_LH_MASK       0xFFFC

#define BK_L(x)         (((x)<<2)|BK_LOW_BIT)
#define BK_H(x)         (((x)<<2)|BK_HIGH_BIT)
#define BK_ALL(x)       ((x)<<1) //((x)<<2)

#define _L_BK_VE_SRC(x)  BK_L(x)
#define _H_BK_VE_SRC(x)  BK_H(x)
#define _BK_VE_SRC(x)    BK_ALL(x)

#define _L_BK_VE_ENC(x)  BK_L(x)
#define _H_BK_VE_ENC(x)  BK_H(x)
#define _BK_VE_ENC(x)    BK_ALL(x)

#define BK_VE_SRC(x)     (REG_BASE_VE_SOURCE+(x<<1)) //(((REG_BASE_VE_SOURCE+x)<<2))
#define BK_VE_ENC(x)    (REG_BASE_VE_ENCODER+(x<<1))//(((REG_BASE_VE_ENCODER+x)<<2))

 //VE out
#define VE_OUT_CVBS_YCC         0x00
#define VE_OUT_CVBS_YCbCr       0x01
#define VE_OUT_CVBS_RGB         0x10
#define VE_OUT_NONE             0xFF

/// definition for _ENABLE
#define _ENABLE      1
/// definition for _DISABLE
#define _DISABLE     0


typedef struct
{
    S16 s16Idx;
    U16 u16Val;
}code RegUnitType, *pRegUnitType;


/// status of switchinging output destination
typedef enum
{
    MS_VE_SWITCH_DST_SUCCESS,               ///< success
    MS_VE_SWITCH_DST_INVALID_COMBINATION,   ///< invalid combination
    MS_VE_SWITCH_DST_INVALID_PARAM,         ///< invalid parameter
    MS_VE_SWITCH_DST_FAIL,                  ///< fail
}MS_SWITCH_VE_DST_STATUS;

/// the information of switching ouput destination for TV encoder
typedef struct
{
    U8 u8DestIdx;   ///< the indication of destination device
    MS_VE_OUTPUT_DEST_TYPE OutputDstType; ///< type of output destination
    MS_SWITCH_VE_DST_STATUS Status;     ///< the returning status of switching output destination
}MS_SWITCH_VE_DEST_INFO, *PMS_SWITCH_VE_DEST_INFO;


/// status of switchinging input source
typedef enum
{
    MS_VE_SWITCH_SRC_SUCCESS,           ///< success
    MS_VE_SWITCH_SRC_INVALID_PARAM,     ///< invalid parameter
    MS_VE_SWITCH_SRC_FAIL,              ///< fail
}MS_SWITCH_VE_SRC_STATUS;

/// the information of switching output destination for TV encoder
typedef struct
{
    MS_VE_INPUT_SRC_TYPE InputSrcType; ///< type of input source
    MS_VOP_TIMING *ptiming; // VOP timing
    MS_SWITCH_VE_SRC_STATUS Status; ///< the returning status of switching input source
}MS_SWITCH_VE_SRC_INFO, *PMS_SWITCH_VE_SRC_INFO;

/// fix color information
typedef struct
{
    Bool bEnable;           ///< TURE/FALSE, enable/disable fix color our
    U8   u8Color_Y;         ///< color, Y channel
    U8   u8Color_Cb;        ///< color, Cb channel
    U8   u8Color_Cr;        ///< color, Cr channel
}MS_VE_FIX_COLOR_INFO, *PMS_VE_FIX_COLOR_INFO;

/// VE output Type
typedef enum
{
    MS_VE_OUT_CCIR656,  ///< output signal is CCIR656
    MS_VE_OUT_TVENCODER,///< output signal from TVEncoder
}MS_VE_OUT_TYPE;

/// output control for VE
typedef struct
{
    Bool bEnable; ///< TRUE/FALSE, enable/disable VE
    MS_VE_OUT_TYPE OutputType; ///< VE output type
}MS_VE_OUTPUT_CTRL, *PMS_VE_OUTPUT_CTRL;



 typedef struct
{
    //pRegUnitType    pVE_TBL;
    MS_REG_TYPE*     pVE_TBL;
    MS_REG_TYPE*     pVE_Coef_TBL;
    MS_REG_TYPE*     pVBI_TBL;
    Bool            bvtotal_525;
    Bool            bPALSwitch;
    Bool            bPALout;
}MS_VE_OUT_VIDEOSYS, *PMS_VE_OUT_VIDEOSYS;

typedef struct
{
    Bool bValid;
    U8   u8DACType;
}MS_VE_OUT_DEST, *PMS_VE_OUT_DEST;



/// define the size of capture and display window
typedef struct
{
    U16 u16H_CapStart;  ///< horizotnal starting position of capture window
    U16 u16H_CapSize;   ///< horizotnal size of capture window
    U16 u16V_CapStart;  ///< vertical starting position of capture window
    U16 u16V_CapSize;   ///< vertical size of capture window
    U16 u16H_DisStart;  ///< horizotnal starting position of display window
    U16 u16H_DisSize;   ///< horizotnal size of display window
    U16 u16V_DisStart;  ///< vertical starting position of display window
    U16 u16V_DisSize;   ///< vertical size of display window
}MS_CAPTUREDISPLAYWINDOW_TYPE, *PMS_CAPTUREDISPLAYWINDOW_TYPE;

typedef enum
{
    PIN8_FORMAT_OFF,    ///<  no signal or internal bypass
    PIN8_FORMAT_16_9,   ///<  widescreen(16:9) signal
    PIN8_FORMAT_4_3     ///<  normal(4:3) signal
} ScartFormatEnumType;


// Mode information
typedef struct
{
    U8  u8ModeIndex;        // mode index
    U16 u16HorizontalStart; // horizontal start
    U16 u16VerticalStart;   // vertical start
    U16 u16HorizontalTotal; // ADC horizontal total
    U8  u8Phase;            // ADC phase
    U16 u16DefaultHStart;   // default horizontal start
    U8  u8AutoSign;         // AutoConfig count
    U16 u16HorizontalSize;  // horizontal size
    U16 u16VerticalSize;    // vertical size
}MS_MODE_SETTING_TYPE, *PMS_MODE_SETTING_TYPE;

typedef enum
{
    MS_IP_SEL_DC0,
    MS_IP_SEL_DC1,
}MS_IPSEL_DC;


/// the user ADC setting
typedef struct
{
    U8 u8RedOffset;    ///< ADC red offset
    U8 u8GreenOffset;  ///< ADC green offset
    U8 u8BlueOffset;   ///< ADC blue offset
    U8 u8RedGain;      ///< ADC red gain
    U8 u8GreenGain;    ///< ADC green gain
    U8 u8BlueGain;     ///< ADC blue gain
}MS_ADC_SETTING_TYPE, *PMS_ADC_SETTING_TYPE;

typedef struct
{
    U16 BKDNR[6];
    U16 BKOPM[6];
    U16 DNR_81;  // MADI mode
    U32 IP2_04;  // Pre H scaling ratio
    U32 IP2_08;  // Pre V scaling ratio
    U32 OP1_08;  // post V scaling ratio
    U32 OP1_06;  // post H scaling ratio
    U16 OP1_0D;  // pre scaling fomula
    U16 OP1_2A;  // vertical length after pre-scaling
    U16 DNR_100; // linear mode
    U16 ELA_1F;  // EODI enable/disable
}MS_MULTIWIN_BAKCUP_REG;



// Define input port type
typedef enum
{
    INPUT_PORT_VGA,
    INPUT_PORT_YPBPR,
    INPUT_PORT_DVI,
    INPUT_PORT_MST_AV,
    INPUT_PORT_MST_SV,
    INPUT_PORT_SCART,
    INPUT_PORT_EXTERNAL_VD,
    INPUT_PORT_DC,
    INPUT_PORT_NUM,
    //INPUT_PORT_NONE = INPUT_PORT_NUM,
} MS_INPUT_PORT_TYPE;

typedef enum
{
    MS_ADC_BFOUT_DAC,
    MS_ADC_BFOUT_Y,
    MS_ADC_BFOUT_YC,
    MS_ADC_BFOUT_OFF,
}MS_ADC_BUFF_OUT_TYPE;


// source information
typedef struct
{
    Bool bUsed;     // indication of usage
    U8 u8SrcIdx;    // indication of main or sub window
    U8 u8SrcAdcIdx; // ADC select
    MS_INPUT_SOURCE_TYPE InputSourceType;// input source type

    MS_INPUT_PORT_TYPE PreInputPortType;
    MS_INPUT_PORT_TYPE InputPortType;    // input port type
    U8 u8InputSrcMux; // input select mux
    U8 u8SyncSelMux;
    U8 u8VDYMux;
    U8 u8VDCMux;
    U8 u8ScartFBMux;

    //MS_VIDEO_SYSTEM   VideoSystem;  // TV standard : PAL or NTSC
    MS_CAPTUREDISPLAYWINDOW_TYPE CapDisWin;    // capture & display window for non-DTV
    MS_CAPTUREDISPLAYWINDOW_TYPE DTVCapDisWin; // capture & display window for DTV
    U16 u16VD_Status;
         // current VD status
    U8  u8VideoStableCounter;
 // signal stable counter

    Bool bEnablePreRGB2YUV;
    Bool bColorSpaceYUV;
    Bool bEnableMatrixYUV2RGB;
    Bool bMemSingleBuf;
    Bool bEnable3DNR;
    Bool b3DComb;
    Bool bEnableFilmMode;
    Bool bModeInterlaceMode;
    U8   u8MemoryMode;
    U8   u8DeInterlaceMode;
    U8   u8EODiMode;
    U8   u8DelayLines;
    U16  u16FetchNumber;
    U16  u16MemOffset;

    U8   H_PreScalingInfo;
    U8   H_PostScalingInfo;
    Bool H_bScalingPrePost;
    U8   V_PreScalingInfo;
    U8   V_PostScalingInfo;
    Bool V_bScalingPrePost;
    U16  u16H_SizeAfterPreScaling;
    U16  u16V_SizeAfterPreScaling;
    U16  u16V_Length;
    U16  u16H_CapSizeIC; // real value for IC
    U16  u16V_CapSizeIC; // real value for IC

    U8   u8V_OverScan;
    U8   u8H_OverScan;
    U8   u8WSS; // WSS value

    EN_ASPECT_RATIO_TYPE MVDAspectRatio; // aspect ratio type for MVD
    EN_ASPECT_RATIO_TYPE WSSAspectRatio; // aspect ratio type for WSS
//#if USE_SCART_PIN8
    ScartFormatEnumType  ScartPi8Format;
//#endif
    MS_CAPTUREDISPLAYWINDOW_TYPE Aspect_CaptureDispWin; // capture and display window for aspect ratio
    MS_TUNE_WINDOW_INFO TunningWinInfo;

    Bool bVideoDoModeSetting;
    Bool bModeDoModeSetting;
    Bool bModeInputTimingChange;
    Bool bModeInputTimingStable;
    U8   u8ModeTimingChangeDebounce;
    U8   u8ModeInputTimingStableCounter;
    U8   u8ModeIndex; // mode index for PC Mode
    U16  u16MVDResWidth; // resolution width for MVD
    U16  u16MVDResHeight; // resolution height for MVD

    U8   u8CurrentSyncStatus; // H/V sync status
    U8   u8ModeStatus; // mode status: unsupportd mode, new user mode

    U16  u16ModeVerticalDE;
    U16  u16ModeHorizontalDE;
    U16  u16ModeHfreq;
    U16  u16ModeVfreq;

    U16  u16ModeHorizontalPeriod;
    U16  u16ModeVerticalTotal;

    U8   u8BorderColor;
    MS_MODE_SETTING_TYPE ModeSetting;       // the information for PC

    Bool bVideoUseFIR_11Tap;

    MS_IPSEL_DC  DCIdx;                    // DC0 or DC1 is used

//#if ENABLE_SET_WINDOW_REG
    U32  u32V_PreScalingRatio;
    U32  u32V_PostScalingRatio;
    U32  u32H_PreScalingRatio;
    U32  u32H_PostScalingRatio;
//#endif

    //-------- color setting --------
// calvin, plz discuss it
//    MS_VIDEO_SETTING_TYPE   VideoSetting;   // the information for Video
//    MS_PC_SETTING_TYPE      PCSetting;      // the information for PC

    //-------- ADC --------
    MS_ADC_SETTING_TYPE AdcSetting;         // ADC setting

    MS_MULTIWIN_BAKCUP_REG MultiWin_Reg;    // Backup register for MultiWin
    MS_TVENCODER_BACKUP_REG TvEncoder_Reg;  // Backup register for TVEncoder

    //MS_ADC_POWER_ON_TYPE  ADCPowerType;

#if ENABLE_DLC
    Bool bEnableDLC;
#endif
}MS_SRC_INFO, *PMS_SRC_INFO;



//------------------------------------------------------------------------------
extern void MDrv_VE_SwitchInputSrc(PMS_SWITCH_VE_SRC_INFO pSwitchInfo);
extern void MDrv_VE_SwitchOuputDest(PMS_SWITCH_VE_DEST_INFO pSwitchInfo);
extern void MDrv_VE_Set_OutputCtrl(PMS_VE_OUTPUT_CTRL pOutputCtrl);
extern BOOLEAN MDrv_VE_Set_Output_VideoStd(MS_VE_VIDEOSYS VideoSystem);
extern void MDrv_VE_PowerOn(void);
extern void MDrv_VE_PowerOff(void);
extern void MDrv_VE_Init(void);
extern void MDrv_VE_Set_FixColorOut(PMS_VE_FIX_COLOR_INFO pInfo);

extern void MDrv_VE_Set_DestDevice(MS_SCALER_DEST_TYPE eDestType);
#endif

⌨️ 快捷键说明

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