xref: /utopia/UTPA2-700.0.x/mxlib/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_ES_SetStaticKey,
47     E_MDRV_CMD_DSCMB_PidFlt_ScmbStatus,
48     E_MDRV_CMD_DSCMB_PVR_RecCtrl,
49 
50     /* advanced configuration*/
51     E_MDRV_CMD_DSCMB_SetDefaultCAVid,
52     E_MDRV_CMD_DSCMB_EngSetAlgo,
53     E_MDRV_CMD_DSCMB_EngSetKeyFSCB,
54     E_MDRV_CMD_DSCMB_EngSetKey,
55     E_MDRV_CMD_DSCMB_EngResetKey,
56     E_MDRV_CMD_DSCMB_EngSetIV,
57     E_MDRV_CMD_DSCMB_EngSetSwitch,
58     E_MDRV_CMD_DSCMB_EngSetFSCB,
59 
60     /*Key ladder*/
61     E_MDRV_CMD_DSCMB_KLadder_AtomicExec,
62     E_MDRV_CMD_DSCMB_KLadder_ETSI,
63 
64     /*System info*/
65     E_MDRV_CMD_DSCMB_QueryCap,
66     E_MDRV_CMD_DSCMB_SetDBGLevel,
67     E_MDRV_CMD_DSCMB_GetLibVer,
68     E_MDRV_CMD_DSCMB_GetConnectStatus,
69     E_MDRV_CMD_DSCMB_OptConfig,
70 
71     E_MDRV_CMD_DSCMB_HDCP2_SetRiv_Ex,
72 
73     /* PayLoad Encryption */
74     E_MDRV_CMD_DSCMB_CAPVR_FlowSet,
75     E_MDRV_CMD_DSCMB_DualPath_Enable,
76     E_MDRV_CMD_DSCMB_DualPath_Disable,
77 
78     E_MDRV_CMD_DSCMB_EngSetIV_Ex,
79 
80     E_MDRV_CMD_DSCMB_MAX,
81 } eDscmbIoctlOpt;
82 
83 typedef struct DLL_PACKED _DSCMB_QUERYCAP
84 {
85     MS_U32              u32EngId;
86     DSCMB_Query_Type    eQueryType;
87     void*               pInput;
88     void*               pOutput;
89 } DSCMB_QUERYCAP;
90 
91 typedef struct DLL_PACKED _DSCMB_OPTCONFIG
92 {
93     MS_U32              u32EngId;
94     DSCMB_Option        eOpt;
95     void*               pInput;
96     void*               pOutput;
97     MS_BOOL             bSet;
98 } DSCMB_OPTCONFIG;
99 
100 typedef struct DLL_PACKED _DSCMB_FLTALLOC
101 {
102     MS_U32          u32EngId;
103     DSCMB_Flt_Type  eFltType;
104     MS_U32          u32DscmbId;
105 } DSCMB_FLTALLOC;
106 
107 typedef struct DLL_PACKED _DSCMB_FLTFREE
108 {
109     MS_U32          u32EngId;
110     MS_U32          u32DscmbId;
111 } DSCMB_FLTFREE;
112 
113 typedef struct DLL_PACKED _DSCMB_CONNECTFLT
114 {
115     MS_U32      u32EngId;
116     MS_U32      u32DscmbId;
117     MS_U32      u32DmxFltId;
118 } DSCMB_CONNECTFLT, DSCMB_DISCONNECTFLT, DSCMB_CONNECTSTATUS;
119 
120 typedef struct DLL_PACKED _DSCMB_CONNECTPID
121 {
122     MS_U32      u32EngId;
123     MS_U32      u32DscmbId;
124     MS_U32      u32Pid;
125 } DSCMB_CONNECTPID, DSCMB_DISCONNECTPID;
126 
127 typedef struct DLL_PACKED _DSCMB_FLTDSCMB
128 {
129     MS_U32      u32EngId;
130     MS_U32      u32DscmbId;
131     MS_BOOL     bDscmb;
132 } DSCMB_FLTDSCMB;
133 
134 typedef struct DLL_PACKED _DSCMB_FLTIVSET
135 {
136     MS_U32          u32EngId;
137     MS_U32          u32DscmbId;
138     DSCMB_Key_Type  eKeyType;
139     union {
140         MS_U8*      pu8IV;
141         MS_U8*      pu8Key;
142     };
143 } DSCMB_FLTIVSET, DSCMB_FLTKEYSET, DSCMB_ENGIV;
144 
145 typedef struct DLL_PACKED _DSCMB_FLTKEYRESET
146 {
147     MS_U32          u32EngId;
148     MS_U32          u32DscmbId;
149     DSCMB_Key_Type  eKeyType;
150 } DSCMB_FLTKEYRESET;
151 
152 typedef struct DLL_PACKED _DSCMB_TYPESET
153 {
154     MS_U32          u32EngId;
155     MS_U32          u32DscmbId;
156     DSCMB_Type      eType;
157 } DSCMB_TYPESET;
158 
159 typedef struct DLL_PACKED _DSCMB_HDCP2_SETRIV
160 {
161     MS_U32      u32EngId;
162     MS_U8*      pu8Riv;
163 } DSCMB_HDCP2_SETRIV;
164 
165 typedef struct DLL_PACKED _DSCMB_HDCP2_SETRIV_EX
166 {
167     MS_U32      u32EngId;
168     MS_U32      u32DscmbId;
169     MS_U8*      pu8Riv;
170 } DSCMB_HDCP2_SETRIV_EX;
171 
172 typedef struct DLL_PACKED _DSCMB_MULTI2_SETSYSKEY
173 {
174     MS_U32      u32EngId;
175     MS_U8*      pu8SysKey;
176 } DSCMB_MULTI2_SETSYSKEY;
177 
178 typedef struct DLL_PACKED _DSCMB_MULTI2_SETROUND
179 {
180     MS_U32      u32EngId;
181     MS_U32      u32Round;
182 } DSCMB_MULTI2_SETROUND;
183 
184 typedef struct DLL_PACKED _DSCMB_ES_SETSTATICKEY
185 {
186     MS_U32      u32EngId;
187     MS_U8*      pu8StaticKey;
188 } DSCMB_ES_SETSTATICKEY;
189 
190 typedef struct DLL_PACKED _DSCMB_SCMBSTATUS
191 {
192     MS_U32      u32EngId;
193     MS_U32      u32DmxFltId;
194     SCMB_Level* pScmbLevel;
195 } DSCMB_DSCMBSTATUS;
196 
197 typedef struct DLL_PACKED _DSCMB_PVR_RECCTRL
198 {
199     MS_U32      u32EngId;
200     MS_BOOL     bEnable;
201 } DSCMB_PVR_RECCTRL;
202 
203 typedef struct DLL_PACKED _DSCMB_DEFAULT_CAVID
204 {
205     MS_U32        u32EngId;
206     MS_U32        u32CAVid;
207 } DSCMB_DEFAULT_CAVID;
208 
209 typedef struct DLL_PACKED _DSCMB_ENGFSCB
210 {
211     MS_U32        u32EngId;
212     MS_U32        u32DscmbId;
213     DSCMB_FSCB    eForceSCB;
214 } DSCMB_ENGFSCB;
215 
216 typedef struct DLL_PACKED _DSCMB_ENGSWITCH
217 {
218     MS_U32         u32EngId;
219     MS_U32         u32DscmbId;
220     DSCMB_Eng_Type eUppSwitch;
221     DSCMB_Eng_Type eLowSwitch;
222 } DSCMB_ENGSWITCH;
223 
224 typedef struct DLL_PACKED _DSCMB_ENGALGO
225 {
226     MS_U32         u32EngId;
227     MS_U32         u32DscmbId;
228     DSCMB_Eng_Type eEngType;
229     DSCMB_Algo_Cfg stConfig;
230 } DSCMB_ENGALGO;
231 
232 typedef struct DLL_PACKED _DSCMB_ENGKEYFSCB
233 {
234     MS_U32         u32EngId;
235     MS_U32         u32DscmbId;
236     DSCMB_Eng_Type eEngType;
237     DSCMB_Key_Type eKeyType;
238     DSCMB_FSCB     eForceSCB;
239 } DSCMB_ENGKEYFSCB;
240 
241 typedef struct DLL_PACKED _DSCMB_ENGKEY
242 {
243     MS_U32         u32EngId;
244     MS_U32         u32DscmbId;
245     DSCMB_Eng_Type eEngType;
246     DSCMB_Key_Type eKeyType;
247     union {
248         MS_U8*      pu8IV;
249     MS_U8*         pu8Key;
250     };
251 } DSCMB_ENGKEY, DSCMB_ENGIV_EX;
252 
253 typedef struct DLL_PACKED _DSCMB_ENGRESETKEY
254 {
255     MS_U32         u32EngId;
256     MS_U32         u32DscmbId;
257     DSCMB_Eng_Type eEngType;
258     DSCMB_Key_Type eKeyType;
259 } DSCMB_ENGRESETKEY;
260 
261 typedef struct DLL_PACKED _DSCMB_CAPVR_FLOWSET
262 {
263     MS_U32           u32EngId;
264     DSCMB_CAPVR_MODE eCaMode;
265     DSCMB_TSIF       ePvrSrcTsif;
266 } DSCMB_CAPVR_FLOWSET;
267 
268 typedef struct DLL_PACKED _DSCMB_DUALPATH
269 {
270     MS_U32        u32EngId;
271     MS_U32        u32DmxFltId;
272 } DSCMB_DUALPATH;
273 
274 typedef struct DLL_PACKED _DSCMB_KL_ATOMICEXEC
275 {
276     DSCMB_KLCfg_All*   KLCfg;
277     MS_U8*             ACPU_Out;
278     DSCMB_KL_Status*   u32Status;
279 } DSCMB_KL_ATOMICEXEC;
280 
281 typedef struct DLL_PACKED _DSCMB_KL_ETSI
282 {
283     DSCMB_KLCfg_All* KLCfg;
284     MS_U8*           ACPU_Out;
285     MS_U8*           pu8Nonce;
286     MS_U8*           pu8Response;
287     DSCMB_KL_Status* u32Status;
288 } DSCMB_KL_ETSI;
289 
290 MS_U32 DSCMBOpen(void** pInstantTmp, MS_U32 u32ModuleVersion, void* pAttribute);
291 MS_U32 DSCMBClose(void* pInstantTmp);
292 MS_U32 DSCMBIoctl(void* pInstantTmp, MS_U32 u32Cmd, void* pu32Args);
293 
294 
295 #ifdef __cplusplus
296 }
297 #endif
298 
299 #endif // __DRV_DSCMB_V2_H__
300