xref: /utopia/UTPA2-700.0.x/projects/tmplib/include/apiXC_PCMonitor.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_PCMonitor.h
94 /// @brief header file
95 /// @author MStar Semiconductor Inc.
96 ///
97 ////////////////////////////////////////////////////////////////////////////////
98 
99 /*! \defgroup Video Video modules
100 
101  *  \defgroup XC_FE XC_FE modules
102  *  \ingroup Video
103 
104     PC monitor is used to detect signal information.\n
105     For more information,see \link PC_Monitor PC_Monitor interface (apiXC_PCMonitor.h) \endlink
106 
107  * \defgroup PC_Monitor PC_Monitor interface (apiXC_PCMonitor.h)
108  *  \ingroup XC_FE
109 
110     PC monitor is used to detect signal information such as
111     - input source type : Component / HDMI / DVI / VGA
112     - input horizontal frequency
113     - input vertical frequency
114     - input vertical total
115     - input sync detection : H/V polarity, scan type
116     - HDMI/DVI only : Data Enable section detection result
117     - Euro HDTV detection result
118     and the sync stable result will be passed back and make sure these signal characteristics are steady.
119 
120     TO BE NOTICED :
121     signal characteristics being steady does not mean that this signal are valid signal.
122 
123     <b> Operation Code Flow: </b> \n
124     check flow chart directly.
125     \image html apiXC_PCMonitor_base_flow.png
126 
127  * \defgroup PC_Monitor_INIT PC_Monitor init control
128  *  \ingroup PC_Monitor
129 
130  *! \defgroup PC_Monitor_FEATURE PC_Monitor feature operation
131  *  \ingroup PC_Monitor
132 
133  *! \defgroup PC_Monitor_INFO PC_Monitor Infomation pool
134  *  \ingroup PC_Monitor
135 
136  *! \defgroup PC_Monitor_ToBeModified PC_Monitor api to be modified
137  *  \ingroup PC_Monitor
138 
139  *! \defgroup PC_Monitor_ToBeRemove PC_Monitor api to be removed
140  *  \ingroup PC_Monitor
141  */
142 
143 
144 #ifndef _API_XC_PC_MONITOR_H_
145 #define _API_XC_PC_MONITOR_H_
146 #ifdef __cplusplus
147 extern "C"
148 {
149 #endif
150 
151 //-------------------------------------------------------------------------------------------------
152 //  Include Files
153 //-------------------------------------------------------------------------------------------------
154 
155 //-------------------------------------------------------------------------------------------------
156 //  Macro and Define
157 //-------------------------------------------------------------------------------------------------
158 
159 #define ENABLE_IP_AUTO_COAST    (0)
160 
161 //-------------------------------------------------------------------------------------------------
162 //  Type and Structure
163 //-------------------------------------------------------------------------------------------------
164 
165 /// Indicate the status of pc monitor.
166 typedef enum
167 {
168     E_XC_PCMONITOR_STABLE_NOSYNC = 0,       ///< Input timing stable, no input sync detected
169     E_XC_PCMONITOR_STABLE_SYNC ,            ///< Input timing stable, no input sync detected
170     E_XC_PCMONITOR_UNSTABLE,                ///< Timing change, has to wait InfoFrame if HDMI input
171 } XC_PCMONITOR_STATUS;
172 
173 //-------------------------------------------------------------------------------------------------
174 //  Function and Variable
175 //-------------------------------------------------------------------------------------------------
176 
177 //-------------------------------------------------------------------------------------------------
178 /// PC monitor Init
179 /// @ingroup PC_Monitor_INIT
180 /// @param  u8MaxWindowNum                 \b IN: max window number
181 /// @return MS_BOOL
182 //-------------------------------------------------------------------------------------------------
183 MS_BOOL MApi_XC_PCMonitor_Init(MS_U8 u8MaxWindowNum);
184 //-------------------------------------------------------------------------------------------------
185 /// PC monitor restart
186 /// @ingroup PC_Monitor_FEATURE
187 /// @param  eWindow                 \b IN: window ID
188 //-------------------------------------------------------------------------------------------------
189 void MApi_XC_PCMonitor_Restart(SCALER_WIN eWindow);
190 
191 //-------------------------------------------------------------------------------------------------
192 /// PC monitor restart
193 /// @ingroup PC_Monitor_ToBeModified
194 /// @param  u16TimingStableCounter                 \b IN: stable counter
195 /// @param  u16TimingNosyncCounter                 \b IN: no signal counter
196 //-------------------------------------------------------------------------------------------------
197 void MApi_XC_PCMonitor_SetTimingCount(MS_U16 u16TimingStableCounter, MS_U16 u16TimingNosyncCounter);
198 
199 //-------------------------------------------------------------------------------------------------
200 /// PC monitor
201 /// @ingroup PC_Monitor_FEATURE
202 /// @param  src                         \b IN: stable counter
203 /// @param  eWindow                 \b IN: window ID
204 /// @return XC_PCMONITOR_STATUS
205 //-------------------------------------------------------------------------------------------------
206 XC_PCMONITOR_STATUS MApi_XC_PCMonitor(INPUT_SOURCE_TYPE_t src, SCALER_WIN eWindow);
207 
208 //-------------------------------------------------------------------------------------------------
209 /// Get current status of PC monitor
210 /// @ingroup PC_Monitor_ToBeModified
211 /// @param  eWindow                 \b IN: window ID
212 /// @return XC_PCMONITOR_STATUS
213 //-------------------------------------------------------------------------------------------------
214 XC_PCMONITOR_STATUS MApi_XC_PCMonitor_GetCurrentState(SCALER_WIN eWindow);
215 
216 //-------------------------------------------------------------------------------------------------
217 /// Get the sync status of PC monitor
218 /// @ingroup PC_Monitor_ToBeModified
219 /// @param  eWindow                 \b IN: window ID
220 /// @return MS_U8
221 //-------------------------------------------------------------------------------------------------
222 MS_U8 MApi_XC_PCMonitor_GetSyncStatus(SCALER_WIN eWindow);
223 
224 //-------------------------------------------------------------------------------------------------
225 /// Get horizontal frequency * 10
226 /// @ingroup PC_Monitor_ToBeModified
227 /// @param  eWindow                 \b IN: which window we are going to get
228 /// @return MS_U16 horizontal frequency * 10
229 //-------------------------------------------------------------------------------------------------
230 MS_U16 MApi_XC_PCMonitor_Get_HFreqx10(SCALER_WIN eWindow);
231 
232 //-------------------------------------------------------------------------------------------------
233 /// Get horizontal frequency * 1000
234 /// @ingroup PC_Monitor_ToBeModified
235 /// @param  eWindow                 \b IN: which window we are going to get
236 /// @return MS_U32 horizontal frequency * 1000
237 //-------------------------------------------------------------------------------------------------
238 // MS_U32 MApi_XC_PCMonitor_Get_HFreqx1K(SCALER_WIN eWindow);
239 
240 //-------------------------------------------------------------------------------------------------
241 /// Get vertical frequency * 10
242 /// @ingroup PC_Monitor_ToBeModified
243 /// @param  eWindow                 \b IN: which window we are going to get
244 /// @return MS_U16 vertical frequency * 10
245 //-------------------------------------------------------------------------------------------------
246 MS_U16 MApi_XC_PCMonitor_Get_VFreqx10(SCALER_WIN eWindow);
247 
248 //-------------------------------------------------------------------------------------------------
249 /// Get vertical frequency * 1000
250 /// @ingroup PC_Monitor_ToBeModified
251 /// @param  eWindow                 \b IN: which window we are going to get
252 /// @return MS_U32 vertical frequency * 1000
253 //-------------------------------------------------------------------------------------------------
254 MS_U32 MApi_XC_PCMonitor_Get_VFreqx1K(SCALER_WIN eWindow);
255 
256 //-------------------------------------------------------------------------------------------------
257 /// Get vertical total line
258 /// @ingroup PC_Monitor_ToBeModified
259 /// @param  eWindow                 \b IN: which window we are going to get
260 /// @return MS_U16 vertical total line
261 //-------------------------------------------------------------------------------------------------
262 MS_U16 MApi_XC_PCMonitor_Get_Vtotal(SCALER_WIN eWindow);
263 
264 //-------------------------------------------------------------------------------------------------
265 /// Get DVI/HDMI DE information
266 /// @ingroup PC_Monitor_INFO
267 /// @param  eWindow                 \b IN: which window we are going to get
268 /// @param  msWin                    \b IN: DE window size
269 //-------------------------------------------------------------------------------------------------
270 void MApi_XC_PCMonitor_Get_Dvi_Hdmi_De_Info(SCALER_WIN eWindow,MS_WINDOW_TYPE* msWin);
271 
272 //-------------------------------------------------------------------------------------------------
273 /// Get sync loss status
274 /// @ingroup PC_Monitor_INFO
275 /// @param  eWindow                 \b IN: which window we are going to get
276 /// @return MS_BOOL
277 //-------------------------------------------------------------------------------------------------
278 MS_BOOL MApi_XC_PCMonitor_SyncLoss(SCALER_WIN eWindow);
279 
280 //-------------------------------------------------------------------------------------------------
281 /// Check the invalid timing
282 /// @ingroup PC_Monitor_INFO
283 /// @param  bPollingOnly            \b IN: enable polling only
284 /// @param  eWindow                 \b IN: which window we are going to get
285 /// @return MS_BOOL
286 //-------------------------------------------------------------------------------------------------
287 MS_BOOL MApi_XC_PCMonitor_InvalidTimingDetect(MS_BOOL bPollingOnly, SCALER_WIN eWindow);
288 
289 //-------------------------------------------------------------------------------------------------
290 /// PC monitor restart
291 /// @ingroup PC_Monitor_ToBeModified
292 /// @param  u16TimingStableCounter                 \b IN: stable counter
293 /// @param  u16TimingNosyncCounter                 \b IN: no signal counter
294 /// @return E_APIXC_ReturnValue
295 //-------------------------------------------------------------------------------------------------
296 E_APIXC_ReturnValue MApi_XC_PCMonitor_SetTimingCountEx( INPUT_SOURCE_TYPE_t eCurrentSrc, MS_U16 u16TimingStableCounter, MS_U16 u16TimingNosyncCounter);
297 
298 #ifdef __cplusplus
299 }
300 #endif
301 
302 #endif /* _API_XC_PC_MONITOR_H_ */
303