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

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

?? 8390.c

?? LINUX1.0源代碼,代碼條理清晰
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* 8390.c: A general NS8390 ethernet driver core for linux. */
/*
  Written 1992,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 the chip-specific code for many 8390-based ethernet adaptors.
  This is not a complete driver, it must be combined with board-specific
  code such as ne.c, wd.c, 3c503.c, etc.
  
  The Author may be reached as becker@super.org or
  C/O Supercomputing Research Ctr., 17100 Science Dr., Bowie MD 20715
  */

static char *version =
    "8390.c:v0.99-15e 2/16/94 Donald Becker (becker@super.org)\n";
#include <linux/config.h>

/*
  Braindamage remaining:
  Much of this code should be cleaned up post-1.00, but it has been
  extensively beta tested in the current form.
  
  Sources:
  The National Semiconductor LAN Databook, and the 3Com 3c503 databook.
  The NE* programming info came from the Crynwr packet driver, and figuring
  out that the those boards are similar to the NatSemi evaluation board
  described in AN-729.	Thanks NS, no thanks to Novell/Eagle.
  */

#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/fs.h>
#include <linux/types.h>
#include <linux/ptrace.h>
#include <linux/string.h>
#include <asm/system.h>
#include <asm/segment.h>
#include <asm/bitops.h>
#include <asm/io.h>
#include <errno.h>
#include <linux/fcntl.h>
#include <linux/in.h>
#include <linux/interrupt.h>

#include "dev.h"
#include "eth.h"
#include "ip.h"
#include "protocol.h"
#include "tcp.h"
#include "skbuff.h"
#include "sock.h"
#include "arp.h"

#include "8390.h"

/* These are the operational function interfaces to board-specific
   routines.
	void reset_8390(struct device *dev)
		Resets the board associated with DEV, including a hardware reset of
		the 8390.  This is only called when there is a transmit timeout, and
		it is always followed by 8390_init().
	void block_output(struct device *dev, int count, const unsigned char *buf,
					  int start_page)
		Write the COUNT bytes of BUF to the packet buffer at START_PAGE.  The
		"page" value uses the 8390's 256-byte pages.
	int block_input(struct device *dev, int count, char *buf, int ring_offset)
		Read COUNT bytes from the packet buffer into BUF.  Start reading from
		RING_OFFSET, the address as the 8390 sees it.  The first read will
		always be the 4 byte, page aligned 8390 header.  *If* there is a
		subsequent read, it will be of the rest of the packet.
*/
#define ei_reset_8390 (ei_local->reset_8390)
#define ei_block_output (ei_local->block_output)
#define ei_block_input (ei_local->block_input)

/* use 0 for production, 1 for verification, >2 for debug */
#ifdef EI_DEBUG
int ei_debug = EI_DEBUG;
#else
int ei_debug = 1;
#endif

/* Max number of packets received at one Intr.
   Current this may only be examined by a kernel debugger. */
static int high_water_mark = 0;

/* Index to functions. */
int ei_open(struct device *dev);	/* Put into the device structure. */
void ei_interrupt(int reg_ptr);		/* Installed as the interrupt handler. */

static void ei_tx_intr(struct device *dev);
static void ei_receive(struct device *dev);
static void ei_rx_overrun(struct device *dev);

/* Routines generic to NS8390-based boards. */
void NS8390_init(struct device *dev, int startp);
static void NS8390_trigger_send(struct device *dev, unsigned int length,
								int start_page);
#ifdef HAVE_MULTICAST
static void set_multicast_list(struct device *dev, int num_addrs, void *addrs);
#endif

struct sigaction ei_sigaction = { ei_interrupt, 0, 0, NULL, };

/* Open/initialize the board.  This routine goes all-out, setting everything
   up anew at each open, even though many of these registers should only
   need to be set once at boot.
   */
int ei_open(struct device *dev)
{
    struct ei_device *ei_local = (struct ei_device *) dev->priv;
    
    if ( ! ei_local) {
		printk("%s: Opening a non-existent physical device\n", dev->name);
		return ENXIO;
    }
    
    irq2dev_map[dev->irq] = dev;
    NS8390_init(dev, 1);
    dev->start = 1;
    ei_local->irqlock = 0;
    return 0;
}

