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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? tpqic02.c

?? LINUX1.0源代碼,代碼條理清晰
?? C
?? 第 1 頁 / 共 5 頁
字號(hào):
/* $Id: tpqic02.c,v 0.2.1.21 1993/06/18 19:04:33 root Exp root $
 *
 * Driver for tape drive support for Linux-i386 0.99.12.
 *
 * Copyright (c) 1993 by H. H. Bergman. All rights reserved.
 * Current e-mail address: csg279@wing.rug.nl
 * [If you are unable to reach me directly, try the TAPE mailing list
 * channel on linux-activists@niksula.hut.fi using "X-Mn-Key: TAPE" as
 * the first line in your message.]
 *
 * Distribution of this program in executable form is only allowed if
 * all of the corresponding source files are made available through the same
 * medium at no extra cost.
 *
 * I will not accept any responsibility for damage caused directly or
 * indirectly by this program, or code derived from this program.
 *
 * Use this code at your own risk. Don't blame me if it destroys your data!
 * Make sure you have a backup before you try this code.
 *
 * This driver was partially inspired by the 'wt' driver in the 386BSD
 * source distribution, which carries the following copyright notice:
 *
 *  Copyright (c) 1991 The Regents of the University of California.
 *  All rights reserved.
 *
 * You are not allowed to change this line nor the text above.
 *
 * $Log: tpqic02.c,v $
 * Revision 0.2.1.21  1993/06/18  19:04:33  root
 * minor fixes for 0.99.10.
 *
 * Revision 0.2.1.20  1993/06/11  21:38:51  root
 * Added exception code for status 0x8000 (Cypher weirdness).
 *
 * Revision 0.2.1.19  1993/04/19  23:13:59  root
 * Cleanups. Changed to 0.99.8.
 *
 * Revision 0.2.1.18  1993/03/22  17:39:47  root
 * Moved to 0.99.7. Added Archive MTSEEK and MTTELL support.
 *
 * Revision 0.2.1.17  1993/03/08  18:51:59  root
 * Tried to `fix' write-once bug in previous release.
 *
 * Revision 0.2.1.16  1993/03/01  00:06:16  root
 * Use register_chrdev() for 0.99.6.
 *
 * Revision 0.2.1.15  1993/02/25  00:14:25  root
 * minor cleanups.
 *
 * Revision 0.2.1.14  1993/01/25  00:06:14  root
 * Kernel udelay. Eof fixups.
 * Removed report_ read/write dummies; have strace(1) now.
 *
 * Revision 0.2.1.13  1993/01/10  02:24:43  root
 * Rewrote wait_for_ready() to use newer schedule() features.
 * This improves performance for rewinds etc.
 *
 * Revision 0.2.1.12  1993/01/05  18:44:09  root
 * Changes for 0.99.1. Fixed `restartable reads'.
 *
 * Revision 0.2.1.11  1992/11/28  01:19:10  root
 * Changes to exception handling (significant).
 * Changed returned error codes. Hopefully they're correct now.
 * Changed declarations to please gcc-2.3.1.
 * Patch to deal with bogus interrupts for Archive cards.
 *
 * Revision 0.2.1.10  1992/10/28  00:50:44  root
 * underrun/error counter needed byte swapping.
 *
 * Revision 0.2.1.9  1992/10/15  17:06:01  root
 * Removed online() stuff. Changed EOF handling.
 *
 * Revision 0.2.1.8  1992/10/02  22:25:48  root
 * Removed `no_sleep' parameters (got usleep() now),
 * cleaned up some comments.
 *
 * Revision 0.2.1.7  1992/09/27  01:41:55  root
 * Changed write() to do entire user buffer in one go, rather than just
 * a kernel-buffer sized portion each time.
 *
 * Revision 0.2.1.6  1992/09/21  02:15:30  root
 * Introduced udelay() function for microsecond-delays.
 * Trying to use get_dma_residue rather than TC flags.
 * Patch to fill entire user buffer on reads before
 * returning.
 *
 * Revision 0.2.1.5  1992/09/19  02:31:28  root
 * Some changes based on patches by Eddy Olk to
 * support Archive SC402/SC499R controller cards.
 *
 * Revision 0.2.1.4  1992/09/07  01:37:37  root
 * Minor changes
 *
 * Revision 0.2.1.3  1992/08/13  00:11:02  root
 * Added some support for Archive SC402 and SC499 cards.
 * (Untested.)
 *
 * Revision 0.2.1.2  1992/08/10  02:02:36  root
 * Changed from linux/system.h macros to asm/dma.h inline functions.
 *
 * Revision 0.2.1.1  1992/08/08  01:12:39  root
 * cleaned up a bit. added stuff for selftesting.
 * preparing for asm/dma.h instead of linux/system.h
 *
 * Revision 0.2  1992/08/03  20:11:30  root
 * Changed to use new IRQ allocation. Padding now done at runtime, pads to
 * 512 bytes. Because of this the page regs must be re-programmed every
 * block! Added hooks for selftest commands.
 * Moved to linux-0.97.
 *
 * Revision 0.1.0.5  1992/06/22  22:20:30  root
 * moved to Linux 0.96b
 *
 * Revision 0.1.0.4  1992/06/18  02:00:04  root
 * Use minor bit-7 to enable/disable printing of extra debugging info
 * when do tape access.
 * Added semop stuff for DMA/IRQ allocation checking. Don't think this
 * is the right way to do it though.
 *
 * Revision 0.1.0.3  1992/06/01  01:57:34  root
 * changed DRQ to DMA. added TDEBUG ifdefs to reduce output.
 *
 * Revision 0.1.0.2  1992/05/31  14:02:38  root
 * changed SET_DMA_PAGE handling slightly.
 *
 * Revision 0.1.0.1  1992/05/27  12:12:03  root
 * Can now use multiple files on tape (sort of).
 * First release.
 *
 * Revision 0.1  1992/05/26  01:16:31  root
 * Initial version. Copyright H. H. Bergman 1992
 *
 */

