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

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

?? hp.c

?? LINUX1.0源代碼,代碼條理清晰
?? C
字號(hào):
/* hp.c: A HP LAN ethernet driver for linux. */
/*
	Written 1993 by Donald Becker.
	Copyright 1993 United States Government as represented by the
	Director, National Security Agency.	 This software may be used and
	distributed according to the terms of the GNU Public License,
	incorporated herein by reference.

	This is a driver for the HP LAN adaptors.

	The Author may be reached as becker@super.org or
	C/O Supercomputing Research Ctr., 17100 Science Dr., Bowie MD 20715
*/

static char *version =
	"hp.c:v0.99.15k 3/3/94 Donald Becker (becker@super.org)\n";

#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/errno.h>
#include <linux/ioport.h>
#include <asm/system.h>
#include <asm/io.h>

#include "dev.h"
#include "8390.h"

#ifndef HAVE_PORTRESERVE
#define check_region(ioaddr, size)				0
#define snarf_region(ioaddr, size);				do ; while (0)
#endif

#define HP_IO_EXTENT	32

#define HP_DATAPORT		0x0c	/* "Remote DMA" data port. */
#define HP_ID			0x07
#define HP_CONFIGURE	0x08	/* Configuration register. */
#define	 HP_RUN			0x01	/* 1 == Run, 0 == reset. */
#define	 HP_IRQ			0x0E	/* Mask for software-configured IRQ line. */
#define	 HP_DATAON		0x10	/* Turn on dataport */
#define NIC_OFFSET		0x10	/* Offset the 8390 registers. */

#define HP_START_PG		0x00	/* First page of TX buffer */
#define HP_8BSTOP_PG	0x80	/* Last page +1 of RX ring */
#define HP_16BSTOP_PG	0xFF	/* Same, for 16 bit cards. */

int hp_probe(struct device *dev);
int hpprobe1(struct device *dev, int ioaddr);

static void hp_reset_8390(struct device *dev);
static int hp_block_input(struct device *dev, int count,
						  char *buf, int ring_offset);
static void hp_block_output(struct device *dev, int count,
							const unsigned char *buf, const start_page);
static void hp_init_card(struct device *dev);

/* The map from IRQ number to HP_CONFIGURE register setting. */
/* My default is IRQ5	   0  1	 2  3  4  5  6	7  8  9 10 11 */
static char irqmap[16] = { 0, 0, 4, 6, 8,10, 0,14, 0, 4, 2,12,0,0,0,0};


/*	Probe for an HP LAN adaptor.
	Also initialize the card and fill in STATION_ADDR with the station
	address. */

int hp_probe(struct device *dev)
{
	int *port, ports[] = {0x300, 0x320, 0x340, 0x280, 0x2C0, 0x200, 0x240, 0};
	short ioaddr = dev->base_addr;

	if (ioaddr > 0x1ff)			/* Check a single specified location. */
		return hpprobe1(dev, ioaddr);
	else if (ioaddr > 0)				/* Don't probe at all. */
		return ENXIO;

	for (port = &ports[0]; *port; port++) {
		if (check_region(*port, HP_IO_EXTENT))
			continue;
		if (hpprobe1(dev, *port) == 0) {
			return 0;
		}
	}
	return ENODEV;
}

