xref: /utopia/UTPA2-700.0.x/modules/vdec_lite/drv/hvd_lite/drvHVD_EX.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) 2008-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   drvHVD.h
98 /// @brief  HVD Driver Interface
99 /// @author MStar Semiconductor Inc.
100 ///////////////////////////////////////////////////////////////////////////////////////////////////
101 
102 #ifndef _DRV_HVD_H_
103 #define _DRV_HVD_H_
104 
105 #ifdef __cplusplus
106 extern "C"
107 {
108 #endif
109 
110 #if (!defined(MSOS_TYPE_NUTTX) && !defined(MSOS_TYPE_OPTEE)) || defined(SUPPORT_X_MODEL_FEATURE)
111 
112 //-------------------------------------------------------------------------------------------------
113 //  Driver Capability
114 //-------------------------------------------------------------------------------------------------
115 
116 //-------------------------------------------------------------------------------------------------
117 //  Macro and Define
118 //-------------------------------------------------------------------------------------------------
119 #define MSIF_HVD_LIB_CODE                     {'H','V','D','_'}    //Lib code
120 #define MSIF_HVD_LIBVER                       {'0','C'}            //LIB version     0.0 ~ Z.Z
121 #define MSIF_HVD_BUILDNUM                     {'0','2'}            //Build Number    00 ~ 99
122 #define MSIF_HVD_CHANGELIST                   {'0','0','6','4','4','6','7','9'} //P4 ChangeList Number
123 
124 //------------------------------------------------------------------------------
125 /// @brief \b HVD_DRV_VERSION : HVD Version
126 //------------------------------------------------------------------------------
127 #define HVD_DRV_VERSION                 /* Character String for DRV/API version             */  \
128     MSIF_TAG,                           /* 'MSIF'                                           */  \
129     MSIF_CLASS,                         /* '00'                                             */  \
130     MSIF_CUS,                           /* 0x0000                                           */  \
131     MSIF_MOD,                           /* 0x0000                                           */  \
132     MSIF_CHIP,                                                                                  \
133     MSIF_CPU,                                                                                   \
134     MSIF_HVD_LIB_CODE,                  /* IP__                                             */  \
135     MSIF_HVD_LIBVER,                    /* 0.0 ~ Z.Z                                        */  \
136     MSIF_HVD_BUILDNUM,                  /* 00 ~ 99                                          */  \
137     MSIF_HVD_CHANGELIST,                /* CL#                                              */  \
138     MSIF_OS
139 
140 #define HVD_INIT_HW_MASK                            BMASK(3:0)         ///< HW Type
141     #define HVD_INIT_HW_AVC                             BITS(3:0, 0)   ///< HW deflaut: AVC 0X00
142     #define HVD_INIT_HW_AVS                             BITS(3:0, 1)   ///< HW : AVS 0X01
143     #define HVD_INIT_HW_RM                              BITS(3:0, 2)   ///< HW: RM 0X10
144     #define HVD_INIT_HW_MVC                             BITS(3:0, 3)   ///< HW: RM 0X11
145     #define HVD_INIT_HW_VP8                             BITS(3:0, 4)   ///< HW: VP8 0X100
146     #define HVD_INIT_HW_MJPEG                           BITS(3:0, 5)   ///< HW: MJPEG 0x101
147     #define HVD_INIT_HW_VP6                             BITS(3:0, 6)   ///< HW: VP6 0x110
148     #define HVD_INIT_HW_HEVC                            BITS(3:0, 7)   ///< HW: HEVC 0x111
149     #define HVD_INIT_HW_VP9                             BITS(3:0, 8)   ///< HW: VP9 0x1000
150 #define HVD_INIT_MAIN_MASK                          BMASK(5:4)         ///< main type
151     #define HVD_INIT_MAIN_FILE_RAW                      BITS(5:4, 0)   ///< main type: default: 0X00
152     #define HVD_INIT_MAIN_FILE_TS                       BITS(5:4, 1)   ///< main type: 0X01
153     #define HVD_INIT_MAIN_LIVE_STREAM                   BITS(5:4, 2)   ///< main type: 0X10
154 #define HVD_INIT_INPUT_MASK                         BMASK(6:6)         ///< process path for filling BBU table:  file mode. use drive; TSP: use tsp mode
155     #define HVD_INIT_INPUT_TSP                          BITS(6:6, 0)   ///< tsp input( default)
156     #define HVD_INIT_INPUT_DRV                          BITS(6:6, 1)   ///< driver input
157 #define HVD_INIT_START_CODE_MASK                    BMASK(7:7)         ///< AVC FILE MODE ONLY: mkv, mp4 container use.
158     #define HVD_INIT_START_CODE_REMAINED                BITS(7:7, 0)   ///< start code remained.(Defualt)
159     #define HVD_INIT_START_CODE_REMOVED                 BITS(7:7, 1)   ///< start code removed.
160 #define HVD_INIT_UTOPIA_ENVI                            BIT(8)         ///< check MIU sel and set it
161 #define HVD_INIT_DBG_FW                                 BIT(9)         ///< check FW is debug version or not
162 #define HVD_INIT_DUAL_ES_MASK                       BMASK(10:10)         ///< Dual ES buffer iput.
163     #define HVD_INIT_DUAL_ES_DISABLE                    BITS(10:10, 0)   ///< Disable Dual ES buffer input.
164     #define HVD_INIT_DUAL_ES_ENABLE                     BITS(10:10, 1)   ///< Enable Dual ES buffer input.
165 
166 //#define HVD_INIT_ENABLE_ISR_DISP            BIT( 8)        ///< enable display ISR. ISR occurs at every Vsync.
167 
168 #define HVD_RV_BROKEN_BY_US_MASK        0x80000000
169 
170 #define HVD_BBU_TAG_LIMITATION          0x200000
171 #define QUANTITY_AFTER_BROKEN_BY_US     4
172 #define QUANTITY_LENGTH                  0x1FFF00
173 #define MAX_QUANTITY                     (QUANTITY_LENGTH * QUANTITY_AFTER_BROKEN_BY_US)
174 #define MIN_BBU_VACANCY_PER_PUSH        2
175 #define MIN_BBU_VACANCY_FOR_4K2K         (MIN_BBU_VACANCY_PER_PUSH * QUANTITY_AFTER_BROKEN_BY_US)          // about 6MB
176 
177 #define HVD_MAX_DEC_NUM 2
178 
179 #define HVD_CCRB_PACKET_LENGTH      8
180 
181 #define T35_DVB_COUNTRY_CODE  0xB5
182 #define T35_DVB_PROVIDER_CODE 0x0031
183 
184 #define DTV_AFD_CODE   0x44544731
185 #define DTV_DTB1_CODE  0x47413934
186 
187 #define DTV_BAR_CODE 0x06
188 #define DTV_CC_CODE 0x03
189 #define DTV_DIRECTTV_CODE 0x2F
190 
191 #define MAX_NTSC_CC_ELE  4
192 #define MAX_NTSC_CC_BYTE (MAX_NTSC_CC_ELE << 2)
193 #define MAX_DTV_CC_BYTE  128
194 
195 #define CC_NTSC1    1
196 #define CC_NTSC2    2
197 #define CC_ATSC        4
198 #define CC_157      (CC_NTSC1|CC_NTSC2)
199 
200 #define USER_DATA_MODE_DVB_NORMAL                 0x00
201 #define USER_DATA_MODE_DIRECTTV_CC                0x01
202 #define USER_DATA_MODE_FRM_PACKING_ARRANGEMENT    0x02
203 #define USER_DATA_MODE_ATSC_CC_RAW                0x04
204 #define USER_DATA_MODE_EXTERNAL_CC_BUFFER         0x10
205 
206 #define MAX_608_CC_LEN 512
207 #define MAX_708_CC_LEN 512
208 
209 //-------------------------------------------------------------------------------------------------
210 //  Type and Structure
211 //-------------------------------------------------------------------------------------------------
212 typedef void (*HVD_InterruptCb)(void);
213 
214 
215 //-----------------------------------------------------------------------------
216 /// @brief \b Enum \b Name: EN_CC_HVD_INFO
217 /// @brief \b Enum \b Description:  The type of Close Caption Selector
218 typedef enum
219 {
220     HVD_EX_CC_SELECTOR_708_SW              = 0x0000,
221     HVD_EX_CC_SELECTOR_RINGBUFFER    = 0x0001
222 
223 } EN_CC_HVD_EX_INFO;
224 
225 //-----------------------------------------------------------------------------
226 /// @brief \b Enum \b Name: HVD_EX_Result
227 /// @brief \b Enum \b Description:  General result of HVD functions
228 //-----------------------------------------------------------------------------
229 typedef enum
230 {
231     E_HVD_EX_FAIL,                  ///< General fail cases.
232     E_HVD_EX_OK,                    ///< Action success.
233     E_HVD_EX_RET_INVALID_PARAMETER, ///< Function has invalid input.
234     E_HVD_EX_RET_ILLEGAL_ACCESS,    ///< Illegal access. like driver not initialized.
235     E_HVD_EX_RET_HARDWARE_BREAKDOWN,///< HW has no responses or impossible responses.
236     E_HVD_EX_RET_OUTOF_MEMORY,      ///< The input memory config is not enough.
237     E_HVD_EX_RET_UNSUPPORTED,       ///< Function is not supported by HVD driver.
238     E_HVD_EX_RET_TIMEOUT,           ///< Action timeout.
239     E_HVD_EX_RET_NOTREADY,          ///< Action not ready. User needs to call it again later.
240     E_HVD_EX_RET_MEMORY_OVERWIRTE,  ///< The input memory config may be overwrite.
241     E_HVD_EX_RET_QUEUE_FULL,        ///< HVD BBU queue or ES buffer is full.
242     E_HVD_EX_RET_RE_INIT,
243     E_HVD_EX_RET_NOT_RUNNING,
244     E_HVD_EX_RET_CMA_ERROR,         ///< CMA initialization error
245 } HVD_EX_Result;
246 
247 //-----------------------------------------------------------------------------
248 /// @brief \b Enum \b Name: HVD_EX_GetPlayState
249 /// @brief \b Enum \b Description:  The current HVD play state.
250 //-----------------------------------------------------------------------------
251 typedef enum
252 {
253     E_HVD_EX_GSTATE_INIT,   ///< Before or during initialization.
254     E_HVD_EX_GSTATE_PLAY,   ///< playback.
255     E_HVD_EX_GSTATE_PAUSE,  ///< decode and display are all paused.
256     E_HVD_EX_GSTATE_STOP,   ///< after stop.
257 } HVD_EX_GetPlayState;
258 
259 //-----------------------------------------------------------------------------
260 /// @brief \b Enum \b Name: HVD_EX_SyncType
261 /// @brief \b Enum \b Description:  The current mode type of HVD synchronization .
262 //-----------------------------------------------------------------------------
263 typedef enum
264 {
265     E_HVD_EX_SYNC_ATS,  ///< Live stream, or TS file mode.
266     E_HVD_EX_SYNC_PTS,  ///< only for file mode, input time stamp is PTS.
267     E_HVD_EX_SYNC_DTS,  ///< only for file mode, input time stamp is DTS.
268     E_HVD_EX_SYNC_STS,  ///< only for file mode, input time stamp is random, output should be sorted.
269 } HVD_EX_SyncType;
270 
271 //-----------------------------------------------------------------------------
272 /// @brief \b Enum \b Name: HVD_EX_DispSpeed
273 /// @brief \b Enum \b Description:  The current mode type of HVD display speed
274 //-----------------------------------------------------------------------------
275 typedef enum
276 {
277     E_HVD_EX_DISP_SPEED_FF_32X     = 32,    ///< Speed fast forward 32x.
278     E_HVD_EX_DISP_SPEED_FF_16X     = 16,    ///< Speed fast forward 16x.
279     E_HVD_EX_DISP_SPEED_FF_8X      = 8,     ///< Speed fast forward 8x.
280     E_HVD_EX_DISP_SPEED_FF_4X      = 4,     ///< Speed fast forward 4x.
281     E_HVD_EX_DISP_SPEED_FF_2X      = 2,     ///< Speed fast forward 2x.
282     E_HVD_EX_DISP_SPEED_NORMAL_1X  = 1,     ///< Normal display speed.
283     E_HVD_EX_DISP_SPEED_SF_2X      = -2,    ///< Slow forward 2X.
284     E_HVD_EX_DISP_SPEED_SF_4X      = -4,    ///< Slow forward 4X.
285     E_HVD_EX_DISP_SPEED_SF_8X      = -8,    ///< Slow forward 8X.
286     E_HVD_EX_DISP_SPEED_SF_16X     = -16,   ///< Slow forward 16X.
287     E_HVD_EX_DISP_SPEED_SF_32X     = -32,   ///< Slow forward 32X.
288 } HVD_EX_DispSpeed;
289 
290 //-----------------------------------------------------------------------------
291 /// @brief \b Enum \b Name: HVD_EX_DropDisp
292 /// @brief \b Enum \b Description:  The current mode type of HVD dropping decoded frames.
293 //-----------------------------------------------------------------------------
294 typedef enum
295 {
296     E_HVD_EX_DROP_DISPLAY_AUTO = (1 << 0),       ///< automatic drop mode, drop frame if display queue is more than threshold
297     E_HVD_EX_DROP_DISPLAY_ONCE = (1 << 1),       ///< drop once, drop the number of non-ref frames
298 } HVD_EX_DropDisp;
299 
300 //-----------------------------------------------------------------------------
301 /// @brief \b Enum \b Name: HVD_EX_FrmRateConvMode
302 /// @brief \b Enum \b Description:  The current mode type of HVD frame rate convertion.
303 //-----------------------------------------------------------------------------
304 typedef enum
305 {
306     E_HVD_EX_FRC_MODE_NORMAL,       ///< Disable FRC mode.
307     E_HVD_EX_FRC_MODE_32PULLDOWN,   ///< 3:2 pulldown mode (ex. 24p a 60i or 60p)
308     E_HVD_EX_FRC_MODE_PAL2NTSC ,    ///< PALaNTSC conversion (50i a 60i)
309     E_HVD_EX_FRC_MODE_NTSC2PAL,     ///< NTSCaPAL conversion (60i a 50i)
310     E_HVD_EX_FRC_MODE_DISP_2X,      ///< output rate is twice of input rate (ex. 30p a 60p)
311     E_HVD_EX_FRC_MODE_24_TO_50,     ///< output rate 24P->50P 48I->50I
312     E_HVD_EX_FRC_MODE_50P_60P,      ///< output rate 50P ->60P
313     E_HVD_EX_FRC_MODE_60P_50P,      ///< output rate 60P ->50P
314 } HVD_EX_FrmRateConvMode;
315 
316 //-----------------------------------------------------------------------------
317 /// @brief \b Enum \b Name: HVD_EX_Codec
318 /// @brief \b Enum \b Description:  The supported codec type.
319 //-----------------------------------------------------------------------------
320 typedef enum
321 {
322     E_HVD_EX_AVC,
323     E_HVD_EX_AVS,
324     E_HVD_EX_RM,
325     E_HVD_EX_MVC,
326     E_HVD_EX_VP8,
327     E_HVD_EX_MJPEG,
328     E_HVD_EX_VP6,
329     E_HVD_EX_HEVC,
330     E_HVD_EX_VP9,
331     E_HVD_EX_NONE,
332 } HVD_EX_Codec;
333 
334 //-----------------------------------------------------------------------------
335 /// @brief \b Enum \b Name: HVD_EX_GetModeStatus
336 /// @brief \b Enum \b Description:  The available mode information supported by HVD.
337 //-----------------------------------------------------------------------------
338 typedef enum
339 {
340     E_HVD_EX_GMODE_IS_SHOW_ERR_FRM,
341     E_HVD_EX_GMODE_IS_REPEAT_LAST_FIELD,
342     E_HVD_EX_GMODE_IS_ERR_CONCEAL,
343     E_HVD_EX_GMODE_IS_SYNC_ON,
344     E_HVD_EX_GMODE_IS_PLAYBACK_FINISH,
345     E_HVD_EX_GMODE_SYNC_MODE,
346     E_HVD_EX_GMODE_SKIP_MODE,
347     E_HVD_EX_GMODE_DROP_MODE,
348     E_HVD_EX_GMODE_DISPLAY_SPEED,
349     E_HVD_EX_GMODE_FRC_MODE,
350     E_HVD_EX_GMODE_ISR_TYPE,
351     E_HVD_EX_GMODE_IS_STEP_DISPLAY = 0x0100,
352     E_HVD_EX_GMODE_STREAM_TYPE,
353 } HVD_EX_GetModeStatus;
354 
355 //-----------------------------------------------------------------------------
356 /// @brief \b Enum \b Name: HVD_EX_SkipDecode
357 /// @brief \b Enum \b Description:  The HVD decoding frame types.
358 //-----------------------------------------------------------------------------
359 typedef enum
360 {
361     E_HVD_EX_SKIP_DECODE_ALL,  ///< decode all frames
362     E_HVD_EX_SKIP_DECODE_I,    ///< decode I frames only
363     E_HVD_EX_SKIP_DECODE_IP,   ///< decode I and referenced frames only( skip non-ref frames)
364 } HVD_EX_SkipDecode;
365 
366 //-----------------------------------------------------------------------------
367 /// @brief \b Enum \b Name: HVD_EX_FrmType
368 /// @brief \b Enum \b Description:  The frame type.
369 //-----------------------------------------------------------------------------
370 typedef enum
371 {
372     E_HVD_EX_FRM_TYPE_I,        ///< I frame.
373     E_HVD_EX_FRM_TYPE_P,        ///< P frame.
374     E_HVD_EX_FRM_TYPE_B,        ///< B frame.
375     E_HVD_EX_FRM_TYPE_OTHER,    ///reservase
376 } HVD_EX_FrmType;
377 
378 //-----------------------------------------------------------------------------
379 /// @brief \b Enum \b Name: HVD_EX_FieldType
380 /// @brief \b Enum \b Description:  The Field type.
381 //-----------------------------------------------------------------------------
382 typedef enum
383 {
384     E_HVD_EX_FIELDTYPE_NONE,    ///< no field.
385     E_HVD_EX_FIELDTYPE_TOP,     ///< Top field only.
386     E_HVD_EX_FIELDTYPE_BOTTOM,  ///< Bottom field only.
387     E_HVD_EX_FIELDTYPE_BOTH,    ///< Both fields.
388 } HVD_EX_FieldType;
389 
390 //-----------------------------------------------------------------------------
391 /// @brief \b Enum \b Name: HVD_EX_UartLevel
392 /// @brief \b Enum \b Description:  The debug level of HVD.
393 //-----------------------------------------------------------------------------
394 typedef enum
395 {
396     E_HVD_EX_UART_LEVEL_NONE = 0,   ///< Disable all uart message.
397     E_HVD_EX_UART_LEVEL_ERR,        ///< Only output error message
398     E_HVD_EX_UART_LEVEL_INFO,       ///< output general message, and above.
399     E_HVD_EX_UART_LEVEL_DBG,        ///< output debug message, and above.
400     E_HVD_EX_UART_LEVEL_TRACE,      ///< output function trace message, and above.
401     E_HVD_EX_UART_LEVEL_FW,         ///< output FW message, and above.
402 } HVD_EX_UartLevel;
403 
404 //-----------------------------------------------------------------------------
405 /// @brief \b Enum \b Name: HVD_EX_PatternInfo
406 /// @brief \b Enum \b Description:  The information type of specific pattern.
407 //-----------------------------------------------------------------------------
408 typedef enum
409 {
410     E_HVD_EX_FLUSH_PATTERN_SIZE,    ///< flush pattern size.
411     E_HVD_EX_DUMMY_HW_FIFO,         ///< HW fifo size.
412 } HVD_EX_PatternInfo;
413 
414 //-----------------------------------------------------------------------------
415 /// @brief \b Enum \b Name: HVD_EX_DynamicScalingInfo
416 /// @brief \b Enum \b Description:  The information type of specific dynamic information.
417 //-----------------------------------------------------------------------------
418 typedef enum
419 {
420     E_HVD_EX_DS_BUF_MIUSEL,       ///< the HW MIU selection of the buffer of dynamic scaling. TRUE: MIU 1. FALSE: MIU 0.
421     E_HVD_EX_DS_BUF_ADDR,         ///< the start physical address of the buffer of dynamic scaling.
422     E_HVD_EX_DS_BUF_SIZE,         ///< the size of the buffer of dynamic scaling.
423     E_HVD_EX_DS_VECTOR_DEPTH,     ///< the required vector depth of the dynamic scaling.
424     E_HVD_EX_DS_INFO_ADDR,        ///< the scaler info buffer address of dynamic scaling.
425     E_HVD_EX_DS_IS_ENABLED,       ///< if dynamic scaling is enabled.
426 } HVD_EX_DynamicScalingInfo;
427 
428 typedef enum
429 {
430     E_HVD_EX_FLUSH_NONE = 0,
431     E_HVD_EX_FLUSH_RUNNING,     //HK -> FW
432     E_HVD_EX_FLUSH_DONE         //FW -> HK
433 
434 }HVD_EX_FlushStatus;
435 
436 
437 //-----------------------------------------------------------------------------
438 /// @brief \b Enum \b Name: HVD_EX_IsrEvent
439 /// @brief \b Enum \b Description:  The information type of ISR event.
440 //-----------------------------------------------------------------------------
441 typedef enum
442 {
443     E_HVD_EX_ISR_NONE = 0,                        ///< disable ISR
444     E_HVD_EX_ISR_DISP_ONE = BIT(0),               ///< HVD display one frame on screen.
445     E_HVD_EX_ISR_DISP_REPEAT = BIT(1),            ///< The current displayed frame is repeated frame.
446     E_HVD_EX_ISR_DISP_WITH_CC = BIT(2),           ///< Current displayed frame should be displayed with user data.
447     E_HVD_EX_ISR_DISP_FIRST_FRM = BIT(3),         ///< HVD display first frame on screen.
448 
449     E_HVD_EX_ISR_DEC_ONE = BIT(8),                ///< HVD decoded one frame done.
450     E_HVD_EX_ISR_DEC_I = BIT(9),                  ///< HVD decoded one I frame done.
451     E_HVD_EX_ISR_DEC_HW_ERR = BIT(10),            ///< HVD HW found decode error.
452     E_HVD_EX_ISR_DEC_CC_FOUND = BIT(11),          ///< HVD found one user data with decoded frame.
453     E_HVD_EX_ISR_DEC_DISP_INFO_CHANGE = BIT(12),  ///< HVD found display information change.
454     E_HVD_EX_ISR_DEC_DATA_ERR = BIT(13),          ///< HVD HW found decode error.
455     E_HVD_EX_ISR_DEC_FIRST_FRM = BIT(14),         ///< HVD decode first frame.
456     E_HVD_EX_ISR_DEC_SEQ_HDR_FOUND = BIT(15),         ///< HVD decode first frame.
457 } HVD_EX_IsrEvent;
458 
459 //-----------------------------------------------------------------------------
460 /// @brief \b Enum \b Name: HVD_EX_GetFrmInfoType
461 /// @brief \b Enum \b Description:  The information type of get frame information.
462 //-----------------------------------------------------------------------------
463 typedef enum
464 {
465     E_HVD_EX_GFRMINFO_DISPLAY = 0,  ///< Displayed frame.
466     E_HVD_EX_GFRMINFO_DECODE,       ///< Decoded frame.
467     E_HVD_EX_GFRMINFO_NEXT_DISPLAY, ///< Next frame to be displayed.
468     E_HVD_EX_GFRMINFO_DISPLAY_SUB,  ///< Displayed sub frame.
469     E_HVD_EX_GFRMINFO_DECODE_SUB,   ///< Decoded sub frame.
470     E_HVD_EX_GFRMINFO_LAST_DISPLAY,
471     E_HVD_EX_GFRMINFO_LAST_DISPLAY_EX,
472 } HVD_EX_GetFrmInfoType;
473 
474 //-----------------------------------------------------------------------------
475 /// @brief \b Enum \b Name: HVD_EX_GDataType
476 /// @brief \b Enum \b Description:  The information type of get data
477 //-----------------------------------------------------------------------------
478 typedef enum
479 {
480     E_HVD_EX_GDATA_TYPE_DISP_CNT,
481     E_HVD_EX_GDATA_TYPE_SKIP_CNT,
482     E_HVD_EX_GDATA_TYPE_DROP_CNT,
483     E_HVD_EX_GDATA_TYPE_IDLE_CNT,
484     E_HVD_EX_GDATA_TYPE_VSYNC_CNT,
485     E_HVD_EX_GDATA_TYPE_MAIN_LOOP_CNT,
486     E_HVD_EX_GDATA_TYPE_AVC_LEVEL_IDC,
487     E_HVD_EX_GDATA_TYPE_DISP_Q_SIZE,
488     E_HVD_EX_GDATA_TYPE_ES_LEVEL,
489     E_HVD_EX_GDATA_TYPE_AVC_VUI_DISP_INFO,
490     E_HVD_EX_GDATA_TYPE_DISP_STC,
491     E_HVD_EX_GDATA_TYPE_USERDATA_IDX_TBL_SIZE,
492     E_HVD_EX_GDATA_TYPE_USERDATA_PACKET_SIZE,
493     E_HVD_EX_GDATA_TYPE_REAL_FRAMERATE,
494     E_HVD_EX_GDATA_TYPE_IS_ORI_INTERLACE_MODE,
495     E_HVD_EX_GDATA_TYPE_FRAME_MBS_ONLY_FLAG,
496     E_HVD_EX_GDATA_TYPE_FW_CODEC_TYPE,
497     E_HVD_EX_GDATA_TYPE_FRC_MODE,
498     E_HVD_EX_GDATA_TYPE_IS_LEAST_DISPQ_SIZE,
499     E_HVD_EX_GDATA_TYPE_FIELD_PIC_FLAG,
500     E_HVD_EX_GDATA_TYPE_FW_STATUS_FLAG,
501     E_HVD_EX_GDATA_TYPE_HVD_HW_MAX_PIXEL,
502 #ifdef VDEC3
503     E_HVD_EX_GDATA_TYPE_VBBU_ADDR,
504 #endif
505     E_HVD_EX_GDATA_TYPE_VIDEO_FULL_RANGE_FLAG,
506     E_HVD_EX_GDATA_TYPE_SEQ_CHANGE_INFO,
507     E_HVD_EX_GDATA_TYPE_GET_NOT_SUPPORT_INFO,
508     E_HVD_EX_GDATA_TYPE_GET_MIN_TSP_DATA_SIZE
509 } HVD_EX_GDataType;
510 
511 //-----------------------------------------------------------------------------
512 /// @brief \b Enum \b Name: HVD_EX_GDataType
513 /// @brief \b Enum \b Description:  The type of set settings
514 //-----------------------------------------------------------------------------
515 typedef enum
516 {
517     E_HVD_EX_SSET_TIME_UNIT,            ///< set the HVD time unit of all interface. HVD_TimeUnit_Type
518     E_HVD_EX_SSET_PITCH,                ///< set the pitch of vsync.
519     E_HVD_EX_SSET_SYNC_EACH_FRM,        ///< HVD does sync action at every frame. TREU: turn on; FALSE: turn off.
520     E_HVD_EX_SSET_MAX_DEC_TICK,         ///< HVD limits the max decode ticks for one field.
521     E_HVD_EX_SSET_AUTO_FREE_ES,         ///< HVD frees the ES buffer data when ES is being fulled.
522     E_HVD_EX_SSET_MIN_FRAME_GAP,        ///< set HVD not to report error which is caused by the frame gap larger than min frame gap.
523     E_HVD_EX_SSET_DISABLE_DEBLOCKING,   ///< HVD will not do deblocking process.
524     E_HVD_EX_SSET_DISABLE_QUARTER_PIXEL,///< HVD will not do quarter pixel process.
525     E_HVD_EX_SSET_MIU_BURST_CNT_LEVEL,  ///< HVD MIU Burst Cnt, Arg 0~7: burst cnt level, 0xFFFFFFFF = Disable
526 } HVD_EX_SSettingsType;
527 
528 //-----------------------------------------------------------------------------
529 /// @brief \b Enum \b Name: HVD_EX_PatternType
530 /// @brief \b Enum \b Description:  The type of special pattern for specific purpose.
531 //-----------------------------------------------------------------------------
532 typedef enum
533 {
534     E_HVD_EX_PATTERN_FLUSH = 0,           ///< Used after MDrv_HVD_Flush().
535     E_HVD_EX_PATTERN_FILEEND,             ///< Used after MDrv_HVD_EX_SetDataEnd().
536 } HVD_EX_PatternType;
537 
538 //-----------------------------------------------------------------------------
539 /// @brief \b Enum \b Name: HVD_EX_ESLevel
540 /// @brief \b Enum \b Description:  The level of ES buffer.
541 //-----------------------------------------------------------------------------
542 typedef enum
543 {
544     E_HVD_EX_ES_LEVEL_NORMAL = 0,
545     E_HVD_EX_ES_LEVEL_UNDER = BIT(0),
546     E_HVD_EX_ES_LEVEL_OVER = BIT(1),
547 } HVD_EX_ESLevel;
548 
549 //-----------------------------------------------------------------------------
550 /// @brief \b Enum \b Name: HVD_EX_ErrorCode
551 /// @brief \b Enum \b Description:  The type of HVD error
552 //-----------------------------------------------------------------------------
553 typedef enum
554 {
555     E_HVD_EX_ERRCODE_GENERAL_BASE = 0x0000,
556     E_HVD_EX_ERRCODE_OUT_OF_SPEC,
557     E_HVD_EX_ERRCODE_UNKNOW_ERR,
558     E_HVD_EX_ERRCODE_HW_BREAK_DOWN,
559     E_HVD_EX_ERRCODE_HW_DEC_TIMEOUT,
560     E_HVD_EX_ERRCODE_OUT_OF_MEMORY,
561     E_HVD_EX_ERRCODE_UNKNOWN_CODEC,
562     E_HVD_EX_ERRCODE_RES_NOT_SUPPORT,
563 
564     // AVC
565     E_HVD_EX_ERRCODE_AVC_BASE = 0x1000,
566     E_HVD_EX_ERRCODE_AVC_SPS_BROKEN,           // SPS is not valid
567     E_HVD_EX_ERRCODE_AVC_SPS_NOT_IN_SPEC,
568     E_HVD_EX_ERRCODE_AVC_SPS_NOT_ENOUGH_FRM,   // DPB size at specified level is smaller than the specified number of reference frames. This is not allowed
569     E_HVD_EX_ERRCODE_AVC_PPS_BROKEN,           // PPS is not valid
570     E_HVD_EX_ERRCODE_AVC_REF_LIST,
571     E_HVD_EX_ERRCODE_AVC_NO_REF,
572     E_HVD_EX_ERRCODE_AVC_RES,
573 
574     // AVS
575     E_HVD_EX_ERRCODE_AVS_BASE = (0x2000),
576     E_HVD_EX_ERRCODE_AVS_RES,
577 
578     // RM
579     E_HVD_EX_ERRCODE_RM_BASE = (0x3000),
580     E_HVD_EX_ERRCODE_RM_PACKET_HEADER,
581     E_HVD_EX_ERRCODE_RM_FRAME_HEADER,
582     E_HVD_EX_ERRCODE_RM_SLICE_HEADER,
583     E_HVD_EX_ERRCODE_RM_BYTE_CNT,
584     E_HVD_EX_ERRCODE_RM_DISP_TIMEOUT,
585     E_HVD_EX_ERRCODE_RM_NO_REF,
586     E_HVD_EX_ERRCODE_RM_RES,                    // out of supported resolution
587     E_HVD_EX_ERRCODE_RM_VLC,
588     E_HVD_EX_ERRCODE_RM_SIZE_OUT_FB_LAYOUT,
589 } HVD_EX_ErrorCode;
590 
591 //-----------------------------------------------------------------------------
592 /// @brief \b Enum \b Name: HVD_TurboInitLevel
593 /// @brief \b Enum \b Description:  The level of turbo init mode.
594 //-----------------------------------------------------------------------------
595 typedef enum
596 {
597     E_HVD_EX_TURBOINIT_NONE        = 0,     ///< Not omit any process.
598     E_HVD_EX_TURBOINIT_CHECK       = BIT(0),     ///< Omit checking.
599     E_HVD_EX_TURBOINIT_MEMORY      = BIT(1),     ///< Omit memory reset process.
600     E_HVD_EX_TURBOINIT_DISPLAY     = BIT(2),     ///< Omit FW display setup process.
601     E_HVD_EX_TURBOINIT_FW_RELOAD   = BIT(3), ///< Omit FW reload process.
602 } HVD_EX_TurboInitType;
603 
604 //-----------------------------------------------------------------------------
605 /// @brief \b Enum \b Name: HVD_EX_FWSourceType
606 /// @brief \b Enum \b Description:  The type of fw binary input source
607 //-----------------------------------------------------------------------------
608 typedef enum
609 {
610     E_HVD_EX_FW_SOURCE_NONE,       ///< No input FW; FW will be loaded by VDEC library.
611     E_HVD_EX_FW_SOURCE_DRAM,       ///< input source from DRAM.
612     E_HVD_EX_FW_SOURCE_FLASH,      ///< input source from FLASH.
613 } HVD_EX_FWSourceType;
614 
615 //-----------------------------------------------------------------------------
616 /// @brief \b Enum \b Name: HVD_EX_DumpStatus
617 /// @brief \b Enum \b Description:  The type of fw binary input source
618 //-----------------------------------------------------------------------------
619 typedef enum
620 {
621     E_HVD_EX_DUMP_STATUS_DRV   = BIT(0),       ///< Dump Driver status
622     E_HVD_EX_DUMP_STATUS_FW    = BIT(1),       ///< Dump firmware status
623     E_HVD_EX_DUMP_STATUS_HW    = BIT(2),       ///< Dump hardware status
624 } HVD_EX_DumpStatus;
625 
626 // VDEC SEQ change info, must match VDEC_SpsChangeInfo in fwHVD_if.h
627 typedef enum
628 {
629     E_HVD_SEQ_CHANGE_NONE              = 0,         ///< unknown sps change info
630     E_HVD_SEQ_CHANGE_FIRST_TIME        = BIT(0),    ///< seq change due to first sequence
631     E_HVD_SEQ_CHANGE_RESOLUTION        = BIT(1),    ///< seq chagne due to resolution
632     E_HVD_SEQ_CHANGE_PICTURE_TYPE      = BIT(2),    ///< seq chagne due to picture type
633     E_HVD_SEQ_CHANGE_ASPECT_RATIO      = BIT(3),    ///< seq chagne due to aspect ratio
634     E_HVD_SEQ_CHANGE_FRAME_RATE        = BIT(4),    ///< seq chagne due to frame rate
635     E_HVD_SEQ_CHANGE_HDR_INFO          = BIT(5),    ///< seq chagne due to HDR info
636 } HVD_SeqChangeInfo;
637 
638 typedef enum
639 {
640     E_HVD_EX_DRV_STREAM_NONE = 0,
641     E_HVD_EX_DRV_MAIN_STREAM,
642     E_HVD_EX_DRV_SUB_STREAM,
643     E_HVD_EX_DRV_MVC_STREAM,
644 #ifdef VDEC3
645     E_HVD_EX_DRV_N_STREAM,
646 #endif
647 } HVD_EX_DRV_StreamType;
648 
649 typedef enum
650 {
651     E_HVD_EX_FB_REDUCTION_NONE = 0,        ///< FB reduction disable
652     E_HVD_EX_FB_REDUCTION_1_2 = 1,         ///< FB reduction 1/2
653     E_HVD_EX_FB_REDUCTION_1_4 = 2,         ///< FB reduction 1/4
654 } HVD_EX_FBReductionType;
655 
656 typedef enum
657 {
658     E_HVD_EX_CLOCK_SPEED_NONE = 0,
659     E_HVD_EX_CLOCK_SPEED_HIGHEST,
660     E_HVD_EX_CLOCK_SPEED_HIGH,
661     E_HVD_EX_CLOCK_SPEED_MEDIUM,
662     E_HVD_EX_CLOCK_SPEED_LOW,
663     E_HVD_EX_CLOCK_SPEED_LOWEST,
664     E_HVD_EX_CLOCK_SPEED_DEFAULT,
665 } HVD_EX_ClockSpeed;
666 
667 
668 typedef enum
669 {
670     E_HVD_EX_ES_BUF_STATUS_UNKNOWN   = 0,
671     E_HVD_EX_ES_BUF_STATUS_UNDERFLOW = 1,
672     E_HVD_EX_ES_BUF_STATUS_OVERFLOW  = 2,
673     E_HVD_EX_ES_BUF_STATUS_NORMAL    = 3,
674 
675 }HVD_EX_ES_Buf_Status;
676 
677 
678 //HVD set MFcodec Mode
679 typedef enum
680 {
681     E_HVD_EX_MFCODEC_DEFAULT = 0,
682     E_HVD_EX_MFCODEC_FORCE_ENABLE,
683     E_HVD_EX_MFCODEC_FORCE_DISABLE,
684 }HVD_EX_MFCodec_mode;
685 
686 //HVD set Display Mode
687 typedef enum
688 {
689     E_HVD_EX_DISPLAY_MODE_DEFAULT,
690     E_HVD_EX_DISPLAY_MODE_MCU,
691     E_HVD_EX_DISPLAY_MODE_HARDWIRE,
692 }HVD_EX_Display_mode;
693 
694 
695 //set VDEC Feature
696 typedef enum
697 {
698     E_HVD_EX_FEATURE_DEFAULT = 0,
699     E_HVD_EX_FEATURE_FORCE_MAIN_PROFILE = 1, //BIT0=1: HEVC Only support Main profile decode
700 } HVD_EX_Feature;
701 
702 #if defined(MSOS_TYPE_LINUX)
703 #if 1
704 #define CMA_DRV_DIRECT_INIT
705 #else
706 #define CMA_FW_INIT
707 #endif
708 #endif
709 
710 //#ifdef CMA_DRV_DIRECT_INIT
711 /// input source select enumerator
712 typedef enum
713 {
714     ///DTV mode
715     E_HVD_EX_SRC_MODE_DTV = 0,
716     ///TS file mode
717     E_HVD_EX_SRC_MODE_TS_FILE,
718     ///generic file mode
719     E_HVD_EX_SRC_MODE_FILE,
720     /// TS file and dual ES buffer mode
721     E_HVD_EX_SRC_MODE_TS_FILE_DUAL_ES,
722     ///generic file and dual ES buffer mode
723     E_HVD_EX_SRC_MODE_FILE_DUAL_ES,
724 } HVD_EX_SrcMode;
725 //#endif
726 
727 /// codec type enumerator
728 typedef enum
729 {
730     ///unsupported codec type
731     E_HVD_EX_CODEC_TYPE_NONE = 0,
732     ///MPEG 1/2
733     E_HVD_EX_CODEC_TYPE_MPEG2,
734     ///H263 (short video header)
735     E_HVD_EX_CODEC_TYPE_H263,
736     ///MPEG4 (default)
737     E_HVD_EX_CODEC_TYPE_MPEG4,
738     ///MPEG4 (Divx311)
739     E_HVD_EX_CODEC_TYPE_DIVX311,
740     ///MPEG4 (Divx412)
741     E_HVD_EX_CODEC_TYPE_DIVX412,
742     ///FLV
743     E_HVD_EX_CODEC_TYPE_FLV,
744     ///VC1 advanced profile (VC1)
745     E_HVD_EX_CODEC_TYPE_VC1_ADV,
746     ///VC1 main profile (RCV)
747     E_HVD_EX_CODEC_TYPE_VC1_MAIN,
748     ///Real Video version 8
749     E_HVD_EX_CODEC_TYPE_RV8,
750     ///Real Video version 9 and 10
751     E_HVD_EX_CODEC_TYPE_RV9,
752     ///H264
753     E_HVD_EX_CODEC_TYPE_H264,
754     ///AVS
755     E_HVD_EX_CODEC_TYPE_AVS,
756     ///MJPEG
757     E_HVD_EX_CODEC_TYPE_MJPEG,
758     ///MVC
759     E_HVD_EX_CODEC_TYPE_MVC,
760     ///VP8
761     E_HVD_EX_CODEC_TYPE_VP8,
762     ///HEVC
763     E_HVD_EX_CODEC_TYPE_HEVC,
764     ///VP9
765     E_HVD_EX_CODEC_TYPE_VP9,
766     E_HVD_EX_CODEC_TYPE_NUM
767 } HVD_EX_CodecType;
768 
769 typedef enum
770 {
771     E_HVD_EX_GET_DV_SUPPORT_PROFILE = 0,
772     E_HVD_EX_GET_DV_SUPPORT_LEVEL,
773     E_HVD_EX_SET_DV_INFO,//set profile and level
774 } HVD_EX_DV_CMD_TYPE;
775 
776 //-----------------------------------------------------------------------------
777 /// @brief \b Struct \b Name: HVD_EX_DispInfo
778 /// @brief \b Struct \b Description:  Store the HVD driver information
779 //-----------------------------------------------------------------------------
780 typedef struct
781 {
782     MS_U16 u16HorSize;          ///< pixel width.
783     MS_U16 u16VerSize;          ///< pixel height.
784     MS_U32 u32FrameRate;    ///< 1000 times frames per second.
785     MS_U8 u8AspectRate;     ///< aspect ration ID.
786     MS_U8 u8Interlace;          ///< interlace content
787     MS_U8 u8AFD;            ///< AFD ID number
788     MS_U8 bChroma_idc_Mono;             ///< - TRUE: mono mode FALSE: colorful, not mono
789     MS_U16 u16SarWidth;            ///< Sample aspect width ratio.
790     MS_U16 u16SarHeight;           ///< Sample aspect height ratio.
791     MS_U16 u16CropRight;            ///< crop right.
792     MS_U16 u16CropLeft;             ///< crop left.
793     MS_U16 u16CropBottom;           ///< crop bottom.
794     MS_U16 u16CropTop;          ///< crop top.
795     MS_U16 u16Pitch;            ///< pitch
796     MS_U8  u8ColourPrimaries;   ///< Color Primaries in VUI
797     //****************************
798     MS_U8 reserved8_0;          ///< reserved.
799     //******************************
800 } HVD_EX_DispInfo;     //  bytes
801 
802 //-----------------------------------------------------------------------------
803 /// @brief \b Struct \b Name: HVD_EX_DrvInfo
804 /// @brief \b Struct \b Description:  Store the HVD driver information
805 //-----------------------------------------------------------------------------
806 typedef struct
807 {
808     MS_BOOL bAVC;       ///< - TRUE: HW does support AVC.  - FALSE: HW does not support AVC.
809     MS_BOOL bAVS;       ///< - TRUE: HW does support AVS.  - FALSE: HW does not support AVS.
810     MS_BOOL bRM;        ///< - TRUE: HW does support RM.  - FALSE: HW does not support RM.
811     MS_U32  FWversion;       ///<  FW version number.
812 } HVD_EX_DrvInfo;
813 
814 //-----------------------------------------------------------------------------
815 /// @brief \b Struct \b Name: HVD_EX_DrvStatus
816 /// @brief \b Struct \b Description:  Store the HVD driver status
817 //-----------------------------------------------------------------------------
818 typedef struct
819 {
820     MS_BOOL bInit;       ///< - TRUE: Initialization success.  - FALSE: Initialization failed or not initialized yet.
821     MS_BOOL bBusy;       ///< - TRUE: Driver is processing  - FALSE: Driver is Idle.
822 } HVD_EX_DrvStatus;
823 
824 //-----------------------------------------------------------------------------
825 /// @brief \b Struct \b Name: HVD_EX_RVInfo
826 /// @brief \b Struct \b Description:  RV file information
827 //-----------------------------------------------------------------------------
828 typedef struct
829 {
830     MS_U16 RV_Version;      ///< Real Video Bitstream version
831     MS_U16 ulNumSizes;      ///< Real Video Number sizes
832     MS_U16 ulPicSizes_w[8]; ///< Real Video file width
833     MS_U16 ulPicSizes_h[8]; ///< Real Video file height
834 } HVD_EX_RVInfo;
835 
836 typedef struct
837 {
838     HVD_EX_FBReductionType LumaFBReductionMode;     ///< Luma frame buffer reduction mode.
839     HVD_EX_FBReductionType ChromaFBReductionMode;   ///< Chroma frame buffer reduction mode.
840     MS_U8                 u8EnableAutoMode;        /// 0: Disable, 1: Enable
841 } HVD_EX_FBReduction;
842 
843 //-----------------------------------------------------------------------------
844 /// @brief \b Struct \b Name: HVD_EX_MemCfg
845 /// @brief \b Struct \b Description:  Store the HVD driver config
846 //-----------------------------------------------------------------------------
847 typedef struct
848 {
849     HVD_EX_FWSourceType eFWSourceType;             //!< the input FW source type.
850     MS_VIRT  u32FWBinaryVAddr;                //!<  virtual address of input FW binary in DRAM
851     MS_PHY  u32FWBinaryAddr;                //!< the physical memory start address in Flash/DRAM memory of FW code
852     MS_U32  u32FWBinarySize;                //!< the FW code size
853     MS_VIRT u32VLCBinaryVAddr;///< VLC table binary data buffer start address
854     MS_PHY u32VLCBinaryAddr;///< VLC table binary data buffer start address
855     MS_U32 u32VLCBinarySize;///<VLC table binary data buffer size
856     MS_PHY  u32MIU1BaseAddr;       //!< the physical memory start address of MIU 1 base address. 0: default value.
857     MS_VIRT  u32CodeBufVAddr;        //!< the virtual memory start address of code buffer
858     MS_PHY  u32CodeBufAddr;         //!< the physical memory start address of code buffer
859     MS_U32  u32CodeBufSize;             //!< the code buffer size
860     MS_VIRT  u32FrameBufVAddr;           //!< the virtual memory start address of frame buffer
861     MS_PHY  u32FrameBufAddr;            //!< the physical memory start address of frame buffer
862     MS_U32  u32FrameBufSize;                //!< the frame buffer size
863     MS_VIRT  u32BitstreamBufVAddr;           //!< the virtual memory start address of bit stream buffer
864     MS_PHY  u32BitstreamBufAddr;                //!< the physical memory start address of bit stream buffer
865     MS_U32  u32BitstreamBufSize;            //!< the bit stream buffer size
866     MS_VIRT  u32DrvProcessBufVAddr;       //!< the virtual memory start address of driver process buffer
867     MS_PHY  u32DrvProcessBufAddr;       //!< the physical memory start address of driver process buffer
868     MS_U32  u32DrvProcessBufSize;        //!< the driver process buffer size
869 #ifdef VDEC3
870     MS_PHY  u32TotalBitstreamBufAddr;
871     MS_U32  u32TotalBitstreamBufSize;
872 #endif
873 } HVD_EX_MemCfg;
874 
875 //-----------------------------------------------------------------------------
876 /// @brief \b Struct \b Name: HVD_Init_Params
877 /// @brief \b Struct \b Description:  Store the initialization settings
878 //-----------------------------------------------------------------------------
879 typedef struct
880 {
881     MS_U32 u32ModeFlag;     ///< init mode flag, use HVD_INIT_* to setup HVD.
882     MS_U32 u32FrameRate;     ///< frame rate.
883     MS_U32 u32FrameRateBase;     ///< frame rate base. The value of u32FrameRate /u32FrameRateBase must be frames per sec.
884     MS_U8   u8MinFrmGap;    ///< set the min frame gap.
885     MS_U8   u8SyncType;         ///< HVD_EX_SyncType. sync type of current playback.
886     MS_U16 u16Pitch;   ///< not zero: specify the pitch. 0: use default value.
887     MS_U32 u32MaxDecTick;   ///< not zero: specify the max decode tick. 0: use default value.
888     MS_BOOL bSyncEachFrm;   ///< TRUE: sync STC at each frame. FALSE: not sync each frame.
889     MS_BOOL bAutoFreeES;   ///< TRUE: auto free ES buffer when ES buffer is full. FALSE: not do the auto free.
890     MS_BOOL bAutoPowerSaving;   ///< TRUE: auto power saving. FALSE: not do the auto power saving.
891     MS_BOOL bDynamicScaling;   ///< TRUE: enable Dynamic Scaling. FALSE: disable Dynamic Scaling.
892     MS_BOOL bFastDisplay;   ///< TRUE: enable Fast Display. FALSE: disable Fast Display.
893     MS_BOOL bUserData;   ///< TRUE: enable processing User data. FALSE: disable processing User data.
894     MS_U8 u8TurboInit;       ///< HVD_TurboInitLevel. set the turbo init mode.
895     MS_U8 u8TimeUnit;   ///< HVD_Time_Unit_Type.set the type of input/output time unit.
896     MS_U16 u16DecoderClock;      ///< HVD decoder clock speed. 0: default value. non-zero: any nearist clock.
897     MS_U16 u16ChipECONum;    ///< Chip revision, ECO number.
898     HVD_EX_RVInfo* pRVFileInfo;           ///< pointer to RV file info
899     HVD_EX_FBReduction stFBReduction; ///< HVD Frame buffer reduction type
900 } HVD_EX_InitSettings;
901 
902 //-----------------------------------------------------------------------------
903 /// @brief \b Struct \b Name: HVD_EX_PacketInfo
904 /// @brief \b Struct \b Description:  Store the packet information
905 //-----------------------------------------------------------------------------
906 typedef struct
907 {
908     MS_PHY u32Staddr;     ///< Packet offset from bitstream buffer base address. unit: byte.
909     MS_U32 u32Length;    ///< Packet size. unit: byte.
910     MS_PHY u32Staddr2;     ///< Packet offset from bitstream buffer base address. unit: byte.
911     MS_U32 u32Length2;    ///< Packet size. unit: byte.
912     MS_U32 u32TimeStamp;    ///< Packet time stamp. unit: ms.
913     MS_U32 u32ID_L;    ///< Packet ID low part.
914     MS_U32 u32ID_H;    ///< Packet ID high part.
915     MS_U32 u32AllocLength;    ///< Allocated Packet size. unit: byte.
916 } HVD_EX_PacketInfo;
917 
918 //-----------------------------------------------------------------------------
919 /// @brief \b Struct \b Name: HVD_EX_FrameInfo
920 /// @brief \b Struct \b Description:  Store the frame information
921 //-----------------------------------------------------------------------------
922 typedef struct
923 {
924     MS_PHY u32LumaAddr;                 ///< The start physical of luma data. Unit: byte.
925     MS_PHY u32ChromaAddr;               ///< The start physcal of chroma data. Unit: byte.
926     MS_U32 u32TimeStamp;                ///< Time stamp(DTS, PTS) of current displayed frame. Unit: 90khz.
927     MS_U32 u32ID_L;                     ///< low part of ID number decided by MDrv_HVD_EX_PushQueue().
928     MS_U32 u32ID_H;                     ///< high part of ID number decided by MDrv_HVD_EX_PushQueue().
929     MS_U16 u16Pitch;                        ///< The pitch of current frame.
930     MS_U16 u16Width;                        ///< pixel width of current frame.
931     MS_U16 u16Height;                       ///< pixel height of current frame.
932     HVD_EX_FrmType eFrmType;     ///< picture type: I, P, B frame
933     HVD_EX_FieldType  eFieldType;                 ///< none, top , bottom, both field
934     MS_U32 u32PrivateData;              //[STB]only for AVC
935     MS_PHY u32LumaAddr_2bit;                 ///< The start offset of luma data. Unit: byte.
936     MS_PHY u32ChromaAddr_2bit;               ///< The start offset of chroma data. Unit: byte.
937     MS_U16 u16Pitch_2bit;
938     MS_U8  u8LumaBitdepth;
939     MS_U8  u8ChromaBitdepth;
940     MS_PHY u32LumaAddrI;
941     MS_PHY u32LumaAddrI_2bit;
942     MS_PHY u32ChromaAddrI;
943     MS_PHY u32ChromaAddrI_2bit;
944     MS_U32 u32MFCodecInfo;
945     MS_U32 u32LumaMFCbitlen;
946     MS_U32 u32ChromaMFCbitlen;
947     ////HVD_MasteringDisplayColourVolume//
948     MS_U32 u32MaxLuminance;
949     MS_U32 u32MinLuminance;
950     MS_U16 u16Primaries[3][2];
951     MS_U16 u16WhitePoint[2];
952     MS_U8  u8Frm_Info_Ext_avail; ///bit[1]: SEI_Enabled,  bit[0]: colur_description_present_flag
953     ////colour_description////////////
954     MS_U8  u8Colour_primaries;                            // u(8)
955     MS_U8  u8Transfer_characteristics;                    // u(8)
956     MS_U8  u8Matrix_coefficients;                         // u(8)
957     ////Dolby_Vision////////////
958     MS_U8 u8DVMode; // bit[0:1] 0: Disable 1:Single layer 2: Dual layer, bit[2] 0:Base Layer 1:Enhance Layer
959     MS_U8 u8CurrentIndex;
960     MS_U8 bDMEnable;
961     MS_U8 bCompEnable;
962     MS_PHY u32DVMetadataAddr;
963     MS_U32 u32DVDMSize;
964     MS_U32 u32DVCompSize;
965     MS_PHY u32HDRRegAddr;
966     MS_U32 u32HDRRegSize;
967     MS_PHY u32HDRLutAddr;
968     MS_U32 u32HDRLutSize;
969     // Other
970     MS_U8  u8ComplexityLevel; // from 1~5, smaller number means smaller complexity
971     MS_U8  u8TileMode;
972     MS_U8  u8Reserve[2];
973     // Pixel aspect ratio info, crop info
974     MS_U32 u32ParWidth;
975     MS_U32 u32ParHeight;
976     MS_U16 u16CropRight;
977     MS_U16 u16CropLeft;
978     MS_U16 u16CropBottom;
979     MS_U16 u16CropTop;
980     // Profiling / benchmark
981     MS_U16 u16MIUBandwidth;
982     MS_U16 u16Bitrate;
983     // HTLB
984     MS_U8  u8HTLBTableId;
985     MS_U8  u8HTLBEntriesSize;
986     MS_U8  u8Reserve1[2];
987     MS_U32 u32HTLBEntriesAddr;
988 } HVD_EX_FrameInfo;
989 
990 
991 //-----------------------------------------------------------------------------
992 /// @brief \b Struct \b Name: HVD_DISP_INFO_THRESHOLD
993 /// @brief \b Struct \b Description:  Store the disp information threshold
994 //-----------------------------------------------------------------------------
995 typedef struct
996 {
997     MS_U32 u32FrmrateUpBound;       //Framerate filter upper bound
998     MS_U32 u32FrmrateLowBound;      //Framerate filter lower bound
999     MS_U32 u32MvopUpBound;          //mvop filter upper bound
1000     MS_U32 u32MvopLowBound;         //mvop filter lower bound
1001 } HVD_EX_DispInfoThreshold;
1002 
1003 typedef struct
1004 {
1005     MS_U8 STCSetflag[HVD_MAX_DEC_NUM];
1006     MS_U32 STCIndex[HVD_MAX_DEC_NUM];
1007 }HVD_EX_STCModCfg;
1008 
1009 typedef struct
1010 {
1011     MS_U8  u8DecMod;
1012     MS_U8  u8CodecCnt;
1013     MS_U8  u8CodecType[HVD_MAX_DEC_NUM];
1014     MS_U8  u8ArgSize;
1015     MS_U32 u32Arg;
1016 } HVD_EX_DecModCfg;
1017 //-----------------------------------------------------------------------------
1018 /// @brief \b Struct \b Name: HVD_UsrData_Info
1019 /// @brief \b Struct \b Description:  Store the User Data information
1020 //-----------------------------------------------------------------------------
1021 typedef struct
1022 {
1023     MS_U32 u32Pts;
1024     MS_U8  u8PicStruct;           // picture_structure
1025     MS_U8  u8PicType;             // picture type: 1->I picture, 2->P,3->B
1026     MS_U8  u8TopFieldFirst;       // Top field first: 1 if top field first
1027     MS_U8  u8RptFirstField;       // Repeat first field: 1 if repeat field first
1028 
1029     MS_PHY u32DataBuf;            // User_Data data buffer address
1030     MS_U16 u16TmpRef;             // Temporal reference of the picture
1031     MS_U8  u8ByteCnt;             // User Data length
1032     MS_U8  u8Reserve;             // Reserved
1033 } HVD_EX_UserData_Info;
1034 
1035 typedef struct
1036 {
1037     MS_BOOL bvaild;
1038     MS_BOOL bUsed;
1039     MS_U8   u8Frm_packing_arr_cnl_flag;
1040     MS_U8   u8Frm_packing_arr_type;
1041     MS_U8   u8content_interpretation_type;
1042     MS_U8   u1Quincunx_sampling_flag;
1043     MS_U8   u1Spatial_flipping_flag;
1044     MS_U8   u1Frame0_flipping_flag;
1045     MS_U8   u1Field_views_flag;
1046     MS_U8   u1Current_frame_is_frame0_flag;
1047     MS_U8   u1Frame0_self_contained_flag;
1048     MS_U8   u1Frame1_self_contained_flag;
1049     MS_U8   u4Frame0_grid_position_x;
1050     MS_U8   u4Frame0_grid_position_y;
1051     MS_U8   u4Frame1_grid_position_x;
1052     MS_U8   u4Frame1_grid_position_y;
1053     MS_U16  u16CropRight;
1054     MS_U16  u16CropLeft;
1055     MS_U16  u16CropBottom;
1056     MS_U16  u16CropTop;
1057     MS_U8   u8payload_len;
1058     MS_U8   u8WaitSPS;
1059     MS_U8   u8Reserved01;
1060     MS_U8   u8Reserved02;
1061     MS_U32  u32payload;
1062 }HVD_EX_FrmPackingSEI;
1063 
1064 typedef struct
1065 {
1066     MS_BOOL bUsed;
1067     MS_BOOL bColourVolumeSEIEnabled;
1068     MS_U32  u32MaxLuminance;
1069     MS_U32  u32MinLuminance;
1070     MS_U16  u16Primaries[3][2];
1071     MS_U16  u16WhitePoint[2];
1072 }HVD_EX_DisplayColourVolumeSEI;
1073 
1074 typedef struct
1075 {
1076     MS_BOOL bUsed;
1077     MS_BOOL ContentLightLevelEnabled;
1078     MS_U16  maxContentLightLevel;
1079     MS_U16  maxPicAverageLightLevel;
1080 } HVD_EX_ContentLightLevelInfoSEI;
1081 
1082 typedef struct
1083 {
1084     MS_PHY  u32DSBufAddr;       // Buffer Address
1085     MS_U32  u32DSBufSize;       // Buffer Size
1086 }HVD_EX_ExternalDSBuf;
1087 
1088 typedef struct
1089 {
1090     MS_U64 u64PTS;
1091     MS_U32 u32POC;
1092     MS_U8 u8FrameType;
1093 }HVD_EX_PVR_Seamless_Info;
1094 
1095 typedef struct
1096 {
1097     HVD_EX_Codec eCodecType;
1098     MS_VIRT  u32DataVAddr;
1099     MS_U32  u32MemUsageSize;
1100     MS_U16  u16DataSize;
1101 } HVD_EX_FbMemUsage_Param;
1102 
1103 //-------------------------------------------------------------------------------------------------
1104 //  Function and Variable
1105 //-------------------------------------------------------------------------------------------------
1106 void        MDrv_HVD_EX_SetCtrlsBase(MS_U32 u32Id);
1107 void        MDrv_HVD_EX_MJPEG_InitSharemem(MS_U32 u32Id, MS_U32 u32CodeBufVAddr);
1108 void        MDrv_HVD_EX_MJPEG_Exit(MS_U32 u32Id);
1109 
1110 void        MDrv_HVD_EX_SetOSRegBase(MS_VIRT u32RegBaseAddr);
1111 #ifdef VDEC3
1112 HVD_EX_Result  MDrv_HVD_EX_GetFreeStream(MS_U32 *pu32Id, HVD_EX_DRV_StreamType eStreamType, MS_BOOL bIsEVD, MS_BOOL bIsNStreamMode);
1113 HVD_EX_Result  MDrv_HVD_EX_Init(MS_U32 u32Id, HVD_EX_MemCfg *pStMemCfg, HVD_EX_InitSettings *pStInitSettings, MS_BOOL bFWdecideFB, MS_BOOL bDRVdecideBS);
1114 #else
1115 HVD_EX_Result  MDrv_HVD_EX_GetFreeStream(MS_U32 *pu32Id, HVD_EX_DRV_StreamType eStreamType, MS_BOOL bIsEVD, MS_BOOL bIsNStreamMode);
1116 HVD_EX_Result  MDrv_HVD_EX_Init(MS_U32 u32Id, HVD_EX_MemCfg *pStMemCfg, HVD_EX_InitSettings *pStInitSettings);
1117 #endif
1118 HVD_EX_Result  MDrv_HVD_EX_Rst(MS_U32 u32Id, MS_BOOL bErrHandle);
1119 HVD_EX_Result  MDrv_HVD_EX_Play(MS_U32 u32Id);
1120 HVD_EX_Result  MDrv_HVD_EX_Exit(MS_U32 u32Id);
1121 HVD_EX_Result  MDrv_HVD_EX_Pause(MS_U32 u32Id);
1122 HVD_EX_Result  MDrv_HVD_EX_Flush(MS_U32 u32Id, MS_BOOL bShowLast);
1123 HVD_EX_Result  MDrv_HVD_EX_StepDisp(MS_U32 u32Id);
1124 HVD_EX_Result  MDrv_HVD_EX_StepDecode(MS_U32 u32Id);
1125 HVD_EX_Result  MDrv_HVD_EX_PushQueue(MS_U32 u32Id, HVD_EX_PacketInfo *pInfo);
1126 HVD_EX_Result  MDrv_HVD_EX_PushQueue_Fire(MS_U32 u32Id);
1127 HVD_EX_Result  MDrv_HVD_EX_DecodeIFrame(MS_U32 u32Id, MS_PHY u32SrcSt, MS_U32 u32SrcSize);
1128 
1129 HVD_EX_Result  MDrv_HVD_EX_SetDataEnd(MS_U32 u32Id, MS_BOOL bEnd);
1130 HVD_EX_Result  MDrv_HVD_EX_SetDispErrFrm(MS_U32 u32Id, MS_BOOL bEnable);
1131 HVD_EX_Result  MDrv_HVD_EX_SetCalFrameRate(MS_U32 u32Id, MS_BOOL bEnable);
1132 HVD_EX_Result  MDrv_HVD_EX_SetDispRepeatField(MS_U32 u32Id, MS_BOOL bEnable);
1133 HVD_EX_Result  MDrv_HVD_EX_SetSkipDecMode(MS_U32 u32Id, HVD_EX_SkipDecode eDecType);
1134 #ifdef VDEC3_FB
1135 HVD_EX_Result  MDrv_HVD_EX_SetFrmBuffAddr(MS_U32 u32Id, MS_PHY u32FrmBuffAddr);
1136 HVD_EX_Result  MDrv_HVD_EX_SetFrmBuffSize(MS_U32 u32Id, MS_U32 u32FrmBuffSize);
1137 #endif
1138 HVD_EX_Result MDrv_HVD_EX_SetDVXCShmBuff(MS_U32 u32Id, MS_PHY u32FWBaseAddr, MS_PHY u32DVXCShmAddr, MS_SIZE u32DVXCShmSize);
1139 HVD_EX_Result  MDrv_HVD_EX_SetFrmBuff2(MS_U32 u32Id, MS_PHY u32FrmBuffAddr, MS_U32 u32FrmBuffSize);
1140 HVD_EX_Result  MDrv_HVD_EX_SetDispSpeed(MS_U32 u32Id, HVD_EX_DispSpeed eSpeed);
1141 HVD_EX_Result  MDrv_HVD_EX_SetSyncActive(MS_U32 u32Id, MS_BOOL bEnable);
1142 HVD_EX_Result  MDrv_HVD_EX_SetDropMode(MS_U32 u32Id, HVD_EX_DropDisp eMode, MS_U32 u32Arg);
1143 HVD_EX_Result  MDrv_HVD_EX_RstPTS(MS_U32 u32Id, MS_U32 u32PTS);
1144 HVD_EX_Result  MDrv_HVD_EX_SetFrcMode(MS_U32 u32Id, HVD_EX_FrmRateConvMode eMode);
1145 HVD_EX_Result  MDrv_HVD_EX_SetSyncTolerance(MS_U32 u32Id, MS_U32 u32Arg);
1146 HVD_EX_Result  MDrv_HVD_EX_SetSyncVideoDelay(MS_U32 u32Id, MS_U32 u32Arg);
1147 HVD_EX_Result  MDrv_HVD_EX_SetSyncFreeRunTH(MS_U32 u32Id, MS_U32 u32Arg);
1148 HVD_EX_Result  MDrv_HVD_EX_SetSyncRepeatTH(MS_U32 u32Id, MS_U32 u32Arg);
1149 HVD_EX_Result  MDrv_HVD_EX_SetErrConceal(MS_U32 u32Id, MS_BOOL u32Arg);
1150 void        MDrv_HVD_EX_SetDbgLevel(MS_U32 u32Id, HVD_EX_UartLevel elevel);
1151 HVD_EX_Result  MDrv_HVD_EX_SeekToPTS(MS_U32 u32Id, MS_U32 u32PTS);
1152 HVD_EX_Result  MDrv_HVD_EX_SkipToPTS(MS_U32 u32Id, MS_U32 u32PTS);
1153 HVD_EX_Result  MDrv_HVD_EX_SetFreezeImg(MS_U32 u32Id, MS_BOOL bEnable);
1154 HVD_EX_Result  MDrv_HVD_EX_SetBlueScreen(MS_U32 u32Id, MS_BOOL bEnable);
1155 HVD_EX_Result  MDrv_HVD_EX_SetDispOneField(MS_U32 u32Id, MS_BOOL bEnable);
1156 HVD_EX_Result  MDrv_HVD_EX_SetISREvent(MS_U32 u32Id, MS_U32 u32Event, HVD_InterruptCb fnISRHandler);
1157 MS_BOOL     MDrv_HVD_EX_SetEnableISR(MS_U32 u32Id, MS_BOOL bEnable);
1158 MS_BOOL     MDrv_HVD_EX_SetForceISR(MS_U32 u32Id, MS_BOOL bEnable);
1159 MS_BOOL     MDrv_HVD_EX_SetMVOPDone(MS_U32 u32Id);
1160 HVD_EX_Result  MDrv_HVD_EX_SetVirtualBox(MS_U32 u32Id, MS_U16 u16Width, MS_U16 u16Height);
1161 HVD_EX_Result  MDrv_HVD_EX_SetDynScalingParam(MS_U32 u32Id, void *pStAddr, MS_U32 u32Size);
1162 HVD_EX_Result  MDrv_HVD_EX_SetAutoRmLstZeroByte(MS_U32 u32Id, MS_BOOL bOn);
1163 HVD_EX_Result  MDrv_HVD_EX_SetDispInfoTH(MS_U32 u32Id, HVD_EX_DispInfoThreshold *DispInfoTH);
1164 HVD_EX_Result  MDrv_HVD_EX_SetFastDisplay(MS_U32 u32Id, MS_BOOL bFastDisplay);
1165 HVD_EX_Result  MDrv_HVD_EX_SetIgnoreErrRef(MS_U32 u32Id, MS_BOOL bIgnore);
1166 HVD_EX_Result  MDrv_HVD_EX_ForceFollowDTVSpec(MS_U32 u32Id, MS_BOOL bEnable);
1167 
1168 MS_BOOL     MDrv_HVD_EX_IsISROccured(MS_U32 u32Id);
1169 MS_BOOL     MDrv_HVD_EX_IsDispFinish(MS_U32 u32Id);
1170 MS_BOOL     MDrv_HVD_EX_IsFrameShowed(MS_U32 u32Id);
1171 MS_BOOL     MDrv_HVD_EX_IsStepDecodeDone(MS_U32 u32Id);
1172 HVD_EX_Result  MDrv_HVD_EX_CheckDispInfoRdy(MS_U32 u32Id);
1173 MS_BOOL     MDrv_HVD_EX_IsDispInfoChg(MS_U32 u32Id);
1174 MS_BOOL     MDrv_HVD_EX_IsIdle(MS_U32 u32Id);
1175 MS_BOOL     MDrv_HVD_EX_IsSyncStart(MS_U32 u32Id);
1176 MS_BOOL     MDrv_HVD_EX_IsSyncReach(MS_U32 u32Id);
1177 MS_BOOL     MDrv_HVD_EX_IsLowDelay(MS_U32 u32Id);
1178 MS_BOOL     MDrv_HVD_EX_IsIFrmFound(MS_U32 u32Id);
1179 MS_BOOL     MDrv_HVD_EX_Is1stFrmRdy(MS_U32 u32Id);
1180 MS_BOOL     MDrv_HVD_EX_IsAllBufferEmpty(MS_U32 u32Id);
1181 HVD_EX_Result  MDrv_HVD_EX_IsAlive(MS_U32 u32Id);
1182 
1183 MS_U32      MDrv_HVD_EX_GetBBUVacancy(MS_U32 u32Id);
1184 HVD_EX_Result  MDrv_HVD_EX_GetDispInfo(MS_U32 u32Id, HVD_EX_DispInfo *pInfo);
1185 MS_U32      MDrv_HVD_EX_GetPTS(MS_U32 u32Id);
1186 MS_U64      MDrv_HVD_EX_GetU64PTS(MS_U32 u32Id);
1187 MS_U64      MDrv_HVD_EX_GetU64PTS_PreParse(MS_U32 u32Id);
1188 MS_U32      MDrv_HVD_EX_GetNextPTS(MS_U32 u32Id);
1189 MS_U32      MDrv_HVD_EX_GetNextDispQPtr(MS_U32 u32Id);
1190 MS_U32      MDrv_HVD_EX_GetDataErrCnt(MS_U32 u32Id);
1191 MS_U32      MDrv_HVD_EX_GetDecErrCnt(MS_U32 u32Id);
1192 MS_VIRT      MDrv_HVD_EX_GetESWritePtr(MS_U32 u32Id);
1193 MS_VIRT      MDrv_HVD_EX_GetESReadPtr(MS_U32 u32Id);
1194 MS_U32      MDrv_HVD_EX_GetESQuantity(MS_U32 u32Id);
1195 MS_BOOL     MDrv_HVD_EX_GetCaps(HVD_EX_Codec u32Type);
1196 MS_U32      MDrv_HVD_EX_GetErrCode(MS_U32 u32Id);
1197 MS_U32      MDrv_HVD_EX_GetPlayMode(MS_U32 u32Id, HVD_EX_GetModeStatus eMode);
1198 HVD_EX_GetPlayState MDrv_HVD_EX_GetPlayState(MS_U32 u32Id);
1199 MS_U32      MDrv_HVD_EX_GetDecodeCnt(MS_U32 u32Id);
1200 MS_U8       MDrv_HVD_EX_GetActiveFormat(MS_U32 u32Id);
1201 const HVD_EX_DrvInfo *MDrv_HVD_EX_GetInfo(void);
1202 HVD_EX_Result  MDrv_HVD_EX_GetLibVer(const MSIF_Version **ppVersion);
1203 MS_BOOL     MDrv_HVD_EX_GetStatus(MS_U32 u32Id, HVD_EX_DrvStatus *pstatus);
1204 HVD_EX_Result  MDrv_HVD_EX_GetFrmInfo(MS_U32 u32Id, HVD_EX_GetFrmInfoType eType, HVD_EX_FrameInfo *pInfo);
1205 MS_BOOL     MDrv_HVD_EX_GetISRInfo(MS_U32 u32Id, MS_U32 *eType);
1206 MS_U32      MDrv_HVD_EX_CalLumaSum(MS_U32 u32Id, HVD_EX_GetFrmInfoType eType);
1207 MS_U32      MDrv_HVD_EX_GetUserData_Wptr(MS_U32 u32Id);
1208 MS_VIRT      MDrv_HVD_EX_GetUserData_Packet(MS_U32 u32Id, MS_U32 u32Idx, MS_U32 *u32Size);
1209 HVD_EX_Result  MDrv_HVD_EX_GenPattern(MS_U32 u32Id, HVD_EX_PatternType eType, MS_VIRT u32VAddr, MS_U32 *u32Size);
1210 MS_U32      MDrv_HVD_EX_GetPatternInfo(MS_U32 u32Id, HVD_EX_PatternInfo eType);
1211 MS_U32      MDrv_HVD_EX_GetDynamicScalingInfo(MS_U32 u32Id, HVD_EX_DynamicScalingInfo eType);
1212 MS_BOOL     MDrv_HVD_EX_GetFrmRateIsSupported(MS_U32 u32Id);
1213 
1214 MS_VIRT     MDrv_HVD_EX_GetData(MS_U32 u32Id, HVD_EX_GDataType eType);
1215 MS_U32      MDrv_HVD_EX_GetMem_Dbg(MS_U32 u32Id, MS_VIRT u32Addr);
1216 void        MDrv_HVD_EX_DbgDumpStatus(MS_U32 u32Id, HVD_EX_DumpStatus eFlag);
1217 void        MDrv_HVD_EX_SetMem_Dbg(MS_U32 u32Id, MS_VIRT u32Addr, MS_U32 u32Arg);
1218 HVD_EX_Result  MDrv_HVD_EX_SetCmd_Dbg(MS_U32 u32Id, MS_U32 u32Cmd, MS_U32 u32Arg);
1219 HVD_EX_Result  MDrv_HVD_EX_SetSettings_Pro(MS_U32 u32Id, HVD_EX_SSettingsType eType, MS_U32 u32Arg);
1220 HVD_EX_Result  MDrv_HVD_EX_SetBalanceBW(MS_U32 u32Id, MS_U8 u8QPCnt, MS_U8 u8DBCnt, MS_U8 u8Upper);
1221 MS_S64      MDrv_HVD_EX_GetPtsStcDiff(MS_U32 u32Id);
1222 MS_U32      MDrv_HVD_EX_GetDrvFwVer(void);
1223 HVD_EX_Result  MDrv_HVD_EX_SetFdMaskDelayCnt(MS_U32 u32Id, MS_U8 u8DelayCnt);
1224 HVD_EX_Result  MDrv_HVD_EX_SetOutputFRCMode(MS_U32 u32Id, MS_U8 u8FrameRate, MS_U8 u8Interlace);
1225 HVD_EX_Result  MDrv_HVD_EX_DispFrame(MS_U32 u32Id, MS_U32 u32FrmIdx);
1226 HVD_EX_Result  MDrv_HVD_EX_FreeFrame(MS_U32 u32Id, MS_U32 u32FrmIdx);
1227 HVD_EX_Result  MDrv_HVD_EX_EnableDispQue(MS_U32 u32Id, MS_BOOL bEnable);
1228 HVD_EX_Result  MDrv_HVD_EX_EnableVSizeAlign(MS_U32 u32Id, MS_BOOL bEnable);
1229 HVD_EX_Result  MDrv_HVD_EX_ShowDecodeOrder(MS_U32 u32Id, MS_BOOL bEnable);
1230 HVD_EX_Result  MDrv_HVD_EX_Disp_Ignore_Crop(MS_U32 u32Id, MS_BOOL bEnable);
1231 HVD_EX_Result MDrv_HVD_EX_RmEnablePtsTbl(MS_U32 u32Id, MS_BOOL bEnable);
1232 HVD_EX_Result  MDrv_HVD_EX_SetFRCDropType(MS_U32 u32Id, MS_U8 u8DropType);
1233 MS_U32      MDrv_HVD_EX_GetDrvFwVer(void);
1234 MS_U32      MDrv_HVD_EX_GetFwVer(MS_U32 u32Id);
1235 HVD_EX_Result MDrv_HVD_EX_DispOutsideMode(MS_U32 u32Id, MS_BOOL bEnable);
1236 MS_BOOL MDrv_HVD_SetSingleDecodeMode(MS_BOOL bEnable);
1237 MS_BOOL MDrv_HVD_SetSTCMode(MS_U32 u32Id, MS_U32 STCindex);
1238 MS_BOOL MDrv_HVD_SetDecodeMode(MS_U32 u32Id, HVD_EX_DecModCfg *pstCfg);
1239 void MDrv_HVD_EX_SetBurstMode(MS_U32 u32Id, MS_BOOL bBurst);
1240 HVD_EX_Result  MDrv_HVD_EX_ForceInterlaceMode(MS_U32 u32Id, MS_U8 u8Mode);
1241 HVD_EX_Result  MDrv_HVD_EX_Support_AVC2MVC(MS_U32 u32Id, MS_BOOL bEnable);
1242 HVD_EX_Result  MDrv_HVD_EX_3DLR_View_Exchange(MS_U32 u32Id, MS_BOOL bEnable);
1243 HVD_EX_Result  MDrv_HVD_EX_Enable_New_Slow_Motion(MS_U32 u32Id, MS_BOOL bEnable);
1244 HVD_EX_Result  MDrv_HVD_EX_SetDTVUserDataMode(MS_U32 u32Id,MS_U8 u8UserDataMode);
1245 MS_BOOL MDrv_HVD_EX_GetUsrDataIsAvailable(MS_U32 u32Id);
1246 HVD_EX_Result  MDrv_HVD_EX_GetUserDataInfo(MS_U32 u32Id,HVD_EX_UserData_Info* pUsrInfo);
1247 HVD_EX_Result  MDrv_HVD_EX_GetFrmPackingArrSEI(MS_U32 u32Id,HVD_EX_FrmPackingSEI *pFrmPacking);
1248 HVD_EX_Result  MDrv_HVD_EX_GetContentLightLevelInfoSEI(MS_U32 u32Id, HVD_EX_ContentLightLevelInfoSEI *pContentLightLevel);
1249 HVD_EX_Result  MDrv_HVD_EX_GetDisplayColourVolumeArrSEI(MS_U32 u32Id, HVD_EX_DisplayColourVolumeSEI *pDisplayColourVolume);
1250 HVD_EX_Result  MDrv_HVD_EX_SuspendDynamicScale(MS_U32 u32Id, MS_BOOL bEnable);
1251 HVD_EX_Result  MDrv_HVD_EX_PushDispQWithRefNum(MS_U32 u32Id, MS_U8 u8Mode);
1252 HVD_EX_Result  MDrv_HVD_EX_IgnorePicOverrun(MS_U32 u32Id, MS_BOOL bEnable);
1253 HVD_EX_Result  MDrv_HVD_EX_DynamicScalingResvNBuffer(MS_U32 u32Id, MS_BOOL bEnable);
1254 HVD_EX_Result  MDrv_HVD_EX_CtlSpeedInDispOnly(MS_U32 u32Id, MS_BOOL bEnable);
1255 HVD_EX_Result  MDrv_HVD_EX_AVCSupportRefNumOverMaxDBPSize(MS_U32 u32Id, MS_BOOL bEnable);
1256 MS_U32 MDrv_HVD_EX_GetBBUQNum(MS_U32 u32Id);
1257 MS_U32 MDrv_HVD_EX_GetDispFrmNum(MS_U32 u32Id);
1258 HVD_EX_Result MDrv_HVD_Init_Share_Mem(void);
1259 HVD_EX_Result MDrv_HVD_EX_SetHVDClockSpeed(HVD_EX_ClockSpeed eClockSpeed);
1260 HVD_EX_Result MDrv_HVD_EX_SetVPUClockSpeed(HVD_EX_ClockSpeed eClockSpeed);
1261 HVD_EX_Result MDrv_HVD_EX_DSReportDispInfoChange(MS_U32 u32Id, MS_BOOL bEnable);
1262 HVD_EX_Result MDrv_HVD_EX_SetSecureMode(MS_U32 u32Id, MS_U32 u32SecureMode);
1263 HVD_EX_Result MDrv_HVD_EX_SupportRefNumOverMaxDpbSize(MS_U32 u32Id, MS_BOOL bEnable);
1264 HVD_EX_Result MDrv_HVD_EX_RVU_Setting_Mode(MS_U32 u32Id, MS_U32 u32Param);
1265 HVD_EX_Result MDrv_HVD_EX_FramerateHandling(MS_U32 u32Id, MS_U32 u32FrameRate);
1266 HVD_EX_Result MDrv_HVD_EX_DualNonBlockMode(MS_U32 u32Id, MS_BOOL bEnable);
1267 HVD_EX_Result MDrv_HVD_EX_IgnorePicStructDisplay(MS_U32 u32Id, MS_U32 param);
1268 HVD_EX_Result MDrv_HVD_EX_InputPtsFreerunMode(MS_U32 u32Id, MS_U32 param);
1269 HVD_EX_Result MDrv_HVD_EX_ErrConcealStartSlice1stMB(MS_U32 u32Id, MS_U32 param);
1270 HVD_EX_Result MDrv_HVD_EX_SetExternalDSBuffer(MS_U32 u32Id, HVD_EX_ExternalDSBuf *pExternalBuf);
1271 HVD_EX_Result MDrv_HVD_EX_SetHVDColBBUMode(MS_U32 u32Id, MS_U8 bEnable);
1272 
1273 HVD_EX_Result MDrv_HVD_EX_CC_Init(MS_U32 u32Id);
1274 HVD_EX_Result MDrv_HVD_EX_CC_SetCfg(MS_U32 u32Id, MS_U8 u8Operation, MS_U16 u16BufferSize, MS_U8 u8CC608);
1275 HVD_EX_Result MDrv_HVD_EX_CC_Set_RB_StartAddr(MS_U32 u32Id, MS_PHY u32StartPAddress, MS_U8 u8CC608);
1276 HVD_EX_Result MDrv_HVD_EX_CC_SyncRB_RdAddr2WrAddr(MS_U32 u32Id, MS_U8 u8CC608);
1277 HVD_EX_Result MDrv_HVD_EX_CC_Adv_RB_ReadAddr(MS_U32 u32Id, MS_U32 u32EachPacketSize, MS_U8 u8CC608);
1278 HVD_EX_Result MDrv_HVD_EX_CC_DisableParsing(MS_U32 u32Id, MS_U8 u8CC608);
1279 HVD_EX_Result MDrv_HVD_EX_CC_GetInfo(MS_U32 u32Id, MS_U32 selector, MS_U8 type, MS_U32 *p1, MS_U32 *p2);
1280 MS_BOOL MDrv_HVD_EX_CC_IsHvdRstDone(MS_U32 u32Id, MS_U8 type);
1281 MS_U8 MDrv_HVD_EX_CC_GetOverflowStatus(MS_U32 u32Id, MS_U8 u8CC608);
1282 MS_U32 MDrv_HVD_EX_CC_Get_RB_WriteAddr(MS_U32 u32Id, MS_U8 u8CC608);
1283 MS_U32 MDrv_HVD_EX_CC_Get_RB_ReadAddr(MS_U32 u32Id, MS_U8 u8CC608);
1284 MS_BOOL MDrv_HVD_EX_CC_InfoEnhanceMode(MS_U32 u32Id, MS_BOOL bEnable);
1285 HVD_EX_Result MDrv_HVD_EX_AutoExhaustESMode(MS_U32 u32Id, MS_U32 u32ESbound);
1286 MS_U32 MDrv_HVD_EX_GetESBufferStatus(MS_U32 u32Id);
1287 HVD_EX_Result MDrv_HVD_EX_ReturnInvalidAFD(MS_U32 u32Id, MS_BOOL bEnable);
1288 HVD_EX_Result MDrv_HVD_EX_AVCForceBrokenByUs(MS_U32 u32Id, MS_BOOL bEnable);
1289 HVD_EX_Result MDrv_HVD_EX_ShowFirstFrameDirect(MS_U32 u32Id, MS_BOOL bEnable);
1290 HVD_EX_Result MDrv_HVD_EX_AVCResizeDosDispPendBuf(MS_U32 u32Id, MS_U32 u32Size);
1291 HVD_EX_Result MDrv_HVD_EX_SetMinTspSize(MS_U32 u32Id, MS_U32 u32Size);
1292 HVD_EX_Result MDrv_HVD_EX_SetDmxFrameRate(MS_U32 u32Id, MS_U32 u32Value);
1293 HVD_EX_Result MDrv_HVD_EX_SetDmxFrameRateBase(MS_U32 u32Id, MS_U32 u32Value);
1294 MS_BOOL MDrv_HVD_EX_GetSupport2ndMVOPInterface(void);
1295 MS_BOOL MDrv_HVD_EX_SetVPUSecureMode(MS_BOOL bEnable);
1296 HVD_EX_Result MDrv_HVD_EX_SetExternal_CC608_Buffer(MS_U32 u32Id, MS_PHY u32Addr, MS_U32 u32Len);
1297 HVD_EX_Result MDrv_HVD_EX_SetExternal_CC708_Buffer(MS_U32 u32Id, MS_PHY u32Addr, MS_U32 u32Len);
1298 HVD_EX_Result MDrv_HVD_EX_OnePendingBufferMode(MS_U32 u32Id,MS_BOOL bEnable);
1299 HVD_EX_Result MDrv_HVD_EX_TsInBbuMode(MS_U32 u32Id,MS_BOOL bEnable);
1300 HVD_EX_Result MDrv_HVD_EX_IapGnBufShareBWMode(MS_U32 u32Id,MS_BOOL bEnable, MS_PHY u32IapGnBufAddr, MS_U32 u32IapGnBufSize);
1301 HVD_EX_Result MDrv_HVD_EX_SetPTSUsecMode(MS_U32 u32Id, MS_BOOL bEnable);
1302 HVD_EX_Result MDrv_HVD_EX_Set_Err_Tolerance(MS_U32 u32Id, MS_U32 u32Arg);
1303 HVD_EX_Result MDrv_HVD_EX_SetDVInfo(MS_U32 u32Id, MS_U32 u32Arg);
1304 HVD_EX_Result MDrv_HVD_EX_PVRTimeShiftSeamlessMode(MS_U32 u32Id, MS_U8 u8Arg);
1305 MS_U8 MDrv_HVD_EX_GetDSBufMiuSelect(MS_U32 u32Id);
1306 MS_U8 MDrv_HVD_EX_CHIP_Capability(void* pHWCap);
1307 MS_BOOL MDrv_HVD_EX_GetPVRSeamlessInfo(MS_U32 u32Id, HVD_EX_PVR_Seamless_Info* param);
1308 void MDrv_HVD_EX_BBU_Proc(MS_U32 u32Id);
1309 void MDrv_HVD_EX_BBU_StopProc(MS_U32 u32Id);
1310 void MDrv_HVD_EX_SetCMAInformation(void* cmaInitParam);
1311 HVD_EX_Result MDrv_HVD_EX_PreSetMFCodecMode(MS_U32 u32Id, HVD_EX_MFCodec_mode eMFCodecMode);
1312 HVD_EX_Result MDrv_HVD_EX_PreSetDisplayMode(MS_U32 u32Id, HVD_EX_Display_mode eDisplayMode);
1313 HVD_EX_Result MDrv_HVD_EX_PreSetForce8BitMode(MS_U32 u32Id, MS_BOOL bForce8BitMode);
1314 HVD_EX_Result MDrv_HVD_EX_PreSetVdecFeature(MS_U32 u32Id, HVD_EX_Feature eVdecFeature);
1315 HVD_EX_Result MDrv_HVD_EX_GetFbMemUsageSize(HVD_EX_FbMemUsage_Param *pInfo);
1316 HVD_EX_Result MDrv_HVD_EX_GetCodecCapInfo( int eCodecType, void *pCodecCapInfo);
1317 HVD_EX_Result MDrv_HVD_EX_FRC_OnlyShowTopField(MS_U32 u32Id, MS_BOOL bEnable);
1318 HVD_EX_Result MDrv_HVD_EX_DisableEsFullStop(MS_U32 u32Id, MS_BOOL bDisable);
1319 HVD_EX_Result MDrv_HVD_EX_DirectSTCMode(MS_U32 u32Id, MS_U32 u32StcInMs);
1320 
1321 MS_SIZE MDrv_HVD_EX_GetFrameBufferDefaultSize(HVD_EX_CodecType eCodecType);
1322 #ifdef CMA_DRV_DIRECT_INIT
1323 MS_BOOL MDrv_HVD_EX_GetCMAMemSize(HVD_EX_CodecType eCodecType, HVD_EX_SrcMode eSrcMode,
1324     MS_U64 *offset, MS_SIZE *length, MS_U64 total_length, MS_SIZE unUseSize);
1325 #endif
1326 
1327 HVD_EX_Result MDrv_HVD_EX_GetDVSupportProfiles(MS_U32 *pu32DVSupportProfiles);
1328 HVD_EX_Result MDrv_HVD_EX_GetDVSupportHighestLevel(MS_U32 u32DVProfile, MS_U32 *pu32DVLevel);
1329 HVD_EX_Result MDrv_HVD_EX_Set_Slow_Sync(MS_U32 u32Id, MS_U32 u32Arg);
1330 MS_BOOL       MDrv_HVD_EX_IsDispQueueEmpty(MS_U32 u32Id);
1331 
1332 #else
1333 MS_BOOL MDrv_HVD_EX_LoadCodeInSecure(MS_U32 addr);
1334 MS_BOOL MDrv_HVD_EX_SetLockDownRegister(void* param,MS_U8 u8IsHVD);
1335 #if (defined(MSOS_TYPE_OPTEE))
1336 MS_BOOL MDrv_HVD_EX_OPTEE_SetRegister(void* param);
1337 #endif
1338 #endif
1339 
1340 #ifdef __cplusplus
1341 }
1342 #endif
1343 #endif // _DRV_HVD_H_
1344 
1345