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 drvAESDMA_v2.h 98 /// @brief AESDMA Driver Interface 99 /// @author MStar Semiconductor Inc. 100 /////////////////////////////////////////////////////////////////////////////////////////////////// 101 102 #ifndef _DRV_AESDMA_V2_H_ 103 #define _DRV_AESDMA_V2_H_ 104 105 #ifdef __cplusplus 106 extern "C" 107 { 108 #endif 109 110 //------------------------------------------------------------------------------------------------- 111 // Defines 112 //------------------------------------------------------------------------------------------------- 113 // below for utopia20 structure 114 115 116 typedef enum { 117 MDrv_CMD_AESDMA_Init, 118 MDrv_CMD_AESDMA_SetIV, 119 MDrv_CMD_AESDMA_Reset, 120 MDrv_CMD_AESDMA_SetFileInOut, 121 MDrv_CMD_AESDMA_SetKey, 122 MDrv_CMD_AESDMA_SelEng, 123 MDrv_CMD_AESDMA_Start, 124 MDrv_CMD_AESDMA_GetStatus, 125 MDrv_CMD_AESDMA_IsFinished, 126 MDrv_CMD_AESDMA_SetClk, 127 MDrv_CMD_AESDMA_SetSecureKey, 128 MDrv_CMD_AESDMA_SetPS, 129 MDrv_CMD_AESDMA_PSRelease, 130 MDrv_CMD_AESDMA_GetPSMatchedByteCNT, 131 MDrv_CMD_AESDMA_GetPSMatchedPTN, 132 MDrv_CMD_AESDMA_Notify, 133 MDrv_CMD_AESDMA_Rand, 134 MDrv_CMD_RSA_Calculate, 135 MDrv_CMD_RSA_IsFinished, 136 MDrv_CMD_RSA_Output, 137 MDrv_CMD_SHA_Calculate, 138 MDrv_CMD_AESDMA_Memcpy, 139 MDrv_CMD_SHA_CalculateManual, 140 MDrv_CMD_AESDMA_PARSER_MASKSCRMB, 141 MDrv_CMD_AESDMA_PARSER_SETSCRMBPATTERN, 142 MDrv_CMD_AESDMA_PARSER_BYPASSPID, 143 MDrv_CMD_AESDMA_PARSER_SETPID, 144 MDrv_CMD_AESDMA_PARSER_ENCRYPT, 145 MDrv_CMD_AESDMA_PARSER_DECRYPT, 146 MDrv_CMD_AESDMA_PARSER_Start, 147 MDrv_CMD_AESDMA_PARSER_SETADDEDSCRMBPATTERN, 148 MDrv_CMD_AESDMA_PARSER_QUERYPIDCOUNT, 149 MDrv_CMD_AESDMA_ENABLE_Two_Key, 150 MDrv_CMD_AESDMA_SetOddKey, 151 MDrv_CMD_AESDMA_SetOddIV, 152 MDrv_CMD_IS_SECRETKEY_IN_NORMAL_BLANK, 153 MDrv_CMD_AESDMA_SetKey_Ex, 154 MDrv_CMD_AESDMA_SetIV_Ex, 155 MDrv_CMD_HDCP_MDrv_PROCESSCIPHER, 156 MDrv_CMD_HDCP_GetHdcpCipherState, 157 158 } eAesdmaIoctlOpt; 159 160 //------------------------------------------------------------------------------------------------- 161 // Macros 162 //------------------------------------------------------------------------------------------------- 163 164 165 //------------------------------------------------------------------------------------------------- 166 // Type and Structure Declaration 167 //------------------------------------------------------------------------------------------------- 168 169 typedef struct _AESDMA_INIT 170 { 171 MS_PHY u32miu0addr; 172 MS_PHY u32miu1addr; 173 MS_U32 u32miunum; 174 }AESDMA_INIT, *PAESDMA_INIT; 175 176 typedef struct _AESDMA_FILE_INOUT 177 { 178 MS_PHY u32FileinAddr; 179 MS_U32 u32FileInNum; 180 MS_PHY u32FileOutSAddr; 181 MS_PHY u32FileOutEAddr; 182 }AESDMA_FILE_INOUT, *PAESDMA_FILE_INOUT; 183 184 typedef struct _AESDMA_SEL_ENG 185 { 186 DrvAESDMA_CipherMode eMode; 187 MS_BOOL bDescrypt; 188 }AESDMA_SEL_ENG, *PAESDMA_SEL_ENG; 189 190 typedef struct _AESDMA_SET_IV 191 { 192 MS_U32 *pInitVector; 193 }AESDMA_SET_IV, *PAESDMA_SET_IV; 194 195 typedef struct _AESDMA_SET_KEY 196 { 197 MS_U32 *pCipherKey; 198 }AESDMA_SET_KEY, *PAESDMA_SET_KEY; 199 200 typedef struct _AESDMA_SET_KEY_EX 201 { 202 const MS_U8 *pu8Key; 203 MS_U32 u32Len; 204 }AESDMA_SET_KEY_EX, *PAESDMA_SET_KEY_EX; 205 206 typedef struct _AESDMA_SET_IV_EX 207 { 208 const MS_U8 *pu8IV; 209 MS_U32 u32Len; 210 }AESDMA_SET_IV_EX, *PAESDMA_SET_IV_EX; 211 212 213 typedef struct _AESDMA_SET_PS 214 { 215 MS_U32 u32PTN; 216 MS_U32 u32Mask; 217 MS_BOOL bPSin_Enable; 218 MS_BOOL bPSout_Enable; 219 }AESDMA_SET_PS, *PAESDMA_SET_PS; 220 221 typedef struct _AESDMA_START 222 { 223 MS_BOOL bStart; 224 }AESDMA_START, *PAESDMA_START; 225 226 227 typedef struct _AESDMA_NOTIFY 228 { 229 DrvAESDMA_Event eEvents; 230 P_DrvAESDMA_EvtCallback pfCallback; 231 }AESDMA_NOTIFY, *PAESDMA_NOTIFY; 232 233 typedef struct _AESDMA_RAND 234 { 235 MS_U32 *u32PABuf; 236 MS_U32 u32Size; 237 }AESDMA_RAND, *PAESDMA_RAND; 238 239 typedef struct _RSA_CALCULATE 240 { 241 DrvAESDMA_RSASig *pstSign; 242 DrvAESDMA_RSAKey *pstKey; 243 DrvAESDMA_RSAMode eMode; 244 }RSA_CALCULATE, *PRSA_CALCULATE; 245 246 typedef struct _RSA_OUTPUT 247 { 248 DrvAESDMA_RSAMode eMode; 249 DrvAESDMA_RSAOut *pstRSAOut; 250 }RSA_OUTPUT, *PRSA_OUTPUT; 251 252 typedef struct _SHA_CALCULATE 253 { 254 DrvAESDMA_SHAMode eMode; 255 MS_PHY u32PAInBuf; 256 MS_U32 u32Size; 257 MS_PHY u32PAOutBuf; 258 }SHA_CALCULATE, *PSHA_CALCULATE; 259 260 typedef struct _SHA_CALCULATE_MANUAL 261 { 262 DrvAESDMA_HASHCFG stCfg; 263 DrvAESDMA_HASH_STAGE eStage; 264 MS_U32 u32DoneBytes; 265 MS_U8 *pu8SetIV; 266 }SHA_CALCULATE_MANUAL, *PSHA_CALCULATE_MANUAL; 267 268 typedef struct _AESDMA_PARSER_CONFIGURATIONS 269 { 270 DrvAESDMA_ScrmbPattern eScrmbPattern; 271 DrvAESDMA_ParserMode eParserMode; 272 DrvAESDMA_ScrmbPattern eAddedScrmbPattern; 273 }AESDMA_PARSER_CONFIGURATIONS, *PAESDMA_PARSER_CONFIGURATIONS; 274 275 typedef struct _AESDMA_PARSER_PID_CONFIGURATIONS 276 { 277 //Don't care PidIndex and Pid if BypassPid is true; 278 MS_BOOL bBypassPid; 279 MS_U8 u8PidIndex; 280 MS_U16 u16Pid; 281 }AESDMA_PARSER_PID_CONFIGURATIONS, *PAESDMA_PARSER_PID_CONFIGURATIONS; 282 283 typedef struct _HDCP_CIPHER 284 { 285 MS_U8 u8Idx; 286 MS_U8 pu8Riv[8]; 287 MS_U8 pu8ContentKey[16]; 288 }HDCP_CIPHER, *PHDCP_CIPHER; 289 290 typedef struct _HDCP_CIPHER_STATE 291 { 292 MS_U8 u8Idx; //Port Index. 293 MS_U8 *pu8State; //For return Status. 294 }HDCP_CIPHER_STATE, *PHDCP_CIPHER_STATE; 295 296 //------------------------------------------------------------------------------------------------- 297 // Extern Global Variabls 298 //------------------------------------------------------------------------------------------------- 299 300 //------------------------------------------------------------------------------------------------- 301 // Extern Functions 302 //------------------------------------------------------------------------------------------------- 303 304 ////////////////////////////////////////////////////////////// 305 306 #ifdef __cplusplus 307 } 308 #endif 309 310 #endif // _DRV_AESDMA_V2_H_ 311 312