xref: /utopia/UTPA2-700.0.x/mxlib/include/drvDMD_INTERN_DVBT_v2.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 ///
97 /// @file   drvDMD_DVBT_INTERN.h
98 /// @brief  DVBT Driver Interface
99 /// @author MStar Semiconductor Inc.
100 ///////////////////////////////////////////////////////////////////////////////////////////////////
101 
102 #ifndef _DRV_DVBT_V2_H_
103 #define _DRV_DVBT_V2_H_
104 
105 //#include "MsCommon.h"
106 //#include "drvDMD_common.h"
107 #include "drvDMD_INTERN_DVBT.h"
108 #ifdef __cplusplus
109 extern "C"
110 {
111 #endif
112 //-------------------------------------------------------------------------------------------------
113 //  Driver Capability
114 //-------------------------------------------------------------------------------------------------
115 typedef enum {
116     DMD_DVBT_DRV_CMD_Init,
117     DMD_DVBT_DRV_CMD_Exit,
118     DMD_DVBT_DRV_CMD_SetDbgLeve,
119     DMD_DVBT_DRV_CMD_GetInfo,
120     DMD_DVBT_DRV_CMD_GetLibVer,
121     DMD_DVBT_DRV_CMD_GetFWVer,
122     DMD_DVBT_DRV_CMD_GetReg,
123     DMD_DVBT_DRV_CMD_SetReg,
124     DMD_DVBT_DRV_CMD_SetSerialControl,
125     DMD_DVBT_DRV_CMD_SetConfig,
126     DMD_DVBT_DRV_CMD_SetConfigHPLP,
127     DMD_DVBT_DRV_CMD_SetConfigHPLPSetIF,
128     DMD_DVBT_DRV_CMD_SetActive,
129     DMD_DVBT_DRV_CMD_GetLock,
130     DMD_DVBT_DRV_CMD_GetSignalStrength,
131     DMD_DVBT_DRV_CMD_GetSignalStrengthWithRFPower,
132     DMD_DVBT_DRV_CMD_GetSignalQuality,
133     DMD_DVBT_DRV_CMD_GetSignalQualityWithRFPower,
134     DMD_DVBT_DRV_CMD_GetSNR,
135     DMD_DVBT_DRV_CMD_GetPostViterbiBer,
136     DMD_DVBT_DRV_CMD_GetPreViterbiBer,
137     DMD_DVBT_DRV_CMD_GetPacketErr,
138     DMD_DVBT_DRV_CMD_GetTPSInfo,
139     DMD_DVBT_DRV_CMD_GetCellID,
140     DMD_DVBT_DRV_CMD_GetFreqOffset,
141     DMD_DVBT_DRV_CMD_NORDIGSSITableWrite,
142     DMD_DVBT_DRV_CMD_NORDIGSSITableRead,
143     DMD_DVBT_DRV_CMD_SetPowerState,
144 
145     DMD_DVBT_DRV_CMD_GetIFAGC
146 } DMD_DVBT_DRV_COMMAND;
147 /// For demod init
148 typedef struct DLL_PACKED _DMD_DVBT_InitData_Transform
149 {
150     // tuner parameter
151     MS_U8 u8SarChannel;
152     /*
153     DMD_RFAGC_SSI *pTuner_RfagcSsi;
154     MS_U16 u16Tuner_RfagcSsi_Size;
155     DMD_IFAGC_SSI *pTuner_IfagcSsi_LoRef;
156     MS_U16 u16Tuner_IfagcSsi_LoRef_Size;
157     DMD_IFAGC_SSI *pTuner_IfagcSsi_HiRef;
158     MS_U16 u16Tuner_IfagcSsi_HiRef_Size;
159     DMD_IFAGC_ERR *pTuner_IfagcErr_LoRef;
160     MS_U16 u16Tuner_IfagcErr_LoRef_Size;
161     DMD_IFAGC_ERR *pTuner_IfagcErr_HiRef;
162     MS_U16 u16Tuner_IfagcErr_HiRef_Size;
163     DMD_SQI_CN_NORDIGP1 *pSqiCnNordigP1;
164     MS_U16 u16SqiCnNordigP1_Size;
165     */
166 
167     // register init
168     MS_U8 *u8DMD_DVBT_DSPRegInitExt; // TODO use system variable type
169     MS_U8 u8DMD_DVBT_DSPRegInitSize;
170     MS_U8 *u8DMD_DVBT_InitExt; // TODO use system variable type
171 } DMD_DVBT_InitData_Transform;
172 
173 typedef struct DLL_PACKED _DVBT_EXIT_PARAM
174 {
175 	MS_BOOL ret;
176 }DVBT_EXIT_PARAM, *PDVBT_EXIT_PARAM;
177 
178 typedef struct DLL_PACKED _DVBT_SETDBG_LEVEL_PARAM
179 {
180     DMD_DbgLv u8DbgLevel;
181     MS_BOOL ret;
182 } DVBT_SETDBG_LEVEL_PARAM, *PDVBT_SETDBG_LEVEL_PARAM;
183 
184 typedef struct DLL_PACKED _DVBT_INIT_PARAM
185 {
186     DMD_DVBT_InitData_Transform *DMD_DVBT_InitData;
187     MS_U32 u32InitDataLen;
188 	MS_BOOL ret;
189 } DVBT_INIT_PARAM, *PDVBT_INIT_PARAM;
190 
191 typedef struct DLL_PACKED _DVBT_GETINFO_PARAM
192 {
193     DMD_DVBT_INFO_TYPE eInfoType;
194 	DMD_DVBT_Info* pInfo;
195 	MS_BOOL ret;
196 } DVBT_GETINFO_PARAM, *PDVBT_GETINFO_PARAM;
197 
198 /*
199 typedef struct _DVBT_GETINFO_RETURN_PARAM
200 {
201     DMD_DVBT_Info* pInfo;
202 } DVBT_GETINFO_RETURN_PARAM, *PDVBT_GETINFO_RETURN_PARAM;
203 */
204 typedef struct DLL_PACKED _DVBT_GETLIBVER_PARAM
205 {
206     const MSIF_Version **ppVersion;
207     MS_BOOL ret;
208 } DVBT_GETLIBVER_PARAM, *PDVBT_GETLIBVER_PARAM;
209 
210 typedef struct DLL_PACKED _DVBT_GETFWVER_PARAM
211 {
212     MS_U16 *ver;
213    MS_BOOL ret;
214 } DVBT_GETFWVER_PARAM, *PDVBT_GETFWVER_PARAM;
215 
216 typedef struct DLL_PACKED _DVBT_GETREG_PARAM
217 {
218     MS_U16 u16Addr;
219     MS_U8 *pu8Data;
220    MS_BOOL ret;
221 } DVBT_GETREG_PARAM, *PDVBT_GETREG_PARAM;
222 
223 typedef struct DLL_PACKED _DVBT_SETREG_PARAM
224 {
225     MS_U16 u16Addr;
226     MS_U8 u8Data;
227    MS_BOOL ret;
228 } DVBT_SETREG_PARAM, *PDVBT_SETREG_PARAM;
229 
230 typedef struct DLL_PACKED _DVBT_SetSerialControl_PARAM
231 {
232     MS_BOOL bEnable;
233     MS_BOOL ret;
234 } DVBT_SetSerialControl_PARAM, *PDVBT_SetSerialControl_PARAM;
235 
236 typedef struct DLL_PACKED _DVBT_SetConfig_PARAM
237 {
238     DMD_RF_CHANNEL_BANDWIDTH BW;
239     MS_BOOL bSerialTS;
240     MS_BOOL bPalBG;
241     MS_BOOL ret;
242 } DVBT_SetConfig_PARAM, *PDVBT_SetConfig_PARAM;
243 
244 typedef struct DLL_PACKED _DVBT_SetConfigHPLP_PARAM
245 {
246     DMD_RF_CHANNEL_BANDWIDTH BW;
247     MS_BOOL bSerialTS;
248     MS_BOOL bPalBG;
249     MS_BOOL bLPSel;
250     MS_BOOL ret;
251 } DVBT_SetConfigHPLP_PARAM, *PDVBT_SetConfigHPLP_PARAM;
252 
253 typedef struct DLL_PACKED _DVBT_SetConfigHPLPSetIF_PARAM
254 {
255     DMD_RF_CHANNEL_BANDWIDTH BW;
256     MS_BOOL bSerialTS;
257     MS_BOOL bPalBG;
258     MS_BOOL bLPSel;
259     MS_U32 u32IFFreq;
260     MS_U32 u32FSFreq;
261     MS_U8 u8IQSwap;
262     MS_BOOL ret;
263 } DVBT_SetConfigHPLPSetIF_PARAM, *PDVBT_SetConfigHPLPSetIF_PARAM;
264 
265 typedef struct DLL_PACKED _DVBT_SetActive_PARAM
266 {
267     MS_BOOL bEnable;
268     MS_BOOL ret;
269 } DVBT_SetActive_PARAM, *PDVBT_SetActive_PARAM;
270 
271 typedef struct DLL_PACKED _DVBT_GetLock_PARAM
272 {
273     DMD_DVBT_GETLOCK_TYPE eType;
274     DMD_LOCK_STATUS *eLockStatus;
275     MS_BOOL ret;
276 } DVBT_GetLock_PARAM, *PDVBT_GetLock_PARAM;
277 
278 typedef struct DLL_PACKED _DVBT_GetSignalStrength_PARAM
279 {
280     MS_U16 *u16Strength;
281     MS_BOOL ret;
282 } DVBT_GetSignalStrength_PARAM, *PDVBT_GetSignalStrength_PARAM;
283 
284 /*bryan temp mark*/
285 #if(0)
286 typedef struct _DVBT_GetSignalStrengthWithRFPower_PARAM
287 {
288     MS_U16 *u16Strength;
289     float fRFPowerDbm;
290     MS_BOOL ret;
291 } DVBT_GetSignalStrengthWithRFPower_PARAM, *PDVBT_GetSignalStrengthWithRFPower_PARAM;
292 #endif
293 
294 typedef struct DLL_PACKED _DVBT_GetSignalQuality_PARAM
295 {
296     MS_U16 *u16Quality;
297     MS_BOOL ret;
298 } DVBT_GetSignalQuality_PARAM, *PDVBT_GetSignalQuality_PARAM;
299 
300 typedef struct DLL_PACKED _DVBT_GetSignalQualityWithRFPower_PARAM
301 {
302     MS_U16 *u16Quality;
303     float fRFPowerDbm;
304     MS_BOOL ret;
305 } DVBT_GetSignalQualityWithRFPower_PARAM, *PDVBT_GetSignalQualityWithRFPower_PARAM;
306 
307 
308 typedef struct _DVBT_GetSNR_PARAM
309 {
310     MS_U32 *noise_power_reg;
311     MS_BOOL ret;
312 } DVBT_GetSNR_PARAM, *PDVBT_GetSNR_PARAM;
313 
314 
315 typedef struct _DVBT_GetIFAGC_PARAM
316 {
317 	MS_U8 *ifagc_reg;
318 	MS_U8 *ifagc_reg_lsb;
319 	MS_U16 *ifagc_err_reg;
320 	MS_BOOL ret;
321 }DVBT_GetIFAGC_PARAM,*PDVBT_GetIFAGC_PARAM;
322 
323 
324 typedef struct _DVBT_GetPostViterbiBer_PARAM
325 {
326 	MS_U32 *BitErr_reg;
327 	MS_U16 *BitErrPeriod_reg;
328 	MS_U16 *PktErr_reg;
329 	MS_BOOL ret;
330 } DVBT_GetPostViterbiBer_PARAM, *PDVBT_GetPostViterbiBer_PARAM;
331 
332 
333 #if(0)
334 typedef struct _DVBT_GetPreViterbiBer_PARAM
335 {
336     float *ber;
337     MS_BOOL ret;
338 } DVBT_GetPreViterbiBer_PARAM, *PDVBT_GetPreViterbiBer_PARAM;
339 #endif
340 
341 typedef struct DLL_PACKED _DVBT_GetPacketErr_PARAM
342 {
343     MS_U16 *pktErr;
344     MS_BOOL ret;
345 } DVBT_GetPacketErr_PARAM, *PDVBT_GetPacketErr_PARAM;
346 
347 typedef struct DLL_PACKED _DVBT_GetTPSInfo_PARAM
348 {
349     MS_U16 *u16Info;
350     MS_BOOL ret;
351 } DVBT_GetTPSInfo_PARAM, *PDVBT_GetTPSInfo_PARAM;
352 
353 typedef struct DLL_PACKED _DVBT_GetCellID_PARAM
354 {
355     MS_U16 *u16CellID;
356     MS_BOOL ret;
357 } DVBT_GetCellID_PARAM, *PDVBT_GetCellID_PARAM;
358 
359 /*bryan temp mark*/
360 #if(0)
361 typedef struct _DVBT_GetFreqOffset_PARAM
362 {
363     float *pFreqOff;
364     MS_BOOL ret;
365 } DVBT_GetFreqOffset_PARAM, *PDVBT_GetFreqOffset_PARAM;
366 #endif
367 
368 /*bryan temp mark*/
369 #if(0)
370 typedef struct _DVBT_NORDIGSSITableWrite_PARAM
371 {
372     DMD_CONSTEL constel;
373     DMD_CODERATE code_rate;
374     float write_value;
375     MS_BOOL ret;
376 } DVBT_NORDIGSSITableWrite_PARAM, *PDVBT_NORDIGSSITableWrite_PARAM;
377 
378 typedef struct DLL_PACKED _DVBT_NORDIGSSITableRead_PARAM
379 {
380     DMD_CONSTEL constel;
381     DMD_CODERATE code_rate;
382     float *read_value;
383     MS_BOOL ret;
384 } DVBT_NORDIGSSITableRead_PARAM, *PDVBT_NORDIGSSITableRead_PARAM;
385 #endif
386 
387 typedef struct DLL_PACKED _DVBT_SetPowerState_PARAM
388 {
389     EN_POWER_MODE u16PowerState;
390     MS_BOOL ret;
391 } DVBT_SetPowerState_PARAM, *PDVBT_SetPowerState_PARAM;
392 
393 
394 /*******kernel mode transform structure***************/
395 
396 
397 
398 
399 
400 /*************************************************/
401 
402 
403 MS_U32 DVBTOpen(void** pInstantTmp, MS_U32 u32ModuleVersion, void* pAttribute);
404 MS_U32 DVBTClose(void* pInstantTmp);
405 MS_U32 DVBTIoctl(void* pInstantTmp, MS_U32 u32Cmd, void* pArgs);
406 //MS_U32 DVBTStr(MS_U32 u32PowerState, void* pModule);
407 
408 
409 #ifdef __cplusplus
410 }
411 #endif
412 
413 #endif // _DRV_DVBT_H_
414 
415