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

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

?? pt.c

?? 這個linux源代碼是很全面的~基本完整了~使用c編譯的~由于時間問題我沒有親自測試~但就算用來做參考資料也是非常好的
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*         pt.c    (c) 1998  Grant R. Guenther <grant@torque.net>                          Under the terms of the GNU General Public License.        This is the high-level driver for parallel port ATAPI tape        drives based on chips supported by the paride module.	The driver implements both rewinding and non-rewinding	devices, filemarks, and the rewind ioctl.  It allocates	a small internal "bounce buffer" for each open device, but        otherwise expects buffering and blocking to be done at the        user level.  As with most block-structured tapes, short	writes are padded to full tape blocks, so reading back a file        may return more data than was actually written.        By default, the driver will autoprobe for a single parallel        port ATAPI tape drive, but if their individual parameters are        specified, the driver can handle up to 4 drives.	The rewinding devices are named /dev/pt0, /dev/pt1, ...	while the non-rewinding devices are /dev/npt0, /dev/npt1, etc.        The behaviour of the pt 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 devices 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 (96) 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 "pt").            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)         If this driver is built into the kernel, you can use         the following command line parameters, with the same values        as the corresponding module parameters listed above:            pt.drive0            pt.drive1            pt.drive2            pt.drive3        In addition, you can use the parameter pt.disable to disable        the driver entirely.*//*   Changes:	1.01	GRG 1998.05.06	Round up transfer size, fix ready_wait,			        loosed interpretation of ATAPI standard				for clearing error status.				Eliminate sti();	1.02    GRG 1998.06.16  Eliminate an Ugh.	1.03    GRG 1998.08.15  Adjusted PT_TMO, use HZ in loop timing,				extra debugging	1.04    GRG 1998.09.24  Repair minor coding error, added jumbo support	*/#define PT_VERSION      "1.04"#define PT_MAJOR	96#define PT_NAME		"pt"#define PT_UNITS	4/* Here are things one can override from the insmod command.   Most are autoprobed by paride unless set here.  Verbose is on   by default.*/static int	verbose = 0;static int	major = PT_MAJOR;static char	*name = PT_NAME;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 pt_drive_count;#define D_PRT   0#define D_PRO   1#define D_UNI   2#define D_MOD   3#define D_SLV   4#define D_DLY   5#define DU              (*drives[unit])/* end of parameters */#include <linux/module.h>#include <linux/errno.h>#include <linux/fs.h>#include <linux/devfs_fs_kernel.h>#include <linux/kernel.h>#include <linux/delay.h>#include <linux/slab.h>#include <linux/mtio.h>#include <linux/wait.h>#include <linux/smp_lock.h>#include <asm/uaccess.h>#ifndef MODULE#include "setup.h"static STT pt_stt[5] = {{"drive0",6,drive0},                        {"drive1",6,drive1},                        {"drive2",6,drive2},                        {"drive3",6,drive3},			{"disable",1,&disable}};void pt_setup( char *str, int *ints){       generic_setup(pt_stt,5,str);}#endifMODULE_PARM(verbose,"i");MODULE_PARM(major,"i");MODULE_PARM(name,"s");MODULE_PARM(drive0,"1-6i");MODULE_PARM(drive1,"1-6i");MODULE_PARM(drive2,"1-6i");MODULE_PARM(drive3,"1-6i");#include "paride.h"#define PT_MAX_RETRIES  5#define PT_TMO          3000            /* interrupt timeout in jiffies */#define PT_SPIN_DEL     50              /* spin delay in micro-seconds  */#define PT_RESET_TMO    30		/* 30 seconds */#define PT_READY_TMO	60		/* 60 seconds */#define PT_REWIND_TMO	1200		/* 20 minutes */#define PT_SPIN         ((1000000/(HZ*PT_SPIN_DEL))*PT_TMO)  #define STAT_ERR        0x00001#define STAT_INDEX      0x00002#define STAT_ECC        0x00004#define STAT_DRQ        0x00008#define STAT_SEEK       0x00010#define STAT_WRERR      0x00020#define STAT_READY      0x00040#define STAT_BUSY       0x00080#define STAT_SENSE	0x1f000#define ATAPI_TEST_READY	0x00#define ATAPI_REWIND		0x01#define ATAPI_REQ_SENSE		0x03#define ATAPI_READ_6		0x08#define ATAPI_WRITE_6		0x0a#define ATAPI_WFM		0x10#define ATAPI_IDENTIFY		0x12#define ATAPI_MODE_SENSE	0x1a#define ATAPI_LOG_SENSE		0x4dint pt_init(void);#ifdef MODULEvoid cleanup_module( void );#endifstatic int pt_open(struct inode *inode, struct file *file);static int pt_ioctl(struct inode *inode,struct file *file,                    unsigned int cmd, unsigned long arg);static int pt_release (struct inode *inode, struct file *file);static ssize_t pt_read(struct file * filp, char * buf,                        size_t count, loff_t *ppos);static ssize_t pt_write(struct file * filp, const char * buf,                         size_t count, loff_t *ppos);static int pt_detect(void);static int pt_identify (int unit);/* bits in PT.flags */#define PT_MEDIA	1#define PT_WRITE_OK	2#define PT_REWIND	4#define PT_WRITING      8#define PT_READING     16#define PT_EOF	       32#define PT_NAMELEN      8#define PT_BUFSIZE  16384struct pt_unit {	struct pi_adapter pia;    /* interface to paride layer */	struct pi_adapter *pi;	int flags;        	  /* various state flags */	int last_sense;		  /* result of last request sense */	int drive;		  /* drive */	int access;               /* count of active opens ... */	int bs;			  /* block size */	int capacity;             /* Size of tape in KB */	int present;		  /* device present ? */	char *bufptr;	char name[PT_NAMELEN];	  /* pf0, pf1, ... */	};struct pt_unit pt[PT_UNITS];/*  'unit' must be defined in all functions - either as a local or a param */#define PT pt[unit]#define PI PT.pistatic char pt_scratch[512];            /* scratch block buffer *//* kernel glue structures */static struct file_operations pt_fops = {	owner:		THIS_MODULE,	read:		pt_read,	write:		pt_write,	ioctl:		pt_ioctl,	open:		pt_open,	release:	pt_release,};void pt_init_units( void ){       int     unit, j;        pt_drive_count = 0;        for (unit=0;unit<PT_UNITS;unit++) {                PT.pi = & PT.pia;                PT.access = 0;                PT.flags = 0;		PT.last_sense = 0;                PT.present = 0;		PT.bufptr = NULL;		PT.drive = DU[D_SLV];                j = 0;                while ((j < PT_NAMELEN-2) && (PT.name[j]=name[j])) j++;                PT.name[j++] = '0' + unit;                PT.name[j] = 0;                if (DU[D_PRT]) pt_drive_count++;        }} static devfs_handle_t devfs_handle;int pt_init (void)      /* preliminary initialisation */{       int unit;	if (disable) return -1;	pt_init_units();	if (pt_detect()) return -1;	if (devfs_register_chrdev(major,name,&pt_fops)) {                printk("pt_init: unable to get major number %d\n",                        major);	        for (unit=0;unit<PT_UNITS;unit++)        	  if (PT.present) pi_release(PI);                return -1;        }	devfs_handle = devfs_mk_dir (NULL, "pt", NULL);	devfs_register_series (devfs_handle, "%u", 4, DEVFS_FL_DEFAULT,			       major, 0, S_IFCHR | S_IRUSR | S_IWUSR,			       &pt_fops, NULL);	devfs_register_series (devfs_handle, "%un", 4, DEVFS_FL_DEFAULT,			       major, 128, S_IFCHR | S_IRUSR | S_IWUSR,			       &pt_fops, NULL);        return 0;}#ifdef MODULE/* Glue for modules ... */void    cleanup_module(void);int     init_module(void){       int     err;#ifdef PARIDE_JUMBO       { extern paride_init();         paride_init();       } #endif        err = pt_init();        return err;}void    cleanup_module(void){	int unit;	devfs_unregister (devfs_handle);	devfs_unregister_chrdev(major,name);	for (unit=0;unit<PT_UNITS;unit++)	  if (PT.present) pi_release(PI);}#endif#define	WR(c,r,v)	pi_write_regr(PI,c,r,v)#define	RR(c,r)		(pi_read_regr(PI,c,r))#define DRIVE           (0xa0+0x10*PT.drive)static int pt_wait( int unit, int go, int stop, char * fun, char * msg ){       int j, r, e, s, p;        j = 0;        while ((((r=RR(1,6))&go)||(stop&&(!(r&stop))))&&(j++<PT_SPIN))                udelay(PT_SPIN_DEL);        if ((r&(STAT_ERR&stop))||(j>=PT_SPIN)) {           s = RR(0,7);           e = RR(0,1);           p = RR(0,2);           if (j >= PT_SPIN) e |= 0x100;           if (fun) printk("%s: %s %s: alt=0x%x stat=0x%x err=0x%x"                           " loop=%d phase=%d\n",                            PT.name,fun,msg,r,s,e,j,p);           return (e<<8)+s;        }        return 0;}static int pt_command( int unit, char * cmd, int dlen, char * fun ){       pi_connect(PI);        WR(0,6,DRIVE);        if (pt_wait(unit,STAT_BUSY|STAT_DRQ,0,fun,"before command")) {                pi_disconnect(PI);                return -1;        }        WR(0,4,dlen % 256);        WR(0,5,dlen / 256);        WR(0,7,0xa0);          /* ATAPI packet command */        if (pt_wait(unit,STAT_BUSY,STAT_DRQ,fun,"command DRQ")) {                pi_disconnect(PI);                return -1;        }        if (RR(0,2) != 1) {           printk("%s: %s: command phase error\n",PT.name,fun);           pi_disconnect(PI);           return -1;        }        pi_write_block(PI,cmd,12);        return 0;}static int pt_completion( int unit, char * buf, char * fun ){       int r, s, n, p;        r = pt_wait(unit,STAT_BUSY,STAT_DRQ|STAT_READY|STAT_ERR,			fun,"completion");        if (RR(0,7)&STAT_DRQ) {            n = (((RR(0,4)+256*RR(0,5))+3)&0xfffc);	   p = RR(0,2)&3;	   if (p == 0) pi_write_block(PI,buf,n);	   if (p == 2) pi_read_block(PI,buf,n);        }        s = pt_wait(unit,STAT_BUSY,STAT_READY|STAT_ERR,fun,"data done");        pi_disconnect(PI);         return (r?r:s);}static void pt_req_sense( int unit, int quiet ){       char    rs_cmd[12] = { ATAPI_REQ_SENSE,0,0,0,16,0,0,0,0,0,0,0 };        char    buf[16];        int     r;        r = pt_command(unit,rs_cmd,16,"Request sense");        mdelay(1);        if (!r) pt_completion(unit,buf,"Request sense");	PT.last_sense = -1;        if (!r) {	    if (!quiet) printk("%s: Sense key: %x, ASC: %x, ASQ: %x\n",                                    PT.name,buf[2]&0xf,buf[12],buf[13]);	    PT.last_sense = (buf[2]&0xf) | ((buf[12]&0xff)<<8)					 | ((buf[13]&0xff)<<16) ;	} }static int pt_atapi( int unit, char * cmd, int dlen, char * buf, char * fun ){       int r;        r = pt_command(unit,cmd,dlen,fun);        mdelay(1);        if (!r) r = pt_completion(unit,buf,fun);        if (r) pt_req_sense(unit,!fun);                return r;}static void pt_sleep( int cs ){       current->state = TASK_INTERRUPTIBLE;        schedule_timeout(cs);}static int pt_poll_dsc( int unit, int pause, int tmo, char *msg ){	int	k, e, s;	k = 0; e = 0; s = 0;	while (k < tmo) {		pt_sleep(pause);		k++;		pi_connect(PI);		WR(0,6,DRIVE);		s = RR(0,7);		e = RR(0,1);		pi_disconnect(PI);		if (s & (STAT_ERR|STAT_SEEK)) break;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产午夜精品久久久久久免费视| 国产精品 日产精品 欧美精品| 亚洲自拍偷拍欧美| 爽好久久久欧美精品| 韩国一区二区在线观看| 一本久久精品一区二区| 欧美一卡二卡在线| 亚洲欧洲韩国日本视频| 欧美日韩一区三区四区| 精品久久久久99| 18涩涩午夜精品.www| 日本欧美一区二区三区乱码| 不卡视频在线看| 欧美一区二区三区爱爱| 亚洲人成小说网站色在线 | 国产午夜精品一区二区三区四区| 一区二区三区四区国产精品| 国产老肥熟一区二区三区| 欧美日韩一级大片网址| 国产精品妹子av| 久久丁香综合五月国产三级网站| 欧洲生活片亚洲生活在线观看| 久久蜜桃av一区精品变态类天堂| 亚洲国产成人tv| 99久久精品免费看国产免费软件| 亚洲精品在线观看网站| 日本大胆欧美人术艺术动态| 成人美女视频在线观看18| 日韩欧美国产一区二区在线播放| 欧美一区二区二区| 亚洲电影中文字幕在线观看| 91麻豆免费在线观看| 久久精品一区二区三区不卡 | 久久理论电影网| 日韩黄色免费电影| 欧美三级资源在线| 亚洲人妖av一区二区| 成a人片亚洲日本久久| 久久久精品国产99久久精品芒果| 麻豆国产精品一区二区三区| 91精品国产综合久久精品性色| 亚洲激情av在线| 一本色道久久综合亚洲aⅴ蜜桃| 最近日韩中文字幕| 成人美女视频在线观看18| 国产欧美日韩综合| av中文字幕一区| 久久精品免视看| 日本网站在线观看一区二区三区| 最新久久zyz资源站| 久久影院午夜片一区| 久久精品免费观看| 日韩免费在线观看| 国内精品在线播放| 国产欧美日韩一区二区三区在线观看| 精品一区中文字幕| 欧美激情一区二区| 99在线精品免费| 寂寞少妇一区二区三区| 国产色爱av资源综合区| 成人免费看黄yyy456| 亚洲丝袜自拍清纯另类| 欧美色图在线观看| 蜜桃av一区二区| 国产亚洲欧美日韩俺去了| 91色在线porny| 丝袜亚洲精品中文字幕一区| 精品国产乱码久久久久久浪潮| 国产成人av一区二区三区在线| 久久丁香综合五月国产三级网站| 国产精品99久久久久久久vr | 夜夜爽夜夜爽精品视频| 欧美日韩成人一区| 韩国v欧美v亚洲v日本v| 日韩毛片高清在线播放| 4438x成人网最大色成网站| 卡一卡二国产精品 | 精品久久久久久久久久久久包黑料| 国产精品影视天天线| 亚洲欧美国产毛片在线| 欧美一区2区视频在线观看| 成人精品在线视频观看| 亚洲国产成人va在线观看天堂| 精品国产91洋老外米糕| 99国产精品国产精品久久| 日韩福利视频网| 国产精品久久免费看| 欧美裸体一区二区三区| 成人中文字幕电影| 日本在线不卡视频| 亚洲欧美综合在线精品| 精品噜噜噜噜久久久久久久久试看| 国产精品羞羞答答xxdd | 日韩一区二区精品| 99精品视频在线播放观看| 日本不卡一二三区黄网| 一区在线观看视频| 精品美女一区二区| 欧美日韩午夜精品| 91丨porny丨首页| 国产一区二区三区黄视频 | 亚洲国产日日夜夜| 国产精品美女久久久久久| 日韩美一区二区三区| 欧美性大战久久久| 91丨九色丨蝌蚪丨老版| 国产一区二区三区在线观看精品 | 日韩avvvv在线播放| 亚洲精品国产第一综合99久久| 国产婷婷色一区二区三区在线| 欧美一区二区福利在线| 欧美日韩mp4| 国产色91在线| 久久精品国产第一区二区三区| 99精品欧美一区二区三区综合在线| 人妖欧美一区二区| 亚洲成av人片| 一区二区三区在线视频免费| 国产精品麻豆视频| 国产丝袜美腿一区二区三区| 欧美α欧美αv大片| 欧美一区二区三区四区五区| 欧美日韩精品综合在线| 欧美午夜一区二区三区| 欧美在线小视频| 一本大道久久精品懂色aⅴ| 成人免费看的视频| 99久久久精品| 99久久精品免费看国产| 91老司机福利 在线| 99riav一区二区三区| 91原创在线视频| 一本色道**综合亚洲精品蜜桃冫| 欧美xxxxxxxx| 久久亚洲综合色| 久久久不卡影院| www国产亚洲精品久久麻豆| 自拍偷拍国产精品| 欧美老女人第四色| 91精品国产综合久久精品图片| 欧美精品一二三区| 欧美成人伊人久久综合网| 精品日韩欧美在线| 中文字幕精品一区二区三区精品| 国产精品免费丝袜| 一区二区久久久| 亚洲大尺度视频在线观看| 日本中文字幕一区二区视频 | 色88888久久久久久影院按摩 | 亚洲一区二区三区不卡国产欧美| 亚洲午夜视频在线| 另类小说欧美激情| 国产成人在线色| 在线一区二区三区做爰视频网站| 在线成人高清不卡| 久久精子c满五个校花| 一区二区三区在线免费观看| 日韩精品一区第一页| 国产成人av福利| 色噜噜狠狠色综合中国| 欧美白人最猛性xxxxx69交| 综合色天天鬼久久鬼色| 天天影视网天天综合色在线播放| 国产一区二区电影| 色综合久久88色综合天天6 | 日韩有码一区二区三区| 国产成都精品91一区二区三| 欧美性一二三区| 久久精品亚洲麻豆av一区二区 | 成人激情图片网| 在线成人小视频| 国产精品欧美极品| 美美哒免费高清在线观看视频一区二区| 国产成人综合亚洲91猫咪| 精品视频一区三区九区| 国产精品午夜春色av| 热久久国产精品| 色天天综合色天天久久| 久久精品欧美一区二区三区不卡| 一区二区免费视频| 不卡免费追剧大全电视剧网站| 日韩一区二区在线看| 亚洲精品亚洲人成人网在线播放| 久久精品国产99国产精品| 欧美成人性战久久| 亚洲成人精品一区二区| 成人的网站免费观看| 欧美xxxxx牲另类人与| 午夜欧美视频在线观看 | 亚洲精品在线观看网站| 五月天国产精品| 91欧美激情一区二区三区成人| 久久久久久久精| 久久精品久久精品| 欧美日韩不卡在线| 欧美一区二区美女| 国产九色精品成人porny| 久久97超碰色| 欧美另类久久久品| 一区二区三区免费在线观看|