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 #include "drvmvd_cc.h" 118 //////////////////////////////////////////////////////////////////////////////// 119 // Constant & Macro Definition 120 //////////////////////////////////////////////////////////////////////////////// 121 /// Version string. 122 #define MVD_DRV_VERSION /* Character String for DRV/API version */ \ 123 MSIF_TAG, /* 'MSIF' */ \ 124 MSIF_CLASS, /* '00' */ \ 125 MSIF_CUS, /* 0x0000 */ \ 126 MSIF_MOD, /* 0x0000 */ \ 127 MSIF_CHIP, \ 128 MSIF_CPU, \ 129 {'M','V','D','_'}, /* IP__ */ \ 130 {'0','A'}, /* 0.0 ~ Z.Z */ \ 131 {'0','1'}, /* 00 ~ 99 */ \ 132 {'0','0','6','4','1','6','6','7'}, /* CL# */ \ 133 MSIF_OS 134 135 #define MIU1_BASE_DEFAULT 0x8000000 136 #define MIU_SEL_0 0 137 #define MIU_SEL_1 1 138 139 140 #ifdef REDLION_LINUX_KERNEL_ENVI 141 #define MVD_ENABLE_MSOS_MIU1_BASE 0 142 #else 143 #define MVD_ENABLE_MSOS_MIU1_BASE 1 144 #endif 145 146 147 //////////////////////////////////////////////////////////////////////////////// 148 // Type & Structure Declaration 149 //////////////////////////////////////////////////////////////////////////////// 150 /// MVD's capability 151 typedef struct _MVD_Caps 152 { 153 MS_BOOL bMPEG2; 154 MS_BOOL bMPEG4; 155 MS_BOOL bVC1; 156 } MVD_Caps; 157 158 /// MVD driver info. 159 typedef struct _MVD_DrvInfo 160 { 161 MS_U32 u32Resource; 162 MS_U32 u32DeviceNum; 163 MS_U32 u32FWVersion; 164 MVD_Caps stCaps; 165 } MVD_DrvInfo; 166 167 /// Firmware status 168 typedef enum _MVD_DecStat 169 { 170 E_MVD_STAT_IDLE = 0x00, 171 E_MVD_STAT_FIND_STARTCODE = 0x01,//start code 172 E_MVD_STAT_FIND_SPECIALCODE = 0x11,//special code [00_00_01_C5_ab_08_06_27] 173 //for flush data using 174 E_MVD_STAT_FIND_FRAMEBUFFER = 0x02, 175 //fw is trying to find empty FB to continue decoding. 176 //if hang in this state, please check "vsync" or AVSync. 177 E_MVD_STAT_WAIT_DECODEDONE = 0x03, 178 E_MVD_STAT_DECODE_DONE = 0x04, 179 E_MVD_STAT_WAIT_VDFIFO = 0x05, 180 E_MVD_STAT_INIT_SUCCESS = 0x06, 181 E_MVD_STAT_UNKNOWN = 0xff, 182 } MVD_DecStat; 183 184 /// MVD driver status 185 typedef struct _MVD_DrvStatus 186 { 187 MS_U32 u32FWVer; 188 MVD_DecStat eDecStat; 189 MS_BOOL bIsBusy; 190 MS_U8 u8LastFWCmd; 191 } MVD_DrvStatus; 192 193 /// Enumerate CodecType that MVD supports 194 typedef enum _MVD_CodecType 195 { 196 E_MVD_CODEC_MPEG2 = 0x10, 197 E_MVD_CODEC_MPEG4 = 0x00, 198 E_MVD_CODEC_MPEG4_SHORT_VIDEO_HEADER = 0x01, 199 E_MVD_CODEC_DIVX311 = 0x02, 200 E_MVD_CODEC_FLV = 0x03, 201 E_MVD_CODEC_VC1_ADV = 0x04, 202 E_MVD_CODEC_VC1_MAIN = 0x05, 203 E_MVD_CODEC_UNKNOWN = 0xff 204 } MVD_CodecType; 205 206 /// Mode of MVD input source 207 typedef enum _MVD_SrcMode 208 { 209 E_MVD_FILE_MODE = 0x00, 210 E_MVD_SLQ_MODE = 0x01, 211 E_MVD_TS_MODE = 0x02, 212 E_MVD_SLQ_TBL_MODE = 0x03, 213 E_MVD_TS_FILE_MODE = 0x04, 214 E_MVD_SRC_UNKNOWN = 0x05 215 } MVD_SrcMode; 216 217 /// AVSync mode for file playback 218 typedef enum 219 { 220 E_MVD_TIMESTAMP_FREERUN = 0, ///Player didn't set PTS/DTS, so display freerun 221 E_MVD_TIMESTAMP_PTS = 1, ///Player set PTS to MVD decoder 222 E_MVD_TIMESTAMP_DTS = 2, ///Player set DTS to MVD decoder 223 E_MVD_TIMESTAMP_STS = 3, ///SortedTimeStamp means decoder should sort timestamp 224 E_MVD_TIMESTAMP_PTS_RVU = 4, ///Player set PTS to MVD decoder 225 E_MVD_TIMESTAMP_DTS_RVU = 5, ///Player set DTS to MVD decoder 226 227 } MVD_TIMESTAMP_TYPE; 228 229 /// ErrCode obtained from firmware 230 typedef enum _MVD_ErrCode 231 { 232 E_MVD_ERR_UNKNOWN = 0, 233 E_MVD_ERR_SHAPE = 1, 234 E_MVD_ERR_USED_SPRITE = 2, 235 E_MVD_ERR_NOT_8_BIT = 3, //error_status : bits per pixel 236 E_MVD_ERR_NERPRED_ENABLE = 4, 237 E_MVD_ERR_REDUCED_RES_ENABLE = 5, 238 E_MVD_ERR_SCALABILITY = 6, 239 E_MVD_ERR_OTHER = 7, 240 E_MVD_ERR_H263_ERROR = 8, 241 E_MVD_ERR_RES_NOT_SUPPORT = 9, //error_status : none 242 E_MVD_ERR_MPEG4_NOT_SUPPORT = 10, //error_status : none 243 E_MVD_ERR_PROFILE_NOT_SUPPORT= 11, //error_status : none 244 E_MVD_ERR_RCV_ERROR_OCCUR = 12, //error_status : none 245 E_MVD_ERR_VC1_NOT_SUPPORT = 13, //error_status : none 246 E_MVD_ERR_UNKNOW_CODEC_NOT_SUPPORT= 14, //error_status : none 247 E_MVD_ERR_SLQ_TBL_NOT_SUPPORT= 15 //error_status : none 248 } MVD_ErrCode; 249 250 /// Detailed error status when error occurs 251 typedef enum _MVD_ErrStatus 252 { 253 //error_status for E_MVD_ERR_SHAPE 254 E_MVD_ERR_SHAPE_RECTANGULAR = 0x10, 255 E_MVD_ERR_SHAPE_BINARY = 0x11, 256 E_MVD_ERR_SHAPE_BINARY_ONLY = 0x12, 257 E_MVD_ERR_SHAPE_GRAYSCALE = 0x13, 258 259 //error_status for E_MVD_ERR_USED_SPRITE 260 E_MVD_ERR_USED_SPRITE_UNUSED = 0x20, //sprite not used 261 E_MVD_ERR_USED_SPRITE_STATIC = 0x21, 262 E_MVD_ERR_USED_SPRITE_GMC = 0x22, 263 E_MVD_ERR_USED_SPRITE_RESERVED = 0x23, 264 265 E_MVD_ERR_STATUS_NONE = 0x77, 266 E_MVD_ERR_STATUS_UNKOWN = 0x00, 267 } MVD_ErrStatus; 268 269 /// Picture type of MPEG video 270 typedef enum _MVD_PicType 271 { 272 E_MVD_PIC_I = 0, 273 E_MVD_PIC_P = 1, 274 E_MVD_PIC_B = 2, 275 E_MVD_PIC_UNKNOWN = 0xf, 276 } MVD_PicType; 277 278 /// Mode of frame rate conversion 279 typedef enum _MVD_FrcMode { 280 E_MVD_FRC_NORMAL = 0, 281 E_MVD_FRC_DISP_TWICE = 1, 282 E_MVD_FRC_3_2_PULLDOWN = 2, 283 E_MVD_FRC_PAL_TO_NTSC = 3, 284 E_MVD_FRC_NTSC_TO_PAL = 4, 285 E_MVD_FRC_DISP_ONEFIELD = 5,//Removed, call MDrv_MVD_EnableDispOneField() instead. 286 } MVD_FrcMode; 287 288 /// MVD play mode 289 typedef enum 290 { 291 E_MVD_PLAY = 0x00, 292 E_MVD_STEPDISP = 0x01, 293 E_MVD_PAUSE = 0x02, 294 E_MVD_FASTFORWARD = 0x03, 295 E_MVD_BACKFORWARD = 0x04, 296 E_MVD_UNKNOWMODE = 0xff 297 } MVD_PlayMode; 298 299 /// Store the packet information used for SLQ table file mode 300 typedef struct 301 { 302 MS_VIRT u32StAddr; ///< Packet offset from bitstream buffer base address. unit: byte. 303 MS_U32 u32Length; ///< Packet size. unit: byte. 304 MS_U32 u32TimeStamp; ///< Packet time stamp. unit: ms. 305 MS_U32 u32ID_L; ///< Packet ID low part. 306 MS_U32 u32ID_H; ///< Packet ID high part. 307 } MVD_PacketInfo; 308 309 ///MVD frame info data structure 310 typedef struct 311 { 312 MS_U16 u16HorSize; 313 MS_U16 u16VerSize; 314 MS_U32 u32FrameRate; 315 MS_U8 u8AspectRate; 316 MS_U8 u8Interlace; 317 MS_U8 u8AFD; 318 MS_U16 u16par_width; 319 MS_U16 u16par_height; 320 MS_U16 u16SarWidth; 321 MS_U16 u16SarHeight; 322 MS_U16 u16CropRight; 323 MS_U16 u16CropLeft; 324 MS_U16 u16CropBottom; 325 MS_U16 u16CropTop; 326 MS_U16 u16Pitch; 327 MS_U16 u16PTSInterval; 328 MS_U8 u8MPEG1; 329 MS_U8 u8PlayMode; 330 MS_U8 u8FrcMode; 331 MS_U32 u32DynScalingAddr; ///Dynamic scaling address 332 MS_U8 u8DynScalingDepth; ///Dynamic scaling depth 333 MS_U32 u32DynScalingBufSize; ///Dynamic scaling BufSize 334 MS_BOOL bEnableMIUSel; ///Dynamic scaling DS buffer on miu1 or miu0 335 } MVD_FrameInfo; 336 337 /// MVD AVSync Configuration 338 typedef struct 339 { 340 MS_BOOL bEnable; 341 MS_U32 u32Delay; //unit: ms 342 MS_U16 u16Tolerance; //unit: ms 343 } MVD_AVSyncCfg; 344 345 /// MVD Command arguments 346 typedef struct 347 { 348 MS_U8 Arg0; ///< argument 0 349 MS_U8 Arg1; ///< argument 1 350 MS_U8 Arg2; ///< argument 2 351 MS_U8 Arg3; ///< argument 3 352 MS_U8 Arg4; ///< argument 4 353 MS_U8 Arg5; ///< argument 5 354 } MVD_CmdArg; 355 356 /// MVD commands needing handshake 357 typedef enum 358 { 359 MVD_HANDSHAKE_PAUSE, 360 MVD_HANDSHAKE_SLQ_RST, 361 MVD_HANDSHAKE_STOP, 362 MVD_HANDSHAKE_SKIP_DATA, 363 MVD_HANDSHAKE_SKIP_TO_PTS, 364 MVD_HANDSHAKE_SINGLE_STEP, 365 MVD_HANDSHAKE_SCALER_INFO, 366 MVD_HANDSHAKE_GET_NXTDISPFRM, 367 MVD_HANDSHAKE_PARSER_RST, 368 MVD_HANDSHAKE_RST_CC608, 369 MVD_HANDSHAKE_RST_CC708 370 } MVD_HANDSHAKE_CMD; 371 372 373 374 typedef enum 375 { 376 E_MVD_FB_REDUCTION_NONE = 0, ///< FB reduction disable 377 E_MVD_FB_REDUCTION_1_2 = 1, ///< FB reduction 1/2 378 E_MVD_FB_REDUCTION_1_4 = 2, ///< FB reduction 1/4 379 }MVD_FB_Reduction_Type; 380 381 typedef struct 382 { 383 MVD_FB_Reduction_Type LumaFBReductionMode; ///< Luma frame buffer reduction mode. 384 MVD_FB_Reduction_Type ChromaFBReductionMode; ///< Chroma frame buffer reduction mode. 385 MS_U8 u8EnableAutoMode; /// 0: Disable, 1: Enable 386 } MVD_FB_Reduction; 387 388 389 /// Configuration of MVD firmware 390 typedef struct 391 { 392 MS_U32 u32FWVerNum; 393 MS_U32 u32FWSrc; 394 MS_U8 u8FBMode; 395 MVD_CodecType eCodecType; 396 MS_BOOL bNotReload; 397 MVD_FB_Reduction stFBReduction; ///< MVD Frame buffer reduction type 398 MS_U16 u16FBReduceValue; 399 } MVD_FWCfg; 400 401 /// The type of fw binary input source 402 typedef enum 403 { 404 E_MVD_FW_SOURCE_NONE, ///< No input fw. 405 E_MVD_FW_SOURCE_DRAM, ///< input source from DRAM. 406 E_MVD_FW_SOURCE_FLASH, ///< input source from FLASH. 407 } MVD_FWSrcType; 408 409 /// Configuration of memory layout 410 typedef struct 411 { 412 MVD_FWSrcType eFWSrcType; //!< the input FW source type. 413 MS_U32 u32FWSrcVAddr; //!< virtual address of input FW binary in DRAM 414 MS_PHY u32FWBinAddr; //!< physical address in Flash/DRAM of FW code 415 MS_U32 u32FWBinSize; 416 MS_PHY u32FWCodeAddr; 417 MS_U32 u32FWCodeSize; 418 MS_PHY u32FBAddr; 419 MS_U32 u32FBSize; 420 MS_PHY u32BSAddr; 421 MS_U32 u32BSSize; 422 MS_PHY u32DrvBufAddr; 423 MS_U32 u32DrvBufSize; 424 MS_PHY u32DynSacalingBufAddr; 425 MS_U32 u32DynSacalingBufSize; 426 MS_PHY u32Miu1BaseAddr; 427 MS_BOOL bFWMiuSel; 428 MS_BOOL bHWMiuSel; 429 MS_BOOL bEnableDynScale; /// dynamic scaling control bit 430 MS_BOOL bSupportSDModeOnly; /// Config from IP Check 431 } MVD_MEMCfg; 432 433 /// Configuration of MVD 434 typedef struct 435 { 436 MVD_CodecType u8CodecType; 437 MVD_SrcMode u8BSProviderMode; 438 MS_U8 bDisablePESParsing; 439 } MVD_InfoCfg; 440 441 /// Return value of MVD driver 442 typedef enum 443 { 444 E_MVD_RET_OK = 1, 445 E_MVD_RET_FAIL = 0, 446 E_MVD_RET_INVALID_PARAM = 2, 447 E_MVD_RET_QUEUE_FULL = 3, 448 E_MVD_RET_TIME_OUT = 4 449 } E_MVD_Result; 450 451 /// Mode of trick decoding 452 typedef enum 453 { 454 E_MVD_TRICK_DEC_ALL = 0, 455 E_MVD_TRICK_DEC_IP, 456 E_MVD_TRICK_DEC_I, 457 E_MVD_TRICK_DEC_UNKNOWN 458 } MVD_TrickDec; 459 460 /// Speed type of playing 461 typedef enum 462 { 463 E_MVD_SPEED_DEFAULT = 0, 464 E_MVD_SPEED_FAST, 465 E_MVD_SPEED_SLOW, 466 E_MVD_SPEED_TYPE_UNKNOWN 467 } MVD_SpeedType; 468 469 /// MVD pattern type 470 typedef enum 471 { 472 E_MVD_PATTERN_FLUSH = 0, ///< Used after MDrv_MVD_Flush(). 473 E_MVD_PATTERN_FILEEND, ///< Used for file end. 474 } MVD_PatternType; 475 476 /// MVD frame info structure 477 typedef struct 478 { 479 MS_PHY u32LumaAddr; ///< The start physical of luma data. Unit: byte. 480 MS_PHY u32ChromaAddr; ///< The start physcal of chroma data. Unit: byte. 481 MS_U32 u32TimeStamp; ///< Time stamp(DTS, PTS) of current displayed frame. Unit: 90khz. 482 MS_U32 u32ID_L; ///< low part of ID number set by MDrv_MVD_PushQueue(). 483 MS_U32 u32ID_H; ///< high part of ID number set by MDrv_MVD_PushQueue(). 484 MS_U16 u16Pitch; ///< The pitch of current frame. 485 MS_U16 u16Width; ///< pixel width of current frame. 486 MS_U16 u16Height; ///< pixel height of current frame. 487 MS_U16 u16FrmIdx; ///< index of current frame. 488 MVD_PicType eFrmType; ///< picture type: I, P, B frame 489 } MVD_FrmInfo; 490 491 /// MVD extension display info structure 492 typedef struct 493 { 494 MS_U16 u16VSize; /// vertical size from sequene_display_extension 495 MS_U16 u16HSize; /// horizontal size from sequene_display_extension 496 MS_U16 u16VOffset; /// vertical offset from picture_display_extension 497 MS_U16 u16HOffset; /// horizontal offset from picture_display_extension 498 } MVD_ExtDispInfo; 499 500 /// Type of frame info that can be queried 501 typedef enum 502 { 503 E_MVD_FRMINFO_DISPLAY=0, ///< Displayed frame. 504 E_MVD_FRMINFO_DECODE =1, ///< Decoded frame. 505 E_MVD_FRMINFO_NEXT_DISPLAY =2,///< Next frame to be displayed. 506 } MVD_FrmInfoType; 507 508 typedef enum { 509 E_MVD_FRAME_FLIP = 0, 510 E_MVD_FRAME_RELEASE = 1, 511 } MVD_FrmOpt; 512 513 /// MVD time code structure 514 typedef struct 515 { 516 MS_U8 u8TimeCodeHr; ///< time_code_hours 517 MS_U8 u8TimeCodeMin; ///< time_code_minutes 518 MS_U8 u8TimeCodeSec; ///< time_code_seconds 519 MS_U8 u8TimeCodePic; ///< time_code_pictures 520 521 MS_U8 u8DropFrmFlag; ///< drop_frame_flag 522 MS_U8 u8Reserved[3]; ///< reserved fields for 4-byte alignment 523 } MVD_TimeCode; 524 525 /// Format of CC (Closed Caption) 526 typedef enum _MVD_CCFormat 527 { 528 E_MVD_CC_NONE = 0x00, 529 E_MVD_CC_608 = 0x01, //For CC608 or 157 530 E_MVD_CC_708 = 0x02, //For CC708 531 E_MVD_CC_UNPACKED = 0x03, 532 } MVD_CCFormat; 533 534 /// Type of CC 535 typedef enum _MVD_CCType 536 { 537 E_MVD_CC_TYPE_NONE = 0, 538 E_MVD_CC_TYPE_NTSC_FIELD1 = 1, 539 E_MVD_CC_TYPE_NTSC_FIELD2 = 2, 540 E_MVD_CC_TYPE_DTVCC = 3, 541 E_MVD_CC_TYPE_NTSC_TWOFIELD = 4, 542 } MVD_CCType; 543 544 /// Data structure of CC Configuration 545 typedef struct 546 { 547 MVD_CCFormat eFormat; 548 MVD_CCType eType; 549 MS_U32 u32BufStAdd; 550 MS_U32 u32BufSize; 551 } MVD_CCCfg; 552 553 /// Info. of user data 554 typedef struct 555 { 556 MS_U32 u32Pts; 557 MS_U8 u8PicStruct; /* picture_structure*/ 558 MS_U8 u8PicType; /* picture type: 1->I picture, 2->P,3->B */ 559 MS_U8 u8TopFieldFirst; /* Top field first: 1 if top field first*/ 560 MS_U8 u8RptFirstField; /* Repeat first field: 1 if repeat field first*/ 561 562 MS_U16 u16TmpRef; /* Temporal reference of the picture*/ 563 MS_U8 u8ByteCnt; 564 MS_U8 u8Reserve; 565 566 MS_U32 u32DataBuf; 567 } MVD_UsrDataInfo; 568 569 /// MVD interrupt events 570 typedef enum 571 { 572 E_MVD_EVENT_DISABLE_ALL = 0, ///< unregister all events notification 573 E_MVD_EVENT_USER_DATA = BIT(0), ///< found user data 574 E_MVD_EVENT_DISP_VSYNC = BIT(1), ///< vsync interrupt 575 E_MVD_EVENT_PIC_FOUND = BIT(2), ///< 576 E_MVD_EVENT_FIRST_FRAME = BIT(3), ///< first frame decoded 577 E_MVD_EVENT_DISP_RDY = BIT(4), ///< MVD ready to display. 578 E_MVD_EVENT_SEQ_FOUND = BIT(5), ///< found sequence header 579 //E_MVD_EVENT_DEC_ERR = BIT(5), ///< MVD HW found decode error. 580 //E_MVD_EVENT_DEC_CC_FOUND = BIT(6), ///< MVD found one user data with decoded frame. 581 //E_MVD_EVENT_DEC_DATA_ERR = BIT(7), ///< Data error. 582 E_MVD_EVENT_UNMUTE = BIT(8), ///< video unmute 583 E_MVD_EVENT_USER_DATA_DISP= BIT(9), ///< found user data in display order 584 E_MVD_EVENT_DEC_I = BIT(17), 585 } MVD_Event; 586 587 /// MVD clock speed 588 typedef enum 589 { 590 E_MVD_CLOCK_SPEED_NONE = 0, 591 E_MVD_CLOCK_SPEED_HIGHEST, 592 E_MVD_CLOCK_SPEED_HIGH, 593 E_MVD_CLOCK_SPEED_MEDIUM, 594 E_MVD_CLOCK_SPEED_LOW, 595 E_MVD_CLOCK_SPEED_LOWEST, 596 E_MVD_CLOCK_SPEED_DEFAULT, 597 } MVD_ClockSpeed; 598 599 600 typedef void (*MVD_InterruptCb)(void); 601 602 typedef struct 603 { 604 MS_PHY u32UserDataBuf; 605 } MVD_InternalMemCfg; 606 607 //////////////////////////////////////////////////////////////////////////////// 608 // Function Prototype Declaration 609 //////////////////////////////////////////////////////////////////////////////// 610 // E_MVD_Result MDrv_MVD_SetCfg(MVD_FWCfg* fwCfg, MVD_MEMCfg* memCfg, MVD_InfoCfg* InfoCfg); 611 // MS_U32 MDrv_MVD_GetFWVer(void); 612 void MDrv_MVD_SetDbgLevel(MS_U8 level); 613 // const MVD_DrvInfo* MDrv_MVD_GetInfo(void); 614 // E_MVD_Result MDrv_MVD_GetLibVer(const MSIF_Version **ppVersion); 615 // void MDrv_MVD_GetStatus(MVD_DrvStatus* pDrvStatus); 616 MVD_InternalMemCfg *MDrv_MVD_GetInternalMemCfg(void); 617 618 619 // void MDrv_MVD_SetCodecInfo(MVD_CodecType u8CodecType, MVD_SrcMode u8BSProviderMode, MS_U8 bDisablePESParsing); 620 // void MDrv_MVD_SetDivXCfg(MS_U8 u8MvAdjust, MS_U8 u8IdctSel); 621 622 // MS_BOOL MDrv_MVD_SetBitStreamAddr(MS_U32 u32start, MS_U32 u32end); 623 // void MDrv_MVD_SetFrameBuffAddr(MS_U32 u32addr); 624 // void MDrv_MVD_GetFrameInfo(MVD_FrameInfo *pinfo ); 625 // void MDrv_MVD_SetOverflowTH (MS_U32 u32Threshold); 626 // void MDrv_MVD_SetUnderflowTH (MS_U32 u32Threshold); 627 628 // void MDrv_MVD_RstIFrameDec( void ); 629 // MS_BOOL MDrv_MVD_GetIsIFrameDecoding( void ); 630 631 // MS_U8 MDrv_MVD_GetSyncStatus( void ); 632 // MS_BOOL MDrv_MVD_GetIsFreerun(void); 633 // MS_U8 MDrv_MVD_GetIsIPicFound( void ); 634 635 //for MM 636 // MS_U32 MDrv_MVD_GetResidualStreamSize( void ); 637 638 // MS_BOOL MDrv_MVD_DecodeIFrame(MS_PHY u32FrameBufAddr, MS_PHY u32StreamBufAddr, MS_PHY u32StreamBufEndAddr ); 639 // MS_BOOL MDrv_MVD_GetValidStreamFlag( void ); 640 // MS_U32 MDrv_MVD_GetChromaFormat(void); 641 //for MM 642 // void MDrv_MVD_SetFrameInfo(MVD_FrameInfo *pinfo ); 643 // void MDrv_MVD_SetSLQStartEnd( MS_U32 u32start, MS_U32 u32end); 644 // void MDrv_MVD_GetErrInfo(MVD_ErrCode *errCode, MVD_ErrStatus *errStatus); 645 // MS_U32 MDrv_MVD_GetSkipPicCounter( void ); 646 647 // MS_U8 MDrv_MVD_GetSLQAvailableLevel(void); 648 // void MDrv_MVD_SetSLQWritePtr(MS_BOOL bCheckData); 649 // MS_VIRT MDrv_MVD_GetSLQReadPtr( void ); 650 // void MDrv_MVD_SetSLQTblBufStartEnd( MS_U32 u32start, MS_U32 u32end ); 651 652 // MVD_PicType MDrv_MVD_GetPicType( void ); 653 // MS_U32 MDrv_MVD_GetBitsRate( void ); 654 // MS_U8 MDrv_MVD_GetVideoRange(void); 655 // MS_BOOL MDrv_MVD_GetLowDelayFlag( void ); 656 // MS_BOOL MDrv_MVD_GetIs32PullDown(void); 657 // MS_BOOL MDrv_MVD_GetIsDynScalingEnabled(void); 658 // MS_S32 MDrv_MVD_GetPtsStcDiff(void); 659 660 // void MDrv_MVD_Pause(void); 661 // void MDrv_MVD_Resume(void); 662 // MS_BOOL MDrv_MVD_StepDisp(void); 663 // MS_BOOL MDrv_MVD_IsStepDispDone(void); 664 // MS_BOOL MDrv_MVD_StepDecode(void); 665 // MS_BOOL MDrv_MVD_IsStepDecodeDone(void); 666 // MS_BOOL MDrv_MVD_SeekToPTS(MS_U32 u32Pts); 667 // MS_BOOL MDrv_MVD_IsStep2PtsDone(void); 668 // MS_BOOL MDrv_MVD_SkipToPTS(MS_U32 u32Pts); 669 // MS_BOOL MDrv_MVD_TrickPlay(MVD_TrickDec trickDec, MS_U8 u8DispDuration); 670 // void MDrv_MVD_EnableForcePlay(void); 671 672 // void MDrv_MVD_RegSetBase(MS_U32 u32RegBaseAddr); 673 // MS_BOOL MDrv_MVD_Init(void); 674 // MS_BOOL MDrv_MVD_Exit(void); 675 // E_MVD_Result MDrv_MVD_Rst( void ); 676 677 // void MDrv_MVD_Play( void ); 678 // void MDrv_MVD_SetAVSync(MS_BOOL bEnable, MS_U32 u32Delay); 679 // void MDrv_MVD_SetAVSyncThreshold(MS_U32 u32Th); 680 // void MDrv_MVD_SetAVSyncFreerunThreshold(MS_U32 u32Th); 681 // MS_U32 MDrv_MVD_GetAVSyncDelay(void); 682 // MS_BOOL MDrv_MVD_GetIsAVSyncOn(void); 683 // MS_BOOL MDrv_MVD_GetIsSyncRep(void); 684 // MS_BOOL MDrv_MVD_GetIsSyncSkip(void); 685 // MS_BOOL MDrv_MVD_ChangeAVsync(MS_BOOL bEnable, MS_U16 u16PTS); 686 // MS_BOOL MDrv_MVD_DispCtrl(MS_BOOL bDecOrder, MS_BOOL bDropErr, MS_BOOL bDropDisp, MVD_FrcMode eFrcMode); 687 // MS_BOOL MDrv_MVD_DispRepeatField(MS_BOOL bEnable); 688 // MS_BOOL MDrv_MVD_GetTop1stField(void); 689 // MS_BOOL MDrv_MVD_GetRepeat1stField(void); 690 // MS_BOOL MDrv_MVD_GetTmpRefField(void); 691 // MS_U8 MDrv_MVD_GetColorFormat(void); 692 // MS_U8 MDrv_MVD_GetMatrixCoef(void); 693 // MS_U8 MDrv_MVD_GetActiveFormat( void ); 694 // MS_U8 MDrv_MVD_GetDispRdy( void ); 695 // MS_BOOL MDrv_MVD_Is1stFrmRdy(void); 696 // MS_U32 MDrv_MVD_GetGOPCount( void ); 697 // MS_U32 MDrv_MVD_GetPicCounter(void); 698 // MS_U32 MDrv_MVD_GetParserByteCnt(void); 699 // MVD_DecStat MDrv_MVD_GetDecodeStatus(void); 700 // MS_U8 MDrv_MVD_GetLastCmd(void); 701 // MS_U32 MDrv_MVD_GetVldErrCount( void ); 702 // MS_BOOL MDrv_MVD_DropErrorFrame(MS_BOOL bDrop); 703 // MS_BOOL MDrv_MVD_MVDCommand ( MS_U8 u8cmd, MVD_CmdArg *pstCmdArg ); 704 // MS_BOOL MDrv_MVD_SkipData(void); 705 // MS_BOOL MDrv_MVD_SkipToIFrame(void); 706 // MS_BOOL MDrv_MVD_GetCaps(MVD_Caps* pCaps); 707 708 // E_MVD_Result MDrv_MVD_DisableErrConceal(MS_BOOL bDisable); 709 // E_MVD_Result MDrv_MVD_PushQueue(MVD_PacketInfo* pInfo); 710 // E_MVD_Result MDrv_MVD_FlushQueue(void); 711 // MS_BOOL MDrv_MVD_FlushDisplayBuf(void); 712 // MS_U32 MDrv_MVD_GetQueueVacancy(MS_BOOL bCached); 713 // MS_U32 MDrv_MVD_GetESReadPtr(void); 714 // MS_VIRT MDrv_MVD_GetESWritePtr(void); 715 // E_MVD_Result MDrv_MVD_EnableLastFrameShow(MS_BOOL bEnable); 716 // E_MVD_Result MDrv_MVD_IsDispFinish(void); 717 // E_MVD_Result MDrv_MVD_SetSpeed(MVD_SpeedType eSpeedType, MS_U8 u8Multiple); 718 // E_MVD_Result MDrv_MVD_ResetPTS(MS_U32 u32PtsBase); 719 // MS_U32 MDrv_MVD_GetPTS(void); 720 // MS_U32 MDrv_MVD_GetNextPTS(void); 721 // MVD_TrickDec MDrv_MVD_GetTrickMode(void); 722 // MS_BOOL MDrv_MVD_IsPlaying(void); 723 // MS_BOOL MDrv_MVD_IsIdle(void); 724 // MS_BOOL MDrv_MVD_IsSeqChg(void); 725 // E_MVD_Result MDrv_MVD_DbgSetData(MS_U32 u32Addr, MS_U32 u32Data); 726 // E_MVD_Result MDrv_MVD_DbgGetData(MS_U32 u32Addr, MS_U32* u32Data); 727 // MS_U8 MDrv_MVD_GetDecodedFrameIdx ( void ); 728 // MS_BOOL MDrv_MVD_SetFileModeAVSync(MVD_TIMESTAMP_TYPE eSyncMode); 729 // MS_BOOL MDrv_MVD_IsAllBufferEmpty(void); 730 // MS_BOOL MDrv_MVD_GenPattern(MVD_PatternType ePattern, MS_PHY u32PAddr, MS_U32* pu32Size); 731 // MS_U32 MDrv_MVD_GetPatternInfo(void); 732 // E_MVD_Result MDrv_MVD_SetDynScalingParam(MS_PHY u32StAddr, MS_SIZE u32Size); 733 // MS_BOOL MDrv_MVD_SetDynamicScaleAddr(MS_U32 u32addr); 734 // MS_BOOL MDrv_MVD_SetVirtualBox(MS_U16 u16Width, MS_U16 u16Height); 735 // MS_BOOL MDrv_MVD_SetBlueScreen(MS_BOOL bEn); 736 // MS_BOOL MDrv_MVD_EnableInt(MS_U32 bEn); 737 // E_MVD_Result MDrv_MVD_EnableDispOneField(MS_BOOL bEn); 738 // E_MVD_Result MDrv_MVD_GetExtDispInfo(MVD_ExtDispInfo* pInfo); 739 // E_MVD_Result MDrv_MVD_GetFrmInfo(MVD_FrmInfoType eType, MVD_FrmInfo* pInfo); 740 // E_MVD_Result MDrv_MVD_GetTimeCode(MVD_FrmInfoType eType, MVD_TimeCode* pInfo); 741 // MS_BOOL MDrv_MVD_GetUsrDataIsAvailable(void); 742 // MS_BOOL MDrv_MVD_GetUsrDataInfo(MVD_UsrDataInfo* pUsrInfo); 743 // E_MVD_Result MDrv_MVD_SetFreezeDisp(MS_BOOL bEn); 744 // MS_U32 MDrv_MVD_GetDispCount(void); 745 // E_MVD_Result MDrv_MVD_SetFdMaskDelayCount(MS_U16 u16Cnt); 746 // E_MVD_Result MDrv_MVD_SetOutputFRCMode(MS_U8 u8FrameRate, MS_U8 u8Interlace); 747 // E_MVD_Result MDrv_MVD_SetFRCDropType(MS_U8 u8DropType); 748 // E_MVD_Result MDrv_MVD_SetDisableSeqChange(MS_BOOL bEnable); 749 750 // MS_BOOL MDrv_MVD_SetMStreamerMode(MS_U8 u8Mode); 751 // MS_BOOL MDrv_MVD_FrameFlip(MS_U8 u8FrmIdx); 752 // MS_BOOL MDrv_MVD_FrameRelease(MS_U8 u8FrmIdx); 753 // MS_BOOL MDrv_MVD_FrameCapture(MS_U8 u8FrmIdx, MS_BOOL bEnable); 754 755 // E_MVD_Result MDrv_MVD_PVRFlushDispQueue(MS_BOOL bEnable); 756 //ATSC Closed Caption control 757 // E_MVD_Result MDrv_MVD_CCRst(MVD_CCCfg* pCCParam); 758 // E_MVD_Result MDrv_MVD_CCStartParsing(MVD_CCCfg* pCCParam); 759 // E_MVD_Result MDrv_MVD_CCStopParsing(MVD_CCFormat eCCFormat); 760 // E_MVD_Result MDrv_MVD_CCGetWritePtr(MVD_CCFormat eCCFormat, MS_U32* pWrite); 761 // E_MVD_Result MDrv_MVD_CCGetReadPtr(MVD_CCFormat eCCFormat, MS_U32* pRead); 762 // E_MVD_Result MDrv_MVD_CCUpdateReadPtr(MVD_CCFormat eCCFormat, MS_U32 u32EachPacketSize); 763 // E_MVD_Result MDrv_MVD_CCGetIsOverflow(MVD_CCFormat eCCFormat, MS_BOOL* pbOverflow); 764 // MS_BOOL MDrv_MVD_SetSkipRepeatMode(MS_U8 u8Mode); 765 // MS_BOOL MDrv_MVD_FlushPTSBuf(void); 766 // MS_BOOL MDrv_MVD_ParserRstDone(MS_BOOL bEnable); 767 // void MDrv_MVD_DbgDump(void); 768 // MS_BOOL MDrv_MVD_IsCmdFinished(MVD_HANDSHAKE_CMD eCmd); 769 // MS_BOOL MDrv_MVD_GetFrmRateIsSupported(void); 770 // E_MVD_Result MDrv_MVD_SetAutoMute(MS_BOOL bEnable); 771 // E_MVD_Result MDrv_MVD_SetVSizeAlign(MS_BOOL bEnable); 772 // E_MVD_Result MDrv_MVD_SetDispFinishMode(MS_U8 u8Mode); 773 // E_MVD_Result MDrv_MVD_SetAVSyncMode(MS_U8 u8Mode); 774 // E_MVD_Result MDrv_MVD_SetIdctMode(MS_U8 u8Mode); 775 // MS_U32 MDrv_MVD_GetDivxVer(void); 776 777 #ifndef REDLION_LINUX_KERNEL_ENVI 778 #define MVD_ENABLE_ISR 779 #endif 780 781 #ifdef MVD_ENABLE_ISR 782 // E_MVD_Result MDrv_MVD_SetIsrEvent(MS_U32 eEvent, MVD_InterruptCb fnHandler); 783 // MS_U32 MDrv_MVD_GetIsrEvent(void); 784 #else 785 #define MDrv_MVD_SetIsrEvent(x, y) (E_MVD_RET_OK) 786 #define MDrv_MVD_GetIsrEvent() (MS_U32)0 787 #endif 788 789 // E_MVD_Result MDrv_MVD_SetMVDClockSpeed(MVD_ClockSpeed eClockSpeed); 790 791 // E_MVD_Result MDrv_MVD_ShowFirstFrameDirect(MS_BOOL bEnable); 792 793 #ifdef __cplusplus 794 } 795 #endif 796 797 #endif 798