xref: /utopia/UTPA2-700.0.x/modules/hdmi/drv/hdcp/drvHDCP.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 //<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   drvHDCP.c
98 /// @author MStar Semiconductor,Inc.
99 /// @brief  HDCP relative functions
100 ///////////////////////////////////////////////////////////////////////////////////////////////////
101 
102 /*********************************************************************/
103 /*                                                                                                                     */
104 /*                                                   Includes                                                      */
105 /*                                                                                                                     */
106 /*********************************************************************/
107 #include "MsTypes.h"
108 #include "MsCommon.h"
109 #include <stdio.h>
110 #include <string.h>
111 #include "drvHDCP.h"
112 #include "halHDCP.h"
113 #include "MsOS.h"
114 #include "MsDevice.h"
115 #include "drvMMIO.h"
116 
117 #ifndef DRV_HDCP_C
118 #define DRV_HDCP_C
119 
120 /*********************************************************************/
121 /*                                                                                                                     */
122 /*                                                      Defines                                                    */
123 /*                                                                                                                     */
124 /*********************************************************************/
125 /*********************************************************************/
126 /*                                                                                                                     */
127 /*                                                      Global                                                      */
128 /*                                                                                                                     */
129 /*********************************************************************/
130 static MS_BOOL g_bHdcpMMIOBaseInit = FALSE;
131 
132 /*********************************************************************/
133 /*                                                                                                                     */
134 /*                                                    Functions                                                    */
135 /*                                                                                                                     */
136 /*********************************************************************/
137 /*********************************************************************/
138 /*                                                                                                                     */
139 /*                                  HDCP14 Tx Function Start                                              */
140 /*                                                                                                                     */
141 /*********************************************************************/
__FUNC_HDCP14TX_Relative__(void)142 void __FUNC_HDCP14TX_Relative__(void){} // dummy function for pivot
143 //TBD
MDrv_HDCP_HDCP14TxInitHdcp(MS_U8 u8PortIdx)144 MS_BOOL MDrv_HDCP_HDCP14TxInitHdcp(MS_U8 u8PortIdx)
145 {
146     MS_VIRT u32Bank, u32IRBank;
147     MS_PHY u32BankSize;  // Non-PM bank
148     MS_PHY u32IrBankSize;  // PM bank
149 
150     if (g_bHdcpMMIOBaseInit == FALSE)
151     {
152         if (FALSE == MDrv_MMIO_GetBASE(&u32Bank, &u32BankSize, MS_MODULE_BDMA))
153         {
154             printf("MDrv_MMIO_GetBASE (NonPM base)fail\n");
155             MS_ASSERT(0);
156         }
157 
158         if (FALSE == MDrv_MMIO_GetBASE(&u32IRBank, &u32IrBankSize, MS_MODULE_IR))
159         {
160             printf("MDrv_MMIO_GetBASE (PM base)fail\n");
161             MS_ASSERT(0);
162         }
163 
164         MHal_HDCP_SetBank(u32Bank, u32IRBank);
165         g_bHdcpMMIOBaseInit = TRUE;
166     }
167 
168     MHal_HDCP_HDCP14TxInitHdcp(u8PortIdx);
169 
170     return TRUE;
171 }
172 
MDrv_HDCP_HDCP14TxLoadKey(MS_U8 * pu8KeyData,MS_BOOL bUseKmNewMode)173 MS_BOOL MDrv_HDCP_HDCP14TxLoadKey(MS_U8* pu8KeyData, MS_BOOL bUseKmNewMode)
174 {
175     MHal_HDCP_HDCP14TxLoadKey(pu8KeyData, bUseKmNewMode);
176     return TRUE;
177 }
178 
MDrv_HDCP_HDCP14TxSetAuthPass(MS_U8 u8PortIdx)179 MS_BOOL MDrv_HDCP_HDCP14TxSetAuthPass(MS_U8 u8PortIdx)
180 {
181     MHal_HDCP_HDCP14TxSetAuthPass(u8PortIdx);
182     return TRUE;
183 }
184 
MDrv_HDCP_HDCP14TxEnableENC_EN(MS_U8 u8PortIdx,MS_BOOL bEnable)185 MS_BOOL MDrv_HDCP_HDCP14TxEnableENC_EN(MS_U8 u8PortIdx, MS_BOOL bEnable)
186 {
187     MHal_HDCP_HDCP14TxEnableENC_EN(u8PortIdx, bEnable);
188     return TRUE;
189 }
MDrv_HDCP_HDCP14TxProcessAn(MS_U8 u8PortIdx,MS_BOOL bUseInternalAn,MS_U8 * pu8An)190 MS_BOOL MDrv_HDCP_HDCP14TxProcessAn(MS_U8 u8PortIdx, MS_BOOL bUseInternalAn, MS_U8* pu8An)
191 {
192     MHal_HDCP_HDCP14TxProcessAn(u8PortIdx, bUseInternalAn, pu8An);
193     return TRUE;
194 }
195 
MDrv_HDCP_HDCP14TxGetAKSV(MS_U8 u8PortIdx,MS_U8 * pu8Aksv)196 MS_BOOL MDrv_HDCP_HDCP14TxGetAKSV(MS_U8 u8PortIdx, MS_U8* pu8Aksv)
197 {
198     MHal_HDCP_HDCP14TxGetAKSV(u8PortIdx, pu8Aksv);
199     return TRUE;
200 }
201 
MDrv_HDCP_HDCP14TxCompareRi(MS_U8 u8PortIdx,MS_U8 * pu8SinkRi)202 MS_BOOL MDrv_HDCP_HDCP14TxCompareRi(MS_U8 u8PortIdx, MS_U8* pu8SinkRi)
203 {
204     return MHal_HDCP_HDCP14TxCompareRi(u8PortIdx, pu8SinkRi);
205 }
206 
MDrv_HDCP_HDCP14TxConfigMode(MS_U8 u8PortIdx,MS_U8 u8Mode)207 MS_BOOL MDrv_HDCP_HDCP14TxConfigMode(MS_U8 u8PortIdx, MS_U8 u8Mode)
208 {
209     MHal_HDCP_HDCP14TxConfigMode(u8PortIdx, u8Mode);
210     return TRUE;
211 }
212 
MDrv_HDCP_HDCP14TxGenerateCipher(MS_U8 u8PortIdx,MS_U8 * pu8Bksv)213 MS_BOOL MDrv_HDCP_HDCP14TxGenerateCipher(MS_U8 u8PortIdx, MS_U8* pu8Bksv)
214 {
215     MHal_HDCP_HDCP14TxGenerateCipher(u8PortIdx, pu8Bksv);
216     return TRUE;
217 }
218 
MDrv_HDCP_HDCP14TxProcessR0(MS_U8 u8PortIdx)219 MS_BOOL MDrv_HDCP_HDCP14TxProcessR0(MS_U8 u8PortIdx)
220 {
221     return MHal_HDCP_HDCP14TxProcessR0(u8PortIdx);
222 }
223 
MDrv_HDCP_HDCP14TxGetM0(MS_U8 u8PortIdx,MS_U8 * pu8M0)224 MS_BOOL MDrv_HDCP_HDCP14TxGetM0(MS_U8 u8PortIdx, MS_U8* pu8M0)
225 {
226     if (pu8M0 == NULL)
227     {
228         return FALSE;
229     }
230     else
231     {
232         MHal_HDCP_HDCP14TxGetM0(u8PortIdx, pu8M0);
233         return TRUE;
234     }
235 }
236 /*********************************************************************/
237 /*                                                                                                                     */
238 /*                                  HDCP14 Rx Function Start                                              */
239 /*                                                                                                                     */
240 /*********************************************************************/
__FUNC_HDCP14RX_Relative__(void)241 void __FUNC_HDCP14RX_Relative__(void){} // dummy function for pivot
242 //TBD
MDrv_HDCP_HDCP14GetM0(MS_U8 u8PortIdx,MS_U8 * pu8Data)243 MS_BOOL MDrv_HDCP_HDCP14GetM0(MS_U8 u8PortIdx, MS_U8 *pu8Data)
244 {
245     if (pu8Data == NULL)
246     {
247         return FALSE; //DRVAESDMA_FAIL;
248     }
249     else
250     {
251         MHal_HDCP_HDCP14GetM0(u8PortIdx, pu8Data);
252         return TRUE; //DRVAESDMA_OK;
253     }
254 }
255 
256 //**************************************************************************
257 //  [Function Name]:
258 //                  MDrv_HDCP_HDCP14FillKey()
259 //  [Description]:
260 //                  HDCP 1.4 load key
261 //  [Arguments]:
262 //                  [MS_U8] pu8KeyData
263 //  [Return]:
264 //                  BOOL
265 //**************************************************************************
MDrv_HDCP_HDCP14FillKey(MS_U8 * pu8KeyData)266 MS_BOOL MDrv_HDCP_HDCP14FillKey(MS_U8 *pu8KeyData)
267 {
268     if(pu8KeyData == NULL)
269     {
270         return FALSE; //DRVAESDMA_FAIL;
271     }
272     else
273     {
274         MHal_HDCP_HDCP14FillBksv(pu8KeyData);
275         MHal_HDCP_HDCP14FillKey(pu8KeyData +5);
276         return TRUE; //DRVAESDMA_OK;
277     }
278 }
279 
280 /*********************************************************************/
281 /*                                                                                                                     */
282 /*                                  HDCP22 Tx Function Start                                              */
283 /*                                                                                                                     */
284 /*********************************************************************/
__FUNC_HDCP22TX_Relative__(void)285 void __FUNC_HDCP22TX_Relative__(void){} // dummy function for pivot
286 
MDrv_HDCP_HDCP2Init(void)287 MS_BOOL MDrv_HDCP_HDCP2Init(void)
288 {
289     MS_VIRT u32Bank, u32IRBank;
290     MS_PHY u32BankSize;  // Non-PM bank
291     MS_PHY u32IrBankSize;  // PM bank
292 
293     if (g_bHdcpMMIOBaseInit == FALSE)
294     {
295         if (FALSE == MDrv_MMIO_GetBASE(&u32Bank, &u32BankSize, MS_MODULE_BDMA))
296         {
297             printf("MDrv_MMIO_GetBASE (NonPM base)fail\n");
298             MS_ASSERT(0);
299         }
300 
301         if (FALSE == MDrv_MMIO_GetBASE(&u32IRBank, &u32IrBankSize, MS_MODULE_IR))
302         {
303             printf("MDrv_MMIO_GetBASE (PM base)fail\n");
304             MS_ASSERT(0);
305         }
306 
307         MHal_HDCP_SetBank(u32Bank, u32IRBank);
308         g_bHdcpMMIOBaseInit = TRUE;
309     }
310 
311     return TRUE;
312 }
313 
314 //**************************************************************************
315 //  [Function Name]:
316 //                  MDrv_HDCP_HDCP2TxModuleInit()
317 //  [Description]:
318 //                  init or de-init hdcp22 tx hw module
319 //  [Arguments]:
320 //                  [MS_U8] u8PortIdx
321 //                  [MS_BOOL] bEnable
322 //  [Return]:
323 //                  bool
324 //
325 //**************************************************************************
MDrv_HDCP_HDCP2TxModuleInit(MS_U8 u8PortIdx,MS_BOOL bEnable)326 MS_BOOL MDrv_HDCP_HDCP2TxModuleInit(MS_U8 u8PortIdx, MS_BOOL bEnable)
327 {
328     MHal_HDCP_HDCP2TxInit(u8PortIdx, bEnable);
329 
330     return TRUE;
331 }
332 
333 //**************************************************************************
334 //  [Function Name]:
335 //                  MDrv_HDCP_HDCP2TxEnableEncrypt()
336 //  [Description]:
337 //                  enable/disable Hdcp22 Tx encrytion process
338 //  [Arguments]:
339 //                  [MS_U8] u8PortIdx
340 //                  [MS_BOOL] bEnable
341 //  [Return]:
342 //                  void
343 //
344 //**************************************************************************
MDrv_HDCP_HDCP2TxEnableEncrypt(MS_U8 u8PortIdx,MS_BOOL bEnable)345 MS_BOOL MDrv_HDCP_HDCP2TxEnableEncrypt(MS_U8 u8PortIdx, MS_BOOL bEnable)
346 {
347     MHal_HDCP_HDCP2TxEnableEncrypt(u8PortIdx, bEnable);
348 
349     return TRUE;
350 }
351 
352 //**************************************************************************
353 //  [Function Name]:
354 //                  MDrv_HDCP_HDCP2TxFillCipherKey()
355 //  [Description]:
356 //                  Fill Cipher key (Ks^LC128, riv) for HDCP 2.2 Tx
357 //  [Arguments]:
358 //                  [MS_U8] u8PortIdx
359 //                  [MS_U8*] pu8Riv,
360 //                  [MS_U8*] pu8KsXORLC128
361 //  [Return]:
362 //                  void
363 //
364 //**************************************************************************
MDrv_HDCP_HDCP2TxFillCipherKey(MS_U8 u8PortIdx,MS_U8 * pu8Riv,MS_U8 * pu8ContentKey)365 MS_BOOL MDrv_HDCP_HDCP2TxFillCipherKey(MS_U8 u8PortIdx, MS_U8 *pu8Riv, MS_U8 *pu8ContentKey)
366 {
367     MHal_HDCP_HDCP2TxFillCipherKey( u8PortIdx, pu8Riv, pu8ContentKey);
368 
369     return TRUE;
370 }
371 
372 //**************************************************************************
373 //  [Function Name]:
374 //                  MDrv_HDCP_HDCP2TxGetCipherState()
375 //  [Description]:
376 //                  return Status about HDCP22 Tx Cipher engine
377 //  [Arguments]:
378 //                  [MS_U8] u8PortIdx
379 //                  [MS_U8*] pu8State
380 //  [Return]:
381 //                  [MS_U32]
382 //
383 //**************************************************************************
MDrv_HDCP_HDCP2TxGetCipherState(MS_U8 u8PortIdx,MS_U8 * pu8State)384 MS_BOOL MDrv_HDCP_HDCP2TxGetCipherState(MS_U8 u8PortIdx, MS_U8 *pu8State)
385 {
386     MHal_HDCP_HDCP2TxGetCipherState(u8PortIdx, pu8State);
387 
388     return TRUE;
389 }
390 
391 //**************************************************************************
392 //  [Function Name]:
393 //                  MDrv_HDCP_HDCP2TxSetAuthPass()
394 //  [Description]:
395 //                  enable or disable authentication pass bit of hdcp22 tx hw module
396 //  [Arguments]:
397 //                  [MS_U8] u8PortIdx
398 //                  [MS_BOOL] bEnable
399 //  [Return]:
400 //                  [MS_U32]
401 //
402 //**************************************************************************
MDrv_HDCP_HDCP2TxSetAuthPass(MS_U8 u8PortIdx,MS_BOOL bEnable)403 MS_BOOL MDrv_HDCP_HDCP2TxSetAuthPass(MS_U8 u8PortIdx, MS_BOOL bEnable)
404 {
405     MHal_HDCP_HDCP2TxSetAuthPass(u8PortIdx, bEnable);
406     return TRUE;
407 }
408 
409 /*********************************************************************/
410 /*                                                                                                                     */
411 /*                                  HDCP22 Rx Function Start                                              */
412 /*                                                                                                                     */
413 /*********************************************************************/
__FUNC_HDCP22RX_Relative__(void)414 void __FUNC_HDCP22RX_Relative__(void){} // dummy function for pivot
415 
416 //**************************************************************************
417 //  [Function Name]:
418 //                  MDrv_HDCP_HDCP2RxInit()
419 //  [Description]:
420 //                  initial setting of hdcp22 rx
421 //  [Arguments]:
422 //                  [MS_U8] u8PortIdx
423 //  [Return]:
424 //                  [MS_BOOL]
425 //
426 //**************************************************************************
MDrv_HDCP_HDCP2RxInit(MS_U8 u8PortIdx)427 MS_BOOL MDrv_HDCP_HDCP2RxInit(MS_U8 u8PortIdx)
428 {
429     MHal_HDCP_HDCP2RxInit(u8PortIdx);
430 
431     return TRUE;
432 }
433 
434 //**************************************************************************
435 //  [Function Name]:
436 //                  MDrv_HDCP_HDCP2RxProcessCipher()
437 //  [Description]:
438 //                  Fill Cipher key (Ks^LC128, riv) for HDCP 2.2 Rx
439 //  [Arguments]:
440 //                  [MS_U8] u8PortIdx
441 //                  [MS_U8*] pu8Riv,
442 //                  [MS_U8*] pu8ContentKey
443 //  [Return]:
444 //                  [MS_BOOL]
445 //
446 //**************************************************************************
MDrv_HDCP_HDCP2RxProcessCipher(MS_U8 u8PortIdx,MS_U8 * pu8Riv,MS_U8 * pu8ContentKey)447 MS_BOOL MDrv_HDCP_HDCP2RxProcessCipher(MS_U8 u8PortIdx, MS_U8* pu8Riv, MS_U8 *pu8ContentKey)
448 {
449     MHal_HDCP_HDCP2RxProcessCipher(u8PortIdx, pu8Riv, pu8ContentKey);
450 
451     return TRUE;
452 }
453 
454 //**************************************************************************
455 //  [Function Name]:
456 //                  MDrv_HDCP_HDCP2RxEnableENCEN()
457 //  [Description]:
458 //                  Enable or disable ENC_EN
459 //  [Arguments]:
460 //                  [MS_U8] u8PortIdx
461 //                  [MS_BOOL] bEnable
462 //  [Return]:
463 //                  [MS_BOOL]
464 //
465 //**************************************************************************
MDrv_HDCP_HDCP2RxSetSKEPass(MS_U8 u8PortIdx,MS_BOOL bEnable)466 MS_BOOL MDrv_HDCP_HDCP2RxSetSKEPass(MS_U8 u8PortIdx, MS_BOOL bEnable)
467 {
468     MHal_HDCP_HDCP2RxSetSKEPass(u8PortIdx, bEnable);
469     return TRUE;
470 }
471 
472 //**************************************************************************
473 //  [Function Name]:
474 //                  MDrv_HDCP_HDCP2RxProcessCipher()
475 //  [Description]:
476 //                  Fill Cipher key (Ks^LC128, riv) for HDCP 2.2 Rx
477 //  [Arguments]:
478 //                  [MS_U8] u8PortIdx
479 //                  [MS_U8*] pu8Riv,
480 //                  [MS_U8*] pu8ContentKey
481 //  [Return]:
482 //                  [MS_BOOL]
483 //
484 //**************************************************************************
MDrv_HDCP_HDCP2RxFillCipherKey(MS_U8 u8PortIdx,MS_U8 * pu8Riv,MS_U8 * pu8ContentKey)485 MS_BOOL MDrv_HDCP_HDCP2RxFillCipherKey(MS_U8 u8PortIdx, MS_U8* pu8Riv, MS_U8 *pu8ContentKey)
486 {
487     MHal_HDCP_HDCP2RxFillCipherKey(u8PortIdx, pu8Riv, pu8ContentKey);
488     return TRUE;
489 }
490 
491 //**************************************************************************
492 //  [Function Name]:
493 //                  MDrv_HDCP_HDCP2RxGetCipherState()
494 //  [Description]:
495 //                  return Status about HDCP22 Rx Cipher engine
496 //  [Arguments]:
497 //                  [MS_U8] u8PortIdx
498 //                  [MS_U8*] pu8State
499 //  [Return]:
500 //                  [MS_U32]
501 //
502 //**************************************************************************
MDrv_HDCP_HDCP2RxGetCipherState(MS_U8 u8PortIdx,MS_U8 * pu8State)503 MS_BOOL MDrv_HDCP_HDCP2RxGetCipherState(MS_U8 u8PortIdx, MS_U8 *pu8State)
504 {
505     MHal_HDCP_HDCP2RxGetCipherState(u8PortIdx, pu8State);
506 
507     return TRUE;
508 }
509 
510 //**************************************************************************
511 //  [Function Name]:
512 //                  MDrv_HDCP_GetHDCP2Status()
513 //  [Description]:
514 //                  Get HDCP22 encrytion status based on HDMI port number
515 //  [Arguments]:
516 //                  [MS_U32] u32HdmiPort
517 //                  [MS_U32*] pu32HDCPStatus
518 //  [Return]:
519 //                  [MS_BOOL]
520 //
521 //**************************************************************************
MDrv_HDCP_GetHDCP2Status(MS_U32 u32HdmiPort,MS_U32 * pu32HDCPStatus)522 MS_BOOL MDrv_HDCP_GetHDCP2Status(MS_U32 u32HdmiPort, MS_U32 *pu32HDCPStatus)
523 {
524     MS_BOOL bGetStatusFlag = FALSE;
525 
526     if(pu32HDCPStatus != NULL)
527     {
528         bGetStatusFlag = TRUE;
529 
530         *pu32HDCPStatus = MHal_HDCP_HDCP2TxEncrytionStatus(u32HdmiPort, FALSE, 0);
531     }
532 
533     return bGetStatusFlag;
534 }
535 
536 //**************************************************************************
537 //  [Function Name]:
538 //                  MDrv_HDCP_SetHDCP2Status()
539 //  [Description]:
540 //                  Set HDCP22 encrytion status based on HDMI port number
541 //  [Arguments]:
542 //                  [MS_U32] u32HdmiPort
543 //                  [MS_U32] u32HDCPStatus
544 //  [Return]:
545 //                  [MS_BOOL]
546 //
547 //**************************************************************************
MDrv_HDCP_SetHDCP2Status(MS_U32 u32HdmiPort,MS_U32 u32HDCPStatus)548 MS_BOOL MDrv_HDCP_SetHDCP2Status(MS_U32 u32HdmiPort, MS_U32 u32HDCPStatus)
549 {
550     MS_BOOL bSetStatusFlag = FALSE;
551 
552     if(MHal_HDCP_HDCP2TxEncrytionStatus(u32HdmiPort, TRUE, u32HDCPStatus) == u32HDCPStatus)
553     {
554         bSetStatusFlag = TRUE;
555     }
556 
557     return bSetStatusFlag;
558 }
559 
560 //**************************************************************************
561 //  [Function Name]:
562 //                  MDrv_HDCP_GetHDCP1Status()
563 //  [Description]:
564 //                  Get HDCP14 encrytion status based on HDMI port number
565 //  [Arguments]:
566 //                  [MS_U32] u32HdmiPort
567 //                  [MS_U32*] pu32HDCPStatus
568 //  [Return]:
569 //                  [MS_BOOL]
570 //
571 //**************************************************************************
MDrv_HDCP_GetHDCP1Status(MS_U32 u32HdmiPort,MS_U32 * pu32HDCPStatus)572 MS_BOOL MDrv_HDCP_GetHDCP1Status(MS_U32 u32HdmiPort, MS_U32 *pu32HDCPStatus)
573 {
574     MS_BOOL bGetStatusFlag = FALSE;
575 
576     if(pu32HDCPStatus != NULL)
577     {
578         bGetStatusFlag = TRUE;
579 
580         *pu32HDCPStatus = MHal_HDCP_HDCP1TxEncrytionStatus(u32HdmiPort, FALSE, 0);
581     }
582 
583     return bGetStatusFlag;
584 }
585 
586 //**************************************************************************
587 //  [Function Name]:
588 //                  MDrv_HDCP_SetHDCP1Status()
589 //  [Description]:
590 //                  Set HDCP22 encrytion status based on HDMI port number
591 //  [Arguments]:
592 //                  [MS_U32] u32HdmiPort
593 //                  [MS_U32] u32HDCPStatus
594 //  [Return]:
595 //                  [MS_BOOL]
596 //
597 //**************************************************************************
MDrv_HDCP_SetHDCP1Status(MS_U32 u32HdmiPort,MS_U32 u32HDCPStatus)598 MS_BOOL MDrv_HDCP_SetHDCP1Status(MS_U32 u32HdmiPort, MS_U32 u32HDCPStatus)
599 {
600     MS_BOOL bSetStatusFlag = FALSE;
601 
602     if(MHal_HDCP_HDCP1TxEncrytionStatus(u32HdmiPort, TRUE, u32HDCPStatus) == u32HDCPStatus)
603     {
604         bSetStatusFlag = TRUE;
605     }
606 
607     return bSetStatusFlag;
608 }
609 
610 //**************************************************************************
611 //  [Function Name]:
612 //                  MDrv_HDCP_GetHDMIStatus()
613 //  [Description]:
614 //                  Get HDMI enable status based on HDMI port number
615 //  [Arguments]:
616 //                  [MS_U32] u32HdmiPort
617 //                  [MS_U32*] pu32HDMIStatus
618 //  [Return]:
619 //                  [MS_BOOL]
620 //
621 //**************************************************************************
MDrv_HDCP_GetHDMIStatus(MS_U32 u32HdmiPort,MS_U32 * pu32HDMIStatus)622 MS_BOOL MDrv_HDCP_GetHDMIStatus(MS_U32 u32HdmiPort, MS_U32 *pu32HDMIStatus)
623 {
624     MS_BOOL bGetStatusFlag = FALSE;
625 
626     if(pu32HDMIStatus != NULL)
627     {
628         bGetStatusFlag = TRUE;
629 
630         *pu32HDMIStatus = MHal_HDCP_HDCPTxHDMIStatus(u32HdmiPort, FALSE, 0);
631     }
632 
633     return bGetStatusFlag;
634 }
635 
636 //**************************************************************************
637 //  [Function Name]:
638 //                  MDrv_HDCP_SetHDCP1Status()
639 //  [Description]:
640 //                  Set HDMI enable status based on HDMI port number
641 //  [Arguments]:
642 //                  [MS_U32] u32HdmiPort
643 //                  [MS_U32] u32HDMIStatus
644 //  [Return]:
645 //                  [MS_BOOL]
646 //
647 //**************************************************************************
MDrv_HDCP_SetHDMIStatus(MS_U32 u32HdmiPort,MS_U32 u32HDMIStatus)648 MS_BOOL MDrv_HDCP_SetHDMIStatus(MS_U32 u32HdmiPort, MS_U32 u32HDMIStatus)
649 {
650     MS_BOOL bSetStatusFlag = FALSE;
651 
652     if(MHal_HDCP_HDCPTxHDMIStatus(u32HdmiPort, TRUE, u32HDMIStatus) == u32HDMIStatus)
653     {
654         bSetStatusFlag = TRUE;
655     }
656 
657     return bSetStatusFlag;
658 }
659 
660 #endif //#ifndef DRV_HDCP_C
661