int hpprobe1(struct device *dev, int ioaddr)
{
	int i, board_id, wordmode;
	char *name;
	unsigned char *station_addr = dev->dev_addr;

	/* Check for the HP physical address, 08 00 09 xx xx xx. */
	/* This really isn't good enough: we may pick up HP LANCE boards
	   also!  Avoid the lance 0x5757 signature. */
	if (inb(ioaddr) != 0x08
		|| inb(ioaddr+1) != 0x00
		|| inb(ioaddr+2) != 0x09
		|| inb(ioaddr+14) == 0x57)
		return ENODEV;

	/* Set up the parameters based on the board ID.
	   If you have additional mappings, please mail them to becker@super.org. */
	if ((board_id = inb(ioaddr + HP_ID)) & 0x80) {
		name = "HP27247";
		wordmode = 1;
	} else {
		name = "HP27250";
		wordmode = 0;
	}

	/* Grab the region so we can find another board if something fails. */
	snarf_region(ioaddr, HP_IO_EXTENT);

	printk("%s: %s (ID %02x) at %#3x,", dev->name, name, board_id, ioaddr);

	for(i = 0; i < ETHER_ADDR_LEN; i++)
		printk(" %2.2x", station_addr[i] = inb(ioaddr + i));

	/* Snarf the interrupt now.  Someday this could be moved to open(). */
	if (dev->irq < 2) {
		int irq_16list[] = { 11, 10, 5, 3, 4, 7, 9, 0};
		int irq_8list[] = { 7, 5, 3, 4, 9, 0};
		int *irqp = wordmode ? irq_16list : irq_8list;
		do {
			int irq = *irqp;
			if (request_irq (irq, NULL) != -EBUSY) {
				autoirq_setup(0);
				/* Twinkle the interrupt, and check if it's seen. */
				outb_p(irqmap[irq] | HP_RUN, ioaddr + HP_CONFIGURE);
				outb_p( 0x00 | HP_RUN, ioaddr + HP_CONFIGURE);
				if (irq == autoirq_report(0)		 /* It's a good IRQ line! */
					&& request_irq (irq, &ei_interrupt) == 0) {
					printk(" selecting IRQ %d.\n", irq);
					dev->irq = *irqp;
					break;
				}
			}
		} while (*++irqp);
		if (*irqp == 0) {
			printk(" no free IRQ lines.\n");
			return EBUSY;
		}
	} else {
		if (dev->irq == 2)
			dev->irq = 9;
		if (irqaction(dev->irq, &ei_sigaction)) {
			printk (" unable to get IRQ %d.\n", dev->irq);
			return EBUSY;
		}
	}

	if (ei_debug > 1)
		printk(version);

	/* Set the base address to point to the NIC, not the "real" base! */
	dev->base_addr = ioaddr + NIC_OFFSET;

	ethdev_init(dev);

	ei_status.name = name;
	ei_status.word16 = wordmode;
	ei_status.tx_start_page = HP_START_PG;
	ei_status.rx_start_page = HP_START_PG + TX_PAGES;
	ei_status.stop_page = wordmode ? HP_16BSTOP_PG : HP_8BSTOP_PG;

	ei_status.reset_8390 = &hp_reset_8390;
	ei_status.block_input = &hp_block_input;
	ei_status.block_output = &hp_block_output;
	hp_init_card(dev);

	return 0;
}

static void
hp_reset_8390(struct device *dev)
{
	int hp_base = dev->base_addr - NIC_OFFSET;
	int saved_config = inb_p(hp_base + HP_CONFIGURE);

	if (ei_debug > 1) printk("resetting the 8390 time=%ld...", jiffies);
	outb_p(0x00, hp_base + HP_CONFIGURE);
	ei_status.txing = 0;
	/* Pause just a few cycles for the hardware reset to take place. */
	SLOW_DOWN_IO;
	SLOW_DOWN_IO;

	outb_p(saved_config, hp_base + HP_CONFIGURE);
	SLOW_DOWN_IO; SLOW_DOWN_IO;
	
	if ((inb_p(hp_base+NIC_OFFSET+EN0_ISR) & ENISR_RESET) == 0)
		printk("%s: hp_reset_8390() did not complete.\n", dev->name);

	if (ei_debug > 1) printk("8390 reset done (%ld).", jiffies);
	return;
}

/* Block input and output, similar to the Crynwr packet driver.	 If you
   porting to a new ethercard look at the packet driver source for hints.
   The HP LAN doesn't use shared memory -- we put the packet
   out through the "remote DMA" dataport. */

