xref: /utopia/UTPA2-700.0.x/modules/ve/utopia_adaption/ve/TVENCODER_adp.c (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 ////////////////////////////////////////////////////////////////////////////////
79 /// file    TVENCODER_adp.c
80 /// @brief  TV encoder.
81 /// @author MStar Semiconductor Inc.
82 ////////////////////////////////////////////////////////////////////////////////
83 
84 #ifndef _TVENCODER_ADP_C_
85 #define _TVENCODER_ADP_C_
86 
87 //------------------------------------------------------------------------------
88 //  Include Files
89 //------------------------------------------------------------------------------
90 // Common Definition
91 #include <linux/kernel.h>
92 #include <linux/string.h>
93 #include <linux/slab.h>
94 /*#if !defined(MSOS_TYPE_LINUX_KERNEL)
95 #include <stdio.h>
96 #include <string.h>
97 #else
98 #include <linux/string.h>
99 #include <linux/slab.h>
100 #endif*/
101 #include "MsTypes.h"
102 #include "utopia.h"
103 #include "utopia_adp.h"
104 
105 // Internal Definition
106 #include "tvencoder.h"
107 #include "TVENCODER_adp.h"
108 extern spt_MS_NULL;
109 //------------------------------------------------------------------------------
110 //  Driver Compiler Options
111 //------------------------------------------------------------------------------
112 
113 //------------------------------------------------------------------------------
114 //  Local Defines
115 //------------------------------------------------------------------------------
116 
117 //------------------------------------------------------------------------------
118 //  Local Structurs
119 //------------------------------------------------------------------------------
120 
121 //------------------------------------------------------------------------------
122 //  Global Variables
123 //------------------------------------------------------------------------------
124 
125 //------------------------------------------------------------------------------
126 //  Local Variables
127 //------------------------------------------------------------------------------
128 
129 //Top
130 UADP_STRUCT_POINTER_TABLE spt_TVE_GetInfo[5];
131 UADP_STRUCT_POINTER_TABLE spt_TVE_GetStatus[5];
132 UADP_STRUCT_POINTER_TABLE spt_TVE_SetDbgLevel[5];
133 UADP_STRUCT_POINTER_TABLE spt_TVE_SwitchInputSRC[5];
134 UADP_STRUCT_POINTER_TABLE spt_TVE_SetInputSRC[5];
135 UADP_STRUCT_POINTER_TABLE spt_TVE_SwitchOutputDest[5];
136 UADP_STRUCT_POINTER_TABLE spt_TVE_SetOutputCtrl[5];
137 UADP_STRUCT_POINTER_TABLE spt_TVE_SetOutputVideoStd[5];
138 UADP_STRUCT_POINTER_TABLE spt_TVE_SetMemoryBaseAddr[5];
139 UADP_STRUCT_POINTER_TABLE spt_TVE_Init[5];
140 UADP_STRUCT_POINTER_TABLE spt_TVE_Exit[5];
141 UADP_STRUCT_POINTER_TABLE spt_TVE_SetWSSData[5];
142 UADP_STRUCT_POINTER_TABLE spt_TVE_GetWSSData[5];
143 UADP_STRUCT_POINTER_TABLE spt_TVE_SetMode[5];
144 UADP_STRUCT_POINTER_TABLE spt_TVE_SetBlackSceen[5];
145 UADP_STRUCT_POINTER_TABLE spt_TVE_IsBlackScreenEnabled[5];
146 UADP_STRUCT_POINTER_TABLE spt_TVE_SetTtxBuffer[5];
147 UADP_STRUCT_POINTER_TABLE spt_TVE_VE_GetTtxReadDoneStatus[5];
148 UADP_STRUCT_POINTER_TABLE spt_TVE_EnableCcSw[5];
149 UADP_STRUCT_POINTER_TABLE spt_TVE_SetCcRange[5];
150 UADP_STRUCT_POINTER_TABLE spt_TVE_SendCcData[5];
151 UADP_STRUCT_POINTER_TABLE spt_TVE_set_display_window[5];
152 UADP_STRUCT_POINTER_TABLE spt_TVE_SetOSD[5];
153 UADP_STRUCT_POINTER_TABLE spt_TVE_SetRGBIn[5];
154 UADP_STRUCT_POINTER_TABLE spt_TVE_Get_Output_Video_Std[5];
155 UADP_STRUCT_POINTER_TABLE spt_TVE_SetCaptureMode[5];
156 UADP_STRUCT_POINTER_TABLE spt_TVE_GetDstInfo[5];
157 UADP_STRUCT_POINTER_TABLE spt_TVE_Set_TestPattern[5];
158 UADP_STRUCT_POINTER_TABLE spt_TVE_DisableRegWrite[5];
159 UADP_STRUCT_POINTER_TABLE spt_TVE_AdjustPositionBase[5];
160 UADP_STRUCT_POINTER_TABLE spt_TVE_Set_Customer_Scaling[5];
161 UADP_STRUCT_POINTER_TABLE spt_TVE_InitVECapture[5];
162 UADP_STRUCT_POINTER_TABLE spt_TVE_EnaVECapture[5];
163 UADP_STRUCT_POINTER_TABLE spt_TVE_Adjust_FrameStart[5];
164 UADP_STRUCT_POINTER_TABLE spt_TVE_SetPowerState[5];
165 UADP_STRUCT_POINTER_TABLE spt_TVE_ReloadSetting[5];
166 UADP_STRUCT_POINTER_TABLE spt_TVE_GetConfig[5];
167 
168 //Bottom
169 UADP_STRUCT_POINTER_TABLE spt_VE_DrvInfo[5];
170 UADP_STRUCT_POINTER_TABLE spt_VE_VE_Caps[5];
171 UADP_STRUCT_POINTER_TABLE spt_VE_DrvStatus[5];
172 UADP_STRUCT_POINTER_TABLE spt_VE_SwithcSrc_info[5];
173 UADP_STRUCT_POINTER_TABLE spt_VE_InputSrcInfo[5];
174 UADP_STRUCT_POINTER_TABLE spt_VE_Switch_Dest_Info[5];
175 UADP_STRUCT_POINTER_TABLE spt_VE_Output_Ctrl[5];
176 UADP_STRUCT_POINTER_TABLE spt_VE_DrvSetMode[5];
177 UADP_STRUCT_POINTER_TABLE spt_VE_DST_DispInfo[5];
178 //UADP_STRUCT_POINTER_TABLE spt_VE_SetDisplayWin[5];
179 UADP_STRUCT_POINTER_TABLE spt_VE_CusScalingInfo[5];
180 UADP_STRUCT_POINTER_TABLE spt_VE_Output_CAPTURE[5];
181 UADP_STRUCT_POINTER_TABLE spt_VE_VECAPTURESTATE[5];
182 UADP_STRUCT_POINTER_TABLE spt_VE_WINDOW_TYPE[5];
183 UADP_STRUCT_POINTER_TABLE spt_VE_Config[5];
184 //------------------------------------------------------------------------------
185 //  Debug Functions
186 //------------------------------------------------------------------------------
187 
188 //------------------------------------------------------------------------------
189 //  Local Functions
190 //------------------------------------------------------------------------------
191 
192 //------------------------------------------------------------------------------
193 //  Global Functions
194 //------------------------------------------------------------------------------
TVENCODER_adp_Init(FUtopiaIOctl * pIoctl)195 MS_U32 TVENCODER_adp_Init(FUtopiaIOctl* pIoctl)
196 {
197 
198 //set table
199     MS_U32 temp=0;
200 
201     //Top
202     PTVE_GETINFO          pGetInfo = (PTVE_GETINFO)temp;
203 	PTVE_GETSTATUS        pGetStatus = (PTVE_GETSTATUS)temp;
204 	//PTVE_SETDBGLEVEL      pDbgLevel  = (PTVE_SETDBGLEVEL)temp;
205 	PTVE_SWITCH_SRC_INFO  pVE_SwitchSrc_info   = (PTVE_SWITCH_SRC_INFO)temp;
206 	PTVE_SETINPUTSRC      pVE_SetInputSrc      = (PTVE_SETINPUTSRC)temp;
207 	PTVE_SWITCHOUTPUTDEST pSwitchOutputDest = (PTVE_SWITCHOUTPUTDEST)temp;
208 	PTVE_SETOUTPUTCTRL pSetOutputCtrl = (PTVE_SETOUTPUTCTRL)temp;
209 	//PTVE_SETOUTPUTVIDEOSTD pSetOutputVideoStd = (PTVE_SETOUTPUTVIDEOSTD)temp;
210 	//PTVE_INIT pInit = (PTVE_INIT)temp;
211 	//PTVE_EXIT pExit = (PTVE_EXIT)temp;
212 	//PTVE_SETWSSDATA pSetWSSdata = (PTVE_SETWSSDATA)temp;
213 	//PTVE_GETWSSDATA pGetWSSData = (PTVE_GETWSSDATA)temp;
214 	PTVE_SETMODE pSetMode = (PTVE_SETMODE)temp;
215 	//PTVE_SETBLACKSCREEN pSetBlackScreen = (PTVE_SETBLACKSCREEN)temp;
216 	//PTVE_ISBLACKSCREENENABLE pBlackScreenEnable = (PTVE_ISBLACKSCREENENABLE)temp;
217 	//PTVE_SETTTXBUFFER pSetTtxBuffer = (PTVE_SETTTXBUFFER)temp;
218 	//PTVE_GETTTXREADDONE pGetTtxReadDoneStatus = (PTVE_GETTTXREADDONE)temp;
219 	//PTVE_ENABLECCSW pEnableCcSw = (PTVE_ENABLECCSW)temp;
220 	//PTVE_SETCCRANGE pSetCcRange = (PTVE_SETCCRANGE)temp;
221 	//PTVE_SENDCCDATA pSendCcData = (PTVE_SENDCCDATA)temp;
222 	//PTVE_SETDISPLAYWIN pSetDisplayWin = (PTVE_SETDISPLAYWIN)temp;
223 	//PTVE_SETOSD pSetOsd = (PTVE_SETOSD)temp;
224 	//PTVE_SETRGBIN pSetRGBIn = (PTVE_SETRGBIN)temp;
225 	//PTVE_GETOUTPUTVIDEOSTD pOutputVideoSTD = (PTVE_GETOUTPUTVIDEOSTD)temp;
226 	//PTVE_SETCAPMODE pSetCaptureMode = (PTVE_SETCAPMODE)temp;
227 	PTVE_GETDSTINFO pGetDstInfo = (PTVE_GETDSTINFO)temp;
228 	//PTVE_SETTESTPATTERN pSetTestPattern = (PTVE_SETTESTPATTERN)temp;
229 	//PTVE_DISABLEREGWRITE pDiableRegWrite = (PTVE_DISABLEREGWRITE)temp;
230 	//PTVE_ADJPOSITIONBASE pAdjPositionBase = (PTVE_ADJPOSITIONBASE)temp;
231 	PTVE_SETCUSSCALING pSetCusScaling = (PTVE_SETCUSSCALING)temp;
232 	P_TVE_INITCAPTURE pInitCapture = (P_TVE_INITCAPTURE)temp;
233 	PTVE_ENACAPTURE pEnableCapture =(PTVE_ENACAPTURE)temp;
234 	PTVE_ADJFRAMESTART pAdjustFrameStart = (PTVE_ADJFRAMESTART)temp;
235 	//PTVE_SETPOWERSTATE pSetPowerState = (PTVE_SETPOWERSTATE)temp;
236 	PTVE_GETCONFIG        pGetConfig = (PTVE_GETCONFIG)temp;
237 
238 
239 	//Bottom
240     //VE_DrvInfo* pVE_DrvInfo = (VE_DrvInfo*)temp;
241     //VE_Caps* pVE_Caps = (VE_Caps*)temp;
242 	//VE_DrvStatus* pStaus = (VE_DrvStatus*)temp;
243 	//PMS_Switch_VE_Src_Info pSwithcSrc_info = (PMS_Switch_VE_Src_Info)temp;
244 	//PMS_VE_InputSrc_Info pInputSrcInfo = (PMS_VE_InputSrc_Info)temp;
245 	//PMS_Switch_VE_Dest_Info pSwitchInfo = (PMS_Switch_VE_Dest_Info)temp;
246 	//PMS_VE_Output_Ctrl pOutputCtrl = (PMS_VE_Output_Ctrl)temp;
247 	//MS_VE_Set_Mode_Type* pVESetMode = (MS_VE_Set_Mode_Type*)temp;
248     //MS_VE_WINDOW_TYPE*
249 	//(MS_VE_WINDOW_TYPE*)pVEstDispWin = (MS_VE_WINDOW_TYPE*) temp;
250 	//MS_VE_DST_DispInfo* pDstInfo = (MS_VE_DST_DispInfo*)temp;
251 	//MS_VE_CusScalingInfo* pstVECusScalingInfo = (MS_VE_CusScalingInfo*)temp;
252 	//PMS_VE_Output_CAPTURE pVECapture = (PMS_VE_Output_CAPTURE)temp;
253 	//PMS_VE_VECAPTURESTATE pstVECapState = (PMS_VE_VECAPTURESTATE)temp;
254 	//MS_VE_WINDOW_TYPE *stSrcWin = (MS_VE_WINDOW_TYPE*)temp;
255 
256 //
257     UADPBypassSetSPT(&spt_VE_VE_Caps[0],UADP_SPT_SELF_SIZE,0, sizeof(VE_Caps));
258     UADPBypassSetSPT(&spt_VE_VE_Caps[1],UADP_SPT_END , 0, 0);
259 
260     UADPBypassSetSPT(&spt_VE_DrvInfo[0],UADP_SPT_SELF_SIZE,0, sizeof(VE_DrvInfo));
261     //UADPBypassSetSPT(&spt_VE_DrvInfo[1],UADP_SPT_POINTER_TO_NEXT,
262     //    ((unsigned long)(&(pVE_DrvInfo->stCaps))-(unsigned long)pVE_DrvInfo), &spt_VE_VE_Caps);
263     UADPBypassSetSPT(&spt_VE_DrvInfo[1],UADP_SPT_END , 0, 0);
264 
265     UADPBypassSetSPT(&spt_VE_DrvStatus[0],UADP_SPT_SELF_SIZE,0, sizeof(VE_DrvStatus));
266     UADPBypassSetSPT(&spt_VE_DrvStatus[1],UADP_SPT_END , 0, 0);
267 
268     UADPBypassSetSPT(&spt_VE_SwithcSrc_info[0],UADP_SPT_SELF_SIZE,0, sizeof(MS_Switch_VE_Src_Info));
269     UADPBypassSetSPT(&spt_VE_SwithcSrc_info[1],UADP_SPT_END , 0, 0);
270 
271     UADPBypassSetSPT(&spt_VE_InputSrcInfo[0],UADP_SPT_SELF_SIZE,0, sizeof(MS_VE_InputSrc_Info));
272     UADPBypassSetSPT(&spt_VE_InputSrcInfo[1],UADP_SPT_END , 0, 0);
273 
274     UADPBypassSetSPT(&spt_VE_Switch_Dest_Info[0],UADP_SPT_SELF_SIZE,0, sizeof(MS_Switch_VE_Dest_Info));
275     UADPBypassSetSPT(&spt_VE_Switch_Dest_Info[1],UADP_SPT_END , 0, 0);
276 
277     UADPBypassSetSPT(&spt_VE_Output_Ctrl[0],UADP_SPT_SELF_SIZE,0, sizeof(MS_VE_Output_Ctrl));
278     UADPBypassSetSPT(&spt_VE_Output_Ctrl[1],UADP_SPT_END , 0, 0);
279 
280     UADPBypassSetSPT(&spt_VE_DrvSetMode[0],UADP_SPT_SELF_SIZE,0, sizeof(MS_VE_Set_Mode_Type));
281     UADPBypassSetSPT(&spt_VE_DrvSetMode[1],UADP_SPT_END , 0, 0);
282 
283     //UADPBypassSetSPT(&spt_VE_SetDisplayWin[0],UADP_SPT_SELF_SIZE,0, sizeof(MS_VE_WINDOW_TYPE));
284     //UADPBypassSetSPT(&spt_VE_SetDisplayWin[1],UADP_SPT_END , 0, 0);
285 
286     UADPBypassSetSPT(&spt_VE_DST_DispInfo[0],UADP_SPT_SELF_SIZE,0, sizeof(MS_VE_DST_DispInfo));
287     UADPBypassSetSPT(&spt_VE_DST_DispInfo[1],UADP_SPT_END , 0, 0);
288 
289     UADPBypassSetSPT(&spt_VE_CusScalingInfo[0],UADP_SPT_SELF_SIZE,0, sizeof(MS_VE_CusScalingInfo));
290     UADPBypassSetSPT(&spt_VE_CusScalingInfo[1],UADP_SPT_END , 0, 0);
291 
292 #ifdef BIFROST_32BIT_MODE
293     UADP_SDT_NAME1(VE_Output_CAPTURE,MS_VE_Output_CAPTURE,UADP_SDT_AT,u32MiuBaseAddr,MS_NULL);
294 #else
295     UADPBypassSetSPT(&spt_VE_Output_CAPTURE[0],UADP_SPT_SELF_SIZE,0, sizeof(MS_VE_Output_CAPTURE));
296     UADPBypassSetSPT(&spt_VE_Output_CAPTURE[1],UADP_SPT_END , 0, 0);
297 #endif
298 
299     UADPBypassSetSPT(&spt_VE_VECAPTURESTATE[0],UADP_SPT_SELF_SIZE,0, sizeof(MS_VE_VECAPTURESTATE));
300     UADPBypassSetSPT(&spt_VE_VECAPTURESTATE[1],UADP_SPT_END , 0, 0);
301 
302     UADPBypassSetSPT(&spt_VE_WINDOW_TYPE[0],UADP_SPT_SELF_SIZE,0, sizeof(MS_VE_WINDOW_TYPE));
303     UADPBypassSetSPT(&spt_VE_WINDOW_TYPE[1],UADP_SPT_END , 0, 0);
304 
305     UADPBypassSetSPT(&spt_VE_Config[0],UADP_SPT_SELF_SIZE,0, sizeof(MS_PHYADDR));
306     UADPBypassSetSPT(&spt_VE_Config[1],UADP_SPT_END , 0, 0);
307 
308 //---
309     UADPBypassSetSPT(&spt_TVE_GetInfo[0],UADP_SPT_SELF_SIZE,0, sizeof(TVE_GETINFO));
310     UADPBypassSetSPT(&spt_TVE_GetInfo[1],UADP_SPT_POINTER_TO_NEXT,
311                       ((unsigned long)(&(pGetInfo->pVE_DrvInfo))-(unsigned long)pGetInfo), (unsigned long)&spt_VE_DrvInfo);
312     UADPBypassSetSPT(&spt_TVE_GetInfo[2],UADP_SPT_END , 0, 0);
313 
314 
315     UADPBypassSetSPT(&spt_TVE_GetStatus[0],UADP_SPT_SELF_SIZE,0, sizeof(TVE_GETSTATUS));
316     UADPBypassSetSPT(&spt_TVE_GetStatus[1],UADP_SPT_POINTER_TO_NEXT,
317         ((unsigned long)(&(pGetStatus->pStaus))-(unsigned long)pGetStatus), (unsigned long)&spt_VE_DrvStatus);
318     UADPBypassSetSPT(&spt_TVE_GetStatus[2],UADP_SPT_END , 0, 0);
319 
320 
321     UADPBypassSetSPT(&spt_TVE_SetDbgLevel[0],UADP_SPT_SELF_SIZE,0, sizeof(TVE_SETDBGLEVEL));
322     UADPBypassSetSPT(&spt_TVE_SetDbgLevel[1],UADP_SPT_END , 0, 0);
323 
324 
325 	UADPBypassSetSPT(&spt_TVE_SwitchInputSRC[0],UADP_SPT_SELF_SIZE,0, sizeof(TVE_SWITCH_SRC_INFO));
326     UADPBypassSetSPT(&spt_TVE_SwitchInputSRC[1],UADP_SPT_POINTER_TO_NEXT,
327         ((unsigned long)(&(pVE_SwitchSrc_info->pSwithcSrc_info))-(unsigned long)pVE_SwitchSrc_info), (unsigned long)&spt_VE_SwithcSrc_info);
328     UADPBypassSetSPT(&spt_TVE_SwitchInputSRC[2],UADP_SPT_END , 0, 0);
329 
330 
331     UADPBypassSetSPT(&spt_TVE_SetInputSRC[0],UADP_SPT_SELF_SIZE,0, sizeof(TVE_SETINPUTSRC));
332     UADPBypassSetSPT(&spt_TVE_SetInputSRC[1],UADP_SPT_POINTER_TO_NEXT,
333         ((unsigned long)(&(pVE_SetInputSrc->pInputSrcInfo))-(unsigned long)pVE_SetInputSrc), (unsigned long)&spt_VE_InputSrcInfo);
334     UADPBypassSetSPT(&spt_TVE_SetInputSRC[2],UADP_SPT_END , 0, 0);
335 
336 
337     UADPBypassSetSPT(&spt_TVE_SwitchOutputDest[0],UADP_SPT_SELF_SIZE,0, sizeof(TVE_SWITCHOUTPUTDEST));
338     UADPBypassSetSPT(&spt_TVE_SwitchOutputDest[1],UADP_SPT_POINTER_TO_NEXT,
339         ((unsigned long)(&(pSwitchOutputDest->pSwitchInfo))-(unsigned long)pSwitchOutputDest), (unsigned long)&spt_VE_Switch_Dest_Info);
340     UADPBypassSetSPT(&spt_TVE_SwitchOutputDest[2],UADP_SPT_END , 0, 0);
341 
342 	UADPBypassSetSPT(&spt_TVE_SetOutputCtrl[0],UADP_SPT_SELF_SIZE,0, sizeof(TVE_SETOUTPUTCTRL));
343     UADPBypassSetSPT(&spt_TVE_SetOutputCtrl[1],UADP_SPT_POINTER_TO_NEXT,
344         ((unsigned long)(&(pSetOutputCtrl->pOutputCtrl)) - (unsigned long)pSetOutputCtrl), (unsigned long)&spt_VE_Output_Ctrl);
345     UADPBypassSetSPT(&spt_TVE_SetOutputCtrl[2],UADP_SPT_END , 0, 0);
346 
347 	UADPBypassSetSPT(&spt_TVE_SetOutputVideoStd[0],UADP_SPT_SELF_SIZE,0, sizeof(TVE_SETOUTPUTVIDEOSTD));
348 	UADPBypassSetSPT(&spt_TVE_SetOutputVideoStd[1],UADP_SPT_END , 0, 0);
349 
350     UADPBypassSetSPT(&spt_TVE_SetMemoryBaseAddr[0],UADP_SPT_SELF_SIZE,0, sizeof(TVE_SETMEMORYBASEADDR));
351     UADPBypassSetSPT(&spt_TVE_SetMemoryBaseAddr[1],UADP_SPT_END , 0, 0);
352 
353     UADP_SDT_NAME1(TVE_Init,TVE_INIT,UADP_SDT_AT,u32MIUAddress,MS_NULL);
354 
355     UADPBypassSetSPT(&spt_TVE_Exit[0],UADP_SPT_SELF_SIZE,0, sizeof(TVE_EXIT));
356 	UADPBypassSetSPT(&spt_TVE_Exit[1],UADP_SPT_END , 0, 0);
357 
358 
359     UADPBypassSetSPT(&spt_TVE_SetWSSData[0],UADP_SPT_SELF_SIZE,0, sizeof(TVE_SETWSSDATA));
360 	UADPBypassSetSPT(&spt_TVE_SetWSSData[1],UADP_SPT_END , 0, 0);
361 
362     UADPBypassSetSPT(&spt_TVE_GetWSSData[0],UADP_SPT_SELF_SIZE,0, sizeof(TVE_GETWSSDATA));
363 	UADPBypassSetSPT(&spt_TVE_GetWSSData[1],UADP_SPT_END , 0, 0);
364 
365     UADPBypassSetSPT(&spt_TVE_SetMode[0],UADP_SPT_SELF_SIZE,0, sizeof(TVE_SETMODE));
366     UADPBypassSetSPT(&spt_TVE_SetMode[1],UADP_SPT_POINTER_TO_NEXT,
367         ((unsigned long)(&(pSetMode->pVESetMode)) - (unsigned long)pSetMode), (unsigned long)&spt_VE_DrvSetMode);
368 	UADPBypassSetSPT(&spt_TVE_SetMode[2],UADP_SPT_END , 0, 0);
369 
370     UADPBypassSetSPT(&spt_TVE_SetBlackSceen[0],UADP_SPT_SELF_SIZE,0, sizeof(TVE_SETBLACKSCREEN));
371 	UADPBypassSetSPT(&spt_TVE_SetBlackSceen[1],UADP_SPT_END , 0, 0);
372 
373     UADPBypassSetSPT(&spt_TVE_IsBlackScreenEnabled[0],UADP_SPT_SELF_SIZE,0, sizeof(TVE_SETBLACKSCREEN));
374 	UADPBypassSetSPT(&spt_TVE_IsBlackScreenEnabled[1],UADP_SPT_END , 0, 0);
375 
376     UADPBypassSetSPT(&spt_TVE_SetTtxBuffer[0],UADP_SPT_SELF_SIZE,0, sizeof(TVE_SETTTXBUFFER));
377 	UADPBypassSetSPT(&spt_TVE_SetTtxBuffer[1],UADP_SPT_END , 0, 0);
378 
379     UADPBypassSetSPT(&spt_TVE_VE_GetTtxReadDoneStatus[0],UADP_SPT_SELF_SIZE,0, sizeof(TVE_GETTTXREADDONE));
380 	UADPBypassSetSPT(&spt_TVE_VE_GetTtxReadDoneStatus[1],UADP_SPT_END , 0, 0);
381 
382     UADPBypassSetSPT(&spt_TVE_EnableCcSw[0],UADP_SPT_SELF_SIZE,0, sizeof(TVE_ENABLECCSW));
383 	UADPBypassSetSPT(&spt_TVE_EnableCcSw[1],UADP_SPT_END , 0, 0);
384 
385     UADPBypassSetSPT(&spt_TVE_SetCcRange[0],UADP_SPT_SELF_SIZE,0, sizeof(TVE_SETCCRANGE));
386 	UADPBypassSetSPT(&spt_TVE_SetCcRange[1],UADP_SPT_END , 0, 0);
387 
388     UADPBypassSetSPT(&spt_TVE_SendCcData[0],UADP_SPT_SELF_SIZE,0, sizeof(TVE_SENDCCDATA));
389 	UADPBypassSetSPT(&spt_TVE_SendCcData[1],UADP_SPT_END , 0, 0);
390 
391     UADPBypassSetSPT(&spt_TVE_set_display_window[0],UADP_SPT_SELF_SIZE,0, sizeof(TVE_SETDISPLAYWIN));
392 	//UADPBypassSetSPT(&spt_TVE_set_display_window[1],UADP_SPT_POINTER_TO_NEXT,
393     //    ((unsigned long)(&(pSetDisplayWin->stDispWin)) - (unsigned long)pSetDisplayWin), (unsigned long)&spt_VE_SetDisplayWin);
394     UADPBypassSetSPT(&spt_TVE_set_display_window[2],UADP_SPT_END , 0, 0);
395 
396     UADPBypassSetSPT(&spt_TVE_SetOSD[0],UADP_SPT_SELF_SIZE,0, sizeof(TVE_SETOSD));
397 	UADPBypassSetSPT(&spt_TVE_SetOSD[1],UADP_SPT_END , 0, 0);
398 
399     UADPBypassSetSPT(&spt_TVE_SetRGBIn[0],UADP_SPT_SELF_SIZE,0, sizeof(TVE_SETRGBIN));
400 	UADPBypassSetSPT(&spt_TVE_SetRGBIn[1],UADP_SPT_END , 0, 0);
401 
402     UADPBypassSetSPT(&spt_TVE_Get_Output_Video_Std[0],UADP_SPT_SELF_SIZE,0, sizeof(TVE_GETOUTPUTVIDEOSTD));
403 	UADPBypassSetSPT(&spt_TVE_Get_Output_Video_Std[1],UADP_SPT_END , 0, 0);
404 
405     UADPBypassSetSPT(&spt_TVE_SetCaptureMode[0],UADP_SPT_SELF_SIZE,0, sizeof(TVE_SETCAPMODE));
406 	UADPBypassSetSPT(&spt_TVE_SetCaptureMode[1],UADP_SPT_END , 0, 0);
407 
408     UADPBypassSetSPT(&spt_TVE_GetDstInfo[0],UADP_SPT_SELF_SIZE,0, sizeof(TVE_GETDSTINFO));
409     UADPBypassSetSPT(&spt_TVE_GetDstInfo[1],UADP_SPT_POINTER_TO_NEXT,
410         ((unsigned long)(&(pGetDstInfo->pDstInfo)) - (unsigned long)pGetDstInfo), (unsigned long)&spt_VE_DST_DispInfo);
411 	UADPBypassSetSPT(&spt_TVE_GetDstInfo[2],UADP_SPT_END , 0, 0);
412 
413     UADPBypassSetSPT(&spt_TVE_Set_TestPattern[0],UADP_SPT_SELF_SIZE,0, sizeof(TVE_SETTESTPATTERN));
414 	UADPBypassSetSPT(&spt_TVE_Set_TestPattern[1],UADP_SPT_END , 0, 0);
415 
416     UADPBypassSetSPT(&spt_TVE_DisableRegWrite[0],UADP_SPT_SELF_SIZE,0, sizeof(TVE_DISABLEREGWRITE));
417 	UADPBypassSetSPT(&spt_TVE_DisableRegWrite[1],UADP_SPT_END , 0, 0);
418 
419     UADPBypassSetSPT(&spt_TVE_AdjustPositionBase[0],UADP_SPT_SELF_SIZE,0, sizeof(TVE_ADJPOSITIONBASE));
420 	UADPBypassSetSPT(&spt_TVE_AdjustPositionBase[1],UADP_SPT_END , 0, 0);
421 
422     UADPBypassSetSPT(&spt_TVE_Set_Customer_Scaling[0],UADP_SPT_SELF_SIZE,0, sizeof(TVE_SETCUSSCALING));
423     UADPBypassSetSPT(&spt_TVE_Set_Customer_Scaling[1],UADP_SPT_POINTER_TO_NEXT,
424         ((unsigned long)(&(pSetCusScaling->pstVECusScalingInfo)) - (unsigned long)pSetCusScaling), (unsigned long)&spt_VE_CusScalingInfo);
425 	UADPBypassSetSPT(&spt_TVE_Set_Customer_Scaling[2],UADP_SPT_END , 0, 0);
426 
427     UADPBypassSetSPT(&spt_TVE_InitVECapture[0],UADP_SPT_SELF_SIZE,0, sizeof(_TVE_INITCAPTURE));
428     UADPBypassSetSPT(&spt_TVE_InitVECapture[1],UADP_SPT_POINTER_TO_NEXT,
429         ((unsigned long)(&(pInitCapture->pVECapture)) - (unsigned long)pInitCapture), (unsigned long)&spt_VE_Output_CAPTURE);
430 	UADPBypassSetSPT(&spt_TVE_InitVECapture[2],UADP_SPT_END , 0, 0);
431 
432     UADPBypassSetSPT(&spt_TVE_EnaVECapture[0],UADP_SPT_SELF_SIZE,0, sizeof(TVE_ENACAPTURE));
433     UADPBypassSetSPT(&spt_TVE_EnaVECapture[1],UADP_SPT_POINTER_TO_NEXT,
434         ((unsigned long)(&(pEnableCapture->pstVECapState)) - (unsigned long)pEnableCapture), (unsigned long)&spt_VE_VECAPTURESTATE);
435 	UADPBypassSetSPT(&spt_TVE_EnaVECapture[2],UADP_SPT_END , 0, 0);
436 
437     UADPBypassSetSPT(&spt_TVE_Adjust_FrameStart[0],UADP_SPT_SELF_SIZE,0, sizeof(TVE_ADJFRAMESTART));
438     UADPBypassSetSPT(&spt_TVE_Adjust_FrameStart[1],UADP_SPT_POINTER_TO_NEXT,
439         ((unsigned long)(&(pAdjustFrameStart->stSrcWin)) - (unsigned long)pAdjustFrameStart), (unsigned long)&spt_VE_WINDOW_TYPE);
440 	UADPBypassSetSPT(&spt_TVE_Adjust_FrameStart[2],UADP_SPT_END , 0, 0);
441 
442     UADPBypassSetSPT(&spt_TVE_SetPowerState[0],UADP_SPT_SELF_SIZE,0, sizeof(TVE_SETPOWERSTATE));
443     UADPBypassSetSPT(&spt_TVE_SetPowerState[1],UADP_SPT_END , 0, 0);
444 
445     UADPBypassSetSPT(&spt_TVE_ReloadSetting[0],UADP_SPT_SELF_SIZE,0, sizeof(TVE_RELOADSETTING));
446     UADPBypassSetSPT(&spt_TVE_ReloadSetting[1],UADP_SPT_END , 0, 0);
447 
448     UADPBypassSetSPT(&spt_TVE_GetConfig[0],UADP_SPT_SELF_SIZE,0, sizeof(TVE_GETCONFIG));
449     UADPBypassSetSPT(&spt_TVE_GetConfig[1],UADP_SPT_POINTER_TO_NEXT,
450         ((unsigned long)(&(pGetConfig->pMIUAddress))-(unsigned long)pGetConfig), (unsigned long)&spt_VE_Config);
451     UADPBypassSetSPT(&spt_TVE_GetConfig[2],UADP_SPT_END , 0, 0);
452 
453 	*pIoctl= (FUtopiaIOctl)TVENCODER_adp_Ioctl;
454     return 0;
455 }
TVENCODER_adp_Ioctl(void * pInstanceTmp,MS_U32 u32Cmd,void * const pArgs)456 
457 MS_U32 TVENCODER_adp_Ioctl(void* pInstanceTmp, MS_U32 u32Cmd, void* const pArgs)
458 {
459     MS_U32 u32Ret;
460 	char buffer_arg[2048];
461     switch(u32Cmd)
462     {
463 
464 		case E_MDRV_CMD_TVE_GetInfo :
465 			u32Ret = UADPBypassIoctl(pInstanceTmp,u32Cmd,pArgs,NULL, spt_TVE_GetInfo,buffer_arg,sizeof(buffer_arg));
466 			break;
467         case E_MDRV_CMD_TVE_GetStatues:
468 			u32Ret = UADPBypassIoctl(pInstanceTmp,u32Cmd,pArgs,NULL, spt_TVE_GetStatus,buffer_arg,sizeof(buffer_arg));
469 			break;
470         case E_MDRV_CMD_TVE_SetDbgLevel:
471 			u32Ret = UADPBypassIoctl(pInstanceTmp,u32Cmd,pArgs,spt_TVE_SetDbgLevel, spt_TVE_SetDbgLevel,buffer_arg,sizeof(buffer_arg));
472 		    break;
473         case E_MDRV_CMD_TVE_SwitchInputSRC:
474 			u32Ret = UADPBypassIoctl(pInstanceTmp,u32Cmd,pArgs,spt_TVE_SwitchInputSRC, spt_TVE_SwitchInputSRC,buffer_arg,sizeof(buffer_arg));
475 		    break;
476         case E_MDRV_CMD_TVE_SetInputSRC:
477 			u32Ret = UADPBypassIoctl(pInstanceTmp,u32Cmd,pArgs,spt_TVE_SetInputSRC, spt_TVE_SetInputSRC,buffer_arg,sizeof(buffer_arg));
478 		    break;
479         case E_MDRV_CMD_TVE_SwitchOutputDest:
480 			u32Ret = UADPBypassIoctl(pInstanceTmp,u32Cmd,pArgs,spt_TVE_SwitchOutputDest,spt_TVE_SwitchOutputDest,buffer_arg,sizeof(buffer_arg));
481 		    break;
482         case E_MDRV_CMD_TVE_SetOutputCtrl:
483 			u32Ret = UADPBypassIoctl(pInstanceTmp,u32Cmd,pArgs,spt_TVE_SwitchOutputDest,spt_TVE_SwitchOutputDest,buffer_arg,sizeof(buffer_arg));
484 		    break;
485         case E_MDRV_CMD_TVE_SetOutputVideoStd:
486 			u32Ret = UADPBypassIoctl(pInstanceTmp,u32Cmd,pArgs,spt_TVE_SetOutputVideoStd,spt_TVE_SetOutputVideoStd,buffer_arg,sizeof(buffer_arg));
487 		    break;
488         case E_MDRV_CMD_TVE_SetMemoryBaseAddr:
489 			u32Ret = UADPBypassIoctl(pInstanceTmp,u32Cmd,pArgs,spt_TVE_SetMemoryBaseAddr,NULL,buffer_arg,sizeof(buffer_arg));
490 		    break;
491         case E_MDRV_CMD_TVE_Init:
492 			u32Ret = UADPBypassIoctl(pInstanceTmp,u32Cmd,pArgs,spt_TVE_Init,spt_TVE_Init,buffer_arg,sizeof(buffer_arg));
493 		    break;
494         case E_MDRV_CMD_TVE_Exit:
495 			u32Ret = UADPBypassIoctl(pInstanceTmp,u32Cmd,pArgs,NULL,spt_TVE_Exit,buffer_arg,sizeof(buffer_arg));
496 		    break;
497         case E_MDRV_CMD_TVE_SetWSSData:
498 			u32Ret = UADPBypassIoctl(pInstanceTmp,u32Cmd,pArgs,spt_TVE_SetWSSData,spt_TVE_SetWSSData,buffer_arg,sizeof(buffer_arg));
499 		    break;
500         case E_MDRV_CMD_TVE_GetWSSData:
501 			u32Ret = UADPBypassIoctl(pInstanceTmp,u32Cmd,pArgs,NULL,spt_TVE_GetWSSData,buffer_arg,sizeof(buffer_arg));
502 		    break;
503         case E_MDRV_CMD_TVE_SetMode:
504 			u32Ret = UADPBypassIoctl(pInstanceTmp,u32Cmd,pArgs,spt_TVE_SetMode,spt_TVE_SetMode,buffer_arg,sizeof(buffer_arg));
505 		    break;
506         case E_MDRV_CMD_TVE_SetBlackSceen:
507 			u32Ret = UADPBypassIoctl(pInstanceTmp,u32Cmd,pArgs,spt_TVE_SetBlackSceen,NULL,buffer_arg,sizeof(buffer_arg));
508 		    break;
509         case E_MDRV_CMD_TVE_IsBlackScreenEnabled:
510 			u32Ret = UADPBypassIoctl(pInstanceTmp,u32Cmd,pArgs,NULL,spt_TVE_IsBlackScreenEnabled,buffer_arg,sizeof(buffer_arg));
511 		    break;
512         case E_MDRV_CMD_TVE_SetTtxBuffer:
513 			u32Ret = UADPBypassIoctl(pInstanceTmp,u32Cmd,pArgs,spt_TVE_SetTtxBuffer,NULL,buffer_arg,sizeof(buffer_arg));
514 		    break;
515         case E_MDRV_CMD_TVE_VE_GetTtxReadDoneStatus:
516 			u32Ret = UADPBypassIoctl(pInstanceTmp,u32Cmd,pArgs,NULL,spt_TVE_VE_GetTtxReadDoneStatus,buffer_arg,sizeof(buffer_arg));
517 		    break;
518         case E_MDRV_CMD_TVE_EnableCcSw:
519 			u32Ret = UADPBypassIoctl(pInstanceTmp,u32Cmd,pArgs,spt_TVE_EnableCcSw,NULL,buffer_arg,sizeof(buffer_arg));
520 		    break;
521         case E_MDRV_CMD_TVE_SetCcRange:
522 			u32Ret = UADPBypassIoctl(pInstanceTmp,u32Cmd,pArgs,spt_TVE_SetCcRange,NULL,buffer_arg,sizeof(buffer_arg));
523 		    break;
524         case E_MDRV_CMD_TVE_SendCcData:
525 			u32Ret = UADPBypassIoctl(pInstanceTmp,u32Cmd,pArgs,spt_TVE_SendCcData,NULL,buffer_arg,sizeof(buffer_arg));
526 		    break;
527         case E_MDRV_CMD_TVE_set_display_window:
528 			u32Ret = UADPBypassIoctl(pInstanceTmp,u32Cmd,pArgs,spt_TVE_set_display_window,NULL,buffer_arg,sizeof(buffer_arg));
529 		    break;
530         case E_MDRV_CMD_TVE_SetOSD:
531 			u32Ret = UADPBypassIoctl(pInstanceTmp,u32Cmd,pArgs,spt_TVE_SetOSD,NULL,buffer_arg,sizeof(buffer_arg));
532 		    break;
533         case E_MDRV_CMD_TVE_SetRGBIn:
534 			u32Ret = UADPBypassIoctl(pInstanceTmp,u32Cmd,pArgs,spt_TVE_SetRGBIn,NULL,buffer_arg,sizeof(buffer_arg));
535 		    break;
536         case E_MDRV_CMD_TVE_Get_Output_Video_Std:
537 			u32Ret = UADPBypassIoctl(pInstanceTmp,u32Cmd,pArgs,NULL,spt_TVE_Get_Output_Video_Std,buffer_arg,sizeof(buffer_arg));
538             break;
539         case E_MDRV_CMD_TVE_SetCaptureMode:
540 			u32Ret = UADPBypassIoctl(pInstanceTmp,u32Cmd,pArgs,spt_TVE_SetCaptureMode,NULL,buffer_arg,sizeof(buffer_arg));
541             break;
542         case E_MDRV_CMD_TVE_GetDstInfo:
543 			u32Ret = UADPBypassIoctl(pInstanceTmp,u32Cmd,pArgs,spt_TVE_GetDstInfo,spt_TVE_GetDstInfo,buffer_arg,sizeof(buffer_arg));
544             break;
545         case E_MDRV_CMD_TVE_Set_TestPattern:
546 			u32Ret = UADPBypassIoctl(pInstanceTmp,u32Cmd,pArgs,spt_TVE_Set_TestPattern,NULL,buffer_arg,sizeof(buffer_arg));
547             break;
548         case E_MDRV_CMD_TVE_DisableRegWrite:
549 			u32Ret = UADPBypassIoctl(pInstanceTmp,u32Cmd,pArgs,spt_TVE_DisableRegWrite,spt_TVE_DisableRegWrite,buffer_arg,sizeof(buffer_arg));
550             break;
551         case E_MDRV_CMD_TVE_AdjustPositionBase:
552 			u32Ret = UADPBypassIoctl(pInstanceTmp,u32Cmd,pArgs,spt_TVE_AdjustPositionBase,spt_TVE_AdjustPositionBase,buffer_arg,sizeof(buffer_arg));
553             break;
554         case E_MDRV_CMD_TVE_Set_Customer_Scaling:
555 			u32Ret = UADPBypassIoctl(pInstanceTmp,u32Cmd,pArgs,spt_TVE_Set_Customer_Scaling,spt_TVE_Set_Customer_Scaling,buffer_arg,sizeof(buffer_arg));
556             break;
557         case E_MDRV_CMD_TVE_InitVECapture:
558 			u32Ret = UADPBypassIoctl(pInstanceTmp,u32Cmd,pArgs,spt_TVE_InitVECapture,NULL,buffer_arg,sizeof(buffer_arg));
559             break;
560         case E_MDRV_CMD_TVE_EnaVECapture:
561 			u32Ret = UADPBypassIoctl(pInstanceTmp,u32Cmd,pArgs,spt_TVE_EnaVECapture,spt_TVE_EnaVECapture,buffer_arg,sizeof(buffer_arg));
562             break;
563         case E_MDRV_CMD_TVE_Adjust_FrameStart:
564 			u32Ret = UADPBypassIoctl(pInstanceTmp,u32Cmd,pArgs,spt_TVE_Adjust_FrameStart,spt_TVE_Adjust_FrameStart,buffer_arg,sizeof(buffer_arg));
565             break;
566         case E_MDRV_CMD_TVE_SetPowerState:
567 			u32Ret = UADPBypassIoctl(pInstanceTmp,u32Cmd,pArgs,spt_TVE_SetPowerState,spt_TVE_SetPowerState,buffer_arg,sizeof(buffer_arg));
568             break;
569         case E_MDRV_CMD_TVE_ReloadSetting:
570 			u32Ret = UADPBypassIoctl(pInstanceTmp,u32Cmd,pArgs,NULL,spt_TVE_ReloadSetting,buffer_arg,sizeof(buffer_arg));
571 		    break;
572         case E_MDRV_CMD_TVE_GetConfig:
573 			u32Ret = UADPBypassIoctl(pInstanceTmp,u32Cmd,pArgs,spt_TVE_GetConfig, spt_TVE_GetConfig,buffer_arg,sizeof(buffer_arg));
574 		    break;
575         default:
576             break;
577 
578     }
579 
580 	return u32Ret;
581    // return UtopiaIoctl(pModuleDDI->pInstant,u32Cmd,arg);
582 }
583 
584 #endif
585 
586