1 #ifndef __DSCMB_PRIVATE__ 2 #define __DSCMB_PRIVATE__ 3 4 #include "regDSCMB.h" 5 6 7 #ifdef __cplusplus 8 extern "C" 9 { 10 #endif 11 12 #define MAGIC_NUM 0x12345678 13 14 typedef enum { 15 E_DSCMB_RESOURCE, 16 } eDscmbResourceId; 17 18 typedef struct 19 { 20 MS_U32 u32SlotIdOdd; 21 MS_U32 u32SlotIdEven; 22 MS_U32 u32SlotIdClear; 23 MS_U32 u32PidFltId[MAX_DSCMB_PIDFLT_NUM]; 24 MS_U32 u32PidFltIdNum; 25 MS_U32 u32DscmbId; 26 MS_BOOL bUsed; 27 MS_BOOL bDscmb; 28 DSCMB_SLOT_Type SlotType; 29 DSCMB_Type DscmbType; 30 } stDscmbTspMap; 31 32 typedef struct _DSCMB_RESOURCE_PRIVATE 33 { 34 stDscmbTspMap DscmbTspMap[ENG_NUM][MAX_NUM]; 35 MS_U32 u32FreeSlot[ENG_NUM]; 36 MS_BOOL bInited_Drv; 37 MS_U32 u32Magic; 38 } DSCMB_RESOURCE_PRIVATE; 39 40 41 typedef struct _DSCMB_INSTANT_PRIVATE 42 { 43 MS_U8 pInitVector[DSCMB_IV_LENGTH]; 44 MS_U8 pCipherKey[DSCMB_KEY_LENGTH]; 45 DSCMB_Type eType; 46 DSCMB_Key_Type eKeyType; 47 } DSCMB_INSTANT_PRIVATE; 48 49 50 // descrambler initial function 51 MS_BOOL _MDrv_DSCMB_Init(void); 52 53 // descrambler finalize function 54 MS_BOOL _MDrv_DSCMB_Exit(void); 55 56 // descrambler query function 57 MS_BOOL _MDrv_DSCMB2_GetCap(MS_U32 u32EngId, DSCMB_Query_Type eQueryType, void* pInput, void* pOutput); 58 59 // descrambler filter management 60 MS_U32 _MDrv_DSCMB2_FltAlloc_Ex(MS_U32 u32EngId, DSCMB_Flt_Type eFltType); 61 MS_BOOL _MDrv_DSCMB2_FltFree(MS_U32 u32EngId, MS_U32 u32DscmbId); 62 63 // descrambler filter maps to TSP pid 64 MS_BOOL _MDrv_DSCMB2_FltConnectPid(MS_U32 u32EngId, MS_U32 u32DscmbId, MS_U32 u32Pid); 65 MS_BOOL _MDrv_DSCMB2_FltDisconnectPid(MS_U32 u32EngId, MS_U32 u32DscmbId, MS_U32 u32Pid); 66 MS_BOOL _MDrv_DSCMB2_FltDisconnectPid_Ex(MS_U32 u32EngId, MS_U32 u32DscmbId, MS_U32 u32Pid); 67 68 // descrambler filter maps to TSP filter id 69 MS_BOOL _MDrv_DSCMB2_FltConnectFltId(MS_U32 u32EngId, MS_U32 u32DscmbId, MS_U32 u32FltId); 70 MS_BOOL _MDrv_DSCMB2_FltDisconnectFltId(MS_U32 u32EngId, MS_U32 u32DscmbId, MS_U32 u32FltId); 71 72 73 74 // Set descrambler filter as scrambling/decrambling mode 75 // Default filter mode is descrambling if this function is not specified 76 // This function should be invoked before MDrv_DSCMB_FltTypeSet 77 MS_BOOL _MDrv_DSCMB2_FltDscmb(MS_U32 u32EngId, MS_U32 u32DscmbId, MS_BOOL bDscmb); 78 79 // descrambler algorithm 80 MS_BOOL _MDrv_DSCMB2_FltTypeSet(MS_U32 u32EngId, MS_U32 u32DscmbId, DSCMB_Type); 81 82 // descrambler miscellaneous option config 83 MS_BOOL _MDrv_DSCMB2_OptConfig(MS_U32 u32EngId, DSCMB_Option eOpt, void* pInput, void* pOutput, MS_BOOL bSet); 84 85 86 #if (!( defined(TSP_VERSION) && (TSP_VERSION == TSP_VER_2_0))) 87 // descrambler altorithm related 88 MS_BOOL _MDrv_DSCMB2_Multi2_SetRound(MS_U32 u32EngId, MS_U32 u32Round); 89 MS_BOOL _MDrv_DSCMB2_Multi2_SetSystemKey(MS_U32 u32EngId, MS_U8* u8Syskey); 90 MS_BOOL _MDrv_DSCMB2_HDCP2_SetRIV(MS_U32 u32EngId, MS_U8* pu8RIV); 91 #endif 92 // descrambler key 93 MS_BOOL _MDrv_DSCMB2_FltKeySet(MS_U32 u32EngId, MS_U32 u32DscmbId, DSCMB_Key_Type eKeyType, MS_U8* pu8Key); 94 MS_BOOL _MDrv_DSCMB2_FltKeyReset(MS_U32 u32EngId, MS_U32 u32DscmbId, DSCMB_Key_Type eKeyType); 95 MS_BOOL _MDrv_DSCMB2_FltIVSet(MS_U32 u32EngId, MS_U32 u32DscmbId, DSCMB_Key_Type eKeyType, MS_U8* pu8IV); 96 MS_BOOL _MDrv_DSCMB2_FltKeyReset(MS_U32 u32EngId, MS_U32 u32DscmbId, DSCMB_Key_Type eKeyType); 97 98 // scramble status 99 MS_BOOL _MDrv_DSCMB2_PidFlt_ScmbStatus(MS_U32 u32EngId, MS_U32 u32PidFltId, SCMB_Level* pScmbLevel); 100 MS_U32 _MDrv_DSCMB2_SetPowerState(EN_POWER_MODE u16PowerState); 101 102 #ifdef CONFIG_UTOPIA_PROC_DBG_SUPPORT 103 MS_U32 DSCMBMdbIoctl(MS_U32 cmd, const void* const pArgs); 104 #endif 105 106 #ifdef __cplusplus 107 } 108 #endif 109 110 111 #endif // __DSCMB_PRIVATE__ 112 113 114