static int
hp_block_input(struct device *dev, int count, char *buf, int ring_offset)
{
	int nic_base = dev->base_addr;
	int saved_config = inb_p(nic_base - NIC_OFFSET + HP_CONFIGURE);
	int xfer_count = count;

	outb_p(saved_config | HP_DATAON, nic_base - NIC_OFFSET + HP_CONFIGURE);
	outb_p(E8390_NODMA+E8390_PAGE0+E8390_START, nic_base);
	outb_p(count & 0xff, nic_base + EN0_RCNTLO);
	outb_p(count >> 8, nic_base + EN0_RCNTHI);
	outb_p(ring_offset & 0xff, nic_base + EN0_RSARLO);
	outb_p(ring_offset >> 8, nic_base + EN0_RSARHI);
	outb_p(E8390_RREAD+E8390_START, nic_base);
	if (ei_status.word16) {
	  insw(nic_base - NIC_OFFSET + HP_DATAPORT,buf,count>>1);
	  if (count & 0x01)
		buf[count-1] = inb(nic_base - NIC_OFFSET + HP_DATAPORT), xfer_count++;
	} else {
		insb(nic_base - NIC_OFFSET + HP_DATAPORT, buf, count);
	}
	/* This is for the ALPHA version only, remove for later releases. */
	if (ei_debug > 0) {			/* DMA termination address check... */
	  int high = inb_p(nic_base + EN0_RSARHI);
	  int low = inb_p(nic_base + EN0_RSARLO);
	  int addr = (high << 8) + low;
	  /* Check only the lower 8 bits so we can ignore ring wrap. */
	  if (((ring_offset + xfer_count) & 0xff) != (addr & 0xff))
		printk("%s: RX transfer address mismatch, %#4.4x vs. %#4.4x (actual).\n",
			   dev->name, ring_offset + xfer_count, addr);
	}
	outb_p(saved_config & (~HP_DATAON), nic_base - NIC_OFFSET + HP_CONFIGURE);
	return ring_offset + count;
}

static void
hp_block_output(struct device *dev, int count,
				const unsigned char *buf, const start_page)
{
	int nic_base = dev->base_addr;
	int saved_config = inb_p(nic_base - NIC_OFFSET + HP_CONFIGURE);

	outb_p(saved_config | HP_DATAON, nic_base - NIC_OFFSET + HP_CONFIGURE);
	/* Round the count up for word writes.	Do we need to do this?
	   What effect will an odd byte count have on the 8390?
	   I should check someday. */
	if (ei_status.word16 && (count & 0x01))
	  count++;
	/* We should already be in page 0, but to be safe... */
	outb_p(E8390_PAGE0+E8390_START+E8390_NODMA, nic_base);

#ifdef ei8390_bug
	/* Handle the read-before-write bug the same way as the
	   Crynwr packet driver -- the NatSemi method doesn't work. */
	outb_p(0x42, nic_base + EN0_RCNTLO);
	outb_p(0,	nic_base + EN0_RCNTHI);
	outb_p(0xff, nic_base + EN0_RSARLO);
	outb_p(0x00, nic_base + EN0_RSARHI);
	outb_p(E8390_RREAD+E8390_START, EN_CMD);
	/* Make certain that the dummy read has occured. */
	inb_p(0x61);
	inb_p(0x61);
#endif

	outb_p(count & 0xff, nic_base + EN0_RCNTLO);
	outb_p(count >> 8,	 nic_base + EN0_RCNTHI);
	outb_p(0x00, nic_base + EN0_RSARLO);
	outb_p(start_page, nic_base + EN0_RSARHI);

	outb_p(E8390_RWRITE+E8390_START, nic_base);
	if (ei_status.word16) {
		/* Use the 'rep' sequence for 16 bit boards. */
		outsw(nic_base - NIC_OFFSET + HP_DATAPORT, buf, count>>1);
	} else {
		outsb(nic_base - NIC_OFFSET + HP_DATAPORT, buf, count);
	}

	/* DON'T check for 'inb_p(EN0_ISR) & ENISR_RDC' here -- it's broken! */

	/* This is for the ALPHA version only, remove for later releases. */
	if (ei_debug > 0) {			/* DMA termination address check... */
	  int high = inb_p(nic_base + EN0_RSARHI);
	  int low  = inb_p(nic_base + EN0_RSARLO);
	  int addr = (high << 8) + low;
	  if ((start_page << 8) + count != addr)
		printk("%s: TX Transfer address mismatch, %#4.4x vs. %#4.4x.\n",
			   dev->name, (start_page << 8) + count, addr);
	}
	outb_p(saved_config & (~HP_DATAON), nic_base - NIC_OFFSET + HP_CONFIGURE);
	return;
}

