⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xport.c

📁 ESS3890+SL原代码(1*16内存)
💻 C
📖 第 1 页 / 共 2 页
字号:
/* Copyright 1997, ESS Technology, Inc.					*//* SCCSID @(#)xport.c	4.4 01/06/05 *//* * $Log$ */#include <stdio.h>#include <stdlib.h>#include <ctype.h>#include "vcxi.h"#include "buffer.h"#include "const.h"#include "debug.h"#include "tdm.h"#include "low.h"#include "util.h"#include "xport.h"#include "play.h" #define PRINTF(a)/**************************************************************************** Various defines ****************************************************************************/#define ALTMODE         0x00000013#define DVBMODE         0x00000003#define PS8MODE         DVBMODE#define PS16MODE        0x00000001#define DestVideo       0#define DestAudio       2#define DestAux         4#define DestUser        6#define DestRisc        1#define makepid(pid,CCvalid,CCvalue,dest)	\	((1L<<21L) +				\	((pid    &0x01fffL)<<8L)	+	\	((CCvalid&0x00001L)<<7L)	+	\	((CCvalue&0x0000fL)<<3L)	+	\	(dest & 0x00007L) )/**************************************************************************** Transport mode select. Things like 8 or 16 bit, DVB or DSS. ****************************************************************************/#define AID_CHECK 0x2d	/* AC3 substream ID patch location */#define PS_BYPASS 0x2c	/* AC3 substream ID check bypass for generic PS */#define SP_BYPASS 0x2f	/* AC3 extra info code bypass for sub-picture */#define CONTINUE  0x32	/* This is where continue is *//**************************************************************************** Local function prototypes ****************************************************************************/static void XPORT_load_cam(int *, int);PRIVATE	void		XPORT_adj_match_channel(int);PRIVATE	unsigned int	XPORT_UcodeImmd(int, unsigned int);/**************************************************************************** Select xport type, load ucode and cam. ****************************************************************************/#define set_parameter(a, b)  {			\    uCode= T_uCode_##a;				\    uCsize = T_uCode_##a##_SZ/sizeof(int); 	\    pid = T_pid_##b; 				\    pidsize = T_pid_##b##_SZ/sizeof(int);	\} /**************************************************************************** Local variables ****************************************************************************/static int x07f07fff = 0x07f07fff;/**************************************************************************** XPORT interrupt service routine ****************************************************************************/#ifdef XPORT20#define XPORT_MAX_FIFO	7	/* <00:mm> <ss:ff> <sub:code> <01:ID>	*				 * <junk:d> <d:d> <d:d>			*/#else#define XPORT_MAX_FIFO	8	/* Add <mode:filenumber>		*/#endifunsigned short XPORT_fifo[XPORT_MAX_FIFO]; /* XPORT->RISC FIFO data	*//* * XPORT seq interrupt handler. This routine reads all the XPORT * FIFO data. Due to a bug in XPORT hardware, it is more reliable to  * read the FIFO while nobody is writing to the FIFO. The current * XPORT microcode will make sure that after the last RISC FIFO data * is sent, trigger a seq. interrupt; this interrupt is far away from * the next RISC FIFO data. * * The data will be read out, and it will be process in TDM interrup * just like before. * * Return: *	1:	Equivalent to TDM interrupt */int XPORT_interrupt_service(void){    int loop, max, cnt;    mvd[xport_clear_stat_bits] = 2;	/* Clear seq. IRQ */#ifdef ANTI_SHOCK    if (TDM_isCDDA) {	if (C2PO_interrupt) {	    C2PO_interrupt = 0;	    /*	     * We have gotten a C2PO error..	     * xport has stopped (bad data to "junk").	     * So we need to save last good ABV data	     * then reconnect it with good data later.	     */	    PLAY_set_2x_speed = 1; /* catch up with 2X speed */	    av_cdda_match_stop();	}	return(0);    }#endif ANTI_SHOCK    /*      * Counter is usually one less than what is in the FIFO. However,      * if there is nothing in FIFO, the counter is still 0.     */    cnt = (mvd[xport_read_rff_count] & 0x3f) + 1;    /*     * If XPORT_fifo_length is not 0, then TDM interrupt has not happened     * yet; in other words, this is the "2nd packet" interrupt. Ignore     * the interrupt. Don't touch the FIFO data because if the interrupt     * latency is long, the next currCDtime may be in!     */    if (XPORT_fifo_length == 0) {	XPORT_fifo_length = cnt;	/*	 * Since nobody is writing to the RISC FIFO, reading it now	 * shall give reliable result!	 *	 * Make sure the number of data item makes sense.	 */	if ((max = XPORT_fifo_length) > XPORT_MAX_FIFO)	  max = XPORT_MAX_FIFO;	/* Read the FIFO data into an array */	for (loop = 0; loop < max; loop++)	  XPORT_fifo[loop] = mvd[xport_read_risc_data];	/* If we have more data unexpectly, throw them away */	for (loop; loop < XPORT_fifo_length; loop++)	  reg0 = mvd[xport_read_risc_data];    }    return(0);}/**************************************************************************** Download transport ucode. ****************************************************************************/void XPORT_load_ucode(ucode)int ucode;{    int  *uCode;	/* Pointer to the ROM ucode array		*/    int  *pid;		/* Pointer to the ROM PID array			*/    int  uCsize;	/* Size of ROM ucode array			*/    int  pidsize;	/* Size of PID array				*/    int  i;    /* Return if we have the right XPORT ucode loaded already */    if (XPORT_current_ucode == ucode)	return;    if (ucode == MPEG1_PS) {	set_parameter(MPEG1_PS, MPEG1_PS);	/* VCD	*/    } else {	/* Both MP3 and DATA use MP3 */	set_parameter(MP3, MPEG1_PS);	/* MP3	*/    }    /* Select video/audio channel ID */    XPORT_load_cam(pid, pidsize);    PRINTF(("Loading xport ucode.\n"));    assert(size);    if (uCsize > 0x80) {	FATAL(("Ucode too long. Download aborted.\n"));    }    mvd[xport_misc] = XPORT_LDMC | XPORT_RESET;    for (i=0; i < uCsize; i++)  	mvd[xport_microcode_table+i] = uCode[i];     for(; i < 0x80; i++)	mvd[xport_microcode_table+i] = 0x3f07f00L;     /*     * GetSector's data goes to VBV instead of the default ABV     */    if (ucode == DATA_PS)       mvd[xport_microcode_table + XPORT_OFFSET_SET_DESTINATION] =	(uCode[XPORT_OFFSET_SET_DESTINATION] & 0x7fffff0) | PID_DEST_VIDEO;#ifdef DEBUG    mvd[xport_misc] = XPORT_RESET;    mvd[xport_misc] = XPORT_LDMC | XPORT_RESET;    for (i=0; i < uCsize; i++)  {        int tmp;	tmp = mvd[xport_microcode_table+i];	tmp = mvd[xport_microcode_table+i] & x0fffffff;	if( tmp != (uCode[i] & x0fffffff)){	    FATAL(("Xport ucode verify error\n"));	}     }#endif    mvd[xport_misc] = XPORT_RESET;    XPORT_current_ucode = ucode;	/* Keep track of XPORT ucode	*/}/**************************************************************************** Load xport PID. ****************************************************************************/static void XPORT_load_cam(PID_table, size)int 	    *PID_table; 	/* table address */int 	    size;{    int *pid_data;    int	i, data, tmp;    PRINTF(("Load pid table \n"));    assert(size);    pid_data = PID_table;#ifdef DEBUG    if (size > 0x20) {	FATAL(("PID table too long. Download aborted.\n"));    }#endif    /*-write ucode-*/    mvd[xport_misc] = XPORT_FLUSHCAM| XPORT_RESET;    mvd[xport_misc] = XPORT_RESET;    mvd[xport_misc] = XPORT_LDPID | XPORT_RESET;	/* Load all the CAM entries */    for (i = 0; i < 0x20; i++) {	    data = 0;	    if (i < size) data = pid_data[i]; 	    mvd[xport_pid_table+i] = data;    }#ifdef DEBUG	/* Check to make sure loading is successful */    for (i = 0; i < 0x20; i++) {	    data = 0;	    if (i < size) data = pid_data[i];	    	    tmp = mvd[xport_pid_table+i];	    tmp = mvd[xport_pid_table+i];	    if ((unsigned char) tmp != (unsigned char) data)	      break;    }#endif    mvd[xport_misc] = XPORT_RESET;}#if (MPEG1 && MKROM)/* * Routine to restore CAM table. There is report that CAM table * content may change in some situation. */void XPORT_restore_e0_c0(){    int *pid_data = T_pid_MPEG1_PS;    mvd[xport_misc] = XPORT_LDPID;    mvd[xport_pid_table + XPORT_PID_E0] = pid_data[XPORT_PID_E0];    mvd[xport_pid_table + XPORT_PID_C0] = pid_data[XPORT_PID_C0];}#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -