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-2009 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 #ifndef _DRV_HDCP_H_ 95 #define _DRV_HDCP_H_ 96 97 #include "MsCommon.h" 98 /*********************************************************************/ 99 /* */ 100 /* Defines */ 101 /* */ 102 /*********************************************************************/ 103 104 /*********************************************************************/ 105 /* */ 106 /* Structure */ 107 /* */ 108 /*********************************************************************/ 109 110 /*********************************************************************/ 111 /* */ 112 /* Proto-type */ 113 /* */ 114 /*********************************************************************/ 115 //HDCP14 116 //---------------------------------------------------------------- 117 /// MDrv_HDCP_HDCP14TxInitHdcp() 118 /// initiallze hardware setting of hdcp1.x Tx module 119 /// @param u8PortIdx \b IN: HDMI Port Index 120 /// @return void 121 //---------------------------------------------------------------- 122 MS_BOOL MDrv_HDCP_HDCP14TxInitHdcp(MS_U8 u8PortIdx); 123 124 //---------------------------------------------------------------- 125 /// MDrv_HDCP_HDCP14TxLoadKey() 126 /// loading Hdcp1.x key 127 /// @param pu8KeyData \b IN: hdcp key pointer 128 /// @param bUseKmNewMode \b IN: indicate decrypt mode is new or old mode 129 /// @return void 130 //---------------------------------------------------------------- 131 MS_BOOL MDrv_HDCP_HDCP14TxLoadKey(MS_U8* pu8KeyData, MS_BOOL bUseKmNewMode); 132 133 //---------------------------------------------------------------- 134 /// MDrv_HDCP_HDCP14TxSetAuthPass() 135 /// setting register when authentication flow is done 136 /// @param u8PortIdx \b IN: HDMI Port Index 137 /// @return void 138 //---------------------------------------------------------------- 139 MS_BOOL MDrv_HDCP_HDCP14TxSetAuthPass(MS_U8 u8PortIdx); 140 //---------------------------------------------------------------- 141 /// MDrv_HDCP_HDCP14TxEnableENC_EN() 142 /// enable or disable ENC_EN signal 143 /// @param u8PortIdx \b IN: HDMI Port Index 144 /// @param bEnable \b IN: indicate enable or disable ENC_EN signal 145 /// @return void 146 //---------------------------------------------------------------- 147 MS_BOOL MDrv_HDCP_HDCP14TxEnableENC_EN(MS_U8 u8PortIdx, MS_BOOL bEnable); 148 //---------------------------------------------------------------- 149 /// MDrv_HDCP_HDCP14TxProcessAn() 150 /// filling or fetching AN value depends on using external or internal AN 151 /// @param u8PortIdx \b IN: HDMI Port Index 152 /// @param bUseInternalAn \b IN: indicate internal or external AN 153 /// @param pu8An \b IN: if using external AN, treat this as input AN; \b OUT: if using internal AN, treat this as return AN 154 /// @return void 155 //---------------------------------------------------------------- 156 MS_BOOL MDrv_HDCP_HDCP14TxProcessAn(MS_U8 u8PortIdx, MS_BOOL bUseInternalAn, MS_U8* pu8An); 157 //---------------------------------------------------------------- 158 /// MDrv_HDCP_HDCP14TxGetAKSV() 159 /// fetch AKSV from hdcp1.x key 160 /// @param u8PortIdx \b IN: HDMI Port Index 161 /// @param pu8Aksv \b OUT: MS_U8 pointer to store AKSV for return 162 /// @return void 163 //---------------------------------------------------------------- 164 MS_BOOL MDrv_HDCP_HDCP14TxGetAKSV(MS_U8 u8PortIdx, MS_U8* pu8Aksv); 165 //---------------------------------------------------------------- 166 /// MDrv_HDCP_HDCP14TxCompareRi() 167 /// compare Ri value of sink and source side 168 /// @param u8PortIdx \b IN: HDMI Port Index 169 /// @param pu8SinkRi \b IN: MS_U8 pointer to store Ri value of sink device 170 /// @return MS_BOOL, TRUE: success; FALSE: failed 171 //---------------------------------------------------------------- 172 MS_BOOL MDrv_HDCP_HDCP14TxCompareRi(MS_U8 u8PortIdx, MS_U8* pu8SinkRi); 173 //---------------------------------------------------------------- 174 /// MDrv_HDCP_HDCP14TxConfigMode() 175 /// config hdcp1.x encrypt mode 176 /// @param u8PortIdx \b IN: HDMI Port Index 177 /// @param u8Mode \b IN: encrypt mode of hdcp1.x 178 /// @return void 179 //---------------------------------------------------------------- 180 MS_BOOL MDrv_HDCP_HDCP14TxConfigMode(MS_U8 u8PortIdx, MS_U8 u8Mode); 181 //---------------------------------------------------------------- 182 /// MDrv_HDCP_HDCP14TxGenerateCipher() 183 /// decrypt hdcp1.x key and init cipher engine 184 /// @param u8PortIdx \b IN: HDMI Port Index 185 /// @param pu8Bksv \b IN: MS_U8 pointer to store BKSV value 186 /// @return void 187 //---------------------------------------------------------------- 188 MS_BOOL MDrv_HDCP_HDCP14TxGenerateCipher(MS_U8 u8PortIdx, MS_U8* pu8Bksv); 189 //---------------------------------------------------------------- 190 /// MDrv_HDCP_HDCP14TxProcessR0() 191 /// trigger HW module to do the R0 calculation and return if process is done 192 /// @param u8PortIdx \b IN: HDMI Port Index 193 /// @return MS_BOOL, TRUE: success; FALSE: failed 194 //---------------------------------------------------------------- 195 MS_BOOL MDrv_HDCP_HDCP14TxProcessR0(MS_U8 u8PortIdx); 196 //---------------------------------------------------------------- 197 /// MDrv_HDCP_HDCP14TxGetM0() 198 /// fetch M0 value from HW module 199 /// @param u8PortIdx \b IN: HDMI Port Index 200 /// @param pu8M0 \b IN: pointer to store M0 value 201 /// @return MS_BOOL, TRUE: success; FALSE: failed 202 //---------------------------------------------------------------- 203 MS_BOOL MDrv_HDCP_HDCP14TxGetM0(MS_U8 u8PortIdx, MS_U8* pu8M0); 204 //---------------------------------------------------------------- 205 /// MDrv_HDCP_HDCP14GetM0() 206 /// fetch HDCP 1.4 M0 value from Sink device 207 /// @param u8PortIdx \b IN: HDMI Port Index 208 /// @param pu8Data \b IN: MS_U8 pointer to store returned M0 value 209 /// @return MS_BOOL, TRUE: success; FALSE: failed 210 //---------------------------------------------------------------- 211 MS_BOOL MDrv_HDCP_HDCP14GetM0(MS_U8 u8PortIdx, MS_U8 *pu8Data); 212 //---------------------------------------------------------------- 213 /// MDrv_HDCP_HDCP14FillKey() 214 /// Load HDCP 1.4 key 215 /// @param pu8KeyData \b IN: MS_U8 pointer to store HDCP 1.4 key value 216 /// @return MS_BOOL, TRUE: success; FALSE: failed 217 //---------------------------------------------------------------- 218 MS_BOOL MDrv_HDCP_HDCP14FillKey(MS_U8 *pu8KeyData); 219 220 //HDCP22 221 //---------------------------------------------------------------- 222 /// MDrv_HDCP_HDCP2Init() 223 /// Initial Process of HDCP2.2 224 /// @param \b IN: none 225 /// @return MS_BOOL, TRUE: success; FALSE: failed 226 //---------------------------------------------------------------- 227 MS_BOOL MDrv_HDCP_HDCP2Init(void); 228 //HDCP22 TX 229 //---------------------------------------------------------------- 230 /// MDrv_HDCP_HDCP2Init() 231 /// Initial of HDCP2.2 tx hw module 232 /// @param u8PortIdx \b IN: HDMI Port Index 233 /// @param bEnable \b IN: init / de-init flag 234 /// @return MS_BOOL, TRUE: success; FALSE: failed 235 //---------------------------------------------------------------- 236 MS_BOOL MDrv_HDCP_HDCP2TxModuleInit(MS_U8 u8PortIdx, MS_BOOL bEnable); 237 //---------------------------------------------------------------- 238 /// MDrv_HDCP_HDCP2TxEnableEncrypt() 239 /// Enable HDCP2.2 Encryption 240 /// @param u8PortIdx \b IN: HDMI Port Index 241 /// @param bEnable: \b IN: TRUE: enable encryption; FALSE: disable encryption 242 /// @return MS_BOOL, TRUE: success; FALSE: failed 243 //---------------------------------------------------------------- 244 MS_BOOL MDrv_HDCP_HDCP2TxEnableEncrypt(MS_U8 u8PortIdx, MS_BOOL bEnable); 245 //---------------------------------------------------------------- 246 /// MDrv_HDCP_HDCP2TxFillCipherKey() 247 /// Fill HDCP2.2 TX Cipher Key 248 /// @param u8PortIdx \b IN: HDMI Port Index 249 /// @pu8Riv \b IN: MS_U8 pointer which stored RIV data 250 /// @pu8ContentKey \b IN: MS_U8 pointer which stored KS^LV128 251 /// @return MS_BOOL, TRUE: success; FALSE: failed 252 //---------------------------------------------------------------- 253 MS_BOOL MDrv_HDCP_HDCP2TxFillCipherKey(MS_U8 u8PortIdx, MS_U8 *pu8Riv, MS_U8 *pu8ContentKey); 254 //---------------------------------------------------------------- 255 /// MDrv_HDCP_HDCP2RxGetCipherState() 256 /// Get current HDCP2.2 TX status 257 /// @u8PortIdx \b IN: HDMI Port Index 258 /// @pu8State \b IN: MS_U8 pointer which return HDCP22 TX cipher state 259 /// @return MS_BOOL, TRUE: success; FALSE: failed 260 //---------------------------------------------------------------- 261 MS_BOOL MDrv_HDCP_HDCP2TxGetCipherState(MS_U8 u8PortIdx, MS_U8 *pu8State); 262 263 //---------------------------------------------------------------- 264 /// MDrv_HDCP_HDCP2TxSetAuthPass() 265 /// Set or clear HDCP2.2 TX authentication pass 266 /// @u8PortIdx \b IN: HDMI Port Index 267 /// @bEnable \b IN: disable or enable authentication pass bit 268 /// @return MS_BOOL, TRUE: success; FALSE: failed 269 //---------------------------------------------------------------- 270 MS_BOOL MDrv_HDCP_HDCP2TxSetAuthPass(MS_U8 u8PortIdx, MS_BOOL bEnable); 271 272 //HDCP22 Rx 273 //---------------------------------------------------------------- 274 // MDrv_HDCP_HDCP2RxInit() 275 /// hdcp22 rx init setting; 276 /// @u8PortIdx \b IN: HDMI Port Index 277 /// @return MS_BOOL, TRUE: success; FALSE: failed 278 //---------------------------------------------------------------- 279 MS_BOOL MDrv_HDCP_HDCP2RxInit(MS_U8 u8PortIdx); 280 281 //---------------------------------------------------------------- 282 // MDrv_HDCP_HDCP2RxProcessCipher() 283 /// Fill HDCP2.2 RX Cipher Key and set SKE pass; 284 /// @u8PortIdx \b IN: HDMI Port Index 285 /// @pu8Riv \b IN: MS_U8 pointer which stored RIV data 286 /// @pu8ContentKey \b IN: MS_U8 pointer which stored KS^LV128 287 /// @return MS_BOOL, TRUE: success; FALSE: failed 288 //---------------------------------------------------------------- 289 MS_BOOL MDrv_HDCP_HDCP2RxProcessCipher(MS_U8 u8PortIdx, MS_U8* pu8Riv, MS_U8 *pu8ContentKey); 290 291 //---------------------------------------------------------------- 292 // MDrv_HDCP_HDCP2RxEnableENCEN() 293 /// set or clear SKE pass bit; 294 /// @u8PortIdx \b IN: HDMI Port Index 295 /// @bEnable \b IN: flag to indicate set or clear 296 /// @return MS_BOOL, TRUE: success; FALSE: failed 297 //---------------------------------------------------------------- 298 MS_BOOL MDrv_HDCP_HDCP2RxSetSKEPass(MS_U8 u8PortIdx, MS_BOOL bEnable); 299 300 //---------------------------------------------------------------- 301 // MDrv_HDCP_HDCP2RxFillCipherKey() 302 /// Fill HDCP2.2 RX Cipher Key only; 303 /// @u8PortIdx \b IN: HDMI Port Index 304 /// @pu8Riv \b IN: MS_U8 pointer which stored RIV data 305 /// @pu8ContentKey \b IN: MS_U8 pointer which stored KS^LV128 306 /// @return MS_BOOL, TRUE: success; FALSE: failed 307 //---------------------------------------------------------------- 308 MS_BOOL MDrv_HDCP_HDCP2RxFillCipherKey(MS_U8 u8PortIdx, MS_U8* pu8Riv, MS_U8 *pu8ContentKey); 309 310 //---------------------------------------------------------------- 311 /// MDrv_HDCP_HDCP2RxGetCipherState() 312 /// Get current HDCP2.2 RX status 313 /// @u8PortIdx \b IN: HDMI Port Index 314 /// @pu8State \b IN: MS_U8 pointer which return HDCP22 RX cipher state 315 /// @return MS_BOOL, TRUE: success; FALSE: failed 316 //---------------------------------------------------------------- 317 MS_BOOL MDrv_HDCP_HDCP2RxGetCipherState(MS_U8 u8PortIdx, MS_U8 *pu8State); 318 319 //---------------------------------------------------------------- 320 /// MDrv_HDCP_GetHDCP2Status() 321 /// Get HDCP22 encrytion status based on HDMI port number 322 /// @u32HdmiPort \b IN: HDMI Port Index 323 /// @pu32HDCPStatus \b IN: MS_U32 pointer which return encrytion status 324 /// @return MS_BOOL, TRUE: success; FALSE: failed 325 //---------------------------------------------------------------- 326 MS_BOOL MDrv_HDCP_GetHDCP2Status(MS_U32 u32HdmiPort, MS_U32 *pu32HDCPStatus); 327 328 //---------------------------------------------------------------- 329 /// MDrv_HDCP_SetHDCP2Status() 330 /// Set HDCP22 encrytion status based on HDMI port number 331 /// @u32HdmiPort \b IN: HDMI Port Index 332 /// @u32HDCPStatus \b IN: Encrytion status 333 /// @return MS_BOOL, TRUE: success; FALSE: failed 334 //---------------------------------------------------------------- 335 MS_BOOL MDrv_HDCP_SetHDCP2Status(MS_U32 u32HdmiPort, MS_U32 u32HDCPStatus); 336 337 //---------------------------------------------------------------- 338 /// MDrv_HDCP_GetHDCP1Status() 339 /// Get HDCP14 encrytion status based on HDMI port number 340 /// @u32HdmiPort \b IN: HDMI Port Index 341 /// @pu32HDCPStatus \b IN: MS_U32 pointer which return encrytion status 342 /// @return MS_BOOL, TRUE: success; FALSE: failed 343 //---------------------------------------------------------------- 344 MS_BOOL MDrv_HDCP_GetHDCP1Status(MS_U32 u32HdmiPort, MS_U32 *pu32HDCPStatus); 345 346 //---------------------------------------------------------------- 347 /// MDrv_HDCP_SetHDCP1Status() 348 /// Set HDCP14 encrytion status based on HDMI port number 349 /// @u32HdmiPort \b IN: HDMI Port Index 350 /// @u32HDCPStatus \b IN: Encrytion status 351 /// @return MS_BOOL, TRUE: success; FALSE: failed 352 //---------------------------------------------------------------- 353 MS_BOOL MDrv_HDCP_SetHDCP1Status(MS_U32 u32HdmiPort, MS_U32 u32HDCPStatus); 354 355 //---------------------------------------------------------------- 356 /// MDrv_HDCP_GetHDMIStatus() 357 /// Get HDMI enable status based on HDMI port number 358 /// @u32HdmiPort \b IN: HDMI Port Index 359 /// @pu32HDMIStatus \b IN: MS_U32 pointer which return HDMI enable status 360 /// @return MS_BOOL, TRUE: success; FALSE: failed 361 //---------------------------------------------------------------- 362 MS_BOOL MDrv_HDCP_GetHDMIStatus(MS_U32 u32HdmiPort, MS_U32 *pu32HDMIStatus); 363 364 //---------------------------------------------------------------- 365 /// MDrv_HDCP_SetHDMIStatus() 366 /// Set HDMI enable status based on HDMI port number 367 /// @u32HdmiPort \b IN: HDMI Port Index 368 /// @u32HDMIStatus \b IN: HDMI enable status 369 /// @return MS_BOOL, TRUE: success; FALSE: failed 370 //---------------------------------------------------------------- 371 MS_BOOL MDrv_HDCP_SetHDMIStatus(MS_U32 u32HdmiPort, MS_U32 u32HDMIStatus); 372 373 #endif //#ifndef _DRV_HDCP_H_ 374