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

📄 sbpcd.c

📁 这是一个SIGMA方案的PMP播放器的UCLINUX程序,可播放DVD,VCD,CD MP3...有很好的参考价值.
💻 C
📖 第 1 页 / 共 5 页
字号:
 * auto-probing address list * inspired by Adam J. Richter from Yggdrasil * * still not good enough - can cause a hang. *   example: a NE 2000 ethernet card at 300 will cause a hang probing 310. * if that happens, reboot and use the LILO (kernel) command line. * The possibly conflicting ethernet card addresses get NOT probed  * by default - to minimize the hang possibilities.  * * The SB Pro addresses get "mirrored" at 0x6xx and some more locations - to * avoid a type error, the 0x2xx-addresses must get checked before 0x6xx. * * send mail to emoenke@gwdg.de if your interface card is not FULLY * represented here. */#if !(SBPCD_ISSUE-1)static int sbpcd[] = {	CDROM_PORT, SBPRO, /* probe with user's setup first */#if DISTRIBUTION	0x230, 1, /* Soundblaster Pro and 16 (default) */#if 0	0x300, 0, /* CI-101P (default), WDH-7001C (default),		     Galaxy (default), Reveal (one default) */	0x250, 1, /* OmniCD default, Soundblaster Pro and 16 */	0x2C0, 3, /* Teac 16-bit cards */	0x260, 1, /* OmniCD */	0x320, 0, /* Lasermate, CI-101P, WDH-7001C, Galaxy, Reveal (other default),		     Longshine LCS-6853 (default) */	0x338, 0, /* Reveal Sound Wave 32 card model #SC600 */	0x340, 0, /* Mozart sound card (default), Lasermate, CI-101P */	0x360, 0, /* Lasermate, CI-101P */	0x270, 1, /* Soundblaster 16 */	0x670, 0, /* "sound card #9" */	0x690, 0, /* "sound card #9" */	0x338, 2, /* SPEA Media FX, Ensonic SoundScape (default) */	0x328, 2, /* SPEA Media FX */	0x348, 2, /* SPEA Media FX */	0x634, 0, /* some newer sound cards */	0x638, 0, /* some newer sound cards */	0x230, 1, /* some newer sound cards */	/* due to incomplete address decoding of the SbPro card, these must be last */	0x630, 0, /* "sound card #9" (default) */	0x650, 0, /* "sound card #9" */#ifdef MODULE	/*	 * some "hazardous" locations (no harm with the loadable version)	 * (will stop the bus if a NE2000 ethernet card resides at offset -0x10)	 */	0x330, 0, /* Lasermate, CI-101P, WDH-7001C */	0x350, 0, /* Lasermate, CI-101P */	0x358, 2, /* SPEA Media FX */	0x370, 0, /* Lasermate, CI-101P */	0x290, 1, /* Soundblaster 16 */	0x310, 0, /* Lasermate, CI-101P, WDH-7001C */#endif /* MODULE */#endif#endif /* DISTRIBUTION */};#elsestatic int sbpcd[] = {CDROM_PORT, SBPRO}; /* probe with user's setup only */#endifMODULE_PARM(sbpcd, "2i");MODULE_PARM(max_drives, "i");#define NUM_PROBE  (sizeof(sbpcd) / sizeof(int))/*==========================================================================*//* * the external references: */#if !(SBPCD_ISSUE-1)#ifdef CONFIG_SBPCD2extern int sbpcd2_init(void);#endif#ifdef CONFIG_SBPCD3extern int sbpcd3_init(void);#endif#ifdef CONFIG_SBPCD4extern int sbpcd4_init(void);#endif#endif/*==========================================================================*/#define INLINE inline/*==========================================================================*//* * the forward references: */static void sbp_sleep(u_int);static void mark_timeout_delay(u_long);static void mark_timeout_data(u_long);#if 0static void mark_timeout_audio(u_long);#endifstatic void sbp_read_cmd(struct request *req);static int sbp_data(struct request *req);static int cmd_out(void);static int DiskInfo(void);static int sbpcd_chk_disk_change(kdev_t);/*==========================================================================*//* * pattern for printk selection: * * (1<<DBG_INF)  necessary information * (1<<DBG_BSZ)  BLOCK_SIZE trace * (1<<DBG_REA)  "read" status trace * (1<<DBG_CHK)  "media check" trace * (1<<DBG_TIM)  datarate timer test * (1<<DBG_INI)  initialization trace * (1<<DBG_TOC)  tell TocEntry values * (1<<DBG_IOC)  ioctl trace * (1<<DBG_STA)  "ResponseStatus" trace * (1<<DBG_ERR)  "cc_ReadError" trace * (1<<DBG_CMD)  "cmd_out" trace * (1<<DBG_WRN)  give explanation before auto-probing * (1<<DBG_MUL)  multi session code test * (1<<DBG_IDX)  "drive_id != 0" test code * (1<<DBG_IOX)  some special information * (1<<DBG_DID)  drive ID test * (1<<DBG_RES)  drive reset info * (1<<DBG_SPI)  SpinUp test info * (1<<DBG_IOS)  ioctl trace: "subchannel" * (1<<DBG_IO2)  ioctl trace: general * (1<<DBG_UPC)  show UPC info * (1<<DBG_XA1)  XA mode debugging * (1<<DBG_LCK)  door (un)lock info * (1<<DBG_SQ1)   dump SubQ frame * (1<<DBG_AUD)  "read audio" debugging * (1<<DBG_SEQ)  Sequoia interface configuration trace * (1<<DBG_LCS)  Longshine LCS-7260 debugging trace * (1<<DBG_CD2)  MKE/Funai CD200 debugging trace * (1<<DBG_TEA)  TEAC CD-55A debugging trace * (1<<DBG_ECS)  ECS-AT (Vertos-100) debugging trace * (1<<DBG_000)  unnecessary information */#if DISTRIBUTIONstatic int sbpcd_debug = (1<<DBG_INF);#elsestatic int sbpcd_debug = 0 & ((1<<DBG_INF) |			  (1<<DBG_TOC) |			  (1<<DBG_MUL) |			  (1<<DBG_UPC));#endif /* DISTRIBUTION */static int sbpcd_ioaddr = CDROM_PORT;	/* default I/O base address */static int sbpro_type = SBPRO;static unsigned char f_16bit;static unsigned char do_16bit;static int CDo_command, CDo_reset;static int CDo_sel_i_d, CDo_enable;static int CDi_info, CDi_status, CDi_data;static struct cdrom_msf msf;static struct cdrom_ti ti;static struct cdrom_tochdr tochdr;static struct cdrom_tocentry tocentry;static struct cdrom_subchnl SC;static struct cdrom_volctrl volctrl;static struct cdrom_read_audio read_audio;static unsigned char msgnum;static char msgbuf[80];static int max_drives = MAX_DRIVES;#ifndef MODULEstatic unsigned char setup_done;static const char *str_sb_l = "soundblaster";static const char *str_sp_l = "spea";static const char *str_ss_l = "soundscape";static const char *str_t16_l = "teac16bit";static const char *str_ss = "SoundScape";#endifstatic const char *str_sb = "SoundBlaster";static const char *str_lm = "LaserMate";static const char *str_sp = "SPEA";static const char *str_t16 = "Teac16bit";static const char *type;#if !(SBPCD_ISSUE-1)static const char *major_name="sbpcd";#endif#if !(SBPCD_ISSUE-2)static const char *major_name="sbpcd2";#endif#if !(SBPCD_ISSUE-3)static const char *major_name="sbpcd3";#endif#if !(SBPCD_ISSUE-4)static const char *major_name="sbpcd4";#endif/*==========================================================================*/#if FUTUREstatic DECLARE_WAIT_QUEUE_HEAD(sbp_waitq);#endif /* FUTURE */static int teac=SBP_TEAC_SPEED;static int buffers=SBP_BUFFER_FRAMES;static u_char family0[]="MATSHITA"; /* MKE CR-521, CR-522, CR-523 */static u_char family1[]="CR-56";    /* MKE CR-562, CR-563 */static u_char family2[]="CD200";    /* MKE CD200, Funai CD200F */static u_char familyL[]="LCS-7260"; /* Longshine LCS-7260 */static u_char familyT[]="CD-55";    /* TEAC CD-55A */static u_char familyV[]="ECS-AT";   /* ECS Vertos 100 */static u_int recursion; /* internal testing only */static u_int fatal_err; /* internal testing only */static u_int response_count;static u_int flags_cmd_out;static u_char cmd_type;static u_char drvcmd[10];static u_char infobuf[20];static u_char xa_head_buf[CD_XA_HEAD];static u_char xa_tail_buf[CD_XA_TAIL];#if OLD_BUSYstatic volatile u_char busy_data;static volatile u_char busy_audio; /* true semaphores would be safer */#endif /* OLD_BUSY */ static DECLARE_MUTEX(ioctl_read_sem);static u_long timeout;static volatile u_char timed_out_delay;static volatile u_char timed_out_data;#if 0static volatile u_char timed_out_audio;#endifstatic u_int datarate= 1000000;static u_int maxtim16=16000000;static u_int maxtim04= 4000000;static u_int maxtim02= 2000000;static u_int maxtim_8=   30000;#if LONG_TIMINGstatic u_int maxtim_data= 9000;#elsestatic u_int maxtim_data= 3000;#endif /* LONG_TIMING */ #if DISTRIBUTIONstatic int n_retries=6;#elsestatic int n_retries=6;#endif/*==========================================================================*/static int ndrives;static u_char drv_pattern[NR_SBPCD]={speed_auto,speed_auto,speed_auto,speed_auto};static int sbpcd_blocksizes[NR_SBPCD];/*==========================================================================*//* * drive space begins here (needed separate for each unit)  */static int d; /* DriveStruct index: drive number */static struct {	char drv_id;           /* "jumpered" drive ID or -1 */	char drv_sel;          /* drive select lines bits */		char drive_model[9];	u_char firmware_version[4];	char f_eject;          /* auto-eject flag: 0 or 1 */	u_char *sbp_buf;       /* Pointer to internal data buffer,				  space allocated during sbpcd_init() */	u_int sbp_bufsiz;      /* size of sbp_buf (# of frames) */	int sbp_first_frame;   /* First frame in buffer */	int sbp_last_frame;    /* Last frame in buffer  */	int sbp_read_frames;   /* Number of frames being read to buffer */	int sbp_current;       /* Frame being currently read */		u_char mode;           /* read_mode: READ_M1, READ_M2, READ_SC, READ_AU */	u_char *aud_buf;       /* Pointer to audio data buffer,				  space allocated during sbpcd_init() */	u_int sbp_audsiz;      /* size of aud_buf (# of raw frames) */	u_int drv_type;	u_char drv_options;	int status_bits;	u_char diskstate_flags;	u_char sense_byte;		u_char CD_changed;	char open_count;	u_char error_byte;		u_char f_multisession;	u_int lba_multi;	int first_session;	int last_session;	int track_of_last_session;		u_char audio_state;	u_int pos_audio_start;	u_int pos_audio_end;	char vol_chan0;	u_char vol_ctrl0;	char vol_chan1;	u_char vol_ctrl1;#if 000 /* no supported drive has it */	char vol_chan2;	u_char vol_ctrl2;	char vol_chan3;	u_char vol_ctrl3;#endif /*000 */	u_char volume_control; /* TEAC on/off bits */		u_char SubQ_ctl_adr;	u_char SubQ_trk;	u_char SubQ_pnt_idx;	u_int SubQ_run_tot;	u_int SubQ_run_trk;	u_char SubQ_whatisthis;		u_char UPC_ctl_adr;	u_char UPC_buf[7];		int frame_size;	int CDsize_frm;		u_char xa_byte; /* 0x20: XA capabilities */	u_char n_first_track; /* binary */	u_char n_last_track; /* binary (not bcd), 0x01...0x63 */	u_int size_msf; /* time of whole CD, position of LeadOut track */	u_int size_blk;		u_char TocEnt_nixbyte; /* em */	u_char TocEnt_ctl_adr;	u_char TocEnt_number;	u_char TocEnt_format; /* em */	u_int TocEnt_address;#if SAFE_MIXED	char has_data;#endif /* SAFE_MIXED */ 	u_char ored_ctl_adr; /* to detect if CDROM contains data tracks */		struct {		u_char nixbyte; /* em */		u_char ctl_adr; /* 0x4x: data, 0x0x: audio */		u_char number;		u_char format; /* em */ /* 0x00: lba, 0x01: msf */		u_int address;	} TocBuffer[MAX_TRACKS+1]; /* last entry faked */ 		int in_SpinUp; /* CR-52x test flag */	int n_bytes; /* TEAC awaited response count */	u_char error_state, b3, b4; /* TEAC command error state */	u_char f_drv_error; /* TEAC command error flag */	u_char speed_byte;	int frmsiz;	u_char f_XA; /* 1: XA */	u_char type_byte; /* 0, 1, 3 */	u_char mode_xb_6;	u_char mode_yb_7;	u_char mode_xb_8;	u_char delay;	struct cdrom_device_info *sbpcd_infop;} D_S[NR_SBPCD];/* * drive space ends here (needed separate for each unit) *//*==========================================================================*/#if 0unsigned long cli_sti; /* for saving the processor flags */#endif/*==========================================================================*/static struct timer_list delay_timer = { function: mark_timeout_delay};static struct timer_list data_timer = { function: mark_timeout_data};#if 0static struct timer_list audio_timer = { function: mark_timeout_audio};#endif/*==========================================================================*//* * DDI interface */static void msg(int level, const char *fmt, ...){#if DISTRIBUTION#define MSG_LEVEL KERN_NOTICE#else#define MSG_LEVEL KERN_INFO#endif /* DISTRIBUTION */	char buf[256];	va_list args;		if (!(sbpcd_debug&(1<<level))) return;		msgnum++;	if (msgnum>99) msgnum=0;	sprintf(buf, MSG_LEVEL "%s-%d [%02d]:  ", major_name, d, msgnum);	va_start(args, fmt);	vsprintf(&buf[18], fmt, args);	va_end(args);	printk(buf);#if KLOGD_PAUSE	sbp_sleep(KLOGD_PAUSE); /* else messages get lost */#endif /* KLOGD_PAUSE */ 	return;}/*==========================================================================*//* * DDI interface: runtime trace bit pattern maintenance */static int sbpcd_dbg_ioctl(unsigned long arg, int level){	switch(arg)	{	case 0:	/* OFF */		sbpcd_debug = DBG_INF;		break;			default:		if (arg>=128) sbpcd_debug &= ~(1<<(arg-128));		else sbpcd_debug |= (1<<arg);	}	return (arg);}/*==========================================================================*/static void mark_timeout_delay(u_long i){

⌨️ 快捷键说明

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