xref: /utopia/UTPA2-700.0.x/modules/vdec_v3/drv/mvd_v3/drvMVD_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  drvMVD.h
98 /// @brief MPEG-2/4 Video Decoder header file
99 /// @author MStar Semiconductor Inc.
100 ///////////////////////////////////////////////////////////////////////////////////////////////////
101 
102 #ifndef _DRV_MVD_H_
103 #define _DRV_MVD_H_
104 
105 
106 
107 
108 ////////////////////////////////////////////////////////////////////////////////
109 // Include List
110 ////////////////////////////////////////////////////////////////////////////////
111 
112 #ifdef __cplusplus
113 extern "C"
114 {
115 #endif
116 
117 #if (!defined(MSOS_TYPE_NUTTX) && !defined(MSOS_TYPE_OPTEE)) || defined(SUPPORT_X_MODEL_FEATURE)
118 
119 #include "drvmvd_cc.h"
120 ////////////////////////////////////////////////////////////////////////////////
121 // Constant & Macro Definition
122 ////////////////////////////////////////////////////////////////////////////////
123 /// Version string.
124 #define MVD_DRV_VERSION                 /* Character String for DRV/API version             */  \
125     MSIF_TAG,                           /* 'MSIF'                                           */  \
126     MSIF_CLASS,                         /* '00'                                             */  \
127     MSIF_CUS,                           /* 0x0000                                           */  \
128     MSIF_MOD,                           /* 0x0000                                           */  \
129     MSIF_CHIP,                                                                                  \
130     MSIF_CPU,                                                                                   \
131     {'M','V','D','_'},                  /* IP__                                             */  \
132     {'0','A'},                          /* 0.0 ~ Z.Z                                        */  \
133     {'0','1'},                          /* 00 ~ 99                                          */  \
134     {'0','0','6','4','1','6','6','7'},  /* CL#                                              */  \
135     MSIF_OS
136 
137 #define MIU_SEL_0         0
138 #define MIU_SEL_1         1
139 #define MIU_SEL_2         2
140 #define MIU_SEL_3         3
141 
142 
143 #define MST_MODE_TRUE     1
144 #define MST_MODE_FALSE    0
145 
146 
147 #if defined( MSOS_TYPE_ECOS)
148     #define VPRINTF     diag_printf
149     #define MVD_PRINT   diag_printf
150     #define MVD_ERR     diag_printf
151 #else
152     #include "ULog.h"
153     #define VPRINTF(format,args...) ULOGI("VDEC", format, ##args)
154     #define MVD_PRINT(format,args...) ULOGI("VDEC", format, ##args)
155     #define MVD_ERR(format,args...) ULOGE("VDEC", format, ##args)
156 #endif
157 
158 ////////////////////////////////////////////////////////////////////////////////
159 // Type & Structure Declaration
160 ////////////////////////////////////////////////////////////////////////////////
161 /// MVD's capability
162 typedef struct _MVD_Caps
163 {
164     MS_BOOL bMPEG2;
165     MS_BOOL bMPEG4;
166     MS_BOOL bVC1;
167 } MVD_Caps;
168 
169 /// MVD driver info.
170 typedef struct _MVD_DrvInfo
171 {
172     MS_U32 u32Resource;
173     MS_U32 u32DeviceNum;
174     MS_U32 u32FWVersion;
175     MVD_Caps stCaps;
176 } MVD_DrvInfo;
177 
178 /// Firmware status
179 typedef enum _MVD_DecStat
180 {
181     E_MVD_STAT_IDLE             = 0x00,
182     E_MVD_STAT_FIND_STARTCODE   = 0x01,//start code
183     E_MVD_STAT_FIND_SPECIALCODE = 0x11,//special code [00_00_01_C5_ab_08_06_27]
184                                        //for flush data using
185     E_MVD_STAT_FIND_FRAMEBUFFER = 0x02,
186     //fw is trying to find empty FB to continue decoding.
187     //if hang in this state, please check "vsync" or AVSync.
188     E_MVD_STAT_WAIT_DECODEDONE  = 0x03,
189     E_MVD_STAT_DECODE_DONE      = 0x04,
190     E_MVD_STAT_WAIT_VDFIFO      = 0x05,
191     E_MVD_STAT_INIT_SUCCESS     = 0x06,
192     E_MVD_STAT_UNKNOWN          = 0xff,
193 } MVD_DecStat;
194 
195 /// MVD driver status
196 typedef struct _MVD_DrvStatus
197 {
198 //    MS_U32      u32FWVer;
199     MVD_DecStat eDecStat;
200 //    MS_BOOL     bIsBusy;
201     MS_U8       u8LastFWCmd;
202 } MVD_DrvStatus;
203 
204 /// MVD stream types for dual decoders
205 typedef enum
206 {
207     E_MVD_DRV_STREAM_NONE = 0,
208     E_MVD_DRV_MAIN_STREAM,
209     E_MVD_DRV_SUB_STREAM,
210 #ifdef VDEC3
211     E_MVD_DRV_N_STREAM,
212 #else
213     E_MVD_DRV_STREAM_MAX = E_MVD_DRV_SUB_STREAM,
214 #endif
215 } MVD_DRV_StreamType;
216 
217 /// Enumerate CodecType that MVD supports
218 typedef enum _MVD_CodecType
219 {
220     E_MVD_CODEC_MPEG2                    = 0x10,
221     E_MVD_CODEC_MPEG4                    = 0x00,
222     E_MVD_CODEC_MPEG4_SHORT_VIDEO_HEADER = 0x01,
223     E_MVD_CODEC_DIVX311                  = 0x02,
224     E_MVD_CODEC_FLV                      = 0x03,
225     E_MVD_CODEC_VC1_ADV                  = 0x04,
226     E_MVD_CODEC_VC1_MAIN                 = 0x05,
227     E_MVD_CODEC_UNKNOWN                  = 0xff
228 } MVD_CodecType;
229 
230 /// Mode of MVD input source
231 typedef enum _MVD_SrcMode
232 {
233     E_MVD_FILE_MODE       = 0x00,
234     E_MVD_SLQ_MODE        = 0x01,
235     E_MVD_TS_MODE         = 0x02,
236     E_MVD_SLQ_TBL_MODE    = 0x03,
237     E_MVD_TS_FILE_MODE    = 0x04,
238     E_MVD_SRC_UNKNOWN     = 0x05
239 } MVD_SrcMode;
240 
241 /// AVSync mode for file playback
242 typedef enum
243 {
244     E_MVD_TIMESTAMP_FREERUN  = 0,  ///Player didn't set PTS/DTS, so display freerun
245     E_MVD_TIMESTAMP_PTS      = 1,  ///Player set PTS to MVD decoder
246     E_MVD_TIMESTAMP_DTS      = 2,  ///Player set DTS to MVD decoder
247     E_MVD_TIMESTAMP_STS      = 3,  ///SortedTimeStamp means decoder should sort timestamp
248     E_MVD_TIMESTAMP_PTS_RVU  = 4,  ///Player set PTS to MVD decoder
249     E_MVD_TIMESTAMP_DTS_RVU  = 5,  ///Player set DTS to MVD decoder
250     E_MVD_TIMESTAMP_NEW_STS  = 6,  ///Player set PTS to MVD decoder
251 } MVD_TIMESTAMP_TYPE;
252 
253 /// ErrCode obtained from firmware
254 typedef enum _MVD_ErrCode
255 {
256     E_MVD_ERR_UNKNOWN            = 0,
257     E_MVD_ERR_SHAPE              = 1,
258     E_MVD_ERR_USED_SPRITE        = 2,
259     E_MVD_ERR_NOT_8_BIT          = 3,   //error_status : bits per pixel
260     E_MVD_ERR_NERPRED_ENABLE     = 4,
261     E_MVD_ERR_REDUCED_RES_ENABLE = 5,
262     E_MVD_ERR_SCALABILITY        = 6,
263     E_MVD_ERR_OTHER              = 7,
264     E_MVD_ERR_H263_ERROR         = 8,
265     E_MVD_ERR_RES_NOT_SUPPORT    = 9,   //error_status : none
266     E_MVD_ERR_MPEG4_NOT_SUPPORT  = 10,  //error_status : none
267     E_MVD_ERR_PROFILE_NOT_SUPPORT= 11,   //error_status : none
268     E_MVD_ERR_RCV_ERROR_OCCUR= 12   //error_status : none
269 } MVD_ErrCode;
270 
271 /// Detailed error status when error occurs
272 typedef enum _MVD_ErrStatus
273 {
274     //error_status for E_MVD_ERR_SHAPE
275     E_MVD_ERR_SHAPE_RECTANGULAR    = 0x10,
276     E_MVD_ERR_SHAPE_BINARY         = 0x11,
277     E_MVD_ERR_SHAPE_BINARY_ONLY    = 0x12,
278     E_MVD_ERR_SHAPE_GRAYSCALE      = 0x13,
279 
280     //error_status for E_MVD_ERR_USED_SPRITE
281     E_MVD_ERR_USED_SPRITE_UNUSED   = 0x20, //sprite not used
282     E_MVD_ERR_USED_SPRITE_STATIC   = 0x21,
283     E_MVD_ERR_USED_SPRITE_GMC      = 0x22,
284     E_MVD_ERR_USED_SPRITE_RESERVED = 0x23,
285 
286     E_MVD_ERR_STATUS_NONE          = 0x77,
287     E_MVD_ERR_STATUS_UNKOWN        = 0x00,
288 } MVD_ErrStatus;
289 
290 /// Picture type of MPEG video
291 typedef enum _MVD_PicType
292 {
293     E_MVD_PIC_I = 0,
294     E_MVD_PIC_P = 1,
295     E_MVD_PIC_B = 2,
296     E_MVD_PIC_UNKNOWN = 0xf,
297 } MVD_PicType;
298 
299 /// Mode of frame rate conversion
300 typedef enum _MVD_FrcMode {
301     E_MVD_FRC_NORMAL = 0,
302     E_MVD_FRC_DISP_TWICE = 1,
303     E_MVD_FRC_3_2_PULLDOWN = 2,
304     E_MVD_FRC_PAL_TO_NTSC = 3,
305     E_MVD_FRC_NTSC_TO_PAL = 4,
306     E_MVD_FRC_DISP_ONEFIELD = 5,//Removed, call MDrv_MVD_EnableDispOneField() instead.
307 } MVD_FrcMode;
308 
309 /// MVD play mode
310 typedef enum
311 {
312     E_MVD_PLAY          = 0x00,
313     E_MVD_STEPDISP      = 0x01,
314     E_MVD_PAUSE         = 0x02,
315     E_MVD_FASTFORWARD   = 0x03,
316     E_MVD_BACKFORWARD   = 0x04,
317     E_MVD_UNKNOWMODE    = 0xff
318 } MVD_PlayMode;
319 
320 /// Store the packet information used for SLQ table file mode
321 typedef struct
322 {
323     MS_VIRT u32StAddr;    ///< Packet offset from bitstream buffer base address. unit: byte.
324     MS_U32 u32Length;    ///< Packet size. unit: byte.
325     MS_U32 u32TimeStamp; ///< Packet time stamp. unit: ms.
326     MS_U32 u32ID_L;      ///< Packet ID low part.
327     MS_U32 u32ID_H;      ///< Packet ID high part.
328 } MVD_PacketInfo;
329 
330 ///MVD frame info data structure
331 typedef struct
332 {
333     MS_U16  u16HorSize;
334     MS_U16  u16VerSize;
335     MS_U32  u32FrameRate;
336     MS_U8   u8AspectRate;
337     MS_U8   u8Interlace;
338     MS_U8   u8AFD;
339     MS_U16  u16par_width;
340     MS_U16  u16par_height;
341     MS_U16  u16SarWidth;
342     MS_U16  u16SarHeight;
343     MS_U16  u16CropRight;
344     MS_U16  u16CropLeft;
345     MS_U16  u16CropBottom;
346     MS_U16  u16CropTop;
347     MS_U16  u16Pitch;
348     MS_U16  u16PTSInterval;
349     MS_U8   u8MPEG1;
350     MS_U8   u8PlayMode;
351     MS_U8   u8FrcMode;
352     MS_VIRT  u32DynScalingAddr;    ///Dynamic scaling address
353     MS_U8   u8DynScalingDepth;    ///Dynamic scaling depth
354     MS_U32  u32DynScalingBufSize;    ///Dynamic scaling BufSize
355     MS_BOOL bEnableMIUSel;        ///Dynamic scaling DS buffer on miu1 or miu0
356 } MVD_FrameInfo;
357 
358 /// MVD AVSync Configuration
359 typedef struct
360 {
361     MS_U32  u32Delay;       //unit: ms
362     MS_U16  u16Tolerance;   //unit: ms
363     MS_BOOL bEnable;
364     MS_U8   u8Rsvd;         //reserved
365 } MVD_AVSyncCfg;
366 
367 /// MVD Command arguments
368 typedef struct
369 {
370     MS_U8 Arg0;    ///< argument 0
371     MS_U8 Arg1;    ///< argument 1
372     MS_U8 Arg2;    ///< argument 2
373     MS_U8 Arg3;    ///< argument 3
374     MS_U8 Arg4;    ///< argument 4
375     MS_U8 Arg5;    ///< argument 5
376 } MVD_CmdArg;
377 
378 /// MVD commands needing handshake
379 typedef enum
380 {
381     MVD_HANDSHAKE_PAUSE,
382     MVD_HANDSHAKE_SLQ_RST,
383     MVD_HANDSHAKE_STOP,
384     MVD_HANDSHAKE_SKIP_DATA,
385     MVD_HANDSHAKE_SKIP_TO_PTS,
386     MVD_HANDSHAKE_SINGLE_STEP,
387     MVD_HANDSHAKE_SCALER_INFO,
388     MVD_HANDSHAKE_GET_NXTDISPFRM,
389     MVD_HANDSHAKE_PARSER_RST,
390     MVD_HANDSHAKE_RST_CC608,
391     MVD_HANDSHAKE_RST_CC708,
392     MVD_HANDSHAKE_VIRTUAL_COMMAND,
393     MVD_HANDSHAKE_FLUSHQUEUE_COMMAND,
394     MVD_HANDSHAKE_VSYNC_CONTROL,
395 } MVD_HANDSHAKE_CMD;
396 
397 
398 
399 typedef enum
400 {
401     E_MVD_FB_REDUCTION_NONE = 0,        ///< FB reduction disable
402     E_MVD_FB_REDUCTION_1_2 = 1,         ///< FB reduction 1/2
403     E_MVD_FB_REDUCTION_1_4 = 2,         ///< FB reduction 1/4
404 } MVD_FB_Reduction_Type;
405 
406 typedef struct
407 {
408     MVD_FB_Reduction_Type LumaFBReductionMode;     ///< Luma frame buffer reduction mode.
409     MVD_FB_Reduction_Type ChromaFBReductionMode;   ///< Chroma frame buffer reduction mode.
410     MS_U8                 u8EnableAutoMode;        /// 0: Disable, 1: Enable
411     MS_U8                 u8ReservedByte;          /// Reserved byte
412 } MVD_FB_Reduction;
413 
414 /// Configuration of MVD firmware
415 typedef struct
416 {
417     MVD_CodecType    eCodecType;        ///< Specify the active codec type
418     MVD_SrcMode      eSrcMode;          ///< Specify the input source
419     MS_U8            bDisablePESParsing;///< MVD parser enable/disable
420     MS_BOOL          bNotReload;        ///< TRUE to not allow loading f/w after the 1st init to speed up.
421     MVD_FB_Reduction stFBReduction;     ///< MVD Frame buffer reduction type
422     MS_U16           u16FBReduceValue;
423     MS_U8            u8FBMode;          ///driver internal attribute: SD or HD
424     MS_U8            u8FBNum;           ///driver internal attribute: # of frames in FB
425     MS_VIRT           u32FBUsedSize;     ///driver internal attribute: used size
426 } MVD_FWCfg;
427 
428 /// The type of fw binary input source
429 typedef enum
430 {
431     E_MVD_FW_SOURCE_NONE,       ///< No input fw.
432     E_MVD_FW_SOURCE_DRAM,       ///< input source from DRAM.
433     E_MVD_FW_SOURCE_FLASH,      ///< input source from FLASH.
434 } MVD_FWSrcType;
435 
436 /// Configuration of memory layout
437 typedef struct
438 {
439     MVD_FWSrcType eFWSrcType;         //!< the input FW source type.
440     MS_VIRT     u32FWSrcVAddr;         //!< virtual address of input FW binary in DRAM
441     MS_PHY      u32FWBinAddr;          //!< physical address in Flash/DRAM of FW code
442     MS_SIZE     u32FWBinSize;
443     MS_PHY      u32FWCodeAddr;
444     MS_SIZE     u32FWCodeSize;
445     MS_PHY      u32FBAddr;
446     MS_SIZE     u32FBSize;
447     MS_PHY      u32BSAddr;
448     MS_SIZE     u32BSSize;
449     MS_PHY u32DrvBufAddr;
450     MS_SIZE     u32DrvBufSize;
451     MS_PHY u32DynSacalingBufAddr;
452     MS_SIZE     u32DynSacalingBufSize;
453     MS_PHY u32Miu1BaseAddr;
454     MS_PHY u32Miu2BaseAddr;
455     MS_PHY u32Miu3BaseAddr;
456     MS_BOOL    bFWMiuSel;
457     MS_BOOL    bHWMiuSel;
458     MS_U8      u8FWMiuSel;
459     MS_U8      u8HWMiuSel;
460     MS_U8      u8FBMiuSel;
461     MS_BOOL    bEnableDynScale;       /// dynamic scaling control bit
462     MS_BOOL    bSupportSDModeOnly;    /// Config from IP Check
463 } MVD_MEMCfg;
464 
465 /// Return value of MVD driver
466 typedef enum
467 {
468     E_MVD_RET_OK            = 1,
469     E_MVD_RET_FAIL          = 0,
470     E_MVD_RET_INVALID_PARAM = 2,
471     E_MVD_RET_QUEUE_FULL    = 3,
472     E_MVD_RET_TIME_OUT      = 4
473 } E_MVD_Result;
474 
475 /// Mode of trick decoding
476 typedef enum
477 {
478     E_MVD_TRICK_DEC_ALL = 0,
479     E_MVD_TRICK_DEC_IP,
480     E_MVD_TRICK_DEC_I,
481     E_MVD_TRICK_DEC_UNKNOWN
482 } MVD_TrickDec;
483 
484 typedef enum
485 {
486     E_MVD_DISPLAY_PATH_MVOP_MAIN=0,
487     E_MVD_DISPLAY_PATH_MVOP_SUB,
488     E_MVD_DISPLAY_PATH_NONE
489 } MVD_DISPLAY_PATH;
490 
491 typedef enum
492 {
493     E_MVD_EX_INPUT_TSP_0 = 0,
494     E_MVD_EX_INPUT_TSP_1,
495     E_MVD_EX_INPUT_TSP_2,
496     E_MVD_EX_INPUT_TSP_3,
497     E_MVD_EX_INPUT_TSP_NONE = 0xFF,
498 } MVD_INPUT_TSP;
499 
500 /// Speed type of playing
501 typedef enum
502 {
503     E_MVD_SPEED_DEFAULT = 0,
504     E_MVD_SPEED_FAST,
505     E_MVD_SPEED_SLOW,
506     E_MVD_SPEED_TYPE_UNKNOWN
507 } MVD_SpeedType;
508 
509 /// MVD pattern type
510 typedef enum
511 {
512     E_MVD_PATTERN_FLUSH = 0,           ///< Used after MDrv_MVD_Flush().
513     E_MVD_PATTERN_FILEEND,             ///< Used for file end.
514 } MVD_PatternType;
515 
516 /// MVD frame info structure
517 typedef struct
518 {
519     MS_PHY u32LumaAddr;    ///< The start physical of luma data. Unit: byte.
520     MS_PHY u32ChromaAddr;  ///< The start physcal of chroma data. Unit: byte.
521     MS_U32 u32TimeStamp;       ///< Time stamp(DTS, PTS) of current displayed frame. Unit: 90khz.
522     MS_U32 u32ID_L;            ///< low part of ID number set by MDrv_MVD_PushQueue().
523     MS_U32 u32ID_H;            ///< high part of ID number set by MDrv_MVD_PushQueue().
524     MS_U16 u16Pitch;           ///< The pitch of current frame.
525     MS_U16 u16Width;           ///< pixel width of current frame.
526     MS_U16 u16Height;          ///< pixel height of current frame.
527     MS_U16 u16FrmIdx;          ///< index of current frame.
528     MVD_PicType eFrmType;     ///< picture type: I, P, B frame
529 } MVD_FrmInfo;
530 
531 /// MVD extension display info structure
532 typedef struct
533 {
534     MS_U16 u16VSize;         /// vertical size from sequene_display_extension
535     MS_U16 u16HSize;         /// horizontal size from sequene_display_extension
536     MS_U16 u16VOffset;       /// vertical offset from picture_display_extension
537     MS_U16 u16HOffset;       /// horizontal offset from picture_display_extension
538 } MVD_ExtDispInfo;
539 
540 /// Type of frame info that can be queried
541 typedef enum
542 {
543     E_MVD_FRMINFO_DISPLAY=0,   ///< Displayed frame.
544     E_MVD_FRMINFO_DECODE =1,   ///< Decoded frame.
545     E_MVD_FRMINFO_NEXT_DISPLAY =2,///< Next frame to be displayed.
546 } MVD_FrmInfoType;
547 
548 typedef enum
549 {
550     E_MVD_PTS_DISP = 0,          ///< Displayed frame pts.
551     E_MVD_PTS_PRE_PAS = 1,      ///< Pre-parsing pts.
552 } MVD_PtsType;
553 
554 typedef enum {
555     E_MVD_FRAME_FLIP    = 0,
556     E_MVD_FRAME_RELEASE = 1,
557 } MVD_FrmOpt;
558 
559 ///MVD set debug mode
560 typedef enum
561 {
562     E_MVD_EX_DBG_MODE_ORI = 0,
563     E_MVD_EX_DBG_MODE_BYPASS_INSERT_START_CODE ,     /// for UT
564     E_MVD_EX_DBG_MODE_BYPASS_DIVX_MC_PATCH,            /// for UT
565     E_MVD_EX_DBG_MODE_NUM
566 } MVD_DbgMode;
567 
568 typedef struct
569 {
570     union
571     {
572         struct
573         {
574             MS_U32 bBypassInsertStartCode : 1;  // TRUE: for bypass insert start code for UT...
575             MS_U32 bBypassDivxMCPatch : 1;      // TRUE: for bypass divx MC patch for UT...
576         };
577         MS_U32 value;
578     };
579 }MVD_DbgModeCfg;
580 
581 /// Attributes used by drvMVD & halMVD
582 /// Updated by halMVD, read-only for drvMVD
583 typedef struct
584 {
585     MS_BOOL         bAVSyncOn;
586     MS_BOOL         bDropErrFrm;
587     MS_BOOL         bDropDispfrm;
588     MS_BOOL         bDecodeIFrame;
589     MS_BOOL         bStepDecode;
590     MS_BOOL         bStepDisp;
591     MS_BOOL         bStep2Pts;
592     MS_BOOL         bSkip2Pts;
593     MS_BOOL         bEnableLastFrmShow;
594     MS_BOOL         bSlqTblSync;
595     MS_U8           u8MstMode; //MStreamer mode=1; Non-MSt mode=0.
596     MS_U8           u8McuMode; //MCU mode=1;
597     MS_U8           u8DynScalingDepth;
598     MVD_TrickDec    eTrickMode;
599     MVD_FrcMode     eFrcMode;
600     MVD_TIMESTAMP_TYPE eFileSyncMode;
601     MVD_SpeedType   ePreSpeedType;
602     MS_VIRT          u32UsrDataRd;
603     MS_U32          u32IntCnt;      /// interrupt ocurred counter
604     MVD_AVSyncCfg   stSyncCfg;
605     MVD_DbgModeCfg  stDbgModeCfg;
606     MS_BOOL         bExternalDSBuf;
607 } MVD_CtrlCfg;
608 
609 /// MVD time code structure
610 typedef struct
611 {
612     MS_U8   u8TimeCodeHr;   ///<  time_code_hours
613     MS_U8   u8TimeCodeMin;  ///<  time_code_minutes
614     MS_U8   u8TimeCodeSec;  ///<  time_code_seconds
615     MS_U8   u8TimeCodePic;  ///<  time_code_pictures
616 
617     MS_U8   u8DropFrmFlag;  ///<  drop_frame_flag
618     MS_U8   u8Reserved[3];  ///<  reserved fields for 4-byte alignment
619 } MVD_TimeCode;
620 
621 /// Format of CC (Closed Caption)
622 typedef enum _MVD_CCFormat
623 {
624     E_MVD_CC_NONE       = 0x00,
625     E_MVD_CC_608        = 0x01, //For CC608 or 157
626     E_MVD_CC_708        = 0x02, //For CC708
627     E_MVD_CC_UNPACKED   = 0x03,
628 } MVD_CCFormat;
629 
630 /// Type of CC
631 typedef enum _MVD_CCType
632 {
633     E_MVD_CC_TYPE_NONE = 0,
634     E_MVD_CC_TYPE_NTSC_FIELD1 = 1,
635     E_MVD_CC_TYPE_NTSC_FIELD2 = 2,
636     E_MVD_CC_TYPE_DTVCC = 3,
637     E_MVD_CC_TYPE_NTSC_TWOFIELD = 4,
638 } MVD_CCType;
639 
640 /// Data structure of CC Configuration
641 typedef struct
642 {
643     MVD_CCFormat eFormat;
644     MVD_CCType   eType;
645     MS_VIRT       u32BufStAdd;
646     MS_U32       u32BufSize;
647 } MVD_CCCfg;
648 
649 /// Info. of user data
650 typedef struct
651 {
652     MS_U32 u32Pts;
653     MS_U8  u8PicStruct;           /* picture_structure*/
654     MS_U8  u8PicType;             /* picture type: 1->I picture, 2->P,3->B */
655     MS_U8  u8TopFieldFirst;       /* Top field first: 1 if top field first*/
656     MS_U8  u8RptFirstField;       /* Repeat first field: 1 if repeat field first*/
657 
658     MS_U16 u16TmpRef;            /* Temporal reference of the picture*/
659     MS_U8  u8ByteCnt;
660     MS_U8  u8Reserve;
661 
662     MS_U32 u32DataBuf;
663 } MVD_UsrDataInfo;
664 
665 /// MVD interrupt events
666 typedef enum
667 {
668     E_MVD_EVENT_DISABLE_ALL    = 0,           ///< unregister all events notification
669     E_MVD_EVENT_USER_DATA      = BIT(0),      ///< found user data
670     E_MVD_EVENT_DISP_VSYNC     = BIT(1),      ///< vsync interrupt
671     E_MVD_EVENT_PIC_FOUND      = BIT(2),      ///<
672     E_MVD_EVENT_FIRST_FRAME    = BIT(3),      ///< first frame decoded
673     E_MVD_EVENT_DISP_RDY       = BIT(4),      ///< MVD ready to display.
674     E_MVD_EVENT_SEQ_FOUND      = BIT(5),      ///< found sequence header
675     //E_MVD_EVENT_DEC_CC_FOUND = BIT(6),      ///< MVD found one user data with decoded frame.
676     E_MVD_EVENT_DEC_DATA_ERR   = BIT(7),      ///< ES Data error.
677     E_MVD_EVENT_UNMUTE         = BIT(8),      ///< video unmute
678     E_MVD_EVENT_USER_DATA_DISP = BIT(9),      ///< found user data in display order
679     E_MVD_EVENT_DEC_ERR        = BIT(10),     ///< MVD HW found decode error.
680     E_MVD_EVENT_DEC_I          = BIT(11),     ///< MVD HW decode I frame.
681     E_MVD_EVENT_DEC_ONE_FRAME  = BIT(15),     ///< Decode one frame done
682     E_MVD_EVENT_XC_LOW_DEALY   = BIT(16),     ///< speed up the un-mute screen on XC.
683 } MVD_Event;
684 
685 /// MVD clock speed
686 typedef enum
687 {
688     E_MVD_EX_CLOCK_SPEED_NONE = 0,
689     E_MVD_EX_CLOCK_SPEED_HIGHEST,
690     E_MVD_EX_CLOCK_SPEED_HIGH,
691     E_MVD_EX_CLOCK_SPEED_MEDIUM,
692     E_MVD_EX_CLOCK_SPEED_LOW,
693     E_MVD_EX_CLOCK_SPEED_LOWEST,
694     E_MVD_EX_CLOCK_SPEED_DEFAULT,
695 } MVD_EX_ClockSpeed;
696 
697 //MVD CRC value
698 typedef struct
699 {
700     MS_U32 u32HSize;
701     MS_U32 u32VSize;
702     MS_U32 u32Strip;
703     MS_VIRT u32YStartAddr;
704     MS_VIRT u32UVStartAddr;
705 }MVD_CrcIn;
706 
707 typedef struct
708 {
709     MS_U32 u32YCrc;
710     MS_U32 u32UVCrc;
711 }MVD_CrcOut;
712 
713 typedef struct
714 {
715     MS_VIRT  u32DSBufAddr;       // Buffer Address
716     MS_U32  u32DSBufSize;       // Buffer Size
717 }MVD_EX_ExternalDSBuf;
718 
719 
720 typedef struct
721 {
722     MS_BOOL bHWBufferReMapping;
723 } MVD_Pre_Ctrl;
724 
725 typedef struct
726 {
727     MS_BOOL bColor_Descript;
728     MS_U8 u8Color_Primaries;
729     MS_U8 u8Transfer_Char;
730     MS_U8 u8Matrix_Coef;
731 } MVD_Color_Info;
732 
733 /// record origin stream type for MVD drv
734 typedef enum
735 {
736     E_MVD_ORIGINAL_MAIN_STREAM = 0,
737     E_MVD_ORIGINAL_SUB_STREAM,
738     E_MVD_ORIGINAL_N_STREAM,
739 } MVD_Original_Stream;
740 
741 typedef void (*MVD_InterruptCb)(MS_U32 u32CbData);
742 
743 ////////////////////////////////////////////////////////////////////////////////
744 // Function Prototype Declaration
745 ////////////////////////////////////////////////////////////////////////////////
746 E_MVD_Result MDrv_MVD_SetCfg(MS_U32 u32Id, MVD_FWCfg* fwCfg, MVD_MEMCfg* memCfg);
747 MS_U32 MDrv_MVD_GetFWVer(MS_U32 u32Id);
748 void MDrv_MVD_SetDbgLevel(MS_U8 level);
749 const MVD_DrvInfo* MDrv_MVD_GetInfo(void);
750 E_MVD_Result MDrv_MVD_GetLibVer(const MSIF_Version **ppVersion);
751 
752 MS_BOOL MDrv_MVD_SetCodecInfo(MS_U32 u32Id, MVD_CodecType u8CodecType, MVD_SrcMode u8BSProviderMode, MS_U8 bDisablePESParsing);
753 void MDrv_MVD_SetDivXCfg(MS_U32 u32Id, MS_U8 u8MvAdjust, MS_U8 u8IdctSel);
754 
755 void MDrv_MVD_SetFrameBuffAddr(MS_U32 u32Id, MS_VIRT u32addr);
756 void MDrv_MVD_GetFrameInfo(MS_U32 u32Id, MVD_FrameInfo *pinfo );
757 void MDrv_MVD_SetOverflowTH(MS_U32 u32Id, MS_U32 u32Threshold);
758 void MDrv_MVD_SetUnderflowTH(MS_U32 u32Id, MS_U32 u32Threshold);
759 
760 void MDrv_MVD_RstIFrameDec(MS_U32 u32Id, MVD_CodecType eCodecType, MS_BOOL bShareBBU);
761 MS_BOOL MDrv_MVD_GetIsIFrameDecoding(MS_U32 u32Id);
762 
763 MS_U8 MDrv_MVD_GetSyncStatus(MS_U32 u32Id);
764 MS_BOOL MDrv_MVD_GetIsFreerun(MS_U32 u32Id);
765 MS_U8 MDrv_MVD_GetIsIPicFound(MS_U32 u32Id);
766 
767 MS_BOOL MDrv_MVD_DecodeIFrame(MS_U32 u32Id, MS_PHY u32FrameBufAddr, MS_PHY u32StreamBufAddr, MS_PHY u32StreamBufEndAddr );
768 MS_BOOL MDrv_MVD_GetValidStreamFlag(MS_U32 u32Id);
769 MS_U32 MDrv_MVD_GetChromaFormat(MS_U32 u32Id);
770 //for MM
771 void MDrv_MVD_SetFrameInfo(MS_U32 u32Id, MVD_FrameInfo *pinfo );
772 void MDrv_MVD_GetErrInfo(MS_U32 u32Id, MVD_ErrCode *errCode, MVD_ErrStatus *errStatus);
773 MS_U32 MDrv_MVD_GetSkipPicCounter(MS_U32 u32Id);
774 
775 void MDrv_MVD_SetSLQWritePtr(MS_U32 u32Id, MS_BOOL bCheckData);
776 MS_U32 MDrv_MVD_GetSLQReadPtr(MS_U32 u32Id);
777 MVD_PicType MDrv_MVD_GetPicType(MS_U32 u32Id);
778 MS_U32 MDrv_MVD_GetBitsRate(MS_U32 u32Id);
779 MS_U8 MDrv_MVD_GetVideoRange(MS_U32 u32Id);
780 MS_BOOL MDrv_MVD_GetLowDelayFlag(MS_U32 u32Id);
781 MS_BOOL MDrv_MVD_GetIs32PullDown(MS_U32 u32Id);
782 MS_BOOL MDrv_MVD_GetIsDynScalingEnabled(MS_U32 u32Id);
783 MS_S32 MDrv_MVD_GetPtsStcDiff(MS_U32 u32Id);
784 MS_U32 MDrv_MVD_GetVpuStreamId(MS_U32 u32Id);
785 
786 void MDrv_MVD_Pause(MS_U32 u32Id);
787 void MDrv_MVD_Resume(MS_U32 u32Id);
788 MS_BOOL MDrv_MVD_StepDisp(MS_U32 u32Id);
789 MS_BOOL MDrv_MVD_IsStepDispDone(MS_U32 u32Id);
790 MS_BOOL MDrv_MVD_StepDecode(MS_U32 u32Id);
791 MS_BOOL MDrv_MVD_IsStepDecodeDone(MS_U32 u32Id);
792 MS_BOOL MDrv_MVD_SeekToPTS(MS_U32 u32Id, MS_U32 u32Pts);
793 MS_BOOL MDrv_MVD_IsStep2PtsDone(MS_U32 u32Id);
794 MS_BOOL MDrv_MVD_SkipToPTS(MS_U32 u32Id, MS_U32 u32Pts);
795 MS_BOOL MDrv_MVD_TrickPlay(MS_U32 u32Id, MVD_TrickDec trickDec, MS_U8 u8DispDuration);
796 void MDrv_MVD_EnableForcePlay(MS_U32 u32Id);
797 
798 void MDrv_MVD_RegSetBase(MS_VIRT u32RegBaseAddr);
799 E_MVD_Result MDrv_MVD_GetFreeStream(MS_U32 *pu32Id, MVD_DRV_StreamType eStreamType);
800 MS_BOOL MDrv_MVD_Init(MS_U32 u32Id, MVD_CodecType eCodecType, MS_BOOL bShareBBU);
801 MS_BOOL MDrv_MVD_Exit(MS_U32 u32Id);
802 E_MVD_Result MDrv_MVD_Rst(MS_U32 u32Id,MVD_CodecType eCodecType, MS_BOOL bShareBBU);
803 
804 void MDrv_MVD_Play(MS_U32 u32Id);
805 void MDrv_MVD_SetAVSync(MS_U32 u32Id, MS_BOOL bEnable, MS_U32 u32Delay);
806 void MDrv_MVD_SetAVSyncThreshold(MS_U32 u32Id, MS_U32 u32Th);
807 void MDrv_MVD_SetAVSyncFreerunThreshold(MS_U32 u32Id, MS_U32 u32Th);
808 MS_U32 MDrv_MVD_GetAVSyncDelay(MS_U32 u32Id);
809 MS_BOOL MDrv_MVD_GetIsAVSyncOn(MS_U32 u32Id);
810 MS_BOOL MDrv_MVD_GetIsSyncRep(MS_U32 u32Id);
811 MS_BOOL MDrv_MVD_GetIsSyncSkip(MS_U32 u32Id);
812 MS_BOOL MDrv_MVD_ChangeAVsync(MS_U32 u32Id, MS_BOOL bEnable, MS_U16 u16PTS);
813 MS_BOOL MDrv_MVD_DispCtrl(MS_U32 u32Id, MS_BOOL bDecOrder, MS_BOOL bDropErr, MS_BOOL bDropDisp, MVD_FrcMode eFrcMode);
814 MS_BOOL MDrv_MVD_DispRepeatField(MS_U32 u32Id, MS_BOOL bEnable);
815 MS_U8 MDrv_MVD_GetColorFormat(MS_U32 u32Id);
816 MS_U8 MDrv_MVD_GetMatrixCoef(MS_U32 u32Id);
817 MS_U8 MDrv_MVD_GetActiveFormat(MS_U32 u32Id);
818 MS_U8 MDrv_MVD_GetDispRdy(MS_U32 u32Id);
819 MS_BOOL MDrv_MVD_Is1stFrmRdy(MS_U32 u32Id);
820 MS_U32 MDrv_MVD_GetGOPCount(MS_U32 u32Id);
821 MS_U32 MDrv_MVD_GetPicCounter(MS_U32 u32Id);
822 MS_U32 MDrv_MVD_GetParserByteCnt(MS_U32 u32Id);
823 MVD_DecStat MDrv_MVD_GetDecodeStatus(MS_U32 u32Id);
824 MS_U8 MDrv_MVD_GetLastCmd(MS_U32 u32Id);
825 MS_U32 MDrv_MVD_GetVldErrCount(MS_U32 u32Id);
826 MS_BOOL MDrv_MVD_DropErrorFrame(MS_U32 u32Id, MS_BOOL bDrop);
827 MS_BOOL MDrv_MVD_MVDCommand ( MS_U8 u8cmd, MVD_CmdArg *pstCmdArg );
828 MS_BOOL MDrv_MVD_SkipData(MS_U32 u32Id);
829 MS_BOOL MDrv_MVD_SkipToIFrame(MS_U32 u32Id);
830 MS_BOOL MDrv_MVD_GetCaps(MVD_Caps* pCaps);
831 MS_U32 MDrv_MVD_GetMaxPixel(MS_U32 u32Id);
832 MS_BOOL MDrv_MVD_GetFrmRateIsSupported(MS_U32 u32Id);
833 
834 E_MVD_Result MDrv_MVD_DisableErrConceal(MS_U32 u32Id, MS_BOOL bDisable);
835 E_MVD_Result MDrv_MVD_PushQueue(MS_U32 u32Id, MVD_PacketInfo* pInfo);
836 E_MVD_Result MDrv_MVD_FlushQueue(MS_U32 u32Id);
837 MS_BOOL MDrv_MVD_FlushDisplayBuf(MS_U32 u32Id);
838 MS_U32 MDrv_MVD_GetQueueVacancy(MS_U32 u32Id, MS_BOOL bCached);
839 MS_VIRT MDrv_MVD_GetESReadPtr(MS_U32 u32Id);
840 MS_VIRT MDrv_MVD_GetESWritePtr(MS_U32 u32Id);
841 E_MVD_Result MDrv_MVD_EnableLastFrameShow(MS_U32 u32Id, MS_BOOL bEnable);
842 E_MVD_Result MDrv_MVD_IsDispFinish(MS_U32 u32Id);
843 E_MVD_Result MDrv_MVD_SetSpeed(MS_U32 u32Id, MVD_SpeedType eSpeedType, MS_U8 u8Multiple);
844 E_MVD_Result MDrv_MVD_ResetPTS(MS_U32 u32Id, MS_U32 u32PtsBase);
845 MS_U32 MDrv_MVD_GetPTS(MS_U32 u32Id);
846 MS_U64 MDrv_MVD_GetU64PTS(MS_U32 u32Id,MVD_PtsType eType);
847 MS_U32 MDrv_MVD_GetNextPTS(MS_U32 u32Id);
848 MVD_TrickDec MDrv_MVD_GetTrickMode(MS_U32 u32Id);
849 MS_BOOL MDrv_MVD_IsPlaying(MS_U32 u32Id);
850 MS_BOOL MDrv_MVD_IsIdle(MS_U32 u32Id);
851 MS_BOOL MDrv_MVD_IsSeqChg(MS_U32 u32Id);
852 E_MVD_Result MDrv_MVD_DbgSetData(MS_U32 u32Id, MS_VIRT u32Addr, MS_U32 u32Data);
853 E_MVD_Result MDrv_MVD_DbgGetData(MS_U32 u32Id, MS_VIRT u32Addr, MS_U32* u32Data);
854 MS_U8 MDrv_MVD_GetDecodedFrameIdx (MS_U32 u32Id);
855 MS_BOOL MDrv_MVD_SetFileModeAVSync(MS_U32 u32Id, MVD_TIMESTAMP_TYPE eSyncMode);
856 MS_BOOL MDrv_MVD_IsAllBufferEmpty(MS_U32 u32Id);
857 MS_BOOL MDrv_MVD_GenPattern(MS_U32 u32Id, MVD_PatternType ePattern, MS_PHY u32PAddr, MS_U32* pu32Size);
858 MS_U32 MDrv_MVD_GetPatternInfo(void);
859 E_MVD_Result MDrv_MVD_SetDynScalingParam(MS_U32 u32Id, MS_PHY u32StAddr, MS_SIZE u32Size);
860 MS_BOOL MDrv_MVD_SetVirtualBox(MS_U32 u32Id, MS_U16 u16Width, MS_U16 u16Height);
861 MS_BOOL MDrv_MVD_SetBlueScreen(MS_U32 u32Id, MS_BOOL bEn);
862 MS_BOOL MDrv_MVD_FRC_OnlyShowTopField(MS_U32 u32Id, MS_BOOL bEnable);
863 MS_BOOL MDrv_MVD_EnableInt(MS_U32 u32Id, MS_U32 bEn);
864 E_MVD_Result MDrv_MVD_EnableDispOneField(MS_U32 u32Id, MS_BOOL bEn);
865 E_MVD_Result MDrv_MVD_GetExtDispInfo(MS_U32 u32Id, MVD_ExtDispInfo* pInfo);
866 E_MVD_Result MDrv_MVD_GetFrmInfo(MS_U32 u32Id, MVD_FrmInfoType eType, MVD_FrmInfo* pInfo);
867 E_MVD_Result MDrv_MVD_GetTimeCode(MS_U32 u32Id, MVD_FrmInfoType eType, MVD_TimeCode* pInfo);
868 MS_BOOL MDrv_MVD_GetUsrDataIsAvailable(MS_U32 u32Id);
869 MS_BOOL MDrv_MVD_GetUsrDataInfo(MS_U32 u32Id, MVD_UsrDataInfo* pUsrInfo);
870 E_MVD_Result MDrv_MVD_SetFreezeDisp(MS_U32 u32Id, MS_BOOL bEn);
871 MS_U32 MDrv_MVD_GetDispCount(MS_U32 u32Id);
872 MS_U32 MDrv_MVD_GetDropCount(MS_U32 u32Id);
873 E_MVD_Result MDrv_MVD_GetXcLowDelayIntState(MS_U32 u32Id);
874 E_MVD_Result MDrv_MVD_SetFdMaskDelayCount(MS_U32 u32Id, MS_U16 u16Cnt);
875 E_MVD_Result MDrv_MVD_SetOutputFRCMode(MS_U32 u32Id, MS_U8 u8FrameRate, MS_U8 u8Interlace);
876 E_MVD_Result MDrv_MVD_SetFRCDropType(MS_U32 u32Id, MS_U8 u8DropType);
877 E_MVD_Result MDrv_MVD_SetDisableSeqChange(MS_U32 u32Id, MS_BOOL bEnable);
878 
879 MS_BOOL MDrv_MVD_SetMStreamerMode(MS_U32 u32Id, MS_U8 u8Mode);
880 MS_BOOL MDrv_MVD_SetMcuMode(MS_U32 u32Id, MS_U8 u8Mode);
881 MS_BOOL MDrv_MVD_ForceInterlaceMode(MS_U32 u32Id, MS_U8 u8Mode);
882 MS_BOOL MDrv_MVD_ForceProgressiveMode(MS_U32 u32Id, MS_U8 u8Mode);
883 MS_BOOL MDrv_MVD_FrameFlip(MS_U32 u32Id, MS_U8 u8FrmIdx);
884 MS_BOOL MDrv_MVD_FrameRelease(MS_U32 u32Id, MS_U8 u8FrmIdx);
885 MS_BOOL MDrv_MVD_FrameCapture(MS_U32 u32Id, MS_U8 u8FrmIdx, MS_BOOL bEnable);
886 MS_BOOL MDrv_MVD_ReleaseFdMask(MS_U32 u32Id, MS_BOOL bRls);
887 MS_BOOL MDrv_MVD_ParserRstDone(MS_U32 u32Id, MS_BOOL bEnable);
888 MS_BOOL MDrv_MVD_SetVSizeAlign(MS_U32 u32Id, MS_BOOL bEnable);
889 E_MVD_Result MDrv_MVD_SetAutoMute(MS_U32 u32Id, MS_BOOL bEnable);
890 
891 MS_BOOL MDrv_MVD_SetSkipRepeatMode(MS_U32 u32Id, MS_U8 u8Mode);
892 MS_BOOL MDrv_MVD_SetSingleDecodeMode(MS_BOOL bEnable);
893 MS_BOOL MDrv_MVD_FlushPTSBuf(MS_U32 u32Id,MS_BOOL bEnable);
894 MS_BOOL MDrv_MVD_ShowDecodeOrder(MS_U32 u32Id, MS_U8 u8Mode);
895 E_MVD_Result MDrv_MVD_GetCrcValue(MS_U32 u32Id, MVD_CrcIn *pCrcIn, MVD_CrcOut *pCrcOut);
896 E_MVD_Result MDrv_MVD_SetDbgMode(MS_U32 u32Id, MVD_DbgMode enDbgMode, MS_BOOL bEn);
897 MS_BOOL MDrv_MVD_SuspendDynamicScale(MS_U32 u32Id, MS_BOOL bEnable);
898 MS_U8 MDrv_MVD_GetSuspendDynamicScale(MS_U32 u32Id);
899 MS_U8 MDrv_MVD_GetStereoType(MS_U32 u32Id);
900 void MDrv_MVD_DbgDump(MS_U32 u32Id);
901 MS_U32 MDrv_MVD_GetDivxVer(MS_U32 u32Id);
902 MS_BOOL MDrv_MVD_SetIdctMode(MS_U32 u32Id, MS_U8 u8Mode);
903 E_MVD_Result MDrv_MVD_Init_Share_Mem(void);
904 MS_BOOL MDrv_MVD_PreSetCodecType(MS_U32 u32Id,MVD_CodecType eMvdCodecType ,MS_BOOL *bHDMode);
905 E_MVD_Result MDrv_MVD_SetXCLowDelayPara(MS_U32 u32Id,MS_U32 u32Para);
906 MS_U8 MVD_GetHalIdx(MS_U32 u32Id);
907 MS_U32 MVD_GetStreamId(MS_U8 u8Idx);
908 void MDrv_MVD_Drop_One_PTS(MS_U32 u32Id);
909 MS_BOOL MDrv_MVD_DisableEsFullStop(MS_U32 u32Id, MS_BOOL bDisable);
910 #define MVD_ENABLE_ISR
911 
912 #ifdef MVD_ENABLE_ISR
913 E_MVD_Result MDrv_MVD_SetIsrEvent(MS_U32 u32Id, MS_U32 eEvent, MVD_InterruptCb fnHandler);
914 MS_U32 MDrv_MVD_GetIsrEvent(MS_U32 u32Id);
915 #else
916 #define MDrv_MVD_SetIsrEvent(x, y, z) (E_MVD_RET_OK)
917 #define MDrv_MVD_GetIsrEvent(x)     (MS_U32)0
918 #endif
919 MS_U32 MDrv_MVD_GetSLQNum(MS_U32 u32Id);
920 MS_U32 MDrv_MVD_GetDispQNum(MS_U32 u32Id);
921 
922 E_MVD_Result MDrv_MVD_EX_SetMVDClockSpeed(MVD_EX_ClockSpeed eClockSpeed);
923 MS_BOOL MDrv_MVD_ShowFirstFrameDirect(MS_U32 u32Id,MS_BOOL bEnable);
924 E_MVD_Result MDrv_MVD_SetSelfSeqChange(MS_U32 u32Id, MS_BOOL bEnable);
925 MS_U8 MDrv_MVD_GetESBufferStatus(MS_U32 u32Id);
926 E_MVD_Result MDrv_MVD_SetExternalDSBuffer(MS_U32 u32Id, MVD_EX_ExternalDSBuf *pExternalBuf);
927 MS_BOOL MDrv_MVD_Field_Polarity_Display_One_field(MS_U32 u32Id, MS_BOOL bEnable,MS_U8 top_bottom);
928 
929 MS_BOOL MDrv_MVD_SetShareMemoryBase(MS_U32 u32Id, MS_VIRT u32base);
930 MS_U32 MDrv_MVD_GetShareMemoryOffset(MS_U32 u32Id, MS_VIRT *u32base);
931 MS_BOOL MDrv_MVD_EnableVPUSecurityMode(MS_BOOL enable);
932 MS_BOOL MDrv_MVD_GetSupport2ndMVOPInterface(void);
933 MS_BOOL MDrv_MVD_REE_RegisterMBX(void);
934 MS_BOOL MDrv_MVD_REE_SetSHMBaseAddr(MS_U32 U32Type,MS_PHY u32SHMAddr,MS_PHY u32SHMSize,MS_PHY u32MIU1Addr);
935 MS_BOOL MDrv_MVD_GetPVRSeamlessInfo(MS_U8 u8Idx,void* param);
936 
937 MS_BOOL MDrv_MVD_SetExternal_CC608_Buffer(MS_U32 u32Id, MS_VIRT u32base,MS_U8 u8size);
938 MS_BOOL MDrv_MVD_SetExternal_CC708_Buffer(MS_U32 u32Id, MS_VIRT u32base,MS_U8 u8size);
939 MS_BOOL MDrv_MVD_SetPrebufferSize(MS_U32 u32Id, MS_U32 size);
940 E_MVD_Result MDrv_MVD_HWBuffer_ReMappingMode(MS_U32 u32Id,MS_BOOL bEnable);
941 void MDrv_MVD_REE_GetSHMInformation(MS_U32 u32Id, MS_VIRT* u32SHMAddr, MS_VIRT* u32VsyncSHMOffset);
942 E_MVD_Result MDrv_MVD_REE_GetVsyncExtShm(MS_U32 u32Id, MS_VIRT* u32SHMAddr, MS_VIRT* u32VsyncExtShmOffset);
943 E_MVD_Result MDrv_MVD_SetTimeIncPredictParam(MS_U32 u32Id,MS_U32 u32Para);
944 MS_BOOL MDrv_MVD_SetDcodeTimeoutParam(MS_U32 u32Id,MS_BOOL enable,MS_U32 u32timeout);
945 MS_BOOL MDrv_MVD_SetFramebufferAutoMode(MS_U32 u32Id,MS_BOOL bEnable);
946 E_MVD_Result MDrv_MVD_Set_Smooth_Rewind(MS_U32 u32Id, MS_U8 bEnable);
947 E_MVD_Result MDrv_MVD_IsAlive(MS_U32 u32Id);
948 E_MVD_Result MDrv_MVD_Set_Err_Tolerance(MS_U32 u32Id, MS_U16 u16Para);
949 void MVD_RecordStreamId(MS_U32 u32Id);
950 void MDrv_MVD_EnableAutoInsertDummyPattern(MS_U32 u32Id, MS_BOOL bEnable);
951 E_MVD_Result MDrv_MVD_PVR_Seamless_mode(MS_U32 u32Id, MS_U8 u8Arg);
952 E_MVD_Result MDrv_MVD_SetDispFinishMode(MS_U32 u32Id,MS_U8 u8Mode);
953 MS_BOOL MDrv_MVD_Set_MBX_param(MS_U8 u8APIMbxMsgClass);
954 void MDrv_MVD_SetDmxFrameRate(MS_U32 u32Id,MS_U32 u32Value);
955 void MDrv_MVD_SetDmxFrameRateBase(MS_U32 u32Id,MS_U32 u32Value);
956 void MDrv_MVD_TrickPlay2xAVSync(MS_U32 u32Id,MS_BOOL bEnable);
957 void MDrv_MVD_Dynamic_FB_Mode(MS_BOOL bEnable,MS_PHY u32Address,MS_U32 u32Size);
958 void MDrv_MVD_SetCMAInformation(void* cmaInitParam);
959 E_MVD_Result MDrv_MVD_EnablePTSDetector(MS_U32 u32Id, MS_BOOL bEn);
960 MS_BOOL MDrv_MVD_SetAVSyncDispAutoDrop(MS_U32 u32Id,MS_BOOL bEnable);
961 MS_BOOL MDrv_MVD_SetDynmcDispPath(MS_U32 u32Id,MS_BOOL bConnect,MVD_DISPLAY_PATH eValue,MS_BOOL bPreSet);
962 MS_BOOL MDrv_MVD_PreConnectInputTsp(MS_U32 u32Id, MS_BOOL bEnable, MVD_INPUT_TSP eInputTsp, MVD_Original_Stream eStream);
963 E_MVD_Result MDrv_MVD_DisablePBFrameMode(MS_U32 u32Id, MS_BOOL bEn);
964 MS_BOOL MDrv_MVD_ReleaseFreeStream(MS_U32 u32Id);
965 MS_U8   MDrv_MVD_CheckFreeStream(MVD_Original_Stream eStream);
966 MS_BOOL MDrv_MVD_GetColorInfo(MS_U32 u32Id, MVD_Color_Info* pstColorInfo);
967 E_MVD_Result MDrv_MVD_SetDVXCShmAddr(MS_U32 u32Id, MS_PHY u32FWBaseAddr, MS_PHY u32DVXCShmAddr);
968 E_MVD_Result MDrv_MVD_Set_SlowSyncParam(MS_U32 u32Id, MS_U8 u8RepeatPeriod,MS_U8 u8DropPeriod);
969 MS_BOOL MDrv_MVD_VariableFrameRate(MS_U32 u32Id);
970 MS_U32 MDrv_MVD_EX_GetMinTspDataSize(MS_U32 u32Id);
971 MS_BOOL MDrv_MVD_PUSI_Control(MS_U32 u32Id, MS_BOOL bEnable);
972 #endif
973 
974 #ifdef __cplusplus
975 }
976 #endif
977 
978 #endif
979