static int ei_start_xmit(struct sk_buff *skb, struct device *dev)
{
    int e8390_base = dev->base_addr;
    struct ei_device *ei_local = (struct ei_device *) dev->priv;
    int length, send_length;
    
	/* We normally shouldn't be called if dev->tbusy is set, but the
	   existing code does anyway.
	   If it has been too long (> 100 or 150ms.) since the last Tx we assume
	   the board has died and kick it. */

    if (dev->tbusy) {	/* Do timeouts, just like the 8003 driver. */
		int txsr = inb(e8390_base+EN0_TSR), isr;
		int tickssofar = jiffies - dev->trans_start;
		if (tickssofar < 10	||	(tickssofar < 15 && ! (txsr & ENTSR_PTX))) {
			return 1;
		}
		isr = inb(e8390_base+EN0_ISR);
		printk("%s: transmit timed out, TX status %#2x, ISR %#2x.\n",
			   dev->name, txsr, isr);
		/* Does the 8390 thinks it has posted an interrupt? */
		if (isr)
			printk("%s: Possible IRQ conflict on IRQ%d?\n", dev->name, dev->irq);
		else {
			/* The 8390 probably hasn't gotten on the cable yet. */
			printk("%s: Possible network cable problem?\n", dev->name);
			ei_local->interface_num ^= 1; 	/* Try a different xcvr.  */
		}
		/* Try to restart the card.  Perhaps the user has fixed something. */
		ei_reset_8390(dev);
		NS8390_init(dev, 1);
		dev->trans_start = jiffies;
    }
    
    /* Sending a NULL skb means some higher layer thinks we've missed an
       tx-done interrupt. Caution: dev_tint() handles the cli()/sti()
       itself. */
    if (skb == NULL) {
		dev_tint(dev);
		return 0;
    }
    /* Fill in the ethernet header. */
    if (!skb->arp  &&  dev->rebuild_header(skb->data, dev)) {
		skb->dev = dev;
		arp_queue (skb);
		return 0;
    }
    skb->arp=1;
    
    length = skb->len;
    if (skb->len <= 0)
		return 0;

	/* Block a timer-based transmit from overlapping. */
	if (set_bit(0, (void*)&dev->tbusy) != 0) {
		printk("%s: Transmitter access conflict.\n", dev->name);
		return 1;
	}

    /* Mask interrupts from the ethercard. */
    outb(0x00,	e8390_base + EN0_IMR);
    ei_local->irqlock = 1;

    send_length = ETH_ZLEN < length ? length : ETH_ZLEN;

    if (ei_local->pingpong) {
		int output_page;
		if (ei_local->tx1 == 0) {
			output_page = ei_local->tx_start_page;
			ei_local->tx1 = send_length;
			if (ei_debug  &&  ei_local->tx2 > 0)
				printk("%s: idle transmitter tx2=%d, lasttx=%d, txing=%d.\n",
					   dev->name, ei_local->tx2, ei_local->lasttx,
					   ei_local->txing);
		} else if (ei_local->tx2 == 0) {
			output_page = ei_local->tx_start_page + 6;
			ei_local->tx2 = send_length;
			if (ei_debug  &&  ei_local->tx1 > 0)
				printk("%s: idle transmitter, tx1=%d, lasttx=%d, txing=%d.\n",
					   dev->name, ei_local->tx1, ei_local->lasttx,
					   ei_local->txing);
		} else {	/* We should never get here. */
			if (ei_debug)
				printk("%s: No packet buffer space for ping-pong use.\n",
					   dev->name);
			ei_local->irqlock = 0;
			dev->tbusy = 1;
			outb_p(ENISR_ALL,  e8390_base + EN0_IMR);
			return 1;
		}
		ei_block_output(dev, length, skb->data, output_page);
		if (! ei_local->txing) {
			NS8390_trigger_send(dev, send_length, output_page);
			dev->trans_start = jiffies;
			if (output_page == ei_local->tx_start_page)
				ei_local->tx1 = -1, ei_local->lasttx = -1;
			else
				ei_local->tx2 = -1, ei_local->lasttx = -2;
			ei_local->txing = 1;
		} else
			ei_local->txqueue++;

		dev->tbusy = (ei_local->tx1  &&  ei_local->tx2);
    } else {  /* No pingpong, just a single Tx buffer. */
		ei_block_output(dev, length, skb->data, ei_local->tx_start_page);
		NS8390_trigger_send(dev, send_length, ei_local->tx_start_page);
		dev->trans_start = jiffies;
		dev->tbusy = 1;
    }
    
    /* Turn 8390 interrupts back on. */
    ei_local->irqlock = 0;
    outb_p(ENISR_ALL, e8390_base + EN0_IMR);

    if (skb->free)
		kfree_skb (skb, FREE_WRITE);
    
    return 0;
}

