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_ATSC_v2.h 98 /// @brief DMD ATSC Driver Interface 99 /// @author MStar Semiconductor Inc. 100 /////////////////////////////////////////////////////////////////////////////////////////////////// 101 102 #ifndef _DRV_ATSC_V2_H_ 103 #define _DRV_ATSC_V2_H_ 104 105 #include "drvDMD_ATSC.h" 106 107 #ifdef __cplusplus 108 extern "C" 109 { 110 #endif 111 112 //------------------------------------------------------------------------------------------------- 113 // Driver Capability 114 //------------------------------------------------------------------------------------------------- 115 116 117 //------------------------------------------------------------------------------------------------- 118 // Macro and Define 119 //------------------------------------------------------------------------------------------------- 120 121 #ifndef DLL_PUBLIC 122 #define DLL_PUBLIC 123 #endif 124 125 //------------------------------------------------------------------------------------------------- 126 // Type and Structure 127 //------------------------------------------------------------------------------------------------- 128 129 typedef enum { 130 DMD_ATSC_DRV_CMD_SetDbgLevel, 131 DMD_ATSC_DRV_CMD_GetInfo, 132 DMD_ATSC_DRV_CMD_GetLibVer, 133 DMD_ATSC_DRV_CMD_Init, 134 DMD_ATSC_DRV_CMD_Exit, 135 DMD_ATSC_DRV_CMD_GetConfig, 136 DMD_ATSC_DRV_CMD_SetConfig, 137 DMD_ATSC_DRV_CMD_SetReset, 138 DMD_ATSC_DRV_CMD_Set_QAM_SR, 139 DMD_ATSC_DRV_CMD_SetActive, 140 DMD_ATSC_DRV_CMD_SetPowerState, 141 DMD_ATSC_DRV_CMD_GetLock, 142 DMD_ATSC_DRV_CMD_GetModulationMode, 143 DMD_ATSC_DRV_CMD_GetSignalStrength, 144 DMD_ATSC_DRV_CMD_GetSignalQuality, 145 DMD_ATSC_DRV_CMD_GetSNRPercentage, 146 DMD_ATSC_DRV_CMD_GET_QAM_SNR, 147 DMD_ATSC_DRV_CMD_Read_uCPKT_ERR, 148 DMD_ATSC_DRV_CMD_GetPreViterbiBer, 149 DMD_ATSC_DRV_CMD_GetPostViterbiBer, 150 DMD_ATSC_DRV_CMD_ReadFrequencyOffset, 151 DMD_ATSC_DRV_CMD_SetSerialControl, 152 DMD_ATSC_DRV_CMD_IIC_BYPASS_MODE, 153 DMD_ATSC_DRV_CMD_SWITCH_SSPI_GPIO, 154 DMD_ATSC_DRV_CMD_GPIO_GET_LEVEL, 155 DMD_ATSC_DRV_CMD_GPIO_SET_LEVEL, 156 DMD_ATSC_DRV_CMD_GPIO_OUT_ENABLE, 157 DMD_ATSC_DRV_CMD_DoIQSwap, 158 DMD_ATSC_DRV_CMD_GetReg, 159 DMD_ATSC_DRV_CMD_SetReg, 160 DMD_ATSC_DRV_CMD_MD_Init, 161 DMD_ATSC_DRV_CMD_MD_Exit, 162 DMD_ATSC_DRV_CMD_MD_GetConfig, 163 DMD_ATSC_DRV_CMD_MD_SetConfig, 164 DMD_ATSC_DRV_CMD_MD_SetReset, 165 DMD_ATSC_DRV_CMD_MD_Set_QAM_SR, 166 DMD_ATSC_DRV_CMD_MD_SetActive, 167 DMD_ATSC_DRV_CMD_MD_SetPowerState, 168 DMD_ATSC_DRV_CMD_MD_GetLock, 169 DMD_ATSC_DRV_CMD_MD_GetModulationMode, 170 DMD_ATSC_DRV_CMD_MD_GetSignalStrength, 171 DMD_ATSC_DRV_CMD_MD_GetSignalQuality, 172 DMD_ATSC_DRV_CMD_MD_GetSNRPercentage, 173 DMD_ATSC_DRV_CMD_MD_GET_QAM_SNR, 174 DMD_ATSC_DRV_CMD_MD_Read_uCPKT_ERR, 175 DMD_ATSC_DRV_CMD_MD_GetPreViterbiBer, 176 DMD_ATSC_DRV_CMD_MD_GetPostViterbiBer, 177 DMD_ATSC_DRV_CMD_MD_ReadFrequencyOffset, 178 DMD_ATSC_DRV_CMD_MD_SetSerialControl, 179 DMD_ATSC_DRV_CMD_MD_IIC_BYPASS_MODE, 180 DMD_ATSC_DRV_CMD_MD_SWITCH_SSPI_GPIO, 181 DMD_ATSC_DRV_CMD_MD_GPIO_GET_LEVEL, 182 DMD_ATSC_DRV_CMD_MD_GPIO_SET_LEVEL, 183 DMD_ATSC_DRV_CMD_MD_GPIO_OUT_ENABLE, 184 DMD_ATSC_DRV_CMD_MD_DoIQSwap, 185 DMD_ATSC_DRV_CMD_MD_GetReg, 186 DMD_ATSC_DRV_CMD_MD_SetReg 187 } DMD_ATSC_DRV_COMMAND; 188 189 typedef struct DLL_PACKED _ATSC_DBG_LEVEL_PARAM 190 { 191 DMD_ATSC_DbgLv u8DbgLevel; 192 } ATSC_DBG_LEVEL_PARAM, *PATSC_DBG_LEVEL_PARAM; 193 194 typedef struct DLL_PACKED _ATSC_GET_INFO_PARAM 195 { 196 DMD_ATSC_Info* pInfo; 197 } ATSC_GET_INFO_PARAM, *PATSC_GET_INFO_PARAM; 198 199 typedef struct DLL_PACKED _ATSC_GET_LIB_VER_PARAM 200 { 201 const MSIF_Version **ppVersion; 202 } ATSC_GET_LIB_VER_PARAM, *PATSC_GET_LIB_VER_PARAM; 203 204 typedef struct DLL_PACKED _ATSC_INIT_PARAM 205 { 206 MS_U8 id; 207 DMD_ATSC_InitData *pDMD_ATSC_InitData; 208 MS_U32 u32InitDataLen; 209 } ATSC_INIT_PARAM, *PATSC_INIT_PARAM; 210 211 typedef struct DLL_PACKED _ATSC_ID_PARAM 212 { 213 MS_U8 id; 214 } ATSC_ID_PARAM, *PATSC_ID_PARAM; 215 216 typedef struct DLL_PACKED _ATSC_SET_CONFIG_PARAM 217 { 218 MS_U8 id; 219 DMD_ATSC_DEMOD_TYPE eType; 220 MS_BOOL bEnable; 221 } ATSC_SET_CONFIG_PARAM, *PATSC_SET_CONFIG_PARAM; 222 223 typedef struct DLL_PACKED _ATSC_SET_QAM_SR_PARAM 224 { 225 MS_U8 id; 226 DMD_ATSC_DEMOD_TYPE eType; 227 MS_U16 symbol_rate; 228 } ATSC_SET_QAM_SR_PARAM, *PATSC_SET_QAM_SR_PARAM; 229 230 typedef struct DLL_PACKED _ATSC_SET_ACTIVE_PARAM 231 { 232 MS_U8 id; 233 MS_BOOL bEnable; 234 } ATSC_SET_ACTIVE_PARAM, *PATSC_SET_ACTIVE_PARAM; 235 236 typedef struct DLL_PACKED _ATSC_SET_POWER_STATE_PARAM 237 { 238 MS_U8 id; 239 EN_POWER_MODE u16PowerState; 240 } ATSC_SET_POWER_STATE_PARAM, *PATSC_SET_POWER_STATE_PARAM; 241 242 typedef struct DLL_PACKED _ATSC_GET_LOCK_PARAM 243 { 244 MS_U8 id; 245 DMD_ATSC_GETLOCK_TYPE eType; 246 DMD_ATSC_LOCK_STATUS status; 247 } ATSC_GET_LOCK_PARAM, *PATSC_GET_LOCK_PARAM; 248 249 typedef struct DLL_PACKED _ATSC_GET_MODULATION_MODE_PARAM 250 { 251 MS_U8 id; 252 DMD_ATSC_DEMOD_TYPE eType; 253 } ATSC_GET_MODULATION_MODE_PARAM, *PATSC_GET_MODULATION_MODE_PARAM; 254 255 typedef struct DLL_PACKED _ATSC_GET_SIGNAL_STRENGTH_PARAM 256 { 257 MS_U8 id; 258 MS_U16 u16Strength; 259 } ATSC_GET_SIGNAL_STRENGTH_PARAM, *PATSC_GET_SIGNAL_STRENGTH_PARAM; 260 261 typedef struct DLL_PACKED _ATSC_GET_SIGNAL_QUALITY_PARAM 262 { 263 MS_U8 id; 264 DMD_ATSC_SIGNAL_CONDITION eQuality; 265 } ATSC_GET_SIGNAL_QUALITY_PARAM, *PATSC_GET_SIGNAL_QUALITY_PARAM; 266 267 typedef struct DLL_PACKED _ATSC_GET_SNR_PERCENTAGE_PARAM 268 { 269 MS_U8 id; 270 MS_U8 u8Percentage; 271 } ATSC_GET_SNR_PERCENTAGE_PARAM, *PATSC_GET_SNR_PERCENTAGE_PARAM; 272 273 typedef struct DLL_PACKED _ATSC_GET_SNR_PARAM 274 { 275 MS_U8 id; 276 #ifdef UTPA2 277 DMD_ATSC_SNR_DATA snr; 278 #else 279 float snr; 280 #endif 281 } ATSC_GET_SNR_PARAM, *PATSC_GET_SNR_PARAM; 282 283 typedef struct DLL_PACKED _ATSC_GET_UCPKT_ERR_PARAM 284 { 285 MS_U8 id; 286 MS_U16 u16PacketErr; 287 } ATSC_GET_UCPKT_ERR_PARAM, *PATSC_GET_UCPKT_ERR_PARAM; 288 289 typedef struct DLL_PACKED _ATSC_GET_BER_PARAM 290 { 291 MS_U8 id; 292 #ifdef UTPA2 293 DMD_ATSC_BER_DATA ber; 294 #else 295 float ber; 296 #endif 297 } ATSC_GET_BER_PARAM, *PATSC_GET_BER_PARAM; 298 299 typedef struct DLL_PACKED _ATSC_READ_FREQ_OFFSET_PARAM 300 { 301 MS_U8 id; 302 #ifdef UTPA2 303 DMD_ATSC_CFO_DATA cfo; 304 #else 305 MS_S16 cfo; 306 #endif 307 } ATSC_READ_FREQ_OFFSET_PARAM, *PATSC_READ_FREQ_OFFSET_PARAM; 308 309 typedef struct DLL_PACKED _ATSC_SET_SERIAL_CONTROL_PARAM 310 { 311 MS_U8 id; 312 MS_U8 u8TsConfigData; 313 } ATSC_SET_SERIAL_CONTROL_PARAM, *PATSC_SET_SERIAL_CONTROL_PARAM; 314 315 typedef struct DLL_PACKED _ATSC_IIC_BYPASS_MODE_PARAM 316 { 317 MS_U8 id; 318 MS_BOOL bEnable; 319 } ATSC_IIC_BYPASS_MODE_PARAM, *PATSC_IIC_BYPASS_MODE_PARAM; 320 321 typedef struct DLL_PACKED _ATSC_SWITCH_SSPI_GPIO_PARAM 322 { 323 MS_U8 id; 324 MS_BOOL bEnable; 325 } ATSC_SWITCH_SSPI_GPIO_PARAM, *PATSC_SWITCH_SSPI_GPIO_PARAM; 326 327 typedef struct DLL_PACKED _ATSC_GPIO_LEVEL_PARAM 328 { 329 MS_U8 id; 330 MS_U8 u8Pin; 331 MS_BOOL bLevel; 332 } ATSC_GPIO_LEVEL_PARAM, *PATSC_GPIO_LEVEL_PARAM; 333 334 typedef struct DLL_PACKED _ATSC_GPIO_OUT_ENABLE_PARAM 335 { 336 MS_U8 id; 337 MS_U8 u8Pin; 338 MS_BOOL bEnableOut; 339 } ATSC_GPIO_OUT_ENABLE_PARAM, *PATSC_GPIO_OUT_ENABLE_PARAM; 340 341 typedef struct DLL_PACKED _ATSC_DO_IQ_SWAP_PARAM 342 { 343 MS_U8 id; 344 MS_BOOL bIsQPad; 345 } ATSC_DO_IQ_SWAP_PARAM, *PATSC_DO_IQ_SWAP_PARAM; 346 347 typedef struct DLL_PACKED _ATSC_REG_PARAM 348 { 349 MS_U8 id; 350 MS_U16 u16Addr; 351 MS_U8 u8Data; 352 } ATSC_REG_PARAM, *PATSC_REG_PARAM; 353 354 //------------------------------------------------------------------------------------------------- 355 // Function and Variable 356 //------------------------------------------------------------------------------------------------- 357 358 DLL_PUBLIC extern void ATSCRegisterToUtopia(FUtopiaOpen ModuleType); 359 DLL_PUBLIC extern MS_U32 ATSCOpen(void** ppInstance, MS_U32 u32ModuleVersion, void* pAttribute); 360 DLL_PUBLIC extern MS_U32 ATSCClose(void* pInstance); 361 DLL_PUBLIC extern MS_U32 ATSCIoctl(void* pInstance, MS_U32 u32Cmd, void* pArgs); 362 363 #ifdef __cplusplus 364 } 365 #endif 366 367 #endif // _DRV_ATSC_V2_H_ 368 369