/* After the legalese, now the important bits:
 * 
 * This is a driver for the Wangtek 5150 tape drive with 
 * a QIC-02 controller for ISA-PC type computers.
 * Hopefully it will work with other QIC-02 tape drives as well.
 *
 * Make sure your setup matches the configuration parameters.
 * Also, be careful to avoid IO conflicts with other devices!
 */

#include <linux/config.h>

/* skip this driver if not required for this configuration */
#if CONFIG_TAPE_QIC02

/*
#define TDEBUG
*/

#define REALLY_SLOW_IO		/* it sure is ... */

#include <linux/sched.h>
#include <linux/timer.h>
#include <linux/fs.h>
#include <linux/kernel.h>
#include <linux/major.h>
#include <linux/errno.h>
#include <linux/mtio.h>
#include <linux/fcntl.h>
#include <linux/delay.h>
#include <linux/tpqic02.h>

#include <asm/dma.h>
#include <asm/system.h>
#include <asm/io.h>
#include <asm/segment.h>

/* check existence of required configuration parameters */
#if !defined(TAPE_QIC02_PORT) || \
    !defined(TAPE_QIC02_IRQ) || \
    !defined(TAPE_QIC02_DMA)
#error tape_qic02 configuration error
#endif


#define TPQIC_NAME	"tpqic02"

/* Linux outb() commands have (value,port) as parameters.
 * One might expect (port,value) instead, so beware!
 */

static volatile int ctlbits = 0;     /* control reg bits for tape interface */

static struct wait_queue *tape_qic02_transfer = NULL; /* sync rw with interrupts */

static volatile struct mtget ioctl_status;	/* current generic status */

static volatile struct tpstatus tperror;	/* last drive status */

static char rcs_revision[] = "$Revision: 0.2.1.21 $";
static char rcs_date[] = "$Date: 1993/06/18 19:04:33 $";

/* Flag bits for status and outstanding requests.
 * (Could all be put in one bit-field-struct.)
 * Some variables need `volatile' because they may be modified
 * by an interrupt.
 */
