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) 2015-2020 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 apiDMX_tee.h 98 /// @brief MStar Demux Driver Interface for Tee 99 /// @author MStar Semiconductor Inc. 100 /// @version 1.0 101 /////////////////////////////////////////////////////////////////////////////// 102 103 //------------------------------------------------- 104 /*! \defgroup DMX TEE modules 105 */ 106 //------------------------------------------------- 107 108 #ifndef __API_DMX_TEE_H__ 109 #define __API_DMX_TEE_H__ 110 111 #include "MsCommon.h" 112 113 114 #ifdef __cplusplus 115 extern "C" 116 { 117 #endif 118 119 //------------------------------------------------------------------------------------------------- 120 // Driver Capability 121 //------------------------------------------------------------------------------------------------- 122 123 //------------------------------------------------------------------------------------------------- 124 // Macro and Define 125 //------------------------------------------------------------------------------------------------- 126 // Pocily Mamager Pipie id definitation 127 #define DMX_PIPE_NULL 0xFFFFFFFF 128 #define DMX_PIPE_TSPFW 0x00000001 129 #define DMX_PIPE_TSPVQ 0x00000002 130 #define DMX_PIPE_PVR_0 0x80000000 131 #define DMX_PIPE_PVR_1 0x80000001 132 #define DMX_PIPE_PVR_2 0x80000002 133 #define DMX_PIPE_PVR_3 0x80000003 134 #define DMX_PIPE_FILE_0 0x40000000 135 #define DMX_PIPE_FILE_1 0x40000001 136 #define DMX_PIPE_FILE_2 0x40000002 137 #define DMX_PIPE_FILE_3 0x40000003 138 #define DMX_PIPE_MMFI_0 0x41000000 139 #define DMX_PIPE_MMFI_1 0x41000001 140 141 #ifdef MSOS_TYPE_OPTEE 142 typedef struct 143 { 144 MS_U32 ID[4]; //id[3]: 0, id[2]=address_h, od[1]=address_l, id[0]=length 145 }DMX_TEE_RESOURCE; 146 #endif //MSOS_TYPE_OPTEE 147 148 typedef struct _DMX_TEE_BUF_Param 149 { 150 MS_U32 u32EngId; // Engine ID 151 MS_U32 u32Opt; // Option value or MIU select number 152 MS_U32 u32BufSize; // Phsical Buffer Size 153 MS_U32 u32BufAddr; // Phsical Buffer Address 154 MS_U32 u32BufAddr_H; // Phsical Buffer Address_H 155 } DMX_TEE_BUF_Param; 156 157 typedef enum 158 { 159 E_DMX_TEECMD_SET_TSPFW_BUF, ///< For TSP FW buffer control 160 E_DMX_TEECMD_SET_TSPVQ_BUF, ///< For TSP VQ buffer control 161 E_DMX_TEECMD_SET_PVR_BUF, ///< For TSP PVR buffer control 162 E_DMX_TEECMD_SET_FILEIN_BUF, ///< For TSP Finein buffer control 163 E_DMX_TEECMD_SET_MMFI_BUF, ///< For TSP MMFI buffer control 164 } DMX_TEE_USER_CMD; 165 166 typedef enum 167 { 168 E_DMX_REE_TO_TEE_CMD_NULL, 169 E_DMX_REE_TO_TEE_CMD_FW_LoadCode, //None parameters 170 E_DMX_REE_TO_TEE_CMD_SET_VqBuf, //None parameters 171 E_DMX_REE_TO_TEE_CMD_SET_PvrBuf, //Param1: Engine id, Param2: Option 1 is reset buffer to 0 172 E_DMX_REE_TO_TEE_CMD_SET_FileinBuf, //Param1: Engine id, Param2: Buf address, Param3: Buf size 173 E_DMX_REE_TO_TEE_CMD_GET_PvrWPtr, //Param1: Engine id, Param2: Return Buf address 174 E_DMX_REE_TO_TEE_CMD_SET_MMFIBuf //Param1: Engine id, Param2: Return Buf address 175 } DMX_REE_TO_TEE_CMD_TYPE; 176 177 //----------------------------------------------------------------------------- 178 // Functions 179 //----------------------------------------------------------------------------- 180 181 182 //Used for TEE 183 //------------------------------------------------------------------------------------------------- 184 /// Create DMX Tee service task 185 /// @ingroup DMX_Tee 186 /// @return TRUE or FALSE for Pass or Fail 187 /// @note Please call this API when Tee system init, and must create this task before DMX init is called 188 //------------------------------------------------------------------------------------------------- 189 #ifdef MSOS_TYPE_NUTTX 190 MS_BOOL MApi_DMX_TEE_Create_Tee_System(void); 191 #endif 192 193 //------------------------------------------------------------------------------ 194 /// SetControl for TEE 195 /// @ingroup DMX_Tee 196 /// @param cmd \b IN : TEE user cmd 197 /// @param param \b IN : TEE control parameters 198 /// @return MS_BOOL 199 /// @note Tee set DMX setting inform to DMX 200 //------------------------------------------------------------------------------ 201 MS_BOOL MApi_DMX_TEE_SetControl(DMX_TEE_USER_CMD cmd, void* param); 202 203 //------------------------------------------------------------------------------ 204 /// Process REE commend 205 /// @param cmd \b IN : Ree Commend 206 /// @param param \b IN : TEE control parameters 207 /// @return MS_U32 Error code 208 /// @note For buffer control commend, the input parameters should be DMX_TEE_BUF_Param 209 //------------------------------------------------------------------------------ 210 MS_U32 MApi_DMX_TEE_ProcReeCmd(DMX_REE_TO_TEE_CMD_TYPE cmd, void* param); 211 212 #ifdef MSOS_TYPE_OPTEE 213 //------------------------------------------------------------------------------ 214 /// Get secure resource by Pipe ID 215 /// @param u32PipeID \b IN : Pipe ID 216 /// @param pu32MaxNRetRes \b IN : Pointer to store max request resource number 217 /// @param pResource \b OUT : Pointer to store resource data 218 /// @return MS_U32 Error code 219 //------------------------------------------------------------------------------ 220 MS_U32 MApi_DMX_GetResourceByPipeID(MS_U32 u32PipeID, MS_U32* pu32MaxNRetRes, DMX_TEE_RESOURCE* pResource); 221 222 //------------------------------------------------------------------------------ 223 /// Configure secure resource by pipe ID 224 /// @param u32PipeID \b IN : Pipe ID 225 /// @param u32SecureDMA \b IN : 0 -> non-secure dma mode; 1 -> secure dma mode 226 /// @param u32OperationMode \b IN : 0 -> unlock output; 1 -> lock output 227 /// @return MS_U32 Error code 228 //------------------------------------------------------------------------------ 229 MS_U32 MApi_DMX_ConfigPipe(MS_U32 u32PipeID, MS_U32 u32SecureDMA, MS_U32 u32OperationMode); 230 231 //------------------------------------------------------------------------------ 232 /// Check secure resource status by pipe ID 233 /// @param u32PipeID \b IN : Pipe ID 234 /// @param u32SecureDMA \b IN : 0 -> non-secure dma mode; 1 -> secure dma mode 235 /// @param u32OperationMode \b IN : 0 -> unlock output; 1 -> lock output 236 /// @return MS_U32 Status: 0 -> Configure failed; 1 -> Configure OK 237 //------------------------------------------------------------------------------ 238 MS_U32 MApi_DMX_CheckPipe(MS_U32 u32PipeID, MS_U32 u32SecureDMA, MS_U32 u32OperationMode); 239 #endif //MSOS_TYPE_OPTEE 240 241 #ifdef __cplusplus 242 } 243 #endif 244 245 #endif // #ifndef __API_DMX_TEE_H__ 246