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

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

?? depca.c

?? LINUX1.0源代碼,代碼條理清晰
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*  depca.c: A DIGITAL DEPCA ethernet driver for linux.

    Written 1994 by David C. Davies.

    Copyright 1994 David C. Davies and 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 driver is written for the Digital Equipment Corporation series
    of DEPCA ethernet cards:

    	DE100 DEPCA
	DE200 DEPCA Turbo
	DE202 DEPCA Turbo (TP BNC)
	DE210 DEPCA

    The driver has been tested on DE100 and DE20x cards in a relatively busy 
    network.

    The author may be reached as davies@wanton.enet.dec.com or
    Digital Equipment Corporation, 146 Main Street, Maynard MA 01754.

    =========================================================================
    The driver was based on the 'lance.c' driver from Donald Becker which is
    included with the standard driver distribution for linux. Modifications
    were made to most routines and the hardware recognition routines were
    written from scratch. Primary references used were:

    1) Lance.c code in /linux/drivers/net/
    2) "Ethernet/IEEE 802.3 Family. 1992 World Network Data Book/Handbook",
       AMD, 1992 [(800) 222-9323].
    3) "Am79C90 CMOS Local Area Network Controller for Ethernet (C-LANCE)",
       AMD, Pub. #17881, May 1993.
    4) "Am79C960 PCnet-ISA(tm), Single-Chip Ethernet Controller for ISA",
       AMD, Pub. #16907, May 1992
    5) "DEC EtherWORKS LC Ethernet Controller Owners Manual",
       Digital Equipment corporation, 1990, Pub. #EK-DE100-OM.003
    6) "DEC EtherWORKS Turbo Ethernet Controller Owners Manual",
       Digital Equipment corporation, 1990, Pub. #EK-DE200-OM.003
    7) "DEPCA Hardware Reference Manual", Pub. #EK-DEPCA-PR
       Digital Equipment Corporation, 1989
    8) "DEC EtherWORKS Turbo_(TP BNC) Ethernet Controller Owners Manual",
       Digital Equipment corporation, 1991, Pub. #EK-DE202-OM.001
    
    Peter Bauer's depca.c (V0.5) was referred to when debugging this driver.
    The hash filter code was  derived from Reference  3 and has been  tested
    only to the extent that the Table  A-1, page A-7,  was confirmed to fill
    the   filter bit   positions  correctly.  Hash   filtering  is  not  yet
    implemented in the current driver set.

    The  DE200 series boards have   on-board 64kB RAM  for  use as a  shared
    memory network buffer. Only  the DE100 cards  make  use of a  2kB buffer
    mode  which has not  been implemented in  this driver (only the 32kB and
    64kB modes are supported).

    At the  most only 2 DEPCA  cards can be supported  because there is only
    provision for two I/O base addresses on the cards (0x300 and 0x200). The
    base  address is  'autoprobed' by  looking  for  the self  test PROM and
    detecting the  card name.  The shared memory  base address is decoded by
    'autoprobing' the Ethernet PROM address information. The second DEPCA is
    detected and information placed  in the base_addr  variable of the  next
    device  structure   (which is created    if  necessary),  thus  enabling
    ethif_probe initialization for the device.

    ************************************************************************

    NOTE: If you are using two  DEPCAs, it is important  that you assign the
    base memory addresses  correctly.  The driver  autoprobes I/O 0x300 then
    0x200.  The base memory  address for the  first device must be less than
    that of the second so that the auto probe will  correctly assign the I/O
    and  memory addresses on  the same card.  I can't  think of  a way to do
    this unambiguously at the moment, since there is nothing on the cards to
    tie I/O and memory information together.

    I   am unable to test    2 DEPCAs together for   now,   so this code  is
    unchecked. All reports, good or bad, are welcome.

    ************************************************************************

    The board IRQ  setting must be  at  an unused  IRQ  which is auto-probed
    using   Donald Becker's   autoprobe   routines. DE100   board IRQs   are
    {2,3,4,5,7}, whereas  the DE200 is at  {5,9,10,11,15}. Note that IRQ2 is
    really IRQ9 in machines with 16 IRQ lines.

    No 16MB memory  limitation should exist with this  driver as DMA is  not
    used and the common memory area is in low memory on the network card (my
    current system has 20MB and I've not had problems yet).

    The DE203,  DE204  and DE205 cards  may  also work  with this driver  (I
    haven't tested  them so I don't  know). If you have  one of these cards,
    place the name in the DEPCA_SIGNATURE string  around line 160, recompile
    the kernel and reboot. Check if the card  is recognised and works - mail
    me if so, so that I can add it into the list of supported cards!

    TO DO:
    ------

    1. Implement the 2k buffer mode - does anyone need it??

    Revision History
    ----------------

    Version   Date        Description
  
      0.1   25-jan-94     Initial writing
      0.2   27-jan-94     Added LANCE TX buffer chaining
      0.3    1-feb-94     Added multiple DEPCA support
      0.31   4-feb-94     Added DE202 recognition
      0.32  19-feb-94     Tidy up. Improve multi-DEPCA support.

    =========================================================================
*/

static char *version = "depca.c:v0.32 2/19/94 davies@wanton.enet.dec.com\n";

#include <stdarg.h>
#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/string.h>
#include <linux/ptrace.h>
#include <linux/errno.h>
#include <linux/ioport.h>
#include <linux/malloc.h>
#include <linux/interrupt.h>
#include <asm/bitops.h>
#include <asm/io.h>
#include <asm/dma.h>

#include "dev.h"
#include "iow.h"
#include "eth.h"
#include "skbuff.h"
#include "arp.h"
#include "depca.h"

#ifdef DEPCA_DEBUG
int depca_debug = DEPCA_DEBUG;
#else
int depca_debug = 1;
#endif

#ifndef DEPCA_IRQ
/*#define DEPCA_IRQ	{5,9,10,11,15,0}*/
#define DEPCA_IRQ	5
#endif

#ifndef PROBE_LENGTH
#define PROBE_LENGTH    32
#endif

#ifndef PROBE_SEQUENCE
#define PROBE_SEQUENCE "FF0055AAFF0055AA"
#endif

#ifndef DEPCA_SIGNATURE
#define DEPCA_SIGNATURE {"DEPCA","DE100","DE200","DE202","DE210",""}
#define DEPCA_NAME_LENGTH 8
#endif

#ifndef DEPCA_RAM_BASE_ADDRESSES
#define DEPCA_RAM_BASE_ADDRESSES {0xc0000,0xd0000,0xe0000,0x00000}
#endif
static short mem_chkd = 0;               /* holds which base addrs have been */
					 /* checked, for multi-DEPCA case */

#ifndef DEPCA_IO_PORTS
#define DEPCA_IO_PORTS {0x300, 0x200, 0}
#endif

#ifndef DEPCA_TOTAL_SIZE
#define DEPCA_TOTAL_SIZE 0x10
#endif

#ifndef MAX_NUM_DEPCAS
#define MAX_NUM_DEPCAS 2
#endif

/*
** Set the number of Tx and Rx buffers. 
*/
#ifndef DEPCA_BUFFER_LOG_SZ
#define RING_SIZE	16              /* 16 buffers */
#else
#define RING_SIZE	(1 << (DEPCA_BUFFERS_LOG_SZ))
#endif  /* DEPCA_BUFFER_LOG_SZ */

#define PKT_BUF_SZ	1544            /* Buffer size for each Tx/Rx buffer */
#define PKT_SZ   	1514            /* Maximum ethernet packet length */
#define DAT_SZ   	1500            /* Maximum ethernet data length */
#define PKT_HDR_LEN     14              /* Addresses and data length info */

#ifdef HAVE_MULTICAST
#ifndef CRC_POLYNOMIAL
#define CRC_POLYNOMIAL 0x04c11db7       /* Ethernet CRC polynomial */
#endif /* CRC_POLYNOMIAL */
#endif /* HAVE_MULTICAST */

#ifndef HAVE_ALLOC_SKB
#define alloc_skb(size, priority) (struct sk_buff *) kmalloc(size,priority)
#define kfree_skbmem(buff, size) kfree_s(buff,size)
#endif  /* HAVE_ALLOC_SKB */

/*
** The DEPCA Rx and Tx ring descriptors. 
*/
struct depca_rx_head {
    long base;
    short buf_length;		/* This length is negative 2's complement! */
    short msg_length;		/* This length is "normal". */
};

struct depca_tx_head {
    long base;
    short length;		/* This length is negative 2's complement! */
    short misc;                 /* Errors and TDR info */
};

struct depca_ring_info {
};

/*
** The Lance initialization block, described in databook, in common memory.
*/
struct depca_init {
    unsigned short mode;	/* Mode register */
    unsigned char phys_addr[ETH_ALEN];	/* Physical ethernet address */
    unsigned short filter[4];	/* Multicast filter. */
    unsigned long rx_ring;     	/* Rx ring base pointer & ring length */
    unsigned long tx_ring;	/* Tx ring base pointer & ring length */
};

struct depca_private {
    char devname[8];            /* Not used */
    struct depca_rx_head *rx_ring; /* Pointer to start of RX descriptor ring */
    struct depca_tx_head *tx_ring; /* Pointer to start of TX descriptor ring */
    struct depca_init	init_block;/* Initialization block */
    long dma_buffs;		/* Start address of Rx and Tx buffers. */
    int	cur_rx, cur_tx;		/* The next free ring entry */
    int dirty_rx, dirty_tx;	/* The ring entries to be free()ed. */
    int dma;
    struct enet_statistics stats;
    char old_depca;
    short ringSize;             /* ring size based on available memory */
    short rmask;                /* modulus mask based on ring size */
    long rlen;                  /* log2(ringSize) for the descriptors */
};

/*
** Public Functions
*/
static int depca_open(struct device *dev);
static int depca_start_xmit(struct sk_buff *skb, struct device *dev);
static void depca_interrupt(int reg_ptr);
static int depca_close(struct device *dev);
static struct enet_statistics *depca_get_stats(struct device *dev);
#ifdef HAVE_MULTICAST
static void set_multicast_list(struct device *dev, int num_addrs, void *addrs);
#endif

/*
** Private functions
*/
static int depca_probe1(struct device *dev, short ioaddr);
static void depca_init_ring(struct device *dev);
static int depca_rx(struct device *dev);
static int depca_tx(struct device *dev);

static void LoadCSRs(struct device *dev);
static int InitRestartDepca(struct device *dev);
static char *DepcaSignature(unsigned long mem_addr);
static int DevicePresent(short ioaddr);
#ifdef HAVE_MULTICAST
static void SetMulticastFilter(int num_addrs, char *addrs, char *multicast_table);
#endif

static int num_depcas = 0, num_eth = 0;;

/*
** Miscellaneous defines...
*/
#define STOP_DEPCA \
    outw(CSR0, DEPCA_ADDR);\
    outw(STOP, DEPCA_DATA)



int depca_probe(struct device *dev)
{
    int *port, ports[] = DEPCA_IO_PORTS;
    int base_addr = dev->base_addr;
    int status;
    struct device *eth0 = (struct device *) NULL;

    if (base_addr > 0x1ff) {	      /* Check a single specified location. */
		status = depca_probe1(dev, base_addr);
    } else if (base_addr > 0) {	      /* Don't probe at all. */
		status = -ENXIO;
    } else {                          /* First probe for the DEPCA test */
                                      /* pattern in ROM */

      for (status = -ENODEV, port = &ports[0]; 
	                    *port && (num_depcas < MAX_NUM_DEPCAS); port++) {
	int ioaddr = *port;

#ifdef HAVE_PORTRESERVE
	if (check_region(ioaddr, DEPCA_TOTAL_SIZE))
	    continue;
#endif
	if (DevicePresent(DEPCA_PROM) == 0) {
	  if (num_depcas > 0) {        /* only gets here in autoprobe */

	    /*
	    ** Check the device structures for an end of list or unused device
	    */
	    while (dev->next != (struct device *)NULL) {
	      if (dev->next->base_addr == 0xffe0) break;
	      dev = dev->next;         /* walk through eth device list */
	      num_eth++;               /* increment eth device number */
	    }

	    /*
	    ** If no more device structures, malloc one up. If memory could
	    ** not be allocated, print an error message.
	    ** 
	    */
	    if (dev->next == (struct device *)NULL) {
	      dev->next = (struct device *)kmalloc(sizeof(struct device) + 8,
                                                                  GFP_KERNEL);
	    } else {
	      printk("eth%d: Device not initialised, insufficient memory\n",
		                                                      num_eth);
	    }

	    /*
	    ** If the memory was allocated, point to the new memory area
	    ** and initialize it (name, I/O address, next device (NULL) and
	    ** initialisation probe routine).
	    */
	    if ((dev->next != (struct device *)NULL) &&
		(num_eth > 0) && (num_eth < 9999)) {
	      dev = dev->next;         /* point to the new device */
	      dev->name = (char *)(dev + sizeof(struct device));
	      sprintf(dev->name,"eth%d", num_eth); /* New device name */
	      dev->base_addr = ioaddr; /* assign the io address */
	      dev->next = (struct device *)NULL; /* mark the end of list */
	      dev->init = &depca_probe;/* initialisation routine */
	    }
	  } else {
	    eth0 = dev;                /* remember the first device */
	    status = depca_probe1(dev, ioaddr);
	  }
	  num_depcas++;
	  num_eth++;
	}
      }
      if (eth0) dev = eth0;             /* restore the first device */
    }

    if (status) dev->base_addr = base_addr;

    return status;			/* ENODEV would be more accurate. */
}

static int
depca_probe1(struct device *dev, short ioaddr)
{
    struct depca_private *lp;
    int i,j, status=0;
    unsigned long mem_start, mem_base[] = DEPCA_RAM_BASE_ADDRESSES;
    char *name=(char *)NULL;
    int nicsr, offset;


    /*
    ** Stop the DEPCA. Enable the DBR ROM. Disable interrupts and remote boot
    */
    STOP_DEPCA;

    nicsr = inw(DEPCA_NICSR);
    nicsr = ((nicsr & ~SHE & ~RBE & ~IEN) | IM);
    outw(nicsr, DEPCA_NICSR);

    if (inw(DEPCA_DATA) == STOP) {

    /* Now find out what kind of DEPCA we have. The DE100 uses a different
    ** addressing scheme for some registers compared to the DE2xx series.
    ** Note that a base address location is marked as checked if no DEPCA is
    ** there or one is found (when the search is immediately terminated). This
    ** shortens the search time a little for multiple DEPCAs.
    */

      for (j = 0, i = 0; mem_base[i] && (j == 0);) {
	if (((mem_chkd >> i) & 0x01) == 0) { /* has the memory been checked? */
	  name = DepcaSignature(mem_base[i]);/* check for a DEPCA here */
	  mem_chkd |= (0x01 << i);           /* mark location checked */
	  if (*name != (char)NULL) {         /* one found? */
	    j = 1;                           /* set exit flag */
	  } else {
	    i++;                             /* increment search index */
	  }
	}
      }

      if (*name != (char)NULL) {          /* found a DEPCA device */
	mem_start = mem_base[i];
	dev->base_addr = ioaddr;

	printk("%s: DEPCA at %#3x is a %s, ", dev->name, ioaddr, name);

      /* There is a 32 byte station address PROM at DEPCA_PROM address.
	 The first six bytes are the station address. They can be read
	 directly since the signature search set up the ROM address 
	 counter correctly just before this function.

	 For the DE100 we have to be careful about which port is used to
	 read the ROM info.
      */

	if (strstr(name,"DE100")!=(char *)NULL) {
	  j = 1;
	} else {
	  j = 0;
	}

	printk("ethernet address ");
	for (i = 0; i < ETH_ALEN - 1; i++) { /* get the ethernet address */
	  printk("%2.2x:", dev->dev_addr[i] = inb(DEPCA_PROM + j));
	}
	printk("%2.2x", dev->dev_addr[i] = inb(DEPCA_PROM + j));

	for (;i<32;i++) {                /* leave ROM counter in known state */
	  j=inb(DEPCA_PROM);
	}

#ifdef HAVE_PORTRESERVE
	snarf_region(ioaddr, DEPCA_TOTAL_SIZE);
#endif

	/* 
	 ** Determine the base address for the DEPCA RAM from the NI-CSR
	 ** and make up a DEPCA-specific-data structure. 
        */

	if (nicsr & BUF) {
	  offset = 0x8000;              /* 32kbyte RAM */
	  nicsr &= ~BS;                 /* DEPCA RAM in top 32k */
	  printk(",\n      with 32kB RAM");
	} else {
	  offset = 0x0000;              /* 64kbyte RAM */
	  printk(",\n      with 64kB RAM");
	}

	mem_start += offset;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲视频在线观看三级| 99re亚洲国产精品| 国产在线精品一区二区不卡了 | 日韩午夜激情视频| 精品免费日韩av| 国产精品午夜在线| 日韩黄色在线观看| 高清不卡一二三区| 3d成人h动漫网站入口| 国产日产欧美一区| 天天爽夜夜爽夜夜爽精品视频| 国产精品资源网站| 日韩视频一区二区| 国产传媒欧美日韩成人| 欧美高清视频在线高清观看mv色露露十八 | 粗大黑人巨茎大战欧美成人| 欧美乱熟臀69xxxxxx| 免费av成人在线| 欧洲精品在线观看| 国产网站一区二区三区| 日本欧美一区二区三区乱码| 欧美性感一类影片在线播放| 中文字幕一区二区三中文字幕| 久久99国产精品久久| 欧美主播一区二区三区| 青青青伊人色综合久久| 亚洲国产精品成人综合色在线婷婷| 日本视频一区二区三区| 国产欧美日本一区视频| 在线免费观看日本一区| 久久69国产一区二区蜜臀| 亚洲欧洲色图综合| 欧美一级电影网站| 色综合久久中文综合久久97| 国产欧美日韩激情| 欧美一区二区三区免费观看视频| 亚洲一卡二卡三卡四卡五卡| 波多野结衣精品在线| 国产精品乱人伦| 日韩一区二区三区av| 99re在线视频这里只有精品| 美国毛片一区二区| 精品少妇一区二区三区免费观看 | 亚洲情趣在线观看| fc2成人免费人成在线观看播放| 亚洲成人激情综合网| 欧美日韩精品一区二区天天拍小说 | 自拍偷自拍亚洲精品播放| 91麻豆精品国产91久久久更新时间 | 美女网站色91| 亚洲精品国产a久久久久久| 色94色欧美sute亚洲线路一ni| 亚洲欧美日韩在线不卡| 久久蜜桃香蕉精品一区二区三区| 国内精品国产成人国产三级粉色 | 国产一区二区福利视频| 亚洲成人av一区二区| 国产精品乱码一区二三区小蝌蚪| 亚洲精品一区二区三区四区高清| 精品一区二区三区在线播放视频| 亚洲综合区在线| 亚洲欧美综合网| 国产精品麻豆网站| 国产精品视频一二三| 久久久久久久久久久黄色| 欧美大尺度电影在线| 国产1区2区3区精品美女| 六月丁香综合在线视频| 国产精品你懂的| 亚洲国产成人午夜在线一区| 久久久久久一级片| 2024国产精品| 色视频欧美一区二区三区| 波多野结衣在线aⅴ中文字幕不卡| 亚洲激情成人在线| 亚洲伦在线观看| 亚洲男人都懂的| 亚洲精品乱码久久久久久| 亚洲色图在线看| 亚洲免费在线看| 一区二区三区欧美日韩| 久久在线观看免费| 久久久蜜桃精品| 国产精品三级av| 亚洲欧美另类小说| 亚洲一二三四区不卡| 亚洲一区二区美女| 麻豆传媒一区二区三区| 激情六月婷婷综合| 国产高清久久久| 不卡一区中文字幕| 在线日韩一区二区| 日韩情涩欧美日韩视频| 久久久99精品久久| 最新日韩av在线| 婷婷国产v国产偷v亚洲高清| 美腿丝袜在线亚洲一区| 国产精品一区二区无线| 99国产精品久| 欧美美女一区二区三区| 精品成人私密视频| 中文字幕一区二区三| 亚洲图片欧美综合| 亚洲日本va在线观看| 一区二区成人在线观看| 日韩av一二三| 懂色一区二区三区免费观看| 欧美天堂一区二区三区| 日韩一区二区在线观看视频| 久久免费电影网| 夜夜精品视频一区二区| 久久99国产精品免费| 99久久99久久久精品齐齐| 在线看日本不卡| 久久在线免费观看| 亚洲成年人网站在线观看| 久久精品国产77777蜜臀| av成人动漫在线观看| 日韩一级免费观看| 亚洲色图欧美偷拍| 精油按摩中文字幕久久| 99re这里都是精品| www国产亚洲精品久久麻豆| 亚洲影院久久精品| 国产精品一区二区x88av| 欧美美女一区二区三区| 国产精品久久久久三级| 中文字幕中文字幕一区二区| 天天射综合影视| 一本色道久久综合亚洲91| 亚洲人午夜精品天堂一二香蕉| 天堂午夜影视日韩欧美一区二区| 国产精品18久久久久久久久| 欧美日韩成人激情| 亚洲婷婷国产精品电影人久久| 免费欧美在线视频| 色诱视频网站一区| 国产欧美精品一区二区三区四区| 亚洲va国产天堂va久久en| 成人精品小蝌蚪| 久久丝袜美腿综合| 秋霞午夜av一区二区三区| 欧美在线观看一区| 亚洲欧洲日韩一区二区三区| 国内精品视频666| 欧美一级精品大片| 亚洲第一在线综合网站| av不卡一区二区三区| 国产日产亚洲精品系列| 国产久卡久卡久卡久卡视频精品| 欧美日韩的一区二区| 一区二区欧美国产| 色综合天天视频在线观看| 国产精品麻豆欧美日韩ww| 国产精品系列在线播放| 欧美成人vps| 麻豆91小视频| 日韩美女一区二区三区四区| 午夜精品福利在线| 欧美性色欧美a在线播放| 一区二区三区在线视频播放| hitomi一区二区三区精品| 国产精品女上位| 97超碰欧美中文字幕| 亚洲色图第一区| 日本高清免费不卡视频| 亚洲精品国产a| 欧美日韩一区二区在线观看| 精品久久人人做人人爱| 99久久久久久99| 中文字幕一区二区三区在线播放| 成人av影院在线| 亚洲欧美日韩国产成人精品影院 | 成人av电影在线观看| 一区在线中文字幕| 99久久精品国产毛片| 亚洲精品国产品国语在线app| 色国产综合视频| 亚洲超碰精品一区二区| 制服丝袜亚洲播放| 捆绑调教一区二区三区| 久久久久久久综合色一本| 成人涩涩免费视频| 日韩美女啊v在线免费观看| 色婷婷精品久久二区二区蜜臂av| 亚洲一区二区三区不卡国产欧美| 欧美久久免费观看| 久久国产综合精品| 中文字幕免费不卡在线| 一本色道亚洲精品aⅴ| 午夜久久久久久久久| 欧美mv日韩mv| 成人91在线观看| 三级亚洲高清视频| 久久精品视频在线看| 91丝袜美女网| 国产视频在线观看一区二区三区| 成人黄色a**站在线观看| 亚洲综合av网| 久久久亚洲精品石原莉奈|