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-2010 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 mdrvDSCMB.c
98 /// @brief API Interface
99 /// @author MStar Semiconductor,Inc.
100 /// @attention
101 ///////////////////////////////////////////////////////////////////////////////////////////////////
102
103
104 //-------------------------------------------------------------------------------------------------
105 // Include Files
106 //-------------------------------------------------------------------------------------------------
107 #ifdef MSOS_TYPE_LINUX_KERNEL
108 #include <linux/string.h>
109 #include <linux/uaccess.h>
110 #include <linux/compat.h>
111 #else
112 #include <stdio.h>
113 #include <string.h>
114 #endif
115
116 #include "MsTypes.h"
117
118 #include "drvDSCMB_v2.h"
119 #include "drvDSCMB_private.h"
120
121 #include "utopia.h"
122 #include "utopia_dapi.h"
123 #include "MsOS.h"
124
125 //-------------------------------------------------------------------------------------------------
126 // Driver Compiler Options
127 //-------------------------------------------------------------------------------------------------
128
129 //-------------------------------------------------------------------------------------------------
130 // Global Variables
131 //-------------------------------------------------------------------------------------------------
132 void* pModuleDscmb = NULL;
133
134 //-------------------------------------------------------------------------------------------------
135 // Local Defines
136 //-------------------------------------------------------------------------------------------------
137 #define DSCMB_MSG(_f, _a...) //printf(_f, ##_a)
138
139 //-------------------------------------------------------------------------------------------------
140 // Local Structures
141 //-------------------------------------------------------------------------------------------------
142
143 //-------------------------------------------------------------------------------------------------
144 // Local Variables
145 //-------------------------------------------------------------------------------------------------
146 MS_BOOL* _bFreeSlot;
147 stDscmbTspMap (*DscmbTspMap)[HAL_DSCMB_KTE_MAX];
148 stTspFltInfo* _u32PidFlt2Dscmb;
149 MS_BOOL* _bFreeRIVSlot;
150
151 //-------------------------------------------------------------------------------------------------
152 // Local Functions
153 //-------------------------------------------------------------------------------------------------
154
155
156 //-------------------------------------------------------------------------------------------------
157 // Global Functions
158 //-------------------------------------------------------------------------------------------------
DSCMBRegisterToUtopia(void)159 void DSCMBRegisterToUtopia(void)
160 {
161 DSCMB_RESOURCE_PRIVATE * pResPri = NULL;
162 void* psResource = NULL;
163
164 // 1. deal with module
165
166 // create a DSCMB module
167 // a. size = 8
168 // b. Dst: pModuleDscmb
169 UtopiaModuleCreate(MODULE_DSCMB, 8, &pModuleDscmb);
170 // register a dscmb module
171 UtopiaModuleRegister(pModuleDscmb);
172 //setup module functions
173 UtopiaModuleSetupFunctionPtr(pModuleDscmb, (FUtopiaOpen)DSCMBOpen, (FUtopiaClose)DSCMBClose, (FUtopiaIOctl)DSCMBIoctl);
174
175 // 2. deal with resource
176 // create and allocate resource private data(drv Global shared data)
177 UtopiaResourceCreate("DSCMB", sizeof(DSCMB_RESOURCE_PRIVATE), &psResource);
178 UtopiaResourceRegister(pModuleDscmb, psResource, E_DSCMB_RESOURCE);
179 UtopiaModuleAddResourceEnd(pModuleDscmb, E_DSCMB_RESOURCE);
180
181 if(UtopiaResourceObtain(pModuleDscmb, E_DSCMB_RESOURCE, &psResource) != UTOPIA_STATUS_SUCCESS)
182 {
183 DSCMB_MSG("UtopiaResourceObtain fail\n");
184 return ;
185 }
186 UtopiaResourceGetPrivate(psResource, (void**)&pResPri);
187
188 if(pResPri->u32Magic != MAGIC_NUM)
189 {
190 // not regiser yet
191 pResPri->u32Magic = MAGIC_NUM;
192 pResPri->bInited_Drv = FALSE;
193 pResPri->u32Cavid = DEFAULT_CAVID;
194 }
195
196 UtopiaResourceRelease(psResource);
197 }
198
DSCMBOpen(void ** ppInstance,MS_U32 u32ModuleVersion,void * pAttribute)199 MS_U32 DSCMBOpen(void** ppInstance, MS_U32 u32ModuleVersion, void* pAttribute)
200 {
201 DSCMB_MSG("DSCMB open \n");
202
203 if(ppInstance == 0)
204 {
205 return UTOPIA_STATUS_PARAMETER_ERROR;
206 }
207
208 DSCMB_INSTANT_PRIVATE* psDscmbInstPri = NULL;
209
210 //create instance
211 //1. Allocate instant private data, prepare argument variable.
212 //2. Dst: ppInstance
213 UtopiaInstanceCreate(sizeof(DSCMB_INSTANT_PRIVATE), ppInstance);
214
215 //get instant private data pointer
216 // 1. Dst: psDscmbInstPri
217 UtopiaInstanceGetPrivate(*ppInstance, (void**)&psDscmbInstPri);
218
219 //reset argument variables.
220 // memset(&psDscmbInstPri->pInitVector, 0x0, DSCMB_IV_LENGTH);
221 // memset(&psDscmbInstPri->pCipherKey, 0x0, DSCMB_KEY_LENGTH);
222 // memset(&psDscmbInstPri, 0, sizeof(DSCMB_INSTANT_PRIVATE));
223
224 return UTOPIA_STATUS_SUCCESS;
225 }
226
DSCMBIoctl(void * pInstance,MS_U32 u32Cmd,void * pu32Args)227 MS_U32 DSCMBIoctl(void* pInstance, MS_U32 u32Cmd, void* pu32Args)
228 {
229 void* pstRes = NULL;
230 MS_U32 u32Ret = UTOPIA_STATUS_FAIL;
231 DSCMB_RESOURCE_PRIVATE* pstResPri = NULL;
232 DSCMB_INSTANT_PRIVATE* pstInstPri = NULL;
233
234 if(UtopiaResourceObtain(pModuleDscmb, E_DSCMB_RESOURCE, &pstRes) != UTOPIA_STATUS_SUCCESS)
235 {
236 DSCMB_MSG("UtopiaResourceObtain fail\n");
237 return UTOPIA_STATUS_ERR_RESOURCE;
238 }
239 UtopiaResourceGetPrivate(pstRes, (void**)&pstResPri);
240
241 if((FALSE == pstResPri->bInited_Drv) &&
242 (u32Cmd != E_MDRV_CMD_DSCMB_Init) &&
243 (u32Cmd != E_MDRV_CMD_DSCMB_QueryCap) &&
244 (u32Cmd != E_MDRV_CMD_DSCMB_SetDBGLevel) &&
245 (u32Cmd != E_MDRV_CMD_DSCMB_GetLibVer) &&
246 (u32Cmd != E_MDRV_CMD_DSCMB_Exit))
247 {
248 UtopiaResourceRelease(pstRes);
249 return UTOPIA_STATUS_FAIL;
250 }
251
252 //set pointer from resource private to local file pointer variable
253 //the local file pointer variable will extern to drvDSCMB.c
254 _bFreeSlot = pstResPri->bFreeSlot;
255 _bFreeRIVSlot = pstResPri->bFreeRIVSlot;
256 _u32PidFlt2Dscmb = pstResPri->u32PidFlt2Dscmb;
257 DscmbTspMap = pstResPri->DscmbTspMap;
258
259 switch(u32Cmd)
260 {
261 // General API
262 case E_MDRV_CMD_DSCMB_Init:
263 {
264 if(pstResPri->bInited_Drv == FALSE)
265 {
266 if(TRUE == _MDrv_DSCMB2_Init())
267 {
268 pstResPri->bInited_Drv = TRUE;
269 }
270 else
271 {
272 DSCMB_MSG("E_MDRV_CMD_DSCMB_Init fail\n");
273 }
274 }
275 else
276 {
277 // SW init only
278 if(FALSE == _MDrv_DSCMB2_InitBySWFlag(TRUE))
279 {
280 DSCMB_MSG("E_MDRV_CMD_DSCMB_Init fail\n");
281 }
282
283 }
284 DSCMB_MSG("E_MDRV_CMD_DSCMB_Init\n");
285
286 u32Ret = UTOPIA_STATUS_SUCCESS;
287 }
288 break;
289
290 case E_MDRV_CMD_DSCMB_Exit:
291 {
292 if(pstResPri->bInited_Drv == TRUE)
293 {
294 if(TRUE == _MDrv_DSCMB2_Exit())
295 {
296 pstResPri->bInited_Drv = FALSE;
297 u32Ret = UTOPIA_STATUS_SUCCESS;
298 }
299 else
300 {
301 u32Ret = UTOPIA_STATUS_FAIL;
302 }
303 }
304 else
305 {
306 u32Ret = UTOPIA_STATUS_SUCCESS;
307 }
308
309 DSCMB_MSG("E_MDRV_CMD_DSCMB_Exit\n");
310 }
311 break;
312
313 case E_MDRV_CMD_DSCMB_SetPowerState:
314 {
315 EN_POWER_MODE * pPowereMode = (EN_POWER_MODE *)pu32Args;
316 if(TRUE == _MDrv_DSCMB2_SetPowerState(*pPowereMode))
317 {
318 u32Ret = UTOPIA_STATUS_SUCCESS;
319 }
320 DSCMB_MSG("E_MDRV_CMD_DSCMB_SetPowerState,\n");
321 }
322 break;
323
324 case E_MDRV_CMD_DSCMB_FltAlloc:
325 {
326 DSCMB_FLTALLOC* pFltAlloc = (DSCMB_FLTALLOC *)pu32Args;
327
328 pFltAlloc->u32DscmbId = _MDrv_DSCMB2_FltAlloc_Ex(pFltAlloc->u32EngId,
329 pFltAlloc->eFltType);
330 if(pFltAlloc->u32DscmbId != DRV_DSCMB_FLT_NULL)
331 {
332 u32Ret = UTOPIA_STATUS_SUCCESS;
333 }
334
335 DSCMB_MSG("E_MDRV_CMD_DSCMB_FltAlloc\n");
336 }
337 break;
338
339 case E_MDRV_CMD_DSCMB_FltFree:
340 {
341 DSCMB_FLTFREE * pFltFree = (DSCMB_FLTFREE *)pu32Args;
342 if(TRUE == _MDrv_DSCMB2_FltFree(pFltFree->u32EngId, pFltFree->u32DscmbId))
343 {
344 u32Ret = UTOPIA_STATUS_SUCCESS;
345 }
346
347 DSCMB_MSG("E_MDRV_CMD_DSCMB_FltFree\n");
348 }
349 break;
350
351 case E_MDRV_CMD_DSCMB_FltConnectFltId:
352 {
353 DSCMB_CONNECTFLT * pConnectFlt = (DSCMB_CONNECTFLT *)pu32Args;
354 if(TRUE == _MDrv_DSCMB2_FltConnectFltId(pConnectFlt->u32EngId,
355 pConnectFlt->u32DscmbId,
356 pConnectFlt->u32DmxFltId))
357 {
358 u32Ret = UTOPIA_STATUS_SUCCESS;
359 }
360
361 DSCMB_MSG("E_MDRV_CMD_DSCMB_FltConnectFltId\n");
362
363 }
364 break;
365
366 case E_MDRV_CMD_DSCMB_FltDisconnectFltId:
367 {
368 DSCMB_DISCONNECTFLT * pDisconnectFlt = (DSCMB_DISCONNECTFLT *)pu32Args;
369 if(TRUE == _MDrv_DSCMB2_FltDisconnectFltId(pDisconnectFlt->u32EngId,
370 pDisconnectFlt->u32DscmbId,
371 pDisconnectFlt->u32DmxFltId))
372 {
373 u32Ret = UTOPIA_STATUS_SUCCESS;
374 }
375
376 DSCMB_MSG("E_MDRV_CMD_DSCMB_FltDisconnectFltId\n");
377 }
378 break;
379
380 #if !(defined(MSOS_TYPE_OPTEE) || defined(MSOS_TYPE_NUTTX))
381 case E_MDRV_CMD_DSCMB_FltConnectPid:
382 {
383 DSCMB_CONNECTPID * pstConnectPid = (DSCMB_CONNECTPID *)pu32Args;
384 if(TRUE == _MDrv_DSCMB2_FltConnectPid(
385 pstConnectPid->u32EngId,
386 pstConnectPid->u32DscmbId,
387 pstConnectPid->u32Pid))
388 {
389 u32Ret = UTOPIA_STATUS_SUCCESS;
390 }
391
392 DSCMB_MSG("E_MDRV_CMD_DSCMB_FltConnectPid\n");
393 }
394 break;
395
396 case E_MDRV_CMD_DSCMB_FltDisconnectPid:
397 {
398 DSCMB_DISCONNECTPID * pstDisconnectPid = (DSCMB_DISCONNECTPID *)pu32Args;
399 if(TRUE == _MDrv_DSCMB2_FltDisconnectPid_Ex(pstDisconnectPid->u32EngId,
400 pstDisconnectPid->u32DscmbId,
401 pstDisconnectPid->u32Pid))
402 {
403 u32Ret = UTOPIA_STATUS_SUCCESS;
404 }
405
406 DSCMB_MSG("E_MDRV_CMD_DSCMB_FltDisconnectPid\n");
407 }
408 break;
409 #endif
410 case E_MDRV_CMD_DSCMB_FltDscmb:
411 {
412 DSCMB_FLTDSCMB * pstFltDscmb = (DSCMB_FLTDSCMB *)pu32Args;
413
414 if(TRUE == _MDrv_DSCMB2_FltDscmb(pstFltDscmb->u32EngId,
415 pstFltDscmb->u32DscmbId,
416 pstFltDscmb->bDscmb))
417 {
418 u32Ret = UTOPIA_STATUS_SUCCESS;
419 }
420
421 DSCMB_MSG("E_MDRV_CMD_DSCMB_FltDscmb\n");
422 }
423 break;
424
425 case E_MDRV_CMD_DSCMB_FltTypeSet:
426 {
427 DSCMB_TYPESET *pstTypeSet = (DSCMB_TYPESET *)pu32Args;
428 if(TRUE == _MDrv_DSCMB2_FltTypeSet(pstTypeSet->u32EngId,
429 pstTypeSet->u32DscmbId,
430 pstTypeSet->eType))
431 {
432 u32Ret = UTOPIA_STATUS_SUCCESS;
433 }
434
435 DSCMB_MSG("E_MDRV_CMD_DSCMB_FltTypeSet\n");
436 }
437 break;
438
439 case E_MDRV_CMD_DSCMB_FltKeySet:
440 {
441 DSCMB_FLTKEYSET * pstFltKeySet = (DSCMB_FLTKEYSET *)pu32Args;
442
443 if(TRUE == _MDrv_DSCMB2_FltKeySet(pstFltKeySet->u32EngId,
444 pstFltKeySet->u32DscmbId,
445 pstFltKeySet->eKeyType,
446 pstFltKeySet->pu8Key))
447 {
448 u32Ret = UTOPIA_STATUS_SUCCESS;
449 }
450
451 DSCMB_MSG("E_MDRV_CMD_DSCMB_FltKeySet\n");
452 }
453 break;
454
455 case E_MDRV_CMD_DSCMB_FltKeyReset:
456 {
457 DSCMB_FLTKEYRESET * pstFltKeyReset = (DSCMB_FLTKEYRESET *)pu32Args;
458 if(TRUE == _MDrv_DSCMB2_FltKeyReset(pstFltKeyReset->u32EngId,
459 pstFltKeyReset->u32DscmbId,
460 pstFltKeyReset->eKeyType))
461 {
462 u32Ret = UTOPIA_STATUS_SUCCESS;
463 }
464
465 DSCMB_MSG("E_MDRV_CMD_DSCMB_FltKeyReset\n");
466 }
467 break;
468
469 case E_MDRV_CMD_DSCMB_FltIVSet:
470 {
471 UtopiaInstanceGetPrivate(pInstance, (void**)&pstInstPri);
472 DSCMB_FLTIVSET * pstFltIVSet = (DSCMB_FLTIVSET *)pu32Args;
473
474 if(TRUE == _MDrv_DSCMB2_FltIVSet(pstFltIVSet->u32EngId,
475 pstFltIVSet->u32DscmbId,
476 pstFltIVSet->eKeyType,
477 pstFltIVSet->pu8IV))
478 {
479 u32Ret = UTOPIA_STATUS_SUCCESS;
480 }
481 DSCMB_MSG("E_MDRV_CMD_DSCMB_FltIVSet\n");
482 }
483 break;
484
485 case E_MDRV_CMD_DSCMB_HDCP2_SetRiv:
486 {
487 DSCMB_HDCP2_SETRIV * pstSetRiv = (DSCMB_HDCP2_SETRIV *)pu32Args;
488 if(TRUE == _MDrv_DSCMB2_HDCP2_SetRIV(pstSetRiv->u32EngId,
489 pstSetRiv->pu8Riv))
490 {
491 u32Ret = UTOPIA_STATUS_SUCCESS;
492 }
493 DSCMB_MSG("E_MDRV_CMD_DSCMB_HDCP2_SetRiv\n");
494 }
495 break;
496
497 case E_MDRV_CMD_DSCMB_HDCP2_SetRiv_Ex:
498 {
499 DSCMB_HDCP2_SETRIV_EX * pstSetRiv = (DSCMB_HDCP2_SETRIV_EX *)pu32Args;
500 if(TRUE == _MDrv_DSCMB2_HDCP2_SetRIV_Ex(pstSetRiv->u32EngId,
501 pstSetRiv->u32DscmbId,
502 pstSetRiv->pu8Riv))
503 {
504 u32Ret = UTOPIA_STATUS_SUCCESS;
505 }
506 DSCMB_MSG("E_MDRV_CMD_DSCMB_HDCP2_SetRiv_Ex\n");
507 }
508 break;
509
510 case E_MDRV_CMD_DSCMB_Multi2_SetRound:
511 {
512 DSCMB_MULTI2_SETROUND * pstSetRnd = (DSCMB_MULTI2_SETROUND *)pu32Args;
513 if(TRUE == _MDrv_DSCMB2_Multi2_SetRound(pstSetRnd->u32EngId,
514 pstSetRnd->u32Round))
515 {
516 u32Ret = UTOPIA_STATUS_SUCCESS;
517 }
518 }
519 break;
520
521 case E_MDRV_CMD_DSCMB_Multi2_SetSysKey:
522 {
523 DSCMB_MULTI2_SETSYSKEY * psSetSysKey = (DSCMB_MULTI2_SETSYSKEY *)pu32Args;
524 if(TRUE == _MDrv_DSCMB2_Multi2_SetSystemKey(psSetSysKey->u32EngId,
525 (MS_U8*)psSetSysKey->pu8SysKey))
526 {
527 u32Ret = UTOPIA_STATUS_SUCCESS;
528 }
529 }
530 break;
531
532 case E_MDRV_CMD_DSCMB_ES_SetStaticKey:
533 {
534 DSCMB_ES_SETSTATICKEY * psSetStaticKey = (DSCMB_ES_SETSTATICKEY *)pu32Args;
535 if(TRUE == _MDrv_DSCMB2_ES_SetStaticKey(psSetStaticKey->u32EngId,
536 (MS_U8*)psSetStaticKey->pu8StaticKey))
537 {
538 u32Ret = UTOPIA_STATUS_SUCCESS;
539 }
540 }
541 break;
542
543 case E_MDRV_CMD_DSCMB_PidFlt_ScmbStatus:
544 {
545 DSCMB_DSCMBSTATUS * pDscmbStatus = (DSCMB_DSCMBSTATUS *)pu32Args;
546 if(TRUE == _MDrv_DSCMB2_PidFlt_ScmbStatus(pDscmbStatus->u32EngId,
547 pDscmbStatus->u32DmxFltId,
548 pDscmbStatus->pScmbLevel))
549 {
550 u32Ret = UTOPIA_STATUS_SUCCESS;
551 }
552
553 DSCMB_MSG("E_MDRV_CMD_DSCMB_PidFlt_ScmbStatus\n");
554
555 }
556 break;
557
558 case E_MDRV_CMD_DSCMB_PVR_RecCtrl:
559 {
560 DSCMB_PVR_RECCTRL * pPvrRecCtrl = (DSCMB_PVR_RECCTRL *)pu32Args;
561 if(TRUE == _MDrv_DSCMB2_PVR_RecCtrl(pPvrRecCtrl->u32EngId,
562 pPvrRecCtrl->bEnable))
563 {
564 u32Ret = UTOPIA_STATUS_SUCCESS;
565 }
566
567 DSCMB_MSG("E_MDRV_CMD_DSCMB_PVR_RecCtrl\n");
568
569 }
570 break;
571
572 case E_MDRV_CMD_DSCMB_SetDefaultCAVid:
573 {
574 DSCMB_DEFAULT_CAVID * pu32DefaultVid = (DSCMB_DEFAULT_CAVID *)pu32Args;
575 if(TRUE == _MDrv_DSCMB2_SetDefaultCAVid(pu32DefaultVid->u32EngId, pu32DefaultVid->u32CAVid))
576 {
577 u32Ret = UTOPIA_STATUS_SUCCESS;
578 }
579 DSCMB_MSG("E_MDRV_CMD_DSCMB_SetDefaultCAVid\n");
580 }
581 break;
582
583 case E_MDRV_CMD_DSCMB_EngSetAlgo:
584 {
585 DSCMB_ENGALGO * pAlgo = (DSCMB_ENGALGO *)pu32Args;
586 if(TRUE == _MDrv_DSCMB2_EngSetAlgo(pAlgo->u32EngId, pAlgo->u32DscmbId, pAlgo->eEngType, pAlgo->stConfig))
587 {
588 u32Ret = UTOPIA_STATUS_SUCCESS;
589 }
590
591 DSCMB_MSG("E_MDRV_CMD_DSCMB_EngSetAlgo\n");
592 }
593 break;
594
595 case E_MDRV_CMD_DSCMB_EngSetKey:
596 {
597 DSCMB_ENGKEY * pKey = (DSCMB_ENGKEY *)pu32Args;
598 if(TRUE == _MDrv_DSCMB2_EngSetKey(pKey->u32EngId, pKey->u32DscmbId, pKey->eEngType, pKey->eKeyType, pKey->pu8Key))
599 {
600 u32Ret = UTOPIA_STATUS_SUCCESS;
601 }
602
603 DSCMB_MSG("E_MDRV_CMD_DSCMB_EngSetKey\n");
604 }
605 break;
606
607 case E_MDRV_CMD_DSCMB_EngSetKeyFSCB:
608 {
609 DSCMB_ENGKEYFSCB * pKeyFSCB = (DSCMB_ENGKEYFSCB *)pu32Args;
610 if(TRUE == _MDrv_DSCMB2_EngSetKeyFSCB(pKeyFSCB->u32EngId, pKeyFSCB->u32DscmbId, pKeyFSCB->eEngType, pKeyFSCB->eKeyType, pKeyFSCB->eForceSCB))
611 {
612 u32Ret = UTOPIA_STATUS_SUCCESS;
613 }
614
615 DSCMB_MSG("E_MDRV_CMD_DSCMB_EngSetKeyFSCB\n");
616 }
617 break;
618
619 case E_MDRV_CMD_DSCMB_EngResetKey:
620 {
621 DSCMB_ENGRESETKEY * pKey = (DSCMB_ENGRESETKEY *)pu32Args;
622 if(TRUE == _MDrv_DSCMB2_EngResetKey(pKey->u32EngId, pKey->u32DscmbId, pKey->eEngType, pKey->eKeyType))
623 {
624 u32Ret = UTOPIA_STATUS_SUCCESS;
625 }
626 DSCMB_MSG("E_MDRV_CMD_DSCMB_EngResetKey\n");
627 }
628 break;
629
630 case E_MDRV_CMD_DSCMB_EngSetIV:
631 {
632 DSCMB_ENGIV * pIV = (DSCMB_ENGIV *)pu32Args;
633 if(TRUE == _MDrv_DSCMB2_EngSetIV(pIV->u32EngId, pIV->u32DscmbId, pIV->eKeyType, pIV->pu8IV))
634 {
635 u32Ret = UTOPIA_STATUS_SUCCESS;
636 }
637 DSCMB_MSG("E_MDRV_CMD_DSCMB_EngSetIV\n");
638 }
639 break;
640
641 case E_MDRV_CMD_DSCMB_EngSetSwitch:
642 {
643 DSCMB_ENGSWITCH * pSwitch = (DSCMB_ENGSWITCH *)pu32Args;
644 if(TRUE == _MDrv_DSCMB2_EngSetSwitch(pSwitch->u32EngId, pSwitch->u32DscmbId, pSwitch->eUppSwitch, pSwitch->eLowSwitch))
645 {
646 u32Ret = UTOPIA_STATUS_SUCCESS;
647 }
648 DSCMB_MSG("E_MDRV_CMD_DSCMB_EngSetSwitch\n");
649 }
650 break;
651
652 case E_MDRV_CMD_DSCMB_EngSetFSCB:
653 {
654 DSCMB_ENGFSCB * pFSCB = (DSCMB_ENGFSCB *)pu32Args;
655 if(TRUE == _MDrv_DSCMB2_EngSetFSCB(pFSCB->u32EngId, pFSCB->u32DscmbId, pFSCB->eForceSCB))
656 {
657 u32Ret = UTOPIA_STATUS_SUCCESS;
658 }
659
660 DSCMB_MSG("E_MDRV_CMD_DSCMB_EngSetFSCB\n");
661 }
662 break;
663
664 case E_MDRV_CMD_DSCMB_KLadder_AtomicExec:
665 {
666 DSCMB_KL_ATOMICEXEC * pKLArgs = (DSCMB_KL_ATOMICEXEC *)pu32Args;
667 if(TRUE == _MDrv_DSCMB2_KLadder_AtomicExec(pKLArgs->KLCfg,
668 pKLArgs->ACPU_Out,
669 pKLArgs->u32Status))
670 {
671 u32Ret = UTOPIA_STATUS_SUCCESS;
672 }
673
674 DSCMB_MSG("E_MDRV_CMD_DSCMB_KLadder_AtomicExec\n");
675
676 }
677 break;
678
679 case E_MDRV_CMD_DSCMB_KLadder_ETSI:
680 {
681 DSCMB_KL_ETSI * pKLArgs = (DSCMB_KL_ETSI *)pu32Args;
682 if(TRUE == _MDrv_DSCMB2_KLadder_ETSI(pKLArgs->KLCfg,
683 pKLArgs->ACPU_Out,
684 pKLArgs->pu8Nonce,
685 pKLArgs->pu8Response,
686 pKLArgs->u32Status))
687 {
688 u32Ret = UTOPIA_STATUS_SUCCESS;
689 }
690 DSCMB_MSG("E_MDRV_CMD_DSCMB_KLadder_ETSI\n");
691 }
692 break;
693
694 case E_MDRV_CMD_DSCMB_QueryCap:
695 {
696 DSCMB_QUERYCAP* pGetCap = (DSCMB_QUERYCAP*)pu32Args;
697 if(TRUE == _MDrv_DSCMB2_GetCap(pGetCap->u32EngId,
698 pGetCap->eQueryType,
699 pGetCap->pInput,
700 pGetCap->pOutput))
701 {
702 u32Ret = UTOPIA_STATUS_SUCCESS;
703 }
704
705 DSCMB_MSG("E_MDRV_CMD_DSCMB_GetCap\n");
706 }
707 break;
708
709 case E_MDRV_CMD_DSCMB_SetDBGLevel:
710 {
711 MS_U32* pDBGArgs = (MS_U32*)pu32Args;
712 if(TRUE == _MDrv_DSCMB2_SetDBGLevel(*pDBGArgs))
713 {
714 u32Ret = UTOPIA_STATUS_SUCCESS;
715 }
716
717 DSCMB_MSG("E_MDRV_CMD_DSCMB_SetDBGLevel\n");
718 }
719 break;
720
721 case E_MDRV_CMD_DSCMB_GetLibVer:
722 {
723 const MSIF_Version** pLibVerArgs = (const MSIF_Version**)pu32Args;
724 if(TRUE == _MDrv_DSCMB2_GetLibVer(pLibVerArgs))
725 {
726 u32Ret = UTOPIA_STATUS_SUCCESS;
727 }
728
729 DSCMB_MSG("E_MDRV_CMD_DSCMB_GetLibVer\n");
730 }
731 break;
732
733 case E_MDRV_CMD_DSCMB_GetConnectStatus:
734 {
735 DSCMB_CONNECTSTATUS* pStatusArgs = (DSCMB_CONNECTSTATUS*)pu32Args;
736 if(TRUE == _MDrv_DSCMB2_GetConnectStatus (pStatusArgs->u32EngId,
737 pStatusArgs->u32DscmbId,
738 pStatusArgs->u32DmxFltId))
739 {
740 u32Ret = UTOPIA_STATUS_SUCCESS;
741 }
742 DSCMB_MSG("E_MDRV_CMD_DSCMB_GetConnectStatus\n");
743 }
744 break;
745
746 case E_MDRV_CMD_DSCMB_CAPVR_FlowSet:
747 {
748 DSCMB_CAPVR_FLOWSET* pStatusArgs = (DSCMB_CAPVR_FLOWSET*)pu32Args;
749 if(TRUE == _MDrv_DSCMB2_CAPVR_FlowSet (pStatusArgs->u32EngId,
750 pStatusArgs->eCaMode,
751 pStatusArgs->ePvrSrcTsif))
752 {
753 u32Ret = UTOPIA_STATUS_SUCCESS;
754 }
755 DSCMB_MSG("E_MDRV_CMD_DSCMB_CAPVR_FlowSet\n");
756 }
757 break;
758
759 case E_MDRV_CMD_DSCMB_DualPath_Enable:
760 {
761 DSCMB_DUALPATH* pStatusArgs = (DSCMB_DUALPATH*)pu32Args;
762 if(TRUE == _MDrv_DSCMB2_DualPath_Enable (pStatusArgs->u32EngId,
763 pStatusArgs->u32DmxFltId))
764 {
765 u32Ret = UTOPIA_STATUS_SUCCESS;
766 }
767 DSCMB_MSG("E_MDRV_CMD_DSCMB_DualPath_Enable\n");
768 }
769 break;
770
771 case E_MDRV_CMD_DSCMB_DualPath_Disable:
772 {
773 DSCMB_DUALPATH* pStatusArgs = (DSCMB_DUALPATH*)pu32Args;
774 if(TRUE == _MDrv_DSCMB2_DualPath_Disable (pStatusArgs->u32EngId,
775 pStatusArgs->u32DmxFltId))
776 {
777 u32Ret = UTOPIA_STATUS_SUCCESS;
778 }
779 DSCMB_MSG("E_MDRV_CMD_DSCMB_DualPath_Disable\n");
780 }
781 break;
782
783 case E_MDRV_CMD_DSCMB_EngSetIV_Ex:
784 {
785 DSCMB_ENGIV_EX* pStatusArgs = (DSCMB_ENGIV_EX*)pu32Args;
786 if(TRUE == _MDrv_DSCMB2_EngSetIV_Ex (pStatusArgs->u32EngId,
787 pStatusArgs->u32DscmbId,
788 pStatusArgs->eEngType,
789 pStatusArgs->eKeyType,
790 pStatusArgs->pu8IV))
791 {
792 u32Ret = UTOPIA_STATUS_SUCCESS;
793 }
794 DSCMB_MSG("E_MDRV_CMD_DSCMB_EngSetIV_Ex\n");
795 }
796 break;
797
798 default:
799 DSCMB_MSG("DSCMBIoctl - Unknown commend 0x%x!!!\n", (int)u32Cmd);
800 return UTOPIA_STATUS_FAIL;
801 }
802
803
804 UtopiaResourceRelease(pstRes);
805
806 return u32Ret;
807 }
808
DSCMBClose(void * pInstance)809 MS_U32 DSCMBClose(void* pInstance)
810 {
811
812 UtopiaInstanceDelete(pInstance);
813
814 return UTOPIA_STATUS_SUCCESS;
815 }
816
817