?? vp.h
字號:
/* Copyright 1996, ESS Technology, Inc. *//* SCCSID @(#)vp.h 1.72 5/8/98 *//* * $Log$ */#ifndef _VP_H_#define _VP_H_/************************************************************ * vp.h * prefix: VP_ * most macros are named something like VP_macros. * Most macros start with a parameter ncmdq; * value of ncmdq can be either 0 or NCMDQ_VP_macros, which is a constant, * parameter 0 should be used when we do not want a VP_cmdq_wait to * be issued in the beginning of that macros, probably because we * have already issued VP_cmdq_wait somewhere else before. * This mechanism is used to avoid and manage cmdq overflow problem. * Macros that start with VP_cmdq_ does not have VP_cmdq_wait in it. ************************************************************//************************************************************ * compile option ************************************************************/#undef CMDQ_DEBUG/************************************************************ * microcode entry pt address * rom code ************************************************************/#define setBase 0x1003#define rx_0 0x1033#define rx_1 0x1028#define rx_2 0x101d#define rx_3 0x1017#define clr_pcstack 0x1052#define check 0x1015#define do_nothing 0x1058#define loading 0x1005#define longnop 0x104e#define setMode 0x1001#define r_rr14 0x104c#define r_rr15 0x104d#define r_rr10 0x1048#define r_rr11 0x1049#define r_rr12 0x104a#define r_rr13 0x104b#define r_rr7 0x1045#define r_rr6 0x1044#define r_rr5 0x1043#define r_rr4 0x1042#define r_rr3 0x1041#define r_rr2 0x1040#define r_rr1 0x103f#define r_rr0 0x103e#define r_rr9 0x1047#define r_rr8 0x1046#define idct_dc_no_mismatch 0x105a#define idct 0x105d#define idct_join 0x10c9#define idct_no_mismatch 0x105d#define move_Y 0x115d#define dm_add_8 0x1173#define extract_Y 0x115b#define Do_Avg 0x1177#define mpeg_inter_no_mismatch 0x118c#define mpeg_inter_join 0x118d#define intra_postidct 0x120f#define select_Y 0x1231#define select_U 0x122b#define select_V 0x122e#define mpeg1_inter 0x1189#define mpeg_intra_no_mismatch 0x11df#define intra_quant 0x1200#define fourfour_join 0x11e1#define mpeg_intra_join 0x11e0#define set_iquant 0x1234#define clearalldp 0x124d#define ClearRLA_DP 0x1258#define set_DP 0x124a#define save_DC 0x1266#define restore_DC 0x126f#define mismatch_ctl_mpeg1 0x127e#define idct8to4 0x1288/* * Following entry points are different for older 3210's (before 3210T) * vs. newer 3210's. So we are using two index tables (see misctbl.c) */#define Frame_int VP_ucode_offset[0]#define Restore_UV_from_fifth VP_ucode_offset[1]#define Save_UV_in_fifth VP_ucode_offset[2]#define dpcm VP_ucode_offset[3]#define mpeg1_intra VP_ucode_offset[4]#define kcross_fade VP_ucode_offset[5]#define karaoke VP_ucode_offset[6]#define clearing_DC VP_ucode_offset[7]#define mpg_audio_synth32 VP_ucode_offset[8]#define mpg_audio_synwindow18 VP_ucode_offset[9]#define mpg_volume_stereoint VP_ucode_offset[10]#define mpg_audio_average VP_ucode_offset[11]#define interleave /* end of t3210 difference */#ifdef MPEG2#undef dpcm /* override rom code */#include "m2vram2.map"#endif#ifdef AC3#ifndef FAKE#include "ac3all.map"#endif#endif#ifdef MPEG1 /* in the VPURAM */#ifdef SVCD#include "m2vram2.map"#endif#define raise_lum 0x1887#define echo_mix_bot 0x19a3#define echo 0x194f#define echo_mix_top 0x198f#define ksearch_init 0x1800#define ksearch_coarse 0x180e#define ksearch_fine 0x1804#define cif_ntsc_Y 0x1800#define cif_ntsc_YUV 0x1804#define ntsc_cif_Y 0x1800#define ntsc_cif_YUV 0x1804#define two2one_2nd 0x1803#define clearing_DC_Y_digest 0x1826#define two2one_1st 0x1800#define spatial_vxl 0x1805#define spatial_srd 0x1800#define cdda_mono 0x1800#define cdda_volume_control 0x181a#define clamp_0x87 0x19c8#define horz_scale_4_3_Y 0x1800#define horz_scale_4_3_YUV 0x1804#endif/************************************************************ * Number of cmdq entries needed for each VP operation ************************************************************/#define NCMDQ_VP_cbus 1#define NCMDQ_VP_data 1#define NCMDQ_VP_ucode NCMDQ_VP_cbus#define NCMDQ_VP_mcmd NCMDQ_VP_cbus#define NCMDQ_VP_block 1#define NCMDQ_VP_block_twice 2#define NCMDQ_VP_endio (NCMDQ_VP_block*2)#define NCMDQ_VP_xfer 4#define NCMDQ_VP_xfer_2d 3#define NCMDQ_VP_read NCMDQ_VP_block_twice#define NCMDQ_VP_cmdq_reset 2/************************************************************ * Following are commands to VP via Cbus (see BUSCON_CMDQUE_VPCBUSWR) ************************************************************/#define VPCMD_WAIT 0x8000 /* VP's Wait bit */#define VPCMD_W_DPCM 0x4000 /* Write to DPCM memory */#define VPCMD_W_DP 0x4800 /* Write to DP memory */#define VPCMD_R_DPCM 0x5000 /* Read from DPCM memory */#define VPCMD_R_DP 0x5800 /* Read from DP memory */#define VPCMD_W_INTRA 0x6000 /* Write RUN/AMPL intra */#define VPCMD_W_INTER 0x6800 /* Write RUN/AMPL inter */#define VPCMD_R_INTRA 0x7000 /* Read RUN/AMPL intra */#define VPCMD_R_INTER 0x7800 /* Read RUN/AMPL inter *//* house keeping command */#define VPCMD_MV 0x0300 /* motion vector housekeep cmd */#define VPCMD_BFRAME_ON 0x0282 /* Bframe Compression housekeep cmd */#define VPCMD_BFRAME_OF 0x0280 /* Bframe Compression housekeep cmd *//* Following are VP DMA controls (see BUSCON_CMDQUE_VPDMAX) */#define VPDMA_VP2MEM 0x0 /* From VP to reference memory */#define VPDMA_MEM2VP 0x4000 /* From reference memory to VP */#define VPDMA_INC2 0x1000 /* Increment Y position by 2 when DMAing*/#define VPDMA_INC1 0x0000 /* Increment Y position by 1 when DMAing*/#define VPDMA_RLA 0x2000 /* Transfer RLA data */#define VPDMA_BREAK 0x8000 /* Send break to VP at the end of a line*/#define VPDMA_WIDTH0 0x0000 /* Use width0 for y increments */#define VPDMA_WIDTH1 0x0200 /* Use width1 for y increments */#define VPDMA_WIDTH2 0x0400 /* Use width2 for y increments */#define VPDMA_WIDTH3 0x0600 /* Use width3 for y increments */#define VPDMA_USEDX 0x0800 /* Use dx for y increments */#ifdef MPEG1/* mpeg1 way of using width register */#define VPDMA_WIDTH44 VPDMA_WIDTH1 /* width1 is hardwired to 44 */#define VPDMA_WIDTH33 VPDMA_WIDTH2 /* width2 is hardwired to 33 */#endif#ifndef FAKE/************************************************************ * Following are commands to VP via dmay (see BUSCON_CMDQUE_DMAY) ************************************************************/#define VPDMA_YPOS_BFRAME_COMP_ON 0x8000#define VPDMA_YPOS_BFRAME_COMP_OF 0x0000#if 0#define VPDMA_YPOS_BFRAME_COMP 0x8000#endif/* Following are used with BUSCON_CMDQUE_VPSTATWAIT */#define VPSTAT_DH 0x2000/* should have been appended in initialization */#define VPUCODE 0x1000 /* append to all vpucode addresses *//************************************************************ * enty type that can go into cmdq ************************************************************/#define VP_cmdq_cmd(a) mvd[buscon_cmdque_vpcbuswr] = (a)#define VP_cmdq_dmax(x) mvd[buscon_cmdque_vpdmax] = (x)#define VP_cmdq_dmay(y) mvd[buscon_cmdque_vpdmay] = (y)#define VP_cmdq_vpstat(y) mvd[buscon_cmdque_vpstatwait] = (y)#define VP_cmdq_deltas(dx, dy) \ mvd[buscon_cmdque_vpdeltas] = ((0x80 - (dy)) << 9) | (0x200 - (dx))/* the -2 term leave some leeway so that read and write pointer won't * overlap; or else hardware might have problem * (according to Duat Tran) */#define MAX_CMDQUE_NUMENTRIES (64-2)#if 0#define VP_cmdq_wait_timeout(n) do {\ int way_too_much = 0; \ while ((mvd[buscon_cmdque_numentries]&0x3f) > (MAX_CMDQUE_NUMENTRIES-(n))) { \ if (way_too_much++ >= 150000) { \ EPRINTF(("VP_cmdq_wait timeout\n")); \ break; \ } \ } \} while (0)#define VP_cmdq_wait(n) VP_cmdq_wait_timeout(n)#else#define VP_cmdq_wait(n) \ do {} while((mvd[buscon_cmdque_numentries]&0x3f)>(MAX_CMDQUE_NUMENTRIES-(n)))#endif#define VP_cmdq_wait_empty while (!(mvd[buscon_cmdque_status]&1));/************************************************************ * command going into vp thru dbus ************************************************************/#define VP_data(ncmdq, a) \do { \ if (ncmdq) VP_cmdq_wait(ncmdq); \ mvd[buscon_cmdque_vpdbuswrlow] = (a); \} while(0)/* vp_data to be faded out */#define vp_data(a) VP_data(NCMDQ_VP_data, a)#define vp_data_only(a) VP_data(0, a)/************************************************************ * command going into vp thru cbus * vp_ucode: for datapath * vp_mcmd: for io ************************************************************/#define VP_cbus(ncmdq, a) \do { \ if(ncmdq) VP_cmdq_wait(ncmdq); \ VP_cmdq_cmd(a); \} while(0)#define VP_ucode(ncmdq, a) VP_cbus(ncmdq, a)/* vp_ucode should be faded out */#define vp_ucode(a) VP_ucode(NCMDQ_VP_ucode, a)#define vp_ucode_only(a) VP_ucode(0, a)#define wait4l_only VP_block(0, UCODE_IDLE)#define VP_mcmd(ncmdq, a) VP_cbus(ncmdq, a)/* vp_mcmd should be faded out */#define vp_mcmd(a) VP_mcmd(NCMDQ_VP_mcmd, a)#define vp_mcmd_only(a) VP_mcmd(0, a)/************************************************************ * blocking commands at interface with internal queue * might have to be issued twice to take into account delay induced * by internal vp queue, in such case use VP_block_twice() ************************************************************//************************************************************ * VP_MCMD_ISSUED: * why needed is still to be investigated!!! * stuffing between vp_mcmd and dmay in rla case * must be issued immediate after vp_mcmd to avoid certain timing problem: * there could be a scenerio that the vp_mcmd has been executed, causing * waitio_ready to wait forever ************************************************************/typedef enum { UCODE_IDLE =0x21f, IO_IDLE =0x9f, VP_MCMD_ISSUED =0x9b, VP_CMDQ_NOT_EMPTY_N_IO_IDLE =0x0fe,} READY_MASK;#define VP_block(ncmdq, ready_mask) \{ \ if (ncmdq) VP_cmdq_wait(ncmdq); \ mvd[buscon_cmdque_vpstatwait] = ready_mask; \}#define VP_block_twice(ncmdq, ready_mask) \{ \ if (ncmdq) VP_cmdq_wait(ncmdq); \ mvd[buscon_cmdque_vpstatwait] = ready_mask; \ mvd[buscon_cmdque_vpstatwait] = ready_mask; \}/************************************************************ * send endio to terminate vp_mcmd used in io ************************************************************/#define VP_endio(ncmdq) \{ \ VP_block(ncmdq, 0x400); \ VP_block(0, 0x8400); \}/************************************************************ * VP_xfer a general way for transfering 1d data between dram and vp * for 2d data use VP_xfer_2d * e.g. to output idct result to dram: * VP_xfer(VPCMD_R_DPCM, vpadr, VPDMA_BREAK+VPDMA_WIDTH2, offset+xy2a(x,y,720), 4, 16); ************************************************************//* internal use in VP_xfer */#define VPDIR(cmd) (((cmd) & 0x1000) ? VPDMA_VP2MEM : VPDMA_MEM2VP)#define VP_xfer(ncmdq, cmd, vpadr, mode, addr, dx, dy) do { \ if (ncmdq) VP_cmdq_wait(ncmdq); \ VP_cmdq_cmd((cmd) + (vpadr)); \ VP_cmdq_deltas((dx), (dy)); \ VP_cmdq_dmax(VPDIR(cmd) + (mode) + a2x(addr)); \ VP_cmdq_dmay(a2y(addr)); \} while (0)#define VP_xfer_bf(ncmdq, cmd, vpadr, mode, addr, dx, dy) do { \ vp_mcmd_only(VPCMD_BFRAME_ON); \ if (ncmdq) VP_cmdq_wait(ncmdq); \ VP_cmdq_cmd((cmd) + (vpadr)); \ VP_cmdq_deltas((dx), (dy)); \ VP_cmdq_dmax(VPDIR(cmd) + (mode) + a2x(addr)); \ VP_cmdq_dmay(0x8000+a2y(addr)); \ vp_mcmd_only(VPCMD_BFRAME_OF); \} while (0)#define VP_xfer_sw(ncmdq, cmd, vpadr, mode, addr, dx, dy, z) do { \ if (ncmdq) VP_cmdq_wait(ncmdq); \ VP_cmdq_cmd((cmd) + (vpadr)); \ VP_cmdq_deltas((dx), (dy)); \ VP_cmdq_dmax(VPDIR(cmd) + (mode) + a2x(addr)); \ if (z) VP_cmdq_dmay(0x8000+a2y(addr)); \ else VP_cmdq_dmay(a2y(addr)); \} while (0)#define VP_ucode_wait() do { \ VP_block_twice(NCMDQ_VP_block_twice, UCODE_IDLE); \} while (0);/************************************************************ * vp_mcmd is issued outside for better optimization * offset, DX, X all in dword unit * remember to select INC2 * need width term * BframeComp can be 0 or 0x8000 ************************************************************/#define VP_xfer_2d(ncmdq, x, y, DX, DY, offset, width, vpdma_mode, vpdir, BframeComp) \{ \ int addr = (offset)+xy2a(x,y,width); \ if (ncmdq) VP_cmdq_wait(ncmdq); \ VP_cmdq_deltas(DX, DY); \ VP_cmdq_dmax((vpdir) + (vpdma_mode) + (VPDMA_BREAK) + a2x(addr)); \ VP_cmdq_dmay(a2y(addr)+BframeComp); \}/************************************************************ * wait until cmdq is empty, then read out port value * such wait is necessary to make sure that port value is valid ************************************************************/#define VP_read(ncmdq, port) \{ \ if (ncmdq) VP_cmdq_wait(ncmdq); \ VP_block_twice(0, UCODE_IDLE); \ VP_cmdq_wait_empty; \ mvd[buscon_cmdque_vprd] = 0x0; \ while (!(mvd[buscon_cmdque_status]& 0x8)); \ port = (mvd[buscon_cmdque_rdrlatchl] & 0xffff); \}/************************************************************ * CMDQ_reset discard all pending cmdq entries ************************************************************//* since it's reset, probably it does not go thru command queue, * so no need for cmdq_wait??? */#define VP_cmdq_reset(ncmdq) \{ \ if (ncmdq) VP_cmdq_wait(ncmdq); \ mvd[buscon_cmdque_cntl] = 0x20; \ mvd[buscon_cmdque_cntl] = 0x00; \}#define CMDQ_reset() VP_cmdq_reset(0)/************************************************************ * global typedef ************************************************************/typedef enum { rnone,#ifdef MPEG2 rvideo,#endif#ifdef AC3 rac3both, rac3shot, rac3long, rfft64,#endif#ifdef MPEG1#ifdef SVCD rvideo,#endif rnonpage, rtwo2one, rpal2ntsc, rntsc2pal, rksearch, rcdda,#ifdef SPATIAL rspatial,#endif#ifdef BF43 rhscale,#endif#endif rdummy, /* rdummy should never be used in indexing array */} RAMCODE;#ifdef AC3GBLDEF(int fft64_is_in, 0);#endif/************************************************************ * external function declaration ************************************************************/EXPORT void VP_init(void);EXPORT void VP_reset(void);EXPORT void VP_load_ucode(RAMCODE name);EXPORT void VP_version(void);EXPORT void VP_xfer_wait(void);#else /* FAKE */#define VP_xfer_wait()#define VP_ucode_wait()#define VP_load_ucode(name)#define VP_cmdq_wait(n)#endif#endif /* _VP_H_ */
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -