亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
免费在线欧美视频| 亚洲一区二区欧美激情| 另类专区欧美蜜桃臀第一页| 9191精品国产综合久久久久久| 视频在线观看一区二区三区| 91精品国产品国语在线不卡| 激情五月播播久久久精品| 国产人妖乱国产精品人妖| 99久久99久久久精品齐齐| 亚洲精品va在线观看| 91福利国产成人精品照片| 天堂蜜桃91精品| 精品国产电影一区二区| 粉嫩蜜臀av国产精品网站| 一区二区在线电影| 欧美精品123区| 国产凹凸在线观看一区二区| 蜜臀av性久久久久av蜜臀妖精| 欧美日韩高清在线| 蜜臀av性久久久久av蜜臀妖精| 国产日韩欧美综合在线| 91蜜桃在线免费视频| 首页国产欧美日韩丝袜| 国产日韩欧美亚洲| 欧美性受xxxx| 精品一区二区在线播放| 国产精品三级视频| 欧美日韩精品福利| 国产+成+人+亚洲欧洲自线| 亚洲日本乱码在线观看| 日韩一区二区在线观看| 成人高清视频在线| 日韩精品色哟哟| 国产精品国产a| 91精品国产手机| 99久久精品99国产精品| 美洲天堂一区二卡三卡四卡视频| 中文字幕日韩av资源站| 日韩精品一区在线| 色天使色偷偷av一区二区| 免费黄网站欧美| 亚洲精品欧美二区三区中文字幕| 欧美一区二区三区成人| 色综合一个色综合| 国产精品自拍一区| 亚洲一区二区高清| 国产婷婷色一区二区三区四区| 欧美午夜影院一区| 成人国产精品免费观看| 韩国三级中文字幕hd久久精品| 亚洲成人高清在线| 国产精品久久一级| 欧美精品一区二区三区一线天视频 | 99精品久久只有精品| 捆绑调教美女网站视频一区| 亚洲精品自拍动漫在线| 欧美激情一区二区三区蜜桃视频| 日韩精品中文字幕一区二区三区| 欧美日韩另类一区| 色哟哟一区二区| av亚洲精华国产精华精华| 国产精品一区2区| 国产在线一区观看| 日本不卡的三区四区五区| 亚洲电影一级片| 一区二区三区在线视频观看| 国产精品久久二区二区| 欧美国产精品劲爆| 国产午夜精品理论片a级大结局 | 亚洲视频一区在线观看| 国产欧美日韩卡一| 国产日韩欧美综合一区| 久久久99精品免费观看不卡| 久久蜜桃香蕉精品一区二区三区| 欧美大肚乱孕交hd孕妇| 日韩午夜在线观看视频| 日韩精品最新网址| 日韩三级视频在线观看| 欧美mv和日韩mv的网站| 精品免费国产二区三区| 久久亚洲一区二区三区明星换脸 | 欧美丝袜丝交足nylons| 欧美影视一区二区三区| 欧美午夜视频网站| 精品视频一区二区三区免费| 欧美三级一区二区| 69久久99精品久久久久婷婷| 日韩精品自拍偷拍| 久久精品欧美一区二区三区麻豆| 久久色视频免费观看| 国产精品久久久久久久久快鸭 | 欧美亚日韩国产aⅴ精品中极品| 欧美系列在线观看| 欧美一区二区高清| 精品国产百合女同互慰| 欧美激情综合网| 尤物在线观看一区| 日产国产欧美视频一区精品| 国产在线播放一区| 高清av一区二区| 在线视频欧美精品| 91精品国产免费| 久久夜色精品国产噜噜av| 最新日韩在线视频| 亚洲另类春色校园小说| 男男成人高潮片免费网站| 国产精品影视在线观看| 色先锋资源久久综合| 欧美一级黄色大片| 中文字幕二三区不卡| 亚洲国产精品自拍| 国产一区二区三区免费看| 一本到不卡精品视频在线观看| 日韩一二三区不卡| 国产欧美精品一区二区色综合 | 国产精品久久一卡二卡| 婷婷国产v国产偷v亚洲高清| 国产成人av一区| 欧美乱妇15p| 日韩毛片精品高清免费| 日本aⅴ精品一区二区三区| 国产成人av电影在线播放| 欧美视频在线不卡| 国产午夜精品在线观看| 亚洲.国产.中文慕字在线| 国产白丝精品91爽爽久久| 欧美久久久久久久久久| 中文字幕亚洲欧美在线不卡| 麻豆国产精品一区二区三区| 91麻豆精品视频| 久久精品人人做人人综合 | 欧美精品粉嫩高潮一区二区| 国产女同互慰高潮91漫画| 日韩电影在线观看电影| 色综合网色综合| 国产欧美综合在线观看第十页 | 久久久精品人体av艺术| 亚洲国产美女搞黄色| av电影天堂一区二区在线| 精品国产免费人成在线观看| 亚洲一区av在线| 色综合久久中文综合久久97| 久久久久久久久久久久久久久99 | 欧美一区三区二区| 国产精品伦一区二区三级视频| 美女一区二区三区在线观看| 欧洲亚洲精品在线| 国产精品视频一区二区三区不卡| 蜜桃视频一区二区三区| 欧美老肥妇做.爰bbww视频| 亚洲免费观看高清| 成人av片在线观看| 久久久久久久久久久久电影| 久久丁香综合五月国产三级网站 | 91啪亚洲精品| 国产精品另类一区| 国产高清成人在线| 欧美精品一区二区久久婷婷| 蜜臀久久99精品久久久久久9| 欧美老女人在线| 亚洲观看高清完整版在线观看| 色婷婷久久一区二区三区麻豆| 亚洲视频电影在线| av亚洲精华国产精华| 日韩理论在线观看| 91在线高清观看| 亚洲日本va在线观看| 91免费版在线看| 亚洲在线免费播放| 欧美天堂亚洲电影院在线播放| 亚洲高清不卡在线| 欧美日本免费一区二区三区| 日韩vs国产vs欧美| 日韩天堂在线观看| 国产麻豆精品在线观看| 国产欧美一区二区三区沐欲| www.欧美亚洲| 一区二区在线免费| 欧美高清性hdvideosex| 青青草国产成人99久久| 欧美不卡123| 国产suv精品一区二区6| 一色屋精品亚洲香蕉网站| 色婷婷综合激情| 日韩高清不卡一区| 久久人人超碰精品| www.亚洲色图.com| 亚洲自拍都市欧美小说| 欧美一区日本一区韩国一区| 久久99国产乱子伦精品免费| 国产免费观看久久| 色婷婷综合久色| 日韩1区2区日韩1区2区| 26uuu国产电影一区二区| 成人性生交大片免费看视频在线| 国产精品久线在线观看| 欧美日韩国产一二三| 国产麻豆精品在线| 一区二区三区四区不卡在线 | 国产精选一区二区三区|