xref: /utopia/UTPA2-700.0.x/modules/dscmb/hal/k6lite/nsk2/halDSCMB.h (revision 53ee8cc121a030b8d368113ac3e966b4705770ef)
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-2009 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   drvDscmb.h
98 /// @brief  Descrambler (Dscmb) Driver Interface
99 /// @author MStar Semiconductor,Inc.
100 /// @attention
101 ////////////////////////////////////////////////////////////////////////////////////////////////////
102 
103 #ifndef __HAL_DSCMB_H__
104 #define __HAL_DSCMB_H__
105 
106 #define DSCMB2_DBGLV_EMERG     0  //Used for emergency messages, usually those that precede a crash.
107 #define DSCMB2_DBGLV_ALERT     1  //A situation requiring immediate action.
108 #define DSCMB2_DBGLV_CRIT      2  //Critical conditions, often related to serious hardware or software failures.
109 #define DSCMB2_DBGLV_ERR       3  //Used to report error conditions; device drivers often use KERN_ERR to report hardware difficulties.
110 #define DSCMB2_DBGLV_WARNING   4  //Warnings about problematic situations that do not, in themselves, create serious problems with the system.
111 #define DSCMB2_DBGLV_NOTICE    5  //Situations that are normal, but still worthy of note. A number of security-related conditions are reported at this level.
112 #define DSCMB2_DBGLV_INFO      6  //Informational messages. Many drivers print information about the hardware they find at startup time at this level.
113 #define DSCMB2_DBGLV_DEBUG     7  //Used for debugging messages.
114 #define DSCMB2_DBGLV_ARRAY     8  //Uesd for array data.
115 
116 
117 #define NDS_IMPL                // tag for reconstructure the code
118 
119 #define HAL_DSCMB_FLT_NULL                      0xFFFFFFFFUL
120 #define PID_SLOT_INDEX_NULL                     0x7FUL
121 
122 //HAL_DSCMB_KTE_GetStatus(), for debug usage
123 #define DSCMB_PIDIDX_EN     0x80000000UL
124 #define DSCMB_KTE_VALID     0x40000000UL
125 #define DSCMB_KTE_DUAL_EN   0x10000000UL
126 #define DSCMB_KTE_LSAS_EN   0x00000001UL
127 #define DSCMB_KTE_ESA_EN    0x00000100UL
128 #define DSCMB_KTE_LSAD_EN   0x00010000UL
129 #define DSCMB_KTE_IV_EN     0x01000000UL
130 
131 #define HAL_DSCMB_RIV_MAX      16UL  //max  number of RIV slot
132 
133 #define HAL_DSCMB_KTE_MAX      128UL // 0 ~ 127 and 127 is reserved for NULL key
134 #define HAL_DSCMB_KTE_ID_NULL  127UL
135 #define HAL_DSCMB_PIDIDX_MAX   192UL
136 #define HAL_DSCMB_PIDFLT_NUM   192UL
137 #define HAL_DSCMB_TSIF_MAX      4UL
138 #define HAL_DSCMB_TSID_MAX      4UL
139 #define HAL_DSCMB_ENG_MAX       1UL
140 #define REG_DSCMB_PATH_CNT      HAL_DSCMB_TSID_MAX
141 
142 #define HAL_DSCMB_ENG_NUM               1UL
143 
144 #define HAL_DSCMB_KEY_TYPE_CLEAR        0UL
145 #define HAL_DSCMB_KEY_TYPE_EVEN         2UL
146 #define HAL_DSCMB_KEY_TYPE_ODD          3UL
147 
148 #define HAL_DSCMB_KEYLEN_MAX            16UL
149 #define HAL_DSCMB_MULTI2_SYSKEY_MAX     32UL
150 
151 #define HAL_DSCMB_ES_STATICKEY_MAX      16UL
152 
153 #define HAL_DSCMB_SPSPVR_ENG_NUM        1UL  //only one spspvr filter in dscmb(32 filter pid)
154 #define HAL_DSCMB_SPSPVR_FLT_NUM        32UL
155 //#define HAL_DSCMB_SPSPVR_BUF_NUM        1
156 
157 #define DSCMB_CAPVR_PIDTABLE_NUM  (2UL)
158 #define DSCMB_CAPVR_PIDFLT_MAX (HAL_DSCMB_SPSPVR_FLT_NUM*DSCMB_CAPVR_PIDTABLE_NUM)
159 
160 #define DEFAULT_CAVID            (0x0FUL)
161 
162 #define DSCMB_CWKL                (0UL)
163 #define DSCMB_PVRKL               (1UL)
164 
165 #define DSCMB_KL_DST_CLASS_CPU     (0x80UL)
166 #define DSCMB_KL_DST_CLASS_TSIO    (0x800UL)
167 #define DSCMB_KL_DST_CLASS_KT      (0x8000UL)
168 #define DSCMB_KL_DST_CLASS_DMA     (0x800000UL)
169 #define DSCMB_KL_DST_CLASS_SPSSPD  (0x880000UL)
170 #define DSCMB_KL_DST_CLASS_PVT     (0x80000000UL)
171 
172 //Tmp define here, need to put drvDSCMB.h in the future
173 #define    E_DSCMB_KL_DST_DMA_CSSK            0x00900000UL
174 typedef enum
175 {
176     E_HAL_DSCMB_CAVID1 = 0x0001,
177     E_HAL_DSCMB_CAVID2 = 0x0002,
178     E_HAL_DSCMB_CAVID3 = 0x0003,
179     E_HAL_DSCMB_CAVID4 = 0x0004,
180     E_HAL_DSCMB_CAVID5 = 0x0005,
181     E_HAL_DSCMB_CAVID6 = 0x0006,
182     E_HAL_DSCMB_CAVID7 = 0x0007,
183     E_HAL_DSCMB_CAVID8 = 0x0008,
184     E_HAL_DSCMB_CAVIDF = 0x000F,
185 } HAL_DSCMB_CAVID;
186 
187 typedef enum
188 {
189     E_HAL_DSCMB_MAIN_ALGO_AES    = 0,
190     E_HAL_DSCMB_MAIN_ALGO_CSA2   = 1,
191     E_HAL_DSCMB_MAIN_ALGO_DES    = 2,
192     E_HAL_DSCMB_MAIN_ALGO_TDES   = 3,
193     E_HAL_DSCMB_MAIN_ALGO_MULTI2 = 4,
194     E_HAL_DSCMB_MAIN_ALGO_CSA2_CONF =5,
195     E_HAL_DSCMB_MAIN_ALGO_CSA3   = 6,
196     E_HAL_DSCMB_MAIN_ALGO_ASA    = 7,
197     E_HAL_DSCMB_MAIN_ALGO_TCSA3  = 8,
198     E_HAL_DSCMB_MAIN_ALGO_ESSA   = 9,
199     E_HAL_DSCMB_MAIN_ALGO_DEFAULT = 0xF,
200     E_HAL_DSCMB_MAIN_ALGO_NUM,
201 } HAL_DSCMB_MainAlgo_Type;
202 
203 typedef enum
204 {
205     E_HAL_DSCMB_SUB_ALGO_MDI_CBC  = 0,
206     E_HAL_DSCMB_SUB_ALGO_MDI_RCBC = 1,
207     E_HAL_DSCMB_SUB_ALGO_MDD_CBC  = 2 ,
208     E_HAL_DSCMB_SUB_ALGO_MDD_RCBC = 3,
209     E_HAL_DSCMB_SUB_ALGO_LEADING_CLEAR = 4,
210     E_HAL_DSCMB_SUB_ALGO_ECB = 5,
211     E_HAL_DSCMB_SUB_ALGO_CBC = 6,
212     E_HAL_DSCMB_SUB_ALGO_CTR = 7,
213     E_HAL_DSCMB_SUB_ALGO_OFB = 8,
214     E_HAL_DSCMB_SUB_ALGO_AESVAR = 9 ,
215     E_HAL_DSCMB_SUB_ALGO_DEFAULT = 0xF,
216     E_HAL_DSCMB_SUB_ALGO_NUM,
217 } HAL_DSCMB_SubAlgo_Type;
218 
219 
220 typedef enum
221 {
222     E_HAL_DSCMB_RESSB_ALGO_CLR    = 0,
223     E_HAL_DSCMB_RESSB_ALGO_CTS    = 1,
224     E_HAL_DSCMB_RESSB_ALGO_SCTE52 = 2,
225     E_HAL_DSCMB_RESSB_ALGO_XORIV1 = 3,
226     E_HAL_DSCMB_RESSB_ALGO_OC_M   = 4,
227     E_HAL_DSCMB_RESSB_ALGO_XORIV2 = 5,
228     E_HAL_DSCMB_RESSB_ALGO_CTR    = 6,
229     E_HAL_DSCMB_RESSB_ALGO_DEFAULT = 0x7,
230     E_HAL_DSCMB_RESSB_ALGO_NUM,
231 } HAL_DSCMB_ResSBAlgo_Type;
232 
233 
234 typedef enum
235 {
236     E_HAL_DSCMB_ENG_LSAD = 0 ,
237     E_HAL_DSCMB_ENG_ESA  = 1  ,
238     E_HAL_DSCMB_ENG_LSAS = 2 ,
239     E_HAL_DSCMB_ENG_SWITCH   = 3 ,
240     E_HAL_DSCMB_ENG_IV_LSAD  = 4,
241     E_HAL_DSCMB_ENG_IV_ESA   = 5 ,
242     E_HAL_DSCMB_ENG_IV_LSAS  = 6 ,
243     E_HAL_DSCMB_ENG_NUM,
244 } HAL_DSCMB_KTE_WriteType;
245 
246 
247 // descrambler key ladder
248 typedef enum
249 {
250     E_HAL_DSCMB_KEY_CLEAR =             0,
251     E_HAL_DSCMB_KEY_UNDEFINE =          1,
252     E_HAL_DSCMB_KEY_EVEN  =             2,
253     E_HAL_DSCMB_KEY_ODD   =             3,
254 } HAL_DSCMB_KeyType;
255 
256 typedef enum
257 {
258     E_HAL_DSCMB_FSCB_UNCHG =             0,
259     E_HAL_DSCMB_FSCB_B00   =             1,
260     E_HAL_DSCMB_FSCB_B10   =             2,
261     E_HAL_DSCMB_FSCB_B11   =             3,
262 } HAL_DSCMB_FSCB;
263 
264 
265 typedef enum
266 {
267     E_HAL_DSCMB_SCBFIX_UNCHG  =             0,
268     E_HAL_DSCMB_SCBFIX_USESCB =             1,
269     E_HAL_DSCMB_SCBFIX_CLEAR  =             2,
270 
271     E_HAL_DSCMB_SCBFIX_ODD2EVEN =           4,
272     E_HAL_DSCMB_SCBFIX_EVEN2ODD =           5,
273 
274     E_HAL_DSCMB_SCBFIX_ODD2CLEAR  =         6,
275     E_HAL_DSCMB_SCBFIX_EVEN2CLEAR =         7,
276 
277 } HAL_DSCMB_SCBFix;
278 
279 
280 typedef enum
281 {
282     E_HAL_DSCMB_SCBFIX_LSAD =          0,
283     E_HAL_DSCMB_SCBFIX_ESA  =          1,
284     E_HAL_DSCMB_SCBFIX_LSAS =          2,
285     E_HAL_DSCMB_SCBFIX_DMXU =          3,
286     E_HAL_DSCMB_SCBFIX_DMXL =          4,
287 } HAL_DSCMB_SCBFix_EngSel;
288 
289 
290 
291 typedef enum
292 {
293     E_HAL_DSCMB_CIPHER_OUTPUT_SPS0 = 0 ,
294     E_HAL_DSCMB_CIPHER_OUTPUT_SPS1 = 1 ,
295     E_HAL_DSCMB_CIPHER_OUTPUT_SPS2 = 2 ,
296     E_HAL_DSCMB_CIPHER_OUTPUT_SPS3 = 3 ,
297     E_HAL_DSCMB_CIPHER_OUTPUT_CLR0 = 4 ,
298     E_HAL_DSCMB_CIPHER_OUTPUT_CLR1 = 5 ,
299     E_HAL_DSCMB_CIPHER_OUTPUT_CLR2 = 6 ,
300     E_HAL_DSCMB_CIPHER_OUTPUT_CLR3 = 7 ,
301     E_HAL_DSCMB_CIPHER_OUTPUT_CLR4 = 8 ,
302     E_HAL_DSCMB_CIPHER_OUTPUT_CLR5 = 9 ,
303     E_HAL_DSCMB_CIPHER_OUTPUT_TSO0 = 10 ,
304     E_HAL_DSCMB_CIPHER_OUTPUT_TSO1 = 11 ,
305 
306 } HAL_DSCMB_OutPut_Eng_Sel;
307 
308 
309 typedef enum
310 {
311     E_HAL_DSCMB_PARSER_CNT    =       0,
312     E_HAL_DSCMB_PARSER_EVENT  =       1,
313     E_HAL_DSCMB_PARSER_SCB    =       2,
314     E_HAL_DSCMB_PARSER_BADPKT =       3,
315     E_HAL_DSCMB_PARSER_2NDHIT =       4,
316     E_HAL_DSCMB_PARSER_ESA    =       5,
317     E_HAL_DSCMB_PARSER_LSA    =       6,
318     E_HAL_DSCMB_PARSER_INFO   =       7,
319 } HAL_DSCMB_PktParser_Mode;
320 
321 
322 //---------------------------
323 //   KL enumerate
324 //---------------------------
325 typedef enum
326 {
327     E_HAL_DSCMB_KL_DST_KT    = 0x0,
328     E_HAL_DSCMB_KL_DST_DMA   = 0x1,
329     E_HAL_DSCMB_KL_DST_CSSK  = 0x1,
330     E_HAL_DSCMB_KL_DST_TSIO  = 0x2,
331     E_HAL_DSCMB_KL_DST_ACPU  = 0x4,
332     E_HAL_DSCMB_KL_DST_SCPU  = 0x5,
333     E_HAL_DSCMB_KL_DST_PRI0  = 0x8,
334     E_HAL_DSCMB_KL_DST_PRI1  = 0x9,
335     E_HAL_DSCMB_KL_DST_PRI2  = 0xA,
336     E_HAL_DSCMB_KL_DST_PRI3  = 0xB,
337 
338 } HAL_DSCMB_KL_Dst;
339 
340 typedef enum
341 {
342     E_HAL_DSCMB_KL_DSTDMA_NA     = 0x0 ,
343     E_HAL_DSCMB_KL_DSTDMA_SK0    = 0x0 ,
344     E_HAL_DSCMB_KL_DSTDMA_SK1    = 0x1 ,
345     E_HAL_DSCMB_KL_DSTDMA_SK2    = 0x2 ,
346     E_HAL_DSCMB_KL_DSTDMA_SK3    = 0x3 ,
347 
348     E_HAL_DSCMB_KL_DSTDMA_SPS0   = 0xf ,
349     E_HAL_DSCMB_KL_DSTDMA_SPS1   = 0xf ,
350     E_HAL_DSCMB_KL_DSTDMA_SPS2   = 0xf ,
351     E_HAL_DSCMB_KL_DSTDMA_SPS3   = 0xf ,
352 
353     E_HAL_DSCMB_KL_DSTDMA_SPD0   = 0xf ,  //PVR
354     E_HAL_DSCMB_KL_DSTDMA_SPD1   = 0xf ,  //PVR
355     E_HAL_DSCMB_KL_DSTDMA_SPD2   = 0xf ,  //PVR
356     E_HAL_DSCMB_KL_DSTDMA_SPD3   = 0xf ,  //PVR
357     E_HAL_DSCMB_KL_DSTDMA_SPD4   = 0xf ,  //PVR
358     E_HAL_DSCMB_KL_DSTDMA_SPD5   = 0xf ,  //PVR
359     E_HAL_DSCMB_KL_DSTDMA_CSSK   = 0xf ,  //CW
360 } HAL_DSCMB_KL_DstDma;
361 
362 typedef enum
363 {
364     E_HAL_DSCMB_KL_DST_SP_NA     = 0x0 ,
365     E_HAL_DSCMB_KL_DST_SP_SPS0   = 0x4 ,
366     E_HAL_DSCMB_KL_DST_SP_SPS1   = 0x5 ,
367     E_HAL_DSCMB_KL_DST_SP_SPS2   = 0x6 ,
368     E_HAL_DSCMB_KL_DST_SP_SPS3   = 0x7 ,
369     E_HAL_DSCMB_KL_DST_SP_SPD0   = 0xC ,
370     E_HAL_DSCMB_KL_DST_SP_SPD1   = 0xD ,
371     E_HAL_DSCMB_KL_DST_SP_SPD2   = 0x8 ,
372     E_HAL_DSCMB_KL_DST_SP_SPD3   = 0x9 ,
373     E_HAL_DSCMB_KL_DST_SP_SPD4   = 0xA ,
374     E_HAL_DSCMB_KL_DST_SP_SPD5   = 0xB ,
375 } HAL_DSCMB_KL_DstSP;
376 
377 typedef enum
378 {
379     E_HAL_DSCMB_KL_DSTKT_LSAD    = 0x0 ,
380     E_HAL_DSCMB_KL_DSTKT_ESA     = 0x1 ,
381     E_HAL_DSCMB_KL_DSTKT_LSAS    = 0x2 ,
382 } HAL_DSCMB_KL_DstKT;
383 
384 
385 typedef enum
386 {
387     E_HAL_DSCMB_KL_SRC_ACPU  = 0,
388     E_HAL_DSCMB_KL_SRC_SK1   = 1,
389     E_HAL_DSCMB_KL_SRC_SK2   = 2,
390     E_HAL_DSCMB_KL_SRC_SK3   = 3,
391     E_HAL_DSCMB_KL_SRC_SK4   = 4,
392     E_HAL_DSCMB_KL_SRC_SK5   = 5,
393     E_HAL_DSCMB_KL_SRC_SK6   = 6,
394     E_HAL_DSCMB_KL_SRC_SK7   = 7,
395     E_HAL_DSCMB_KL_SRC_SK8   = 8,
396     E_HAL_DSCMB_KL_SRC_SK9   = 9,
397     E_HAL_DSCMB_KL_SRC_SK10  = 10,
398     E_HAL_DSCMB_KL_SRC_SK11  = 11,
399     E_HAL_DSCMB_KL_SRC_SK12  = 12,
400     E_HAL_DSCMB_KL_SRC_SK13  = 13,
401     E_HAL_DSCMB_KL_SRC_SK14  = 14,
402     E_HAL_DSCMB_KL_SRC_SK15  = 15,
403 
404 } HAL_DSCMB_KL_Src;
405 
406 typedef enum
407 {
408     E_HAL_DSCMB_KL_TYPE_0   = 0x0,
409     E_HAL_DSCMB_KL_TYPE_1   = 0x1,
410     E_HAL_DSCMB_KL_TYPE_2   = 0x2,
411     E_HAL_DSCMB_KL_TYPE_3   = 0x3,
412     E_HAL_DSCMB_KL_TYPE_4   = 0x4,
413     E_HAL_DSCMB_KL_TYPE_5   = 0x5,
414     E_HAL_DSCMB_KL_TYPE_1_KPR =0x9,
415     E_HAL_DSCMB_KL_TYPE_1_2   =0xA,
416     E_HAL_DSCMB_KL_TYPE_1_3   =0xB,
417     E_HAL_DSCMB_KL_TYPE_5_SMI =0xD,
418     E_HAL_DSCMB_KL_TYPE_LUT   =0xF,
419     E_HAL_DSCMB_KL_TYPE_INVALID,
420 } HAL_DSCMB_KL_Type;
421 
422 
423 typedef enum
424 {
425     E_HAL_DSCMB_KL_ALGO_TDES  = 0,
426     E_HAL_DSCMB_KL_ALGO_AES   = 1,
427 } HAL_DSCMB_KL_Algo;
428 
429 typedef struct
430 {
431     MS_U32 u32LUT; //LUT3 fill in 512 bytes table, each has 9 bits to describe
432     MS_U32 u32M;
433     MS_U32 u32BC;
434 } DSCMB_KL_TA_LUT3;
435 
436 typedef enum
437 {
438     E_HAL_DSCMB_KL_ERR_MSG_KDF,
439     E_HAL_DSCMB_KL_ERR_MSG_KL,
440     E_HAL_DSCMB_KL_ERR_MSG_AES,
441     E_HAL_DSCMB_KL_ERR_MSG_TDES,
442     E_HAL_DSCMB_KL_ERR_MSG_LSA,
443     E_HAL_DSCMB_KL_ERR_MSG_ESA,
444     E_HAL_DSCMB_KL_ERR_MSG_DMA,
445     E_HAL_DSCMB_KL_ERR_MSG_TSIO,
446     E_HAL_DSCMB_KL_ERR_MSG_UACPU,
447     E_HAL_DSCMB_KL_ERR_MSG_SEP,
448     E_HAL_DSCMB_KL_ERR_MSG_NONCE,
449     E_HAL_DSCMB_KL_ERR_MSG_TYPE,
450     E_HAL_DSCMB_KL_ERR_MSG_PRV,
451     E_HAL_DSCMB_KL_ERR_MSG_HK,
452     E_HAL_DSCMB_KL_ERR_MSG_DACPU,
453     E_HAL_DSCMB_KL_ERR_MSG_BADRK,
454     E_HAL_DSCMB_KL_ERR_MSG_ILUT,
455     E_HAL_DSCMB_KL_ERR_MSG_RSV1,
456     E_HAL_DSCMB_KL_ERR_MSG_KLTYPE,
457     E_HAL_DSCMB_KL_ERR_MSG_ZERO,
458     E_HAL_DSCMB_KL_ERR_MSG_RSV2,
459     E_HAL_DSCMB_KL_ERR_MSG_RSV3,
460     E_HAL_DSCMB_KL_ERR_MSG_KCV,
461     E_HAL_DSCMB_KL_ERR_MSG_BADIK,
462 
463 }HAL_DSCMB_KL_Err_Msg;
464 
465 
466 //---------------------------
467 //    enumerate
468 //---------------------------
469 //ts_if
470 typedef enum
471 {
472     E_HAL_DSCMB_TSIF0 = 0,
473     E_HAL_DSCMB_TSIF1 = 1,
474     E_HAL_DSCMB_TSIF2 = 2,
475     E_HAL_DSCMB_TSIF3 = 3,
476     E_HAL_DSCMB_TSIF_NUM,
477 } HAL_DSCMB_TSIF;
478 
479 //pktDmx
480 typedef enum
481 {
482     E_HAL_DSCMB_TSID0 = 0,
483     E_HAL_DSCMB_TSID1 = 1,
484     E_HAL_DSCMB_TSID2 = 2,
485     E_HAL_DSCMB_TSID3 = 3,
486     E_HAL_DSCMB_TSID_NUM,
487 } HAL_DSCMB_TSID;
488 
489 typedef enum
490 {
491     E_HAL_DSCMB_CHANNEL0 = 0,
492     E_HAL_DSCMB_CHANNEL_NUM,
493 } HAL_DSCMB_CHANNEL;
494 
495 typedef enum
496 {
497     E_HAL_DSCMB_SPSPVR_NUM,
498 } HAL_DSCMB_SPSPVR;
499 
500 
501 typedef struct
502 {
503     //for read:
504     MS_U32 ClrSlotIndex : 7; //bit[6:0] clr slot index
505     MS_U32 PktViewDbgInfo : 1; //bit[7]
506     MS_U32 OddSlotIndex : 7; //bit[14:8] odd slot index
507     MS_U32 PidSlotEn : 1; //bit[15]
508     MS_U32 EvenSlotIndex : 7; //bit[22:16] even slot index
509     MS_U32 DualSloEn : 1; //bit[23] dualpath_en
510     MS_U32 ClrSloEn : 1; //bit[24] clr slot enable
511     MS_U32 OddSloEn : 1; //bit[25] odd slot enable
512     MS_U32 EvenSloEn : 1; //bit[26] even slot enable
513     MS_U32 CA_VID : 5; //bit[31:27] cavid
514 } PidSlotMapRead_t;
515 
516 typedef struct
517 {
518     //for read:
519     MS_U32 Privileged : 1; //bit[32] privileged
520     MS_U32 SecurePidSlot : 1; //bit[33] pidslot_is_secure
521     MS_U32 Reserved : 30;
522 } PidSlotMapRead2_t;
523 
524 typedef struct
525 {
526 
527     MS_U32 ForceSCB : 2; //bit[1:0]
528     MS_U32 NDS_AES_MODE_PI : 1;
529     MS_U32 NDS_AES_MODE_EN : 1;
530     MS_U32 Reg2_reserve_4_7 : 4;
531     MS_U32 IuputSrc : 8;
532     MS_U32 LowDest : 8;
533     MS_U32 UppDest : 8;
534 
535     MS_U32 ESA_Decrypt : 1;
536     MS_U32 Reg3_reserve_1_11 : 11;
537     MS_U32 ESA_SB : 3;
538     MS_U32 Reg3_reserve_15 : 1;
539     MS_U32 ESA_RES : 3;
540     MS_U32 Reg3_reserve_19 : 1;
541     MS_U32 ESA_SubAlgo : 4;
542     MS_U32 ESA_MainAlgo : 4;
543     MS_U32 Reg3_reserve_28_31 : 4;
544 
545     MS_U32 LSAS_Decrypt : 1;
546     MS_U32 Reg4_reserve_1_11 : 11;
547     MS_U32 LSAS_SB : 3;
548     MS_U32 Reg4_reserve_15 : 1;
549     MS_U32 LSAS_RES : 3;
550     MS_U32 Reg4_reserve_19 : 1;
551     MS_U32 LSAS_SubAlgo : 4;
552     MS_U32 LSAS_MainAlgo : 4;
553     MS_U32 Reg4_reserve_28_31 : 4;
554 
555     MS_U32 LSAD_Decrypt : 1;
556     MS_U32 Reg5_reserve_1_11 : 11;
557     MS_U32 LSAD_SB : 3;
558     MS_U32 Reg5_reserve_15 : 1;
559     MS_U32 LSAD_RES : 3;
560     MS_U32 Reg5_reserve_19 : 1;
561     MS_U32 LSAD_SubAlgo : 4;
562     MS_U32 LSAD_MainAlgo : 4;
563     MS_U32 Reg5_reserve_28_31 : 4;
564 
565     MS_U32 Low_Switch : 4;
566     MS_U32 Upp_Switch : 4;
567     MS_U32 DVBCSA_Var : 5;
568     MS_U32 Reg6_reserve_13_14 : 2;
569     MS_U32 ModifyXrc : 1;
570     MS_U32 Permutation : 3;
571     MS_U32 CAVid : 5;
572     MS_U32 RegCnt : 8;
573 
574 } SwitchReg_Map_t;
575 
576 typedef struct
577 {
578 #define ErrStatusMak 0x1FFFFFFF
579 	MS_U32 Key_KDF_KeyForbidden : 1;
580 	MS_U32 Key_KL_KeyForbidden : 1;
581 	MS_U32 Key_AES_KeyForbidden : 1;
582 	MS_U32 Key_TDES_KeyForbidden : 1;
583 	MS_U32 Key_LSA_KeyForbidden : 1;
584 	MS_U32 Key_ESA_KeyForbidden : 1;
585 	MS_U32 Key_DMA_KeyForbidden : 1;
586 	MS_U32 Key_HMAC_KeyForbidden : 1;
587 	MS_U32 Key_ACPU_KeyForbidden : 1;
588 	MS_U32 Key_SEP_KeyForbidden : 1;
589 	MS_U32 Key_LUT_KeyForbidden : 1;
590 	MS_U32 Key_Type_KeyForbidden : 1;
591 	MS_U32 Key_PrivateKey_KeyForbidden : 1;
592 	MS_U32 Key_SW_KeyForbidden : 1;
593 	MS_U32 Key_Reserve : 1;
594 	MS_U32 Key_BadRootKey : 1;
595 
596 	MS_U32 KL_LUT_NotInit : 1;
597 	MS_U32 KL_LUT_GenWithoutSWReset : 1;
598 	MS_U32 KL_NotSupportKLType  : 1;
599 	MS_U32 KL_ZeroOrder : 1;
600 	MS_U32 KL_Reserve : 2;
601 	MS_U32 KL_LUT0_Err : 1;
602 	MS_U32 KL_BadInternalKey : 1;
603 
604 	MS_U32 KeyBus_Resp : 5;
605 		#define KeyBusRespMsk            0x1F
606 		#define KeyBusRespOK             0x0
607 		#define KeyBusNoSlot             0x1F
608 		#define KeyBusNotAllowToWriteKey 0x19
609 		#define KeyBusAllOneOrZeroKey    0x10
610 
611 	MS_U32 KeyBus_Done : 1;
612 
613 	MS_U32 Biss_AllowWriteKey : 1;
614 	MS_U32 Biss_WriteKeyError : 1;
615 
616 }KL_RegErrFlag_t;
617 
618 
619 #if 1 //put here temp, when sps/spd read, and want to open api, put these to drvDSCMB.h
620 typedef struct
621 {
622     MS_U32                  pPvrBuf0;       ///< DMX PVR buffer 0 starting address
623     MS_U32                  pPvrBuf1;       ///< DMX PVR buffer 1 starting address
624     MS_U32                  u32PvrBufSize0;    ///< DMX PVR buffer 0 size
625     MS_U32                  u32PvrBufSize1;    ///< DMX PVR buffer 1 size
626     MS_U32                  u32ChannelEngId;
627     MS_BOOL                 bEncrypt;
628 } DSCMB_SPSPVR_Info;
629 
630 
631 typedef enum
632 {
633     E_DSCMB_SPSPVR_ENG0 = 0 ,
634     E_DSCMB_SPSPVR_ENG1 = 1 ,
635     E_DSCMB_SPSPVR_ENG2 = 2 ,
636     E_DSCMB_SPSPVR_ENG3 = 3 ,
637     E_DSCMB_SPSPVR_ENG_NUM,
638 } DSCMB_SPSPVR_ENG;
639 
640 #endif
641 
642 typedef enum
643 {
644     // descrambler engine
645     E_HAL_DSCMB_CAP_ENGINE_NUM,
646     // descrambler slot
647     E_HAL_DSCMB_CAP_FLT_NUM,
648     // descrambler type supported
649     E_HAL_DSCMB_CAP_SUPPORT_ALGORITHM,
650     // descrambler mapping, start tsp pid filter
651     E_HAL_DSCMB_CAP_PIDFILTER_MAP_START,
652     // descrambler mapping, end tsp pid filter
653     E_HAL_DSCMB_CAP_PIDFILTER_MAP_END,
654     // share key slot max number
655     E_HAL_DSCMB_CAP_SHARE_KEY_SLOT_NUM,
656     // share key slot max number
657     E_HAL_DSCMB_CAP_SHARE_KEY_SLOT_MAX_NUM,
658     // share key region number
659     E_HAL_DSCMB_CAP_SHARE_KEY_REGION_NUM,
660     // share key region start
661     E_HAL_DSCMB_CAP_SHARE_KEY_REGION_START,
662     // share key region end
663     E_HAL_DSCMB_CAP_SHARE_KEY_REGION_END,
664 } HAL_DSCMB_Query_Type;
665 
666 
667 //--------------------------------------------------------------------------
668 //   function Declaration
669 //--------------------------------------------------------------------------
670 MS_BOOL HAL_DSCMB_SetBank(MS_VIRT u32Bank);
671 MS_BOOL HAL_DSCMB_GetBank(MS_VIRT * u32Bank);
672 MS_BOOL HAL_DSCMB_Init(void);
673 MS_BOOL HAL_DSCMB_OTPEnDSCMB(void);
674 MS_BOOL HAL_DSCMB_SetCAVid(MS_U32 u32CAVid);
675 MS_U32  HAL_DSCMB_GetCAVid(void);
676 MS_BOOL HAL_DSCMB_GetCap(MS_U32 u32EngId, HAL_DSCMB_Query_Type eQueryType, void* pInData, void* pOutData);
677 
678 void    HAL_DSCMB_ReadPidSlotMap(MS_U32 u32FltId,PidSlotMapRead_t *pReadData);
679 MS_BOOL HAL_DSCMB_CC_Respin(MS_U32 u32CHNum, MS_U32 u32Tsid, MS_BOOL bEnable);
680 
681 void   HAL_DSCMB_SetDBGLevel(MS_U32 u32Level);
682 
683 
684 //////////////////////////////////////
685 //////                                               ////
686 //////     PidSlotMap Control function     ///
687 //////                                               ////
688 //////////////////////////////////////
689 MS_BOOL HAL_DSCMB_PidIdx_SetCAVid(MS_U32 u32fltid , MS_U32 u32CAVid );
690 MS_BOOL HAL_DSCMB_PidIdx_SetTsId(MS_U32 u32fltid , MS_U32 u32TsId );
691 MS_BOOL HAL_DSCMB_PidIdx_SetSlotKeyIdx(MS_U32 u32FltId,DSCMB_Key_Type key, MS_U32 keyIdx);
692 MS_BOOL HAL_DSCMB_PidIdx_ClearSlotKeyIdx(MS_U32 u32FltId,DSCMB_Key_Type key);
693 MS_BOOL HAL_DSCMB_PidIdx_EnableSlot(MS_U32 u32FltId);
694 MS_BOOL HAL_DSCMB_PidIdx_DisableSlot(MS_U32 u32FltId);
695 MS_BOOL HAL_DSCMB_PidIdx_DualPath(MS_U32 u32fltid , MS_BOOL bDual );
696 MS_BOOL HAL_DSCMB_PidIdx_Enable(MS_U32 u32fltid , MS_BOOL bEnable);
697 MS_BOOL HAL_DSCMB_PidIdx_SetSecure(MS_U32 u32fltid , MS_BOOL bSecure);
698 MS_BOOL HAL_DSCMB_PidIdx_SetPrivilege(MS_U32 u32fltid , MS_BOOL bEnable );
699 
700 
701 ////////////////////////////////////////////
702 //////                                                          ////
703 //////     Slot Control function  (Key & Switch)   ///
704 //////                                                          ////
705 /////////////////////////////////////////////
706 
707 // Key-specific FSCB
708 #define ENABLE_KEY_FSCB
709 void HAL_DSCMB_KTE_Clear_KeyFSCB(MS_U32 u32fltid);
710 void HAL_DSCMB_KTE_Copy_KeyFSCB(MS_U32 u32fltid_Src, MS_U32 u32fltid_Dst);
711 MS_BOOL HAL_DSCMB_KTE_Write_KeyFSCB(MS_U32 u32FltId, MS_U32 u32KteSel, DSCMB_Key_Type eKeyType, HAL_DSCMB_FSCB eForceSCB);
712 
713 MS_BOOL HAL_DSCMB_KTE_Read_Switch(MS_U32 u32fltid, DSCMB_Key_Type type, MS_U32 u32CAVid, MS_U32 *u32data);
714 MS_BOOL HAL_DSCMB_KTE_Write_Key(MS_U32 u32fltid, DSCMB_Key_Type type,DSCMB_Eng_Type wtype, MS_U32 u32CAVid, MS_U8* u8key);
715 MS_BOOL HAL_DSCMB_KTE_Write_RIV(MS_U32 u32FltId, DSCMB_Key_Type eType, MS_U32 u32CAVid, MS_U8* u8key, MS_U32 u32RIVIdx);
716 MS_BOOL HAL_DSCMB_KTE_Write_IV(MS_U32 u32FltId, DSCMB_Key_Type eType, MS_U32 u32CAVid, MS_U8* u8key );
717 MS_BOOL HAL_DSCMB_KTE_Write_IV_Ex(MS_U32 u32FltId, DSCMB_Key_Type eType, DSCMB_Eng_Type wType, MS_U32 u32CAVid, MS_U8* u8key );
718 MS_BOOL HAL_DSCMB_KTE_Key_Ctrl (MS_U32 u32fltid, DSCMB_Key_Type type, DSCMB_Eng_Type wtype, MS_U32 u32CAVid, MS_BOOL bEnable );
719 MS_BOOL HAL_DSCMB_KTE_Key_Ctrl_Ex(MS_U32 u32FltId, DSCMB_Key_Type eType, DSCMB_Eng_Type wType, MS_U32 u32CAVid, MS_BOOL bEnable, MS_BOOL bIsKL);
720 MS_BOOL HAL_DSCMB_KTE_IV_Ctrl(MS_U32 u32FltId, DSCMB_Key_Type eType, MS_U32 u32CAVid, MS_BOOL bEnable );
721 MS_BOOL HAL_DSCMB_KTE_IV_Ctrl_Ex(MS_U32 u32FltId, DSCMB_Key_Type eType, DSCMB_Eng_Type wType, MS_U32 u32CAVid, MS_BOOL bEnable );
722 
723 MS_BOOL HAL_DSCMB_KTE_Write_Algo(MS_U32 u32fltid,DSCMB_Key_Type eKeyType,DSCMB_Eng_Type eEngType , MS_U32 u32CAVid,
724                                  DSCMB_MainAlgo_Type eAlgoType, DSCMB_SubAlgo_Type eSubAlgo,
725                                  DSCMB_ResSBAlgo_Type eRes, DSCMB_ResSBAlgo_Type eSB ,
726                                  MS_BOOL bDecrypt );
727 MS_BOOL HAL_DSCMB_KTE_Write_Switch(MS_U32 u32fltid, DSCMB_Key_Type eKeyType, MS_U32 u32CAVid, MS_U32 UppSwitch, MS_U32 LowSwitch);
728 MS_BOOL HAL_DSCMB_KTE_Write_Permu(MS_U32 u32fltid ,DSCMB_Key_Type eKeyType, MS_U32 u32CAVid, MS_U32 u32per);
729 MS_BOOL HAL_DSCMB_KTE_Write_SBOX(MS_U32 u32fltid ,DSCMB_Key_Type eKeyType, MS_U32 u32CAVid, MS_U32 u32Sbox, MS_BOOL bCSA2Mode);
730 MS_BOOL HAL_DSCMB_KTE_GetStatus(MS_U32 u32fltid ,DSCMB_Key_Type eKeyType, MS_U32 *KeyStatus);
731 MS_BOOL HAL_DSCMB_KTE_Write_SrcDst(MS_U32 u32fltid ,DSCMB_Key_Type eKeyType, MS_U32 u32CAVid, MS_U32 Src, MS_U32 UppDst, MS_U32 LowDst);
732 MS_BOOL HAL_DSCMB_KTE_Write_FSCB(MS_U32 u32FltId ,DSCMB_Key_Type eKeyType, MS_U32 u32CAVid, DSCMB_FSCB eForceSCB);
733 MS_BOOL HAL_DSCMB_KTE_Write_PacketSwitch(MS_U32 u32FltId ,DSCMB_Key_Type eKeyType, MS_U32 u32CAVid, DSCMB_Eng_Type eUppSwitch, DSCMB_Eng_Type eLowSwitch);
734 
735 // Set Multi2 syskey //
736 MS_BOOL HAL_DSCMB_KTE_Write_MULTI2_SysKey(MS_U8* Key , MS_U32 u32Len);
737 MS_BOOL HAL_DSCMB_KTE_Write_MULTI2_Round(MS_U32 u32Round) ;
738 
739 MS_BOOL HAL_DSCMB_KTE_HW_SEM_Lock(MS_U32 u32WaitMs);
740 MS_BOOL HAL_DSCMB_KTE_HW_SEM_Unlock(void);
741 
742 /////////////////////////////////////////////
743 //////                                                           ////
744 //////     Cipher Channel function                     ////
745 //////                                                          ////
746 /////////////////////////////////////////////
747 
748 MS_BOOL HAL_DSCMB_Cipher_DualPath(MS_U32 u32CHNum, MS_BOOL bEnable);
749 MS_BOOL HAL_DSCMB_Cipher_TCSA3(MS_U32 u32CHNum, MS_BOOL bEnable);
750 
751 MS_BOOL HAL_DSCMB_Cipher_Set_SCBFix(MS_U32 EngId ,MS_U32 u32tsif ,HAL_DSCMB_SCBFix_EngSel eEngSel ,
752                                     HAL_DSCMB_SCBFix eSCBFix);
753 
754 MS_U32 HAL_DSCMB_Cipher_Output_Ctrl(HAL_DSCMB_OutPut_Eng_Sel EngId, MS_U32 u32ChlSel , MS_BOOL bEnable , MS_BOOL bEncrypt ,
755                                     MS_U32 u32TsId , MS_U32 u32CaVid) ;
756 
757 MS_BOOL HAL_DSCMB_Cipher_ES_SetStaticKey(MS_U32 u32EngId, MS_U8 *pu8StaticKey, MS_U32 u32KeyLen);
758 
759 MS_U32 HAL_DSCMB_PktParser_Ctrl( MS_U32 u32Eng, MS_U32 u32tsif, MS_BOOL bRst, MS_U32 u32Range ,
760                                  HAL_DSCMB_PktParser_Mode u32viewer, MS_BOOL bEnable );
761 
762 // TSP control
763 void HAL_DSCMB_SetTSPCADst(MS_U32 fltId, MS_U32 u32UpDst, MS_U32 u32LowDst);
764 void HAL_DSCMB_SetTSPPidSlotMap(MS_U32 u32FltId, MS_U32 u32PidSlotMapNo);
765 void HAL_DSCMB_PidFlt_EnableKey(MS_U32 fltId, MS_BOOL bEnable);
766 void HAL_DSCMB_Get_TsidInput(MS_U32 u32FltId, MS_U32 *u32Tsid);
767 void HAL_DSCMB_ConnectPath(MS_U32 u32Idx ,MS_BOOL bEnable);
768 void HAL_DSCMB_SetTSPCAVid(MS_U32 u32Tsid, MS_U32 CAVid);
769 void HAL_DSCMB_PidFlt_2ndPid(MS_U32 u32FltId, MS_BOOL bEnable);
770 void HAL_DSCMB_PidFlt_PIDPair(MS_U32 u32FltId, MS_U32 u32PPNo, MS_BOOL bEnable);
771 MS_BOOL HAL_DSCMB_ClearPidPairStatus(MS_U32 u32TsSrc, MS_U32 u32PidPairNum);
772 MS_BOOL HAL_DSCMB_PidFlt_SetPidPair(MS_U32 u32FltIdPri, MS_U32 u32FltIdSec);
773 MS_BOOL HAL_DSCMB_PidFlt_ClearPidPair(MS_U32 u32FltIdPri, MS_U32 u32FltIdSec);
774 MS_U32  HAL_DSCMB_PidFlt_GetPid(MS_U32 u32FltId);
775 
776 // New
777 MS_U32  HAL_DSCMB_FltSrc2TSIF(DSCMB_TSIF ePidFltSrc);
778 MS_U32  HAL_DSCMB_FltSrc2PktDmx(DSCMB_TSIF ePidFltSrc);
779 MS_BOOL HAL_DSCMB_SPD_Enable(MS_U32 tsif);
780 MS_BOOL HAL_DSCMB_SPD_Disable(MS_U32 tsif);
781 MS_BOOL HAL_DSCMB_SPD_Reset(MS_U32 tsif);
782 void    HAL_DSCMB_PrintSwitchSetup(MS_U32 u32FltId, DSCMB_Key_Type type, MS_U32 u32CAVid);
783 void    HAL_DSCMB_PktParser_PrintEvent(MS_U32 event);
784 MS_U32  HAL_DSCMB_GetProgId(DSCMB_CAPVR_MODE eCaMode);
785 MS_U32  HAL_DSCMB_GetChannlId(DSCMB_TSIF ePidFltSrc);
786 MS_BOOL HAL_DSCMB_Cipher_SPS_Enable(HAL_DSCMB_OutPut_Eng_Sel EngId, MS_BOOL bEncrypt);
787 MS_BOOL HAL_DSCMB_PES_Enable(MS_U32 u32CHNum, MS_U32 u32Tsid, MS_BOOL bEnable);
788 
789 
790 // Key Ladder Functions //
791 MS_BOOL HAL_DSCMB_KL_Start( DSCMB_KL_SelEng eKLEng );
792 MS_BOOL HAL_DSCMB_KL_Reset(DSCMB_KL_SelEng eKLEng) ;
793 MS_BOOL HAL_DSCMB_KL_KeyProp(DSCMB_KL_SelEng eKLEng, MS_U32 u32CAVid, MS_U32 u32KeyUsg, MS_U32 u32KeyEtpy);
794 MS_BOOL HAL_DSCMB_KL_KeyBus_Ex(DSCMB_KL_SelEng eKLEng, MS_U32 u32FltId, MS_U32 u32Field, DSCMB_Key_Type eKeyType, DSCMB_KLDst eDst, HAL_DSCMB_FSCB eFSCB);
795 MS_BOOL HAL_DSCMB_KL_KeyBus(DSCMB_KL_SelEng eKLEng, MS_U32 u32FltId, MS_U32 u32Field, DSCMB_Key_Type eKeyType, DSCMB_KLDst eDst);
796 MS_BOOL HAL_DSCMB_KL_Ctrl(DSCMB_KL_SelEng eKLEng, DSCMB_KLEng eAlgo, DSCMB_KLType eType, DSCMB_KLSrc eSrc, DSCMB_KLDst eDst);
797 MS_BOOL HAL_DSCMB_KL_GetACPUOut(DSCMB_KL_SelEng eKLEng, MS_U8 *pu8Key, MS_U32 u32Size);
798 MS_BOOL HAL_DSCMB_KL_ACPURootKey(DSCMB_KL_SelEng eKLEng, MS_U8 *pu8Key);
799 MS_BOOL HAL_DSCMB_KL_Input(DSCMB_KL_SelEng eKLEng, MS_U32 u32In, MS_U8 *pu8Key);
800 MS_BOOL HAL_DSCMB_KL_ErrStatus(DSCMB_KL_SelEng eKLEng);
801 MS_BOOL HAL_DSCMB_KL_ErrMsg(DSCMB_KL_SelEng eKLEng, MS_U32 *pu32ErrMsg);
802 MS_BOOL HAL_DSCMB_KL_KDF_Busy(DSCMB_KL_SelEng eKLEng, MS_BOOL *pbBusy);
803 MS_BOOL HAL_DSCMB_KL_TCSA3_CHSel(MS_U32 u32Ch);
804 MS_BOOL HAL_DSCMB_KL_TCSA3_Start(void);
805 MS_BOOL HAL_DSCMB_KL_TCSA3_ActCode(MS_U8 *pu8Code, MS_U32 u32Size);
806 
807 MS_BOOL HAL_DSCMB_KL_TA_LUT3(DSCMB_KL_SelEng eKLEng, DSCMB_KL_TA_LUT3 *LUT3Tab);
808 MS_BOOL HAL_DSCMB_KL_TA_EncCW(DSCMB_KL_SelEng eKLEng, MS_U8 *pu8EncCW);
809 MS_BOOL HAL_DSCMB_KL_TA_EN(DSCMB_KL_SelEng eKLEng, MS_BOOL bTAEn);
810 
811 MS_BOOL HAL_DSCMB_KL_ETSI_Nonce(DSCMB_KL_SelEng eKLEng, MS_U8 *pu8Nonce);
812 MS_BOOL HAL_DSCMB_KL_ETSI_Response(DSCMB_KL_SelEng eKLEng, MS_U8 *pu8Response);
813 void    HAL_DSCMB_KL_KDF_Disable( DSCMB_KL_SelEng  eKLEng);
814 void    HAL_DSCMB_KL_KDF_Enable( DSCMB_KL_SelEng  eKLEng, KDF_TYPE eKDFType, MS_U16  u16AppId, KDF_HW_KEY_SEL eHWKeyId);
815 
816 MS_BOOL HAL_DSCMB_KL_SP_KeyCtrl(DSCMB_KL_SelEng  eKLEng, DSCMB_KLDst eDst);
817 MS_BOOL HAL_DSCMB_KL_SP_SetIV(DSCMB_KL_SelEng  eKLEng, MS_U8 *pu8IV);
818 MS_BOOL HAL_DSCMB_KL_SP_Start(DSCMB_KL_SelEng eKLEng);
819 
820 MS_BOOL HAL_DSCMB_KL_HW_SEM_Lock(DSCMB_KL_SelEng eKLEng, MS_U32 u32WaitMs);
821 MS_BOOL HAL_DSCMB_KL_HW_SEM_Unlock(DSCMB_KL_SelEng eKLEng);
822 
823 void HAL_DSCMB_KL_DstSecure(DSCMB_KL_SelEng eKLEng, MS_BOOL bDstSecure);
824 
825 #endif
826