/* The typical workload of the driver:
   Handle the ether interface interrupts. */
void ei_interrupt(int reg_ptr)
{
    int irq = -(((struct pt_regs *)reg_ptr)->orig_eax+2);
    struct device *dev = (struct device *)(irq2dev_map[irq]);
    int e8390_base;
    int interrupts, boguscount = 0;
    struct ei_device *ei_local;
    
    if (dev == NULL) {
		printk ("net_interrupt(): irq %d for unknown device.\n", irq);
		return;
    }
    e8390_base = dev->base_addr;
    ei_local = (struct ei_device *) dev->priv;
    if (dev->interrupt || ei_local->irqlock) {
		/* The "irqlock" check is only for testing. */
		sti();
		printk(ei_local->irqlock
			   ? "%s: Interrupted while interrupts are masked! isr=%#2x imr=%#2x.\n"
			   : "%s: Reentering the interrupt handler! isr=%#2x imr=%#2x.\n",
			   dev->name, inb_p(e8390_base + EN0_ISR),
			   inb_p(e8390_base + EN0_IMR));
		return;
    }
    
    dev->interrupt = 1;
    sti(); /* Allow other interrupts. */
    
    /* Change to page 0 and read the intr status reg. */
    outb_p(E8390_NODMA+E8390_PAGE0, e8390_base + E8390_CMD);
    if (ei_debug > 3)
		printk("%s: interrupt(isr=%#2.2x).\n", dev->name,
			   inb_p(e8390_base + EN0_ISR));
    
    /* !!Assumption!! -- we stay in page 0.	 Don't break this. */
    while ((interrupts = inb_p(e8390_base + EN0_ISR)) != 0
		   && ++boguscount < 5) {
		if (interrupts & ENISR_RDC) {
			/* Ack meaningless DMA complete. */
			outb_p(ENISR_RDC, e8390_base + EN0_ISR);
		}
		if (interrupts & ENISR_OVER) {
			ei_rx_overrun(dev);
		} else if (interrupts & (ENISR_RX+ENISR_RX_ERR)) {
			/* Got a good (?) packet. */
			ei_receive(dev);
		}
		/* Push the next to-transmit packet through. */
		if (interrupts & ENISR_TX) {
			ei_tx_intr(dev);
		} else if (interrupts & ENISR_COUNTERS) {
			struct ei_device *ei_local = (struct ei_device *) dev->priv;
			ei_local->stat.rx_frame_errors += inb_p(e8390_base + EN0_COUNTER0);
			ei_local->stat.rx_crc_errors   += inb_p(e8390_base + EN0_COUNTER1);
			ei_local->stat.rx_missed_errors+= inb_p(e8390_base + EN0_COUNTER2);
			outb_p(ENISR_COUNTERS, e8390_base + EN0_ISR); /* Ack intr. */
		}
		
		/* Ignore the transmit errs and reset intr for now. */
		if (interrupts & ENISR_TX_ERR) {
			outb_p(ENISR_TX_ERR, e8390_base + EN0_ISR); /* Ack intr. */
		}
		outb_p(E8390_NODMA+E8390_PAGE0+E8390_START, e8390_base + E8390_CMD);
    }
    
    if (interrupts && ei_debug) {
		printk("%s: unknown interrupt %#2x\n", dev->name, interrupts);
		outb_p(E8390_NODMA+E8390_PAGE0+E8390_START, e8390_base + E8390_CMD);
		outb_p(0xff, e8390_base + EN0_ISR); /* Ack. all intrs. */
    }
    dev->interrupt = 0;
    return;
}

/* We have finished a transmit: check for errors and then trigger the next
   packet to be sent. */
