xref: /utopia/UTPA2-700.0.x/projects/tmplib/include/drvDSCMB_v2.h (revision 53ee8cc121a030b8d368113ac3e966b4705770ef)
1 #ifndef __DRV_DSCMB_V2_H__
2 #define __DRV_DSCMB_V2_H__
3 
4 #include "drvDSCMB.h"
5 
6 #ifdef __cplusplus
7 extern "C"
8 {
9 #endif
10 
11 #define DSCMB_IV_LENGTH 16
12 #define DSCMB_KEY_LENGTH 16
13 #define DSCMB_HDCP2_RIV_LENGTH 8
14 #define DSCMB_MULTI2_SYSKEY_LENGTH 32
15 
16 typedef enum {
17     E_DSCMB_ENG0,
18     E_DSCMB_ENG1,
19     E_DSCMB_ENG2,
20     E_DSCMB_UNKNOWN,
21 } eDscmbEngID;
22 
23 typedef enum {
24     /* Init and exit */
25     E_MDRV_CMD_DSCMB_Init,
26     E_MDRV_CMD_DSCMB_Exit,
27     E_MDRV_CMD_DSCMB_SetPowerState,
28 
29     E_MDRV_CMD_DSCMB_FltAlloc,
30     E_MDRV_CMD_DSCMB_FltFree,
31     E_MDRV_CMD_DSCMB_FltConnectFltId,
32     E_MDRV_CMD_DSCMB_FltConnectPid,
33     E_MDRV_CMD_DSCMB_FltDisconnectFltId,
34     E_MDRV_CMD_DSCMB_FltDisconnectPid,
35 
36     /* basic configuration*/
37     E_MDRV_CMD_DSCMB_FltDscmb,
38     E_MDRV_CMD_DSCMB_FltTypeSet,
39     E_MDRV_CMD_DSCMB_FltKeySet,
40     E_MDRV_CMD_DSCMB_FltKeyReset,
41     E_MDRV_CMD_DSCMB_FltIVSet,
42 
43     E_MDRV_CMD_DSCMB_HDCP2_SetRiv,
44     E_MDRV_CMD_DSCMB_Multi2_SetRound,
45     E_MDRV_CMD_DSCMB_Multi2_SetSysKey,
46     E_MDRV_CMD_DSCMB_PidFlt_ScmbStatus,
47     E_MDRV_CMD_DSCMB_PVR_RecCtrl,
48 
49     /* advanced configuration*/
50     E_MDRV_CMD_DSCMB_SetDefaultCAVid,
51     E_MDRV_CMD_DSCMB_EngSetAlgo,
52     E_MDRV_CMD_DSCMB_EngSetKey,
53     E_MDRV_CMD_DSCMB_EngResetKey,
54     E_MDRV_CMD_DSCMB_EngSetIV,
55     E_MDRV_CMD_DSCMB_EngSetSwitch,
56     E_MDRV_CMD_DSCMB_EngSetFSCB,
57 
58     /*Key ladder*/
59     E_MDRV_CMD_DSCMB_KLadder_AtomicExec,
60     E_MDRV_CMD_DSCMB_KLadder_ETSI,
61 
62     /*System info*/
63     E_MDRV_CMD_DSCMB_QueryCap,
64     E_MDRV_CMD_DSCMB_SetDBGLevel,
65     E_MDRV_CMD_DSCMB_GetLibVer,
66     E_MDRV_CMD_DSCMB_GetConnectStatus,
67 
68     E_MDRV_CMD_DSCMB_MAX,
69 } eDscmbIoctlOpt;
70 
71 typedef struct _DSCMB_QUERYCAP
72 {
73     MS_U32              u32EngId;
74     DSCMB_Query_Type    eQueryType;
75     void*               pInput;
76     void*               pOutput;
77 } DSCMB_QUERYCAP;
78 
79 typedef struct _DSCMB_FLTALLOC
80 {
81     MS_U32          u32EngId;
82     DSCMB_Flt_Type  eFltType;
83     MS_U32          u32DscmbId;
84 } DSCMB_FLTALLOC;
85 
86 typedef struct _DSCMB_FLTFREE
87 {
88     MS_U32          u32EngId;
89     MS_U32          u32DscmbId;
90 } DSCMB_FLTFREE;
91 
92 typedef struct _DSCMB_CONNECTFLT
93 {
94     MS_U32      u32EngId;
95     MS_U32      u32DscmbId;
96     MS_U32      u32DmxFltId;
97 } DSCMB_CONNECTFLT, DSCMB_DISCONNECTFLT, DSCMB_CONNECTSTATUS;
98 
99 typedef struct _DSCMB_CONNECTPID
100 {
101     MS_U32      u32EngId;
102     MS_U32      u32DscmbId;
103     MS_U32      u32Pid;
104 } DSCMB_CONNECTPID, DSCMB_DISCONNECTPID;
105 
106 typedef struct _DSCMB_FLTDSCMB
107 {
108     MS_U32      u32EngId;
109     MS_U32      u32DscmbId;
110     MS_BOOL     bDscmb;
111 } DSCMB_FLTDSCMB;
112 
113 typedef struct _DSCMB_FLTIVSET
114 {
115     MS_U32          u32EngId;
116     MS_U32          u32DscmbId;
117     DSCMB_Key_Type  eKeyType;
118     union {
119         MS_U8*      pu8IV;
120         MS_U8*      pu8Key;
121     };
122 } DSCMB_FLTIVSET, DSCMB_FLTKEYSET, DSCMB_ENGIV;
123 
124 typedef struct _DSCMB_FLTKEYRESET
125 {
126     MS_U32          u32EngId;
127     MS_U32          u32DscmbId;
128     DSCMB_Key_Type  eKeyType;
129 } DSCMB_FLTKEYRESET;
130 
131 typedef struct _DSCMB_TYPESET
132 {
133     MS_U32          u32EngId;
134     MS_U32          u32DscmbId;
135     DSCMB_Type      eType;
136 } DSCMB_TYPESET;
137 
138 typedef struct _DSCMB_HDCP2_SETRIV
139 {
140     MS_U32      u32EngId;
141     MS_U8*      pu8Riv;
142 } DSCMB_HDCP2_SETRIV;
143 
144 typedef struct _DSCMB_MULTI2_SETSYSKEY
145 {
146     MS_U32      u32EngId;
147     MS_U8*      pu8SysKey;
148 } DSCMB_MULTI2_SETSYSKEY;
149 
150 typedef struct _DSCMB_MULTI2_SETROUND
151 {
152     MS_U32      u32EngId;
153     MS_U32      u32Round;
154 } DSCMB_MULTI2_SETROUND;
155 
156 typedef struct _DSCMB_SCMBSTATUS
157 {
158     MS_U32      u32EngId;
159     MS_U32      u32DmxFltId;
160     SCMB_Level* pScmbLevel;
161 } DSCMB_DSCMBSTATUS;
162 
163 typedef struct _DSCMB_PVR_RECCTRL
164 {
165     MS_U32      u32EngId;
166     MS_BOOL     bEnable;
167 } DSCMB_PVR_RECCTRL;
168 
169 typedef struct _DSCMB_DEFAULT_CAVID
170 {
171     MS_U32        u32EngId;
172     MS_U32        u32CAVid;
173 } DSCMB_DEFAULT_CAVID;
174 
175 typedef struct _DSCMB_ENGFSCB
176 {
177     MS_U32        u32EngId;
178     MS_U32        u32DscmbId;
179     DSCMB_FSCB    eForceSCB;
180 } DSCMB_ENGFSCB;
181 
182 typedef struct _DSCMB_ENGSWITCH
183 {
184     MS_U32         u32EngId;
185     MS_U32         u32DscmbId;
186     DSCMB_Eng_Type eUppSwitch;
187     DSCMB_Eng_Type eLowSwitch;
188 } DSCMB_ENGSWITCH;
189 
190 typedef struct _DSCMB_ENGALGO
191 {
192     MS_U32         u32EngId;
193     MS_U32         u32DscmbId;
194     DSCMB_Eng_Type eEngType;
195     DSCMB_Algo_Cfg stConfig;
196 } DSCMB_ENGALGO;
197 
198 typedef struct _DSCMB_ENGKEY
199 {
200     MS_U32         u32EngId;
201     MS_U32         u32DscmbId;
202     DSCMB_Eng_Type eEngType;
203     DSCMB_Key_Type eKeyType;
204     MS_U8*         pu8Key;
205 } DSCMB_ENGKEY;
206 
207 typedef struct _DSCMB_ENGRESETKEY
208 {
209     MS_U32         u32EngId;
210     MS_U32         u32DscmbId;
211     DSCMB_Eng_Type eEngType;
212     DSCMB_Key_Type eKeyType;
213 } DSCMB_ENGRESETKEY;
214 
215 typedef struct _DSCMB_KL_ATOMICEXEC
216 {
217     DSCMB_KLCfg_All*   KLCfg;
218     MS_U8*             ACPU_Out;
219     DSCMB_KL_Status*   u32Status;
220 } DSCMB_KL_ATOMICEXEC;
221 
222 typedef struct _DSCMB_KL_ETSI
223 {
224     DSCMB_KLCfg_All* KLCfg;
225     MS_U8*           ACPU_Out;
226     MS_U8*           pu8Nonce;
227     MS_U8*           pu8Response;
228     DSCMB_KL_Status* u32Status;
229 } DSCMB_KL_ETSI;
230 
231 MS_U32 DSCMBOpen(void** pInstantTmp, MS_U32 u32ModuleVersion, void* pAttribute);
232 MS_U32 DSCMBClose(void* pInstantTmp);
233 MS_U32 DSCMBIoctl(void* pInstantTmp, MS_U32 u32Cmd, void* pu32Args);
234 
235 
236 #ifdef __cplusplus
237 }
238 #endif
239 
240 #endif // __DRV_DSCMB_V2_H__
241