xref: /utopia/UTPA2-700.0.x/projects/tmplib/include/apiXC_ModeParse_EX.h (revision 53ee8cc121a030b8d368113ac3e966b4705770ef)
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 /// @file  apiXC_ModeParse_EX.h
94 /// @brief MIU header file
95 /// @author MStar Semiconductor Inc.
96 ///
97 ////////////////////////////////////////////////////////////////////////////////
98 #ifndef _API_XC_MODEPARSE_EX_H_
99 #define _API_XC_MODEPARSE_EX_H_
100 
101 #include "MsCommon.h"
102 
103 // Driver
104 #include "drvXC_IOPort_EX.h"
105 
106 // Api
107 #include "apiXC_EX.h"
108 
109 #ifdef __cplusplus
110 extern "C"
111 {
112 #endif
113 
114 //-------------------------------------------------------------------------------------------------
115 //  Include Files
116 //-------------------------------------------------------------------------------------------------
117 
118 //-------------------------------------------------------------------------------------------------
119 //  Macro and Define
120 //-------------------------------------------------------------------------------------------------
121 
122 //------------------------------
123 // Mode Detect & Search
124 //------------------------------
125 #define XC_MODEPARSE_EX_MD_FLAG_NULL            0x00
126 
127 #define XC_MODEPARSE_EX_MD_FLAG_POR_HPVP        0x01
128 #define XC_MODEPARSE_EX_MD_FLAG_POR_HPVN        0x02
129 #define XC_MODEPARSE_EX_MD_FLAG_POR_HNVP        0x04
130 #define XC_MODEPARSE_EX_MD_FLAG_POR_HNVN        0x08
131 #define XC_MODEPARSE_EX_MD_FLAG_INTERLACE       0x10
132 
133 #define XC_MODEPARSE_EX_MD_FLAG_EURO_HDTV_BIT   0x20
134 
135 #define XC_MODEPARSE_EX_MD_FLAG_YPBPR_BIT       0x40
136 #define XC_MODEPARSE_EX_MD_FLAG_HDTV_BIT        0x80
137 
138 
139 //-------------------------------------------------------------------------------------------------
140 //  Type and Structure
141 //-------------------------------------------------------------------------------------------------
142 
143 /// The type of result after mode searching.
144 typedef enum
145 {
146     E_XC_MODEPARSE_EX_NOT_PARSED = 0,        ///< timing not stable or stable no sync, not parse yet
147     E_XC_MODEPARSE_EX_OUT_OF_RANGE,          ///< out of spec.
148     E_XC_MODEPARSE_EX_UNSUPPORT_MODE,        ///< can't find in mode tables
149     E_XC_MODEPARSE_EX_SUPPORT_MODE,          ///< support mode
150 } XC_MODEPARSE_EX_RESULT;
151 
152 typedef struct
153 {
154     // mode parse result
155     MS_U8  u8ModeIndex;                    ///< OUT: mode parse will return the mode index by this variable
156     MS_U16 u16ResWidth;                    ///< OUT: indicate the resolution -> width
157     MS_U16 u16ResHeight;                   ///< OUT: indicate the resolution -> height
158 
159     // src type
160     XC_EX_INPUT_SOURCE_TYPE eSrcType;       ///< IN: input source type
161 
162     // Analog
163     MS_U16 u16HFreqx10;                    ///< IN: HFreq x 10, unit KHz after / 10
164     MS_U16 u16VFreqx10;                    ///< IN: VFreq x 10, unit Hz after / 10
165     MS_U16 u16Vtotal;                      ///< IN: Vertical total
166     MS_U8  u8SyncStatus;                   ///< IN: from XC driver, including H/V sync polarity, interlaced or progressive, mode parse will or XC_EX_MD_USER_MODE_BIT if new mode found
167 
168     // Digital
169     XC_EX_WINDOW_TYPE sDVI_HDMI_DE_Info;   ///< IN: DVI/HDMI input DE information
170 
171     // EuroHDTV detected or not
172     XC_EX_DETECT_EURO_HDTV_STATUS_TYPE eEuroHDTVStatus;    ///< IN: timing monitor detect Euro/Aus HDTV status
173 } XC_MODEPARSE_EX_INPUT_INFO;  ///< the neccesary input timing information for mode search
174 
175 typedef enum
176 {
177     E_XC_MODEPARSE_EX_RES_640X350,     // 00
178     E_XC_MODEPARSE_EX_RES_640X400,     // 01
179     E_XC_MODEPARSE_EX_RES_720X400,     // 02
180     E_XC_MODEPARSE_EX_RES_640X480,     // 03
181     E_XC_MODEPARSE_EX_RES_800X600,     // 04
182     E_XC_MODEPARSE_EX_RES_832X624,     // 05
183     E_XC_MODEPARSE_EX_RES_1024X768,    // 06
184     E_XC_MODEPARSE_EX_RES_1280X1024,   // 07
185     E_XC_MODEPARSE_EX_RES_1600X1200,   // 08
186     E_XC_MODEPARSE_EX_RES_1152X864,    // 09
187     E_XC_MODEPARSE_EX_RES_1152X870,    // 10
188     E_XC_MODEPARSE_EX_RES_1280X768,    // 11
189     E_XC_MODEPARSE_EX_RES_1280X960,    // 12
190     E_XC_MODEPARSE_EX_RES_720X480,     // 13
191     E_XC_MODEPARSE_EX_RES_1920X1080,   // 14
192     E_XC_MODEPARSE_EX_RES_1280X720,    // 15
193     E_XC_MODEPARSE_EX_RES_720X576,     // 16
194     E_XC_MODEPARSE_EX_RES_1920X1200,   // 17
195     E_XC_MODEPARSE_EX_RES_1400X1050,   // 18
196     E_XC_MODEPARSE_EX_RES_1440X900,    // 19
197     E_XC_MODEPARSE_EX_RES_1680X1050,   // 20
198     E_XC_MODEPARSE_EX_RES_1280X800,    // 21
199     E_XC_MODEPARSE_EX_RES_1600X1024,   // 22
200     E_XC_MODEPARSE_EX_RES_1600X900,    // 23
201     E_XC_MODEPARSE_EX_RES_1360X768,    // 24
202     E_XC_MODEPARSE_EX_RES_848X480,     // 25
203     E_XC_MODEPARSE_EX_RES_1920X1080P,  // 26
204     E_XC_MODEPARSE_EX_RES_1366X768,    // 27
205     E_XC_MODEPARSE_EX_RES_864X648,     // 28
206     E_XC_MODEPARSE_EX_RES_1280X1470,   // 29
207     E_XC_MODEPARSE_EX_RES_1920X2205,   // 30
208     E_XC_MODEPARSE_EX_RES_720X240,     // 31
209     E_XC_MODEPARSE_EX_RES_720x288,     // 32
210     E_XC_MODEPARSE_EX_RES_1152X900,    // 33
211     E_XC_MODEPARSE_EX_RES_856x480,     // 34
212     E_XC_MODEPARSE_EX_RES_MAXIMUM
213 } XC_MODEPARSE_EX_RESOLUTION_TYPE;
214 
215 typedef struct
216 {
217     XC_MODEPARSE_EX_RESOLUTION_TYPE enResolutionIndex;   ///< resolution
218 
219     MS_U16 u16HorizontalFrequency;             ///< Horizontal frequency
220     MS_U16 u16VerticalFrequency;               ///< Vertical frequency
221 
222     MS_U16 u16HorizontalStart;                 ///< Horizontal start
223     MS_U16 u16VerticalStart;                   ///< Vertical start
224 
225     MS_U16 u16HorizontalTotal;                 ///< Horizontal Total
226     MS_U16 u16VerticalTotal;                   ///< Vertical Total
227     MS_U8 u8VTotalTolerance;                   ///< VTotal tolerance
228 
229     MS_U8 u8AdcPhase;                          ///< ADC phase
230 
231     MS_U8 u8StatusFlag; ///< flags
232     // b0: VSync polarity(1/0 = positive/negative)
233     // b1: HSync polarity(1/0 = positive/negative)
234     // b2: Sync polarity care bit
235     // b4: interlace mode
236 } XC_MODEPARSE_EX_PCADC_MODETABLE_TYPE;
237 
238 typedef struct
239 {
240     XC_MODEPARSE_EX_RESOLUTION_TYPE enResolutionIndex;   ///< resolution
241 
242     MS_U16 u16HorizontalFrequency;             ///< Horizontal frequency
243     MS_U16 u16VerticalFrequency;               ///< Vertical frequency
244 
245     MS_U16 u16HorizontalStart;                 ///< Horizontal start
246     MS_U16 u16VerticalStart;                   ///< Vertical start
247 
248     MS_U16 u16HorizontalTotal;                 ///< Horizontal Total
249     MS_U16 u16VerticalTotal;                   ///< Vertical Total
250     MS_U16 u16VTotalTolerance;                   ///< VTotal tolerance
251 
252     MS_U16 u16AdcPhase;                          ///< adc phase
253 
254     MS_U8 u8StatusFlag; ///< flags
255     // b0: VSync polarity(1/0 = positive/negative)
256     // b1: HSync polarity(1/0 = positive/negative)
257     // b2: Sync polarity care bit
258     // b4: interlace mode
259 } XC_MODEPARSE_EX_PCADC_MODETABLE_TYPE_EX;
260 
261 
262 //-------------------------------------------------------------------------------------------------
263 //  Function and Variable
264 //-------------------------------------------------------------------------------------------------
265 
266 DLL_PUBLIC MS_BOOL MApi_XC_ModeParse_EX_Init(XC_DEVICE_ID *pDeviceId);
267 // mode search
268 
269 DLL_PUBLIC XC_MODEPARSE_EX_RESULT MApi_XC_ModeParse_EX_MatchMode(XC_DEVICE_ID *pDeviceId, XC_MODEPARSE_EX_PCADC_MODETABLE_TYPE* ModeDB, MS_U8 u16NumberOfItems , XC_MODEPARSE_EX_INPUT_INFO *psInputInfo);
270 DLL_PUBLIC XC_MODEPARSE_EX_RESULT MApi_XC_ModeParse_EX_MatchModeEx(XC_DEVICE_ID *pDeviceId, XC_MODEPARSE_EX_PCADC_MODETABLE_TYPE_EX* ModeDB, MS_U8 u16NumberOfItems , XC_MODEPARSE_EX_INPUT_INFO *psInputInfo);
271 #ifdef __cplusplus
272 }
273 #endif
274 
275 #endif /* _API_XC_MODEPARSE_EX_H_ */
276