static void ei_tx_intr(struct device *dev)
{
    int e8390_base = dev->base_addr;
    int status = inb(e8390_base + EN0_TSR);
    struct ei_device *ei_local = (struct ei_device *) dev->priv;
    
    outb_p(ENISR_TX, e8390_base + EN0_ISR); /* Ack intr. */
    
    if (ei_local->pingpong) {
		ei_local->txqueue--;
		if (ei_local->tx1 < 0) {
			if (ei_local->lasttx != 1 && ei_local->lasttx != -1)
				printk("%s: bogus last_tx_buffer %d, tx1=%d.\n",
					   ei_local->name, ei_local->lasttx, ei_local->tx1);
			ei_local->tx1 = 0;
			dev->tbusy = 0;
			if (ei_local->tx2 > 0) {
				NS8390_trigger_send(dev, ei_local->tx2, ei_local->tx_start_page + 6);
				dev->trans_start = jiffies;
				ei_local->txing = 1;
				ei_local->tx2 = -1,
				ei_local->lasttx = 2;
			} else
				ei_local->lasttx = 20, ei_local->txing = 0;
		} else if (ei_local->tx2 < 0) {
			if (ei_local->lasttx != 2  &&  ei_local->lasttx != -2)
				printk("%s: bogus last_tx_buffer %d, tx2=%d.\n",
					   ei_local->name, ei_local->lasttx, ei_local->tx2);
			ei_local->tx2 = 0;
			dev->tbusy = 0;
			if (ei_local->tx1 > 0) {
				NS8390_trigger_send(dev, ei_local->tx1, ei_local->tx_start_page);
				dev->trans_start = jiffies;
				ei_local->txing = 1;
				ei_local->tx1 = -1;
				ei_local->lasttx = 1;
			} else

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91精品国产手机| 欧美国产成人在线| 久久先锋资源网| 国产黄色精品视频| 亚洲va欧美va天堂v国产综合| 日韩一区二区免费在线观看| 懂色av中文字幕一区二区三区| 一区二区三区日韩欧美精品 | 精品久久久久99| 97se亚洲国产综合自在线观| 奇米一区二区三区| 亚洲欧美色综合| www久久久久| 在线播放日韩导航| 91免费在线看| 欧美xxx久久| 欧美日韩一区视频| 91蜜桃在线免费视频| 国产99久久久国产精品潘金| 精品国产网站在线观看| 欧美日韩一区二区三区在线| 波多野结衣中文一区| 久久成人麻豆午夜电影| 国产欧美一区二区精品久导航 | 国产原创一区二区三区| 国产精品理论片在线观看| 欧美xfplay| 91精品国产黑色紧身裤美女| 欧美日韩综合色| 国产aⅴ综合色| 国产成人综合视频| 国产一区日韩二区欧美三区| 天堂va蜜桃一区二区三区| 欧美成人乱码一区二区三区| 7777精品伊人久久久大香线蕉经典版下载 | 91麻豆.com| 风间由美一区二区av101| 韩国女主播成人在线观看| 中文字幕的久久| 国产清纯美女被跳蛋高潮一区二区久久w| 日韩欧美国产麻豆| 在线不卡a资源高清| 欧美电影在哪看比较好| 制服丝袜av成人在线看| 欧美一区二区在线免费播放| 色综合久久88色综合天天免费| 不卡的电影网站| 91免费看`日韩一区二区| 欧美日韩精品一区二区| 欧美精品亚洲一区二区在线播放| 欧美日韩精品一区二区天天拍小说 | 国产综合色视频| 成人激情图片网| 国产主播一区二区三区| 国产成人午夜电影网| 国产成人综合精品三级| 亚洲成a人片在线不卡一二三区| 亚欧色一区w666天堂| 午夜精品久久久久久久久久| 五月婷婷久久丁香| 国产精品99久久久久久久vr| 国产成人在线视频网址| 欧美视频在线观看一区二区| 在线不卡的av| 2021中文字幕一区亚洲| 亚洲欧美一区二区三区久本道91| 国产欧美一区二区精品秋霞影院| 亚洲自拍都市欧美小说| 精品一二线国产| 色噜噜狠狠成人网p站| 国产精品三级视频| 五月天一区二区| 99久久久久久99| 另类小说欧美激情| 91精品国产免费| 依依成人综合视频| 丁香五精品蜜臀久久久久99网站 | 国产亚洲一区二区三区四区 | 极品尤物av久久免费看| 91网站在线观看视频| 欧美一区二区在线观看| 亚洲综合丝袜美腿| 国产精品一品二品| 欧美一级生活片| 国产精品视频你懂的| 精品在线免费观看| 色狠狠色噜噜噜综合网| 欧美一级艳片视频免费观看| 一区二区三区在线看| 丁香网亚洲国际| 欧美肥妇bbw| 亚洲人亚洲人成电影网站色| 激情综合色丁香一区二区| 99久久精品费精品国产一区二区| 欧美xxxx在线观看| 日欧美一区二区| 91成人看片片| 久久精品亚洲麻豆av一区二区 | 国产成人一区在线| 91精品国产综合久久精品性色| 日本一区二区三区dvd视频在线| 亚洲少妇30p| 国产91丝袜在线观看| 精品国产髙清在线看国产毛片| 亚洲欧美日韩在线| 色综合中文综合网| 欧美成人女星排名| 蜜桃av一区二区| 欧美本精品男人aⅴ天堂| 国产农村妇女精品| 亚洲国产精品久久艾草纯爱| 日本道在线观看一区二区| 人人爽香蕉精品| 欧美不卡一区二区三区四区| 日本中文字幕一区| 欧美v亚洲v综合ⅴ国产v| 日韩综合一区二区| 国产成人免费视频网站 | 麻豆国产精品一区二区三区 | 国产精品久久午夜夜伦鲁鲁| 成人免费视频视频在线观看免费| 国产网红主播福利一区二区| 国产亚洲成aⅴ人片在线观看 | 欧美大片日本大片免费观看| 日韩精品一二三区| 欧美日韩亚洲综合在线| 中文字幕第一页久久| 国产成人三级在线观看| 国产精品久久久久三级| 丁香亚洲综合激情啪啪综合| 国产精品福利电影一区二区三区四区| 成人免费视频一区二区| 国产亚洲婷婷免费| 91老师片黄在线观看| 亚洲成a人片在线不卡一二三区| 国产一本一道久久香蕉| 国产精品久久网站| 欧美日韩国产一级片| 亚洲高清中文字幕| 久久品道一品道久久精品| 国产成人av自拍| 国产午夜亚洲精品理论片色戒| 日本伊人午夜精品| 国产精品少妇自拍| www.在线成人| 久久国产三级精品| 国产精品美女久久久久久久网站| 欧美视频完全免费看| 国产精品一区二区在线播放| 亚洲精品自拍动漫在线| 精品美女在线观看| youjizz国产精品| 久久99久久99| 亚洲香蕉伊在人在线观| 精品日韩av一区二区| 在线观看免费成人| 国产高清在线观看免费不卡| 日韩亚洲欧美综合| 久久99精品国产麻豆不卡| 国产精品你懂的在线| 日韩午夜激情电影| 色综合久久中文字幕综合网| 国产一区二区三区在线观看精品 | 久久成人精品无人区| 日韩美女视频一区| 国产亚洲欧美在线| 欧美影院午夜播放| 91麻豆国产精品久久| 国产精品1区2区3区在线观看| 亚洲国产人成综合网站| 2023国产精品自拍| 欧美性猛片aaaaaaa做受| 精品综合久久久久久8888| 亚洲综合免费观看高清在线观看| 日韩一区二区免费高清| 97成人超碰视| 不卡av电影在线播放| 国产精品69毛片高清亚洲| 亚洲成人av电影| 亚洲色图另类专区| 欧美专区亚洲专区| 在线不卡免费欧美| 欧美精选午夜久久久乱码6080| 一本大道av一区二区在线播放 | 欧美成人三级在线| 日韩一区二区在线观看视频 | 91色|porny| 成人黄色大片在线观看| 成人高清免费观看| av成人老司机| 91污片在线观看| 色婷婷综合中文久久一本| 久久精品72免费观看| 色综合天天综合色综合av | 亚洲一区二区三区四区不卡| 一区二区在线观看免费| 夜夜精品浪潮av一区二区三区| 亚洲精品亚洲人成人网在线播放| 欧美一区二区三区播放老司机| 欧美videossexotv100|