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 #ifndef __M4VD_MSG_QUE_H__ 79 #define __M4VD_MSG_QUE_H__ 80 81 82 #define OFFSET_BASE 0x00020000 83 #define FW_VOL_INFO_START (0x00020000+OFFSET_BASE) 84 #define FW_FRAME_INFO_START (0x00020100+OFFSET_BASE) 85 #define FW_DIVX_INFO_START (0x00020200+OFFSET_BASE) 86 #define RCV_SEQ_START (0x00020400+OFFSET_BASE) 87 #define DEBUG_BUF_START (0x00020500+OFFSET_BASE) 88 #define DEC_FRMAE_INFO_START (0x00020600+OFFSET_BASE) 89 #define SW_BITPLANE_BASE (0x00020700+OFFSET_BASE) 90 91 // VC1_SEQ_INFO put on 65K 92 #define FW_VERSION 0x07244998 93 #define INTERFACE_VERSION 0x00000020 //ver.20 add decode_I ISR. 94 #define EN_SECTION_START 0x20000000 95 96 typedef struct _FW_VOL_INFO 97 { 98 //VOL infomation 99 unsigned short vol_info; //reg0x40 100 // D[5] short_video_header; //1 101 // D[4] vol_interlaced; 102 // D[3] vol_qpel; 103 // D[2] vol_rsync_marker_disable; 104 // D[1] vol_dp_enable; 105 // D[0] vol_rvlc_enable; 106 107 unsigned short sprite_usage; 108 109 unsigned int width; 110 unsigned int height; 111 112 unsigned short pts_incr; 113 unsigned short reserved0; 114 115 unsigned char aspect_ratio; 116 unsigned char progressive_sequence; 117 unsigned char mpeg1; 118 unsigned char play_mode; 119 120 unsigned char mpeg_frc_mode; 121 unsigned char first_display; 122 unsigned char low_delay; 123 unsigned char video_range; 124 125 unsigned int bit_rate; 126 127 unsigned short vol_time_incr_res; 128 unsigned short fixed_vop_time_incr; //0: not fixed_vop_rate others : vop_time_incr 129 130 unsigned char par_width; 131 unsigned char par_height; 132 unsigned char reserved1; 133 unsigned char reserved2; 134 135 unsigned int vc1_frame_rate; 136 unsigned int frame_rate; 137 unsigned char key_gen[32]; 138 unsigned char ds_enable; 139 unsigned char reserved3; 140 unsigned short CropBottom; 141 unsigned int DSbufsize; 142 }FW_VOL_INFO,*pFW_VOL_INFO;//16 byte 143 144 #define OFFSET_VOL_INFO 0 145 #define OFFSET_SPRITE_USAGE 2 146 #define OFFSET_WIDTH 4 147 #define OFFSET_HEIGHT 8 148 #define OFFSET_PTS_INCR 12 149 #define OFFSET_RESERVED0 14 150 #define OFFSET_ASPECT_RATIO 16 151 #define OFFSET_PROGRESSIVE_SEQUENCE 17 152 #define OFFSET_MPEG1 18 153 #define OFFSET_PLAY_MODE 19 154 #define OFFSET_MPEG_FRC_MODE 20 155 #define OFFSET_FIRST_DISPLAY 21 156 #define OFFSET_LOW_DELAY 22 157 #define OFFSET_VIDEO_RANGE 23 158 #define OFFSET_BIT_RATE 24 159 #define OFFSET_VOL_TIME_INCR_RES 28 160 #define OFFSET_FIXED_VOP_TIME_INCR 30 161 #define OFFSET_PAR_WIDTH 32 162 #define OFFSET_PAR_HEIGHT 33 163 #define OFFSET_VC1_FRAME_RATE 36 164 #define OFFSET_FRAME_RATE 40 165 #define OFFSET_KEY_GEN 44 166 #define OFFSET_DS_ENABLE 76 167 #define OFFSET_CROPBOTTOM 78 168 #define OFFSET_DSBUFSIZE 80 169 170 typedef struct 171 { 172 union 173 { 174 struct 175 { 176 unsigned int mvdcmd_handshake_pause : 1; // 1 for handshake ready with CMD_PAUSE, 177 unsigned int mvdcmd_handshake_slq_reset : 1; // 1 for handshake ready with CMD_VC1_HW_SLQ_RESET 178 unsigned int mvdcmd_handshake_stop : 1; // 1 for handshake ready with CMD_STOP 179 unsigned int mvdcmd_handshake_skip_data : 1; // 1 for handshake ready with CMD_SKIP_DATA 180 unsigned int mvdcmd_handshake_skip_to_pts : 1; // 1 for handshake ready with CMD_SKIP_TO_PTS 181 unsigned int mvdcmd_handshake_single_step : 1; // 1 for handshake ready with CMD_SINGLE_STEP 182 unsigned int mvdcmd_handshake_scaler_data_ready : 1; 183 unsigned int mvdcmd_handshake_get_nextdispfrm_ready : 1; // for Mstreamer mode 184 unsigned int mvdcmd_handshake_parser_rst : 1; // 1 for handshake done with CMD_PTS_TBL_RESET 185 unsigned int mvdcmd_handshake_cc608_rst : 1; // "0" for handshake done with mstar cc608 186 unsigned int mvdcmd_handshake_cc708_rst : 1; // "0" for handshake done with mstar cc708 187 unsigned int mvdcmd_handshake_fast_rst : 1; // 1 for handshake done with CMD_FAST_RST, 1 for fast_rst_done... 188 unsigned int mvdcmd_handshake_reserved : 20; // reserved for extend 189 }; 190 unsigned int value; 191 }; 192 }MVD_CMD_HANDSHADE_INDEX; 193 194 typedef struct 195 { 196 union 197 { 198 struct 199 { 200 unsigned int mvd_xc_disable_black_screen : 1; // 1 for XC disable the black screen, defaule is "0"... 201 unsigned int mvd_xc_release_force_rbank : 1; // 1 for XC release force read bank, defaule is "0"... 202 unsigned int mvd_xc_release_bob_mode : 1; // 1 for XC release BOB mode, defaule is "0"... 203 unsigned int mvd_xc_release_UCNR : 1; // 1 for XC release UCNR, defaule is "0"... 204 unsigned int mvd_xc_reserved : 28; // reserved for extend 205 }; 206 unsigned int value; 207 }; 208 }MVD_XC_LOW_DELAY_INT_STATE; 209 210 typedef struct _FW_FRAME_INFO 211 { 212 unsigned int frame_count; //1 213 unsigned int slq_tbl_rptr; //==>ms 214 unsigned int vol_update; 215 216 unsigned int error_code; //4 217 unsigned int error_status; //20 218 219 unsigned int skip_frame_count; 220 221 unsigned int picture_type; //0:I frame 1:P frame 2:B frame 222 unsigned int slq_sw_index; //32 223 224 unsigned char fb_index; 225 unsigned char top_ff; 226 unsigned char repeat_ff; 227 unsigned char invalidstream;//36 228 229 unsigned int vld_err_count; 230 unsigned short tmp_ref; 231 unsigned char first_frame; 232 unsigned char first_I_found;//44 233 234 unsigned int gop_i_fcnt; //12 235 unsigned int gop_p_fcnt; 236 unsigned int gop_b_fcnt; 237 unsigned int overflow_count;//60 238 239 unsigned int time_incr; //16 240 unsigned int self_rst_count; 241 unsigned int sw_vd_count;//72 242 unsigned int step_disp_done; 243 unsigned int step_to_pts_done; //20 244 MVD_CMD_HANDSHADE_INDEX cmd_handshake_index; 245 unsigned int last_frame_show_done; 246 unsigned int meet_file_end_sc; 247 unsigned int rcv_payload_lenth; 248 unsigned int firmware_version; 249 unsigned int ic_version; 250 unsigned int interface_version; 251 252 unsigned char color_primaries; 253 unsigned char transfer_char; 254 unsigned char matrix_coef; 255 unsigned char video_format; 256 257 unsigned short disp_h_size; 258 unsigned short disp_v_size; 259 260 unsigned char time_code_hours; 261 unsigned char time_code_minutes; 262 unsigned char time_code_seconds; 263 unsigned char time_code_pictures; 264 265 unsigned char drop_frame_flag; 266 unsigned char time_code_hours_disp; 267 unsigned char time_code_minutes_disp; 268 unsigned char time_code_seconds_disp; 269 270 unsigned char time_code_pictures_disp; 271 unsigned char drop_frame_flag_disp; 272 unsigned char PicStruct; 273 unsigned char chroma_format; 274 275 int pts_stc; 276 unsigned int displayed_cnt; 277 unsigned int next_pts; 278 279 unsigned short centre_h_offset; 280 unsigned short centre_v_offset; 281 282 unsigned int disp_pts; // current displayed frame pts 283 unsigned int divx_ver_5x; // report divx version... 284 unsigned int frame_buf_size; // report real frame buffer size(unit in bytes)... 285 MVD_XC_LOW_DELAY_INT_STATE xc_low_delay_int_state; // for xc low delay interrupt status... 286 unsigned int xc_low_delay_cnt; // 287 unsigned int xc_diff_field_no; // for get XC diff field number... 288 unsigned int xc_low_delay_cnt_latched; // for dbg xc_low_delay timing only... 289 }FW_FRAME_INFO, *pFW_FRAME_INFO; 290 291 #define OFFSET_FRAME_COUNT 0 292 #define OFFSET_SLQ_TBL_RPTR 4 293 #define OFFSET_VOL_UPDATE 8 294 #define OFFSET_ERROR_CODE 12 295 #define OFFSET_ERROR_STATUS 16 296 #define OFFSET_SKIP_FRAME_COUNT 20 297 #define OFFSET_PICTURE_TYPE 24 298 #define OFFSET_SLQ_SW_INDEX 28 299 #define OFFSET_FB_INDEX 32 300 #define OFFSET_TOP_FF 33 301 #define OFFSET_REPEAT_FF 34 302 #define OFFSET_INVALIDSTREAM 35 303 #define OFFSET_VLD_ERR_COUNT 36 304 #define OFFSET_TMP_REF 40 305 #define OFFSET_FIRST_FRAME 42 306 #define OFFSET_FIRST_I_FOUND 43 307 #define OFFSET_GOP_I_FCNT 44 308 #define OFFSET_GOP_P_FCNT 48 309 #define OFFSET_GOP_B_FCNT 52 310 #define OFFSET_OVERFLOW_COUNT 56 311 #define OFFSET_TIME_INCR 60 312 #define OFFSET_SELF_RST_COUNT 64 313 #define OFFSET_SW_VD_COUNT 68 314 #define OFFSET_STEP_DISP_DONE 72 315 #define OFFSET_STEP_TO_PTS_DONE 76 316 #define OFFSET_CMD_HANDSHAKE_INDEX 80 317 #define OFFSET_CMD_LAST_FRAME_SHOW 84 318 #define OFFSET_MEET_FILE_END_SC 88 319 #define OFFSET_RCV_PAYLOAD_LENGTH 92 320 #define OFFSET_FIRMWARE_VERSION 96 321 #define OFFSET_IC_VERSION 100 322 #define OFFSET_INTERFACE_VERSION 104 323 #define OFFSET_COLOR_PRIMARIES 108 324 #define OFFSET_TRANSFER_CHAR 109 325 #define OFFSET_MATRIX_COEF 110 326 #define OFFSET_VIDEO_FORMAT 111 327 #define OFFSET_DISP_H_SIZE 112 328 #define OFFSET_DISP_V_SIZE 114 329 #define OFFSET_TIME_CODE_HOURS 116 // for decoding frame 330 #define OFFSET_TIME_CODE_MINUTES 117 // for decoding frame 331 #define OFFSET_TIME_CODE_SECONDS 118 // for decoding frame 332 #define OFFSET_TIME_CODE_PICTURES 119 // for decoding frame 333 #define OFFSET_DROP_FRAME_FLAG 120 // for decoding frame 334 #define OFFSET_TIME_CODE_HOURS_DISP 121 // for displaying frame 335 #define OFFSET_TIME_CODE_MINUTES_DISP 122 // for displaying frame 336 #define OFFSET_TIME_CODE_SECONDS_DISP 123 // for displaying frame 337 #define OFFSET_TIME_CODE_PICTURES_DISP 124 // for displaying frame 338 #define OFFSET_DROP_FRAME_FLAG_DISP 125 // for displaying frame 339 #define OFFSET_PICTURE_STRUCTURE 126 340 #define OFFSET_CHROMA_FORMAT 127 341 #define OFFSET_PTS_STC 128 // integer, pts_stc(n)=pts(n)-stc(n) 342 #define OFFSET_DISPLAYED_CNT 132 343 #define OFFSET_NEXT_PTS 136 344 #define OFFSET_CENTRE_H_OFFSET 140 345 #define OFFSET_CENTRE_V_OFFSET 142 346 #define OFFSET_DISP_PTS 144 347 #define OFFSET_DIVX_VER_5X 148 348 #define OFFSET_FRAME_BUF_SIZE 152 // report real frame buffer size(unit in bytes)... 349 #define OFFSET_XC_LOW_DELAY_INT_STATE 156 // for xc low delay interrupt status... 350 #define OFFSET_XC_LOW_DELAY_CNT 160 // for xc low delay interrupt status... 351 #define OFFSET_XC_DIFF_FIELD_NO 164 // for get XC diff field number... 352 #define OFFSET_XC_LOW_DELAY_CNT_LATCH 168 // for dbg xc_low_delay timing only... 353 354 typedef struct _FW_DIVX_INFO 355 { 356 unsigned int vol_handle_done; 357 358 unsigned int width; 359 unsigned int height; 360 unsigned int frame_count;//4 361 unsigned int frame_time; 362 363 unsigned short pts_incr; 364 unsigned short reserve0; 365 366 unsigned char aspect_ratio; 367 unsigned char progressive_sequence; 368 unsigned char mpeg1; 369 unsigned char play_mode; 370 371 unsigned char mpeg_frc_mode;//8 372 unsigned char invalidstream; 373 unsigned char reserve[2]; 374 unsigned int frame_rate; 375 }FW_DIVX_INFO, *pFW_DIVX_INFO; 376 377 #define OFFSET_DIVX_VOL_HANDLE_DONE 0 378 #define OFFSET_DIVX_WIDTH 4 379 #define OFFSET_DIVX_HEIGHT 8 380 #define OFFSET_DIVX_FRAME_COUNT 12 381 #define OFFSET_DIVX_FRAME_TIME 16 382 #define OFFSET_DIVX_PTS_INCR 20 383 #define OFFSET_DIVX_RESERVE0 22 384 #define OFFSET_DIVX_ASPECT_RATIO 24 385 #define OFFSET_DIVX_PROGRESSIVE_SEQUENCE 25 386 #define OFFSET_DIVX_MPEG1 26 387 #define OFFSET_DIVX_PLAY_MODE 27 388 #define OFFSET_DIVX_MPEG_FRC_MODE 28 389 #define OFFSET_DIVX_INVALIDSTREAM 29 390 #define OFFSET_DIVX_RESERVED 30 391 #define OFFSET_DIVX_FRAME_RATE 32 392 393 #define STATUS_VIDEO_SYNC (1<<0) 394 #define STATUS_VIDEO_FREERUN (1<<1) 395 #define STATUS_VIDEO_SKIP (1<<2) 396 #define STATUS_VIDEO_REPEAT (1<<3) 397 398 typedef struct _FW_USER_DATA_BUF 399 { 400 unsigned char picType; /* picture type: 1->I picture, 2->P,3->B */ 401 unsigned char top_ff; /* Top field first: 1 if top field first*/ 402 unsigned char rpt_ff; /* Repeat first field: 1 if repeat field first*/ 403 unsigned char userdatabytecnt; 404 405 unsigned short tmpRef; /* Temporal reference of the picture*/ 406 407 unsigned char userdata[250]; 408 }FW_USER_DATA_BUF,*pFW_USER_DATA_BUF; 409 410 #define FW_USER_DATA_BUF_EXT_PACK_LEN 240 411 typedef struct _FW_USER_DATA_BUF_EXT 412 { 413 unsigned char picType; /* picture type: 1->I picture, 2->P,3->B */ 414 unsigned char top_ff; /* Top field first: 1 if top field first*/ 415 unsigned char rpt_ff; /* Repeat first field: 1 if repeat field first*/ 416 unsigned char userdatabytecnt; 417 418 unsigned short tmpRef; /* Temporal reference of the picture*/ 419 unsigned char PicStruct; /* picture struct with this cc pack*/ 420 unsigned char reserved; 421 422 unsigned int pts; /* pts with this cc pack*/ 423 unsigned int reserved2; 424 425 unsigned char userdata[FW_USER_DATA_BUF_EXT_PACK_LEN]; 426 }FW_USER_DATA_BUF_EXT,*pFW_USER_DATA_BUF_EXT; 427 428 typedef struct _DecFrameInfo 429 { 430 unsigned int u32DecLumaAddr; 431 unsigned int u32DecChromaAddr; 432 unsigned int u32DecTimeStamp; 433 unsigned int u32DecID_L; 434 unsigned int u32DecID_H; 435 unsigned short u16DecPitch; 436 unsigned short u16DecWidth; 437 unsigned short u16DecHeight; 438 unsigned short u16DeceFrameType; 439 unsigned int u32DispLumaAddr; 440 unsigned int u32DispChromaAddr; 441 unsigned int u32DispTimeStamp; 442 unsigned int u32DispID_L; 443 unsigned int u32DispID_H; 444 unsigned short u16DispPitch; 445 unsigned short u16DispWidth; 446 unsigned short u16DispHeight; 447 unsigned short u16DispeFrameType; 448 // for Mstreamer mode 449 unsigned int u32NextDispLumaAddr; 450 unsigned int u32NextDispChromaAddr; 451 unsigned int u32NextDispTimeStamp; 452 unsigned int u32NextDispID_L; 453 unsigned int u32NextDispID_H; 454 unsigned short u16NextDispPitch; 455 unsigned short u16NextDispWidth; 456 unsigned short u16NextDispHeight; 457 unsigned short u16NextDispeFrameType; 458 unsigned short u16NextDispFrameIdx; 459 unsigned short u16reserve; 460 }DecFrameInfo, *pDecFrameInfo; 461 462 #define OFFSET_DECFRAMEINFO_DEC_LUMAADDR 0 463 #define OFFSET_DECFRAMEINFO_DEC_CHROMAADDR 4 464 #define OFFSET_DECFRAMEINFO_DEC_TIMESTAMP 8 465 #define OFFSET_DECFRAMEINFO_DEC_ID_L 12 466 #define OFFSET_DECFRAMEINFO_DEC_ID_H 16 467 #define OFFSET_DECFRAMEINFO_DEC_PITCH 20 468 #define OFFSET_DECFRAMEINFO_DEC_WIDTH 22 469 #define OFFSET_DECFRAMEINFO_DEC_HEIGHT 24 470 #define OFFSET_DECFRAMEINFO_DEC_FRAMETYPE 26 471 #define OFFSET_DECFRAMEINFO_DISP_LUMAADDR 28 472 #define OFFSET_DECFRAMEINFO_DISP_CHROMAADDR 32 473 #define OFFSET_DECFRAMEINFO_DISP_TIMESTAMP 36 474 #define OFFSET_DECFRAMEINFO_DISP_ID_L 40 475 #define OFFSET_DECFRAMEINFO_DISP_ID_H 44 476 #define OFFSET_DECFRAMEINFO_DISP_PITCH 48 477 #define OFFSET_DECFRAMEINFO_DISP_WIDTH 50 478 #define OFFSET_DECFRAMEINFO_DISP_HEIGHT 52 479 #define OFFSET_DECFRAMEINFO_DISP_FRAMETYPE 54 480 #define OFFSET_DECFRAMEINFO_NEXTDISP_LUMAADDR 56 // for Mstreamer mode 481 #define OFFSET_DECFRAMEINFO_NEXTDISP_CHROMAADDR 60 482 #define OFFSET_DECFRAMEINFO_NEXTDISP_TIMESTAMP 64 483 #define OFFSET_DECFRAMEINFO_NEXTDISP_ID_L 68 484 #define OFFSET_DECFRAMEINFO_NEXTDISP_ID_H 72 485 #define OFFSET_DECFRAMEINFO_NEXTDISP_PITCH 76 486 #define OFFSET_DECFRAMEINFO_NEXTDISP_WIDTH 78 487 #define OFFSET_DECFRAMEINFO_NEXTDISP_HEIGHT 80 488 #define OFFSET_DECFRAMEINFO_NEXTDISP_FRAMETYPE 82 489 #define OFFSET_DECFRAMEINFO_NEXTDISP_FRAMEIDX 84 // for Mstreamer mode 490 #define OFFSET_DECFRAMEINFO_RESERVED 86 491 492 typedef struct _DEBUG_INFO 493 { 494 // 495 volatile unsigned short max_coded_width; 496 volatile unsigned short max_coded_height; 497 volatile unsigned short sync_status; // defined by AV_SYNC 498 499 volatile unsigned short REG67; 500 volatile unsigned short REG68; 501 volatile unsigned short REG69; 502 503 volatile unsigned short REG6a; 504 volatile unsigned short REG6b; 505 volatile unsigned short REG6c; 506 507 volatile unsigned short REG6d; 508 volatile unsigned short REG6e; 509 volatile unsigned short REG6f; 510 511 // 512 volatile unsigned short overflow_count; 513 volatile unsigned short underflow_count; 514 volatile unsigned short vlderr_count; 515 volatile unsigned short frame_conut;//0 516 517 volatile unsigned int y_start_addr; //in byte unit 518 volatile unsigned int uv_start_addr;//in byte unit 519 520 volatile unsigned int width; 521 volatile unsigned int height; 522 523 // where 524 volatile unsigned short mb_x; 525 volatile unsigned short mb_y; 526 527 volatile unsigned short file_end; 528 //16-byte aligned 529 volatile unsigned char reserved[24]; 530 531 }DebugInfo; 532 533 typedef struct VC1_SEQ_INFO 534 { 535 volatile unsigned int PROFILE; 536 volatile unsigned int FRMRTQ_POSTPROC; 537 volatile unsigned int BITRTQ_POSTPROC; 538 volatile unsigned int LOOPFILTER; 539 volatile unsigned int MULTIRES; 540 volatile unsigned int FASTUVMC; 541 volatile unsigned int EXTENDED_MV; 542 volatile unsigned int DQUANT; 543 volatile unsigned int VSTRANSFORM; 544 volatile unsigned int OVERLAP; 545 volatile unsigned int SYNCMARKER; 546 volatile unsigned int RANGERED; 547 volatile unsigned int MAXBFRAMES; 548 volatile unsigned int QUANTIZER; 549 volatile unsigned int FINTERPFLAG; 550 volatile unsigned int LEVEL; 551 volatile unsigned int CBR; 552 volatile unsigned int FRAMERATE; 553 volatile unsigned int VERT_SIZE; 554 volatile unsigned int HORIZ_SIZE; 555 }VC1_SEQUENCE_INFO, *pVC1_SEQUENCE_INFO; 556 557 #define OFFSET_RCV_PROFILE 0 558 #define OFFSET_RCV_FRMRTQ_POSTPROC 4 559 #define OFFSET_RCV_BITRTQ_POSTPROC 8 560 #define OFFSET_RCV_LOOPFILTER 12 561 #define OFFSET_RCV_MULTIRES 16 562 #define OFFSET_RCV_FASTUVMC 20 563 #define OFFSET_RCV_EXTENDED_MV 24 564 #define OFFSET_RCV_DQUANT 28 565 #define OFFSET_RCV_VSTRANSFORM 32 566 #define OFFSET_RCV_OVERLAP 36 567 #define OFFSET_RCV_SYNCMARKER 40 568 #define OFFSET_RCV_RANGERED 44 569 #define OFFSET_RCV_MAXBFRAMES 48 570 #define OFFSET_RCV_QUANTIZER 52 571 #define OFFSET_RCV_FINTERPFLAG 56 572 #define OFFSET_RCV_LEVEL 60 573 #define OFFSET_RCV_CBR 64 574 #define OFFSET_RCV_FRAMERATE 68 575 #define OFFSET_RCV_VERT_SIZE 72 576 #define OFFSET_RCV_HORIZ_SIZE 76 577 578 typedef struct _FW_AVSYNC_TABLE 579 { 580 unsigned int byte_cnt; //23 valid bits 581 unsigned int dummy_cnt; //dummy packet counter 582 unsigned int id_low; //ID specified by player 583 unsigned int id_high; 584 585 unsigned int time_stamp; //pts or dts 586 unsigned int reserved_int0; 587 unsigned int reserved_int1; 588 unsigned int reserved_int2; 589 }FW_AVSYNC_TABLE, *pFW_AVSYNC_TABLE; 590 591 #define OFFSET_BYTE_CNT 0 592 #define OFFSET_DUMMY_CNT 4 593 #define OFFSET_ID_LOW 8 594 #define OFFSET_ID_HIGH 12 595 #define OFFSET_TIME_STAMP 16 596 597 #ifdef M4VDPLAYER 598 extern pFW_VOL_INFO gp_vol_info; 599 extern pFW_DIVX_INFO gp_divx_info; 600 #endif 601 602 //interupt flag 603 #define INT_CC_NEW (1<<0) 604 #define INT_USER_DATA (1<<0) 605 #define INT_VBUF_OVF (1<<1) 606 #define INT_VBUF_UNF (1<<2) 607 #define INT_VES_VALID (1<<3) 608 #define INT_VES_INVALID (1<<4) 609 #define INT_SEQ_FOUND (1<<5) 610 #define INT_PIC_FOUND (1<<6) 611 #define INT_DEC_ERR (1<<7) 612 #define INT_FIRST_FRAME (1<<8) 613 #define INT_DISP_RDY (1<<9) 614 #define INT_SYN_SKIP (1<<10) 615 #define INT_SYN_REP (1<<11) 616 #define INT_DISP_VSYNC (1<<12) 617 #define INT_USER_DATA_DISP (1<<13) //user data in display order 618 #define INT_PTS_DISCONTINUE (1<<14) //detection pts discontinue for t3-gp2, 20101214 619 #define INT_DEC_DONE (1<<15) //finishing decoding one frame. 620 #define INT_XC_LOW_DELAY (1<<16) //trigger this interrupt for XC speed up to show image on channel change... 621 #define INT_DEC_I (1<<17) //decoding I frame. 622 623 #define INT_SYN_SKIP_P 10 624 #define INT_SYN_REP_P 11 625 626 // decoding state definition 627 #define DEC_STAT_IDLE 0x00 628 #define DEC_STAT_FIND_SC 0x01 629 #define DEC_STAT_FIND_SPE_SC 0x11 630 #define DEC_STAT_FIND_FRAMEBUFFER 0x02 631 #define DEC_STAT_WAIT_DECODE_DONE 0x03 632 #define DEC_STAT_DECODE_DONE 0x04 633 #define DEC_STAT_WAIT_VDFIFO 0x05 634 #define DEC_STAT_INIT_SUCCESS 0x06 635 636 //error_code 637 #define VOL_SHAPE 1 //error_status 0:rectanglular 1:binary 2: binary only 3: grayscale 638 #define VOL_USED_SPRITE 2 //error_status 0:sprite not used 1:static 2: GMC 3: reserved 639 #define VOL_NOT_8_BIT 3 //error_status : bits per pixel 640 #define VOL_NERPRED_ENABLE 4 641 #define VOL_REDUCED_RES_ENABLE 5 642 #define VOL_SCALABILITY 6 643 #define VOL_OTHER 7 644 #define VOL_H263_ERROR 8 645 #define VOL_RES_NOT_SUPPORT 9 //error_status : none 646 #define VOL_MPEG4_NOT_SUPPORT 10 //error_status : none 647 #define VOL_PROFILE_NOT_SUPPORT 11 648 #define VOL_RCV_ERROR_OCCUR 12 649 #define VOL_VC1_NOT_SUPPORT 13 650 #define VOL_UNKNOW_CODEC_NOT_SUPPORT 14 651 #define VOL_SLQ_TBL_NOT_SUPPORT 15 652 #define VOL_FRAME_BUF_NOT_ENOUGH 16 //error_status : none 653 654 #define CODEC_MPEG4 0x00 //arg0: 0: mpeg4, 1: mpeg4 with short_video_header, 2: DivX311 655 #define CODEC_MPEG4_SHORT_VIDEO_HEADER 0x01 656 #define CODEC_DIVX311 0x02 657 #define CODEC_MPEG2 0x10 658 typedef enum //arg1: 0: file mode 1:slq 2:live stream mode 3:slqtbl 4: Ts file mode 659 { 660 FILE_MODE = 0, 661 SLQ_MODE, 662 STREAM_MODE, 663 SLQ_TBL_MODE, 664 TS_FILE_MODE, 665 OTHER 666 }stream_type; 667 #define ENABLE_PARSER 0x00 //arg2: 0/1 enable/disable parser; 668 #define DISABLE_PARSER 0x01 669 #define ENABLE_PKT_LEN 0x02 670 #define PARSER_MPEG2 0x00 //arg3: 0 13818-1 pes header; 671 #define PARSER_MPEG1 0x01 // 1 11172-1 pes header; 672 673 #define FrcNormal 0 674 #define FrcDisplayTwice 1 //output rate is twice of input rate (ex. 30p a 60p) 675 #define Frc32Pulldown 2 //3:2 pulldown mode (ex. 24p a 60i or 60p) 676 #define FrcPALtoNTSC 3 //PALaNTSC conversion (50i a 60i) 677 #define FrcNTSCtoPAL 4 //NTSCaPAL conversion (60i a 50i) 678 #define FrcShowOneFiled 5 679 #define FrcDisplayDropHalf 6 680 #define FrcDisplay120To50 7 681 #define FrcDisplay100To60 8 682 #define FrcDisplay30To50 9 683 #define FrcDisplayMultipleRepeat 20 //output_rate/input_rate=integer 684 #define FrcDisplayGeneralRepeat 21 //output_rate > input_rate, ex. 15->50... 685 #define FrcDisplayGeneralSkip 22 //output_rate < input_rate, 686 687 #define MVD3_FILE_SD_MODE 0x02 //960*544 688 #define MVD3_HD_MODE 0x10 //1920*1088 689 #define MVD3_SD_MODE 0x00 //720*576 690 #define MVD3_DHD_MODE 0x20 // dual HD 691 692 // File mode avsync related 693 #define NONE_FILE_MODE 0 694 #define FILE_PTS_MODE 1 695 #define FILE_DTS_MODE 2 696 697 // argument for "CMD_DISPLAY_PAUSE" 698 #define DISPLAY_PAUSE_OFF 0x00 699 #define DISPLAY_PAUSE_ON 0x01 700 701 // argument for "CMD_FRC_DROP_BEHAVIOR" 702 #define FRC_DROP_FRAME 0x00 // for default frc drop behavior, drop per frame 703 #define FRC_DROP_FIELD 0x01 // for frc drop behavior, drop per field to improve more smoothly in field mode 704 705 // ARG0 for "CMD_DRAM_OBF" 706 #define OBF_PAS1_WR 0x01 // for Dram obf write index (Parser1 write) 707 #define OBF_VBUF1_RD 0x02 // for Dram obf read index (VBUF1 read) 708 #define OBF_PES_FILE_IN1_WR 0x03 // for Dram obf read index for PESFI1 709 #define OBF_PAS2_WR 0x04 // for Dram obf write index (Parser2 write) 710 #define OBF_VBUF2_RD 0x05 // for Dram obf read index (VBUF2 read) 711 #define OBF_PES_FILE_IN2_WR 0x06 // for Dram obf read index for PESFI2 712 713 //command interface 714 #define CMD_PLAY 0x01 715 #define CMD_PAUSE 0x02 716 #define CMD_STOP 0x03 717 #define CMD_FIND_SEQ 0x04 //find seq header and set command = pause at picture header start code found 718 #define CMD_SINGLE_STEP 0x05 719 #define CMD_PLAY_NO_SQE 0x06 720 #define CMD_FAST_SLOW 0x07 //arg0: 0: nomarl mode, 1: decode I only, 2: deocde I/P only, 3: slow motion 721 #define CMD_CODEC_INFO 0x08 //arg0: 0: mpeg4, 1: mpeg4 with short_video_header, 2: DivX311 722 #define CMD_SYN_THRESHOLD 0x09 723 #define CMD_SYNC_ON 0x0a 724 #define CMD_SYNC_OFFSET 0x0b 725 #define CMD_DISPLAY_CTL 0x0c 726 //arg0: 0/1-display by display/decode order 727 //arg1: 1-drop display decoding error frame 728 //arg2: 1-drop display when decode fast than display 729 //arg3:set frame rate conversion mode 730 #define CMD_GET_SYNC_STAT 0x0d //return arg0: 0/1 sync off/on ; arg1: 3 sync init done 731 #define CMD_GET_AFD 0x0e 732 #define CMD_SKIP_DATA 0x0f //set to skip all data till find FW_SPE_SCODE to resume normal play 733 734 #define CMD_STREAM_BUF_START 0x10 735 #define CMD_STREAM_BUF_END 0x11 736 #define CMD_FB_BASE 0x12 //Frame buffer base address, from LSB to MSB are arg0, arg1, arg2, arg3 737 #define CMD_IAP_BUF_START 0x13 738 #define CMD_DP_BUF_START 0x14 739 #define CMD_MV_BUF_START 0x15 740 #define CMD_DMA_OVFTH 0x16 741 #define CMD_DMA_UNFTH 0x17 742 #define CMD_VC1_MIU_PROTECT_START 0x18 743 #define CMD_VC1_MIU_PROTECT_END 0x19 744 #define CMD_DISP_SPEED_CTRL 0x1a 745 #define CMD_STEP_DISP_DECODE_ONE 0x1b 746 #define CMD_STEP_DISP_ING 0x1c // repeat disp this frame 747 #define CMD_STEP_TO_PTS 0x1d 748 #define CMD_HANDSHAKE_STATUS 0x1e //report handshake status 749 #define CMD_DISPLAY_PAUSE 0x1f // display pause 750 751 #define CMD_USER_BUF_START 0x20 752 #define CMD_USER_BUF_SIZE 0x21 753 #define CMD_RD_USER_WP 0x22 754 #define CMD_WD_USER_RP 0x23 755 #define CMD_RD_CC_PKTCNT 0x24 756 #define CMD_RD_CC_OV 0x25 757 #define CMD_CLOSE_CC 0x26 758 #define CMD_EN_CC_INFO_ENHANCE 0X27 // arg0=1, for enhance to dump the pts/tmp_ref info with each cc-608 packet for mstar cc-lib, 20120406 759 #define CMD_BUF_OFFSET 0x2d // stream/frame buf offset, programable high adderss [bit-25] that allocate to low/high 256MB MIU:(only for K2) 760 #define CMD_ENABLE_VLD_TIMEOUT 0x2e // enable mvd vld timeout and threshold 761 #define CMD_ENABLE_INT_STAT 0x2f // set which int be enabled 762 763 #define CMD_GET_INT_STAT 0x30 764 #define CMD_PARSE_M4V_PACKMD 0x31 765 #define CMD_RD_PTS 0x32 766 #define CMD_FLUSH_LAST_IPFRAME 0x33 767 #define CMD_DECODE_STATUS 0x34 // arg0 = lastcommand ; arg1 = decode_status 768 #define CMD_VBUFFER_COUNT 0x35 769 #define CMD_START_DEC_STRICT 0x36 // start decoding in First I and skip non reference frame B decoding 770 #define CMD_SW_RESET 0x37 771 #define CMD_MVD_FAST_INT 0x38 772 #define CMD_DIU_WIDTH_ALIGN 0x39 773 #define CMD_SW_IDX_ADJ 0x3a // arg0=1 set sw_index as previous queue index infomation 774 #define CMD_PARSER_READ_POSITION 0x3b 775 #define CMD_REPEAT_MODE 0x3c // arg0=1 when frame display repeat only show one field 776 #define CMD_PTS_BASE 0x3d 777 #define CMD_SKIP_TO_PTS 0x3e 778 #define CMD_AVSYNC_FREERUN_THRESHOLD 0x3f 779 780 #define CMD_DEBUG_BUF_START 0x40 781 #define CMD_DEBUG_CTL 0x42 782 #define CMD_RD_IO 0x43 783 #define CMD_WR_IO 0x44 784 #define CMD_FB_RED_SET 0x45 785 #define CMD_FB_NUM 0x46 786 #define CMD_PTS_DETECTOR_EN 0x47 // enable filter for stream discontinue 787 #define CMD_PTS_TBL_RESET 0x48 // to reset pas/vld and pts_tbl 788 #define CMD_DRAM_OBF 0x49 // for Dram OBF key setting 789 #define CMD_FP_FILTER 0x4A // 0:1 for disable/enable field polarity tuning filter, 0 for default... 790 #define CMD_PUSH_FIRST_FRAME_DISP 0x4B // 0:1 for disable/enable to push the first I-frame to dispQ when decoded done on ts and ts-file mode, 0 for default(disable)... 791 #define CMD_FAST_RST 0x4C // 1 for enable mvd self reset... 792 #define CMD_RVU_EN 0x4D //open RVU feature 793 794 #define CMD_SLQ_START 0x50 //SLQ start address, from LSB to MSB are arg0, arg1, arg2, arg3 795 #define CMD_SLQ_END 0x51 //SLQ end address, from LSB to MSB are arg0, arg1, arg2, arg3 796 #define CMD_SLQ_AVAIL_LEVEL 0x52 //arg0: 4-0 797 #define CMD_FPGA_COMP 0x53 //arg0: 1/0:enable/disable FPGA comp 798 #define CMD_DIVX_PATCH 0x54 //arg0: D[0] divx mv p interlace chroma adjust 799 #define CMD_HEADER_INFO_BUF 0x55 //header info buffer base address, from LSB to MSB are arg0, arg1, arg2, arg3 800 #define CMD_IDCT_SEL 0x56 // arg0 D[0]:0/1 llm/divx6 D[1]:0/1 unbias/bias rounding mode 801 #define CMD_VOL_INFO_BUF 0x57 802 #define CMD_FRAME_INFO_BUF 0x58 803 #define CMD_CODE_OFFSET 0x59 804 #define CMD_RESET_FRAMECOUNT 0x5a 805 #define CMD_CHIPID 0x5b 806 #define CMD_DEC_FRAME_INFO_BUF 0x5c 807 #define CMD_GET_FW_VERSION 0x5E 808 #define CMD_GET_EN_CATCH_DATA 0x5F 809 810 #define CMD_SLQ_TBL_BUF_START 0x60 811 #define CMD_SLQ_TBL_BUF_END 0x61 812 #define CMD_SLQ_UPDATE_TBL_WPTR 0x62 813 #define CMD_SLQ_GET_TBL_RPTR 0x63 814 815 // FW stop updating frames when vsync, but decoding process is still going. 816 #define CMD_FREEZE_DISP 0x64 817 #define CMD_DS_VIRTUAL_BOX 0x65 818 #define CMD_SHOW_ONE_FIELD 0x66 819 #define CMD_FD_MASK_DELAY_CNT 0x67 // delay n's vsync then active the fd_mask 820 #define CMD_XC_LOW_DELAY_PARA 0x68 // set the parameter for XC_low_delay mechanism 821 822 #define CMD_FRC_OUPUT 0x69 823 #define CMD_FRC_DROP_BEHAVIOR 0x6A // arg0: FRC_DROP_FRAME/FRC_DROP_FIELD, default is FRC_DROP_FRAME 824 825 #define CMD_GET_NEXTDISPFRM 0x6B // for Mstreamer mode 826 #define CMD_FLIP_RELEASE_FRAME 0x6C // for Mstreamer mode 827 #define CMD_SEND_UNI_PTS 0x6D // for Mstreamer mode 828 #define CMD_SET_MST_MODE 0x6E // for Mstreamer mode 829 #define CMD_SET_MCU_MODE 0x6F // for mcu mode 830 831 #define CMD_DUMP_BITSTREAM_BASE 0x70 832 #define CMD_DUMP_BITSTREAM_LENGTH 0x71 833 834 #define CMD_MVD_IDLE 0x73 835 #define CMD_INTERFACE_VERSION 0x74 836 #define CMD_VC1_STREAM_TYPE_JPEG 0x75 837 #define CMD_VC1_STREAM_TYPE_MJPEG 0x76 838 #define CMD_VC1_BYPASS_MODE 0x77 839 #define CMD_VC1_UPDATE_SLQ 0x78 840 #define CMD_VC1_HW_SLQ_RESET 0x79 841 #define CMD_FLUSH_DISP_QUEUE 0x7A 842 #define CMD_VC1_FORCE_INTLACE_DISP 0x7B 843 #define CMD_VC1_IP_SCALE_THRESHOLD 0x7C 844 #define CMD_MOTION_COM_REDUCE 0x7D 845 #define CMD_CLOSE_DEBLOCK 0x7E 846 #define CMD_FIXED_FRAME_BUFFER 0x7F 847 #define CMD_ENABLE_AUTO_MUTE 0x80 848 #define CMD_FORCE_ALIGN_VSIZE 0x81 849 850 851 // File mode avsync related 852 #define CMD_ENABLE_AVSYNC_QUALIFIER 0x83// arg0=1:for enhance to do avsync when "enable_avsync=1" && "(lastcommand != CMD_PLAY)" for patch avsync on particular clip, 20120314 853 #define CMD_ENABLE_LAST_FRAME_QUALIFIER 0x84// arg0=1:for strict qualify the last_frame_show_done after the last_frame been displayed by mvop, 20120309 854 #define CMD_ENABLE_FILE_SYNC 0x85 855 #define CMD_PTS_TBL_START 0x86 856 #define CMD_FORCE_BLUE_SCREEN 0x87 857 #define CMD_ENABLE_LAST_FRAME_SHOW 0x88 858 #define CMD_DYNAMIC_SCALE_BASE 0x89 859 #define CMD_ENABLE_DYNAMIC_SCALE 0x8A 860 #define CMD_SCALER_INFO_BASE 0x8B 861 #define CMD_SW_BITPLANE_BASE 0x8C 862 #define CMD_FRONTEND_SEL 0x8D // front end input selection 863 #define CMD_ENABLE_FREEZE_PIC 0x8E 864 #define CMD_FORBID_RESOLUTION_CHANGE 0x8F 865 866 // JPEG command 867 #define CMD_JPEG_CONSTRAIN_SIZE 0x91 868 #define CMD_JPEG_STATUS 0x92 869 #define CMD_JPEG_SCALEFACTOR 0x93 870 #define CMD_JPEG_ROI 0x94 871 #define CMD_JPEG_ROI_DIM 0x95 872 #define CMD_JPEG_IPM 0x96 873 874 #define CMD_ENABLE_SAM_UNI 0xA0 // for Mstreamer mode 875 #define CMD_FLIP_TO_DISP 0xA1 // for Mstreamer mode 876 #define CMD_MIU_OFFSET 0xA2 // saving miu offset from hk for LDMA usage 877 #define CMD_IQMEM_CTRL 0xA3 // for iqmem ctrl from HK 878 #define CMD_IQMEM_CTRL_ACK 0xA4 // return ack by f/w 879 #define CMD_IQMEM_BASE_ADDR 0xA5 // unit in byte 880 881 // PES file-in command 882 #define CMD_PES_FILE_LOW_BND 0xA6 // for pes file in mode low bound 883 #define CMD_PES_FILE_UP_BND 0xA7 // for pes file in mode upper bound 884 #define CMD_PES_FILE_EN 0xA8 // for enable pes file in mode 885 #define CMD_PES_FILE_UPDATE_WPTR 0xA9 // for update pes file mode wr_ptr 886 #define CMD_PES_FILE_GET_RPTR 0xAA // for got pes file in mode rd_ptr 887 888 889 // add data in bitstream from skip mode back to normal 890 // 00_00_01_C5_ab_08_06_27 891 #define FW_SPE_SCODE 0xC5 892 #define FW_RESUME1 0xab08 893 #define FW_RESUME2 0x0627 894 #define FILE_PAUSE_SC 0xBE 895 #define FILE_END_SC 0xC6 896 #define FILE_END_EXT1 0xaabb 897 #define FILE_END_EXT2 0xccdd 898 #define FILE_END_EXT3 0xeeff 899 #define FILE_END_EXT4 0xffff 900 #define FILE_END_EXT5 0x0000 901 #endif 902