xref: /utopia/UTPA2-700.0.x/projects/tmplib/include/drvDMD_INTERN_DVBC.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_INTERN_DVBC.h
98 /// @brief  DVBC Driver Interface
99 /// @author MStar Semiconductor Inc.
100 ///////////////////////////////////////////////////////////////////////////////////////////////////
101 
102 /*! \defgroup Demod Demod modules
103 
104  *! \defgroup DVBC DVBC interface (drvDMD_INTERN_DVBC.h)
105  *  \ingroup Demod
106 
107     \brief
108 
109     DVBC driver is a driver for control the operation of the DVB-C system. Some important
110     information can be shown by calling the relative information function.
111 
112     <b>Features</b>
113    - Init
114    - Exit
115    - Set Dbg Level
116    - Get Info
117    - Get DSP Reg
118    - Set DSP Reg
119    - Get Lib Ver
120    - Get Reg
121    - Get FW Ver
122    - Set Reg
123    - Set Serial Control
124    - Set Config
125    - Set Config symbol rate list
126    - Set Active
127    - Get Lock
128    - Get Lock With RF Power
129    - Get Signal Strength
130    - Get Signal Strength With RFPower
131    - Get Signal Quality
132    - Get Signal Quality With RFPower
133    - Get SNR
134    - Get Post Viterbi Ber
135    - Get Packet Err
136    - Get Cell ID
137    - Get Status
138    - Active Dmd Switch
139    - Dual Individual Init
140    - Dual Public _Init
141    - Set Power State
142 
143 
144     <b> DVBC Block Diagram: </b> \n
145     \image html DVBC.png
146 
147     <b> Operation Code Flow: </b> \n
148     -# Init
149     -# SetConfig
150     -# Get lock
151     -# Get relative information
152 
153 
154 
155 
156  *! \defgroup DVBC DVBC interface (drvDMD_INTERN_DVBC.h)
157  *  \ingroup Demod
158 
159  * *! \defgroup DVBC_BASIC DMD Module basic
160  *  \ingroup DVBC
161 
162  *! \defgroup DVBC_To_Be_Removed DVBC to be removed
163  *  \ingroup DVBC
164 
165  *! \defgroup DVBC_To_Be_Modified DVBC to be modified
166  *  \ingroup DVBC
167 
168  *! \defgroup DVBC_REG To set/get register
169  *  \ingroup DVBC
170 
171  *! \defgroup DVBC_CONFIG DVBC config
172  *  \ingroup DVBC
173 
174  *! \defgroup DVBC_LOCK DVBC get lock
175  *  \ingroup DVBC
176 
177  *! \defgroup DVBC_INFO To get DVBC information
178  *  \ingroup DVBC
179 
180   *! \defgroup DVBC_DUAL DVBC dual demod
181  *  \ingroup DVBC
182  */
183 
184 #ifndef _DRV_DVBC_H_
185 #define _DRV_DVBC_H_
186 
187 #include "MsTypes.h"
188 
189 #include "MsCommon.h"
190 #include "drvDMD_common.h"
191 #ifdef __cplusplus
192 extern "C"
193 {
194 #endif
195 
196 
197 //-------------------------------------------------------------------------------------------------
198 //  Driver Capability
199 //-------------------------------------------------------------------------------------------------
200 
201 
202 //-------------------------------------------------------------------------------------------------
203 //  Macro and Define
204 //-------------------------------------------------------------------------------------------------
205 #define MSIF_DMD_DVBC_INTERN_LIB_CODE           {'D','V', 'B','C'} //Lib code
206 #define MSIF_DMD_DVBC_INTERN_LIBVER             {'0','1'}      //LIB version
207 #define MSIF_DMD_DVBC_INTERN_BUILDNUM           {'2','2' }    //Build Number
208 #define MSIF_DMD_DVBC_INTERN_CHANGELIST         {'0','0','0','0','0','0','0','0'} //P4 ChangeList Number
209 // oga
210 #define    INDEX_C_TS_PHASE_EN            23
211 #define    INDEX_C_TS_PHASE_NUM        24
212 
213 #define DMD_DVBC_INTERN_VER                 /* Character String for DRV/API version             */  \
214     MSIF_TAG,                           /* 'MSIF'                                           */  \
215     MSIF_CLASS,                         /* '00'                                             */  \
216     MSIF_CUS,                           /* 0x0000                                           */  \
217     MSIF_MOD,                           /* 0x0000                                           */  \
218     MSIF_CHIP,                                                                                  \
219     MSIF_CPU,                                                                                   \
220     MSIF_DMD_DVBC_INTERN_LIB_CODE,      /* IP__                                             */  \
221     MSIF_DMD_DVBC_INTERN_LIBVER,        /* 0.0 ~ Z.Z                                        */  \
222     MSIF_DMD_DVBC_INTERN_BUILDNUM,      /* 00 ~ 99                                          */  \
223     MSIF_DMD_DVBC_INTERN_CHANGELIST,    /* CL#                                              */  \
224     MSIF_OS
225 
226 #define IS_BITS_SET(val, bits)                  (((val)&(bits)) == (bits))
227 
228 //-------------------------------------------------------------------------------------------------
229 //  Type and Structure
230 //-------------------------------------------------------------------------------------------------
231 typedef enum
232 {
233     DMD_DVBC_DBGLV_NONE,    // disable all the debug message
234     DMD_DVBC_DBGLV_INFO,    // information
235     DMD_DVBC_DBGLV_NOTICE,  // normal but significant condition
236     DMD_DVBC_DBGLV_WARNING, // warning conditions
237     DMD_DVBC_DBGLV_ERR,     // error conditions
238     DMD_DVBC_DBGLV_CRIT,    // critical conditions
239     DMD_DVBC_DBGLV_ALERT,   // action must be taken immediately
240     DMD_DVBC_DBGLV_EMERG,   // system is unusable
241     DMD_DVBC_DBGLV_DEBUG,   // debug-level messages
242 } DMD_DVBC_DbgLv;
243 
244 typedef enum
245 {
246     DMD_DVBC_LOCK,
247     DMD_DVBC_CHECKING,
248     DMD_DVBC_CHECKEND,
249     DMD_DVBC_UNLOCK,
250     DMD_DVBC_NULL,
251 } DMD_DVBC_LOCK_STATUS;
252 
253 typedef enum
254 {
255     DMD_DVBC_GETLOCK,
256     DMD_DVBC_GETLOCK_FEC_LOCK,
257     DMD_DVBC_GETLOCK_PSYNC_LOCK,
258     DMD_DVBC_GETLOCK_TPS_LOCK,
259     DMD_DVBC_GETLOCK_DCR_LOCK,
260     DMD_DVBC_GETLOCK_AGC_LOCK,
261     DMD_DVBC_GETLOCK_MODE_DET,
262     DMD_DVBC_GETLOCK_NO_CHANNEL,
263     DMD_DVBC_GETLOCK_ATV_DETECT,
264     DMD_DVBC_GETLOCK_TR_LOCK,
265     DMD_DVBC_GETLOCK_TR_EVER_LOCK,
266 //    DMD_DVBC_GETLOCK_FEC_STABLE_LOCK,
267 } DMD_DVBC_GETLOCK_TYPE;
268 
269 typedef enum
270 {
271     DMD_DVBC_QAM16 = 0,
272     DMD_DVBC_QAM32 = 1,
273     DMD_DVBC_QAM64 = 2,
274     DMD_DVBC_QAM128 = 3,
275     DMD_DVBC_QAM256 = 4,
276     DMD_DVBC_QAMAUTO = 128,
277 } DMD_DVBC_MODULATION_TYPE;
278 
279 typedef enum
280 {
281     DMD_DVBC_RF_CH_BAND_6MHz = 0x01,
282     DMD_DVBC_RF_CH_BAND_7MHz = 0x02,
283     DMD_DVBC_RF_CH_BAND_8MHz = 0x03,
284     DMD_DVBC_RF_CH_BAND_INVALID
285 } DMD_DVBC_RF_CHANNEL_BANDWIDTH;
286 
287 typedef enum
288 {
289     E_DMD_DVBC_PARAM_VERSION,           //0x00
290     E_DMD_DVBC_OP_RFAGC_EN,
291     E_DMD_DVBC_OP_HUMDET_EN,
292     E_DMD_DVBC_OP_DCR_EN,
293     E_DMD_DVBC_OP_IQB_EN,
294     E_DMD_DVBC_OP_AUTO_IQ,
295     E_DMD_DVBC_OP_AUTO_RFMAX,
296     E_DMD_DVBC_OP_AUTO_ACI,
297     E_DMD_DVBC_OP_AUTO_SCAN,
298     E_DMD_DVBC_OP_AUTO_SCAN_SYM_RATE,
299     E_DMD_DVBC_OP_AUTO_SCAN_QAM,
300     E_DMD_DVBC_OP_ATV_DETECTOR_EN,
301     E_DMD_DVBC_OP_ZIF_EN,                       //ZIF
302     E_DMD_DVBC_OP_NORMALIF_EN,            //NIF
303     E_DMD_DVBC_OP_LIF_EN,                       //LIF
304     E_DMD_DVBC_OP_SAWLESS_EN,             //SAWLESS
305     E_DMD_DVBC_IF_INV_PWM_OUT_EN,     //Sony Tuner , 0x10
306     E_DMD_DVBC_CFG_RSSI,
307     E_DMD_DVBC_CFG_ZIF,
308     E_DMD_DVBC_CFG_FS_L,                        //FS
309     E_DMD_DVBC_CFG_FS_H,                        //FS
310     E_DMD_DVBC_CFG_FIF_L,                       //IF
311     E_DMD_DVBC_CFG_FIF_H,                       //IF
312     E_DMD_DVBC_CFG_FC_L,                //FC
313     E_DMD_DVBC_CFG_FC_H,                //FC
314     E_DMD_DVBC_CFG_BW0_L,
315     E_DMD_DVBC_CFG_BW0_H,
316     E_DMD_DVBC_CFG_BW1_L,
317     E_DMD_DVBC_CFG_BW1_H,
318     E_DMD_DVBC_CFG_BW2_L,
319     E_DMD_DVBC_CFG_BW2_H,
320     E_DMD_DVBC_CFG_BW3_L,
321     E_DMD_DVBC_CFG_BW3_H,               //0x20
322     E_DMD_DVBC_CFG_BW4_L,
323     E_DMD_DVBC_CFG_BW4_H,
324     E_DMD_DVBC_CFG_BW5_L,
325     E_DMD_DVBC_CFG_BW5_H,
326     E_DMD_DVBC_CFG_BW6_L,
327     E_DMD_DVBC_CFG_BW6_H,
328     E_DMD_DVBC_CFG_BW7_L,
329     E_DMD_DVBC_CFG_BW7_H,
330     E_DMD_DVBC_CFG_BW8_L,
331     E_DMD_DVBC_CFG_BW8_H,
332     E_DMD_DVBC_CFG_BW9_L,
333     E_DMD_DVBC_CFG_BW9_H,
334     E_DMD_DVBC_CFG_BW10_L,
335     E_DMD_DVBC_CFG_BW10_H,
336     E_DMD_DVBC_CFG_BW11_L,
337     E_DMD_DVBC_CFG_BW11_H,              //0x30
338     E_DMD_DVBC_CFG_RFMAX,
339     E_DMD_DVBC_CFG_QAM,
340     E_DMD_DVBC_CFG_IQ_SWAP,
341     E_DMD_DVBC_CFG_CCI,
342     E_DMD_DVBC_CFG_TS_SERIAL,
343     E_DMD_DVBC_CFG_TS_CLK_RATE,
344     E_DMD_DVBC_CFG_TS_CLK_INV,
345     E_DMD_DVBC_CFG_TS_DATA_SWAP,
346     E_DMD_DVBC_CFG_TS_EN,
347     E_DMD_DVBC_AGC_REF_L,
348     E_DMD_DVBC_AGC_REF_H,
349     E_DMD_DVBC_AGC_K,
350     E_DMD_DVBC_AGC_LOCK_TH,
351     E_DMD_DVBC_AGC_LOCK_NUM,
352     E_DMD_DVBC_ADC_PGA_GAIN_I,
353     E_DMD_DVBC_ADC_PGA_GAIN_Q,                  //0x40
354     E_DMD_DVBC_ADC_PWDN_I,
355     E_DMD_DVBC_ADC_PWDN_Q,
356     E_DMD_DVBC_ADC_MPLL_DIV_SEL,
357     E_DMD_DVBC_CCI_BYPASS,
358     E_DMD_DVBC_CCI_LOCK_DET,
359     E_DMD_DVBC_CCI_FREQN_OUT_0,
360     E_DMD_DVBC_CCI_FREQN_OUT_1,
361     E_DMD_DVBC_RF_GAIN_MIN,
362     E_DMD_DVBC_RF_GAIN_MAX,
363     E_DMD_DVBC_IF_GAIN_MIN,
364     E_DMD_DVBC_IF_GAIN_MAX,
365     E_DMD_DVBC_NO_SIGNAL_NUM_TH,
366     E_DMD_DVBC_NO_SIGNAL_GAIN_TH_L,
367     E_DMD_DVBC_NO_SIGNAL_GAIN_TH_H,
368     E_DMD_DVBC_NO_SIGNAL_ERR_TH_L,
369     E_DMD_DVBC_NO_SIGNAL_ERR_TH_H,          //0x50
370     E_DMD_DVBC_TUNER_NUM,
371     E_DMD_DVBC_UNCRT_PKT_NUM_7_0,
372     E_DMD_DVBC_UNCRT_PKT_NUM_8_15,
373     E_DMD_DVBC_STATE,
374     E_DMD_DVBC_ILL_LOCK,
375     E_DMD_DVBC_DAGC1_REF,
376     E_DMD_DVBC_DAGC2_REF,
377     E_DMD_DVBC_EQ_KP3_16QAM,
378     E_DMD_DVBC_EQ_KP3_32QAM,
379     E_DMD_DVBC_EQ_KP3_64QAM,
380     E_DMD_DVBC_EQ_KP3_128QAM,
381     E_DMD_DVBC_EQ_KP3_256QAM,
382     E_DMD_DVBC_EQ_KP4_16QAM,
383     E_DMD_DVBC_EQ_KP4_32QAM,
384     E_DMD_DVBC_EQ_KP4_64QAM,
385     E_DMD_DVBC_EQ_KP4_128QAM,                   //0x60
386     E_DMD_DVBC_EQ_KP4_256QAM,
387     E_DMD_DVBC_SNR100_L,
388     E_DMD_DVBC_SNR100_H,
389     E_DMD_DVBC_CFO10_L,
390     E_DMD_DVBC_CFO10_H,
391     E_DMD_DVBC_TR_LOCK,
392     E_DMD_DVBC_CR_LOCK,
393     E_DMD_DVBC_EQ_DMA1_LOCK,
394     E_DMD_DVBC_EQ_DMA_LOCK,
395     E_DMD_DVBC_EQ_DD1_LOCK,
396     E_DMD_DVBC_EQ_DD_LOCK,
397     E_DMD_DVBC_FEC_LOCK,                //0x6C
398     E_DMD_DVBC_CHIP_VERSION,
399 } DVBC_Param_2;
400 
401 typedef enum
402 {
403     // Operation Mode Settings
404     e_opmode_rfagc_en, //0
405     e_opmode_humdet_en,
406     e_opmode_dcr_en,
407     e_opmode_iqb_en,
408     e_opmode_auto_iq,
409     e_opmode_auto_rfmax,
410     e_opmode_auto_aci,
411     e_opmode_auto_scan,
412     e_opmode_auto_scan_sym_rate,
413     e_opmode_auto_scan_qam,
414     e_opmode_atv_detector_en,
415     e_opmode_no_sig_if_gain_th_l,
416     e_opmode_no_sig_if_gain_th_h,
417     e_opmode_no_sig_if_err_th_l,
418     e_opmode_no_sig_if_err_th_h,
419     e_opmode_rsv_0x0F, //15
420     // Config Params
421     e_config_rssi,
422     e_config_zif,
423     e_config_freq,
424     e_config_fc_l,
425     e_config_fc_h,//20
426     e_config_fs_l,
427     e_config_fs_h,
428     e_config_bw_l,
429     e_config_bw_h,
430     e_config_bw1_l,//25
431     e_config_bw1_h,
432     e_config_bw2_l,
433     e_config_bw2_h,
434     e_config_bw3_l,
435     e_config_bw3_h,//30
436     e_config_rsv_0x1F,
437     e_config_rfmax,
438     e_config_qam,
439     e_config_iq_swap,
440     e_config_cci,
441     e_config_ts_serial,
442     e_config_ts_clk_rate,
443     e_config_ts_out_inv,
444     e_config_ts_data_swap,
445     e_config_lif,
446     e_config_fif_l,
447     e_config_fif_h,
448     e_config_tuner_sawless,
449     DVBC_PARAM_LEN,
450 } DVBC_Param;
451 
452 /// For demod init
453 typedef struct
454 {
455     // tuner parameter
456     MS_U8 u8SarChannel;
457     DMD_RFAGC_SSI *pTuner_RfagcSsi;
458     MS_U16 u16Tuner_RfagcSsi_Size;
459     DMD_IFAGC_SSI *pTuner_IfagcSsi_LoRef;
460     MS_U16 u16Tuner_IfagcSsi_LoRef_Size;
461     DMD_IFAGC_SSI *pTuner_IfagcSsi_HiRef;
462     MS_U16 u16Tuner_IfagcSsi_HiRef_Size;
463     DMD_IFAGC_ERR *pTuner_IfagcErr_LoRef;
464     MS_U16 u16Tuner_IfagcErr_LoRef_Size;
465     DMD_IFAGC_ERR *pTuner_IfagcErr_HiRef;
466     MS_U16 u16Tuner_IfagcErr_HiRef_Size;
467     DMD_SQI_CN_NORDIGP1 *pSqiCnNordigP1;
468     MS_U16 u16SqiCnNordigP1_Size;
469 
470     // register init
471     MS_U8 *u8DMD_DVBC_DSPRegInitExt; // TODO use system variable type
472     MS_U8 u8DMD_DVBC_DSPRegInitSize;
473     MS_U8 *u8DMD_DVBC_InitExt; // TODO use system variable type
474 } DMD_DVBC_InitData;
475 
476 typedef enum
477 {
478     E_DMD_DVBC_FAIL=0,
479     E_DMD_DVBC_OK=1
480 } DMD_DVBC_Result;
481 
482 
483 typedef struct
484 {
485     MS_U16 u16Version;
486     MS_U16 u16SymbolRate;
487     DMD_DVBC_MODULATION_TYPE eQamMode;
488     MS_U32 u32IFFreq;
489     MS_BOOL bSpecInv;
490     MS_BOOL bSerialTS;
491     MS_U8 u8SarValue;
492     MS_U32 u32ChkScanTimeStart;
493     DMD_DVBC_LOCK_STATUS eLockStatus;
494     MS_U16 u16Strength;
495     MS_U16 u16Quality;
496     MS_U32 u32Intp; //
497     MS_U32 u32FcFs; //
498     MS_U8 u8Qam; //
499     MS_U16 u16SymbolRateHal; //
500 } DMD_DVBC_Info;
501 
502 //typedef void(*P_DMD_ISR_Proc)(MS_U8 u8DMDID);
503 
504 
505 //-------------------------------------------------------------------------------------------------
506 //  Function and Variable
507 //-------------------------------------------------------------------------------------------------
508 
509 ////////////////////////////////////////////////////////////////////////////////
510 /// MDrv_DMD_DVBC_Init
511 ////////////////////////////////////////////////////////////////////////////////
512 //-------------------------------------------------------------------------------------------------
513 /// Initialize DVBC
514 /// @ingroup DVBC_BASIC
515 /// @param  pDMD_DVBC_InitData     \b IN: Initial data
516 /// @param  u32InitDataLen                \b IN: Initial data length
517 /// @return TRUE : succeed
518 /// @return FALSE : fail
519 //-------------------------------------------------------------------------------------------------
520 extern DLL_PUBLIC MS_BOOL MDrv_DMD_DVBC_Init(DMD_DVBC_InitData *pDMD_DVBC_InitData, MS_U32 u32InitDataLen);
521 
522 ////////////////////////////////////////////////////////////////////////////////
523 /// Should be called when exit VD input source
524 ////////////////////////////////////////////////////////////////////////////////
525 //-------------------------------------------------------------------------------------------------
526 /// Exit DVBC
527 /// @ingroup DVBC_BASIC
528 /// @return TRUE : succeed
529 /// @return FALSE : fail
530 //-------------------------------------------------------------------------------------------------
531 extern DLL_PUBLIC MS_BOOL MDrv_DMD_DVBC_Exit(void);
532 
533 //------------------------------------------------------------------------------
534 /// Set detailed level of DVBT driver debug message
535 /// u8DbgLevel : debug level for Parallel Flash driver\n
536 /// AVD_DBGLV_NONE,    ///< disable all the debug message\n
537 /// AVD_DBGLV_INFO,    ///< information\n
538 /// AVD_DBGLV_NOTICE,  ///< normal but significant condition\n
539 /// AVD_DBGLV_WARNING, ///< warning conditions\n
540 /// AVD_DBGLV_ERR,     ///< error conditions\n
541 /// AVD_DBGLV_CRIT,    ///< critical conditions\n
542 /// AVD_DBGLV_ALERT,   ///< action must be taken immediately\n
543 /// AVD_DBGLV_EMERG,   ///< system is unusable\n
544 /// AVD_DBGLV_DEBUG,   ///< debug-level messages\n
545 /// @return TRUE : succeed
546 /// @return FALSE : failed to set the debug level
547 //------------------------------------------------------------------------------
548 
549 //-------------------------------------------------------------------------------------------------
550 /// Set detailed level of DVBC driver debug message
551 /// @ingroup DVBC_BASIC
552 /// @param  u8DbgLevel                \b IN: debug level for Parallel Flash driver
553 /// @return TRUE : succeed
554 /// @return FALSE : fail
555 //-------------------------------------------------------------------------------------------------
556 // extern DLL_PUBLIC MS_BOOL MDrv_DMD_DVBC_SetDbgLevel(DMD_DVBC_DbgLv u8DbgLevel);
557 
558 //-------------------------------------------------------------------------------------------------
559 /// Get the information of DVBC driver\n
560 /// @return the pointer to the driver information
561 //-------------------------------------------------------------------------------------------------
562 //-------------------------------------------------------------------------------------------------
563 /// Get the information of DVBC driver
564 /// @ingroup DVBC_INFO
565 /// @return : the pointer to the driver information
566 //-------------------------------------------------------------------------------------------------
567 extern DLL_PUBLIC const DMD_DVBC_Info* MDrv_DMD_DVBC_GetInfo(void);
568 
569 //-------------------------------------------------------------------------------------------------
570 /// Get DVBC driver version
571 /// when get ok, return the pointer to the driver version
572 //-------------------------------------------------------------------------------------------------
573 
574 ///////////////////////////////////////////////////////////////////////////////////
575 ///To get/set the DSP parameter table from demod MCU
576 //u16Addr     :the address of the demod MCU DSP parameter table
577 //////////////////////////////////////////////////////////////////////////////////
578 //-------------------------------------------------------------------------------------------------
579 /// Get the DSP parameter table from demod MCU
580 /// @ingroup DVBC_REG
581 /// @return TRUE : succeed
582 /// @return FALSE : fail
583 //-------------------------------------------------------------------------------------------------
584 // extern DLL_PUBLIC MS_BOOL MDrv_DMD_DVBC_GetDSPReg(MS_U16 u16Addr, MS_U8 *pu8Data);
585 
586 //-------------------------------------------------------------------------------------------------
587 /// Set the DSP parameter table from demod MCU
588 /// @ingroup DVBC_REG
589 /// @return TRUE : succeed
590 /// @return FALSE : fail
591 //-------------------------------------------------------------------------------------------------
592 // extern DLL_PUBLIC MS_BOOL MDrv_DMD_DVBC_SetDSPReg(MS_U16 u16Addr, MS_U8 pu8Data);
593 
594 //-------------------------------------------------------------------------------------------------
595 /// Get DVBC intern version
596 /// @ingroup DVBC_INFO
597 /// @param  ppVersion                \b IN: Version
598 /// @return TRUE : succeed
599 /// @return FALSE : fail
600 //-------------------------------------------------------------------------------------------------
601 extern DLL_PUBLIC MS_BOOL MDrv_DMD_DVBC_GetLibVer(const MSIF_Version **ppVersion);
602 
603 ////////////////////////////////////////////////////////////////////////////////
604 /// To get DVBC's register  value, only for special purpose.\n
605 /// u16Addr       : the address of DVBT's register\n
606 /// return the value of AFEC's register\n
607 ////////////////////////////////////////////////////////////////////////////////
608 //-------------------------------------------------------------------------------------------------
609 /// To get DVBC's register value, only for special purpose
610 /// @ingroup DVBC_REG
611 /// @param  u16Addr                \b IN: register address
612 /// @param  pu8Data                \b IN: register value
613 /// @return TRUE : succeed
614 /// @return FALSE : fail
615 //-------------------------------------------------------------------------------------------------
616 // extern DLL_PUBLIC MS_BOOL MDrv_DMD_DVBC_GetReg(MS_U16 u16Addr, MS_U8 *pu8Data);
617 
618 ////////////////////////////////////////////////////////////////////////////////
619 /// Get DVBC FW version
620 /// u16Addr       : the address of DVBC's register\n
621 ////////////////////////////////////////////////////////////////////////////////
622 //-------------------------------------------------------------------------------------------------
623 /// To get DVBC FW version
624 /// @ingroup DVBC_INFO
625 /// @param  ver                \b IN: FW version
626 /// @return TRUE : succeed
627 /// @return FALSE : fail
628 //-------------------------------------------------------------------------------------------------
629 // extern DLL_PUBLIC MS_BOOL MDrv_DMD_DVBC_GetFWVer(MS_U16 *ver);
630 
631 //-------------------------------------------------------------------------------------------------
632 /// To set DVBC's register value, only for special purpose
633 /// @ingroup DVBC_REG
634 /// @param  u16Addr                \b IN: register address
635 /// @param  pu8Data                \b IN: register value
636 /// @return TRUE : succeed
637 /// @return FALSE : fail
638 //-------------------------------------------------------------------------------------------------
639 // extern DLL_PUBLIC MS_BOOL MDrv_DMD_DVBC_SetReg(MS_U16 u16Addr, MS_U8 u8Data);
640 
641 ////////////////////////////////////////////////////////////////////////////////
642 /// MDrv_DMD_DVBC_SetSerialControl
643 ////////////////////////////////////////////////////////////////////////////////
644 //-------------------------------------------------------------------------------------------------
645 /// To set TS serial/parallel mode
646 /// @ingroup DVBC_CONFIG
647 /// @param  bEnable                \b IN: 1=>serial, 0=>parallel
648 /// @return TRUE : succeed
649 /// @return FALSE : fail
650 //-------------------------------------------------------------------------------------------------
651 extern DLL_PUBLIC MS_BOOL MDrv_DMD_DVBC_SetSerialControl(MS_BOOL bEnable);
652 
653 ////////////////////////////////////////////////////////////////////////////////
654 /// MDrv_DMD_DVBC_SetConfig
655 ////////////////////////////////////////////////////////////////////////////////
656 //-------------------------------------------------------------------------------------------------
657 /// To set config data
658 /// @ingroup DVBC_CONFIG
659 /// @param  u16SymbolRate                                    \b IN: set symbol rate
660 /// @param  eQamMode                                                \b IN: set QAM mode auto/manual
661 /// @param  u32IFFreq                                            \b IN: set IF frequency
662 /// @param  bSpecInv                                                \b IN: 1=>spectrum invert, 0=>spectrum normal
663 /// @param  bSerialTS                                            \b IN: 1=>serial, 0=>parallel
664 /// @return TRUE : succeed
665 /// @return FALSE : fail
666 //-------------------------------------------------------------------------------------------------
667 extern DLL_PUBLIC MS_BOOL MDrv_DMD_DVBC_SetConfig(MS_U16 u16SymbolRate, DMD_DVBC_MODULATION_TYPE eQamMode, MS_U32 u32IFFreq, MS_BOOL bSpecInv, MS_BOOL bSerialTS);
668 
669 ////////////////////////////////////////////////////////////////////////////////
670 /// MDrv_DMD_DVBC_SetConfig_symbol_rate_list
671 ////////////////////////////////////////////////////////////////////////////////
672 //-------------------------------------------------------------------------------------------------
673 /// To set config data with symbol rate list
674 /// @ingroup DVBC_CONFIG
675 /// @param  u16SymbolRate                                    \b IN: set symbol rate
676 /// @param  eQamMode                                                \b IN: set QAM mode auto/manual
677 /// @param  u32IFFreq                                            \b IN: set IF frequency
678 /// @param  bSpecInv                                                \b IN: 1=>spectrum invert, 0=>spectrum normal
679 /// @param  bSerialTS                                            \b IN: 1=>serial, 0=>parallel
680 /// @param  pu16_symbol_rate_list                 \b IN: symbol rate list
681 /// @param  u8_symbol_rate_list_num               \b IN: symbol rate list number
682 /// @return TRUE : succeed
683 /// @return FALSE : fail
684 //-------------------------------------------------------------------------------------------------
685 extern DLL_PUBLIC MS_BOOL MDrv_DMD_DVBC_SetConfig_symbol_rate_list(MS_U16 u16SymbolRate, DMD_DVBC_MODULATION_TYPE eQamMode, MS_U32 u32IFFreq, MS_BOOL bSpecInv, MS_BOOL bSerialTS, MS_U16 *pu16_symbol_rate_list,MS_U8 u8_symbol_rate_list_num);
686 
687 ////////////////////////////////////////////////////////////////////////////////
688 /// MDrv_DMD_DVBC_SetActive
689 ////////////////////////////////////////////////////////////////////////////////
690 //-------------------------------------------------------------------------------------------------
691 /// To active DVBC FSM
692 /// @ingroup DVBC_BASIC
693 /// @param  bEnable                \b IN: 1=>Enable
694 /// @return TRUE : succeed
695 /// @return FALSE : fail
696 //-------------------------------------------------------------------------------------------------
697 extern  DLL_PUBLIC MS_BOOL MDrv_DMD_DVBC_SetActive(MS_BOOL bEnable);
698 
699 ////////////////////////////////////////////////////////////////////////////////
700 /// MDrv_DMD_DVBT_Get_Lock
701 ////////////////////////////////////////////////////////////////////////////////
702 //-------------------------------------------------------------------------------------------------
703 /// DVBC get lock flow
704 /// @ingroup DVBC_LOCK
705 /// @param  eType                             \b IN: DVBC get lock
706 /// @param  eLockStatus                \b IN: DVBC lock status
707 /// @return TRUE : succeed
708 /// @return FALSE : fail
709 //-------------------------------------------------------------------------------------------------
710 extern DLL_PUBLIC MS_BOOL MDrv_DMD_DVBC_GetLock(DMD_DVBC_GETLOCK_TYPE eType, DMD_DVBC_LOCK_STATUS *eLockStatus);
711 
712 ////////////////////////////////////////////////////////////////////////////////
713 /// MDrv_DMD_DVBC_GetLockWithRFPower
714 ////////////////////////////////////////////////////////////////////////////////
715 //-------------------------------------------------------------------------------------------------
716 /// DVBC get lock with RF power
717 /// @ingroup DVBC_LOCK
718 /// @param  eType                                             \b IN: DVBC get lock
719 /// @param  eLockStatus                                \b IN: DVBC lock status
720 /// @param  fCurrRFPowerDbm                        \b IN: Current RF power in dBm
721 /// @param  fNoChannelRFPowerDbm               \b IN: No channel RF power in dBm
722 /// @return TRUE : succeed
723 /// @return FALSE : fail
724 //-------------------------------------------------------------------------------------------------
725 extern DLL_PUBLIC MS_BOOL MDrv_DMD_DVBC_GetLockWithRFPower(DMD_DVBC_GETLOCK_TYPE eType, DMD_DVBC_LOCK_STATUS *eLockStatus, float fCurrRFPowerDbm, float fNoChannelRFPowerDbm);
726 
727 ////////////////////////////////////////////////////////////////////////////////
728 /// MDrv_DMD_DVBT_GetSignalStrength
729 ////////////////////////////////////////////////////////////////////////////////
730 //-------------------------------------------------------------------------------------------------
731 /// To get signal strength
732 /// @ingroup DVBC_INFO
733 /// @param  u16Strength                                 \b IN: Signal strength
734 /// @return TRUE : succeed
735 /// @return FALSE : fail
736 //-------------------------------------------------------------------------------------------------
737 extern DLL_PUBLIC MS_BOOL MDrv_DMD_DVBC_GetSignalStrength(MS_U16 *u16Strength);
738 
739 ////////////////////////////////////////////////////////////////////////////////
740 /// MDrv_DMD_DVBC_GetSignalStrengthWithRFPower
741 ////////////////////////////////////////////////////////////////////////////////
742 //-------------------------------------------------------------------------------------------------
743 /// To get signal strength with RF power
744 /// @ingroup DVBC_INFO
745 /// @param  u16Strength                                 \b IN: Signal strength
746 /// @param  fRFPowerDbm                                 \b IN: RF power
747 /// @return TRUE : succeed
748 /// @return FALSE : fail
749 //-------------------------------------------------------------------------------------------------
750 extern DLL_PUBLIC MS_BOOL MDrv_DMD_DVBC_GetSignalStrengthWithRFPower(MS_U16 *u16Strength, float fRFPowerDbm);
751 
752 ////////////////////////////////////////////////////////////////////////////////
753 /// MDrv_DMD_DVBC_GetSignalQuality
754 ////////////////////////////////////////////////////////////////////////////////
755 //-------------------------------------------------------------------------------------------------
756 /// To get signal quality
757 /// @ingroup DVBC_INFO
758 /// @param  u16Quality                                 \b IN: Signal quality
759 /// @return TRUE : succeed
760 /// @return FALSE : fail
761 //-------------------------------------------------------------------------------------------------
762 extern DLL_PUBLIC MS_BOOL MDrv_DMD_DVBC_GetSignalQuality(MS_U16 *u16Quality);
763 
764 ////////////////////////////////////////////////////////////////////////////////
765 /// MDrv_DMD_DVBC_GetSignalQualityWithRFPower
766 ////////////////////////////////////////////////////////////////////////////////
767 //-------------------------------------------------------------------------------------------------
768 /// To get signal quality with RF power
769 /// @ingroup DVBC_INFO
770 /// @param  u16Quality                                 \b IN: Signal quality
771 /// @param  fRFPowerDbm                            \b IN: RF power
772 /// @return TRUE : succeed
773 /// @return FALSE : fail
774 //-------------------------------------------------------------------------------------------------
775 extern DLL_PUBLIC MS_BOOL MDrv_DMD_DVBC_GetSignalQualityWithRFPower(MS_U16 *u16Quality, float fRFPowerDbm);
776 
777 ////////////////////////////////////////////////////////////////////////////////
778 /// MDrv_DMD_DVBC_GetSNR
779 ////////////////////////////////////////////////////////////////////////////////
780 //-------------------------------------------------------------------------------------------------
781 /// To get SNR
782 /// @ingroup DVBC_INFO
783 /// @param  fSNR                                 \b IN: SNR
784 /// @return TRUE : succeed
785 /// @return FALSE : fail
786 //-------------------------------------------------------------------------------------------------
787 extern DLL_PUBLIC MS_BOOL MDrv_DMD_DVBC_GetSNR(float *fSNR);
788 
789 ////////////////////////////////////////////////////////////////////////////////
790 /// MDrv_DMD_DVBC_GetPostViterbiBer
791 ////////////////////////////////////////////////////////////////////////////////
792 //-------------------------------------------------------------------------------------------------
793 /// To get post viterbi BER
794 /// @ingroup DVBC_INFO
795 /// @param  ber                                 \b IN: BER
796 /// @return TRUE : succeed
797 /// @return FALSE : fail
798 //-------------------------------------------------------------------------------------------------
799 extern DLL_PUBLIC MS_BOOL MDrv_DMD_DVBC_GetPostViterbiBer(float *ber);
800 
801 ////////////////////////////////////////////////////////////////////////////////
802 /// MDrv_DMD_DVBC_GetPacketErr
803 ////////////////////////////////////////////////////////////////////////////////
804 //-------------------------------------------------------------------------------------------------
805 /// To get packet error
806 /// @ingroup DVBC_INFO
807 /// @param  pktErr                             \b IN: Packet error
808 /// @return TRUE : succeed
809 /// @return FALSE : fail
810 //-------------------------------------------------------------------------------------------------
811 extern DLL_PUBLIC MS_BOOL MDrv_DMD_DVBC_GetPacketErr(MS_U16 *pktErr);
812 
813 ////////////////////////////////////////////////////////////////////////////////
814 /// MDrv_DMD_DVBC_GetCellID
815 ////////////////////////////////////////////////////////////////////////////////
816 //-------------------------------------------------------------------------------------------------
817 /// To get cell ID
818 /// @ingroup DVBC_INFO
819 /// @param  u16CellID                        \b IN: Cell ID
820 /// @return TRUE : succeed
821 /// @return FALSE : fail
822 //-------------------------------------------------------------------------------------------------
823 // extern DLL_PUBLIC MS_BOOL MDrv_DMD_DVBC_GetCellID(MS_U16 *u16CellID);
824 
825 ////////////////////////////////////////////////////////////////////////////////
826 /// MDrv_DMD_DVBC_GetStatus
827 ////////////////////////////////////////////////////////////////////////////////
828 //-------------------------------------------------------------------------------------------------
829 /// To get DVBC status such as QAM type, symbol rate and frequency offset
830 /// @ingroup DVBC_INFO
831 /// @param  pQAMMode                                 \b IN: QAM type
832 /// @param  u16SymbolRate                    \b IN: Symbol rate
833 /// @param  pFreqOff                                 \b IN: Frequency offset
834 /// @return TRUE : succeed
835 /// @return FALSE : fail
836 //-------------------------------------------------------------------------------------------------
837 extern DLL_PUBLIC MS_BOOL MDrv_DMD_DVBC_GetStatus(DMD_DVBC_MODULATION_TYPE *pQAMMode, MS_U16 *u16SymbolRate, float *pFreqOff);
838 
839 //-------------------------------------------------------------------------------------------------
840 /// To switch demod No.0 and No.1, update demod information current used
841 /// For Kaiser only
842 /// @ingroup DVBC_DUAL
843 /// @param  demod_no                                 \b IN: Demod number
844 /// @return TRUE : succeed
845 /// @return FALSE : fail
846 //-------------------------------------------------------------------------------------------------
847 extern DLL_PUBLIC MS_BOOL MDrv_DMD_DVBC_ActiveDmdSwitch(MS_U8 demod_no);
848 
849 //-------------------------------------------------------------------------------------------------
850 /// Dual init DVBC demod
851 /// For Kaiser only
852 /// @ingroup DVBC_DUAL
853 /// @param  pDMD_DVBC_InitData           \b IN: DVBC init data
854 /// @param  u32InitDataLen                   \b IN: DVBC init data length
855 /// @return TRUE : succeed
856 /// @return FALSE : fail
857 //-------------------------------------------------------------------------------------------------
858 extern     DLL_PUBLIC MS_BOOL MDrv_DMD_DVBC_Dual_Individual_Init(DMD_DVBC_InitData *pDMD_DVBC_InitData, MS_U32 u32InitDataLen);
859 
860 //-------------------------------------------------------------------------------------------------
861 /// Public dual init DVBC demod
862 /// For Kaiser only
863 /// @ingroup DVBC_DUAL
864 /// @param  u8AGC_Tristate_Ctrl       \b IN: Tristate control for RFAGC and IFAGC
865 /// @param  u8Sar_Channel                   \b IN: SAR channel for ADC config
866 /// @return TRUE : succeed
867 /// @return FALSE : fail
868 //-------------------------------------------------------------------------------------------------
869 extern  DLL_PUBLIC MS_BOOL MDrv_DMD_DVBC_Dual_Public_Init(MS_U8 u8AGC_Tristate_Ctrl,MS_U8 u8Sar_Channel);
870 
871 //-------------------------------------------------------------------------------------------------
872 /// To set DVBC power state
873 /// @ingroup DVBC_BASIC
874 /// @param  u16PowerState               \b IN: Power mode
875 /// @return UTOPIA_STATUS_TRUE : succeed
876 /// @return UTOPIA_STATUS_FAIL : fail
877 //-------------------------------------------------------------------------------------------------
878 // extern DLL_PUBLIC MS_U32 MDrv_DMD_DVBC_SetPowerState(EN_POWER_MODE u16PowerState);
879 #ifdef __cplusplus
880 }
881 #endif
882 
883 
884 #endif // _DRV_DVBC_H_
885 
886