xref: /utopia/UTPA2-700.0.x/projects/tmplib/include/drvDAC.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-2007 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   drvDAC.h
98 /// @author MStar Semiconductor Inc.
99 /// @brief  DAC Driver Interface
100 ///////////////////////////////////////////////////////////////////////////////////////////////////
101 
102 #ifndef _DRV_DAC_H_
103 #define _DRV_DAC_H_
104 
105 
106 #ifdef __cplusplus
107 extern "C"
108 {
109 #endif
110 
111 //-------------------------------------------------------------------------------------------------
112 //  Driver Capability
113 //-------------------------------------------------------------------------------------------------
114 
115 
116 //-------------------------------------------------------------------------------------------------
117 //  Macro and Define
118 //-------------------------------------------------------------------------------------------------
119 
120 //-------------------------------------------------------------------------------------------------
121 //  Type and Structure
122 //-------------------------------------------------------------------------------------------------
123 typedef enum
124 {
125     RES_720x480I_60Hz = 0,
126     RES_720x480P_60Hz,
127     RES_720x576I_50Hz,
128     RES_720x576P_50Hz,
129     RES_1280x720P_50Hz,
130     RES_1280x720P_60Hz,
131     RES_1920x1080I_50Hz,
132     RES_1920x1080I_60Hz,
133     RES_1920x1080P_50Hz,
134     RES_1920x1080P_60Hz,
135     RES_1920x1080P_24Hz,
136     RES_1920x1080P_25Hz,
137     RES_1920x1080P_30Hz,
138     RES_640x480P_60Hz,
139     RES_VGA640x480P_60Hz,
140     RES_TTL480X272P_60Hz,
141 } EN_OUTPUT_VIDEO_TIMING_TYPE;
142 
143 typedef enum
144 {
145     COLOR_8_BIT,
146     COLOR_10_BIT,
147     COLOR_12_BIT,
148 }EN_OUTPUT_BIT_TYPE;
149 
150 typedef enum
151 {
152     DAC_CLK_FROM_DISP,
153     DAC_CLK_FROM_VEDAC,
154     DAC_CLK_FROM_DVBC_INN,
155     DAC_CLK_FROM_DVBC_EQ,
156     DAC_CLK_FROM_ADCD_D,
157     DAC_CLK_FROM_DFT,
158 } EN_DAC_CLK_TYPE;
159 
160 typedef enum
161 {
162     DAC_TO_HDGEN = 0,   //HD Gen output
163     DAC_TO_VE = 1,      //VE output (CVBS + S-Video)
164     DAC_TO_VE_YPBPR =3  //VE output (Y/Pb/Pr)
165 } EN_DAC_OUTPUT_TYPE;
166 
167 typedef enum
168 {
169     DAC_R_G_B = 0,
170     DAC_R_B_G = 1,
171     DAC_G_R_B = 2,
172     DAC_B_G_R = 4,
173     DAC_G_B_R = 5,
174     DAC_B_R_G = 6,
175     DAC_R_R_R = 7,
176 } EN_DAC_SWAP_SEL;
177 
178 typedef enum
179 {
180     DAC_OUTPUT_LEVEL_HIGH = 0,  //1.3V
181     DAC_OUTPUT_LEVEL_LOW = 1    //1V
182 } EN_DAC_MAX_OUTPUT_LEVEL;
183 
184 typedef enum
185 {
186     DAC_SD_OFF =0,
187     DAC_SD_X = 1,
188     DAC_SD_Y = 2,
189     DAC_SD_XY = 3,
190     DAC_SD_C = 4,
191     DAC_SD_XC = 5,
192     DAC_SD_YC = 6,
193     DAC_SD_XYC = 7,
194 
195 }EN_DAC_SD_ENABLE_CTRL;
196 
197 typedef enum
198 {
199     DAC_HD_OFF =0,
200     DAC_HD_R = 1,
201     DAC_HD_G = 2,
202     DAC_HD_RG = 3,
203     DAC_HD_B = 4,
204     DAC_HD_RB = 5,
205     DAC_HD_GB = 6,
206     DAC_HD_RGB = 7,
207 
208 }EN_DAC_HD_ENABLE_CTRL;
209 
210 typedef enum
211 {
212     DAC_DETECT_PLUGIN,       //Detect  Plug_IN
213     DAC_DETECT_PLUGOUT,     // Detect Plug_OUT
214 }EN_DAC_DETECT_TYPE;
215 
216 typedef enum
217 {
218     DAC_DETECT_HD,       //Detect HD_DAC
219     DAC_DETECT_SD,     // Detect SD_DAC
220 }EN_DAC_DETECT;
221 
222 //-------------------------------------------------------------------------------------------------
223 //  Function Prototype
224 //-------------------------------------------------------------------------------------------------
225 #ifdef MDRV_DAC_C
226 #define MDRV_INTERFACE
227 #else
228 #define MDRV_INTERFACE extern
229 #endif
230 
231 MDRV_INTERFACE void MDrv_DAC_SetIOMapBase(MS_VIRT virtNPMBase, MS_VIRT virtPMBase);
232 MDRV_INTERFACE void MDrv_DAC_Init(void);
233 MDRV_INTERFACE void MDrv_DAC_Enable(MS_BOOL bEnable, MS_BOOL bIsYPbPr);
234 MDRV_INTERFACE void MDrv_DAC_SetClkInv(MS_BOOL bEnable, MS_BOOL bIsYPbPr);
235 MDRV_INTERFACE void MDrv_DAC_SetOutputSource(EN_DAC_OUTPUT_TYPE enOutputType, MS_BOOL bIsYPbPr);
236 MDRV_INTERFACE void MDrv_DAC_SetOutputLevel(EN_DAC_MAX_OUTPUT_LEVEL enLevel, MS_BOOL bIsYPbPr);
237 MDRV_INTERFACE void MDrv_DAC_SetOutputSwapSel(EN_DAC_SWAP_SEL enSwap,MS_BOOL bIsYPbPr);
238 MDRV_INTERFACE void MDrv_DAC_SetOutputTiming(EN_OUTPUT_VIDEO_TIMING_TYPE enTiming);
239 MDRV_INTERFACE void MDrv_ClkSel_Set(EN_OUTPUT_VIDEO_TIMING_TYPE enTiming, EN_OUTPUT_BIT_TYPE enBits);
240 MDRV_INTERFACE void MDrv_DAC_OnOffSD(EN_DAC_SD_ENABLE_CTRL enBit);
241 MDRV_INTERFACE void MDrv_DAC_OnOffHD(EN_DAC_HD_ENABLE_CTRL enBit);
242 MDRV_INTERFACE void MDrv_DAC_Exit(void);
243 MDRV_INTERFACE void MDrv_DAC_DumpTable(MS_U8 * pTCONTable, MS_U8 u8Tcontype);
244 
245 //----------------------------------------------------------------
246 // DAC - set half output current
247 // @return none
248 //----------------------------------------------------------------
249 MDRV_INTERFACE void MDrv_DAC_SetIHalfOutput(MS_BOOL bEnable, MS_BOOL bIsYPbPr);
250 
251 //----------------------------------------------------------------
252 // DAC - set half output current
253 // @return none
254 //----------------------------------------------------------------
255 MDRV_INTERFACE void MDrv_DAC_SetQuartOutput(MS_BOOL bEnable, MS_BOOL bIsYPbPr);
256 
257 //----------------------------------------------------------------
258 // MDrv_DAC_SetDACState - Set DAC init state
259 // @param: bEnable: TRUE for DAC is initialized, FALSE for not initialized
260 // @param: bIsYPbPr: TRUE for YPbPr, FALSE for CVBS
261 // @return none
262 //----------------------------------------------------------------
263 MDRV_INTERFACE void MDrv_DAC_SetDACState(MS_BOOL bEnable, MS_BOOL bIsYPbPr);
264 
265 //----------------------------------------------------------------
266 // MDrv_DAC_GetDACState - Get DAC init state
267 // @param: bIsYPbPr: TRUE for YPbPr, FALSE for CVBS
268 // @return: TRUE is DAC is initialized
269 //----------------------------------------------------------------
270 MDRV_INTERFACE MS_BOOL MDrv_DAC_GetDACState(MS_BOOL bIsYPbPr);
271 
272 //----------------------------------------------------------------
273 // MDrv_DAC_HotPlugDetect - Get DAC HotPlug state
274 // @param: SelDAC: DAC_DETECT_HD, DAC_DETECT_SD
275 // @param: DetectType: DAC_DETECT_PLUGIN, DAC_DETECT_PLUGOUT
276 // @param: bIsSignIn: Report signal is in/out
277 // @return: TRUE is working successful
278 //----------------------------------------------------------------
279 MDRV_INTERFACE MS_BOOL MDrv_DAC_HotPlugDetect(EN_DAC_DETECT SelDAC, EN_DAC_DETECT_TYPE DetectType, MS_BOOL *State);
280 
281 #ifdef __cplusplus
282 }
283 #endif
284 
285 #endif // _DRV_HDMITX_H_
286 
287