static volatile flag status_dead = YES;	/* device is legally dead until proven alive */
static 		flag status_open = NO;	/* in use or not */

static volatile flag status_bytes_wr = NO;	/* write FM at close or not */
static volatile flag status_bytes_rd = NO;	/* (rd|wr) used for rewinding */

static volatile unsigned long status_cmd_pending = 0; /* cmd in progress */
static volatile flag status_expect_int = NO;	/* ready for interrupts */
static volatile flag status_timer_on = NO; 	/* using time-out */
static volatile int  status_error = 0;		/* int handler may detect error */
static volatile flag status_eof_detected = NO;	/* end of file */
static volatile flag status_eom_detected = NO;	/* end of recorded media */
static volatile flag status_eot_detected = NO;	/* end of tape */
static volatile flag doing_read = NO;
static volatile flag doing_write = NO;

static volatile unsigned long dma_bytes_todo;
static volatile unsigned long dma_bytes_done;
static volatile unsigned dma_mode = 0;		/* !=0 also means DMA in use */
static 		flag need_rewind = YES;

static dev_t current_tape_dev = QIC02_TAPE_MAJOR << 8;
static int extra_blocks_left = BLOCKS_BEYOND_EW;


/* return_*_eof:
 *	NO:	not at EOF,
 *	YES:	tell app EOF was reached (return 0).
 *
 * return_*_eof==YES && reported_*_eof==NO  ==>
 *	return current buffer, next time(s) return EOF.
 *
 * return_*_eof==YES && reported_*_eof==YES  ==>
 *	at EOF and application knows it, so we can
 *	move on to the next file.
 *
 */
static flag return_read_eof = NO;	/* set to signal app EOF was reached */
static flag return_write_eof = NO;
static flag reported_read_eof = NO;	/* set when we've done that */
static flag reported_write_eof = NO;


#ifdef TP_HAVE_SEEK
/* This is for doing `mt seek <blocknr>' */
static char seek_addr_buf[SEEK_BUF_SIZE];
#endif


/* In write mode, we have to write a File Mark after the last block written, 
 * when the tape device is closed. Tape repositioning and reading in write
 * mode is allowed as long as no actual writing has been done. After writing
 * the File Mark, repositioning and reading are allowed again.
 */
static int  mode_access;	/* access mode: READ or WRITE */


/* This is the actual kernel buffer where the interrupt routines read
 * from/write to. It is needed because the DMA channels 1 and 3 cannot
 * access the user buffers. [The kernel buffer must reside in the lower
 * 1MBytes of system memory because of the DMA controller.]
 * The user must ensure that a large enough buffer is passed to the
 * kernel, in order to reduce tape repositioning.
 *
 * The buffer is 512 bytes larger than expected, because I want to align it
 * at 512 bytes, to prevent problems with 64k boundaries.
 */

static volatile char tape_qic02_buf[TPQBUF_SIZE+TAPE_BLKSIZE];
/* A really good compiler would be able to align this at 512 bytes... :-( */

static unsigned long buffaddr;	/* aligned physical address of buffer */


/* This translates minor numbers to the corresponding recording format: */
static char *format_names[] = {
	"not set",	/* for dumb drives unable to handle format selection */
	"11",		/* extinct */
	"24",
	"120",
	"150",
	"300",		/* untested. */
	"600"		/* untested. */
};


/* `exception_list' is needed for exception status reporting.
 * Exceptions 1..14 are defined by QIC-02 rev F.
 * The drive status is matched sequentially to each entry,
 * ignoring irrelevant bits, until a match is found. If no
 * match is found, exception number 0 is used. (That should of
 * course never happen...) The original table was based on the
 * "Exception Status Summary" in QIC-02 rev F, but some changes
 * were required to make it work with real-world drives.
 *
 * Exception 1 (CNI) is changed to also cover status 0x00e0 (mask USL),
 * Exception 4 (EOM) is changed to also cover status 0x8288 (mask EOR),
 * Exception 11 (FIL) is changed to also cover status 0x0089 (mask EOM).
 * Exception 15 (EOR) is added for seek-to-end-of-data (catch EOR),
 * Exception 16 (BOM) is added for beginning-of-media (catch BOM).
 */
