xref: /utopia/UTPA2-700.0.x/mxlib/include/drvVBI_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 
78 #ifndef __DRV_VBI_V2_H__
79 #define __DRV_VBI_V2_H__
80 
81 #include "drvVBI.h"
82 #include "drvDMX_TTX.h"
83 #include "UFO.h"
84 
85 #ifdef __cplusplus
86 extern "C"
87 {
88 #endif
89 
90 typedef enum
91 {
92     VBI_POOL_ID_VBI0 = 0,
93     VBI_POOL_ID_VBI1 = 1,
94 } eVBIPoolID;
95 
96 typedef enum {
97     // VBI Teletext
98     MDrv_CMD_VBI_RingBuffer_Reset = 0,
99     MDrv_CMD_VBI_RegisterCB,
100     MDrv_CMD_VBI_InitializeTTXSlicer,
101     MDrv_CMD_VBI_EnableTTXSlicer,
102     MDrv_CMD_VBI_IsVPS_Ready,
103     MDrv_CMD_VBI_IsTTX_Ready,
104     MDrv_CMD_VBI_IsWSS_Ready,
105     MDrv_CMD_VBI_GetWSS_Data,
106     MDrv_CMD_VBI_GetVPS_Data,
107     MDrv_CMD_VBI_SetVideoStandard,
108     MDrv_CMD_VBI_TTX_PacketBufferIsEmpty,
109     MDrv_CMD_VBI_TTX_CheckCircuitReady,
110     MDrv_CMD_VBI_TTX_GetPacketCount,
111     MDrv_CMD_VBI_TTX_GetPackets,
112     MDrv_CMD_VBI_TTX_GetPacket,
113     MDrv_CMD_VBI_TTX_PacketBufferIsOverflow,
114     MDrv_CMD_VBI_TTX_PacketBufferGetNoOfOverflows,
115     MDrv_CMD_VBI_TTX_EnableLine,
116     MDrv_CMD_VBI_WSS_SetVpsByteNum,
117     MDrv_CMD_VBI_GetCompleteVPS_Data,
118     MDrv_CMD_VBI_GetRawVPS_Data,
119 
120     // VBI CC
121     MDrv_CMD_VBI_CC_InitSlicer = 100,
122     MDrv_CMD_VBI_CC_InitYPbYr,
123     MDrv_CMD_VBI_CC_SetDataRate,
124     MDrv_CMD_VBI_CC_GetInfo,
125     MDrv_CMD_VBI_CC_SetFrameCnt,
126     MDrv_CMD_VBI_CC_EnableSlicer,
127     MDrv_CMD_VBI_CC_EnableLine,
128     MDrv_CMD_VBI_CC_SetSCWindowLen,
129     MDrv_CMD_VBI_CC_SetVideoStandard,
130 
131     // DMX Teletext
132     MDrv_CMD_DMX_TTX_RingBuffer_Reset = 200,
133     MDrv_CMD_DMX_TTX_Init,
134     MDrv_CMD_DMX_TTX_SetFilterID,
135     MDrv_CMD_DMX_TTX_SetCB,
136     MDrv_CMD_DMX_TTX_PacketBufferIsEmpty,
137     MDrv_CMD_DMX_TTX_GetPackets,
138     MDrv_CMD_DMX_TTX_GetPacket,
139     MDrv_CMD_DMX_TTX_PacketBufferIsOverflow,
140     MDrv_CMD_DMX_TTX_PacketBufferGetNoOfOverflows,
141     MDrv_CMD_DMX_TTX_Exit,
142 
143     // MISC
144     MDrv_CMD_VBI_ObtainEng = 300,
145     MDrv_CMD_VBI_ReleaseEng,
146     MDrv_CMD_VBI_QueryCap,
147     MDrv_CMD_VBI_GetLibVer,
148     MDrv_CMD_VBI_GetInfo,
149     MDrv_CMD_VBI_GetStatus,
150     MDrv_CMD_VBI_SetDbgLevel,
151     MDrv_CMD_VBI_Init,
152     MDrv_CMD_VBI_SyncMemory,
153     MDrv_CMD_VBI_Exit,
154     MDrv_CMD_VBI_ProtectMemory,
155 
156     MDrv_CMD_VBI_Suspend,
157     MDrv_CMD_VBI_Resume,
158     MDrv_CMD_VBI_SetPowerState,
159 
160     MDrv_CMD_DMX_TTX_Suspend,
161     MDrv_CMD_DMX_TTX_Resume,
162     MDrv_CMD_DMX_TTX_SetPowerState,
163 } eVBIIoctlOpt;
164 
165 typedef struct DLL_PACKED _VBI_BOOL
166 {
167     MS_BOOL bCheck;
168 } VBI_BOOL, *PVBI_BOOL;
169 
170 typedef struct DLL_PACKED _VBI_GET_DATA
171 {
172     MS_U16 u16data;
173 } VBI_GET_DATA, *PVBI_GET_DATA;
174 
175 typedef struct _VBI_GET_RESULT
176 {
177     EN_POWER_MODE u16PowerState;
178     MS_U32 u32result;
179 } VBI_GET_RESULT, *PVBI_GET_RESULT;
180 
181 //-------------------------------------------------------------
182 
183 typedef struct _VBI_GETLIBVER
184 {
185     const MSIF_Version **ppVersion;
186 } VBI_GETLIBVER_PARAM, *PVBI_GETLIBVER;
187 
188 typedef struct DLL_PACKED _VBI_GETINFO
189 {
190     MS_U8 u8NoInfo;
191 } VBI_GETINFO_PARAM, *PVBI_GETINFO_PARAM;
192 
193 typedef struct DLL_PACKED _GETSTATUS
194 {
195     VBI_DrvStatus *pDrvStatus;
196 } VBI_GETSTATUS_PARAM, *PVBI_GETSTATUS;
197 
198 typedef struct DLL_PACKED _VBI_SETDBGLEVEL
199 {
200     MS_U16 u16DbgSwitch;
201 } VBI_SETDBGLEVEL_PARAM, *PVBI_SETDBGLEVEL;
202 
203 typedef struct DLL_PACKED _VBI_CMD
204 {
205     EN_VBI_CMD cmd;
206 } VBI_CMD, *PVBI_CMD;
207 
208 typedef struct DLL_PACKED _VBI_INIT_TYPE
209 {
210     EN_VBI_CMD cmd;
211     VBI_INIT_TYPE type;
212 } VBI_INIT_TYPE_PARAM, *PVBI_INIT_TYPE;
213 
214 typedef struct DLL_PACKED _DMX_TTX_CMD
215 {
216     EN_VBI_CMD cmd;
217 } DMX_TTX_CMD, *PDMX_TTX_CMD;
218 
219 typedef struct DLL_PACKED _VBI_REGISTER_CB
220 {
221     VBI_CB_FN pFN;
222 #if defined(UFO_PUBLIC_HEADER_300)
223     MS_PHYADDR bufferAddr;
224 #else
225     MS_PHY     bufferAddr;
226 #endif
227     MS_U32 length;
228 } VBI_REGISTER_CB, *PVBI_REGISTER_CB;
229 
230 typedef struct DLL_PACKED _VBI_INITIALIZER_TTX_SLICER
231 {
232     EN_VBI_CMD cmd;
233 #if defined(UFO_PUBLIC_HEADER_300)
234     MS_PHYADDR bufferAddr;
235 #else
236     MS_PHY     bufferAddr;
237 #endif
238     MS_U16 packetCount;
239 } VBI_INITIALIZER_TTX_SLICER, *PVBI_INITIALIZER_TTX_SLICER;
240 
241 typedef struct DLL_PACKED _VBI_ENABLE_TTX_SLICER
242 {
243     MS_BOOL bEnable;
244 } VBI_ENABLE_TTX_SLICER, *PVBI_ENABLE_TTX_SLICER, VBI_CC_ENABLE_SLICER, *PVBI_CC_ENABLE_SLICER;
245 
246 typedef struct DLL_PACKED _VBI_GET_VPS_DATA
247 {
248     MS_U8 *lowerWord;
249     MS_U8 *higherWord;
250 } VBI_GET_VPS_DATA, *PVBI_GET_VPS_DATA;
251 
252 typedef struct DLL_PACKED _VBI_GET_COMPLETE_VPS_DATA
253 {
254     MS_U8  **pBuffer;
255     MS_U32 *length;
256 } VBI_GET_COMPLETE_VPS_DATA, *PVBI_GET_COMPLETE_VPS_DATA;
257 
258 typedef struct DLL_PACKED _VBI_GET_RAW_VPS_DATA
259 {
260     MS_U8 byte0;
261     MS_U8 byte1;
262     MS_U8 byte2;
263     MS_U8 byte3;
264 } VBI_GET_RAW_VPS_DATA, *PVBI_GET_RAW_VPS_DATA;
265 
266 typedef struct DLL_PACKED _VBI_SET_VIDEO_STANDARD
267 {
268     VBI_VIDEO_STANDARD eStandard;
269     MS_BOOL bRet;
270 } VBI_SET_VIDEO_STANDARD, *PVBI_SET_VIDEO_STANDARD;
271 
272 
273 typedef struct DLL_PACKED _VBI_TTX_GET_PACKETS
274 {
275 #if defined(UFO_PUBLIC_HEADER_300)
276     MS_PHYADDR dataAddr;
277 #else
278     MS_PHY     dataAddr;
279 #endif
280     MS_U32 *length;
281 } VBI_TTX_GET_PACKETS, *PVBI_TTX_GET_PACKETS;
282 
283 typedef struct DLL_PACKED _VBI_TTX_GET_PACKET
284 {
285 #if defined(UFO_PUBLIC_HEADER_300)
286     MS_PHYADDR *packetAddress;
287 #else
288     MS_PHY     *packetAddress;
289 #endif
290 } VBI_TTX_GET_PACKET, *PVBI_TTX_GET_PACKET;
291 
292 typedef struct DLL_PACKED _VBI_TTX_ENABLE_LINE
293 {
294     MS_U16 StartLine;
295     MS_U16 EndLine;
296 } VBI_TTX_ENABLE_LINE, *PVBI_TTX_ENABLE_LINE;
297 
298 typedef struct DLL_PACKED _VBI_SYNC_MEMORY
299 {
300     MS_U32 u32Start;
301     MS_U32 u32Size;
302 } VBI_SYNC_MEMORY, *PVBI_SYNC_MEMORY;
303 
304 typedef struct DLL_PACKED _VBI_CC_INIT_SLICER
305 {
306 #if defined(UFO_PUBLIC_HEADER_300)
307     MS_U32     u32RiuAddr;
308     MS_PHYADDR bufferAddr;
309 #else
310     MS_VIRT    u32RiuAddr;
311     MS_PHY     bufferAddr;
312 #endif
313     MS_U16 packetCount;
314 } VBI_CC_INIT_SLICER, *PVBI_CC_INIT_SLICER;
315 
316 typedef struct DLL_PACKED _VBI_CC_INIT_YPBYR
317 {
318     MS_U8 cvbs_no;
319 } VBI_CC_INIT_YPBYR, *PVBI_CC_INIT_YPBYR;
320 
321 typedef struct DLL_PACKED _VBI_CC_SETDATARATE
322 {
323     MS_U8 *ptable;
324 } VBI_CC_SETDATARATE, *PVBI_CC_SETDATARATE;
325 
326 typedef struct DLL_PACKED _VBI_CC_GETINFO
327 {
328     MS_U32 selector;
329     MS_U32 info;
330 } VBI_CC_GETINFO, *PVBI_CC_GETINFO;
331 
332 typedef struct DLL_PACKED _VBI_CC_SET_FRAMECNT
333 {
334     MS_U8 cnt;
335 } VBI_CC_SET_FRAMECNT, *PVBI_CC_SET_FRAMECNT, VBI_VBI_WSS_VPSBYTENUM, *PVBI_VBI_WSS_VPSBYTENUM;
336 
337 typedef struct DLL_PACKED _VBI_CC_ENABLE_LINE
338 {
339     MS_U16 StartLine;
340     MS_U16 EndLine;
341     MS_U8 mode;
342 } VBI_CC_ENABLE_LINE, *PVBI_CC_ENABLE_LINE;
343 
344 typedef struct DLL_PACKED _VBI_CC_SET_SC_WND_LEN
345 {
346     MS_U8 u8Len;
347     MS_BOOL bRet;
348 } VBI_CC_SET_SC_WND_LEN, *PVBI_CC_SET_SC_WND_LEN;
349 
350 typedef struct DLL_PACKED _VBI_PROTECT_MEMORY
351 {
352     MS_BOOL bEnable;
353     MS_PHY phyAddr;
354     MS_U32 u32Size;
355     MS_BOOL bRet;
356 } VBI_PROTECT_MEMORY, *PVBI_PROTECT_MEMORY;
357 
358 typedef struct DLL_PACKED _DMX_TTX_SET_FILTERID
359 {
360     MS_U8 fid;
361 } DMX_TTX_SET_FILTERID, *PDMX_TTX_SET_FILTERID;
362 
363 typedef struct DLL_PACKED _DMX_TTX_SET_CB
364 {
365     DMX_CB_FN fn;
366 } DMX_TTX_SET_CB, *PDMX_TTX_SET_CB;
367 
368 #ifdef __cplusplus
369 }
370 #endif
371 
372 #endif //__DRV_VBI_V2_H__
373 
374