xref: /utopia/UTPA2-700.0.x/mxlib/include/drvDMD_DTMB.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_DTMB.h
98 /// @brief  DTMB Driver Interface
99 /// @author MStar Semiconductor Inc.
100 ///////////////////////////////////////////////////////////////////////////////////////////////////
101 
102 /*! \defgroup Demod Demod interface
103 
104  *! \defgroup DTMB DTMB interface (drvDMD_DTMB.h)
105  *  \ingroup Demod
106 
107     \brief
108 
109     DTMB is the demodulator of supporting DTMB(6/7/8/9M) standard.
110     Receive RF signal from Tuner and transmit demodulated data to TS module.
111 
112     <b>Features</b>
113 
114     - Support DTMB(6/7/8/9M) standard.
115     - Pass CHINA SPEC.
116     - Pass the field stream.
117 
118     <b> DTMB Block Diagram: </b> \n
119     \image html drvDMD_DTMB_pic01.png
120 
121     <b> Operation Code Flow: </b> \n
122     -# Initialize DTMB parameters and load DEMOD FW
123     -# Enable DEMOD state machine
124     -# Monitor lock status
125 
126  *! \defgroup DTMB_BASIC DTMB basic control
127  *  \ingroup DTMB
128 
129  *! \defgroup DTMB_INFO DTMB information
130  *  \ingroup DTMB
131 
132  *! \defgroup DTMB_STR DTMB STR
133  *  \ingroup DTMB
134 
135  *! \defgroup DTMB_ToBeRemoved DTMB API to be removed
136  *  \ingroup DTMB
137  */
138 
139 #ifndef _DRV_DTMB_H_
140 #define _DRV_DTMB_H_
141 
142 //-------------------------------------------------------------------------------------------------
143 //  Driver Capability
144 //-------------------------------------------------------------------------------------------------
145 
146 #if !defined UTPA2
147 #define DMD_DTMB_UTOPIA_EN                  1
148 #define DMD_DTMB_UTOPIA2_EN                 0
149 #else
150 #define DMD_DTMB_UTOPIA_EN                  0
151 #define DMD_DTMB_UTOPIA2_EN                 1
152 #endif
153 
154 #define DMD_DTMB_STR_EN                     1
155 #define DMD_DTMB_MULTI_THREAD_SAFE          0
156 #define DMD_DTMB_MULTI_DMD_EN               1
157 
158 //-------------------------------------------------------------------------------------------------
159 //  Include Files
160 //-------------------------------------------------------------------------------------------------
161 
162 #include "MsTypes.h"
163 #if DMD_DTMB_UTOPIA_EN || DMD_DTMB_UTOPIA2_EN
164 #ifndef MSIF_TAG
165 #include "MsVersion.h"
166 #endif
167 #include "MsCommon.h"
168 #endif
169 #if DMD_DTMB_UTOPIA2_EN || DMD_DTMB_STR_EN
170 #include "utopia.h"
171 #endif
172 
173 //-------------------------------------------------------------------------------------------------
174 //  Driver Capability
175 //-------------------------------------------------------------------------------------------------
176 
177 
178 //-------------------------------------------------------------------------------------------------
179 //  Macro and Define
180 //-------------------------------------------------------------------------------------------------
181 
182 #ifndef DLL_PUBLIC
183 #define DLL_PUBLIC
184 #endif
185 
186 #if DMD_DTMB_MULTI_DMD_EN
187 #define DMD_DTMB_MAX_DEMOD_NUM          2
188 #else
189 #define DMD_DTMB_MAX_DEMOD_NUM          1
190 #endif
191 
192 #if DMD_DTMB_UTOPIA_EN || DMD_DTMB_UTOPIA2_EN
193 #define MSIF_DMD_DTMB_LIB_CODE          {'D','M','D','_','D','T', 'M','B','_'} //Lib code
194 #define MSIF_DMD_DTMB_LIBVER            {'0','0'}                              //LIB version
195 #define MSIF_DMD_DTMB_BUILDNUM          {'0','0' }                             //Build Number
196 #define MSIF_DMD_DTMB_CHANGELIST        {'0','0','0','0','0','0','0','0'}      //P4 ChangeList Number
197 
198 #define DMD_DTMB_VER                    /* Character String for DRV/API version             */  \
199     MSIF_TAG,                           /* 'MSIF'                                           */  \
200     MSIF_CLASS,                         /* '00'                                             */  \
201     MSIF_CUS,                           /* 0x0000                                           */  \
202     MSIF_MOD,                           /* 0x0000                                           */  \
203     MSIF_CHIP,                                                                                  \
204     MSIF_CPU,                                                                                   \
205     MSIF_DMD_DTMB_LIB_CODE,             /* IP__                                             */  \
206     MSIF_DMD_DTMB_LIBVER,               /* 0.0 ~ Z.Z                                        */  \
207     MSIF_DMD_DTMB_BUILDNUM,             /* 00 ~ 99                                          */  \
208     MSIF_DMD_DTMB_CHANGELIST,           /* CL#                                              */  \
209     MSIF_OS
210 #endif // #if DMD_DTMB_UTOPIA_EN || DMD_DTMB_UTOPIA2_EN
211 
212 #ifndef BIT_
213 #define BIT_(n)                                 (1 << (n))
214 #endif
215 
216 #define DMD_DTMB_LOCK_DTMB_PNP_LOCK             BIT_(0)
217 #define DMD_DTMB_LOCK_DTMB_FEC_LOCK             BIT_(1)
218 
219 #define DMD_DTMB_LOCK_DVBC_AGC_LOCK             BIT_(8)
220 #define DMD_DTMB_LOCK_DVBC_PRE_LOCK             BIT_(9)
221 #define DMD_DTMB_LOCK_DVBC_MAIN_LOCK            BIT_(10)
222 
223 //-------------------------------------------------------------------------------------------------
224 //  Type and Structure
225 //-------------------------------------------------------------------------------------------------
226 
227 typedef enum
228 {
229     DMD_DTMB_HAL_CMD_Exit = 0,
230     DMD_DTMB_HAL_CMD_InitClk,
231     DMD_DTMB_HAL_CMD_Download,
232     DMD_DTMB_HAL_CMD_FWVERSION,
233     DMD_DTMB_HAL_CMD_SoftReset,
234     DMD_DTMB_HAL_CMD_SetACICoef,
235     DMD_DTMB_HAL_CMD_SetDTMBMode,
236     DMD_DTMB_HAL_CMD_SetModeClean,
237     DMD_DTMB_HAL_CMD_Set_QAM_SR,
238     DMD_DTMB_HAL_CMD_Active,
239     DMD_DTMB_HAL_CMD_AGCLock,
240     DMD_DTMB_HAL_CMD_DTMB_PNP_Lock,
241     DMD_DTMB_HAL_CMD_DTMB_FEC_Lock,
242     DMD_DTMB_HAL_CMD_DVBC_PreLock,
243     DMD_DTMB_HAL_CMD_DVBC_Main_Lock,
244     DMD_DTMB_HAL_CMD_GetModulation,
245     DMD_DTMB_HAL_CMD_ReadIFAGC,
246     DMD_DTMB_HAL_CMD_ReadFrequencyOffset,
247     DMD_DTMB_HAL_CMD_ReadSNRPercentage,
248     DMD_DTMB_HAL_CMD_GetPreLdpcBer,
249     DMD_DTMB_HAL_CMD_GetPreViterbiBer,
250     DMD_DTMB_HAL_CMD_GetPostViterbiBer,
251     DMD_DTMB_HAL_CMD_GetSNR,
252     DMD_DTMB_HAL_CMD_TS_INTERFACE_CONFIG,
253     DMD_DTMB_HAL_CMD_IIC_Bypass_Mode,
254     DMD_DTMB_HAL_CMD_SSPI_TO_GPIO,
255     DMD_DTMB_HAL_CMD_GPIO_GET_LEVEL,
256     DMD_DTMB_HAL_CMD_GPIO_SET_LEVEL,
257     DMD_DTMB_HAL_CMD_GPIO_OUT_ENABLE,
258     DMD_DTMB_HAL_CMD_DoIQSwap,
259     DMD_DTMB_HAL_CMD_GET_REG,
260     DMD_DTMB_HAL_CMD_SET_REG
261 } DMD_DTMB_HAL_COMMAND;
262 
263 typedef enum
264 {
265     DMD_DTMB_DEMOD_DTMB,
266     DMD_DTMB_DEMOD_DTMB_7M,
267     DMD_DTMB_DEMOD_DTMB_6M,
268     DMD_DTMB_DEMOD_DTMB_5M,
269     DMD_DTMB_DEMOD_DVBC_64QAM,
270     DMD_DTMB_DEMOD_DVBC_256QAM,
271     DMD_DTMB_DEMOD_DVBC_16QAM,
272     DMD_DTMB_DEMOD_DVBC_32QAM,
273     DMD_DTMB_DEMOD_DVBC_128QAM,
274     DMD_DTMB_DEMOD_MAX,
275     DMD_DTMB_DEMOD_NULL = DMD_DTMB_DEMOD_MAX,
276 } DMD_DTMB_DEMOD_TYPE;
277 
278 typedef struct DLL_PACKED
279 {
280     union
281     {
282         #ifdef UTPA2
283         MS_U16 fSiCodeRate; //0.4, 0.6, 0.8
284         MS_U16 fDvbcSymRateL;
285         #else
286         float fSiCodeRate; //0.4, 0.6, 0.8
287         float fDvbcSymRateL;
288         #endif
289     };
290     union
291     {
292         MS_U16 u8SiInterLeaver; //240, 720
293         MS_U16 u8DvbcSymRateH;
294     };
295     union
296     {
297         MS_U8 u8SiQamMode; //4QAM, 16QAM, 32QAM, 64QAM
298         MS_U8 u8DvbcQamMode;
299     };
300     MS_U8  u8SiNR;
301     MS_U8  u8SiCarrierMode; //0: multiple carrier, 1:single carrier
302     MS_U16 u16PNM; //420, 595, 945
303     MS_U8  u8PNC; //0: variable, 1: constant
304     DMD_DTMB_DEMOD_TYPE eDemodType; //DTMB or DVBC
305 } DMD_DTMB_MODULATION_INFO;
306 
307 #ifdef UTPA2
308 typedef struct DLL_PACKED
309 {
310     MS_S16 fftfirstCfo;
311     MS_S8  fftSecondCfo;
312     MS_S16 sr;
313 } DMD_DTMB_CFO_DATA;
314 
315 typedef struct DLL_PACKED
316 {
317     MS_U32 BitErr;
318     MS_U16 Error_window;
319 } DMD_DTMB_BER_DATA;
320 
321 typedef struct DLL_PACKED
322 {
323     MS_U32 snr;
324     MS_U16 sym_num;
325 } DMD_DTMB_SNR_DATA;
326 #endif
327 
328 typedef struct DLL_PACKED
329 {
330     MS_U8 u8Pin;
331     union
332     {
333         MS_BOOL bLevel;
334         MS_BOOL bIsOut;
335     };
336 } DMD_DTMB_GPIO_PIN_DATA;
337 
338 typedef struct DLL_PACKED
339 {
340     MS_U16 u16Addr;
341     MS_U8  u8Data;
342 } DMD_DTMB_REG_DATA;
343 
344 typedef enum
345 {
346     DMD_DTMB_DBGLV_NONE,    // disable all the debug message
347     DMD_DTMB_DBGLV_INFO,    // information
348     DMD_DTMB_DBGLV_NOTICE,  // normal but significant condition
349     DMD_DTMB_DBGLV_WARNING, // warning conditions
350     DMD_DTMB_DBGLV_ERR,     // error conditions
351     DMD_DTMB_DBGLV_CRIT,    // critical conditions
352     DMD_DTMB_DBGLV_ALERT,   // action must be taken immediately
353     DMD_DTMB_DBGLV_EMERG,   // system is unusable
354     DMD_DTMB_DBGLV_DEBUG,   // debug-level messages
355 } DMD_DTMB_DbgLv;
356 
357 typedef enum
358 {
359     DMD_DTMB_GETLOCK,
360     DMD_DTMB_GETLOCK_DTMB_AGCLOCK,
361     DMD_DTMB_GETLOCK_DTMB_PNPLOCK,
362     DMD_DTMB_GETLOCK_DTMB_FECLOCK,
363     DMD_DTMB_GETLOCK_DVBC_AGCLOCK,
364     DMD_DTMB_GETLOCK_DVBC_PRELOCK,
365     DMD_DTMB_GETLOCK_DVBC_MAINLOCK,
366 } DMD_DTMB_GETLOCK_TYPE;
367 
368 typedef enum
369 {
370     DMD_DTMB_LOCK,
371     DMD_DTMB_CHECKING,
372     DMD_DTMB_CHECKEND,
373     DMD_DTMB_UNLOCK,
374     DMD_DTMB_NULL,
375 } DMD_DTMB_LOCK_STATUS;
376 
377 /// For demod init
378 typedef struct DLL_PACKED
379 {
380     // init
381     MS_U16 u16DTMBAGCLockCheckTime;//50
382     MS_U16 u16DTMBPreLockCheckTime;//300
383     MS_U16 u16DTMBPNMLockCheckTime;//1200
384     MS_U16 u16DTMBFECLockCheckTime;//5000
385 
386     MS_U16 u16QAMAGCLockCheckTime;//50
387     MS_U16 u16QAMPreLockCheckTime;//1000
388     MS_U16 u16QAMMainLockCheckTime;//3000
389 
390     // register init
391     MS_U8 *u8DMD_DTMB_DSPRegInitExt; // TODO use system variable type
392     MS_U8 u8DMD_DTMB_DSPRegInitSize;
393     MS_U8 *u8DMD_DTMB_InitExt; // TODO use system variable type
394 
395     //By Tuners:
396     MS_U16  u16IF_KHZ;//By Tuners
397     MS_BOOL bIQSwap;//0
398     MS_U16  u16AGC_REFERENCE;//0
399     MS_BOOL bTunerGainInvert;//0
400 
401     //By IC:
402     MS_U8   u8IS_DUAL;//0
403     MS_BOOL bIsExtDemod;//0
404 
405     //By TS (Only for MCP or ext demod):
406     MS_U8 u1TsConfigByte_SerialMode : 1;
407     MS_U8 u1TsConfigByte_DataSwap   : 1;
408     MS_U8 u1TsConfigByte_ClockInv   : 1;
409     MS_U8 u5TsConfigByte_DivNum     : 5;
410 
411     //By SYS I2C (Only for MCP or ext demod):
412     MS_U8 u8I2CSlaveAddr;
413     MS_U8 u8I2CSlaveBus;
414     MS_BOOL (*I2C_WriteBytes)(MS_U16 u16BusNumSlaveID, MS_U8 u8addrcount, MS_U8* pu8addr, MS_U16 u16size, MS_U8* pu8data);
415     MS_BOOL (*I2C_ReadBytes)(MS_U16 u16BusNumSlaveID, MS_U8 u8AddrNum, MS_U8* paddr, MS_U16 u16size, MS_U8* pu8data);
416 
417     //By SYS MSPI (Only for MCP or ext demod):
418     MS_BOOL bIsUseSspiLoadCode;
419     MS_BOOL bIsSspiUseTsPin;
420 
421     //By SYS memory mapping (Only for int demod):
422     MS_U32 u32TdiStartAddr;
423 
424     #if !DMD_DTMB_UTOPIA_EN && !DMD_DTMB_UTOPIA2_EN
425     MS_U32  (*GetSystemTimeMS)(void);      // Get sys time (unit: ms)
426     void    (*DelayMS)(MS_U32 ms);         // Delay time (unit: ms)
427     MS_BOOL (*CreateMutex)(MS_BOOL enable); // Create&Delete mutex
428     void    (*LockDMD)(MS_BOOL enable);    // Enter&Leave mutex
429     #endif
430 } DMD_DTMB_InitData;
431 
432 typedef struct DLL_PACKED
433 {
434     MS_VIRT virtDMDBaseAddr;
435 
436     MS_BOOL bInit;
437     MS_BOOL bDownloaded;
438 
439     #if DMD_DTMB_STR_EN
440     MS_BOOL             bIsDTV;
441     EN_POWER_MODE       eLastState;
442     #endif
443     DMD_DTMB_DEMOD_TYPE eLastType;
444     MS_U16              u16SymRate;
445 
446     MS_BOOL bIsQPad;
447     MS_U16  u16ChipID;
448 
449     MS_BOOL (*HAL_DMD_DTMB_IOCTL_CMD)(DMD_DTMB_HAL_COMMAND eCmd, void *pPara);
450 } DMD_DTMB_PriData;
451 
452 typedef struct DLL_PACKED
453 {
454     MS_U8  u8Version;
455     MS_U32 u32DTMBScanTimeStart;
456     MS_U32 u32DTMBFECLockTime;
457     MS_U32 u32DTMBLockStatus;
458 } DMD_DTMB_Info;
459 
460 typedef struct DLL_PACKED
461 {
462     DMD_DTMB_InitData  sDMD_DTMB_InitData;
463     DMD_DTMB_PriData   sDMD_DTMB_PriData;
464     DMD_DTMB_Info      sDMD_DTMB_Info;
465 } DMD_DTMB_ResData;
466 
467 //-------------------------------------------------------------------------------------------------
468 //  Function and Variable
469 //-------------------------------------------------------------------------------------------------
470 
471 #ifdef __cplusplus
472 extern "C"
473 {
474 #endif
475 
476 #ifndef MSOS_TYPE_LINUX_KERNEL
477 
478 //-------------------------------------------------------------------------------------------------
479 /// Set detailed level of DTMB driver debug message
480 /// @ingroup DTMB_BASIC
481 /// @param u8DbgLevel    \b IN: debug level for Parallel Flash driver
482 /// @return TRUE : succeed
483 /// @return FALSE : fail
484 //-------------------------------------------------------------------------------------------------
485 DLL_PUBLIC extern MS_BOOL MDrv_DMD_DTMB_SetDbgLevel(DMD_DTMB_DbgLv u8DbgLevel);
486 //-------------------------------------------------------------------------------------------------
487 /// Get the information of DTMB driver
488 /// @ingroup DTMB_INFO
489 /// @return : the pointer to the driver information
490 //-------------------------------------------------------------------------------------------------
491 DLL_PUBLIC extern DMD_DTMB_Info* MDrv_DMD_DTMB_GetInfo(void);
492 //-------------------------------------------------------------------------------------------------
493 /// Get DTMB driver version
494 /// @ingroup DTMB_INFO
495 /// @param ppVersion    \b OUT: the pointer to the driver version
496 /// @return TRUE : succeed
497 /// @return FALSE : fail
498 //-------------------------------------------------------------------------------------------------
499 DLL_PUBLIC extern MS_BOOL MDrv_DMD_DTMB_GetLibVer(const MSIF_Version **ppVersion);
500 //-------------------------------------------------------------------------------------------------
501 /// Initialize HAL interface
502 /// @ingroup DTMB_BASIC
503 /// @return TRUE : succeed
504 /// @return FALSE : fail
505 //-------------------------------------------------------------------------------------------------
506 DLL_PUBLIC extern MS_BOOL MDrv_DMD_DTMB_Initial_Hal_Interface(void);
507 
508 ////////////////////////////////////////////////////////////////////////////////
509 ///                            SINGLE DEMOD API                              ///
510 ////////////////////////////////////////////////////////////////////////////////
511 
512 //-------------------------------------------------------------------------------------------------
513 /// Initialize DTMB Demod
514 /// @ingroup DTMB_BASIC
515 /// @param pDMD_DTMB_InitData    \b IN: DTMB initial parameters
516 /// @param u32InitDataLen        \b IN: size of DTMB initial parameters
517 /// @return TRUE : succeed
518 /// @return FALSE : fail
519 //-------------------------------------------------------------------------------------------------
520 DLL_PUBLIC extern MS_BOOL MDrv_DMD_DTMB_Init(DMD_DTMB_InitData *pDMD_DTMB_InitData, MS_U32 u32InitDataLen);
521 //-------------------------------------------------------------------------------------------------
522 /// Exit DTMB DTV mode
523 /// @ingroup DTMB_STR
524 /// @return TRUE : succeed
525 /// @return FALSE : fail
526 //-------------------------------------------------------------------------------------------------
527 DLL_PUBLIC extern MS_BOOL MDrv_DMD_DTMB_Exit(void);
528 //-------------------------------------------------------------------------------------------------
529 /// Get Initial Data
530 /// @ingroup DTMB_BASIC
531 /// @param psDMD_DTMB_InitData    \b IN: DTMB initial parameters
532 /// @return TRUE : succeed
533 /// @return FALSE : fail
534 //-------------------------------------------------------------------------------------------------
535 DLL_PUBLIC extern MS_U32 MDrv_DMD_DTMB_GetConfig(DMD_DTMB_InitData *psDMD_DTMB_InitData);
536 //-------------------------------------------------------------------------------------------------
537 /// Set Demod mode and restart Demod
538 /// @ingroup DTMB_BASIC
539 /// @param eType    \b IN: Select DTMB modulation type
540 /// @param bEnable  \b IN: Enable SetConfig function
541 /// @return TRUE : succeed
542 /// @return FALSE : fail
543 //-------------------------------------------------------------------------------------------------
544 DLL_PUBLIC extern MS_BOOL MDrv_DMD_DTMB_SetConfig(DMD_DTMB_DEMOD_TYPE eType, MS_BOOL bEnable);
545 //-------------------------------------------------------------------------------------------------
546 /// Reset FW state machine
547 /// @ingroup DTMB_ToBeRemoved
548 /// @return TRUE : succeed
549 /// @return FALSE : fail
550 //-------------------------------------------------------------------------------------------------
551 DLL_PUBLIC extern MS_BOOL MDrv_DMD_DTMB_SetReset(void);
552 //-------------------------------------------------------------------------------------------------
553 /// Set QAM Type and symbol rate
554 /// @ingroup DTMB_ToBeRemoved
555 /// @param eType    \b IN: QAM type
556 /// @param symbol_rate    \b IN: symbol rate
557 /// @return TRUE : succeed
558 /// @return FALSE : fail
559 //-------------------------------------------------------------------------------------------------
560 DLL_PUBLIC extern MS_BOOL MDrv_DMD_DTMB_Set_QAM_SR(DMD_DTMB_DEMOD_TYPE eType, MS_U16 symbol_rate);
561 //-------------------------------------------------------------------------------------------------
562 /// Active Demod
563 /// @ingroup DTMB_ToBeRemoved
564 /// @param bEnable    \b IN: Active Demod if TRUE
565 /// @return TRUE : succeed
566 /// @return FALSE : fail
567 //-------------------------------------------------------------------------------------------------
568 DLL_PUBLIC extern MS_BOOL MDrv_DMD_DTMB_SetActive(MS_BOOL bEnable);
569 //-------------------------------------------------------------------------------------------------
570 /// Support DTMB STR function
571 /// @ingroup DTMB_STR
572 /// @param u16PowerState    \b IN: Set STR status
573 /// @return : STR status
574 //-------------------------------------------------------------------------------------------------
575 #if DMD_DTMB_STR_EN
576 DLL_PUBLIC extern MS_U32 MDrv_DMD_DTMB_SetPowerState(EN_POWER_MODE u16PowerState);
577 #endif
578 //-------------------------------------------------------------------------------------------------
579 /// Get lock status
580 /// @ingroup DTMB_INFO
581 /// @param eType    \b IN: select lock type
582 /// @return : lock status
583 //-------------------------------------------------------------------------------------------------
584 DLL_PUBLIC extern DMD_DTMB_LOCK_STATUS MDrv_DMD_DTMB_GetLock(DMD_DTMB_GETLOCK_TYPE eType);
585 //-------------------------------------------------------------------------------------------------
586 /// Get modulation mode
587 /// @ingroup DTMB_INFO
588 /// @return : modulation mode
589 //-------------------------------------------------------------------------------------------------
590 DLL_PUBLIC extern MS_BOOL MDrv_DMD_DTMB_GetModulationMode(DMD_DTMB_MODULATION_INFO *sDtmbModulationMode);
591 //-------------------------------------------------------------------------------------------------
592 /// Get Demod signal strength (IF AGC gain)
593 /// @ingroup DTMB_INFO
594 /// @param u16Strength    \b OUT: the pointer to signal strength
595 /// @return TRUE : succeed
596 /// @return FALSE : fail
597 //-------------------------------------------------------------------------------------------------
598 DLL_PUBLIC extern MS_BOOL MDrv_DMD_DTMB_GetSignalStrength(MS_U16 *u16Strength);
599 //-------------------------------------------------------------------------------------------------
600 /// Get Demod frequency offset
601 /// @ingroup DTMB_INFO
602 /// @param cfo    \b OUT: the pointer to CFO
603 /// @return TRUE : succeed
604 /// @return FALSE : fail
605 //-------------------------------------------------------------------------------------------------
606 DLL_PUBLIC extern MS_BOOL MDrv_DMD_DTMB_ReadFrequencyOffset(MS_S16 *cfo);
607 //-------------------------------------------------------------------------------------------------
608 /// Get signal quality
609 /// @ingroup DTMB_INFO
610 /// @return : signal quality
611 //-------------------------------------------------------------------------------------------------
612 DLL_PUBLIC extern MS_U8 MDrv_DMD_DTMB_GetSignalQuality(void);
613 //-------------------------------------------------------------------------------------------------
614 /// Get pre LDPC data
615 /// @ingroup DTMB_INFO
616 /// @param pber    \b OUT: the pointer to pre LDPC data
617 /// @return TRUE : succeed
618 /// @return FALSE : fail
619 //-------------------------------------------------------------------------------------------------
620 DLL_PUBLIC extern MS_BOOL MDrv_DMD_DTMB_GetPreLdpcBer(float *pber);
621 //-------------------------------------------------------------------------------------------------
622 /// Get Demod pre Viterbi number
623 /// @ingroup DTMB_ToBeRemoved
624 /// @param ber    \b OUT: the pointer to pre Viterbi BER
625 /// @return TRUE : succeed
626 /// @return FALSE : fail
627 //-------------------------------------------------------------------------------------------------
628 DLL_PUBLIC extern MS_BOOL MDrv_DMD_DTMB_GetPreViterbiBer(float *ber);
629 //-------------------------------------------------------------------------------------------------
630 /// Get Demod post Viterbi number
631 /// @ingroup DTMB_INFO
632 /// @param ber    \b OUT: the pointer to post Viterbi BER
633 /// @return TRUE : succeed
634 /// @return FALSE : fail
635 //-------------------------------------------------------------------------------------------------
636 DLL_PUBLIC extern MS_BOOL MDrv_DMD_DTMB_GetPostViterbiBer(float *ber);
637 //-------------------------------------------------------------------------------------------------
638 /// Get SNR
639 /// @ingroup DTMB_INFO
640 /// @param snr    \b OUT: the pointer to SNR
641 /// @return TRUE : succeed
642 /// @return FALSE : fail
643 //-------------------------------------------------------------------------------------------------
644 DLL_PUBLIC extern MS_BOOL MDrv_DMD_DTMB_GetSNR(float *snr);
645 //-------------------------------------------------------------------------------------------------
646 /// Set TS output mode
647 /// @ingroup DTMB_BASIC
648 /// @param u8TsConfigData    \b IN: TS configuration
649 /// @return TRUE : succeed
650 /// @return FALSE : fail
651 //-------------------------------------------------------------------------------------------------
652 DLL_PUBLIC extern MS_BOOL MDrv_DMD_DTMB_SetSerialControl(MS_U8 u8TsConfigData);
653 //-------------------------------------------------------------------------------------------------
654 /// Enable I2C bypass mode
655 /// @ingroup DTMB_BASIC
656 /// @param bEnable    \b IN: Enable bypass mode
657 /// @return TRUE : succeed
658 /// @return FALSE : fail
659 //-------------------------------------------------------------------------------------------------
660 DLL_PUBLIC extern MS_BOOL MDrv_DMD_DTMB_IIC_BYPASS_MODE(MS_BOOL bEnable);
661 //-------------------------------------------------------------------------------------------------
662 /// Set SSPI pin as GPIO function
663 /// @ingroup DTMB_BASIC
664 /// @param bEnable    \b IN: Switch to GPIO if TRUE, otherwise SSPI
665 /// @return TRUE : succeed
666 /// @return FALSE : fail
667 //------------------------------------------------------------------------------------------------
668 DLL_PUBLIC extern MS_BOOL MDrv_DMD_DTMB_SWITCH_SSPI_GPIO(MS_BOOL bEnable);
669 //-------------------------------------------------------------------------------------------------
670 /// Get GPIO level
671 /// @ingroup DTMB_BASIC
672 /// @param u8Pin    \b IN: Select pin number
673 /// @param bLevel    \b OUT: the pointer to GPIO level
674 /// @return TRUE : succeed
675 /// @return FALSE : fail
676 //-------------------------------------------------------------------------------------------------
677 DLL_PUBLIC extern MS_BOOL MDrv_DMD_DTMB_GPIO_GET_LEVEL(MS_U8 u8Pin, MS_BOOL *bLevel);
678 //-------------------------------------------------------------------------------------------------
679 /// Set GPIO level
680 /// @ingroup DTMB_BASIC
681 /// @param u8Pin    \b IN: Select pin number
682 /// @param bLevel    \b IN: Set GPIO level
683 /// @return TRUE : succeed
684 /// @return FALSE : fail
685 //-------------------------------------------------------------------------------------------------
686 DLL_PUBLIC extern MS_BOOL MDrv_DMD_DTMB_GPIO_SET_LEVEL(MS_U8 u8Pin, MS_BOOL bLevel);
687 //-------------------------------------------------------------------------------------------------
688 /// Set GPIO as output or input
689 /// @ingroup DTMB_BASIC
690 /// @param u8Pin    \b IN: Select pin number
691 /// @param bEnableOut    \b IN: output if TRUE, otherwise input
692 /// @return TRUE : succeed
693 /// @return FALSE : fail
694 //-------------------------------------------------------------------------------------------------
695 DLL_PUBLIC extern MS_BOOL MDrv_DMD_DTMB_GPIO_OUT_ENABLE(MS_U8 u8Pin, MS_BOOL bEnableOut);
696 //-------------------------------------------------------------------------------------------------
697 /// Swap ADC input
698 /// @ingroup DTMB_BASIC
699 /// @param bIsQPad    \b IN: Q pad if TRUE, otherwise I pad
700 /// @return TRUE : succeed
701 /// @return FALSE : fail
702 //-------------------------------------------------------------------------------------------------
703 DLL_PUBLIC extern MS_BOOL MDrv_DMD_DTMB_DoIQSwap(MS_BOOL bIsQPad);
704 //-------------------------------------------------------------------------------------------------
705 /// Get Demod register value
706 /// @ingroup DTMB_BASIC
707 /// @param u16Addr    \b IN: register address
708 /// @param pu8Data    \b OUT: the pointer to register data
709 /// @return TRUE : succeed
710 /// @return FALSE : fail
711 //-------------------------------------------------------------------------------------------------
712 DLL_PUBLIC extern MS_BOOL MDrv_DMD_DTMB_GetReg(MS_U16 u16Addr, MS_U8 *pu8Data);
713 //-------------------------------------------------------------------------------------------------
714 /// Set Demod register value
715 /// @ingroup DTMB_BASIC
716 /// @param u16Addr    \b IN: register address
717 /// @param u8Data    \b IN: register data
718 /// @return TRUE : succeed
719 /// @return FALSE : fail
720 //-------------------------------------------------------------------------------------------------
721 DLL_PUBLIC extern MS_BOOL MDrv_DMD_DTMB_SetReg(MS_U16 u16Addr, MS_U8 u8Data);
722 
723 ////////////////////////////////////////////////////////////////////////////////
724 ///                            MULTI DEMOD API                               ///
725 ////////////////////////////////////////////////////////////////////////////////
726 
727 //-------------------------------------------------------------------------------------------------
728 /// Initialize multiple DTMB Demod
729 /// @ingroup DTMB_BASIC
730 /// @param id                    \b IN: Select Demod number
731 /// @param pDMD_DTMB_InitData    \b IN: DTMB initial parameters
732 /// @param u32InitDataLen        \b IN: size of DTMB initial parameters
733 /// @return TRUE : succeed
734 /// @return FALSE : fail
735 //-------------------------------------------------------------------------------------------------
736 DLL_PUBLIC extern MS_BOOL MDrv_DMD_DTMB_MD_Init(MS_U8 id, DMD_DTMB_InitData *pDMD_DTMB_InitData, MS_U32 u32InitDataLen);
737 //-------------------------------------------------------------------------------------------------
738 /// Support multiple Demod of exiting DTMB DTV mode
739 /// @ingroup DTMB_STR
740 /// @param id    \b IN: Select Demod number
741 /// @return TRUE : succeed
742 /// @return FALSE : fail
743 //-------------------------------------------------------------------------------------------------
744 DLL_PUBLIC extern MS_BOOL MDrv_DMD_DTMB_MD_Exit(MS_U8 id);
745 //-------------------------------------------------------------------------------------------------
746 /// Get Initial Data
747 /// @ingroup DTMB_BASIC
748 /// @param @param id              \b IN: Select Demod number
749 /// @param psDMD_DTMB_InitData    \b IN: DTMB initial parameters
750 /// @return TRUE : succeed
751 /// @return FALSE : fail
752 //-------------------------------------------------------------------------------------------------
753 DLL_PUBLIC extern MS_U32 MDrv_DMD_DTMB_MD_GetConfig(MS_U8 id, DMD_DTMB_InitData *psDMD_DTMB_InitData);
754 //-------------------------------------------------------------------------------------------------
755 /// Support multiple Demod of setting and restarting Demod
756 /// @ingroup DTMB_BASIC
757 /// @param id    \b IN: Select Demod number
758 /// @param eType    \b IN: Select DTMB modulation type
759 /// @param bEnable  \b IN: Enable SetConfig function
760 /// @return TRUE : succeed
761 /// @return FALSE : fail
762 //-------------------------------------------------------------------------------------------------
763 DLL_PUBLIC extern MS_BOOL MDrv_DMD_DTMB_MD_SetConfig(MS_U8 id, DMD_DTMB_DEMOD_TYPE eType, MS_BOOL bEnable);
764 //-------------------------------------------------------------------------------------------------
765 /// Support multiple Demod of reset FW state machine
766 /// @ingroup DTMB_ToBeRemoved
767 /// @param id    \b IN: Select Demod number
768 /// @return TRUE : succeed
769 /// @return FALSE : fail
770 //-------------------------------------------------------------------------------------------------
771 DLL_PUBLIC extern MS_BOOL MDrv_DMD_DTMB_MD_SetReset(MS_U8 id);
772 //-------------------------------------------------------------------------------------------------
773 /// Support multiple Demod of setting QAM Type and symbol rate
774 /// @ingroup DTMB_ToBeRemoved
775 /// @param id    \b IN: Select Demod number
776 /// @param eType    \b IN: QAM type
777 /// @param symbol_rate    \b IN: symbol rate
778 /// @return TRUE : succeed
779 /// @return FALSE : fail
780 //-------------------------------------------------------------------------------------------------
781 DLL_PUBLIC extern MS_BOOL MDrv_DMD_DTMB_MD_Set_QAM_SR(MS_U8 id, DMD_DTMB_DEMOD_TYPE eType, MS_U16 symbol_rate);
782 //-------------------------------------------------------------------------------------------------
783 /// Support multiple Demod of active Demod
784 /// @ingroup DTMB_ToBeRemoved
785 /// @param id    \b IN: Select Demod number
786 /// @param bEnable    \b IN: Active Demod if TRUE
787 /// @return TRUE : succeed
788 /// @return FALSE : fail
789 //-------------------------------------------------------------------------------------------------
790 DLL_PUBLIC extern MS_BOOL MDrv_DMD_DTMB_MD_SetActive(MS_U8 id, MS_BOOL bEnable);
791 //-------------------------------------------------------------------------------------------------
792 /// Support multiple Demod of DTMB STR function
793 /// @ingroup DTMB_STR
794 /// @param id    \b IN: Select Demod number
795 /// @param u16PowerState    \b IN: Set STR status
796 /// @return : STR status
797 //-------------------------------------------------------------------------------------------------
798 #if DMD_DTMB_STR_EN
799 DLL_PUBLIC extern MS_U32 MDrv_DMD_DTMB_MD_SetPowerState(MS_U8 id, EN_POWER_MODE u16PowerState);
800 #endif
801 //-------------------------------------------------------------------------------------------------
802 /// Support multiple Demod of getting lock status
803 /// @ingroup DTMB_INFO
804 /// @param id    \b IN: Select Demod number
805 /// @param eType    \b IN: select lock type
806 /// @return : lock status
807 //-------------------------------------------------------------------------------------------------
808 DLL_PUBLIC extern DMD_DTMB_LOCK_STATUS MDrv_DMD_DTMB_MD_GetLock(MS_U8 id, DMD_DTMB_GETLOCK_TYPE eType);
809 //-------------------------------------------------------------------------------------------------
810 /// Support multiple Demod of getting modulation mode
811 /// @ingroup DTMB_INFO
812 /// @param id    \b IN: Select Demod number
813 /// @return : modulation mode
814 //-------------------------------------------------------------------------------------------------
815 DLL_PUBLIC extern MS_BOOL MDrv_DMD_DTMB_MD_GetModulationMode(MS_U8 id, DMD_DTMB_MODULATION_INFO *sDtmbModulationMode);
816 //-------------------------------------------------------------------------------------------------
817 /// Support multiple Demod of getting Demod signal strength (IF AGC gain)
818 /// @ingroup DTMB_INFO
819 /// @param id    \b IN: Select Demod number
820 /// @param u16Strength    \b OUT: the pointer to signal strength
821 /// @return TRUE : succeed
822 /// @return FALSE : fail
823 //-------------------------------------------------------------------------------------------------
824 DLL_PUBLIC extern MS_BOOL MDrv_DMD_DTMB_MD_GetSignalStrength(MS_U8 id, MS_U16 *u16Strength);
825 //-------------------------------------------------------------------------------------------------
826 /// Support multiple Demod of getting Demod fequency offset
827 /// @ingroup DTMB_INFO
828 /// @param id    \b IN: Select Demod number
829 /// @param cfo    \b OUT: the pointer to CFO
830 /// @return TRUE : succeed
831 /// @return FALSE : fail
832 //-------------------------------------------------------------------------------------------------
833 DLL_PUBLIC extern MS_BOOL MDrv_DMD_DTMB_MD_ReadFrequencyOffset(MS_U8 id, MS_S16 *cfo);
834 //-------------------------------------------------------------------------------------------------
835 /// Support multiple Demod of getting Demod signal quality
836 /// @ingroup DTMB_INFO
837 /// @param id    \b IN: Select Demod number
838 /// @return : signal quality
839 //-------------------------------------------------------------------------------------------------
840 DLL_PUBLIC extern MS_U8 MDrv_DMD_DTMB_MD_GetSignalQuality(MS_U8 id);
841 //-------------------------------------------------------------------------------------------------
842 /// Support multiple Demod of getting pre LDPC data
843 /// @ingroup DTMB_INFO
844 /// @param id    \b IN: Select Demod number
845 /// @param pber    \b OUT: the pointer to pre LDPC data
846 /// @return TRUE : succeed
847 /// @return FALSE : fail
848 //-------------------------------------------------------------------------------------------------
849 DLL_PUBLIC extern MS_BOOL MDrv_DMD_DTMB_MD_GetPreLdpcBer(MS_U8 id, float *pber);
850 //-------------------------------------------------------------------------------------------------
851 /// Support multiple Demod of getting Demod pre Viterbi number
852 /// @ingroup DTMB_ToBeRemoved
853 /// @param id    \b IN: Select Demod number
854 /// @param ber    \b OUT: the pointer to BER
855 /// @return TRUE : succeed
856 /// @return FALSE : fail
857 //-------------------------------------------------------------------------------------------------
858 DLL_PUBLIC extern MS_BOOL MDrv_DMD_DTMB_MD_GetPreViterbiBer(MS_U8 id, float *ber);
859 //-------------------------------------------------------------------------------------------------
860 /// Support multiple Demod of getting Demod post Viterbi number
861 /// @ingroup DTMB_INFO
862 /// @param id    \b IN: Select Demod number
863 /// @param ber    \b OUT: the pointer to BER
864 /// @return TRUE : succeed
865 /// @return FALSE : fail
866 //-------------------------------------------------------------------------------------------------
867 DLL_PUBLIC extern MS_BOOL MDrv_DMD_DTMB_MD_GetPostViterbiBer(MS_U8 id, float *ber);
868 //-------------------------------------------------------------------------------------------------
869 /// Support multiple Demod of getting SNR
870 /// @ingroup DTMB_INFO
871 /// @param id    \b IN: Select Demod number
872 /// @param snr    \b OUT: the pointer to SNR
873 /// @return TRUE : succeed
874 /// @return FALSE : fail
875 //-------------------------------------------------------------------------------------------------
876 DLL_PUBLIC extern MS_BOOL MDrv_DMD_DTMB_MD_GetSNR(MS_U8 id, float *snr);
877 //-------------------------------------------------------------------------------------------------
878 /// Support multiple Demod of setting TS output mode
879 /// @ingroup DTMB_BASIC
880 /// @param id    \b IN: Select Demod number
881 /// @param u8TsConfigData    \b IN: TS configuration
882 /// @return TRUE : succeed
883 /// @return FALSE : fail
884 //-------------------------------------------------------------------------------------------------
885 DLL_PUBLIC extern MS_BOOL MDrv_DMD_DTMB_MD_SetSerialControl(MS_U8 id, MS_U8 u8TsConfigData);
886 //-------------------------------------------------------------------------------------------------
887 /// Support multiple Demod of enabling I2C bypass mode
888 /// @ingroup DTMB_BASIC
889 /// @param id    \b IN: Select Demod number
890 /// @param bEnable    \b IN: Enable bypass mode
891 /// @return TRUE : succeed
892 /// @return FALSE : fail
893 //-------------------------------------------------------------------------------------------------
894 DLL_PUBLIC extern MS_BOOL MDrv_DMD_DTMB_MD_IIC_BYPASS_MODE(MS_U8 id, MS_BOOL bEnable);
895 //-------------------------------------------------------------------------------------------------
896 /// Support multiple Demod of setting SSPI pin as GPIO function
897 /// @ingroup DTMB_BASIC
898 /// @param id    \b IN: Select Demod number
899 /// @param bEnable    \b IN: Switch to GPIO if TRUE, otherwise SSPI
900 /// @return TRUE : succeed
901 /// @return FALSE : fail
902 //-------------------------------------------------------------------------------------------------
903 DLL_PUBLIC extern MS_BOOL MDrv_DMD_DTMB_MD_SWITCH_SSPI_GPIO(MS_U8 id, MS_BOOL bEnable);
904 //-------------------------------------------------------------------------------------------------
905 /// Support multiple Demod of getting GPIO level
906 /// @ingroup DTMB_BASIC
907 /// @param id    \b IN: Select Demod number
908 /// @param u8Pin    \b IN: Select pin number
909 /// @param bLevel    \b OUT: the pointer to GPIO level
910 /// @return TRUE : succeed
911 /// @return FALSE : fail
912 //-------------------------------------------------------------------------------------------------
913 DLL_PUBLIC extern MS_BOOL MDrv_DMD_DTMB_MD_GPIO_GET_LEVEL(MS_U8 id, MS_U8 u8Pin, MS_BOOL *bLevel);
914 //-------------------------------------------------------------------------------------------------
915 /// Support multiple Demod of setting GPIO level
916 /// @ingroup DTMB_BASIC
917 /// @param id    \b IN: Select Demod number
918 /// @param u8Pin    \b IN: Select pin number
919 /// @param bLevel    \b IN: Set GPIO level
920 /// @return TRUE : succeed
921 /// @return FALSE : fail
922 //-------------------------------------------------------------------------------------------------
923 DLL_PUBLIC extern MS_BOOL MDrv_DMD_DTMB_MD_GPIO_SET_LEVEL(MS_U8 id, MS_U8 u8Pin, MS_BOOL bLevel);
924 //-------------------------------------------------------------------------------------------------
925 /// Support multiple Demod of setting GPIO as output or input
926 /// @ingroup DTMB_BASIC
927 /// @param id    \b IN: Select Demod number
928 /// @param u8Pin    \b IN: Select pin number
929 /// @param bEnableOut    \b IN: output if TRUE, otherwise input
930 /// @return TRUE : succeed
931 /// @return FALSE : fail
932 //-------------------------------------------------------------------------------------------------
933 DLL_PUBLIC extern MS_BOOL MDrv_DMD_DTMB_MD_GPIO_OUT_ENABLE(MS_U8 id, MS_U8 u8Pin, MS_BOOL bEnableOut);
934 //-------------------------------------------------------------------------------------------------
935 /// Support multiple Demod of swapping ADC input
936 /// @ingroup DTMB_BASIC
937 /// @param bIsQPad    \b IN: Q pad if TRUE, otherwise I pad
938 /// @return TRUE : succeed
939 /// @return FALSE : fail
940 //-------------------------------------------------------------------------------------------------
941 DLL_PUBLIC extern MS_BOOL MDrv_DMD_DTMB_MD_DoIQSwap(MS_U8 id, MS_BOOL bIsQPad);
942 //-------------------------------------------------------------------------------------------------
943 /// Support multiple Demod of getting Demod register value
944 /// @ingroup DTMB_BASIC
945 /// @param id    \b IN: Select Demod number
946 /// @param u16Addr    \b IN: register address
947 /// @param pu8Data    \b OUT: the pointer to get register data
948 /// @return TRUE : succeed
949 /// @return FALSE : fail
950 //-------------------------------------------------------------------------------------------------
951 DLL_PUBLIC extern MS_BOOL MDrv_DMD_DTMB_MD_GetReg(MS_U8 id, MS_U16 u16Addr, MS_U8 *pu8Data);
952 //-------------------------------------------------------------------------------------------------
953 /// Support multiple Demod of setting Demod register value
954 /// @ingroup DTMB_BASIC
955 /// @param id    \b IN: Select Demod number
956 /// @param u16Addr    \b IN: register address
957 /// @param u8Data    \b IN: register data
958 /// @return TRUE : succeed
959 /// @return FALSE : fail
960 //-------------------------------------------------------------------------------------------------
961 DLL_PUBLIC extern MS_BOOL MDrv_DMD_DTMB_MD_SetReg(MS_U8 id, MS_U16 u16Addr, MS_U8 u8Data);
962 
963 #endif // #ifndef MSOS_TYPE_LINUX_KERNEL
964 
965 #ifdef UTPA2
966 DLL_PUBLIC extern MS_BOOL _MDrv_DMD_DTMB_SetDbgLevel(DMD_DTMB_DbgLv u8DbgLevel);
967 DLL_PUBLIC extern DMD_DTMB_Info* _MDrv_DMD_DTMB_GetInfo(void);
968 DLL_PUBLIC extern MS_BOOL _MDrv_DMD_DTMB_GetLibVer(const MSIF_Version **ppVersion);
969 
970 DLL_PUBLIC extern MS_BOOL _MDrv_DMD_DTMB_MD_Init(MS_U8 id, DMD_DTMB_InitData *pDMD_DTMB_InitData, MS_U32 u32InitDataLen);
971 DLL_PUBLIC extern MS_BOOL _MDrv_DMD_DTMB_MD_Exit(MS_U8 id);
972 DLL_PUBLIC extern MS_U32 _MDrv_DMD_DTMB_MD_GetConfig(MS_U8 id, DMD_DTMB_InitData *psDMD_DTMB_InitData);
973 DLL_PUBLIC extern MS_BOOL _MDrv_DMD_DTMB_MD_SetConfig(MS_U8 id, DMD_DTMB_DEMOD_TYPE eType, MS_BOOL bEnable);
974 DLL_PUBLIC extern MS_BOOL _MDrv_DMD_DTMB_MD_SetReset(MS_U8 id);
975 DLL_PUBLIC extern MS_BOOL _MDrv_DMD_DTMB_MD_Set_QAM_SR(MS_U8 id, DMD_DTMB_DEMOD_TYPE eType, MS_U16 symbol_rate);
976 DLL_PUBLIC extern MS_BOOL _MDrv_DMD_DTMB_MD_SetActive(MS_U8 id, MS_BOOL bEnable);
977 #if DMD_DTMB_STR_EN
978 DLL_PUBLIC extern MS_U32 _MDrv_DMD_DTMB_MD_SetPowerState(MS_U8 id, EN_POWER_MODE u16PowerState);
979 #endif
980 DLL_PUBLIC extern DMD_DTMB_LOCK_STATUS _MDrv_DMD_DTMB_MD_GetLock(MS_U8 id, DMD_DTMB_GETLOCK_TYPE eType);
981 DLL_PUBLIC extern MS_BOOL _MDrv_DMD_DTMB_MD_GetModulationMode(MS_U8 id, DMD_DTMB_MODULATION_INFO *sDtmbModulationMode);
982 DLL_PUBLIC extern MS_BOOL _MDrv_DMD_DTMB_MD_GetSignalStrength(MS_U8 id, MS_U16 *u16Strength);
983 DLL_PUBLIC extern MS_BOOL _MDrv_DMD_DTMB_MD_ReadFrequencyOffset(MS_U8 id, DMD_DTMB_CFO_DATA *cfo);
984 DLL_PUBLIC extern MS_U8 _MDrv_DMD_DTMB_MD_GetSignalQuality(MS_U8 id);
985 DLL_PUBLIC extern MS_BOOL _MDrv_DMD_DTMB_MD_GetPreLdpcBer(MS_U8 id, DMD_DTMB_BER_DATA *pber);
986 DLL_PUBLIC extern MS_BOOL _MDrv_DMD_DTMB_MD_GetPreViterbiBer(MS_U8 id, DMD_DTMB_BER_DATA *ber);
987 DLL_PUBLIC extern MS_BOOL _MDrv_DMD_DTMB_MD_GetPostViterbiBer(MS_U8 id, DMD_DTMB_BER_DATA *ber);
988 DLL_PUBLIC extern MS_BOOL _MDrv_DMD_DTMB_MD_GetSNR(MS_U8 id, DMD_DTMB_SNR_DATA *snr);
989 DLL_PUBLIC extern MS_BOOL _MDrv_DMD_DTMB_MD_SetSerialControl(MS_U8 id, MS_U8 u8TsConfigData);
990 DLL_PUBLIC extern MS_BOOL _MDrv_DMD_DTMB_MD_IIC_BYPASS_MODE(MS_U8 id, MS_BOOL bEnable);
991 DLL_PUBLIC extern MS_BOOL _MDrv_DMD_DTMB_MD_SWITCH_SSPI_GPIO(MS_U8 id, MS_BOOL bEnable);
992 DLL_PUBLIC extern MS_BOOL _MDrv_DMD_DTMB_MD_GPIO_GET_LEVEL(MS_U8 id, MS_U8 u8Pin, MS_BOOL *bLevel);
993 DLL_PUBLIC extern MS_BOOL _MDrv_DMD_DTMB_MD_GPIO_SET_LEVEL(MS_U8 id, MS_U8 u8Pin, MS_BOOL bLevel);
994 DLL_PUBLIC extern MS_BOOL _MDrv_DMD_DTMB_MD_GPIO_OUT_ENABLE(MS_U8 id, MS_U8 u8Pin, MS_BOOL bEnableOut);
995 DLL_PUBLIC extern MS_BOOL _MDrv_DMD_DTMB_MD_DoIQSwap(MS_U8 id, MS_BOOL bIsQPad);
996 DLL_PUBLIC extern MS_BOOL _MDrv_DMD_DTMB_MD_GetReg(MS_U8 id, MS_U16 u16Addr, MS_U8 *pu8Data);
997 DLL_PUBLIC extern MS_BOOL _MDrv_DMD_DTMB_MD_SetReg(MS_U8 id, MS_U16 u16Addr, MS_U8 u8Data);
998 #endif // #ifdef UTPA2
999 
1000 #ifdef __cplusplus
1001 }
1002 #endif
1003 
1004 #endif // _DRV_DTMB_H_
1005