static struct exception_list_type {
	short mask, code;
	char *msg;
} exception_list[] = {
	{0, 0,
		"Unknown exception status code",		/* extra: 0 */},
	{~(TP_WRP|TP_USL), TP_ST0|TP_CNI,
		/* My Wangtek 5150EQ sometimes reports a status code
		 * of 0x00e0, which is not a valid exception code, but
		 * I think it should be recognized as "NO CARTRIDGE".
		 */
		"Cartridge not in place"			/* 1 */},
	{-1, TP_ST0|TP_CNI|TP_USL|TP_WRP,
		"Drive not online"				/* 2 */},
	{~(TP_ST1|TP_BOM), TP_ST0|TP_WRP,
		"Write protected cartridge"			/* 3 */},
	{~(TP_ST1|TP_EOR), TP_ST0|TP_EOM,
		"End of media"					/* 4 */},
	{~TP_WRP, TP_ST0|TP_UDA| TP_ST1|TP_BOM,
		"Read or Write abort. Rewind tape."		/* 5 */},
	{~TP_WRP, TP_ST0|TP_UDA,
		"Read error. Bad block transferred."		/* 6 */},
	{~TP_WRP, TP_ST0|TP_UDA|TP_BNL,
		"Read error. Filler block transferred."		/* 7 */},
	{~TP_WRP, TP_ST0|TP_UDA|TP_BNL |TP_ST1|TP_NDT,
		"Read error. No data detected."			/* 8 */},
	{~TP_WRP, TP_ST0|TP_EOM|TP_UDA|TP_BNL |TP_ST1|TP_NDT,
		"Read error. No data detected. EOM."		/* 9 */},
	{~(TP_WRP|TP_MBD|TP_PAR|TP_EOR), TP_ST0|TP_UDA|TP_BNL |TP_ST1|TP_NDT|TP_BOM,
		"Read error. No data detected. BOM."		/* 10 */},
	{~(TP_WRP|TP_EOM), TP_ST0|TP_FIL,
		/* Status 0x0089 (EOM & FM) is viewed as an FM,
		 * because it can only happen during a read.
		 * EOM is checked separately for an FM condition.
		 */
		"File mark detected"				/* 11 */},
	{~(TP_ST0|TP_CNI|TP_USL|TP_WRP|TP_BOM), TP_ST1|TP_ILL,
		"Illegal command"				/* 12 */},
	{~(TP_ST0|TP_CNI|TP_USL|TP_WRP|TP_BOM), TP_ST1|TP_POR,
		"Reset occurred"					/* 13 */},
	{~TP_WRP, TP_ST0|TP_FIL|TP_MBD,		/* NOTE: ST1 not set! */
		"Marginal block detected"			/* 14 */},
	{~(TP_ST0|TP_WRP|TP_EOM|TP_UDA|TP_BNL|TP_FIL |TP_NDT), TP_ST1|TP_EOR,
		/********** Is the extra TP_NDT really needed Eddy? **********/
		"End of recorded media"				/* extra: 15 */},
		/* 15 is returned when SEEKEOD completes successfully */
	{~(TP_WRP|TP_ST0), TP_ST1|TP_BOM,
		"Beginning of media"				/* extra: 16 */}
#ifdef CYPHER_BUG
	/* Perhaps the Cypher driver clears the TP_BOM bit after the
	 * status has been read? The QIC-02 specs explicitly state that
	 * the BOM bit should remain set as long as the tape is logically
	 * at the beginning of the tape.
	 */
	,{-1, TP_ST1,
		"Hmm, this must be Cypher drive... Aaargh"	/* extra */}
#endif
};
#define NR_OF_EXC	(sizeof(exception_list)/sizeof(struct exception_list_type))



