xref: /utopia/UTPA2-700.0.x/mxlib/include/drvDMD_ISDBT_v2.h (revision 53ee8cc121a030b8d368113ac3e966b4705770ef)
1 //<MStar Software>
2 //******************************************************************************
3 // MStar Software
4 // Copyright (c) 2010 - 2012 MStar Semiconductor, Inc. All rights reserved.
5 // All software, firmware and related documentation herein ("MStar Software") are
6 // intellectual property of MStar Semiconductor, Inc. ("MStar") and protected by
7 // law, including, but not limited to, copyright law and international treaties.
8 // Any use, modification, reproduction, retransmission, or republication of all
9 // or part of MStar Software is expressly prohibited, unless prior written
10 // permission has been granted by MStar.
11 //
12 // By accessing, browsing and/or using MStar Software, you acknowledge that you
13 // have read, understood, and agree, to be bound by below terms ("Terms") and to
14 // comply with all applicable laws and regulations:
15 //
16 // 1. MStar shall retain any and all right, ownership and interest to MStar
17 //    Software and any modification/derivatives thereof.
18 //    No right, ownership, or interest to MStar Software and any
19 //    modification/derivatives thereof is transferred to you under Terms.
20 //
21 // 2. You understand that MStar Software might include, incorporate or be
22 //    supplied together with third party`s software and the use of MStar
23 //    Software may require additional licenses from third parties.
24 //    Therefore, you hereby agree it is your sole responsibility to separately
25 //    obtain any and all third party right and license necessary for your use of
26 //    such third party`s software.
27 //
28 // 3. MStar Software and any modification/derivatives thereof shall be deemed as
29 //    MStar`s confidential information and you agree to keep MStar`s
30 //    confidential information in strictest confidence and not disclose to any
31 //    third party.
32 //
33 // 4. MStar Software is provided on an "AS IS" basis without warranties of any
34 //    kind. Any warranties are hereby expressly disclaimed by MStar, including
35 //    without limitation, any warranties of merchantability, non-infringement of
36 //    intellectual property rights, fitness for a particular purpose, error free
37 //    and in conformity with any international standard.  You agree to waive any
38 //    claim against MStar for any loss, damage, cost or expense that you may
39 //    incur related to your use of MStar Software.
40 //    In no event shall MStar be liable for any direct, indirect, incidental or
41 //    consequential damages, including without limitation, lost of profit or
42 //    revenues, lost or damage of data, and unauthorized system use.
43 //    You agree that this Section 4 shall still apply without being affected
44 //    even if MStar Software has been modified by MStar in accordance with your
45 //    request or instruction for your use, except otherwise agreed by both
46 //    parties in writing.
47 //
48 // 5. If requested, MStar may from time to time provide technical supports or
49 //    services in relation with MStar Software to you for your use of
50 //    MStar Software in conjunction with your or your customer`s product
51 //    ("Services").
52 //    You understand and agree that, except otherwise agreed by both parties in
53 //    writing, Services are provided on an "AS IS" basis and the warranty
54 //    disclaimer set forth in Section 4 above shall apply.
55 //
56 // 6. Nothing contained herein shall be construed as by implication, estoppels
57 //    or otherwise:
58 //    (a) conferring any license or right to use MStar name, trademark, service
59 //        mark, symbol or any other identification;
60 //    (b) obligating MStar or any of its affiliates to furnish any person,
61 //        including without limitation, you and your customers, any assistance
62 //        of any kind whatsoever, or any information; or
63 //    (c) conferring any license or right under any intellectual property right.
64 //
65 // 7. These terms shall be governed by and construed in accordance with the laws
66 //    of Taiwan, R.O.C., excluding its conflict of law rules.
67 //    Any and all dispute arising out hereof or related hereto shall be finally
68 //    settled by arbitration referred to the Chinese Arbitration Association,
69 //    Taipei in accordance with the ROC Arbitration Law and the Arbitration
70 //    Rules of the Association by three (3) arbitrators appointed in accordance
71 //    with the said Rules.
72 //    The place of arbitration shall be in Taipei, Taiwan and the language shall
73 //    be English.
74 //    The arbitration award shall be final and binding to both parties.
75 //
76 //******************************************************************************
77 //<MStar Software>
78 ////////////////////////////////////////////////////////////////////////////////
79 //
80 // Copyright (c) 2008-2009 MStar Semiconductor, Inc.
81 // All rights reserved.
82 //
83 // Unless otherwise stipulated in writing, any and all information contained
84 // herein regardless in any format shall remain the sole proprietary of
85 // MStar Semiconductor Inc. and be kept in strict confidence
86 // ("MStar Confidential Information") by the recipient.
87 // Any unauthorized act including without limitation unauthorized disclosure,
88 // copying, use, reproduction, sale, distribution, modification, disassembling,
89 // reverse engineering and compiling of the contents of MStar Confidential
90 // Information is unlawful and strictly prohibited. MStar hereby reserves the
91 // rights to any and all damages, losses, costs and expenses resulting therefrom.
92 //
93 ////////////////////////////////////////////////////////////////////////////////
94 
95 ///////////////////////////////////////////////////////////////////////////////////////////////////
96 ///
97 /// @file   drvDMD_ISDBT_v2.h
98 /// @brief  DMD ISDBT Driver Interface
99 /// @author MStar Semiconductor Inc.
100 ///////////////////////////////////////////////////////////////////////////////////////////////////
101 
102 #ifndef _DRV_ISDBT_V2_H_
103 #define _DRV_ISDBT_V2_H_
104 
105 #include "drvDMD_ISDBT.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_ISDBT_DRV_CMD_SetDbgLevel,
131     DMD_ISDBT_DRV_CMD_GetInfo,
132     DMD_ISDBT_DRV_CMD_GetLibVer,
133     DMD_ISDBT_DRV_CMD_Init,
134     DMD_ISDBT_DRV_CMD_Exit,
135     DMD_ISDBT_DRV_CMD_GetConfig,
136     DMD_ISDBT_DRV_CMD_AdvSetConfig,
137     DMD_ISDBT_DRV_CMD_SetPowerState,
138     DMD_ISDBT_DRV_CMD_GetLock,
139     DMD_ISDBT_DRV_CMD_GetModulationMode,
140     DMD_ISDBT_DRV_CMD_GetSignalStrength,
141     DMD_ISDBT_DRV_CMD_GetFreqOffset,
142     DMD_ISDBT_DRV_CMD_GetSignalQuality,
143     DMD_ISDBT_DRV_CMD_GetSignalQualityOfLayerA,
144     DMD_ISDBT_DRV_CMD_GetSignalQualityOfLayerB,
145     DMD_ISDBT_DRV_CMD_GetSignalQualityOfLayerC,
146     DMD_ISDBT_DRV_CMD_GetSignalQualityCombine,
147     DMD_ISDBT_DRV_CMD_GetSNR,
148     DMD_ISDBT_DRV_CMD_Read_PKT_ERR,
149     DMD_ISDBT_DRV_CMD_GetPreViterbiBer,
150     DMD_ISDBT_DRV_CMD_GetPostViterbiBer,
151     DMD_ISDBT_DRV_CMD_GET_PKT_ERR,
152     DMD_ISDBT_DRV_CMD_SetSerialControl,
153     DMD_ISDBT_DRV_CMD_IIC_BYPASS_MODE,
154     DMD_ISDBT_DRV_CMD_SWITCH_SSPI_GPIO,
155     DMD_ISDBT_DRV_CMD_GPIO_GET_LEVEL,
156     DMD_ISDBT_DRV_CMD_GPIO_SET_LEVEL,
157     DMD_ISDBT_DRV_CMD_GPIO_OUT_ENABLE,
158     DMD_ISDBT_DRV_CMD_DoIQSwap,
159     DMD_ISDBT_DRV_CMD_GetReg,
160     DMD_ISDBT_DRV_CMD_SetReg,
161     DMD_ISDBT_DRV_CMD_MD_Init,
162     DMD_ISDBT_DRV_CMD_MD_Exit,
163     DMD_ISDBT_DRV_CMD_MD_GetConfig,
164     DMD_ISDBT_DRV_CMD_MD_AdvSetConfig,
165     DMD_ISDBT_DRV_CMD_MD_SetActive,
166     DMD_ISDBT_DRV_CMD_MD_SetPowerState,
167     DMD_ISDBT_DRV_CMD_MD_GetLock,
168     DMD_ISDBT_DRV_CMD_MD_GetModulationMode,
169     DMD_ISDBT_DRV_CMD_MD_GetSignalStrength,
170     DMD_ISDBT_DRV_CMD_MD_GetFreqOffset,
171     DMD_ISDBT_DRV_CMD_MD_GetSignalQuality,
172     DMD_ISDBT_DRV_CMD_MD_GetSignalQualityOfLayerA,
173     DMD_ISDBT_DRV_CMD_MD_GetSignalQualityOfLayerB,
174     DMD_ISDBT_DRV_CMD_MD_GetSignalQualityOfLayerC,
175     DMD_ISDBT_DRV_CMD_MD_GetSignalQualityCombine,
176     DMD_ISDBT_DRV_CMD_MD_GetSNR,
177     DMD_ISDBT_DRV_CMD_MD_Get_PKT_ERR,
178     DMD_ISDBT_DRV_CMD_MD_GetPreViterbiBer,
179     DMD_ISDBT_DRV_CMD_MD_GetPostViterbiBer,
180     DMD_ISDBT_DRV_CMD_MD_Read_PKT_ERR,
181     DMD_ISDBT_DRV_CMD_MD_SetSerialControl,
182     DMD_ISDBT_DRV_CMD_MD_IIC_BYPASS_MODE,
183     DMD_ISDBT_DRV_CMD_MD_SWITCH_SSPI_GPIO,
184     DMD_ISDBT_DRV_CMD_MD_GPIO_GET_LEVEL,
185     DMD_ISDBT_DRV_CMD_MD_GPIO_SET_LEVEL,
186     DMD_ISDBT_DRV_CMD_MD_GPIO_OUT_ENABLE,
187     DMD_ISDBT_DRV_CMD_MD_DoIQSwap,
188     DMD_ISDBT_DRV_CMD_MD_GetReg,
189     DMD_ISDBT_DRV_CMD_MD_SetReg
190 } DMD_ISDBT_DRV_COMMAND;
191 
192 typedef struct DLL_PACKED _ISDBT_DBG_LEVEL_PARAM
193 {
194     DMD_ISDBT_DbgLv u8DbgLevel;
195 } ISDBT_DBG_LEVEL_PARAM, *PISDBT_DBG_LEVEL_PARAM;
196 
197 typedef struct DLL_PACKED _ISDBT_GET_INFO_PARAM
198 {
199     DMD_ISDBT_Info* pInfo;
200 } ISDBT_GET_INFO_PARAM, *PISDBT_GET_INFO_PARAM;
201 
202 typedef struct DLL_PACKED _ISDBT_GET_LIB_VER_PARAM
203 {
204     const MSIF_Version **ppVersion;
205 } ISDBT_GET_LIB_VER_PARAM, *PISDBT_GET_LIB_VER_PARAM;
206 
207 typedef struct DLL_PACKED _ISDBT_INIT_PARAM
208 {
209     MS_U8 id;
210     DMD_ISDBT_InitData *pDMD_ISDBT_InitData;
211     MS_U32             u32InitDataLen;
212 } ISDBT_INIT_PARAM, *PISDBT_INIT_PARAM;
213 
214 typedef struct DLL_PACKED _ISDBT_SET_CONFIG_PARAM
215 {
216     MS_U8 id;
217     DMD_ISDBT_DEMOD_TYPE eType;
218     MS_BOOL             bEnable;
219 } ISDBT_SET_CONFIG_PARAM, *PISDBT_SET_CONFIG_PARAM;
220 
221 typedef struct DLL_PACKED _ISDBT_ID_PARAM
222 {
223     MS_U8 id;
224 } ISDBT_ID_PARAM, *PISDBT_ID_PARAM;
225 
226 typedef struct DLL_PACKED _ISDBT_SET_POWER_STATE_PARAM
227 {
228     MS_U8 id;
229     EN_POWER_MODE u16PowerState;
230 } ISDBT_SET_POWER_STATE_PARAM, *PISDBT_SET_POWER_STATE_PARAM;
231 
232 typedef struct DLL_PACKED _ISDBT_GET_LOCK_PARAM
233 {
234     MS_U8 id;
235     DMD_ISDBT_GETLOCK_TYPE eType;
236     DMD_ISDBT_LOCK_STATUS  status;
237 } ISDBT_GET_LOCK_PARAM, *PISDBT_GET_LOCK_PARAM;
238 
239 typedef struct DLL_PACKED _ISDBT_GET_MODULATION_MODE_PARAM
240 {
241     MS_U8 id;
242     EN_ISDBT_Layer eLayerIndex;
243     sISDBT_MODULATION_MODE IsdbtModulationMode;
244 } ISDBT_GET_MODULATION_MODE_PARAM, *PISDBT_GET_MODULATION_MODE_PARAM;
245 
246 typedef struct DLL_PACKED _ISDBT_GET_SIGNAL_STRENGTH_PARAM
247 {
248     MS_U8 id;
249     MS_U16 u16Strength;
250 } ISDBT_GET_SIGNAL_STRENGTH_PARAM, *PISDBT_GET_SIGNAL_STRENGTH_PARAM;
251 
252 typedef struct DLL_PACKED _ISDBT_GET_FREQ_OFFSET_PARAM
253 {
254     MS_U8 id;
255     #ifdef UTPA2
256     DMD_ISDBT_CFO_DATA cfo;
257     #else
258     MS_S16 cfo;
259     #endif
260 } ISDBT_GET_FREQ_OFFSET_PARAM, *PISDBT_GET_FREQ_OFFSET_PARAM;
261 
262 typedef struct DLL_PACKED _ISDBT_GET_SIGNAL_QUALITY_PARAM
263 {
264     MS_U8 id;
265     MS_U16 u16SignalQuality;
266 } ISDBT_GET_SIGNAL_QUALITY_PARAM, *PISDBT_GET_SIGNAL_QUALITY_PARAM;
267 
268 typedef struct DLL_PACKED _ISDBT_GET_SNR_PARAM
269 {
270     MS_U8 id;
271     #ifdef UTPA2
272     DMD_ISDBT_SNR_DATA snr;
273     #else
274     float snr;
275     #endif
276 } ISDBT_GET_SNR_PARAM, *PISDBT_GET_SNR_PARAM;
277 
278 typedef struct DLL_PACKED _ISDBT_READ_PKT_ERR_PARAM
279 {
280     MS_U8 id;
281     EN_ISDBT_Layer eIsdbtLayer;
282     MS_U16 u16PacketErr;
283 } ISDBT_READ_PKT_ERR_PARAM, *PISDBT_READ_PKT_ERR_PARAM;
284 
285 typedef struct DLL_PACKED _ISDBT_GET_BER_PARAM
286 {
287     MS_U8 id;
288     DMD_ISDBT_GET_BER_VALUE ber;
289 } ISDBT_GET_BER_PARAM, *PISDBT_GET_BER_PARAM;
290 
291 typedef struct DLL_PACKED _ISDBT_SET_SERIAL_CONTROL_PARAM
292 {
293     MS_U8 id;
294     MS_U8 u8TsConfigData;
295 } ISDBT_SET_SERIAL_CONTROL_PARAM, *PISDBT_SET_SERIAL_CONTROL_PARAM;
296 
297 typedef struct DLL_PACKED _ISDBT_IIC_BYPASS_MODE_PARAM
298 {
299     MS_U8 id;
300     MS_BOOL bEnable;
301 } ISDBT_IIC_BYPASS_MODE_PARAM, *PISDBT_IIC_BYPASS_MODE_PARAM;
302 
303 typedef struct DLL_PACKED _ISDBT_SWITCH_SSPI_GPIO_PARAM
304 {
305     MS_U8 id;
306     MS_BOOL bEnable;
307 } ISDBT_SWITCH_SSPI_GPIO_PARAM, *PISDBT_SWITCH_SSPI_GPIO_PARAM;
308 
309 typedef struct DLL_PACKED _ISDBT_GPIO_LEVEL_PARAM
310 {
311     MS_U8 id;
312     MS_U8 u8Pin;
313     MS_BOOL bLevel;
314 } ISDBT_GPIO_LEVEL_PARAM, *PISDBT_GPIO_LEVEL_PARAM;
315 
316 typedef struct DLL_PACKED _ISDBT_GPIO_OUT_ENABLE_PARAM
317 {
318     MS_U8 id;
319     MS_U8 u8Pin;
320     MS_BOOL bEnableOut;
321 } ISDBT_GPIO_OUT_ENABLE_PARAM, *PISDBT_GPIO_OUT_ENABLE_PARAM;
322 
323 typedef struct DLL_PACKED _ISDBT_DO_IQ_SWAP_PARAM
324 {
325     MS_U8 id;
326     MS_BOOL bIsQPad;
327 } ISDBT_DO_IQ_SWAP_PARAM, *PISDBT_DO_IQ_SWAP_PARAM;
328 
329 typedef struct DLL_PACKED _ISDBT_REG_PARAM
330 {
331     MS_U8 id;
332     MS_U16 u16Addr;
333     MS_U8 u8Data;
334 } ISDBT_REG_PARAM, *PISDBT_REG_PARAM;
335 
336 
337 //-------------------------------------------------------------------------------------------------
338 //  Function and Variable
339 //-------------------------------------------------------------------------------------------------
340 
341 DLL_PUBLIC extern void ISDBTRegisterToUtopia(FUtopiaOpen ModuleType);
342 DLL_PUBLIC extern MS_U32 ISDBTOpen(void** ppInstance, MS_U32 u32ModuleVersion, void* pAttribute);
343 DLL_PUBLIC extern MS_U32 ISDBTClose(void* pInstance);
344 DLL_PUBLIC extern MS_U32 ISDBTIoctl(void* pInstance, MS_U32 u32Cmd, void* pArgs);
345 
346 #ifdef __cplusplus
347 }
348 #endif
349 
350 #endif // _DRV_ISDBT_V2_H_
351 
352