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