static void tpqputs(char *s)
{
	printk(TPQIC_NAME ": %s\n", s);
} /* tpqputs */


/* Perform byte order swapping for a 16-bit word.
 *
 * [FIXME] This should probably be in include/asm/
 * ([FIXME] i486 can do this faster)
 */
static inline void byte_swap_w(volatile unsigned short * w)
{
	int t = *w;

	*w = (t>>8) | ((t & 0xff)<<8);
}



/* Init control register bits on interface card.
 * For Archive, interrupts must be enabled explicitly.
 * Wangtek interface card requires ONLINE to be set, Archive SC402/SC499R
 * cards keep it active all the time.
 */
static void ifc_init(void)
{
#if TAPE_QIC02_IFC == WANGTEK
	ctlbits = WT_CTL_ONLINE;	/* online */
	outb_p(ctlbits, QIC_CTL_PORT);

#elif TAPE_QIC02_IFC == ARCHIVE
	ctlbits = 0;			/* no interrupts yet */
	outb_p(ctlbits, QIC_CTL_PORT);
	outb_p(0, AR_RESET_DMA_PORT);	/* dummy write to reset DMA */
#else
# error No valid interface card specified
#endif
} /* ifc_init */

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久国际精品| 美女视频第一区二区三区免费观看网站| 精品嫩草影院久久| 日韩一区二区视频| 欧美一区二区三区成人| 日韩精品中文字幕在线不卡尤物| 日韩视频一区二区三区在线播放| 91精品国产全国免费观看| 91精品国产综合久久精品图片| 91精品欧美久久久久久动漫 | 一本一道久久a久久精品| 色综合久久中文综合久久97 | 久久久99免费| 久久精品夜色噜噜亚洲aⅴ| 国产婷婷精品av在线| 亚洲国产成人一区二区三区| 国产精品美女久久久久高潮 | 成人网在线免费视频| av在线不卡电影| 日本高清不卡视频| 欧美日韩夫妻久久| 日韩欧美国产电影| 国产日韩欧美高清在线| 中文一区在线播放| 亚洲午夜在线电影| 免费观看一级特黄欧美大片| 国产精品一二三四五| 99视频在线精品| 欧美日韩视频专区在线播放| 日韩欧美电影在线| 中文字幕av免费专区久久| 一区二区欧美视频| 美女mm1313爽爽久久久蜜臀| 高清不卡在线观看av| 91成人在线免费观看| 日韩欧美一区二区视频| 国产精品美女久久久久久| 亚洲国产精品久久艾草纯爱 | 日韩精品专区在线| 国产精品视频看| 亚洲国产精品影院| 久久99精品国产91久久来源| 成人精品国产免费网站| 精品视频一区二区三区免费| 欧美精品一区视频| 一区二区三区在线视频免费| 麻豆精品国产传媒mv男同| 成人午夜视频在线观看| 欧美久久久久久蜜桃| 国产精品网站在线观看| 亚洲国产cao| 国产成人在线看| 欧美日韩一区二区在线视频| 久久久久国产一区二区三区四区| 亚洲精品高清在线| 国产精品影视在线| 欧美日韩在线三区| 国产人成亚洲第一网站在线播放 | 日韩**一区毛片| 不卡一区二区在线| 日韩精品一区二区三区在线| 一区二区三区成人| 成人在线视频首页| 欧美电影免费观看高清完整版在| 亚洲女人****多毛耸耸8| 国产一区视频在线看| 欧美精品aⅴ在线视频| 亚洲欧洲日韩一区二区三区| 久久se这里有精品| 欧美日韩第一区日日骚| 国产精品美女久久久久久久久久久| 青青草原综合久久大伊人精品优势| 色综合天天综合狠狠| 久久人人爽人人爽| 久久er精品视频| 欧美欧美欧美欧美首页| 亚洲免费色视频| 成人av电影在线观看| 久久久不卡影院| 麻豆91精品91久久久的内涵| 欧美影院一区二区| 亚洲天堂福利av| 成人aa视频在线观看| 国产欧美日韩精品一区| 韩国v欧美v日本v亚洲v| 91麻豆精品国产91久久久资源速度| 一区二区三区精品视频在线| 成人激情黄色小说| 国产精品三级av在线播放| 国内久久精品视频| 精品国产一区二区亚洲人成毛片| 日韩国产欧美一区二区三区| 欧美日韩精品三区| 亚洲韩国一区二区三区| 在线视频一区二区三| 亚洲免费在线观看视频| 99国产精品国产精品久久| 国产精品久久精品日日| 成人黄色小视频| 国产精品久久久久久久久免费相片 | 色94色欧美sute亚洲线路二| 亚洲欧美怡红院| 99久久久国产精品| 亚洲日本va在线观看| 99国产精品久| 亚洲黄色av一区| 欧美午夜理伦三级在线观看| 亚洲午夜一区二区| 69久久夜色精品国产69蝌蚪网| 日韩精品午夜视频| 日韩欧美国产一区二区三区| 狠狠久久亚洲欧美| 久久久91精品国产一区二区精品 | 午夜激情一区二区| 欧美一区二区三区四区视频| 青青草精品视频| 亚洲精品在线免费观看视频| 国内久久婷婷综合| 国产精品欧美精品| 99re66热这里只有精品3直播 | 天天影视涩香欲综合网| 欧美一区二区美女| 国产成人在线看| 亚洲三级电影网站| 欧美日韩免费电影| 久久99精品国产麻豆不卡| 久久精品欧美一区二区三区不卡| 99久久亚洲一区二区三区青草 | 成人性生交大片免费| 一区二区三区在线视频观看58| 777奇米成人网| 国产一区二区精品久久| 国产精品天天看| 欧美伊人精品成人久久综合97| 日本免费在线视频不卡一不卡二| 2023国产精品| 色综合色综合色综合色综合色综合| 亚洲va韩国va欧美va精品| 欧美变态tickling挠脚心| 波波电影院一区二区三区| 亚洲综合999| 日韩久久久精品| 99国产精品久久久久久久久久久 | 91黄色激情网站| 青椒成人免费视频| 国产精品美女久久久久av爽李琼 | 欧美大片拔萝卜| av网站免费线看精品| 日韩电影在线观看网站| 中文字幕欧美日韩一区| 欧美人成免费网站| 国产aⅴ精品一区二区三区色成熟| 亚洲精品高清视频在线观看| 精品日本一线二线三线不卡 | 国产精品网站在线播放| 欧美日韩国产首页在线观看| 国产一区二区在线视频| 亚洲高清免费观看| 中文一区二区完整视频在线观看| 欧美日韩国产大片| 福利电影一区二区| 日本欧美久久久久免费播放网| 1区2区3区精品视频| 精品久久免费看| 欧美日韩性生活| 99视频国产精品| 国产一区在线精品| 日韩在线一区二区| 亚洲日本成人在线观看| 久久久精品免费免费| 欧美精品在欧美一区二区少妇| 99精品桃花视频在线观看| 激情图片小说一区| 调教+趴+乳夹+国产+精品| 国产精品国产三级国产| 欧美精品一区二区三区在线播放| 欧美日韩在线观看一区二区 | 欧美一区二区播放| 在线国产亚洲欧美| 99久久免费视频.com| 国产精品一区二区三区99| 免费精品视频最新在线| 亚洲国产一区二区a毛片| 中文字幕亚洲在| 国产视频不卡一区| 亚洲精品一区二区三区四区高清 | xf在线a精品一区二区视频网站| 欧美日韩欧美一区二区| 色偷偷88欧美精品久久久| 波波电影院一区二区三区| 国产成人在线免费观看| 国产在线播放一区二区三区| 美脚の诱脚舐め脚责91| 日本午夜精品一区二区三区电影 | 国产在线一区二区| 蜜臀av性久久久久蜜臀av麻豆| 午夜精品影院在线观看| 亚洲自拍偷拍麻豆| 亚洲黄色片在线观看| 亚洲视频在线观看三级|