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) 2006-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 apiXC_Auto.h 98 /// @brief XC api for Auto 99 /// @author MStar Semiconductor Inc. 100 /// 101 //////////////////////////////////////////////////////////////////////////////// 102 103 /*! \defgroup Video Video modules 104 105 * \defgroup XC_FE XC_FE modules 106 * \ingroup Video 107 108 Auto is used to implement auto adjust and auto calibration.\n 109 For more information,see \link Auto_Geometry Auto_Geometry interface (apiXC_Auto.h) \endlink 110 111 * \defgroup Auto_Geometry Auto_Geometry interface (apiXC_Auto.h) 112 * \ingroup XC_FE 113 114 Auto is used to implement auto adjust and auto calibration, including 115 - VGA auto adjust 116 - ADC Calibration 117 118 <b> Operation Code Flow: </b> \n 119 check flow chart directly. 120 \image html auto_flow.png 121 122 * \defgroup AUTO_INIT AUTO init control 123 * \ingroup Auto_Geometry 124 125 *! \defgroup AUTO_FEATURE AUTO feature operation 126 * \ingroup Auto_Geometry 127 128 *! \defgroup AUTO_INFO AUTO Infomation pool 129 * \ingroup Auto_Geometry 130 131 *! \defgroup AUTO_ToBeModified AUTO api to be modified 132 * \ingroup Auto_Geometry 133 134 *! \defgroup AUTO_ToBeRemove AUTO api to be removed 135 * \ingroup Auto_Geometry 136 */ 137 138 139 #ifndef _APIXC_AUTO_H_ 140 #define _APIXC_AUTO_H_ 141 #ifdef __cplusplus 142 extern "C" 143 { 144 #endif 145 146 //------------------------------------------------------------------------------------------------- 147 // Include Files 148 //------------------------------------------------------------------------------------------------- 149 150 //------------------------------------------------------------------------------------------------- 151 // Macro and Define 152 //------------------------------------------------------------------------------------------------- 153 #define XC_AUTO_SIGNAL_INFO_VERSION 1 154 155 //------------------------------------------------------------------------------------------------- 156 // Type and Structure 157 //------------------------------------------------------------------------------------------------- 158 typedef enum 159 { 160 E_XC_AUTO_TUNE_NULL = 0x00, 161 162 // Basic auto-tune 163 E_XC_AUTO_TUNE_VALID_DATA = 0x01, 164 E_XC_AUTO_TUNE_POSITION = 0x02, 165 E_XC_AUTO_TUNE_FREQ = 0x04, 166 E_XC_AUTO_TUNE_PHASE = 0x08, 167 E_XC_AUTO_TUNE_BASIC = E_XC_AUTO_TUNE_VALID_DATA | E_XC_AUTO_TUNE_POSITION | E_XC_AUTO_TUNE_FREQ | E_XC_AUTO_TUNE_PHASE, 168 169 // Auto-tune RGB Color 170 E_XC_AUTO_TUNE_RGB_OFFSET = 0x10, 171 E_XC_AUTO_TUNE_RGB_GAIN = 0X20, 172 E_XC_AUTO_TUNE_RGB_COLOR = E_XC_AUTO_TUNE_RGB_OFFSET | E_XC_AUTO_TUNE_RGB_GAIN, 173 174 // Auto-tune YUV Color 175 E_XC_AUTO_TUNE_YUV_COLOR = 0X40, 176 177 E_XC_AUTO_TUNE_SCART_RGB_GAIN = 0x80, 178 179 // Advance auto-tune 180 E_XC_AUTO_TUNE_ADVANCE = E_XC_AUTO_TUNE_BASIC | E_XC_AUTO_TUNE_RGB_COLOR, 181 } XC_Auto_TuneType; 182 183 typedef enum 184 { 185 E_XC_INTERNAL_CALIBRATION, 186 E_XC_EXTERNAL_CALIBRATION, 187 } XC_Auto_CalibrationType; 188 189 typedef enum 190 { 191 E_XC_HW_CALIBRATION, 192 E_XC_SW_CALIBRATION, 193 } XC_Auto_CalibrationMode; 194 195 typedef enum 196 { 197 E_XC_AUTO_POR_HPVP, 198 E_XC_AUTO_POR_HPVN, 199 E_XC_AUTO_POR_HNVP, 200 E_XC_AUTO_POR_HNVN, 201 }XC_Auto_SYNC_POR; 202 203 typedef struct 204 { 205 206 MS_U16 u16HorizontalStart; ///< horizontal start 207 MS_U16 u16VerticalStart; ///< vertical start 208 MS_U16 u16HorizontalTotal; ///< ADC horizontal total 209 MS_U16 u16HResolution; ///< H size 210 MS_U8 u8Phase; ///< obsolete 211 212 } XC_Auto_Signal_Info; 213 214 typedef struct 215 { 216 MS_U16 u16Version; ///< version 217 MS_U16 u16HorizontalStart; ///< horizontal start 218 MS_U16 u16VerticalStart; ///< vertical start 219 MS_U16 u16HorizontalTotal; ///< ADC horizontal total 220 MS_U16 u16HResolution; ///< H size 221 MS_U16 u16Phase; ///< ADC phase 222 } XC_Auto_Signal_Info_Ex; 223 224 typedef struct 225 { 226 INPUT_SOURCE_TYPE_t eCurrentSrc; 227 SCALER_WIN eWindow; 228 XC_Auto_SYNC_POR eSyncPolarity; 229 MS_U32 u32HSyncStart; 230 MS_U32 u32HSyncEnd; 231 }XC_AUTO_SYNC_INFO; 232 //------------------------------------------------------------------------------------------------- 233 // Function and Variable 234 //------------------------------------------------------------------------------------------------- 235 //************************************************************************* 236 //Function name: MApi_XC_Auto_Geometry 237 //Description: Auto-tune for PC mode 238 /// @ingroup AUTO_FEATURE 239 /// @param enAutoTuneType \b IN: Auto function select 240 /// @param ActiveInfo \b OUT: Current PC mode setting 241 /// @param StandardInfo \b IN:Standard mode. (This is singal information of stardard) 242 /// @param eWindow \b IN: Window 243 /// @return @ref MS_BOOL 244 //************************************************************************* 245 MS_BOOL MApi_XC_Auto_Geometry(XC_Auto_TuneType enAutoTuneType, XC_Auto_Signal_Info *ActiveInfo, XC_Auto_Signal_Info *StandardInfo, SCALER_WIN eWindow); 246 247 //************************************************************************* 248 //Function name: MApi_XC_Auto_Geometry_EX 249 //Description: Auto-tune for PC mode 250 /// @ingroup AUTO_FEATURE 251 /// @param enAutoTuneType \b IN: Auto function select 252 /// @param ActiveInfo \b OUT: Current PC mode EX setting 253 /// @param StandardInfo \b IN:Standard mode. (This is singal information of stardard) 254 /// @param eWindow \b IN: Window 255 /// @return @ref MS_BOOL 256 //************************************************************************* 257 MS_BOOL MApi_XC_Auto_Geometry_Ex(XC_Auto_TuneType enAutoTuneType, XC_Auto_Signal_Info_Ex *ActiveInfo, XC_Auto_Signal_Info_Ex *StandardInfo, SCALER_WIN eWindow); 258 259 //************************************************************************* 260 //Function name: MApi_XC_Auto_StopAutoGeometry 261 //Description: Stop Auto-tune for PC mode 262 /// @ingroup AUTO_FEATURE 263 /// @return @ref MS_BOOL 264 //************************************************************************* 265 // MS_BOOL MApi_XC_Auto_StopAutoGeometry(void); // Call MApi_XC_Auto_Geometry to restart auto geometry again. 266 267 //*************************************************************************** 268 ///-This function is to set gain and offset 269 /// @ingroup AUTO_INFO 270 /// @param type \b IN:calibration type 271 /// @param enAutoTuneType \b OUT:auto tune type 272 /// @param pstADCSetting \b IN:ADC setting 273 /// @param eWindow \b IN: Window 274 /// @return @ref MS_BOOL 275 //*************************************************************************** 276 MS_BOOL MApi_XC_Auto_GainOffset(XC_Auto_CalibrationType type, XC_Auto_TuneType enAutoTuneType, APIXC_AdcGainOffsetSetting *pstADCSetting, SCALER_WIN eWindow); 277 278 //*************************************************************************** 279 ///-This function is to get fixed gain for HW calibration 280 /// @ingroup AUTO_INFO 281 /// @param enAutoTuneType \b IN:tune type 282 /// @param pstADCSetting \b OUT:gain value 283 /// @return @ref MS_BOOL 284 //*************************************************************************** 285 MS_BOOL MApi_XC_Auto_GetHWFixedGainOffset(XC_Auto_TuneType enAutoTuneType, APIXC_AdcGainOffsetSetting *pstADCSetting); 286 287 //*************************************************************************** 288 ///-This function is to set ValidDataThreshold by customer 289 /// @ingroup AUTO_FEATURE 290 /// @param Value \b IN:ValidDataThreshold 291 /// @return @ref MS_BOOL 292 //*************************************************************************** 293 // MS_BOOL MApi_XC_Auto_SetValidData(MS_U8 Value); 294 295 /******************************************************************************/ 296 /// -This function will recalibration ADC offset, must be called when mode change. 297 /// @ingroup AUTO_FEATURE 298 /// @param bEnable \b IN: 299 /// - 0: Disable offset recalibration 300 /// - 1: Enable offset recalibration 301 /// @param bIsYPbPrFlag \b IN: to tell if YPbPr in 302 /// - 0: Vga mode 303 /// - 1: YPbPr mode 304 /******************************************************************************/ 305 void MApi_XC_Auto_AutoOffset(MS_BOOL bEnable, MS_BOOL bIsYPbPrFlag); 306 307 /******************************************************************************/ 308 /// -This function will try to get the actual mode width for VGA 309 /// @ingroup AUTO_INFO 310 /// @param eWindow \b IN: Window 311 /// @param pSignalInfo \b IN: Input signal info for distinguish 312 /// Note: The result of "MApi_XC_Auto_DetectWidth" will highly depends on the HTT value of pSignalInfo 313 /******************************************************************************/ 314 // MS_BOOL MApi_XC_Auto_DetectWidth(XC_Auto_Signal_Info_Ex *pSignalInfo , SCALER_WIN eWindow); 315 316 //*************************************************************************** 317 ///-This function is to set HW or Sw calibration 318 /// @ingroup AUTO_FEATURE 319 /// @param eMode \b IN: HW or SW mode for calibration 320 /// @return @ref MS_BOOL 321 //*************************************************************************** 322 MS_BOOL MApi_XC_Auto_SetCalibrationMode(XC_Auto_CalibrationMode eMode); 323 324 //*************************************************************************** 325 ///-This function is to get HW or Sw calibration 326 /// @ingroup AUTO_INFO 327 /// @param eMode \b OUT: HW or SW mode for calibration 328 //*************************************************************************** 329 void MApi_XC_Auto_GetCalibrationMode(XC_Auto_CalibrationMode *eMode); 330 331 //*************************************************************************** 332 ///-This function is to get sync info 333 /// @ingroup AUTO_INFO 334 /// @param eMode \b OUT: HW or SW mode for calibration 335 //*************************************************************************** 336 void MApi_XC_AUTO_GetSyncInfo(XC_AUTO_SYNC_INFO *pSyncInfo); 337 338 339 #ifdef __cplusplus 340 } 341 #endif 342 343 #endif /* _APIXC_AUTO_H_ */ 344