xref: /utopia/UTPA2-700.0.x/mxlib/include/drvDMD_INTERN_DVBT2_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_DVBT2_V2_H_
103 #define _DRV_DVBT2_V2_H_
104 
105 //#include "MsCommon.h"
106 //#include "drvDMD_common.h"
107 #include "drvDMD_INTERN_DVBT2.h"
108 #ifdef __cplusplus
109 extern "C"
110 {
111 #endif
112 //-------------------------------------------------------------------------------------------------
113 //  Driver Capability
114 //-------------------------------------------------------------------------------------------------
115 typedef enum {
116     DMD_DVBT2_DRV_CMD_Init                        ,
117     DMD_DVBT2_DRV_CMD_Exit                        ,
118     DMD_DVBT2_DRV_CMD_SetDbgLevel                 ,
119     DMD_DVBT2_DRV_CMD_GetInfo                     ,
120     DMD_DVBT2_DRV_CMD_GetLibVer                   ,
121     DMD_DVBT2_DRV_CMD_GetFWVer                    ,
122     DMD_DVBT2_DRV_CMD_GetReg                      ,
123     DMD_DVBT2_DRV_CMD_SetReg                      ,
124     DMD_DVBT2_DRV_CMD_SetSerialControl            ,
125     DMD_DVBT2_DRV_CMD_SetReset                    ,
126     DMD_DVBT2_DRV_CMD_SetConfig                   ,
127     DMD_DVBT2_DRV_CMD_SetActive                   ,
128     DMD_DVBT2_DRV_CMD_GetLock                     ,
129 //    DMD_DVBT2_DRV_CMD_GetSignalStrengthWithRFPower,
130 //    DMD_DVBT2_DRV_CMD_GetSignalQualityWithRFPower ,
131     DMD_DVBT2_DRV_CMD_GetSNR                      ,
132     DMD_DVBT2_DRV_CMD_GetPostLdpcBer              ,
133     DMD_DVBT2_DRV_CMD_GetPreLdpcBer               ,
134     DMD_DVBT2_DRV_CMD_GetPacketErr                ,
135     DMD_DVBT2_DRV_CMD_GetL1Info                   ,
136     DMD_DVBT2_DRV_CMD_GetFreqOffset               ,
137     DMD_DVBT2_DRV_CMD_NORDIG_SSI_Table_Write      ,
138     DMD_DVBT2_DRV_CMD_NORDIG_SSI_Table_Read       ,
139     DMD_DVBT2_DRV_CMD_SetPowerState               ,
140     DMD_DVBT2_DRV_CMD_GetPlpBitMap                ,
141     DMD_DVBT2_DRV_CMD_GetPlpGroupID								,
142     DMD_DVBT2_DRV_CMD_SetPlpID                    ,
143 
144 } DMD_DVBT2_DRV_COMMAND;
145 /// For demod init
146 
147 
148 typedef struct DLL_PACKED _DMD_DVBT2_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_DVBT2_DSPRegInitExt; // TODO use system variable type
169     MS_U8 u8DMD_DVBT2_DSPRegInitSize;
170     MS_U8 *u8DMD_DVBT2_InitExt; // TODO use system variable type
171 
172     MS_U32  u32EqStartAddr;
173     MS_U32  u32TdiStartAddr;
174     MS_U32  u32DjbStartAddr;
175     MS_U32  u32FwStartAddr;
176 } DMD_DVBT2_InitData_Transform;
177 
178 
179 typedef struct DLL_PACKED _DVBT2_INIT_PARAM
180 {
181 	DMD_DVBT2_InitData_Transform *pDMD_DVBT2_InitData;
182 	MS_U32 u32InitDataLen;
183 	MS_BOOL ret;
184 }DVBT2_INIT_PARAM, *PDVBT2_INIT_PARAM;
185 
186 
187 typedef struct DLL_PACKED _DVBT2_EXIT_PARAM
188 {
189 	MS_BOOL ret;
190 }DVBT2_EXIT_PARAM, *PDVBT2_EXIT_PARAM;
191 
192 
193 typedef struct DLL_PACKED _DVBT2_SETDBGLEVEL_PARAM
194 {
195 	DMD_T2_DbgLv u8DbgLevel;
196 	MS_BOOL ret;
197 }DVBT2_SETDBGLEVEL_PARAM, *PDVBT2_SETDBGLEVEL_PARAM;
198 
199 typedef struct DLL_PACKED _DVBT2_GETINFO_PARAM
200 {
201 	DMD_DVBT2_INFO_TYPE eInfoType;
202 	DMD_DVBT2_Info* pInfo;
203 	MS_BOOL ret;
204 }DVBT2_GETINFO_PARAM, *PDVBT2_GETINFO_PARAM;
205 
206 
207 typedef struct DLL_PACKED _DVBT2_GETLIBVER_PARAM
208 {
209 	const MSIF_Version **ppVersion;
210 	MS_BOOL ret;
211 }DVBT2_GETLIBVER_PARAM, *PDVBT2_GETLIBVER_PARAM;
212 
213 
214 typedef struct DLL_PACKED _DVBT2_GETFWVER_PARAM
215 {
216 	MS_U16 *ver;
217 	MS_BOOL ret;
218 }DVBT2_GETFWVER_PARAM, *PDVBT2_GETFWVER_PARAM;
219 
220 typedef struct DLL_PACKED _DVBT2_GETREG_PARAM
221 {
222 	MS_U16 u16Addr;
223 	MS_U8 *pu8Data;
224 	MS_BOOL ret;
225 }DVBT2_GETREG_PARAM, *PDVBT2_GETREG_PARAM;
226 
227 typedef struct DLL_PACKED _DVBT2_SETREG_PARAM
228 {
229 	MS_U16 u16Addr;
230 	MS_U8 u8Data;
231 	MS_BOOL ret;
232 }DVBT2_SETREG_PARAM, *PDVBT2_SETREG_PARAM;
233 
234 typedef struct DLL_PACKED _DVBT2_SETSERIALCONTROL_PARAM
235 {
236 	MS_BOOL bEnable;
237 	MS_BOOL ret;
238 }DVBT2_SETSERIALCONTROL_PARAM,*PDVBT2_SETSERIALCONTROL_PARAM;
239 
240 typedef struct DLL_PACKED _DVBT2_SETCONFIG_PARAM
241 {
242 	DMD_DVBT2_RF_CHANNEL_BANDWIDTH BW;
243 	MS_BOOL bSerialTS;
244        MS_U8 u8PlpID;
245 	MS_BOOL ret;
246 }DVBT2_SETCONFIG_PARAM,*PDVBT2_SETCONFIG_PARAM;
247 
248 typedef struct DLL_PACKED _DVBT2_SETACTIVE_PARAM
249 {
250 	MS_BOOL bEnable;
251 	MS_BOOL ret;
252 }DVBT2_SETACTIVE_PARAM,*PDVBT2_SETACTIVE_PARAM;
253 
254 typedef struct DLL_PACKED _DVBT2_GETLOCK_PARAM
255 {
256 	DMD_DVBT2_GETLOCK_TYPE eType;
257 	DMD_T2_LOCK_STATUS *eLockStatus;
258 	MS_BOOL ret;
259 }DVBT2_GETLOCK_PARAM, *PDVBT2_GETLOCK_PARAM;
260 
261 #if 0
262 typedef struct DLL_PACKED _DVBT2_GETSIGNALSTRENGTHWITHRFPOWER_PARAM
263 {
264 	MS_U16 *u16Strength;
265 	float fRFPowerDbm	;
266 	MS_BOOL ret;
267 }DVBT2_GETSIGNALSTRENGTHWITHRFPOWER_PARAM,*PDVBT2_GETSIGNALSTRENGTHWITHRFPOWER_PARAM;
268 
269 typedef struct DLL_PACKED _DVBT2_GETSIGNALQUALITYWITHRFPOWER_PARAM
270 {
271 	MS_U16 *u16Quality;
272 	float fRFPowerDbm;
273 	MS_BOOL ret;
274 }DVBT2_GETSIGNALQUALITYWITHRFPOWER_PARAM,*PDVBT2_GETSIGNALQUALITYWITHRFPOWER_PARAM;
275 #endif
276 
277 #if 0
278 typedef struct DLL_PACKED _DVBT2_GETSNR_PARAM
279 {
280 	float *fSNR;
281 	MS_BOOL ret;
282 }DVBT2_GETSNR_PARAM,*PDVBT2_GETSNR_PARAM;
283 #else
284 typedef struct DLL_PACKED _DVBT2_GETSNR_PARAM
285 {
286     MS_U16 *u16_snr100;
287     MS_U8 *snr_cali;
288     MS_U8 *u8_gi;
289     MS_BOOL ret;
290 }DVBT2_GETSNR_PARAM,*PDVBT2_GETSNR_PARAM;
291 #endif
292 
293 #if 0
294 typedef struct DLL_PACKED _DVBT2_GETPOSTLDPCBER_PARAM
295 {
296 	float *ber;
297 	MS_BOOL ret;
298 }DVBT2_GETPOSTLDPCBER_PARAM,*PDVBT2_GETPOSTLDPCBER_PARAM;
299 #else
300 typedef struct DLL_PACKED _DVBT2_GETPOSTLDPCBER_PARAM
301 {
302     MS_U32 *BitErr_reg;
303     MS_U16 *BitErrPeriod_reg;
304     MS_U16 *FecType;
305     MS_BOOL ret;
306 }DVBT2_GETPOSTLDPCBER_PARAM,*PDVBT2_GETPOSTLDPCBER_PARAM;
307 #endif
308 
309 #if 0
310 typedef struct DLL_PACKED _DVBT2_GETPRELDPCBERPARAM
311 {
312 	float *ber;
313 	MS_BOOL ret;
314 }DVBT2_GETPRELDPCBERPARAM,*PDVBT2_GETPRELDPCBERPARAM;
315 #else
316 typedef struct DLL_PACKED _DVBT2_GETPRELDPCBERPARAM
317 {
318     MS_U32 *BitErr_reg;
319     MS_U16 *BitErrPeriod_reg;
320     MS_U16 *FecType;
321     MS_BOOL ret;
322 }DVBT2_GETPRELDPCBERPARAM,*PDVBT2_GETPRELDPCBERPARAM;
323 #endif
324 
325 typedef struct DLL_PACKED _DVBT2_GETPACKETERRPARAM
326 {
327 	MS_U16 *pktErr;
328 	MS_BOOL ret;
329 }DVBT2_GETPACKETERRPARAM,*PDVBT2_GETPACKETERRPARAM;
330 
331 
332 typedef struct DLL_PACKED _DVBT2_GETL1INFO_PARAM
333 {
334 	MS_U16 *u16Info;
335 	DMD_DVBT2_SIGNAL_INFO eSignalType;
336 	MS_BOOL ret;
337 }DVBT2_GETL1INFO_PARAM,*PDVBT2_GETL1INFO_PARAM;
338 
339 #if 0
340 typedef struct DLL_PACKED _DVBT2_GETFREQOFFSET_PARAM
341 {
342 	float *pFreqOff;
343 	MS_BOOL ret;
344 }DVBT2_GETFREQOFFSET_PARAM,*PDVBT2_GETFREQOFFSET_PARAM;
345 #else
346 typedef struct DLL_PACKED _DVBT2_GETFREQOFFSET_PARAM
347 {
348     MS_U32 *CfoTd_reg;
349     MS_U32 *CfoFd_reg;
350     MS_U32 *Icfo_reg;
351     MS_U8 *fft_reg;
352     MS_BOOL ret;
353 }DVBT2_GETFREQOFFSET_PARAM,*PDVBT2_GETFREQOFFSET_PARAM;
354 #endif
355 
356 #if 0
357 typedef struct DLL_PACKED _DVBT2_NORDIG_SSI_TABLE_WRITE_PARAM
358 {
359 	DMD_T2_CONSTEL constel;
360 	DMD_T2_CODERATE code_rate;
361 	float write_value;
362 	MS_BOOL ret;
363 }DVBT2_NORDIG_SSI_TABLE_WRITE_PARAM,*PDVBT2_NORDIG_SSI_TABLE_WRITE_PARAM;
364 
365 typedef struct DLL_PACKED _DVBT2_NORDIG_SSI_TABLE_READ
366 {
367 	DMD_T2_CONSTEL constel;
368 	DMD_T2_CODERATE code_rate;
369 	float *read_value;
370 	MS_BOOL ret;
371 }DVBT2_NORDIG_SSI_TABLE_READ_PARAM,*PDVBT2_NORDIG_SSI_TABLE_READ;
372 #endif
373 
374 typedef struct DLL_PACKED _DVBT2_SETPOWERSTATE_PARAM
375 {
376 	EN_POWER_MODE u16PowerState;
377 	MS_U32 ret;
378 }DVBT2_SETPOWERSTATE_PARAM,*PDVBT2_SETPOWERSTATE_PARAM;
379 
380 typedef struct DLL_PACKED _DVBT2_GETPLPBITMAP_PARAM
381 {
382 	MS_U8* u8PlpBitMap;
383 	MS_BOOL ret;
384 }DVBT2_GETPLPBITMAP_PARAM,*PDVBT2_GETPLPBITMAP_PARAM;
385 
386 typedef struct DLL_PACKED _DVBT2_GETPLPGROUPID_PARAM
387 {
388 	MS_U8 u8PlpID;
389 	MS_U8* u8GroupID;
390 	MS_BOOL ret;
391 }DVBT2_GETPLPGROUPID_PARAM,*PDVBT2_GETPLPGROUPID_PARAM;
392 
393 typedef struct DLL_PACKED _DMD_DVBT2_SETPLPID_PARAM
394 {
395 	MS_U8 u8PlpID;
396 	MS_U8 u8GroupID;
397 	MS_BOOL ret;
398 }DMD_DVBT2_SETPLPID_PARAM,*PDMD_DVBT2_SETPLPID_PARAM;
399 
400 
401 
402 
403 
404 
405 
406 
407 
408 
409 /*************************************************/
410 
411 
412 MS_U32 DVBT2Open(void** pInstantTmp, MS_U32 u32ModuleVersion, void* pAttribute);
413 MS_U32 DVBT2Close(void* pInstantTmp);
414 MS_U32 DVBT2Ioctl(void* pInstantTmp, MS_U32 u32Cmd, void* pArgs);
415 
416 
417 
418 #ifdef __cplusplus
419 }
420 #endif
421 
422 #endif // _DRV_DVBT2_H_