/* This function resets the ethercard if something screws up. */
static void
hp_init_card(struct device *dev)
{
	int irq = dev->irq;
	NS8390_init(dev, 0);
	outb_p(irqmap[irq&0x0f] | HP_RUN,
		   dev->base_addr - NIC_OFFSET + HP_CONFIGURE);
	return;
}


/*
 * Local variables:
 * compile-command: "gcc -D__KERNEL__ -I/usr/src/linux/net/inet -Wall -Wstrict-prototypes -O6 -m486 -c hp.c"
 * version-control: t
 * kept-new-versions: 5
 * tab-width: 4
 * c-indent-level: 4
 * End:
 */

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产不卡在线视频| 国产精品一级在线| 久久这里只精品最新地址| 欧美亚洲国产一卡| 在线亚洲精品福利网址导航| 国产成人免费在线观看不卡| 精品一区二区三区av| jizzjizzjizz欧美| 风间由美性色一区二区三区| 国产麻豆一精品一av一免费| 麻豆国产一区二区| 激情另类小说区图片区视频区| 蜜臀av性久久久久蜜臀aⅴ| 天堂在线亚洲视频| 美女视频黄久久| 精品一区二区综合| 国产不卡视频在线观看| 成人在线视频首页| 一本在线高清不卡dvd| 日本高清不卡视频| 欧美一区二区三区精品| 亚洲精品一区二区三区精华液| 久久久无码精品亚洲日韩按摩| 久久嫩草精品久久久久| 国产蜜臀97一区二区三区| 日韩美女视频一区| 亚洲国产精品影院| 久久精品国产**网站演员| 国产精品亚洲综合一区在线观看| av中文字幕在线不卡| 91国产成人在线| 亚洲色图欧洲色图| 男人的j进女人的j一区| 国产另类ts人妖一区二区| 99r国产精品| 日韩欧美成人一区| 中文字幕一区在线观看视频| 夜夜精品视频一区二区| 美日韩一级片在线观看| 大胆亚洲人体视频| 欧美日韩国产经典色站一区二区三区| 日韩三级免费观看| 中文字幕亚洲区| 免费看日韩a级影片| 波波电影院一区二区三区| 国产美女一区二区| 99精品国产视频| 欧美一区二区高清| 亚洲免费观看高清完整| 久久国产福利国产秒拍| 色哦色哦哦色天天综合| 久久九九久久九九| 婷婷激情综合网| gogo大胆日本视频一区| 日韩精品中文字幕在线不卡尤物 | 国产成人综合亚洲网站| 欧美视频一区在线| 国产精品看片你懂得| 国产一区二区三区av电影| 欧美午夜片在线看| 亚洲女与黑人做爰| 国产馆精品极品| 日韩一区中文字幕| 久久精品久久精品| 欧美精品视频www在线观看| 自拍av一区二区三区| 国产麻豆成人传媒免费观看| 91精品国产综合久久久蜜臀图片 | 制服丝袜一区二区三区| 国产精品理伦片| 国产尤物一区二区在线| 欧美一级片在线观看| 亚洲一区二三区| 一本大道久久精品懂色aⅴ| 欧美国产一区二区| 高清国产午夜精品久久久久久| 日韩一区二区三区视频在线| 午夜精品福利一区二区蜜股av| 成人三级伦理片| 久久久av毛片精品| 狂野欧美性猛交blacked| 欧美三级中文字幕在线观看| 又紧又大又爽精品一区二区| 99这里只有精品| 亚洲视频在线观看三级| 欧美亚洲动漫制服丝袜| 天天av天天翘天天综合网色鬼国产| 成人在线视频一区| 亚洲欧美日韩成人高清在线一区| 成人av集中营| 亚洲免费在线播放| 欧美性猛交xxxx黑人交| 五月天视频一区| 在线观看日韩av先锋影音电影院| 一区二区三区产品免费精品久久75| 91传媒视频在线播放| 天堂成人国产精品一区| 精品日韩欧美在线| 国产99久久久久| 中文字幕一区二区5566日韩| 色婷婷综合久久久久中文一区二区| 亚洲精品免费视频| 欧美精品一级二级三级| 极品美女销魂一区二区三区| 欧美韩国日本综合| 91福利在线播放| 久久精品国产成人一区二区三区| 久久久精品一品道一区| 一本久久a久久免费精品不卡| 一区二区在线观看视频在线观看| 欧美经典三级视频一区二区三区| 色悠悠久久综合| 精品在线亚洲视频| 亚洲欧美日韩在线| 精品国产伦一区二区三区免费| 成人午夜看片网址| 免费成人小视频| 亚洲精品国产一区二区三区四区在线| 在线不卡中文字幕| 99精品一区二区三区| 久久成人羞羞网站| 亚洲高清免费在线| 国产精品天天摸av网| 欧美电影在哪看比较好| 成人免费看片app下载| 日韩精品电影在线| 亚洲欧美偷拍卡通变态| 日韩午夜精品视频| 国产主播一区二区三区| 国产精品美女久久久久高潮| 成人午夜免费av| 2020国产精品自拍| 欧美日韩在线一区二区| 麻豆国产一区二区| 国产日韩精品一区二区三区在线| 成人av免费在线观看| 亚洲国产成人av| 99久久99久久精品国产片果冻| 亚洲欧美另类小说视频| 精品视频在线免费| 国模冰冰炮一区二区| 91精品国产综合久久精品| 欧美日韩一区高清| 国产一区二三区| 亚洲卡通动漫在线| 日韩美女在线视频| 91啪亚洲精品| 韩国成人精品a∨在线观看| 亚洲欧美在线aaa| 欧美一区二区成人6969| 成人综合婷婷国产精品久久| 亚洲成a天堂v人片| 久久久久久影视| 日本一区二区三区免费乱视频| 欧美日韩欧美一区二区| 国产成人午夜高潮毛片| 精品视频在线免费观看| 国产高清不卡一区二区| 午夜国产精品一区| 日韩理论片网站| 久久影院午夜片一区| 国产高清不卡二三区| 国产精品一级在线| 男女男精品网站| 亚洲一区二区三区四区在线观看| 亚洲影视资源网| 中文字幕一区视频| 久久久亚洲欧洲日产国码αv| 欧美精品99久久久**| aaa欧美色吧激情视频| 亚洲国产另类av| 久久久精品日韩欧美| 91精品免费在线| 欧美色网站导航| 色8久久精品久久久久久蜜| 成人中文字幕合集| 国产一二三精品| 日韩成人免费在线| 夜夜夜精品看看| 亚洲制服丝袜一区| 亚洲乱码国产乱码精品精的特点| 91一区在线观看| 毛片基地黄久久久久久天堂| 韩国一区二区视频| 国内精品不卡在线| 国产一区二区精品久久99| 麻豆国产欧美一区二区三区| 色欧美片视频在线观看| 日本二三区不卡| 欧美日韩色一区| 欧美日韩美女一区二区| 一本一本久久a久久精品综合麻豆 一本一道波多野结衣一区二区 | 成人激情文学综合网| 成人午夜av电影| 99久久综合国产精品| 99精品视频一区二区三区| 94-欧美-setu| 在线一区二区三区四区| 欧美日韩中文字幕一区二区| 日本久久电影网|