📄 xport.c
字号:
/***************************************************************************** Select xport ucode based on xport_type. If xport_type == MULTI_XPORT, prompt user. Load xport ucode and cam table. Low level initialisation of the xport hardware. *****************************************************************************/int XPORT_init(int xport_type, int xfer_mode){ int mode; if (xport_type == MULTI_XPORT) xport_type = vcx_bitstream_type; XPORT_load_ucode(xport_type); /* xport input mode depends on the xport type and the input xfer mode */ mode = PS16MODE; if (xfer_mode == 5) mode &= ~1; /* TDM */ XPORT_input_mode = mode; mvd[xport_input_mode] = mode; /* 3:dvb mode,0x13:alt mode */ mvd[xport_misc] = XPORT_RESET; mvd[xport_interupt_mask] = 0x10L; /* Enable sequence interrupt */ mvd[r_hostctl] = 0x4L; /* host */ mvd[xport_flush_output] = 0xfL; mvd[xport_flush_output] = 0x0L; return(xport_type);}/************************************************************************ Restart xport at the specified address. ************************************************************************/void XPORT_restart_at(int address, int byte_swap){ TDM_expectBreak = 1; /* currCDtime will break; */#if (MPEG1 && MKROM) XPORT_restore_e0_c0(); /* Restore XPORT CAM for safety. */#endif /* * Following magic allows XPORT PC to be changed without resetting * XPORT (we can't reset XPORT without lossing data in buffers.) */ mvd[xport_pc] = 0; mvd[xport_misc] = XPORT_LDMC; /* RISC stat bits are cleared */ mvd[xport_input_mode] = XPORT_input_mode; (void) mvd[xport_microcode_table + address]; mvd[xport_misc] = 0; mvd[xport_misc] = (byte_swap) ? 0x8L : 0x0L; mvd[xport_pc] = 0x80L + address; XPORT_start = 2; /* Tell outside that XPORT has started */}#ifdef XPORT20/************************************************************************ * Restart xport for 2.0 VCD (set begCDtime/endCDtime) * ************************************************************************//* * Change one line of transport microcode. For 2.0 players, we need * to set begCDtime/endCDtime. * * Input: * line: microcode line offset * data: data. The least significant byte goes to the immediate * field. * * Output: * data >> 8 */PRIVATE unsigned int XPORT_UcodeImmd(line, data)int line;unsigned int data;{ unsigned int tmp; /* * Transport microcode table has to be read twice, the first time * it returns garbage. */ reg0 = mvd[xport_microcode_table + line]; tmp = mvd[xport_microcode_table + line] & 0x7ffff00; mvd[xport_microcode_table + line] = tmp | (data & 0xff); return (data >> 8);}#ifdef ANTI_SHOCKvoid XPORT_load_cdda_match(void){ unsigned int data; mvd[xport_pc] = 0; /* Put XPORT offline so we can change ucode */ /* Load microcode */ mvd[xport_misc] = XPORT_LDMC; /* match 8B..2 samples of 2-channel audio */ data = ABV_data_save[0]; data = XPORT_UcodeImmd(XPORT_OFFSET_MATCH_BYTE3, data); data = XPORT_UcodeImmd(XPORT_OFFSET_MATCH_BYTE4, data); data = XPORT_UcodeImmd(XPORT_OFFSET_MATCH_BYTE1, data); data = XPORT_UcodeImmd(XPORT_OFFSET_MATCH_BYTE2, data); data = ABV_data_save[1]; data = XPORT_UcodeImmd(XPORT_OFFSET_MATCH_BYTE7, data); data = XPORT_UcodeImmd(XPORT_OFFSET_MATCH_BYTE8, data); data = XPORT_UcodeImmd(XPORT_OFFSET_MATCH_BYTE5, data); data = XPORT_UcodeImmd(XPORT_OFFSET_MATCH_BYTE6, data);#if 0 { /* debug */ int i; mvd[xport_misc] = XPORT_RESET; mvd[xport_misc] = XPORT_LDMC | XPORT_RESET; for (i=XPORT_OFFSET_CONTINUE_CDDA; i <= XPORT_OFFSET_MATCH_BYTE4; i++) { int tmp; tmp = mvd[xport_microcode_table+i]; tmp = mvd[xport_microcode_table+i] & x0fffffff; if (i==XPORT_OFFSET_MATCH_BYTE1) xxx1 = tmp; if (i==XPORT_OFFSET_MATCH_BYTE2) xxx2 = tmp; if (i==XPORT_OFFSET_MATCH_BYTE3) xxx3 = tmp; if (i==XPORT_OFFSET_MATCH_BYTE4) xxx4 = tmp; } }#endif}#endif ANTI_SHOCK/* * Change the match_channel ucode line: * either * if (!match(0)) {adv_cmd; goto real_data;} * or * adv_cmd; goto real_data; * * For E1/E2 data, we throw away the data if channel number is 0. For * E0 data, we ignore the channel number. * * Input: * check: 1 for E1/E2 data * 0 for E0 data */PRIVATE void XPORT_adj_match_channel(check)int check;{ unsigned int tmp; /* * Don't do "channel adjust" for MP3/DATA. There is no such thing and * MP3's code doesn't have XPORT_OFFSET_MATCH_CHANNEL! */ if ((XPORT_current_ucode == MP3_PS) || (XPORT_current_ucode == DATA_PS)) return; /* * Transport microcode table has to be read twice, the first time * it returns garbage. */ reg0 = mvd[xport_microcode_table + XPORT_OFFSET_MATCH_CHANNEL]; /* Ucode with condition field masked off */ tmp = mvd[xport_microcode_table + XPORT_OFFSET_MATCH_CHANNEL] & x07f07fff; if (check) tmp |= 0x48000; /* if (!match(0)) */ mvd[xport_microcode_table + XPORT_OFFSET_MATCH_CHANNEL] = tmp;}/* * This routine is called by 2.0's playSectors (2324), getSectors (2048), * playSectors_step_by_step (2324), and fuzzyPlaySector(2324) * * Following entry points should be used: * XPORT_OFFSET_FUZZY_PLAY: for fuzzyPlaySector * XPORT_OFFSET_PLAY_SECTOR: for playSectors and step_by_step * XPORT_OFFSET_GET_SECTOR: for getSectors * * This code will modify the transport microcode to customize for * begCDtime (if necessary) and endCDtime (always) * * playCDDA should call XPORT_restart_at(XPORT_OFFSET_PLAY_CDDA, 1) * * Input: * entry: entry point * still: For fuzzy/playSectors: resolution of still picture * For getSectors: size of the sector */void XPORT_play20video(entry, still)int entry;int still;{ unsigned int time; currCDtime = 0; /* Clear it */ mvd[xport_pc] = 0; /* Put XPORT offline so we can change ucode */ /* Load microcode for begCDtime and endCDtime */ mvd[xport_misc] = XPORT_LDMC; time = begCDtime; /* Set begCDtime to be matched */ time = XPORT_UcodeImmd(XPORT_OFFSET_BEG_FF, time); time = XPORT_UcodeImmd(XPORT_OFFSET_BEG_SS, time); time = XPORT_UcodeImmd(XPORT_OFFSET_BEG_MM, time); time = endCDtime; /* Set endCDtime to be matched */ time = XPORT_UcodeImmd(XPORT_OFFSET_END_FF, time); time = XPORT_UcodeImmd(XPORT_OFFSET_END_SS, time); time = XPORT_UcodeImmd(XPORT_OFFSET_END_MM, time); if (entry == XPORT_OFFSET_GET_SECTOR) { int size; /* * Adjust the size of sector. * Assuming 2048+0 <= size <= 2048 + 0xff * * Older getSectors code sets "still" to 0; make sure they are not * affected. */ size = still ? (still - 2048) : 0; (void) XPORT_UcodeImmd(XPORT_OFFSET_LOAD_GETSECTOR_LOW3, size); } else { /* Adjust match_channel ucode */ XPORT_adj_match_channel(still & 0x3); /* for e1 0r e2 stream, we need to or 0x100 for xport. */ if (still & 0x3) still |= 0x100; mvd[xport_misc] = XPORT_LDPID; mvd[xport_pid_table + XPORT_PID_E1E2] = PID_ID(still) | PID_DEST_VIDEO; /* * Note: if you want to read PID table, you have to read it twice, * the first time it returns junk. */ } XPORT_restart_at(entry, 0); if ((entry == XPORT_OFFSET_PLAY_SECTOR) || (entry == XPORT_OFFSET_GET_SECTOR)) { TDM_found_begCDtime = 0; TDM_trigger = 0; XPORT_active = 0; } else XPORT_active = 1; /* Fuzzy play */}/* * Flush out the gateway FIFO relating to transport. This routine is * called when transport is done so all the incoming data will go * to DRAM. */void XPORT_flushGateway(void){ gbl_gate_control |= (flush_xportv | flush_xporta); mvd[gate_control] = gbl_gate_control; risc_sleep_a_bit(600); gbl_gate_control &= ~(flush_xportv | flush_xporta); mvd[gate_control] = gbl_gate_control;}#endif /* XPORT20 */#ifdef XPORT11/* * For 1.1 players, the kind of still picture to be displayed is determined * during run time (i.e. if there is no E2, then display E1.) When this * detection is made, TDM calls this routine to change the XPORT CAM * table. Since E1/E2 is only needed for VCD, we always resume playing * at FUZZY_PLAY's entry point. */void XPORT_loadstill(still)int still;{ /* Load CAM to specify which kind of still picture to match */ mvd[xport_misc] = XPORT_LDPID | XPORT_RESET; mvd[xport_pid_table + XPORT_PID_E1E2] = PID_ID(still) | PID_DEST_VIDEO; XPORT_restart_at(XPORT_OFFSET_FUZZY_PLAY, 0); }#endif /* XPORT11 */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -