亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? pcd.c

?? Linux塊設備驅動源碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* 	pcd.c	(c) 1997-8  Grant R. Guenther <grant@torque.net>		            Under the terms of the GNU General Public License.	This is a high-level driver for parallel port ATAPI CD-ROM        drives based on chips supported by the paride module.        By default, the driver will autoprobe for a single parallel        port ATAPI CD-ROM drive, but if their individual parameters are        specified, the driver can handle up to 4 drives.        The behaviour of the pcd driver can be altered by setting        some parameters from the insmod command line.  The following        parameters are adjustable:            drive0      These four arguments can be arrays of                   drive1      1-6 integers as follows:            drive2            drive3      <prt>,<pro>,<uni>,<mod>,<slv>,<dly>                        Where,                <prt>   is the base of the parallel port address for                        the corresponding drive.  (required)                <pro>   is the protocol number for the adapter that                        supports this drive.  These numbers are                        logged by 'paride' when the protocol modules                        are initialised.  (0 if not given)                <uni>   for those adapters that support chained                        devices, this is the unit selector for the                        chain of devices on the given port.  It should                        be zero for devices that don't support chaining.                        (0 if not given)                <mod>   this can be -1 to choose the best mode, or one                        of the mode numbers supported by the adapter.                        (-1 if not given)		<slv>   ATAPI CD-ROMs can be jumpered to master or slave.			Set this to 0 to choose the master drive, 1 to                        choose the slave, -1 (the default) to choose the			first drive found.                <dly>   some parallel ports require the driver to                         go more slowly.  -1 sets a default value that                        should work with the chosen protocol.  Otherwise,                        set this to a small integer, the larger it is                        the slower the port i/o.  In some cases, setting                        this to zero will speed up the device. (default -1)                                    major       You may use this parameter to overide the                        default major number (46) that this driver                        will use.  Be sure to change the device                        name as well.            name        This parameter is a character string that                        contains the name the kernel will use for this                        device (in /proc output, for instance).                        (default "pcd")            verbose     This parameter controls the amount of logging                        that the driver will do.  Set it to 0 for                        normal operation, 1 to see autoprobe progress                        messages, or 2 to see additional debugging                        output.  (default 0)              nice        This parameter controls the driver's use of                        idle CPU time, at the expense of some speed. 	If this driver is built into the kernel, you can use kernel        the following command line parameters, with the same values        as the corresponding module parameters listed above:	    pcd.drive0	    pcd.drive1	    pcd.drive2	    pcd.drive3	    pcd.nice        In addition, you can use the parameter pcd.disable to disable        the driver entirely.*//* Changes:	1.01	GRG 1998.01.24	Added test unit ready support	1.02    GRG 1998.05.06  Changes to pcd_completion, ready_wait,				and loosen interpretation of ATAPI			        standard for clearing error status.				Use spinlocks. Eliminate sti().	1.03    GRG 1998.06.16  Eliminated an Ugh	1.04	GRG 1998.08.15  Added extra debugging, improvements to				pcd_completion, use HZ in loop timing	1.05	GRG 1998.08.16	Conformed to "Uniform CD-ROM" standard	1.06    GRG 1998.08.19  Added audio ioctl support	1.07    GRG 1998.09.24  Increased reset timeout, added jumbo support*/#define	PCD_VERSION	"1.07"#define PCD_MAJOR	46#define PCD_NAME	"pcd"#define PCD_UNITS	4/* Here are things one can override from the insmod command.   Most are autoprobed by paride unless set here.  Verbose is off   by default.*/static int verbose = 0;static int major = PCD_MAJOR;static char *name = PCD_NAME;static int nice = 0;static int disable = 0;static int drive0[6] = { 0, 0, 0, -1, -1, -1 };static int drive1[6] = { 0, 0, 0, -1, -1, -1 };static int drive2[6] = { 0, 0, 0, -1, -1, -1 };static int drive3[6] = { 0, 0, 0, -1, -1, -1 };static int (*drives[4])[6] = {&drive0, &drive1, &drive2, &drive3};static int pcd_drive_count;enum {D_PRT, D_PRO, D_UNI, D_MOD, D_SLV, D_DLY};/* end of parameters */#include <linux/module.h>#include <linux/init.h>#include <linux/errno.h>#include <linux/fs.h>#include <linux/kernel.h>#include <linux/delay.h>#include <linux/cdrom.h>#include <linux/spinlock.h>#include <linux/blkdev.h>#include <asm/uaccess.h>static spinlock_t pcd_lock;module_param(verbose, bool, 0644);module_param(major, int, 0);module_param(name, charp, 0);module_param(nice, int, 0);module_param_array(drive0, int, NULL, 0);module_param_array(drive1, int, NULL, 0);module_param_array(drive2, int, NULL, 0);module_param_array(drive3, int, NULL, 0);#include "paride.h"#include "pseudo.h"#define PCD_RETRIES	     5#define PCD_TMO		   800	/* timeout in jiffies */#define PCD_DELAY           50	/* spin delay in uS */#define PCD_READY_TMO	    20	/* in seconds */#define PCD_RESET_TMO	   100	/* in tenths of a second */#define PCD_SPIN	(1000000*PCD_TMO)/(HZ*PCD_DELAY)#define IDE_ERR		0x01#define IDE_DRQ         0x08#define IDE_READY       0x40#define IDE_BUSY        0x80static int pcd_open(struct cdrom_device_info *cdi, int purpose);static void pcd_release(struct cdrom_device_info *cdi);static int pcd_drive_status(struct cdrom_device_info *cdi, int slot_nr);static int pcd_media_changed(struct cdrom_device_info *cdi, int slot_nr);static int pcd_tray_move(struct cdrom_device_info *cdi, int position);static int pcd_lock_door(struct cdrom_device_info *cdi, int lock);static int pcd_drive_reset(struct cdrom_device_info *cdi);static int pcd_get_mcn(struct cdrom_device_info *cdi, struct cdrom_mcn *mcn);static int pcd_audio_ioctl(struct cdrom_device_info *cdi,			   unsigned int cmd, void *arg);static int pcd_packet(struct cdrom_device_info *cdi,		      struct packet_command *cgc);static int pcd_detect(void);static void pcd_probe_capabilities(void);static void do_pcd_read_drq(void);static void do_pcd_request(request_queue_t * q);static void do_pcd_read(void);struct pcd_unit {	struct pi_adapter pia;	/* interface to paride layer */	struct pi_adapter *pi;	int drive;		/* master/slave */	int last_sense;		/* result of last request sense */	int changed;		/* media change seen */	int present;		/* does this unit exist ? */	char *name;		/* pcd0, pcd1, etc */	struct cdrom_device_info info;	/* uniform cdrom interface */	struct gendisk *disk;};static struct pcd_unit pcd[PCD_UNITS];static char pcd_scratch[64];static char pcd_buffer[2048];	/* raw block buffer */static int pcd_bufblk = -1;	/* block in buffer, in CD units,				   -1 for nothing there. See also				   pd_unit.				 *//* the variables below are used mainly in the I/O request engine, which   processes only one request at a time.*/static struct pcd_unit *pcd_current; /* current request's drive */static struct request *pcd_req;static int pcd_retries;		/* retries on current request */static int pcd_busy;		/* request being processed ? */static int pcd_sector;		/* address of next requested sector */static int pcd_count;		/* number of blocks still to do */static char *pcd_buf;		/* buffer for request in progress */static int pcd_warned;		/* Have we logged a phase warning ? *//* kernel glue structures */static int pcd_block_open(struct inode *inode, struct file *file){	struct pcd_unit *cd = inode->i_bdev->bd_disk->private_data;	return cdrom_open(&cd->info, inode, file);}static int pcd_block_release(struct inode *inode, struct file *file){	struct pcd_unit *cd = inode->i_bdev->bd_disk->private_data;	return cdrom_release(&cd->info, file);}static int pcd_block_ioctl(struct inode *inode, struct file *file,				unsigned cmd, unsigned long arg){	struct pcd_unit *cd = inode->i_bdev->bd_disk->private_data;	return cdrom_ioctl(file, &cd->info, inode, cmd, arg);}static int pcd_block_media_changed(struct gendisk *disk){	struct pcd_unit *cd = disk->private_data;	return cdrom_media_changed(&cd->info);}static struct block_device_operations pcd_bdops = {	.owner		= THIS_MODULE,	.open		= pcd_block_open,	.release	= pcd_block_release,	.ioctl		= pcd_block_ioctl,	.media_changed	= pcd_block_media_changed,};static struct cdrom_device_ops pcd_dops = {	.open		= pcd_open,	.release	= pcd_release,	.drive_status	= pcd_drive_status,	.media_changed	= pcd_media_changed,	.tray_move	= pcd_tray_move,	.lock_door	= pcd_lock_door,	.get_mcn	= pcd_get_mcn,	.reset		= pcd_drive_reset,	.audio_ioctl	= pcd_audio_ioctl,	.generic_packet	= pcd_packet,	.capability	= CDC_CLOSE_TRAY | CDC_OPEN_TRAY | CDC_LOCK |			  CDC_MCN | CDC_MEDIA_CHANGED | CDC_RESET |			  CDC_PLAY_AUDIO | CDC_GENERIC_PACKET | CDC_CD_R |			  CDC_CD_RW,};static void pcd_init_units(void){	struct pcd_unit *cd;	int unit;	pcd_drive_count = 0;	for (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++) {		struct gendisk *disk = alloc_disk(1);		if (!disk)			continue;		cd->disk = disk;		cd->pi = &cd->pia;		cd->present = 0;		cd->last_sense = 0;		cd->changed = 1;		cd->drive = (*drives[unit])[D_SLV];		if ((*drives[unit])[D_PRT])			pcd_drive_count++;		cd->name = &cd->info.name[0];		snprintf(cd->name, sizeof(cd->info.name), "%s%d", name, unit);		cd->info.ops = &pcd_dops;		cd->info.handle = cd;		cd->info.speed = 0;		cd->info.capacity = 1;		cd->info.mask = 0;		disk->major = major;		disk->first_minor = unit;		strcpy(disk->disk_name, cd->name);	/* umm... */		disk->fops = &pcd_bdops;	}}static int pcd_open(struct cdrom_device_info *cdi, int purpose){	struct pcd_unit *cd = cdi->handle;	if (!cd->present)		return -ENODEV;	return 0;}static void pcd_release(struct cdrom_device_info *cdi){}static inline int status_reg(struct pcd_unit *cd){	return pi_read_regr(cd->pi, 1, 6);}static inline int read_reg(struct pcd_unit *cd, int reg){	return pi_read_regr(cd->pi, 0, reg);}static inline void write_reg(struct pcd_unit *cd, int reg, int val){	pi_write_regr(cd->pi, 0, reg, val);}static int pcd_wait(struct pcd_unit *cd, int go, int stop, char *fun, char *msg){	int j, r, e, s, p;	j = 0;	while ((((r = status_reg(cd)) & go) || (stop && (!(r & stop))))	       && (j++ < PCD_SPIN))		udelay(PCD_DELAY);	if ((r & (IDE_ERR & stop)) || (j >= PCD_SPIN)) {		s = read_reg(cd, 7);		e = read_reg(cd, 1);		p = read_reg(cd, 2);		if (j >= PCD_SPIN)			e |= 0x100;		if (fun)			printk("%s: %s %s: alt=0x%x stat=0x%x err=0x%x"			       " loop=%d phase=%d\n",			       cd->name, fun, msg, r, s, e, j, p);		return (s << 8) + r;	}	return 0;}static int pcd_command(struct pcd_unit *cd, char *cmd, int dlen, char *fun){	pi_connect(cd->pi);	write_reg(cd, 6, 0xa0 + 0x10 * cd->drive);	if (pcd_wait(cd, IDE_BUSY | IDE_DRQ, 0, fun, "before command")) {		pi_disconnect(cd->pi);		return -1;	}	write_reg(cd, 4, dlen % 256);	write_reg(cd, 5, dlen / 256);	write_reg(cd, 7, 0xa0);	/* ATAPI packet command */	if (pcd_wait(cd, IDE_BUSY, IDE_DRQ, fun, "command DRQ")) {		pi_disconnect(cd->pi);		return -1;	}	if (read_reg(cd, 2) != 1) {		printk("%s: %s: command phase error\n", cd->name, fun);		pi_disconnect(cd->pi);		return -1;	}	pi_write_block(cd->pi, cmd, 12);	return 0;}static int pcd_completion(struct pcd_unit *cd, char *buf, char *fun){	int r, d, p, n, k, j;	r = -1;	k = 0;	j = 0;	if (!pcd_wait(cd, IDE_BUSY, IDE_DRQ | IDE_READY | IDE_ERR,		      fun, "completion")) {		r = 0;		while (read_reg(cd, 7) & IDE_DRQ) {			d = read_reg(cd, 4) + 256 * read_reg(cd, 5);			n = (d + 3) & 0xfffc;			p = read_reg(cd, 2) & 3;			if ((p == 2) && (n > 0) && (j == 0)) {				pi_read_block(cd->pi, buf, n);				if (verbose > 1)					printk("%s: %s: Read %d bytes\n",					       cd->name, fun, n);				r = 0;				j++;			} else {				if (verbose > 1)					printk					    ("%s: %s: Unexpected phase %d, d=%d, k=%d\n",					     cd->name, fun, p, d, k);				if ((verbose < 2) && !pcd_warned) {					pcd_warned = 1;					printk					    ("%s: WARNING: ATAPI phase errors\n",					     cd->name);				}				mdelay(1);			}			if (k++ > PCD_TMO) {				printk("%s: Stuck DRQ\n", cd->name);				break;			}			if (pcd_wait			    (cd, IDE_BUSY, IDE_DRQ | IDE_READY | IDE_ERR, fun,			     "completion")) {				r = -1;				break;			}		}	}	pi_disconnect(cd->pi);	return r;}static void pcd_req_sense(struct pcd_unit *cd, char *fun){	char rs_cmd[12] = { 0x03, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0 };	char buf[16];	int r, c;	r = pcd_command(cd, rs_cmd, 16, "Request sense");	mdelay(1);	if (!r)		pcd_completion(cd, buf, "Request sense");	cd->last_sense = -1;	c = 2;	if (!r) {		if (fun)			printk("%s: %s: Sense key: %x, ASC: %x, ASQ: %x\n",			       cd->name, fun, buf[2] & 0xf, buf[12], buf[13]);		c = buf[2] & 0xf;		cd->last_sense =		    c | ((buf[12] & 0xff) << 8) | ((buf[13] & 0xff) << 16);	}	if ((c == 2) || (c == 6))		cd->changed = 1;}static int pcd_atapi(struct pcd_unit *cd, char *cmd, int dlen, char *buf, char *fun){	int r;	r = pcd_command(cd, cmd, dlen, fun);	mdelay(1);	if (!r)		r = pcd_completion(cd, buf, fun);	if (r)		pcd_req_sense(cd, fun);	return r;}static int pcd_packet(struct cdrom_device_info *cdi, struct packet_command *cgc){	return pcd_atapi(cdi->handle, cgc->cmd, cgc->buflen, cgc->buffer,

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品久久久久毛片软件| 日韩和的一区二区| 国产日韩欧美综合在线| 欧美精品一区二区三区高清aⅴ | 亚洲精品伦理在线| 亚洲欧美日韩久久| 亚洲女人小视频在线观看| 亚洲免费观看高清完整版在线观看| 中文字幕国产一区二区| 久久精品人人做| 亚洲国产成人在线| 中文字幕一区二区三区视频| 国产精品麻豆久久久| 中文字幕中文在线不卡住| 成人欧美一区二区三区在线播放| 亚洲欧美日本韩国| 夜夜亚洲天天久久| 日产欧产美韩系列久久99| 蜜桃91丨九色丨蝌蚪91桃色| 韩国成人福利片在线播放| 国产一区免费电影| 国产精品香蕉一区二区三区| 成人av免费在线| 91麻豆国产精品久久| 在线精品视频一区二区三四 | 国产午夜精品一区二区三区嫩草 | 欧美日韩国产免费| 91精品国产综合久久香蕉麻豆| 日韩欧美视频一区| 国产亚洲综合色| 亚洲人成网站在线| 性做久久久久久免费观看欧美| 免费成人av资源网| 国产成人av一区二区三区在线| 99久久伊人久久99| 精品视频资源站| 亚洲精品一区二区精华| 国产精品久久网站| 亚洲国产你懂的| 精品制服美女丁香| 成av人片一区二区| 制服丝袜成人动漫| 国产女主播在线一区二区| 一区二区三区精品在线观看| 蜜臀av性久久久久蜜臀aⅴ四虎 | 粉嫩aⅴ一区二区三区四区五区| 色天使久久综合网天天| 欧美一激情一区二区三区| 国产欧美一区二区在线观看| 一区二区三区四区av| 麻豆成人91精品二区三区| 成人一级片在线观看| 欧美高清激情brazzers| 国产日产亚洲精品系列| 一区二区三区蜜桃| 国产一区二区三区四区五区美女| 91麻豆免费观看| 久久伊99综合婷婷久久伊| 亚洲一区二区三区小说| 国产毛片精品一区| 欧美日韩国产系列| 亚洲欧洲日产国产综合网| 美女免费视频一区二区| 91色.com| 国产拍揄自揄精品视频麻豆| 婷婷久久综合九色综合伊人色| 国产麻豆日韩欧美久久| 8x福利精品第一导航| 日韩理论片中文av| 国产久卡久卡久卡久卡视频精品| 欧美色图免费看| 一区在线观看视频| 激情六月婷婷综合| 欧美老肥妇做.爰bbww| 椎名由奈av一区二区三区| 精品一区二区三区免费毛片爱| 91久久精品午夜一区二区| 欧美经典一区二区三区| 日本不卡高清视频| 欧美三级电影网站| 亚洲人成网站在线| 成人三级在线视频| 亚洲精品在线观看网站| 奇米888四色在线精品| 欧美日韩在线播放一区| 一区二区三区精品在线观看| 成人av电影在线播放| 久久免费电影网| 老司机精品视频在线| 欧美日本一区二区三区| 亚洲另类在线视频| av亚洲精华国产精华| 国产日产欧产精品推荐色| 久久99精品久久只有精品| 欧美一区二区三区免费大片| 一区二区三区蜜桃网| 一本大道久久a久久精二百| 国产精品午夜电影| 顶级嫩模精品视频在线看| 国产欧美视频一区二区三区| 国产一区二区看久久| 久久久电影一区二区三区| 韩国成人福利片在线播放| 亚洲人123区| 国产精品亲子乱子伦xxxx裸| 国产美女一区二区| 精品少妇一区二区三区在线视频| 亚洲成人资源在线| 欧美日韩精品福利| 亚洲国产裸拍裸体视频在线观看乱了 | 99久久国产综合精品女不卡| 一区在线播放视频| 日本韩国欧美三级| 亚洲综合一二区| 欧美精品第一页| 美女www一区二区| www欧美成人18+| 国产91精品露脸国语对白| **欧美大码日韩| 欧美在线免费视屏| 日本午夜精品视频在线观看| 日韩免费观看高清完整版| 国产一区二区在线观看视频| 欧美国产精品一区| 色婷婷久久一区二区三区麻豆| 亚洲成a人片在线不卡一二三区| 91超碰这里只有精品国产| 久久99久久久久| 国产精品女主播av| 欧洲人成人精品| 毛片av一区二区| 国产欧美日韩激情| 色av一区二区| 麻豆国产精品一区二区三区| 久久久久国产精品厨房| 99热这里都是精品| 日韩成人dvd| 中文在线资源观看网站视频免费不卡| 99v久久综合狠狠综合久久| 婷婷开心久久网| 国产精品热久久久久夜色精品三区| 一本高清dvd不卡在线观看| 日韩不卡手机在线v区| 国产拍揄自揄精品视频麻豆| 91久久精品一区二区二区| 久色婷婷小香蕉久久| 亚洲欧洲精品一区二区三区不卡 | 亚洲综合色视频| 亚洲精品一区二区三区精华液| 91视频国产观看| 美女免费视频一区| 亚洲欧美日韩人成在线播放| 欧美成人艳星乳罩| 色婷婷久久99综合精品jk白丝 | av在线综合网| 麻豆精品视频在线观看免费| 亚洲欧美日韩久久| www成人在线观看| 欧美少妇bbb| eeuss鲁一区二区三区| 热久久久久久久| 亚洲黄网站在线观看| 久久精品欧美一区二区三区不卡| 欧美视频自拍偷拍| 粉嫩13p一区二区三区| 日韩在线a电影| 日韩一区在线看| 国产亚洲精品7777| 日韩一区二区三区免费观看| 色婷婷av一区| 成人污视频在线观看| 久久精品国产在热久久| 亚洲综合在线第一页| 国产精品日韩精品欧美在线| 日韩欧美中文字幕公布| 欧美影片第一页| 99国产精品国产精品久久| 国产精品18久久久久| 强制捆绑调教一区二区| 亚洲已满18点击进入久久| 国产精品国产成人国产三级| 久久综合中文字幕| 91精品国产免费| 欧美日韩国产综合草草| 一本色道久久综合狠狠躁的推荐| 国产精品一二三四区| 激情亚洲综合在线| 亚洲成人一区在线| 一区2区3区在线看| 亚洲黄色小视频| 亚洲欧美综合网| 亚洲四区在线观看| 国产精品视频观看| 久久精品无码一区二区三区| 精品日韩一区二区三区| 欧美一级淫片007| 日韩一区二区三区视频在线| 欧美精品日韩综合在线| 欧美美女bb生活片| 欧美日韩精品一区二区天天拍小说|