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) 2006-2007 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 apiDMS.c
98 /// @author MStar Semiconductor,Inc.
99 /// @brief DMS Api
100 ///////////////////////////////////////////////////////////////////////////////////////////////////
101
102 //-------------------------------------------------------------------------------------------------
103 // Include Files
104 //-------------------------------------------------------------------------------------------------
105
106 #include "MsCommon.h"
107 #include "MsVersion.h"
108 #include "MsIRQ.h"
109 #include "MsOS.h"
110
111 #include "drvDMS.h"
112 #include "apiDMS.h"
113
114 #ifdef MSOS_TYPE_LINUX_KERNEL
115 #include <linux/string.h>
116 #else
117 #include <string.h>
118 #endif
119
120 #include "utopia.h"
121 #include "utopia_dapi.h"
122 #include "apiDMS_v2.h"
123 #include "drvDMS.h"
124 #include "halDMS.h"
125 #include "apiDMS_private.h"
126 #include "UFO.h"
127
128 // for Utopia 2.0 to Utopia 1.0 compatibility.
129 void* g_pDMSInst = NULL;
130
MApi_DMS_Init_U2(void * pInstance,ST_DMS_INITDATA * pstDMS_InitData)131 EN_DMS_RESULT MApi_DMS_Init_U2(void* pInstance, ST_DMS_INITDATA *pstDMS_InitData)
132 {
133 EN_DMS_RESULT eRet = E_DMS_FAIL;
134 eRet = MDrv_DMS_Init(pInstance,pstDMS_InitData);
135 return eRet;
136 }
137
MApi_DMS_Init(ST_DMS_INITDATA * pstDMS_InitData)138 EN_DMS_RESULT MApi_DMS_Init(ST_DMS_INITDATA *pstDMS_InitData)
139 {
140 if (g_pDMSInst == NULL)
141 {
142 if(UtopiaOpen(MODULE_DMS, &g_pDMSInst, 0, NULL) != UTOPIA_STATUS_SUCCESS)
143 {
144 printf("[%s]UtopiaOpen DMS failed\n", __FUNCTION__);
145 return E_DMS_FAIL;
146 }
147 }
148
149 if(pstDMS_InitData == NULL)
150 {
151 printf("[%s,%5d] pstDMS_InitData is NULL\n",__FUNCTION__,__LINE__);
152 return E_DMS_FAIL;
153 }
154
155 ST_DMS_INIT DMSArgs;
156 DMSArgs.eReturnValue = E_DMS_FAIL;
157 DMSArgs.pstDMS_InitData = pstDMS_InitData;
158 if(UtopiaIoctl(g_pDMSInst, E_DMS_CMD_INIT, (void*)&DMSArgs) != UTOPIA_STATUS_SUCCESS)
159 {
160 printf("[%s,%5d] Obtain DMS engine fail\n",__FUNCTION__,__LINE__);
161 }
162 return DMSArgs.eReturnValue;
163 }
164
MApi_DMS_SetMemory_U2(void * pInstance,ST_DMS_SET_MEMORY_TYPE * pstDMS_SetMemType)165 EN_DMS_RESULT MApi_DMS_SetMemory_U2(void* pInstance, ST_DMS_SET_MEMORY_TYPE* pstDMS_SetMemType)
166 {
167 EN_DMS_RESULT eRet = E_DMS_FAIL;
168 eRet = MDrv_DMS_SetMemoryType(pInstance,pstDMS_SetMemType);
169 return eRet;
170 }
171
MApi_DMS_SetMemory(ST_DMS_SET_MEMORY_TYPE * pstDMS_SetMemType)172 EN_DMS_RESULT MApi_DMS_SetMemory(ST_DMS_SET_MEMORY_TYPE* pstDMS_SetMemType)
173 {
174 if (g_pDMSInst == NULL)
175 {
176 printf("[%s,%5d] No instance existed, please get an instance by calling MApi_DMS_Init() first\n",__FUNCTION__,__LINE__);
177 return E_DMS_FAIL;
178 }
179
180 if(pstDMS_SetMemType == NULL)
181 {
182 printf("[%s,%5d] pstDMS_SetMemType is NULL\n",__FUNCTION__,__LINE__);
183 return E_DMS_FAIL;
184 }
185
186 ST_DMS_SETMEMTYPE DMSArgs;
187 DMSArgs.eReturnValue = E_DMS_FAIL;
188 DMSArgs.pstDMS_SetMemType = pstDMS_SetMemType;
189 if(UtopiaIoctl(g_pDMSInst, E_DMS_CMD_SETMEMORY, (void*)&DMSArgs) != UTOPIA_STATUS_SUCCESS)
190 {
191 printf("[%s,%5d] Obtain DMS engine fail\n",__FUNCTION__,__LINE__);
192 }
193 return DMSArgs.eReturnValue;
194 }
195
MApi_DMS_CreateWindow_U2(void * pInstance,ST_DMS_WINDOW * pstOutputWin,ST_DMS_CREATE_WIN_INFO * pstCreateWin_Info,MS_U32 * pu32WindowID)196 EN_DMS_RESULT MApi_DMS_CreateWindow_U2(void* pInstance, ST_DMS_WINDOW *pstOutputWin, ST_DMS_CREATE_WIN_INFO *pstCreateWin_Info, MS_U32 *pu32WindowID)
197 {
198 EN_DMS_RESULT eRet = E_DMS_FAIL;
199 eRet = MDrv_DMS_CreateWindow(pInstance, pstOutputWin, 0, pu32WindowID);
200 return eRet;
201 }
202
MApi_DMS_CreateWindow(ST_DMS_WINDOW * pstOutputWin,ST_DMS_CREATE_WIN_INFO * pstCreateWin_Info,MS_U32 * pu32WindowID)203 EN_DMS_RESULT MApi_DMS_CreateWindow(ST_DMS_WINDOW *pstOutputWin, ST_DMS_CREATE_WIN_INFO *pstCreateWin_Info, MS_U32 *pu32WindowID)
204 {
205 if (g_pDMSInst == NULL)
206 {
207 printf("[%s,%5d] No instance existed, please get an instance by calling MApi_DMS_Init() first\n",__FUNCTION__,__LINE__);
208 return E_DMS_FAIL;
209 }
210
211 ST_DMS_CREATEWIN DMSArgs;
212 DMSArgs.eReturnValue = E_DMS_FAIL;
213 DMSArgs.pstOutputWin = pstOutputWin;
214 DMSArgs.pstCreateWin_Info = pstCreateWin_Info;
215 DMSArgs.pu32WindowID = pu32WindowID;
216
217 if(UtopiaIoctl(g_pDMSInst, E_DMS_CMD_CREATEWINDOW, (void*)&DMSArgs) != UTOPIA_STATUS_SUCCESS)
218 {
219 printf("[%s,%5d] Obtain DMS engine fail\n",__FUNCTION__,__LINE__);
220 }
221 return DMSArgs.eReturnValue;
222 }
223
MApi_DMS_SetDigitalDecodeSignalInfo_U2(void * pInstance,MS_U32 u32WindowID,ST_DMS_DISPFRAMEFORMAT * pstDispFrameFormat)224 EN_DMS_RESULT MApi_DMS_SetDigitalDecodeSignalInfo_U2(void* pInstance, MS_U32 u32WindowID, ST_DMS_DISPFRAMEFORMAT *pstDispFrameFormat)
225 {
226 EN_DMS_RESULT eRet = E_DMS_FAIL;
227 eRet = MDrv_DMS_SetDigitalDecodeSignalInfo(pInstance, u32WindowID, pstDispFrameFormat);
228 return eRet;
229 }
230
MApi_DMS_SetDigitalDecodeSignalInfo(MS_U32 u32WindowID,ST_DMS_DISPFRAMEFORMAT * pstDispFrameFormat)231 EN_DMS_RESULT MApi_DMS_SetDigitalDecodeSignalInfo(MS_U32 u32WindowID, ST_DMS_DISPFRAMEFORMAT *pstDispFrameFormat)
232 {
233 if (g_pDMSInst == NULL)
234 {
235 printf("[%s,%5d] No instance existed, please get an instance by calling MApi_DMS_Init() first\n",__FUNCTION__,__LINE__);
236 return E_DMS_FAIL;
237 }
238
239 ST_DMS_SETDIGIDECINFO DMSArgs;
240 DMSArgs.eReturnValue = E_DMS_FAIL;
241 DMSArgs.u32WindowID = u32WindowID;
242 DMSArgs.pstDispFrameFormat = pstDispFrameFormat;
243 if(UtopiaIoctl(g_pDMSInst, E_DMS_CMD_SETDIGITALDECODESIGNALINFO, (void*)&DMSArgs) != UTOPIA_STATUS_SUCCESS)
244 {
245 printf("[%s,%5d] Obtain DMS engine fail\n",__FUNCTION__,__LINE__);
246 }
247 return DMSArgs.eReturnValue;
248 }
249
MApi_DMS_ClearDigitalDecodeSignalInfo_U2(void * pInstance,MS_U32 u32WindowID)250 EN_DMS_RESULT MApi_DMS_ClearDigitalDecodeSignalInfo_U2(void* pInstance, MS_U32 u32WindowID)
251 {
252 EN_DMS_RESULT eRet = E_DMS_FAIL;
253 eRet = MDrv_DMS_ClearDigitalDecodeSignalInfo(pInstance, u32WindowID);
254 return E_DMS_OK;
255 }
256
MApi_DMS_ClearDigitalDecodeSignalInfo(MS_U32 u32WindowID)257 EN_DMS_RESULT MApi_DMS_ClearDigitalDecodeSignalInfo(MS_U32 u32WindowID)
258 {
259 if (g_pDMSInst == NULL)
260 {
261 printf("[%s,%5d] No instance existed, please get an instance by calling MApi_DMS_Init() first\n",__FUNCTION__,__LINE__);
262 return E_DMS_FAIL;
263 }
264
265 ST_DMS_CLEARDIGIDECINFO DMSArgs;
266 DMSArgs.eReturnValue = E_DMS_FAIL;
267 DMSArgs.u32WindowID = u32WindowID;
268 if(UtopiaIoctl(g_pDMSInst, E_DMS_CMD_CLEARDIGITALDECODESIGNALINFO, (void*)&DMSArgs) != UTOPIA_STATUS_SUCCESS)
269 {
270 printf("[%s,%5d] Obtain DMS engine fail\n",__FUNCTION__,__LINE__);
271 }
272 return DMSArgs.eReturnValue;
273 }
274
MApi_DMS_DestroyWindow_U2(void * pInstance,MS_U32 u32WindowID)275 EN_DMS_RESULT MApi_DMS_DestroyWindow_U2(void* pInstance, MS_U32 u32WindowID)
276 {
277 EN_DMS_RESULT eRet = E_DMS_FAIL;
278 eRet = MDrv_DMS_DestroyWindow(pInstance, u32WindowID);
279 return eRet;
280 }
281
MApi_DMS_DestroyWindow(MS_U32 u32WindowID)282 EN_DMS_RESULT MApi_DMS_DestroyWindow(MS_U32 u32WindowID)
283 {
284 if (g_pDMSInst == NULL)
285 {
286 printf("[%s,%5d] No instance existed, please get an instance by calling MApi_DMS_Init() first\n",__FUNCTION__,__LINE__);
287 return E_DMS_FAIL;
288 }
289
290 ST_DMS_DESTORYWIN DMSArgs;
291 DMSArgs.eReturnValue = E_DMS_FAIL;
292 DMSArgs.u32WindowID = u32WindowID;
293 if(UtopiaIoctl(g_pDMSInst, E_DMS_CMD_DESTORYWINDOW, (void*)&DMSArgs) != UTOPIA_STATUS_SUCCESS)
294 {
295 printf("[%s,%5d] Obtain DMS engine fail\n",__FUNCTION__,__LINE__);
296 }
297 return DMSArgs.eReturnValue;
298 }
299
MApi_DMS_SetWindow_U2(void * pInstance,MS_U32 u32WindowID,ST_DMS_SETWIN_INFO * pstDMS_SetWin_Info)300 EN_DMS_RESULT MApi_DMS_SetWindow_U2(void* pInstance, MS_U32 u32WindowID, ST_DMS_SETWIN_INFO *pstDMS_SetWin_Info)
301 {
302 EN_DMS_RESULT eRet = E_DMS_FAIL;
303 eRet = MDrv_DMS_SetWindow(pInstance,u32WindowID,pstDMS_SetWin_Info);
304 return eRet;
305 }
306
MApi_DMS_SetWindow(MS_U32 u32WindowID,ST_DMS_SETWIN_INFO * pstDMS_SetWin_Info)307 EN_DMS_RESULT MApi_DMS_SetWindow(MS_U32 u32WindowID, ST_DMS_SETWIN_INFO *pstDMS_SetWin_Info)
308 {
309 if (g_pDMSInst == NULL)
310 {
311 printf("[%s,%5d] No instance existed, please get an instance by calling MApi_DMS_Init() first\n",__FUNCTION__,__LINE__);
312 return E_DMS_FAIL;
313 }
314
315 if(pstDMS_SetWin_Info == NULL)
316 {
317 printf("[%s,%5d] pstDMS_SetWin_Info is NULL\n",__FUNCTION__,__LINE__);
318 return E_DMS_FAIL;
319 }
320
321 ST_DMS_SETWIN DMSArgs;
322 DMSArgs.eReturnValue = E_DMS_FAIL;
323 DMSArgs.u32WindowID = u32WindowID;
324 DMSArgs.pstDMS_SetWin_Info = pstDMS_SetWin_Info;
325 if(UtopiaIoctl(g_pDMSInst, E_DMS_CMD_SETWINDOW, (void*)&DMSArgs) != UTOPIA_STATUS_SUCCESS)
326 {
327 printf("[%s,%5d] Obtain DMS engine fail\n",__FUNCTION__,__LINE__);
328 }
329 return DMSArgs.eReturnValue;
330 }
331
MApi_DMS_GetWindowInfo_U2(void * pInstance,MS_U32 u32WindowID,ST_DMS_WINDOW_INFO * pstDMS_GetWin_Info)332 EN_DMS_RESULT MApi_DMS_GetWindowInfo_U2(void* pInstance, MS_U32 u32WindowID, ST_DMS_WINDOW_INFO *pstDMS_GetWin_Info)
333 {
334 printf("[%s,%5d] Not Impl\n",__FUNCTION__,__LINE__);
335 return E_DMS_OK;
336 }
337
MApi_DMS_GetWindowInfo(MS_U32 u32WindowID,ST_DMS_WINDOW_INFO * pstDMS_GetWin_Info)338 EN_DMS_RESULT MApi_DMS_GetWindowInfo(MS_U32 u32WindowID, ST_DMS_WINDOW_INFO *pstDMS_GetWin_Info)
339 {
340 if (g_pDMSInst == NULL)
341 {
342 printf("[%s,%5d] No instance existed, please get an instance by calling MApi_DMS_Init() first\n",__FUNCTION__,__LINE__);
343 return E_DMS_FAIL;
344 }
345
346 if(pstDMS_GetWin_Info == NULL)
347 {
348 printf("[%s,%5d] pstDMS_GetWin_Info is NULL\n",__FUNCTION__,__LINE__);
349 return E_DMS_FAIL;
350 }
351
352 ST_DMS_GETWININFO DMSArgs;
353 DMSArgs.eReturnValue = E_DMS_FAIL;
354 DMSArgs.u32WindowID = u32WindowID;
355 DMSArgs.pstDMS_GetWin_Info = pstDMS_GetWin_Info;
356 if(UtopiaIoctl(g_pDMSInst, E_DMS_CMD_GETWINDOWINFO, (void*)&DMSArgs) != UTOPIA_STATUS_SUCCESS)
357 {
358 printf("[%s,%5d] Obtain DMS engine fail\n",__FUNCTION__,__LINE__);
359 }
360 return DMSArgs.eReturnValue;
361 }
362
MApi_DMS_Video_Flip_U2(void * pInstance,MS_U32 u32WindowID,ST_DMS_DISPFRAMEFORMAT * pstDispFrameFormat)363 EN_DMS_RESULT MApi_DMS_Video_Flip_U2(void* pInstance, MS_U32 u32WindowID, ST_DMS_DISPFRAMEFORMAT* pstDispFrameFormat)
364 {
365 EN_DMS_RESULT eRet = E_DMS_FAIL;
366 eRet = MDrv_DMS_Video_Flip(pInstance, u32WindowID, pstDispFrameFormat);
367 return eRet;
368 }
369
MApi_DMS_Video_Flip(MS_U32 u32WindowID,ST_DMS_DISPFRAMEFORMAT * pstDispFrameFormat)370 EN_DMS_RESULT MApi_DMS_Video_Flip(MS_U32 u32WindowID, ST_DMS_DISPFRAMEFORMAT* pstDispFrameFormat)
371 {
372 if (g_pDMSInst == NULL)
373 {
374 printf("[%s,%5d] No instance existed, please get an instance by calling MApi_DMS_Init() first\n",__FUNCTION__,__LINE__);
375 return E_DMS_FAIL;
376 }
377
378 if(pstDispFrameFormat == NULL)
379 {
380 printf("[%s,%5d] pstDispFrameFormat is NULL\n",__FUNCTION__,__LINE__);
381 return E_DMS_FAIL;
382 }
383
384 ST_DMS_FLIP DMSArgs;
385 DMSArgs.eReturnValue = E_DMS_FAIL;
386 DMSArgs.u32WindowID = u32WindowID;
387 DMSArgs.pstDispFrameFormat = pstDispFrameFormat;
388 if(UtopiaIoctl(g_pDMSInst, E_DMS_CMD_VIDEOFLIP, (void*)&DMSArgs) != UTOPIA_STATUS_SUCCESS)
389 {
390 printf("[%s,%5d] Obtain DMS engine fail\n",__FUNCTION__,__LINE__);
391 }
392 return DMSArgs.eReturnValue;
393 }
394
MApi_DMS_SetZOrder_U2(void * pInstance,MS_U32 u32WindowID,ST_DMS_ZORDER_INFO * pstZorderInfo)395 EN_DMS_RESULT MApi_DMS_SetZOrder_U2(void* pInstance, MS_U32 u32WindowID, ST_DMS_ZORDER_INFO *pstZorderInfo)
396 {
397 EN_DMS_RESULT eRet = E_DMS_FAIL;
398 eRet = MDrv_DMS_SetZOrder(pInstance, u32WindowID, pstZorderInfo->u32Zorder);
399 return eRet;
400 }
401
MApi_DMS_SetZOrder(MS_U32 u32WindowID,ST_DMS_ZORDER_INFO * pstZorderInfo)402 EN_DMS_RESULT MApi_DMS_SetZOrder(MS_U32 u32WindowID, ST_DMS_ZORDER_INFO *pstZorderInfo)
403 {
404 if (g_pDMSInst == NULL)
405 {
406 printf("[%s,%5d] No instance existed, please get an instance by calling MApi_DMS_Init() first\n",__FUNCTION__,__LINE__);
407 return E_DMS_FAIL;
408 }
409
410 if(pstZorderInfo == NULL)
411 {
412 printf("[%s,%5d] pstZorderInfo is NULL\n",__FUNCTION__,__LINE__);
413 return E_DMS_FAIL;
414 }
415
416 ST_DMS_ZORDER DMSArgs;
417 DMSArgs.eReturnValue = E_DMS_FAIL;
418 DMSArgs.u32WindowID = u32WindowID;
419 DMSArgs.pstZorderInfo = pstZorderInfo;
420 if(UtopiaIoctl(g_pDMSInst, E_DMS_CMD_SETZORDER, (void*)&DMSArgs) != UTOPIA_STATUS_SUCCESS)
421 {
422 printf("[%s,%5d] Obtain DMS engine fail\n",__FUNCTION__,__LINE__);
423 }
424 return DMSArgs.eReturnValue;
425 }
426
MApi_DMS_Video_Freeze_U2(void * pInstance,MS_U32 u32WindowID,ST_DMS_FREEZE_WINDOW_INFO * pstWindowFreeze)427 EN_DMS_RESULT MApi_DMS_Video_Freeze_U2(void* pInstance, MS_U32 u32WindowID, ST_DMS_FREEZE_WINDOW_INFO *pstWindowFreeze)
428 {
429 EN_DMS_RESULT eRet = E_DMS_FAIL;
430 eRet = MDrv_DMS_Video_Freeze(pInstance, u32WindowID, pstWindowFreeze->u32Enable);
431 return eRet;
432 }
433
MApi_DMS_Video_Freeze(MS_U32 u32WindowID,ST_DMS_FREEZE_WINDOW_INFO * pstWindowFreeze)434 EN_DMS_RESULT MApi_DMS_Video_Freeze(MS_U32 u32WindowID, ST_DMS_FREEZE_WINDOW_INFO *pstWindowFreeze)
435 {
436 if (g_pDMSInst == NULL)
437 {
438 printf("[%s,%5d] No instance existed, please get an instance by calling MApi_DMS_Init() first\n",__FUNCTION__,__LINE__);
439 return E_DMS_FAIL;
440 }
441
442 if(pstWindowFreeze == NULL)
443 {
444 printf("[%s,%5d] pstWindowFreeze is NULL\n",__FUNCTION__,__LINE__);
445 return E_DMS_FAIL;
446 }
447
448 ST_DMS_FREEZE DMSArgs;
449 DMSArgs.eReturnValue = E_DMS_FAIL;
450 DMSArgs.u32WindowID = u32WindowID;
451 DMSArgs.pstWindowFreeze = pstWindowFreeze;
452 if(UtopiaIoctl(g_pDMSInst, E_DMS_CMD_VIDEOFREEZE, (void*)&DMSArgs) != UTOPIA_STATUS_SUCCESS)
453 {
454 printf("[%s,%5d] Obtain DMS engine fail\n",__FUNCTION__,__LINE__);
455 }
456 return DMSArgs.eReturnValue;
457 }
458
MApi_DMS_Video_Mute_U2(void * pInstance,MS_U32 u32WindowID,ST_DMS_MUTE_WINDOW_INFO * pstWindowMute)459 EN_DMS_RESULT MApi_DMS_Video_Mute_U2(void* pInstance, MS_U32 u32WindowID, ST_DMS_MUTE_WINDOW_INFO *pstWindowMute)
460 {
461 EN_DMS_RESULT eRet = E_DMS_FAIL;
462 eRet = MDrv_DMS_Video_Mute(pInstance, u32WindowID, pstWindowMute->u32Enable);
463 return eRet;
464 }
465
MApi_DMS_Video_Mute(MS_U32 u32WindowID,ST_DMS_MUTE_WINDOW_INFO * pstWindowMute)466 EN_DMS_RESULT MApi_DMS_Video_Mute(MS_U32 u32WindowID, ST_DMS_MUTE_WINDOW_INFO *pstWindowMute)
467 {
468 if (g_pDMSInst == NULL)
469 {
470 printf("[%s,%5d] No instance existed, please get an instance by calling MApi_DMS_Init() first\n",__FUNCTION__,__LINE__);
471 return E_DMS_FAIL;
472 }
473
474 if(pstWindowMute == NULL)
475 {
476 printf("[%s,%5d] pstWindowMute is NULL\n",__FUNCTION__,__LINE__);
477 return E_DMS_FAIL;
478 }
479
480 ST_DMS_MUTE DMSArgs;
481 DMSArgs.eReturnValue = E_DMS_FAIL;
482 DMSArgs.u32WindowID = u32WindowID;
483 DMSArgs.pstWindowMute = pstWindowMute;
484 if(UtopiaIoctl(g_pDMSInst, E_DMS_CMD_VIDEOMUTE, (void*)&DMSArgs) != UTOPIA_STATUS_SUCCESS)
485 {
486 printf("[%s,%5d] Obtain DMS engine fail\n",__FUNCTION__,__LINE__);
487 }
488 return DMSArgs.eReturnValue;
489 }
490
MApi_DMS_Set_MuteColor_U2(void * pInstance,MS_U32 u32WindowID,ST_DMS_MUTE_COLOR_INFO * pstMuteColor)491 EN_DMS_RESULT MApi_DMS_Set_MuteColor_U2(void* pInstance, MS_U32 u32WindowID, ST_DMS_MUTE_COLOR_INFO *pstMuteColor)
492 {
493 printf("[%s,%5d] Not Impl\n",__FUNCTION__,__LINE__);
494 return E_DMS_OK;
495 }
496
MApi_DMS_Set_MuteColor(MS_U32 u32WindowID,ST_DMS_MUTE_COLOR_INFO * pstMuteColor)497 EN_DMS_RESULT MApi_DMS_Set_MuteColor(MS_U32 u32WindowID, ST_DMS_MUTE_COLOR_INFO *pstMuteColor)
498 {
499 if (g_pDMSInst == NULL)
500 {
501 printf("[%s,%5d] No instance existed, please get an instance by calling MApi_DMS_Init() first\n",__FUNCTION__,__LINE__);
502 return E_DMS_FAIL;
503 }
504
505 if(pstMuteColor == NULL)
506 {
507 printf("[%s,%5d] pstMuteColor is NULL\n",__FUNCTION__,__LINE__);
508 return E_DMS_FAIL;
509 }
510
511 ST_DMS_MUTECOLOR DMSArgs;
512 DMSArgs.eReturnValue = E_DMS_FAIL;
513 DMSArgs.u32WindowID = u32WindowID;
514 DMSArgs.pstMuteColor = pstMuteColor;
515 if(UtopiaIoctl(g_pDMSInst, E_DMS_CMD_SETMUTECOLOR, (void*)&DMSArgs) != UTOPIA_STATUS_SUCCESS)
516 {
517 printf("[%s,%5d] Obtain DMS engine fail\n",__FUNCTION__,__LINE__);
518 }
519 return DMSArgs.eReturnValue;
520 }
521
MApi_DMS_GetStatus_U2(void * pInstance,EN_DMS_STATUS * peStatus)522 EN_DMS_RESULT MApi_DMS_GetStatus_U2(void* pInstance, EN_DMS_STATUS *peStatus)
523 {
524 printf("[%s,%5d] Not Impl\n",__FUNCTION__,__LINE__);
525 return 0;
526 }
527
MApi_DMS_GetStatus(EN_DMS_STATUS * peStatus)528 EN_DMS_RESULT MApi_DMS_GetStatus(EN_DMS_STATUS *peStatus)
529 {
530 if (g_pDMSInst == NULL)
531 {
532 printf("[%s,%5d] No instance existed, please get an instance by calling MApi_DMS_Init() first\n",__FUNCTION__,__LINE__);
533 return E_DMS_FAIL;
534 }
535
536 ST_DMS_GETSTATUS DMSArgs;
537 DMSArgs.eReturnValue = E_DMS_FAIL;
538 DMSArgs.peStatus = peStatus;
539 if(UtopiaIoctl(g_pDMSInst, E_DMS_CMD_GETSTATUS, (void*)&DMSArgs) != UTOPIA_STATUS_SUCCESS)
540 {
541 printf("[%s,%5d] Obtain DMS engine fail\n",__FUNCTION__,__LINE__);
542 }
543 return DMSArgs.eReturnValue;
544 }
545
MApi_DMS_GetCapability_U2(void * pInstance,EN_DMS_CAPABILITY * peCapability)546 EN_DMS_RESULT MApi_DMS_GetCapability_U2(void* pInstance, EN_DMS_CAPABILITY *peCapability)
547 {
548 EN_DMS_RESULT eRet = E_DMS_FAIL;
549 eRet = MDrv_DMS_GetCapability(pInstance, peCapability);
550 return eRet;
551 }
552
MApi_DMS_GetCapability(EN_DMS_CAPABILITY * peCapability)553 EN_DMS_RESULT MApi_DMS_GetCapability(EN_DMS_CAPABILITY *peCapability)
554 {
555 if (g_pDMSInst == NULL)
556 {
557 if(UtopiaOpen(MODULE_DMS, &g_pDMSInst, 0, NULL) != UTOPIA_STATUS_SUCCESS)
558 {
559 printf("[%s]UtopiaOpen DMS failed\n", __FUNCTION__);
560 return E_DMS_FAIL;
561 }
562 }
563
564 ST_DMS_GETCAPS DMSArgs;
565 DMSArgs.eReturnValue = E_DMS_FAIL;
566 DMSArgs.peCapability = peCapability;
567 if(UtopiaIoctl(g_pDMSInst, E_DMS_CMD_GETCAPS, (void*)&DMSArgs) != UTOPIA_STATUS_SUCCESS)
568 {
569 printf("[%s,%5d] Obtain DMS engine fail\n",__FUNCTION__,__LINE__);
570 }
571 return DMSArgs.eReturnValue;
572 }
573
MApi_DMS_GetExistedWindows_U2(void * pInstance,MS_U32 * pu32WindowNums)574 EN_DMS_RESULT MApi_DMS_GetExistedWindows_U2(void* pInstance, MS_U32 *pu32WindowNums)
575 {
576 printf("[%s,%5d] Not Impl\n",__FUNCTION__,__LINE__);
577 return 0;
578 }
579
MApi_DMS_GetExistedWindows(MS_U32 * pu32WindowNums)580 EN_DMS_RESULT MApi_DMS_GetExistedWindows(MS_U32 *pu32WindowNums)
581 {
582 if (g_pDMSInst == NULL)
583 {
584 printf("[%s,%5d] No instance existed, please get an instance by calling MApi_DMS_Init() first\n",__FUNCTION__,__LINE__);
585 return E_DMS_FAIL;
586 }
587
588 if(pu32WindowNums == NULL)
589 {
590 printf("[%s,%5d] pu32WindowNums is NULL\n",__FUNCTION__,__LINE__);
591 return E_DMS_FAIL;
592 }
593
594 ST_DMS_GETEXISTWIN DMSArgs;
595 DMSArgs.eReturnValue = E_DMS_FAIL;
596 DMSArgs.pu32WindowNums = pu32WindowNums;
597 if(UtopiaIoctl(g_pDMSInst, E_DMS_CMD_GETEXISTEDWINDOW, (void*)&DMSArgs) != UTOPIA_STATUS_SUCCESS)
598 {
599 printf("[%s,%5d] Obtain DMS engine fail\n",__FUNCTION__,__LINE__);
600 }
601 return DMSArgs.eReturnValue;
602 }
603
MApi_DMS_SetOutputLayer_U2(void * pInstance,ST_DMS_WINDOW * pstLayer)604 EN_DMS_RESULT MApi_DMS_SetOutputLayer_U2(void* pInstance, ST_DMS_WINDOW *pstLayer)
605 {
606 EN_DMS_RESULT eRet = E_DMS_FAIL;
607 eRet = MDrv_DMS_SetOutputLayer(pInstance, pstLayer);
608 return eRet;
609 }
610
MApi_DMS_SetOutputLayer(ST_DMS_WINDOW * pstLayer)611 EN_DMS_RESULT MApi_DMS_SetOutputLayer(ST_DMS_WINDOW *pstLayer)
612 {
613 if (g_pDMSInst == NULL)
614 {
615 printf("[%s,%5d] No instance existed, please get an instance by calling MApi_DMS_Init() first\n",__FUNCTION__,__LINE__);
616 return E_DMS_FAIL;
617 }
618
619 if(pstLayer == NULL)
620 {
621 printf("[%s,%5d] pstLayer is NULL\n",__FUNCTION__,__LINE__);
622 return E_DMS_FAIL;
623 }
624
625 ST_DMS_SETOUTPUTLAYER DMSArgs;
626 DMSArgs.eReturnValue = E_DMS_FAIL;
627 DMSArgs.pstLayer = pstLayer;
628 if(UtopiaIoctl(g_pDMSInst, E_DMS_CMD_SETOUTPUTLAYER, (void*)&DMSArgs) != UTOPIA_STATUS_SUCCESS)
629 {
630 printf("[%s,%5d] Obtain DMS engine fail\n",__FUNCTION__,__LINE__);
631 }
632 return DMSArgs.eReturnValue;
633 }
634
MApi_DMS_Set_3D_Mode_U2(void * pInstance,MS_U32 u32WindowID,ST_DMS_3D_INFO * pst3DInfo)635 EN_DMS_RESULT MApi_DMS_Set_3D_Mode_U2(void* pInstance, MS_U32 u32WindowID, ST_DMS_3D_INFO *pst3DInfo)
636 {
637 EN_DMS_RESULT eRet = E_DMS_FAIL;
638 eRet = MDrv_DMS_Set_3D_Mode(pInstance, u32WindowID, pst3DInfo);
639 return eRet;
640 }
641
MApi_DMS_Set_3D_Mode(MS_U32 u32WindowID,ST_DMS_3D_INFO * pst3DInfo)642 EN_DMS_RESULT MApi_DMS_Set_3D_Mode(MS_U32 u32WindowID, ST_DMS_3D_INFO *pst3DInfo)
643 {
644 if (g_pDMSInst == NULL)
645 {
646 printf("[%s,%5d] No instance existed, please get an instance by calling MApi_DMS_Init() first\n",__FUNCTION__,__LINE__);
647 return E_DMS_FAIL;
648 }
649
650 if(pst3DInfo == NULL)
651 {
652 printf("[%s,%5d] pstMuteColor is NULL\n",__FUNCTION__,__LINE__);
653 return E_DMS_FAIL;
654 }
655
656 ST_DMS_SET3DMODE DMSArgs;
657 DMSArgs.eReturnValue = E_DMS_FAIL;
658 DMSArgs.u32WindowID = u32WindowID;
659 DMSArgs.pst3DInfo = pst3DInfo;
660 if(UtopiaIoctl(g_pDMSInst, E_DMS_CMD_SET3DMODE, (void*)&DMSArgs) != UTOPIA_STATUS_SUCCESS)
661 {
662 printf("[%s,%5d] Obtain DMS engine fail\n",__FUNCTION__,__LINE__);
663 }
664 return DMSArgs.eReturnValue;
665 }
666
MApi_DMS_Set_CaptureInfo_U2(void * pInstance,MS_U32 u32WindowID,ST_DMS_SET_CAPTURE_INFO * pstSetCaptureInfo)667 EN_DMS_RESULT MApi_DMS_Set_CaptureInfo_U2(void* pInstance, MS_U32 u32WindowID, ST_DMS_SET_CAPTURE_INFO *pstSetCaptureInfo)
668 {
669 EN_DMS_RESULT eRet = E_DMS_FAIL;
670 eRet = MDrv_DMS_Set_CaptureInfo(pInstance, u32WindowID, pstSetCaptureInfo);
671 return eRet;
672 }
673
MApi_DMS_Set_CaptureInfo(MS_U32 u32WindowID,ST_DMS_SET_CAPTURE_INFO * pstSetCaptureInfo)674 EN_DMS_RESULT MApi_DMS_Set_CaptureInfo(MS_U32 u32WindowID, ST_DMS_SET_CAPTURE_INFO *pstSetCaptureInfo)
675 {
676 if (g_pDMSInst == NULL)
677 {
678 printf("[%s,%5d] No instance existed, please get an instance by calling MApi_DMS_Init() first\n",__FUNCTION__,__LINE__);
679 return E_DMS_FAIL;
680 }
681
682 if(pstSetCaptureInfo == NULL)
683 {
684 printf("[%s,%5d] pstSetCaptureInfo is NULL\n",__FUNCTION__,__LINE__);
685 return E_DMS_FAIL;
686 }
687
688 ST_DMS_SETCAPTUREINFO DMSArgs;
689 DMSArgs.eReturnValue = E_DMS_FAIL;
690 DMSArgs.u32WindowID = u32WindowID;
691 DMSArgs.pstSetCaptureInfo = pstSetCaptureInfo;
692 if(UtopiaIoctl(g_pDMSInst, E_DMS_CMD_SETCAPTUREINFO, (void*)&DMSArgs) != UTOPIA_STATUS_SUCCESS)
693 {
694 printf("[%s,%5d] Obtain DMS engine fail\n",__FUNCTION__,__LINE__);
695 }
696 return DMSArgs.eReturnValue;
697 }
698
MApi_DMS_Get_CaptureBuffer_U2(void * pInstance,MS_U32 u32WindowID,ST_DMS_CAPTURE_INFO * pstCaptureInfo)699 EN_DMS_RESULT MApi_DMS_Get_CaptureBuffer_U2(void* pInstance, MS_U32 u32WindowID, ST_DMS_CAPTURE_INFO *pstCaptureInfo)
700 {
701 EN_DMS_RESULT eRet = E_DMS_FAIL;
702 eRet = MDrv_DMS_Get_CaptureBuffer(pInstance, u32WindowID, pstCaptureInfo);
703 return eRet;
704 }
705
MApi_DMS_Get_CaptureBuffer(MS_U32 u32WindowID,ST_DMS_CAPTURE_INFO * pstCaptureInfo)706 EN_DMS_RESULT MApi_DMS_Get_CaptureBuffer(MS_U32 u32WindowID, ST_DMS_CAPTURE_INFO *pstCaptureInfo)
707 {
708 if (g_pDMSInst == NULL)
709 {
710 printf("[%s,%5d] No instance existed, please get an instance by calling MApi_DMS_Init() first\n",__FUNCTION__,__LINE__);
711 return E_DMS_FAIL;
712 }
713
714 if(pstCaptureInfo == NULL)
715 {
716 printf("[%s,%5d] pstCaptureInfo is NULL\n",__FUNCTION__,__LINE__);
717 return E_DMS_FAIL;
718 }
719
720 ST_DMS_GETCAPTUREBUF DMSArgs;
721 DMSArgs.eReturnValue = E_DMS_FAIL;
722 DMSArgs.u32WindowID = u32WindowID;
723 DMSArgs.pstCaptureInfo = pstCaptureInfo;
724 if(UtopiaIoctl(g_pDMSInst, E_DMS_CMD_GETCAPTUREBUFFER, (void*)&DMSArgs) != UTOPIA_STATUS_SUCCESS)
725 {
726 printf("[%s,%5d] Obtain DMS engine fail\n",__FUNCTION__,__LINE__);
727 }
728 return DMSArgs.eReturnValue;
729 }
730
MApi_DMS_Release_CaptureBuffer_U2(void * pInstance,MS_U32 u32WindowID,ST_DMS_CAPTURE_INFO * pstCaptureInfo)731 EN_DMS_RESULT MApi_DMS_Release_CaptureBuffer_U2(void* pInstance, MS_U32 u32WindowID, ST_DMS_CAPTURE_INFO *pstCaptureInfo)
732 {
733 EN_DMS_RESULT eRet = E_DMS_FAIL;
734 eRet = MDrv_DMS_Release_CaptureBuffer(pInstance, u32WindowID, pstCaptureInfo);
735 return eRet;
736 }
737
MApi_DMS_Release_CaptureBuffer(MS_U32 u32WindowID,ST_DMS_CAPTURE_INFO * pstCaptureInfo)738 EN_DMS_RESULT MApi_DMS_Release_CaptureBuffer(MS_U32 u32WindowID, ST_DMS_CAPTURE_INFO *pstCaptureInfo)
739 {
740 if (g_pDMSInst == NULL)
741 {
742 printf("[%s,%5d] No instance existed, please get an instance by calling MApi_DMS_Init() first\n",__FUNCTION__,__LINE__);
743 return E_DMS_FAIL;
744 }
745
746 if(pstCaptureInfo == NULL)
747 {
748 printf("[%s,%5d] pstCaptureInfo is NULL\n",__FUNCTION__,__LINE__);
749 return E_DMS_FAIL;
750 }
751
752 ST_DMS_RELEASECAPTUREBUF DMSArgs;
753 DMSArgs.eReturnValue = E_DMS_FAIL;
754 DMSArgs.u32WindowID = u32WindowID;
755 DMSArgs.pstCaptureInfo = pstCaptureInfo;
756 if(UtopiaIoctl(g_pDMSInst, E_DMS_CMD_RELEASECAPTUREBUFFER, (void*)&DMSArgs) != UTOPIA_STATUS_SUCCESS)
757 {
758 printf("[%s,%5d] Obtain DMS engine fail\n",__FUNCTION__,__LINE__);
759 }
760 return DMSArgs.eReturnValue;
761 }
762
763