xref: /utopia/UTPA2-700.0.x/projects/tmplib/include/drvHVD.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 //-------------------------------------------------------------------------------------------------
111 //  Driver Capability
112 //-------------------------------------------------------------------------------------------------
113 
114 //-------------------------------------------------------------------------------------------------
115 //  Macro and Define
116 //-------------------------------------------------------------------------------------------------
117 #define MSIF_HVD_LIB_CODE                     {'H','V','D','_'}    //Lib code
118 #define MSIF_HVD_LIBVER                       {'0','B'}            //LIB version     0.0 ~ Z.Z
119 #define MSIF_HVD_BUILDNUM                     {'0','2'}            //Build Number    00 ~ 99
120 #define MSIF_HVD_CHANGELIST                   {'0','0','6','5','4','0','6','3'} //P4 ChangeList Number
121 
122 //------------------------------------------------------------------------------
123 /// @brief \b HVD_DRV_VERSION : HVD Version
124 //------------------------------------------------------------------------------
125 #define HVD_DRV_VERSION                 /* Character String for DRV/API version             */  \
126     MSIF_TAG,                           /* 'MSIF'                                           */  \
127     MSIF_CLASS,                         /* '00'                                             */  \
128     MSIF_CUS,                           /* 0x0000                                           */  \
129     MSIF_MOD,                           /* 0x0000                                           */  \
130     MSIF_CHIP,                                                                                  \
131     MSIF_CPU,                                                                                   \
132     MSIF_HVD_LIB_CODE,                  /* IP__                                             */  \
133     MSIF_HVD_LIBVER,                    /* 0.0 ~ Z.Z                                        */  \
134     MSIF_HVD_BUILDNUM,                  /* 00 ~ 99                                          */  \
135     MSIF_HVD_CHANGELIST,                /* CL#                                              */  \
136     MSIF_OS
137 
138 #define HVD_INIT_HW_MASK                             BMASK(1:0)    ///< HW Type
139     #define HVD_INIT_HW_AVC                             BITS( 1:0,0)    ///< HW deflaut: AVC 0X00
140     #define HVD_INIT_HW_AVS                             BITS( 1:0,1)    ///< HW : AVS 0X01
141     #define HVD_INIT_HW_RM                             BITS( 1:0,2)    ///< HW: RM 0X10
142 #define HVD_INIT_MAIN_MASK                          BMASK(3:2)    ///< main type
143     #define HVD_INIT_MAIN_FILE_RAW   BITS( 3:2,0)              ///< main type: default: 0X00
144     #define HVD_INIT_MAIN_FILE_TS   BITS( 3:2,1)    ///< main type: 0X01
145     #define HVD_INIT_MAIN_LIVE_STREAM    BITS( 3:2,2)    ///< main type: 0X10
146 #define HVD_INIT_INPUT_MASK    BMASK(4:4)    ///< process path for filling BBU table:  file mode. use drive; TSP: use tsp mode
147     #define HVD_INIT_INPUT_TSP    BITS( 4:4,0)    ///< tsp input( default)
148     #define HVD_INIT_INPUT_DRV    BITS( 4:4,1)     ///< driver input
149 #define HVD_INIT_START_CODE_MASK    BMASK(5:5)    ///< AVC FILE MODE ONLY: mkv, mp4 container use.
150     #define HVD_INIT_START_CODE_REMAINED    BITS( 5:5,0)    ///< start code remained.(Defualt)
151     #define HVD_INIT_START_CODE_REMOVED    BITS( 5:5,1)    ///< start code removed.
152 #define HVD_INIT_UTOPIA_ENVI            BIT( 6)        ///< check MIU sel and set it
153 #define HVD_INIT_DBG_FW            BIT( 7)        ///< check FW is debug version or not
154 //#define HVD_INIT_ENABLE_ISR_DISP            BIT( 8)        ///< enable display ISR. ISR occurs at every Vsync.
155 
156 #define HVD_RV_BROKEN_BY_US_MASK        0x80000000
157 
158 
159 
160 
161 
162 #define HVD_CCRB_PACKET_LENGTH      8
163 
164 #define T35_DVB_COUNTRY_CODE  0xB5
165 #define T35_DVB_PROVIDER_CODE 0x0031
166 
167 #define DTV_AFD_CODE   0x44544731
168 #define DTV_DTB1_CODE  0x47413934
169 
170 #define DTV_BAR_CODE 0x06
171 #define DTV_CC_CODE 0x03
172 #define DTV_DIRECTTV_CODE 0x2F
173 
174 #define MAX_NTSC_CC_ELE  4
175 #define MAX_NTSC_CC_BYTE (MAX_NTSC_CC_ELE << 2)
176 #define MAX_DTV_CC_BYTE  128
177 
178 #define CC_NTSC1    1
179 #define CC_NTSC2    2
180 #define CC_ATSC        4
181 #define CC_157      (CC_NTSC1|CC_NTSC2)
182 
183 #define USER_DATA_MODE_DVB_NORMAL                 0x00
184 #define USER_DATA_MODE_DIRECTTV_CC                0x01
185 #define USER_DATA_MODE_FRM_PACKING_ARRANGEMENT    0x02
186 #define USER_DATA_MODE_ATSC_CC_RAW                0x04
187 
188 #define MAX_608_CC_LEN 512
189 #define MAX_708_CC_LEN 512
190 
191 
192 
193 
194 
195 
196 
197 
198 //-------------------------------------------------------------------------------------------------
199 //  Type and Structure
200 //-------------------------------------------------------------------------------------------------
201 typedef void (*HVD_InterruptCb)(void);
202 
203 
204 
205 //-----------------------------------------------------------------------------
206 /// @brief \b Enum \b Name: EN_CC_HVD_INFO
207 /// @brief \b Enum \b Description:  The type of Close Caption Selector
208 typedef enum
209 {
210     HVD_CC_SELECTOR_708_SW              = 0x0000,
211     HVD_CC_SELECTOR_RINGBUFFER    = 0x0001
212 
213 } EN_CC_HVD_INFO;
214 
215 //-----------------------------------------------------------------------------
216 /// @brief \b Enum \b Name: HVD_Result
217 /// @brief \b Enum \b Description:  General result of HVD functions
218 //-----------------------------------------------------------------------------
219 typedef enum
220 {
221     E_HVD_FAIL=0,       ///< General fail cases.
222     E_HVD_OK,          ///< Action success.
223     E_HVD_RET_INVALID_PARAMETER,            ///< Function has invalid input.
224     E_HVD_RET_ILLEGAL_ACCESS,           ///< Illegal access. like driver not initialized.
225     E_HVD_RET_HARDWARE_BREAKDOWN,           ///< HW has no responses or impossible responses.
226     E_HVD_RET_OUTOF_MEMORY,             ///< The input memory config is not enough.
227     E_HVD_RET_UNSUPPORTED,              ///< Function is not supported by HVD driver.
228     E_HVD_RET_TIMEOUT,              ///< Action timeout.
229     E_HVD_RET_NOTREADY,             ///< Action not ready. User needs to call it again later.
230     E_HVD_RET_MEMORY_OVERWIRTE,             ///< The input memory config may be overwrite.
231     E_HVD_RET_QUEUE_FULL,          ///< HVD BBU queue or ES buffer is full.
232     E_HVD_RET_RE_INIT,          ///< HVD BBU queue or ES buffer is full.
233     E_HVD_RET_NOT_RUNNING,          ///< HVD BBU queue or ES buffer is full.
234 } HVD_Result;
235 
236 //-----------------------------------------------------------------------------
237 /// @brief \b Enum \b Name: HVD_Get_Play_State
238 /// @brief \b Enum \b Description:  The current HVD play state.
239 //-----------------------------------------------------------------------------
240 typedef enum
241 {
242     E_HVD_GSTATE_INIT,          ///< Before or during initialization.
243     E_HVD_GSTATE_PLAY,          ///< playback.
244     E_HVD_GSTATE_PAUSE,         ///< decode and display are all paused.
245     E_HVD_GSTATE_STOP,          ///< after stop.
246 }HVD_Get_Play_State;
247 
248 //-----------------------------------------------------------------------------
249 /// @brief \b Enum \b Name: HVD_Sync_Type
250 /// @brief \b Enum \b Description:  The current mode type of HVD synchronization .
251 //-----------------------------------------------------------------------------
252 typedef enum
253 {
254     E_HVD_SYNC_ATS,     ///< Live stream, or TS file mode.
255     E_HVD_SYNC_PTS,     ///< only for file mode, input time stamp is PTS.
256     E_HVD_SYNC_DTS,     ///< only for file mode, input time stamp is DTS.
257     E_HVD_SYNC_STS,     ///< only for file mode, input time stamp is random, output should be sorted.
258 }HVD_Sync_Type;
259 
260 
261 //-----------------------------------------------------------------------------
262 /// @brief \b Enum \b Name: HVD_Time_Unit_Type
263 /// @brief \b Enum \b Description:  The current time unit type of HVD input/ouput.
264 //-----------------------------------------------------------------------------
265 typedef enum
266 {
267     E_HVD_TIME_UNIT_90KHZ,     ///< 90khz
268     E_HVD_TIME_UNIT_1KHZ,     ///< ms
269 }HVD_Time_Unit_Type;
270 
271 //-----------------------------------------------------------------------------
272 /// @brief \b Enum \b Name: HVD_Disp_Speed
273 /// @brief \b Enum \b Description:  The current mode type of HVD display speed
274 //-----------------------------------------------------------------------------
275 typedef enum
276 {
277     E_HVD_DISP_SPEED_FF_32X=32,           ///< Speed fast forward 32x.
278     E_HVD_DISP_SPEED_FF_16X=16,           ///< Speed fast forward 16x.
279     E_HVD_DISP_SPEED_FF_8X=8,                 ///< Speed fast forward 8x.
280     E_HVD_DISP_SPEED_FF_4X=4,                 ///< Speed fast forward 4x.
281     E_HVD_DISP_SPEED_FF_2X=2,                 ///< Speed fast forward 2x.
282     E_HVD_DISP_SPEED_NORMAL_1X= 1,              ///< Normal display speed.
283     E_HVD_DISP_SPEED_SF_2X= -2,              ///< Slow forward 2X.
284     E_HVD_DISP_SPEED_SF_4X= -4,              ///< Slow forward 4X.
285     E_HVD_DISP_SPEED_SF_8X= -8,              ///< Slow forward 8X.
286     E_HVD_DISP_SPEED_SF_16X= -16,            ///< Slow forward 16X.
287     E_HVD_DISP_SPEED_SF_32X= -32,            ///< Slow forward 32X.
288 }HVD_Drv_Disp_Speed;
289 
290 //-----------------------------------------------------------------------------
291 /// @brief \b Enum \b Name: HVD_Drop_Disp
292 /// @brief \b Enum \b Description:  The current mode type of HVD dropping decoded frames.
293 //-----------------------------------------------------------------------------
294 typedef enum
295 {
296     E_HVD_DROP_DISPLAY_AUTO = (1<<0),       ///< automatic drop mode, drop frame if display queue is more than threshold
297     E_HVD_DROP_DISPLAY_ONCE = (1<<1),       ///< drop once, drop the number of non-ref frames
298 }HVD_Drop_Disp;
299 
300 //-----------------------------------------------------------------------------
301 /// @brief \b Enum \b Name: HVD_FrmRateConv_Mode
302 /// @brief \b Enum \b Description:  The current mode type of HVD frame rate convertion.
303 //-----------------------------------------------------------------------------
304 typedef enum
305 {
306     E_HVD_FRC_MODE_NORMAL,          ///< Disable FRC mode.
307     E_HVD_FRC_MODE_32PULLDOWN,    ///< 3:2 pulldown mode (ex. 24p a 60i or 60p)
308     E_HVD_FRC_MODE_PAL2NTSC ,     ///< PALaNTSC conversion (50i a 60i)
309     E_HVD_FRC_MODE_NTSC2PAL,      ///< NTSCaPAL conversion (60i a 50i)
310     E_HVD_FRC_MODE_DISP_2X,    ///< output rate is twice of input rate (ex. 30p a 60p)
311     E_HVD_FRC_MODE_24_TO_50,    ///< output rate 24P->50P 48I->50I
312     E_HVD_FRC_MODE_50P_60P,    ///< output rate 50P ->60P
313     E_HVD_FRC_MODE_60P_50P,    ///< output rate 60P ->50P
314 }HVD_FrmRateConv_Mode;
315 
316 //-----------------------------------------------------------------------------
317 /// @brief \b Enum \b Name: HVD_Codec
318 /// @brief \b Enum \b Description:  The supported codec type.
319 //-----------------------------------------------------------------------------
320 typedef enum
321 {
322     E_HVD_AVC,
323     E_HVD_AVS,
324     E_HVD_RM,
325 }HVD_Codec;
326 
327 //-----------------------------------------------------------------------------
328 /// @brief \b Enum \b Name: HVD_Get_Mode_Status
329 /// @brief \b Enum \b Description:  The available mode information supported by HVD.
330 //-----------------------------------------------------------------------------
331 typedef enum
332 {
333     E_HVD_GMODE_IS_SHOW_ERR_FRM,
334     E_HVD_GMODE_IS_REPEAT_LAST_FIELD,
335     E_HVD_GMODE_IS_ERR_CONCEAL,
336     E_HVD_GMODE_IS_SYNC_ON,
337     E_HVD_GMODE_IS_PLAYBACK_FINISH,
338     E_HVD_GMODE_SYNC_MODE,
339     E_HVD_GMODE_SKIP_MODE,
340     E_HVD_GMODE_DROP_MODE,
341     E_HVD_GMODE_DISPLAY_SPEED,
342     E_HVD_GMODE_FRC_MODE,
343     E_HVD_GMODE_ISR_TYPE,
344     E_HVD_GMODE_IS_STEP_DISPLAY=0x0100,
345     E_HVD_GMODE_STREAM_TYPE,
346 }HVD_Get_Mode_Status;
347 
348 //-----------------------------------------------------------------------------
349 /// @brief \b Enum \b Name: HVD_Skip_Decode
350 /// @brief \b Enum \b Description:  The HVD decoding frame types.
351 //-----------------------------------------------------------------------------
352 typedef enum
353 {
354     E_HVD_SKIP_DECODE_ALL,  ///< decode all frames
355     E_HVD_SKIP_DECODE_I,    ///< decode I frames only
356     E_HVD_SKIP_DECODE_IP,   ///< decode I and referenced frames only( skip non-ref frames)
357 }HVD_Skip_Decode;
358 
359 //-----------------------------------------------------------------------------
360 /// @brief \b Enum \b Name: HVD_Frm_Type
361 /// @brief \b Enum \b Description:  The frame type.
362 //-----------------------------------------------------------------------------
363 typedef enum
364 {
365     E_HVD_FRM_TYPE_I,  ///< I frame.
366     E_HVD_FRM_TYPE_P,  ///< P frame.
367     E_HVD_FRM_TYPE_B,  ///< B frame.
368 }HVD_Frm_Type;
369 
370 //-----------------------------------------------------------------------------
371 /// @brief \b Enum \b Name: HVD_FieldType
372 /// @brief \b Enum \b Description:  The Field type.
373 //-----------------------------------------------------------------------------
374 typedef enum
375 {
376     E_HVD_FIELDTYPE_NONE,  ///< no field.
377     E_HVD_FIELDTYPE_TOP,  ///< Top field only.
378     E_HVD_FIELDTYPE_BOTTOM,  ///< Bottom field only.
379     E_HVD_FIELDTYPE_BOTH,  ///< Both fields.
380 }HVD_FieldType;
381 
382 //-----------------------------------------------------------------------------
383 /// @brief \b Enum \b Name: HVD_Uart_Level
384 /// @brief \b Enum \b Description:  The debug level of HVD.
385 //-----------------------------------------------------------------------------
386 typedef enum
387 {
388     E_HVD_UART_LEVEL_NONE=0,        ///< Disable all uart message.
389     E_HVD_UART_LEVEL_ERR,           ///< Only output error message
390     E_HVD_UART_LEVEL_INFO,          ///< output general message, and above.
391     E_HVD_UART_LEVEL_DBG,           ///< output debug message, and above.
392     E_HVD_UART_LEVEL_TRACE,           ///< output function trace message, and above.
393     E_HVD_UART_LEVEL_FW,                ///< output FW message, and above.
394 } HVD_Uart_Level;
395 
396 //-----------------------------------------------------------------------------
397 /// @brief \b Enum \b Name: HVD_Pattern_Info
398 /// @brief \b Enum \b Description:  The information type of specific pattern.
399 //-----------------------------------------------------------------------------
400 typedef enum
401 {
402     E_HVD_FLUSH_PATTERN_SIZE,         ///< flush pattern size.
403     E_HVD_DUMMY_HW_FIFO,            ///< HW fifo size.
404 } HVD_Pattern_Info;
405 
406 //-----------------------------------------------------------------------------
407 /// @brief \b Enum \b Name: HVD_DynamicScaling_Info
408 /// @brief \b Enum \b Description:  The information type of specific dynamic information.
409 //-----------------------------------------------------------------------------
410 typedef enum
411 {
412     E_HVD_DS_BUF_MIUSEL,       ///< the HW MIU selection of the buffer of dynamic scaling. TRUE: MIU 1. FALSE: MIU 0.
413     E_HVD_DS_BUF_ADDR,         ///< the start physical address of the buffer of dynamic scaling.
414     E_HVD_DS_BUF_SIZE,         ///< the size of the buffer of dynamic scaling.
415     E_HVD_DS_VECTOR_DEPTH,     ///< the required vector depth of the dynamic scaling.
416     E_HVD_DS_INFO_ADDR,        ///< the scaler info buffer address of dynamic scaling.
417     E_HVD_DS_IS_ENABLED,       ///< if dynamic scaling is enabled.
418 }HVD_DynamicScaling_Info;
419 
420 //-----------------------------------------------------------------------------
421 /// @brief \b Enum \b Name: HVD_ISR_Event
422 /// @brief \b Enum \b Description:  The information type of ISR event.
423 //-----------------------------------------------------------------------------
424 typedef enum
425 {
426     E_HVD_ISR_NONE = 0,                        ///< disable ISR
427     E_HVD_ISR_DISP_ONE = BIT(0),               ///< HVD display one frame on screen.
428     E_HVD_ISR_DISP_REPEAT = BIT(1),            ///< The current displayed frame is repeated frame.
429     E_HVD_ISR_DISP_WITH_CC = BIT(2),           ///< Current displayed frame should be displayed with user data.
430     E_HVD_ISR_DISP_FIRST_FRM = BIT(3),         ///< HVD display first frame on screen.
431 
432     E_HVD_ISR_DEC_ONE = BIT(8),                ///< HVD decoded one frame done.
433     E_HVD_ISR_DEC_I = BIT(9),                  ///< HVD decoded one I frame done.
434     E_HVD_ISR_DEC_HW_ERR = BIT(10),            ///< HVD HW found decode error.
435     E_HVD_ISR_DEC_CC_FOUND = BIT(11),          ///< HVD found one user data with decoded frame.
436     E_HVD_ISR_DEC_DISP_INFO_CHANGE = BIT(12),  ///< HVD found display information change.
437     E_HVD_ISR_DEC_DATA_ERR = BIT(13),          ///< HVD HW found decode error.
438     E_HVD_ISR_DEC_FIRST_FRM = BIT(14),         ///< HVD decode first frame.
439 } HVD_ISR_Event;
440 
441 //-----------------------------------------------------------------------------
442 /// @brief \b Enum \b Name: HVD_Get_Frm_Info_Type
443 /// @brief \b Enum \b Description:  The information type of get frame information.
444 //-----------------------------------------------------------------------------
445 typedef enum
446 {
447     E_HVD_GFRMINFO_DISPLAY=0,          ///< Displayed frame.
448     E_HVD_GFRMINFO_DECODE,          ///< Decoded frame.
449     E_HVD_GFRMINFO_NEXT_DISPLAY,       ///< Next frame to be displayed.
450 } HVD_Get_Frm_Info_Type;
451 
452 //-----------------------------------------------------------------------------
453 /// @brief \b Enum \b Name: HVD_GData_Type
454 /// @brief \b Enum \b Description:  The information type of get data
455 //-----------------------------------------------------------------------------
456 typedef enum
457 {
458     E_HVD_GDATA_TYPE_DISP_CNT,
459     E_HVD_GDATA_TYPE_SKIP_CNT,
460     E_HVD_GDATA_TYPE_DROP_CNT,
461     E_HVD_GDATA_TYPE_IDLE_CNT,
462     E_HVD_GDATA_TYPE_VSYNC_CNT,
463     E_HVD_GDATA_TYPE_MAIN_LOOP_CNT,
464     E_HVD_GDATA_TYPE_AVC_LEVEL_IDC,
465     E_HVD_GDATA_TYPE_DISP_Q_SIZE,
466     E_HVD_GDATA_TYPE_ES_LEVEL,
467     E_HVD_GDATA_TYPE_AVC_VUI_DISP_INFO,
468     E_HVD_GDATA_TYPE_DISP_STC,
469     E_HVD_GDATA_TYPE_USERDATA_IDX_TBL_SIZE,
470     E_HVD_GDATA_TYPE_USERDATA_PACKET_SIZE,
471     E_HVD_GDATA_TYPE_REAL_FRAMERATE,
472     E_HVD_GDATA_TYPE_IS_ORI_INTERLACE_MODE,
473     E_HVD_GDATA_TYPE_FRMPAC_ARRANGE_CNL_FLAG,
474     E_HVD_GDATA_TYPE_FRMPAC_ARRANGE_TYPE,
475     E_HVD_GDATA_TYPE_FB_USAGE_MEM
476 } HVD_GData_Type;
477 
478 //-----------------------------------------------------------------------------
479 /// @brief \b Enum \b Name: HVD_TimeUnit_Type
480 /// @brief \b Enum \b Description:  The type of time unit.
481 //-----------------------------------------------------------------------------
482 typedef enum
483 {
484     E_HVD_TIMEUNIT_90KHZ,       ///< Time unit is 90KHz
485     E_HVD_TIMEUNIT_MS,       ///< Time unit is millisecond.
486 } HVD_TimeUnit_Type;
487 
488 //-----------------------------------------------------------------------------
489 /// @brief \b Enum \b Name: HVD_GData_Type
490 /// @brief \b Enum \b Description:  The type of set settings
491 //-----------------------------------------------------------------------------
492 typedef enum
493 {
494     E_HVD_SSET_TIME_UNIT,       ///< set the HVD time unit of all interface. HVD_TimeUnit_Type
495     E_HVD_SSET_PITCH,               ///< set the pitch of vsync.
496     E_HVD_SSET_SYNC_EACH_FRM,   ///< HVD does sync action at every frame. TREU: turn on; FALSE: turn off.
497     E_HVD_SSET_MAX_DEC_TICK,    ///< HVD limits the max decode ticks for one field.
498     E_HVD_SSET_AUTO_FREE_ES,    ///< HVD frees the ES buffer data when ES is being fulled.
499     E_HVD_SSET_MIN_FRAME_GAP,       ///< set HVD not to report error which is caused by the frame gap larger than min frame gap.
500     E_HVD_SSET_DISABLE_DEBLOCKING,    ///< HVD will not do deblocking process.
501     E_HVD_SSET_DISABLE_QUARTER_PIXEL,   ///< HVD will not do quarter pixel process.
502     E_HVD_SSET_MIU_BURST_CNT_LEVEL,     ///< HVD MIU Burst Cnt, Arg 0~7: burst cnt level, 0xFFFFFFFF = Disable
503     E_HVD_SSET_DISABLE_ANTI_VDEAD,      ///< HVD disable Anti-Video Deadlock function.
504     E_HVD_SSET_FLUSH_FRM_BUF,        /// Arg: 1 show last decode frame, 0 show current diaplay frame. FW will clear all frame buffer then skip to next I frame.
505 } HVD_SSettings_Type;
506 
507 //-----------------------------------------------------------------------------
508 /// @brief \b Enum \b Name: HVD_PatternType
509 /// @brief \b Enum \b Description:  The type of special pattern for specific purpose.
510 //-----------------------------------------------------------------------------
511 typedef enum
512 {
513     E_HVD_PATTERN_FLUSH = 0,           ///< Used after MDrv_HVD_Flush().
514     E_HVD_PATTERN_FILEEND,             ///< Used after MDrv_HVD_SetDataEnd().
515 }HVD_PatternType;
516 
517 
518 //-----------------------------------------------------------------------------
519 /// @brief \b Enum \b Name: HVD_ES_Level
520 /// @brief \b Enum \b Description:  The level of ES buffer.
521 //-----------------------------------------------------------------------------
522 typedef enum
523 {
524     E_HVD_ES_LEVEL_NORMAL = 0,
525     E_HVD_ES_LEVEL_UNDER = BIT(0),
526     E_HVD_ES_LEVEL_OVER = BIT(1),
527 } HVD_ES_Level;
528 
529 //-----------------------------------------------------------------------------
530 /// @brief \b Enum \b Name: HVD_ErrorCode
531 /// @brief \b Enum \b Description:  The type of HVD error
532 //-----------------------------------------------------------------------------
533 typedef enum
534 {
535         E_HVD_ERRCODE_GENERAL_BASE = 0x0000,
536     E_HVD_ERRCODE_OUT_OF_SPEC ,
537     E_HVD_ERRCODE_UNKNOW_ERR,
538     E_HVD_ERRCODE_HW_BREAK_DOWN,
539     E_HVD_ERRCODE_HW_DEC_TIMEOUT,
540     E_HVD_ERRCODE_OUT_OF_MEMORY,
541     E_HVD_ERRCODE_UNKNOWN_CODEC,
542     // AVC
543         E_HVD_ERRCODE_AVC_BASE = 0x1000,
544     E_HVD_ERRCODE_AVC_SPS_BROKEN,           // SPS is not valid
545     E_HVD_ERRCODE_AVC_SPS_NOT_IN_SPEC,
546     E_HVD_ERRCODE_AVC_SPS_NOT_ENOUGH_FRM,   // DPB size at specified level is smaller than the specified number of reference frames. This is not allowed
547     E_HVD_ERRCODE_AVC_PPS_BROKEN,           // PPS is not valid
548     E_HVD_ERRCODE_AVC_REF_LIST,
549     E_HVD_ERRCODE_AVC_NO_REF,
550     E_HVD_ERRCODE_AVC_RES,
551 
552     // AVS
553         E_HVD_ERRCODE_AVS_BASE = (0x2000),
554     E_HVD_ERRCODE_AVS_RES,
555 
556     // RM
557         E_HVD_ERRCODE_RM_BASE = (0x3000),
558     E_HVD_ERRCODE_RM_PACKET_HEADER,
559     E_HVD_ERRCODE_RM_FRAME_HEADER,
560     E_HVD_ERRCODE_RM_SLICE_HEADER,
561     E_HVD_ERRCODE_RM_BYTE_CNT,
562     E_HVD_ERRCODE_RM_DISP_TIMEOUT,
563     E_HVD_ERRCODE_RM_NO_REF,
564     E_HVD_ERRCODE_RM_RES,
565 }HVD_ErrorCode;
566 
567 //-----------------------------------------------------------------------------
568 /// @brief \b Enum \b Name: HVD_TurboInitLevel
569 /// @brief \b Enum \b Description:  The level of turbo init mode.
570 //-----------------------------------------------------------------------------
571 typedef enum
572 {
573     E_HVD_TURBOINIT_NONE=0,     ///< Not omit any process.
574     E_HVD_TURBOINIT_CHECK = BIT(0),     ///< Omit checking.
575     E_HVD_TURBOINIT_MEMORY = BIT(1),     ///< Omit memory reset process.
576     E_HVD_TURBOINIT_DISPLAY = BIT(2),     ///< Omit FW display setup process.
577     E_HVD_TURBOINIT_FW_RELOAD = BIT(3), ///< Omit FW reload process.
578 }HVD_TurboInit_Type;
579 
580 //-----------------------------------------------------------------------------
581 /// @brief \b Enum \b Name: HVD_FWSourceType
582 /// @brief \b Enum \b Description:  The type of fw binary input source
583 //-----------------------------------------------------------------------------
584 typedef enum
585 {
586     E_HVD_FW_SOURCE_NONE,       ///< No input fw.
587     E_HVD_FW_SOURCE_DRAM,       ///< input source from DRAM.
588     E_HVD_FW_SOURCE_FLASH,      ///< input source from FLASH.
589 }HVD_FWSourceType;
590 
591 //-----------------------------------------------------------------------------
592 /// @brief \b Enum \b Name: HVD_DumpStatus
593 /// @brief \b Enum \b Description:  The type of fw binary input source
594 //-----------------------------------------------------------------------------
595 typedef enum
596 {
597     E_HVD_DUMP_STATUS_DRV=BIT(0),       ///< Dump Driver status
598     E_HVD_DUMP_STATUS_FW=BIT(1),       ///< Dump firmware status
599     E_HVD_DUMP_STATUS_HW=BIT(2),       ///< Dump hardware status
600 }HVD_DumpStatus;
601 
602 //-----------------------------------------------------------------------------
603 typedef enum
604 {
605     E_HVD_FB_REDUCTION_NONE = 0,        ///< FB reduction disable
606     E_HVD_FB_REDUCTION_1_2 = 1,         ///< FB reduction 1/2
607     E_HVD_FB_REDUCTION_1_4 = 2,         ///< FB reduction 1/4
608 }HVD_FB_Reduction_Type;
609 
610 
611 typedef enum
612 {
613     E_HVD_CLOCK_SPEED_NONE = 0,
614     E_HVD_CLOCK_SPEED_HIGHEST,
615     E_HVD_CLOCK_SPEED_HIGH,
616     E_HVD_CLOCK_SPEED_MEDIUM,
617     E_HVD_CLOCK_SPEED_LOW,
618     E_HVD_CLOCK_SPEED_LOWEST,
619     E_HVD_CLOCK_SPEED_DEFAULT,
620 } HVD_ClockSpeed;
621 
622 
623 /// @brief \b Struct \b Name: HVD_Disp_Info
624 /// @brief \b Struct \b Description:  Store the HVD driver information
625 //-----------------------------------------------------------------------------
626 typedef struct
627 {
628     MS_U16 u16HorSize;          ///< pixel width.
629     MS_U16 u16VerSize;          ///< pixel height.
630     MS_U32 u32FrameRate;    ///< 1000 times frames per second.
631     MS_U8 u8AspectRate;     ///< aspect ration ID.
632     MS_U8 u8Interlace;          ///< interlace content
633     MS_U8 u8AFD;            ///< AFD ID number
634     MS_U8 bChroma_idc_Mono;             ///< - TRUE: mono mode FALSE: colorful, not mono
635     MS_U16 u16SarWidth;            ///< Sample aspect width ratio.
636     MS_U16 u16SarHeight;           ///< Sample aspect height ratio.
637     MS_U16 u16CropRight;            ///< crop right.
638     MS_U16 u16CropLeft;             ///< crop left.
639     MS_U16 u16CropBottom;           ///< crop bottom.
640     MS_U16 u16CropTop;          ///< crop top.
641     MS_U16 u16Pitch;            ///< pitch
642     MS_U8  u8ColourPrimaries;   ///< Color Primaries in VUI
643     //****************************
644     MS_U8 reserved8_0;          ///< reserved.
645     //******************************
646 } HVD_Disp_Info;     //  bytes
647 
648 //-----------------------------------------------------------------------------
649 /// @brief \b Struct \b Name: HVD_DrvInfo
650 /// @brief \b Struct \b Description:  Store the HVD driver information
651 //-----------------------------------------------------------------------------
652 typedef struct
653 {
654     MS_BOOL bAVC;       ///< - TRUE: HW does support AVC.  - FALSE: HW does not support AVC.
655     MS_BOOL bAVS;       ///< - TRUE: HW does support AVS.  - FALSE: HW does not support AVS.
656     MS_BOOL bRM;        ///< - TRUE: HW does support RM.  - FALSE: HW does not support RM.
657     MS_U32 FWversion;       ///<  FW version number.
658 } HVD_DrvInfo;
659 
660 //-----------------------------------------------------------------------------
661 /// @brief \b Struct \b Name: HVD_DrvStatus
662 /// @brief \b Struct \b Description:  Store the HVD driver status
663 //-----------------------------------------------------------------------------
664 typedef struct
665 {
666     MS_BOOL bInit;       ///< - TRUE: Initialization success.  - FALSE: Initialization failed or not initialized yet.
667     MS_BOOL bBusy;       ///< - TRUE: Driver is processing  - FALSE: Driver is Idle.
668 } HVD_DrvStatus;
669 
670 //-----------------------------------------------------------------------------
671 /// @brief \b Struct \b Name: RV_Info
672 /// @brief \b Struct \b Description:  RV file information
673 //-----------------------------------------------------------------------------
674 typedef struct
675 {
676     MS_U16 RV_Version;      ///< Real Video Bitstream version
677     MS_U16 ulNumSizes;      ///< Real Video Number sizes
678     MS_U16 ulPicSizes_w[8]; ///< Real Video file width
679     MS_U16 ulPicSizes_h[8]; ///< Real Video file height
680 } RV_Info;
681 
682 //-----------------------------------------------------------------------------
683 typedef struct
684 {
685     HVD_FB_Reduction_Type LumaFBReductionMode;     ///< Luma frame buffer reduction mode.
686     HVD_FB_Reduction_Type ChromaFBReductionMode;   ///< Chroma frame buffer reduction mode.
687     MS_U8				  u8EnableAutoMode;	  /// 0: Disable, 1: Enable
688 } HVD_FB_Reduction;
689 /// @brief \b Struct \b Name: HVD_MemCfg
690 /// @brief \b Struct \b Description:  Store the HVD driver config
691 //-----------------------------------------------------------------------------
692 typedef struct
693 {
694     HVD_FWSourceType eFWSourceType;             //!< the input FW source type.
695     MS_U32  u32FWBinaryVAddr;                //!<  virtual address of input FW binary in DRAM
696     MS_PHY  u32FWBinaryAddr;                //!< the physical memory start address in Flash/DRAM memory of FW code
697     MS_U32  u32FWBinarySize;                //!< the FW code size
698     MS_U32 u32VLCBinaryVAddr;///< VLC table binary data buffer start address
699     MS_PHY u32VLCBinaryAddr;///< VLC table binary data buffer start address
700     MS_U32 u32VLCBinarySize;///<VLC table binary data buffer size
701     MS_PHY  u32MIU1BaseAddr;       //!< the physical memory start address of MIU 1 base address. 0: default value.
702     MS_U32  u32CodeBufVAddr;        //!< the virtual memory start address of code buffer
703     MS_PHY  u32CodeBufAddr;         //!< the physical memory start address of code buffer
704     MS_U32  u32CodeBufSize;             //!< the code buffer size
705     MS_U32  u32FrameBufVAddr;           //!< the virtual memory start address of frame buffer
706     MS_PHY  u32FrameBufAddr;            //!< the physical memory start address of frame buffer
707     MS_U32  u32FrameBufSize;                //!< the frame buffer size
708     MS_U32  u32BitstreamBufVAddr;           //!< the virtual memory start address of bit stream buffer
709     MS_PHY  u32BitstreamBufAddr;                //!< the physical memory start address of bit stream buffer
710     MS_U32  u32BitstreamBufSize;            //!< the bit stream buffer size
711     MS_U32  u32DrvProcessBufVAddr;       //!< the virtual memory start address of driver process buffer
712     MS_PHY  u32DrvProcessBufAddr;       //!< the physical memory start address of driver process buffer
713     MS_U32  u32DrvProcessBufSize;        //!< the driver process buffer size
714 } HVD_MemCfg;
715 
716 //-----------------------------------------------------------------------------
717 /// @brief \b Struct \b Name: HVD_Init_Params
718 /// @brief \b Struct \b Description:  Store the initialization settings
719 //-----------------------------------------------------------------------------
720 typedef struct
721 {
722     MS_U32 u32ModeFlag;     ///< init mode flag, use HVD_INIT_* to setup HVD.
723     MS_U32 u32FrameRate;     ///< frame rate.
724     MS_U32 u32FrameRateBase;     ///< frame rate base. The value of u32FrameRate /u32FrameRateBase must be frames per sec.
725     MS_U8   u8MinFrmGap;    ///< set the min frame gap.
726     MS_U8   u8SyncType;         ///< HVD_Sync_Type. sync type of current playback.
727     MS_U16 u16Pitch;   ///< not zero: specify the pitch. 0: use default value.
728     MS_U32 u32MaxDecTick;   ///< not zero: specify the max decode tick. 0: use default value.
729     MS_BOOL bSyncEachFrm;   ///< TRUE: sync STC at each frame. FALSE: not sync each frame.
730     MS_BOOL bAutoFreeES;   ///< TRUE: auto free ES buffer when ES buffer is full. FALSE: not do the auto free.
731     MS_BOOL bAutoPowerSaving;   ///< TRUE: auto power saving. FALSE: not do the auto power saving.
732     MS_BOOL bDynamicScaling;   ///< TRUE: enable Dynamic Scaling. FALSE: disable Dynamic Scaling.
733     MS_BOOL bFastDisplay;   ///< TRUE: enable Fast Display. FALSE: disable Fast Display.
734     MS_BOOL bUserData;   ///< TRUE: enable processing User data. FALSE: disable processing User data.
735     MS_U8 u8TurboInit;       ///< HVD_TurboInitLevel. set the turbo init mode.
736     MS_U8 u8TimeUnit;   ///< HVD_Time_Unit_Type.set the type of input/output time unit.
737     MS_U16 u16DecoderClock;      ///< HVD decoder clock speed. 0: default value. non-zero: any nearist clock.
738     RV_Info* pRVFileInfo;           ///< pointer to RV file info
739     HVD_FB_Reduction stFBReduction; ///< HVD Frame buffer reduction type
740 } HVD_Init_Settings;
741 
742 //-----------------------------------------------------------------------------
743 /// @brief \b Struct \b Name: HVD_Packet_Info
744 /// @brief \b Struct \b Description:  Store the packet information
745 //-----------------------------------------------------------------------------
746 typedef struct
747 {
748     MS_U32 u32Staddr;     ///< Packet offset from bitstream buffer base address. unit: byte.
749     MS_U32 u32Length;    ///< Packet size. unit: byte.
750     MS_U32 u32TimeStamp;    ///< Packet time stamp. unit: ms.
751     MS_U32 u32ID_L;    ///< Packet ID low part.
752     MS_U32 u32ID_H;    ///< Packet ID high part.
753 }HVD_Packet_Info;
754 
755 //-----------------------------------------------------------------------------
756 /// @brief \b Struct \b Name: HVD_Frame_Info
757 /// @brief \b Struct \b Description:  Store the frame information
758 //-----------------------------------------------------------------------------
759 typedef struct
760 {
761     MS_PHY u32LumaAddr;                 ///< The start physical of luma data. Unit: byte.
762     MS_PHY u32ChromaAddr;               ///< The start physcal of chroma data. Unit: byte.
763     MS_U32 u32TimeStamp;                ///< Time stamp(DTS, PTS) of current displayed frame. Unit: 90khz.
764     MS_U32 u32ID_L;                     ///< low part of ID number decided by MDrv_HVD_PushQueue().
765     MS_U32 u32ID_H;                     ///< high part of ID number decided by MDrv_HVD_PushQueue().
766     MS_U16 u16Pitch;                        ///< The pitch of current frame.
767     MS_U16 u16Width;                        ///< pixel width of current frame.
768     MS_U16 u16Height;                       ///< pixel height of current frame.
769     HVD_Frm_Type eFrmType;     ///< picture type: I, P, B frame
770     HVD_FieldType  eFieldType;                 ///< none, top , bottom, both field
771 } HVD_Frame_Info;
772 
773 typedef struct
774 {
775     MS_BOOL aspect_ratio_info_present_flag;            // u(1)
776     MS_U8 aspect_ratio_idc;                            // u(8)
777     MS_U16 sar_width;                                  // u(16)
778     MS_U16 sar_height;                                 // u(16)
779     MS_BOOL overscan_info_present_flag;                // u(1)
780     MS_BOOL overscan_appropriate_flag;                 // u(1)
781     MS_BOOL video_signal_type_present_flag;            // u(1)
782     MS_U8 video_format;                                // u(3)
783     MS_BOOL video_full_range_flag;                     // u(1)
784     MS_BOOL colour_description_present_flag;           // u(1)
785     MS_U8 colour_primaries;                            // u(8)
786     MS_U8 transfer_characteristics;                    // u(8)
787     MS_U8 matrix_coefficients;                         // u(8)
788     MS_BOOL chroma_location_info_present_flag;         // u(1)
789     MS_U8 chroma_sample_loc_type_top_field;            // ue(v) 0~5
790     MS_U8 chroma_sample_loc_type_bottom_field;         // ue(v) 0~5
791     MS_BOOL timing_info_present_flag;                  // u(1)
792     MS_BOOL fixed_frame_rate_flag;                     // u(1)
793     MS_U32 num_units_in_tick;                          // u(32)
794     MS_U32 time_scale;                                 // u(32)
795 } HVD_VUI_DISP_INFO;
796 
797 //-----------------------------------------------------------------------------
798 /// @brief \b Struct \b Name: HVD_DISP_INFO_THRESHOLD
799 /// @brief \b Struct \b Description:  Store the disp information threshold
800 //-----------------------------------------------------------------------------
801 typedef struct
802 {
803     MS_U32 u32FrmrateUpBound;       //Framerate filter upper bound
804     MS_U32 u32FrmrateLowBound;      //Framerate filter lower bound
805     MS_U32 u32MvopUpBound;          //mvop filter upper bound
806     MS_U32 u32MvopLowBound;         //mvop filter lower bound
807 } HVD_Disp_Info_Threshold;
808 
809 //-----------------------------------------------------------------------------
810 /// @brief \b Struct \b Name: HVD_UsrData_Info
811 /// @brief \b Struct \b Description:  Store the User Data information
812 //-----------------------------------------------------------------------------
813 typedef struct
814 {
815     MS_U32 u32Pts;
816     MS_U8  u8PicStruct;           // picture_structure
817     MS_U8  u8PicType;             // picture type: 1->I picture, 2->P,3->B
818     MS_U8  u8TopFieldFirst;       // Top field first: 1 if top field first
819     MS_U8  u8RptFirstField;       // Repeat first field: 1 if repeat field first
820 
821     MS_U32 u32DataBuf;            // User_Data data buffer address
822     MS_U16 u16TmpRef;             // Temporal reference of the picture
823     MS_U8  u8ByteCnt;             // User Data length
824     MS_U8  u8Reserve;             // Reserved
825 } HVD_UserData_Info;
826 
827 typedef struct
828 {
829     MS_U8   u8Frm_packing_arr_cnl_flag;
830     MS_U8   u8Frm_packing_arr_type;
831     MS_U8   u8content_interpretation_type;
832     MS_U8   u1Quincunx_sampling_flag;
833 
834     MS_U8   u1Spatial_flipping_flag;
835     MS_U8   u1Frame0_flipping_flag;
836     MS_U8   u1Field_views_flag;
837     MS_U8   u1Current_frame_is_frame0_flag;
838 
839     MS_U8   u1Frame0_self_contained_flag;
840     MS_U8   u1Frame1_self_contained_flag;
841     MS_U8   u4Frame0_grid_position_x;
842     MS_U8   u4Frame0_grid_position_y;
843 
844     MS_U8   u4Frame1_grid_position_x;
845     MS_U8   u4Frame1_grid_position_y;
846     MS_U8   u8Reserved01;
847     MS_U8   u8Reserved02;
848 }HVD_FrmPackingSEI;
849 
850 
851 //-------------------------------------------------------------------------------------------------
852 //  Function and Variable
853 //-------------------------------------------------------------------------------------------------
854 void        MDrv_HVD_PowerCtrl(MS_BOOL bEnable);
855 void        MDrv_HVD_SetOSRegBase(MS_U32 u32RegBaseAddr);
856 HVD_Result  MDrv_HVD_Init(HVD_MemCfg *pStMemCfg, HVD_Init_Settings *pStInitSettings);
857 HVD_Result  MDrv_HVD_Rst(MS_BOOL bErrHandle);
858 HVD_Result  MDrv_HVD_Play(void);
859 HVD_Result  MDrv_HVD_Exit(void);
860 HVD_Result  MDrv_HVD_Pause(void);
861 HVD_Result  MDrv_HVD_Flush(MS_BOOL bShowLast);
862 HVD_Result  MDrv_HVD_StepDisp(void);
863 HVD_Result  MDrv_HVD_StepDecode(void);
864 HVD_Result  MDrv_HVD_PushQueue(HVD_Packet_Info *pInfo);
865 HVD_Result  MDrv_HVD_PushQueue_Fire(void);
866 HVD_Result  MDrv_HVD_DecodeIFrame(MS_PHY u32SrcSt, MS_U32 u32SrcSize);
867 
868 HVD_Result  MDrv_HVD_SetDataEnd(MS_BOOL bEnd);
869 HVD_Result  MDrv_HVD_SetDispErrFrm(MS_BOOL bEnable);
870 HVD_Result  MDrv_HVD_SetDispRepeatField(MS_BOOL bEnable);
871 HVD_Result  MDrv_HVD_SetSkipDecMode(HVD_Skip_Decode eDecType);
872 HVD_Result  MDrv_HVD_SetDispSpeed(HVD_Drv_Disp_Speed eSpeed);
873 HVD_Result  MDrv_HVD_SetSyncActive(MS_BOOL bEnable);
874 HVD_Result  MDrv_HVD_SetDropMode(HVD_Drop_Disp eMode, MS_U32 u32Arg);
875 HVD_Result  MDrv_HVD_RstPTS(MS_U32 u32PTS);
876 HVD_Result  MDrv_HVD_SetFrcMode(HVD_FrmRateConv_Mode eMode);
877 HVD_Result  MDrv_HVD_SetSyncTolerance(MS_U32 u32Arg);
878 HVD_Result  MDrv_HVD_SetSyncVideoDelay( MS_U32 u32Arg);
879 HVD_Result  MDrv_HVD_SetSyncFreeRunTH(MS_U32 u32Arg);
880 HVD_Result  MDrv_HVD_SetSyncRepeatTH(MS_U32 u32Arg);
881 HVD_Result  MDrv_HVD_SetErrConceal(MS_BOOL u32Arg);
882 void        MDrv_HVD_SetDbgLevel(HVD_Uart_Level elevel);
883 HVD_Result  MDrv_HVD_SeekToPTS(MS_U32 u32PTS);
884 HVD_Result  MDrv_HVD_SkipToPTS(MS_U32 u32PTS);
885 HVD_Result  MDrv_HVD_SetFreezeImg(MS_BOOL bEnable);
886 HVD_Result  MDrv_HVD_SetBlueScreen(MS_BOOL bEnable);
887 HVD_Result  MDrv_HVD_SetDispOneField(MS_BOOL bEnable);
888 HVD_Result  MDrv_HVD_SetISREvent(MS_U32 u32Event, HVD_InterruptCb fnISRHandler);
889 MS_BOOL     MDrv_HVD_SetEnableISR(MS_BOOL bEnable);
890 MS_BOOL     MDrv_HVD_SetForceISR(MS_BOOL bEnable);
891 MS_BOOL     MDrv_HVD_SetMVOPDone(void);
892 HVD_Result  MDrv_HVD_SetVirtualBox(MS_U16 u16Width, MS_U16 u16Height);
893 HVD_Result  MDrv_HVD_SetDynScalingParam(void *pStAddr, MS_U32 u32Size);
894 HVD_Result  MDrv_HVD_SetAutoRmLstZeroByte(MS_BOOL bOn);
895 HVD_Result  MDrv_HVD_SetDispInfoTH(HVD_Disp_Info_Threshold *DispInfoTH);
896 HVD_Result  MDrv_HVD_SetFastDisplay(MS_BOOL bFastDisplay);
897 HVD_Result  MDrv_HVD_SetIgnoreErrRef(MS_BOOL bIgnore);
898 HVD_Result  MDrv_HVD_ForceFollowDTVSpec(MS_BOOL bEnable);
899 
900 MS_BOOL     MDrv_HVD_IsISROccured(void);
901 MS_BOOL     MDrv_HVD_IsDispFinish(void);
902 MS_BOOL     MDrv_HVD_IsFrameShowed(void);
903 MS_BOOL     MDrv_HVD_IsStepDecodeDone(void);
904 HVD_Result  MDrv_HVD_CheckDispInfoRdy(void);
905 MS_BOOL     MDrv_HVD_IsDispInfoChg(void);
906 MS_BOOL     MDrv_HVD_IsIdle(void);
907 MS_BOOL     MDrv_HVD_IsSyncStart(void);
908 MS_BOOL     MDrv_HVD_IsSyncReach(void);
909 MS_BOOL     MDrv_HVD_IsLowDelay(void);
910 MS_BOOL     MDrv_HVD_IsIFrmFound(void);
911 MS_BOOL     MDrv_HVD_Is1stFrmRdy(void);
912 MS_BOOL     MDrv_HVD_IsAllBufferEmpty(void);
913 HVD_Result  MDrv_HVD_IsAlive(void);
914 
915 MS_U32      MDrv_HVD_GetBBUVacancy(void);
916 HVD_Result  MDrv_HVD_GetDispInfo(HVD_Disp_Info *pinfo);
917 MS_U32      MDrv_HVD_GetPTS(void);
918 MS_U32      MDrv_HVD_GetNextPTS(void);
919 MS_U32      MDrv_HVD_GetNextDispQPtr(void);
920 MS_U32      MDrv_HVD_GetDataErrCnt(void);
921 MS_U32      MDrv_HVD_GetDecErrCnt(void);
922 MS_U32      MDrv_HVD_GetESWritePtr(void);
923 MS_U32      MDrv_HVD_GetESReadPtr(void);
924 MS_BOOL     MDrv_HVD_GetCaps(HVD_Codec u32Type);
925 MS_U32      MDrv_HVD_GetErrCode(void);
926 MS_U32      MDrv_HVD_GetPlayMode(HVD_Get_Mode_Status eMode);
927 HVD_Get_Play_State MDrv_HVD_GetPlayState(void);
928 MS_U32      MDrv_HVD_GetDecodeCnt(void);
929 MS_U8       MDrv_HVD_GetActiveFormat(void);
930 const HVD_DrvInfo *MDrv_HVD_GetInfo(void);
931 HVD_Result  MDrv_HVD_GetLibVer(const MSIF_Version **ppVersion);
932 MS_BOOL     MDrv_HVD_GetStatus(HVD_DrvStatus *pstatus);
933 HVD_Result  MDrv_HVD_GetFrmInfo(HVD_Get_Frm_Info_Type eType, HVD_Frame_Info *pInfo);
934 MS_BOOL     MDrv_HVD_GetISRInfo(MS_U32 *eType);
935 MS_U32      MDrv_HVD_CalLumaSum(HVD_Get_Frm_Info_Type eType);
936 MS_U32      MDrv_HVD_GetUserData_Wptr(void);
937 MS_U32      MDrv_HVD_GetUserData_Packet(MS_U32 u32Idx, MS_U32 *u32Size);
938 HVD_Result  MDrv_HVD_GenPattern(HVD_PatternType eType, MS_U32 u32VAddr, MS_U32 *u32Size);
939 MS_U32      MDrv_HVD_GetPatternInfo(HVD_Pattern_Info eType);
940 MS_U32      MDrv_HVD_GetDynamicScalingInfo(HVD_DynamicScaling_Info eType);
941 
942 MS_U32      MDrv_HVD_GetData(HVD_GData_Type eType);
943 MS_U32      MDrv_HVD_GetMem_Dbg(MS_U32 u32Addr);
944 void        MDrv_HVD_DbgDumpStatus(HVD_DumpStatus eFlag);
945 void        MDrv_HVD_SetMem_Dbg(MS_U32 u32Addr, MS_U32 u32Arg);
946 HVD_Result  MDrv_HVD_SetCmd_Dbg(MS_U32 u32Cmd, MS_U32 u32Arg);
947 HVD_Result  MDrv_HVD_SetSettings_Pro( HVD_SSettings_Type eType, MS_U32 u32Arg);
948 HVD_Result  MDrv_HVD_SetBalanceBW(MS_U8 qp_cnt, MS_U8 db_cnt, MS_U8 upper);
949 MS_S64      MDrv_HVD_GetPtsStcDiff(void);
950 MS_U32      MDrv_HVD_GetDrvFwVer(void);
951 MS_U32      MDrv_HVD_GetFwVer(void);
952 HVD_Result  MDrv_HVD_SetFdMaskDelayCnt(MS_U8 u8DelayCnt);
953 HVD_Result  MDrv_HVD_SetOutputFRCMode(MS_U8 u8FrameRate, MS_U8 u8Interlace);
954 HVD_Result  MDrv_HVD_DispFrame(MS_U32 u32FrmIdx);
955 HVD_Result  MDrv_HVD_FreeFrame(MS_U32 u32FrmIdx);
956 HVD_Result  MDrv_HVD_EnableDispQue(MS_BOOL bEnable);
957 HVD_Result  MDrv_HVD_EnableVSizeAlign(MS_BOOL bEnable);
958 HVD_Result  MDrv_HVD_Disp_Ignore_Crop(MS_BOOL bEnable);
959 HVD_Result  MDrv_HVD_SetFRCDropType(MS_U8 u8DropType);
960 MS_U32      MDrv_HVD_GetDrvFwVer(void);
961 HVD_Result  MDrv_HVD_GetUserDataInfo(HVD_UserData_Info* pUsrInfo);
962 MS_BOOL     MDrv_HVD_GetUsrDataIsAvailable(void);
963 HVD_Result  MDrv_HVD_SetDTVUserDataMode(MS_U8 u8UserDataMode);
964 HVD_Result  MDrv_HVD_ForceInterlaceMode(MS_U8 u8Mode);
965 HVD_Result  MDrv_HVD_ShowDecodeOrder(MS_U8 u8Mode);
966 MS_BOOL     MDrv_HVD_GetFrmRateIsSupported(void);
967 HVD_Result  MDrv_HVD_GetFrmPackingArrSEI(HVD_FrmPackingSEI *pFrmPacking);
968 
969 HVD_Result MDrv_HVD_CC_Init(void);
970 HVD_Result MDrv_HVD_CC_SetCfg(MS_U8 u8Operation, MS_U16 u16BufferSize, MS_U8 u8CC608);
971 HVD_Result MDrv_HVD_CC_Set_RB_StartAddr(MS_U32 u32StartPAddress, MS_U8 u8CC608);
972 HVD_Result MDrv_HVD_CC_SyncRB_RdAddr2WrAddr(MS_U8 u8CC608);
973 HVD_Result MDrv_HVD_CC_Adv_RB_ReadAddr(MS_U32 u32EachPacketSize, MS_U8 u8CC608);
974 HVD_Result MDrv_HVD_CC_DisableParsing(MS_U8 u8CC608);
975 HVD_Result MDrv_HVD_CC_GetInfo(MS_U32 selector, MS_U8 type, MS_U32 *p1, MS_U32 *p2);
976 MS_BOOL    MDrv_HVD_CC_IsHvdRstDone(MS_U8 type);
977 MS_U8      MDrv_HVD_CC_GetOverflowStatus(MS_U8 u8CC608);
978 MS_U32     MDrv_HVD_CC_Get_RB_WriteAddr(MS_U8 u8CC608);
979 MS_U32     MDrv_HVD_CC_Get_RB_ReadAddr(MS_U8 u8CC608);
980 MS_BOOL    MDrv_HVD_CC_InfoEnhanceMode(MS_BOOL bEnable);
981 
982 HVD_Result MDrv_HVD_SetHVDClockSpeed(HVD_ClockSpeed eClockSpeed);
983 HVD_Result MDrv_HVD_SetVPUClockSpeed(HVD_ClockSpeed eClockSpeed);
984 
985 HVD_Result MDrv_HVD_PushDispQWithRefNum(MS_BOOL bEnable);
986 HVD_Result MDrv_HVD_ShowFirstFrameDirect(MS_BOOL bEnable);
987 HVD_Result MDrv_HVD_OnePendingBufferMode(MS_BOOL bEnable);
988 HVD_Result MDrv_HVD_FrameRateHandling(MS_BOOL bEnable, MS_U32 u32FrameRate);
989 HVD_Result MDrv_HVD_AutoExhaustESMode(MS_U32 u32ESbound);
990 HVD_Result MDrv_HVD_SetMinTspDataSize(MS_U32 u32Size);
991 HVD_Result MDrv_HVD_AVCSupportRefNumOverMaxDBPSize(MS_BOOL bEnable);
992 
993 #ifdef __cplusplus
994 }
995 #endif
996 
997 #endif // _DRV_HVD_H_
998 
999