xref: /utopia/UTPA2-700.0.x/modules/vif/drv/vif/VIF.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) 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 #ifndef _VIF_H_
97 #define _VIF_H_
98 
99 #ifdef __cplusplus
100 extern "C"
101 {
102 #endif
103 
104 #include "MsCommon.h"
105 #include "MsIRQ.h"
106 #include "MsOS.h"
107 #include "MsTypes.h"
108 
109 #include "drvVIF_v2.h"
110 
111 //****************************************************************************
112 // Public attributes.
113 //****************************************************************************
114 
115 #ifdef _VIF_C_
116 #define INTERFACE
117 #else
118 #define INTERFACE extern
119 #endif
120 
121 typedef struct
122 {
123     BYTE Vif_Clamp_L;
124     BYTE Vif_Clamp_H;
125     BYTE Vif_Clamp_Gain_L;
126     BYTE Vif_Clamp_Gain_H;
127 
128     BYTE Vif_Cr_Rate_1;
129     BYTE Vif_Cr_Rate_2;
130     BYTE Vif_Cr_Rate_3;
131     BYTE Vif_Cr_Rate_Inv;
132 
133     BYTE Vif_N_A1_C0_L;
134     BYTE Vif_N_A1_C0_H;
135     BYTE Vif_N_A1_C1_L;
136     BYTE Vif_N_A1_C1_H;
137     BYTE Vif_N_A1_C2_L;
138     BYTE Vif_N_A1_C2_H;
139     BYTE Vif_N_A2_C0_L;
140     BYTE Vif_N_A2_C0_H;
141     BYTE Vif_N_A2_C1_L;
142     BYTE Vif_N_A2_C1_H;
143     BYTE Vif_N_A2_C2_L;
144     BYTE Vif_N_A2_C2_H;
145 
146     BYTE Vif_SOS_11_C0_L;
147     BYTE Vif_SOS_11_C0_H;
148     BYTE Vif_SOS_11_C1_L;
149     BYTE Vif_SOS_11_C1_H;
150     BYTE Vif_SOS_11_C2_L;
151     BYTE Vif_SOS_11_C2_H;
152     BYTE Vif_SOS_11_C3_L;
153     BYTE Vif_SOS_11_C3_H;
154     BYTE Vif_SOS_11_C4_L;
155     BYTE Vif_SOS_11_C4_H;
156     BYTE Vif_SOS_12_C0_L;
157     BYTE Vif_SOS_12_C0_H;
158     BYTE Vif_SOS_12_C1_L;
159     BYTE Vif_SOS_12_C1_H;
160     BYTE Vif_SOS_12_C2_L;
161     BYTE Vif_SOS_12_C2_H;
162     BYTE Vif_SOS_12_C3_L;
163     BYTE Vif_SOS_12_C3_H;
164     BYTE Vif_SOS_12_C4_L;
165     BYTE Vif_SOS_12_C4_H;
166 
167     BYTE VifSos21FilterC0_L;
168     BYTE VifSos21FilterC0_H;
169     BYTE VifSos21FilterC1_L;
170     BYTE VifSos21FilterC1_H;
171     BYTE VifSos21FilterC2_L;
172     BYTE VifSos21FilterC2_H;
173     BYTE VifSos21FilterC3_L;
174     BYTE VifSos21FilterC3_H;
175     BYTE VifSos21FilterC4_L;
176     BYTE VifSos21FilterC4_H;
177     BYTE VifSos22FilterC0_L;
178     BYTE VifSos22FilterC0_H;
179     BYTE VifSos22FilterC1_L;
180     BYTE VifSos22FilterC1_H;
181     BYTE VifSos22FilterC2_L;
182     BYTE VifSos22FilterC2_H;
183     BYTE VifSos22FilterC3_L;
184     BYTE VifSos22FilterC3_H;
185     BYTE VifSos22FilterC4_L;
186     BYTE VifSos22FilterC4_H;
187     BYTE VifSos31FilterC0_L;
188     BYTE VifSos31FilterC0_H;
189     BYTE VifSos31FilterC1_L;
190     BYTE VifSos31FilterC1_H;
191     BYTE VifSos31FilterC2_L;
192     BYTE VifSos31FilterC2_H;
193     BYTE VifSos31FilterC3_L;
194     BYTE VifSos31FilterC3_H;
195     BYTE VifSos31FilterC4_L;
196     BYTE VifSos31FilterC4_H;
197     BYTE VifSos32FilterC0_L;
198     BYTE VifSos32FilterC0_H;
199     BYTE VifSos32FilterC1_L;
200     BYTE VifSos32FilterC1_H;
201     BYTE VifSos32FilterC2_L;
202     BYTE VifSos32FilterC2_H;
203     BYTE VifSos32FilterC3_L;
204     BYTE VifSos32FilterC3_H;
205     BYTE VifSos32FilterC4_L;
206     BYTE VifSos32FilterC4_H;
207 
208     BYTE Vif_Agc_Ref;
209     BYTE Vif_CR_K_Sel;
210     BYTE Vif_CR_KpKi;
211 }VIFSTRParameter;
212 
213 //****************************************************************************
214 // Public functions.
215 //****************************************************************************
216 INTERFACE void VIF_Version(void);
217 INTERFACE void VIF_SetClock(BOOL bEnable);
218 INTERFACE void VIF_Init(VIFInitialIn * pVIF_InitData, DWORD u32InitDataLen);
219 INTERFACE void VIF_Exit(void);
220 INTERFACE void VIF_Reset(void);
221 INTERFACE void VIF_Handler(BOOL bAutoScan);
222 INTERFACE void VIF_SetSoundSystem(VIFSoundSystem ucSoundSystem);
223 INTERFACE void VIF_SetIfFreq(IfFrequencyType u16IfFreq);
224 INTERFACE U8 VIF_Read_CR_FOE(void);
225 INTERFACE U8 VIF_Read_CR_LOCK_STATUS(void);
226 INTERFACE void VIF_BypassDBBAudioFilter(BOOL bEnable);
227 INTERFACE void VIF_SetFreqBand(FrequencyBand u8FreqBand);
228 INTERFACE BOOL VIF_GetInputLevelIndicator(void);
229 INTERFACE BOOL VIF_SetParameter(VIF_PARA_GROUP paraGroup, void * pVIF_Para, DWORD u32DataLen);
230 INTERFACE void VIF_ShiftClk(BYTE VifShiftClk);
231 INTERFACE MS_U32 VIF_SetPowerState(EN_POWER_MODE u16PowerState);
232 INTERFACE void VIF_WriteByte(U32 u32Reg, U8 u8Val );
233 INTERFACE U8 VIF_ReadByte(U32 u32Reg );
234 
235 
236 //-------------------------------- functions ------------------------------------------------------------
237 
238 typedef void (*IOCTL_VIF_Version)(void);
239 typedef void (*IOCTL_VIF_SetClock)(BOOL);
240 typedef void (*IOCTL_VIF_Init)(VIFInitialIn *, DWORD);
241 typedef void (*IOCTL_VIF_Exit)(void);
242 typedef void (*IOCTL_VIF_Reset)(void);
243 typedef void (*IOCTL_VIF_Handler)(BOOL);
244 typedef void (*IOCTL_VIF_SetSoundSystem)(VIFSoundSystem);
245 typedef void (*IOCTL_VIF_SetIfFreq)(IfFrequencyType);
246 typedef U8 (*IOCTL_VIF_CR_FOE)(void);
247 typedef U8 (*IOCTL_VIF_LOCK_STATUS)(void);
248 typedef void (*IOCTL_VIF_Bypass_DBBAudioFilter)(BOOL);
249 typedef void (*IOCTL_VIF_SetFreqBand)(FrequencyBand);
250 typedef BOOL (*IOCTL_VIF_GetInputLevelIndicator)(void);
251 typedef BOOL (*IOCTL_VIF_SetParameter)(VIF_PARA_GROUP, void *, DWORD);
252 typedef void (*IOCTL_VIF_ShiftClk)(BYTE);
253 typedef MS_U32 (*IOCTL_VIF_SetPowerState)(EN_POWER_MODE);
254 typedef void (*IOCTL_VIF_WriteByte)(U32, U8);
255 typedef U8 (*IOCTL_VIF_ReadByte)(U32);
256 
257 
258 typedef struct _VIF_INSTANT_PRIVATE
259 {
260     IOCTL_VIF_Version                                  fpVIFVersion;
261     IOCTL_VIF_SetClock                                fpVIFSetClock;
262     IOCTL_VIF_Init                                        fpVIFInit;
263     IOCTL_VIF_Exit                                        fpVIFExit;
264     IOCTL_VIF_Reset                                     fpVIFReset;
265     IOCTL_VIF_Handler                                  fpVIFHandler;
266     IOCTL_VIF_SetSoundSystem                     fpVIFSetSoundSystem;
267     IOCTL_VIF_SetIfFreq                                fpVIFSetIfFreq;
268     IOCTL_VIF_CR_FOE                                  fpVIFCRFOE;
269     IOCTL_VIF_LOCK_STATUS                        fpVIFLOCKSTATUS;
270     IOCTL_VIF_Bypass_DBBAudioFilter            fpVIFBypassDBBAudioFilter;
271     IOCTL_VIF_SetFreqBand                           fpVIFSetFreqBand;
272     IOCTL_VIF_GetInputLevelIndicator             fpVIFGetInputLevelIndicator;
273     IOCTL_VIF_SetParameter                          fpVIFSetParameter;
274     IOCTL_VIF_ShiftClk                                  fpVIFShiftClk;
275     IOCTL_VIF_SetPowerState                        fpVIFSetPowerState;
276     IOCTL_VIF_WriteByte                               fpVIFWriteByte;
277     IOCTL_VIF_ReadByte                               fpVIFReadBtye;
278 
279 }VIF_INSTANT_PRIVATE;
280 
281 
282 void VIFRegisterToUtopia(void);
283 MS_U32 VIFOpen(void** pInstantTmp, MS_U32 u32ModuleVersion, void* pAttribute);
284 MS_U32 VIFClose(void* pInstantTmp);
285 MS_U32 VIFIoctl(void* pInstantTmp, MS_U32 u32Cmd, void* pArgs);
286 MS_U32 VIFStr(MS_U32 u32PowerState, void* pModule);
287 
288 
289 #undef INTERFACE
290 
291 #ifdef __cplusplus
292 }
293 #endif
294 
295 #endif //_VIF_H_
296 
297