1 //<MStar Software> 2 //****************************************************************************** 3 // MStar Software 4 // Copyright (c) 2010 - 2012 MStar Semiconductor, Inc. All rights reserved. 5 // All software, firmware and related documentation herein ("MStar Software") are 6 // intellectual property of MStar Semiconductor, Inc. ("MStar") and protected by 7 // law, including, but not limited to, copyright law and international treaties. 8 // Any use, modification, reproduction, retransmission, or republication of all 9 // or part of MStar Software is expressly prohibited, unless prior written 10 // permission has been granted by MStar. 11 // 12 // By accessing, browsing and/or using MStar Software, you acknowledge that you 13 // have read, understood, and agree, to be bound by below terms ("Terms") and to 14 // comply with all applicable laws and regulations: 15 // 16 // 1. MStar shall retain any and all right, ownership and interest to MStar 17 // Software and any modification/derivatives thereof. 18 // No right, ownership, or interest to MStar Software and any 19 // modification/derivatives thereof is transferred to you under Terms. 20 // 21 // 2. You understand that MStar Software might include, incorporate or be 22 // supplied together with third party`s software and the use of MStar 23 // Software may require additional licenses from third parties. 24 // Therefore, you hereby agree it is your sole responsibility to separately 25 // obtain any and all third party right and license necessary for your use of 26 // such third party`s software. 27 // 28 // 3. MStar Software and any modification/derivatives thereof shall be deemed as 29 // MStar`s confidential information and you agree to keep MStar`s 30 // confidential information in strictest confidence and not disclose to any 31 // third party. 32 // 33 // 4. MStar Software is provided on an "AS IS" basis without warranties of any 34 // kind. Any warranties are hereby expressly disclaimed by MStar, including 35 // without limitation, any warranties of merchantability, non-infringement of 36 // intellectual property rights, fitness for a particular purpose, error free 37 // and in conformity with any international standard. You agree to waive any 38 // claim against MStar for any loss, damage, cost or expense that you may 39 // incur related to your use of MStar Software. 40 // In no event shall MStar be liable for any direct, indirect, incidental or 41 // consequential damages, including without limitation, lost of profit or 42 // revenues, lost or damage of data, and unauthorized system use. 43 // You agree that this Section 4 shall still apply without being affected 44 // even if MStar Software has been modified by MStar in accordance with your 45 // request or instruction for your use, except otherwise agreed by both 46 // parties in writing. 47 // 48 // 5. If requested, MStar may from time to time provide technical supports or 49 // services in relation with MStar Software to you for your use of 50 // MStar Software in conjunction with your or your customer`s product 51 // ("Services"). 52 // You understand and agree that, except otherwise agreed by both parties in 53 // writing, Services are provided on an "AS IS" basis and the warranty 54 // disclaimer set forth in Section 4 above shall apply. 55 // 56 // 6. Nothing contained herein shall be construed as by implication, estoppels 57 // or otherwise: 58 // (a) conferring any license or right to use MStar name, trademark, service 59 // mark, symbol or any other identification; 60 // (b) obligating MStar or any of its affiliates to furnish any person, 61 // including without limitation, you and your customers, any assistance 62 // of any kind whatsoever, or any information; or 63 // (c) conferring any license or right under any intellectual property right. 64 // 65 // 7. These terms shall be governed by and construed in accordance with the laws 66 // of Taiwan, R.O.C., excluding its conflict of law rules. 67 // Any and all dispute arising out hereof or related hereto shall be finally 68 // settled by arbitration referred to the Chinese Arbitration Association, 69 // Taipei in accordance with the ROC Arbitration Law and the Arbitration 70 // Rules of the Association by three (3) arbitrators appointed in accordance 71 // with the said Rules. 72 // The place of arbitration shall be in Taipei, Taiwan and the language shall 73 // be English. 74 // The arbitration award shall be final and binding to both parties. 75 // 76 //****************************************************************************** 77 //<MStar Software> 78 //////////////////////////////////////////////////////////////////////////////// 79 // 80 // Copyright (c) 2008-2009 MStar Semiconductor, Inc. 81 // All rights reserved. 82 // 83 // Unless otherwise stipulated in writing, any and all information contained 84 // herein regardless in any format shall remain the sole proprietary of 85 // MStar Semiconductor Inc. and be kept in strict confidence 86 // ("MStar Confidential Information") by the recipient. 87 // Any unauthorized act including without limitation unauthorized disclosure, 88 // copying, use, reproduction, sale, distribution, modification, disassembling, 89 // reverse engineering and compiling of the contents of MStar Confidential 90 // Information is unlawful and strictly prohibited. MStar hereby reserves the 91 // rights to any and all damages, losses, costs and expenses resulting therefrom. 92 // 93 //////////////////////////////////////////////////////////////////////////////// 94 95 /////////////////////////////////////////////////////////////////////////////////////////////////// 96 /// 97 /// @file drvAVD_priv.h 98 /// @brief AVD Driver private Interface 99 /// @author MStar Semiconductor Inc. 100 /////////////////////////////////////////////////////////////////////////////////////////////////// 101 102 #ifndef _DRV_AVD_PRIV_H_ 103 #define _DRV_AVD_PRIV_H_ 104 105 #include "drvAVD_v2.h" 106 107 //------------------------------------------------------------------------------------------------- 108 // Function and Variable 109 //------------------------------------------------------------------------------------------------- 110 111 extern AVD_Result Drv_AVD_Init(VD_INITDATA *pVD_InitData, MS_U32 u32InitDataLen, AVD_RESOURCE_PRIVATE *pResource); 112 113 extern void Drv_AVD_Exit(AVD_RESOURCE_PRIVATE *pResource); 114 115 extern MS_BOOL Drv_AVD_ResetMCU(AVD_RESOURCE_PRIVATE *pResource); 116 117 extern void Drv_AVD_FreezeMCU(MS_BOOL bEnable, AVD_RESOURCE_PRIVATE *pResource); 118 119 extern MS_U16 Drv_AVD_Scan_HsyncCheck(MS_U8 u8HtotalTolerance, AVD_RESOURCE_PRIVATE *pResource); 120 121 extern void Drv_AVD_StartAutoStandardDetection(AVD_RESOURCE_PRIVATE *pResource); 122 123 extern MS_BOOL Drv_AVD_ForceVideoStandard(AVD_VideoStandardType eVideoStandardType, AVD_RESOURCE_PRIVATE *pResource); 124 125 extern void Drv_AVD_3DCombSpeedup(AVD_RESOURCE_PRIVATE *pResource); 126 127 extern void Drv_AVD_LoadDSP(MS_U8 *pu8VD_DSP, MS_U32 len, AVD_RESOURCE_PRIVATE *pResource); 128 129 extern MS_U8 Drv_AVD_MBX_ReadByteByVDMbox(MS_U8 u8Addr, AVD_RESOURCE_PRIVATE *pResource); 130 131 extern void Drv_AVD_BackPorchWindowPositon(MS_BOOL bEnable , MS_U8 u8Value); 132 133 134 extern void Drv_AVD_SetFlag(MS_U32 u32VDPatchFlag, AVD_RESOURCE_PRIVATE *pResource); 135 136 extern void Drv_AVD_SetRegValue(MS_U16 u16Addr,MS_U8 u8Value); 137 138 extern void Drv_AVD_SetRegFromDSP(AVD_RESOURCE_PRIVATE *pResource); 139 140 extern MS_BOOL Drv_AVD_SetInput(AVD_InputSourceType eSource, MS_U8 u8ScartFB, AVD_RESOURCE_PRIVATE *pResource); 141 142 extern MS_BOOL Drv_AVD_SetVideoStandard(AVD_VideoStandardType eStandard, MS_BOOL bIsInAutoTuning, AVD_RESOURCE_PRIVATE *pResource); 143 144 extern void Drv_AVD_SetChannelChange(AVD_RESOURCE_PRIVATE *pResource); 145 146 extern void Drv_AVD_SetHsyncDetectionForTuning(MS_BOOL bEnable, AVD_RESOURCE_PRIVATE *pResource); 147 148 extern void Drv_AVD_Set3dComb(MS_BOOL bEnable, AVD_RESOURCE_PRIVATE *pResource); 149 150 extern void Drv_AVD_SetShiftClk(MS_BOOL bEnable,AVD_ATV_CLK_TYPE eShiftMode, AVD_RESOURCE_PRIVATE *pResource); 151 152 extern void Drv_AVD_SetFreerunPLL(AVD_VideoFreq eVideoFreq, AVD_RESOURCE_PRIVATE *pResource); 153 154 extern void Drv_AVD_SetFreerunFreq(AVD_FreeRunFreq eFreerunfreq, AVD_RESOURCE_PRIVATE *pResource); 155 156 extern void Drv_AVD_SetFactoryPara(AVD_Factory_Para FactoryPara,MS_U8 u8Value, AVD_RESOURCE_PRIVATE *pResource); 157 158 extern MS_BOOL Drv_AVD_SetDbgLevel(AVD_DbgLv u8DbgLevel, AVD_RESOURCE_PRIVATE *pResource); 159 160 extern void Drv_AVD_SetPQFineTune(AVD_RESOURCE_PRIVATE *pResource); 161 162 extern void Drv_AVD_Set3dCombSpeed(MS_U8 u8COMB57, MS_U8 u8COMB58, AVD_RESOURCE_PRIVATE *pResource); 163 164 extern void Drv_AVD_SetStillImageParam(AVD_Still_Image_Param param, AVD_RESOURCE_PRIVATE *pResource); 165 166 extern void Drv_AVD_Set2D3DPatchOnOff(MS_BOOL bEnable); 167 168 extern MS_U8 Drv_AVD_SetAutoFineGainToFixed(void); 169 170 171 extern MS_U8 Drv_AVD_GetRegValue(MS_U16 u16Addr); 172 173 extern MS_U16 Drv_AVD_GetStatus(void); 174 175 extern MS_U8 Drv_AVD_GetNoiseMag(void); 176 177 extern MS_U16 Drv_AVD_GetVTotal(void); 178 179 extern AVD_VideoStandardType Drv_AVD_GetStandardDetection(MS_U16 *u16LatchStatus, AVD_RESOURCE_PRIVATE *pResource); 180 181 extern void Drv_AVD_GetCaptureWindow(void *stCapWin, AVD_VideoStandardType eVideoStandardType , AVD_RESOURCE_PRIVATE *pResource); 182 183 extern AVD_VideoFreq Drv_AVD_GetVerticalFreq(void); 184 185 extern MS_U8 Drv_AVD_GetHsyncEdge(void); 186 187 extern MS_U8 Drv_AVD_GetDSPFineGain(AVD_RESOURCE_PRIVATE *pResource); 188 189 extern MS_U16 Drv_AVD_GetDSPVersion(void); 190 191 extern AVD_Result Drv_AVD_GetLibVer(const MSIF_Version **ppVersion); 192 193 extern void Drv_AVD_GetInfo(AVD_Info* pAVD_Info, AVD_RESOURCE_PRIVATE *pResource); 194 195 extern MS_BOOL Drv_AVD_IsSyncLocked(void); 196 197 extern MS_BOOL Drv_AVD_IsSignalInterlaced(void); 198 199 extern MS_BOOL Drv_AVD_IsColorOn(void); 200 201 extern MS_U32 Drv_AVD_SetPowerState(EN_POWER_MODE u16PowerState, AVD_RESOURCE_PRIVATE *pResource); 202 203 extern MS_BOOL Drv_AVD_GetMacroVisionDetect(void); 204 205 extern MS_BOOL Drv_AVD_GetCGMSDetect(void); 206 207 extern void Drv_AVD_SetBurstWinStart(MS_U8 u8BusrtStartPosition); 208 209 extern MS_BOOL Drv_AVD_IsAVDAlive(void); 210 211 extern MS_BOOL Drv_AVD_IsLockAudioCarrier(void); 212 //-------------------------------- functions ------------------------------------------------------------ 213 214 typedef AVD_Result (*IOCTL_AVD_Init)(VD_INITDATA *, MS_U32, AVD_RESOURCE_PRIVATE *); 215 typedef void (*IOCTL_AVD_Exit)(AVD_RESOURCE_PRIVATE *); 216 typedef MS_BOOL (*IOCTL_AVD_ResetMCU)(AVD_RESOURCE_PRIVATE *); 217 typedef void (*IOCTL_AVD_FreezeMCU)(MS_BOOL, AVD_RESOURCE_PRIVATE *); 218 typedef MS_U16 (*IOCTL_AVD_Scan_HsyncCheck)(MS_U8, AVD_RESOURCE_PRIVATE *); 219 typedef void (*IOCTL_AVD_StartAutoStandardDetection)(AVD_RESOURCE_PRIVATE *); 220 typedef MS_BOOL (*IOCTL_AVD_ForceVideoStandard)(AVD_VideoStandardType, AVD_RESOURCE_PRIVATE *); 221 typedef void (*IOCTL_AVD_3DCombSpeedup)(AVD_RESOURCE_PRIVATE *); 222 typedef void (*IOCTL_AVD_LoadDSP)(MS_U8 *, MS_U32, AVD_RESOURCE_PRIVATE *); 223 typedef void (*IOCTL_AVD_BackPorchWindowPositon)(MS_BOOL , MS_U8); 224 typedef MS_U8 (*IOCTL_AVD_MBX_ReadByteByVDMbox)(MS_U8, AVD_RESOURCE_PRIVATE *); 225 226 typedef void (*IOCTL_AVD_SetFlag)(MS_U32, AVD_RESOURCE_PRIVATE *); 227 typedef void (*IOCTL_AVD_SetRegValue)(MS_U16 ,MS_U8); 228 typedef void (*IOCTL_AVD_SetRegFromDSP)(AVD_RESOURCE_PRIVATE *); 229 typedef MS_BOOL (*IOCTL_AVD_SetInput)(AVD_InputSourceType , MS_U8, AVD_RESOURCE_PRIVATE *); 230 typedef MS_BOOL (*IOCTL_AVD_SetVideoStandard)(AVD_VideoStandardType , MS_BOOL, AVD_RESOURCE_PRIVATE *); 231 typedef void (*IOCTL_AVD_SetChannelChange)(AVD_RESOURCE_PRIVATE *); 232 typedef void (*IOCTL_AVD_SetHsyncDetectionForTuning)(MS_BOOL, AVD_RESOURCE_PRIVATE *); 233 typedef void (*IOCTL_AVD_Set3dComb)(MS_BOOL , AVD_RESOURCE_PRIVATE *); 234 typedef void (*IOCTL_AVD_SetShiftClk)(MS_BOOL ,AVD_ATV_CLK_TYPE, AVD_RESOURCE_PRIVATE *); 235 typedef void (*IOCTL_AVD_SetFreerunPLL)(AVD_VideoFreq, AVD_RESOURCE_PRIVATE *); 236 typedef void (*IOCTL_AVD_SetFreerunFreq)(AVD_FreeRunFreq, AVD_RESOURCE_PRIVATE *); 237 typedef void (*IOCTL_AVD_SetFactoryPara)(AVD_Factory_Para ,MS_U8,AVD_RESOURCE_PRIVATE *); 238 typedef MS_BOOL (*IOCTL_AVD_SetDbgLevel)(AVD_DbgLv, AVD_RESOURCE_PRIVATE *); 239 typedef void (*IOCTL_AVD_SetPQFineTune)(AVD_RESOURCE_PRIVATE *); 240 typedef void (*IOCTL_AVD_Set3dCombSpeed)(MS_U8 , MS_U8, AVD_RESOURCE_PRIVATE *); 241 typedef void (*IOCTL_AVD_SetStillImageParam)(AVD_Still_Image_Param, AVD_RESOURCE_PRIVATE *); 242 typedef void (*IOCTL_AVD_Set2D3DPatchOnOff)(MS_BOOL); 243 typedef MS_U8 (*IOCTL_AVD_SetAutoFineGainToFixed)(void); 244 245 typedef MS_U8 (*IOCTL_AVD_GetRegValue)(MS_U16); 246 typedef MS_U16 (*IOCTL_AVD_GetStatus)(void); 247 typedef MS_U8 (*IOCTL_AVD_GetNoiseMag)(void); 248 typedef MS_U16 (*IOCTL_AVD_GetVTotal)(void); 249 typedef AVD_VideoStandardType (*IOCTL_AVD_GetStandardDetection)(MS_U16 *, AVD_RESOURCE_PRIVATE *); 250 typedef void (*IOCTL_AVD_GetCaptureWindow)(void *, AVD_VideoStandardType, AVD_RESOURCE_PRIVATE *); 251 typedef AVD_VideoFreq (*IOCTL_AVD_GetVerticalFreq)(void); 252 typedef MS_U8 (*IOCTL_AVD_GetHsyncEdge)(void); 253 typedef MS_U8 (*IOCTL_AVD_GetDSPFineGain)(AVD_RESOURCE_PRIVATE *); 254 typedef MS_U16 (*IOCTL_AVD_GetDSPVersion)(void); 255 typedef AVD_Result (*IOCTL_AVD_GetLibVer)(const MSIF_Version **); 256 typedef void (*IOCTL_AVD_GetInfo)(AVD_Info*, AVD_RESOURCE_PRIVATE *); 257 typedef MS_BOOL (*IOCTL_AVD_IsSyncLocked)(void); 258 typedef MS_BOOL (*IOCTL_AVD_IsSignalInterlaced)(void); 259 typedef MS_BOOL (*IOCTL_AVD_IsColorOn)(void); 260 typedef MS_U32 (*IOCTL_AVD_SetPowerState)(EN_POWER_MODE , AVD_RESOURCE_PRIVATE *); 261 typedef MS_BOOL (*IOCTL_AVD_GetMacroVisionDetect)(void); 262 typedef MS_BOOL (*IOCTL_AVD_GetCGMSDetect)(void); 263 typedef void (*IOCTL_AVD_SetBurstWinStart)(MS_U8); 264 typedef MS_BOOL (*IOCTL_AVD_IsAVDAlive)(void); 265 typedef MS_BOOL (*IOCTL_AVD_IsLockAudioCarrier)(void); 266 267 typedef struct _AVD_INSTANT_PRIVATE 268 { 269 IOCTL_AVD_Init fpAVDInit; 270 IOCTL_AVD_Exit fpAVDExit; 271 IOCTL_AVD_ResetMCU fpAVDResetMCU; 272 IOCTL_AVD_FreezeMCU fpAVDFreezeMCU; 273 IOCTL_AVD_Scan_HsyncCheck fpAVDScanHsyncCheck; 274 IOCTL_AVD_StartAutoStandardDetection fpAVDStartAutoStandardDetection; 275 IOCTL_AVD_ForceVideoStandard fpAVDForceVideoStandard; 276 IOCTL_AVD_3DCombSpeedup fpAVD3DCombSpeedup; 277 IOCTL_AVD_LoadDSP fpAVDLoadDSP; 278 IOCTL_AVD_BackPorchWindowPositon fpAVDBackPorchWindowPositon; 279 IOCTL_AVD_MBX_ReadByteByVDMbox fpAVDMBX_ReadByteByVDMbox; 280 281 IOCTL_AVD_SetFlag fpAVDSetFlag; 282 IOCTL_AVD_SetRegValue fpAVDSetRegValue; 283 IOCTL_AVD_SetRegFromDSP fpAVDSetRegFromDSP; 284 IOCTL_AVD_SetInput fpAVDSetInput; 285 IOCTL_AVD_SetVideoStandard fpAVDSetVideoStandard; 286 IOCTL_AVD_SetChannelChange fpAVDSetChannelChange; 287 IOCTL_AVD_SetHsyncDetectionForTuning fpAVDSetHsyncDetectionForTuning; 288 IOCTL_AVD_Set3dComb fpAVDSet3dComb; 289 IOCTL_AVD_SetShiftClk fpAVDSetShiftClk; 290 IOCTL_AVD_SetFreerunPLL fpAVDSetFreerunPLL; 291 IOCTL_AVD_SetFreerunFreq fpAVDSetFreerunFreq; 292 IOCTL_AVD_SetFactoryPara fpAVDSetFactoryPara; 293 IOCTL_AVD_SetDbgLevel fpAVDSetDbgLevel; 294 IOCTL_AVD_SetPQFineTune fpAVDSetPQFineTune; 295 IOCTL_AVD_Set3dCombSpeed fpAVDSet3dCombSpeed; 296 IOCTL_AVD_SetStillImageParam fpAVDSetStillImageParam; 297 IOCTL_AVD_Set2D3DPatchOnOff fpAVDSet2D3DPatchOnOff; 298 IOCTL_AVD_SetAutoFineGainToFixed fpAVDSetAutoFineGainToFixed; 299 300 IOCTL_AVD_GetRegValue fpAVDGetRegValue; 301 IOCTL_AVD_GetStatus fpAVDGetStatus; 302 IOCTL_AVD_GetNoiseMag fpAVDGetNoiseMag; 303 IOCTL_AVD_GetVTotal fpAVDGetVTotal; 304 IOCTL_AVD_GetStandardDetection fpAVDGetStandardDetection; 305 IOCTL_AVD_GetCaptureWindow fpAVDGetCaptureWindow; 306 IOCTL_AVD_GetVerticalFreq fpAVDGetVerticalFreq; 307 IOCTL_AVD_GetHsyncEdge fpAVDGetHsyncEdge; 308 IOCTL_AVD_GetDSPFineGain fpAVDGetDSPFineGain; 309 IOCTL_AVD_GetDSPVersion fpAVDGetDSPVersion; 310 IOCTL_AVD_GetLibVer fpAVDGetLibVer; 311 IOCTL_AVD_GetInfo fpAVDGetInfo; 312 IOCTL_AVD_IsSyncLocked fpAVDIsSyncLocked; 313 IOCTL_AVD_IsSignalInterlaced fpAVDIsSignalInterlaced; 314 IOCTL_AVD_IsColorOn fpAVDIsColorOn; 315 IOCTL_AVD_SetPowerState fpAVDSetPowerState; 316 IOCTL_AVD_GetMacroVisionDetect fpAVDGetMacroVisionDetect; 317 IOCTL_AVD_GetCGMSDetect fpAVDGetCGMSDetect; 318 IOCTL_AVD_SetBurstWinStart fpAVDSetBurstWinStart; 319 IOCTL_AVD_IsAVDAlive fpAVDIsAVDAlive; 320 IOCTL_AVD_IsLockAudioCarrier fpAVDIsLockAudioCarrier; 321 }AVD_INSTANT_PRIVATE; 322 323 324 void AVDRegisterToUtopia(void); 325 MS_U32 AVDOpen(void** pInstantTmp, MS_U32 u32ModuleVersion, void* pAttribute); 326 MS_U32 AVDClose(void* pInstantTmp); 327 MS_U32 AVDIoctl(void* pInstantTmp, MS_U32 u32Cmd, void* pArgs); 328 MS_U32 AVDStr(MS_U32 u32PowerState, void* pModule); 329 void vd_str_stablestatus(void); 330 #endif // _DRV_AVD_PRIV_H_ 331