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

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

?? axnet_cs.c

?? pcmcia驅動源代碼,直接可以在linux2.6下使用 !
?? C
?? 第 1 頁 / 共 4 頁
字號:
/*======================================================================    A PCMCIA ethernet driver for Asix AX88190-based cards    The Asix AX88190 is a NS8390-derived chipset with a few nasty    idiosyncracies that make it very inconvenient to support with a    standard 8390 driver.  This driver is based on pcnet_cs, with the    tweaked 8390 code grafted on the end.  Much of what I did was to    clean up and update a similar driver supplied by Asix, which was    adapted by William Lee, william@asix.com.tw.    Copyright (C) 2001 David A. Hinds -- dahinds@users.sourceforge.net    axnet_cs.c 1.28 2002/06/29 06:27:37    The network driver code is based on Donald Becker's NE2000 code:    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 General Public License,    incorporated herein by reference.    Donald Becker may be reached at becker@scyld.com======================================================================*/#include <linux/kernel.h>#include <linux/module.h>#include <linux/init.h>#include <linux/ptrace.h>#include <linux/slab.h>#include <linux/string.h>#include <linux/timer.h>#include <linux/delay.h>#include <linux/spinlock.h>#include <linux/ethtool.h>#include <linux/netdevice.h>#include <linux/crc32.h>#include "../8390.h"#include <pcmcia/cs_types.h>#include <pcmcia/cs.h>#include <pcmcia/cistpl.h>#include <pcmcia/ciscode.h>#include <pcmcia/ds.h>#include <pcmcia/cisreg.h>#include <asm/io.h>#include <asm/system.h>#include <asm/byteorder.h>#include <asm/uaccess.h>#define AXNET_CMD	0x00#define AXNET_DATAPORT	0x10	/* NatSemi-defined port window offset. */#define AXNET_RESET	0x1f	/* Issue a read to reset, a write to clear. */#define AXNET_MII_EEP	0x14	/* Offset of MII access port */#define AXNET_TEST	0x15	/* Offset of TEST Register port */#define AXNET_GPIO	0x17	/* Offset of General Purpose Register Port */#define AXNET_START_PG	0x40	/* First page of TX buffer */#define AXNET_STOP_PG	0x80	/* Last page +1 of RX ring */#define AXNET_RDC_TIMEOUT 0x02	/* Max wait in jiffies for Tx RDC */#define IS_AX88190	0x0001#define IS_AX88790	0x0002/*====================================================================*//* Module parameters */MODULE_AUTHOR("David Hinds <dahinds@users.sourceforge.net>");MODULE_DESCRIPTION("Asix AX88190 PCMCIA ethernet driver");MODULE_LICENSE("GPL");#ifdef PCMCIA_DEBUG#define INT_MODULE_PARM(n, v) static int n = v; module_param(n, int, 0)INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG);#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)static char *version ="axnet_cs.c 1.28 2002/06/29 06:27:37 (David Hinds)";#else#define DEBUG(n, args...)#endif/*====================================================================*/static int axnet_config(struct pcmcia_device *link);static void axnet_release(struct pcmcia_device *link);static int axnet_open(struct net_device *dev);static int axnet_close(struct net_device *dev);static int axnet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);static const struct ethtool_ops netdev_ethtool_ops;static irqreturn_t ei_irq_wrapper(int irq, void *dev_id);static void ei_watchdog(u_long arg);static void axnet_reset_8390(struct net_device *dev);static int mdio_read(kio_addr_t addr, int phy_id, int loc);static void mdio_write(kio_addr_t addr, int phy_id, int loc, int value);static void get_8390_hdr(struct net_device *,			 struct e8390_pkt_hdr *, int);static void block_input(struct net_device *dev, int count,			struct sk_buff *skb, int ring_offset);static void block_output(struct net_device *dev, int count,			 const u_char *buf, const int start_page);static void axnet_detach(struct pcmcia_device *p_dev);static void axdev_setup(struct net_device *dev);static void AX88190_init(struct net_device *dev, int startp);static int ax_open(struct net_device *dev);static int ax_close(struct net_device *dev);static irqreturn_t ax_interrupt(int irq, void *dev_id);/*====================================================================*/typedef struct axnet_dev_t {	struct pcmcia_device	*p_dev;    dev_node_t		node;    caddr_t		base;    struct timer_list	watchdog;    int			stale, fast_poll;    u_short		link_status;    u_char		duplex_flag;    int			phy_id;    int			flags;} axnet_dev_t;static inline axnet_dev_t *PRIV(struct net_device *dev){	void *p = (char *)netdev_priv(dev) + sizeof(struct ei_device);	return p;}/*======================================================================    axnet_attach() creates an "instance" of the driver, allocating    local data structures for one device.  The device is registered    with Card Services.======================================================================*/static int axnet_probe(struct pcmcia_device *link){    axnet_dev_t *info;    struct net_device *dev;    DEBUG(0, "axnet_attach()\n");    dev = alloc_netdev(sizeof(struct ei_device) + sizeof(axnet_dev_t),			"eth%d", axdev_setup);    if (!dev)	return -ENOMEM;    info = PRIV(dev);    info->p_dev = link;    link->priv = dev;    link->irq.Attributes = IRQ_TYPE_EXCLUSIVE;    link->irq.IRQInfo1 = IRQ_LEVEL_ID;    link->conf.Attributes = CONF_ENABLE_IRQ;    link->conf.IntType = INT_MEMORY_AND_IO;    dev->open = &axnet_open;    dev->stop = &axnet_close;    dev->do_ioctl = &axnet_ioctl;    SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);    return axnet_config(link);} /* axnet_attach *//*======================================================================    This deletes a driver "instance".  The device is de-registered    with Card Services.  If it has been released, all local data    structures are freed.  Otherwise, the structures will be freed    when the device is released.======================================================================*/static void axnet_detach(struct pcmcia_device *link){    struct net_device *dev = link->priv;    DEBUG(0, "axnet_detach(0x%p)\n", link);    if (link->dev_node)	unregister_netdev(dev);    axnet_release(link);    free_netdev(dev);} /* axnet_detach *//*======================================================================    This probes for a card's hardware address by reading the PROM.======================================================================*/static int get_prom(struct pcmcia_device *link){    struct net_device *dev = link->priv;    kio_addr_t ioaddr = dev->base_addr;    int i, j;    /* This is based on drivers/net/ne.c */    struct {	u_char value, offset;    } program_seq[] = {	{E8390_NODMA+E8390_PAGE0+E8390_STOP, E8390_CMD}, /* Select page 0*/	{0x01,	EN0_DCFG},	/* Set word-wide access. */	{0x00,	EN0_RCNTLO},	/* Clear the count regs. */	{0x00,	EN0_RCNTHI},	{0x00,	EN0_IMR},	/* Mask completion irq. */	{0xFF,	EN0_ISR},	{E8390_RXOFF|0x40, EN0_RXCR},	/* 0x60  Set to monitor */	{E8390_TXOFF, EN0_TXCR},	/* 0x02  and loopback mode. */	{0x10,	EN0_RCNTLO},	{0x00,	EN0_RCNTHI},	{0x00,	EN0_RSARLO},	/* DMA starting at 0x0400. */	{0x04,	EN0_RSARHI},	{E8390_RREAD+E8390_START, E8390_CMD},    };    /* Not much of a test, but the alternatives are messy */    if (link->conf.ConfigBase != 0x03c0)	return 0;    axnet_reset_8390(dev);    mdelay(10);    for (i = 0; i < sizeof(program_seq)/sizeof(program_seq[0]); i++)	outb_p(program_seq[i].value, ioaddr + program_seq[i].offset);    for (i = 0; i < 6; i += 2) {	j = inw(ioaddr + AXNET_DATAPORT);	dev->dev_addr[i] = j & 0xff;	dev->dev_addr[i+1] = j >> 8;    }    return 1;} /* get_prom *//*======================================================================    axnet_config() is scheduled to run after a CARD_INSERTION event    is received, to configure the PCMCIA socket, and to make the    ethernet device available to the system.======================================================================*/#define CS_CHECK(fn, ret) \do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)static int try_io_port(struct pcmcia_device *link){    int j, ret;    if (link->io.NumPorts1 == 32) {	link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;	if (link->io.NumPorts2 > 0) {	    /* for master/slave multifunction cards */	    link->io.Attributes2 = IO_DATA_PATH_WIDTH_8;	    link->irq.Attributes = 		IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED;	}    } else {	/* This should be two 16-port windows */	link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;	link->io.Attributes2 = IO_DATA_PATH_WIDTH_16;    }    if (link->io.BasePort1 == 0) {	link->io.IOAddrLines = 16;	for (j = 0; j < 0x400; j += 0x20) {	    link->io.BasePort1 = j ^ 0x300;	    link->io.BasePort2 = (j ^ 0x300) + 0x10;	    ret = pcmcia_request_io(link, &link->io);	    if (ret == CS_SUCCESS) return ret;	}	return ret;    } else {	return pcmcia_request_io(link, &link->io);    }}static int axnet_config(struct pcmcia_device *link){    struct net_device *dev = link->priv;    axnet_dev_t *info = PRIV(dev);    tuple_t tuple;    cisparse_t parse;    int i, j, last_ret, last_fn;    u_short buf[64];    DEBUG(0, "axnet_config(0x%p)\n", link);    tuple.Attributes = 0;    tuple.TupleData = (cisdata_t *)buf;    tuple.TupleDataMax = sizeof(buf);    tuple.TupleOffset = 0;    /* don't trust the CIS on this; Linksys got it wrong */    link->conf.Present = 0x63;    tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;    tuple.Attributes = 0;    CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));    while (last_ret == CS_SUCCESS) {	cistpl_cftable_entry_t *cfg = &(parse.cftable_entry);	cistpl_io_t *io = &(parse.cftable_entry.io);		if (pcmcia_get_tuple_data(link, &tuple) != 0 ||		pcmcia_parse_tuple(link, &tuple, &parse) != 0 ||		cfg->index == 0 || cfg->io.nwin == 0)	    goto next_entry;		link->conf.ConfigIndex = 0x05;	/* For multifunction cards, by convention, we configure the	   network function with window 0, and serial with window 1 */	if (io->nwin > 1) {	    i = (io->win[1].len > io->win[0].len);	    link->io.BasePort2 = io->win[1-i].base;	    link->io.NumPorts2 = io->win[1-i].len;	} else {	    i = link->io.NumPorts2 = 0;	}	link->io.BasePort1 = io->win[i].base;	link->io.NumPorts1 = io->win[i].len;	link->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK;	if (link->io.NumPorts1 + link->io.NumPorts2 >= 32) {	    last_ret = try_io_port(link);	    if (last_ret == CS_SUCCESS) break;	}    next_entry:	last_ret = pcmcia_get_next_tuple(link, &tuple);    }    if (last_ret != CS_SUCCESS) {	cs_error(link, RequestIO, last_ret);	goto failed;    }    CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));        if (link->io.NumPorts2 == 8) {	link->conf.Attributes |= CONF_ENABLE_SPKR;	link->conf.Status = CCSR_AUDIO_ENA;    }        CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));    dev->irq = link->irq.AssignedIRQ;    dev->base_addr = link->io.BasePort1;    if (!get_prom(link)) {	printk(KERN_NOTICE "axnet_cs: this is not an AX88190 card!\n");	printk(KERN_NOTICE "axnet_cs: use pcnet_cs instead.\n");	goto failed;    }    ei_status.name = "AX88190";    ei_status.word16 = 1;    ei_status.tx_start_page = AXNET_START_PG;    ei_status.rx_start_page = AXNET_START_PG + TX_PAGES;    ei_status.stop_page = AXNET_STOP_PG;    ei_status.reset_8390 = &axnet_reset_8390;    ei_status.get_8390_hdr = &get_8390_hdr;    ei_status.block_input = &block_input;    ei_status.block_output = &block_output;    if (inb(dev->base_addr + AXNET_TEST) != 0)	info->flags |= IS_AX88790;    else	info->flags |= IS_AX88190;    if (info->flags & IS_AX88790)	outb(0x10, dev->base_addr + AXNET_GPIO);  /* select Internal PHY */    for (i = 0; i < 32; i++) {	j = mdio_read(dev->base_addr + AXNET_MII_EEP, i, 1);	if ((j != 0) && (j != 0xffff)) break;    }    /* Maybe PHY is in power down mode. (PPD_SET = 1)        Bit 2 of CCSR is active low. */     if (i == 32) {	conf_reg_t reg = { 0, CS_WRITE, CISREG_CCSR, 0x04 }; 	pcmcia_access_configuration_register(link, &reg);	for (i = 0; i < 32; i++) {	    j = mdio_read(dev->base_addr + AXNET_MII_EEP, i, 1);	    if ((j != 0) && (j != 0xffff)) break;	}    }    info->phy_id = (i < 32) ? i : -1;    link->dev_node = &info->node;    SET_NETDEV_DEV(dev, &handle_to_dev(link));    if (register_netdev(dev) != 0) {	printk(KERN_NOTICE "axnet_cs: register_netdev() failed\n");	link->dev_node = NULL;	goto failed;    }    strcpy(info->node.dev_name, dev->name);    printk(KERN_INFO "%s: Asix AX88%d90: io %#3lx, irq %d, hw_addr ",	   dev->name, ((info->flags & IS_AX88790) ? 7 : 1),	   dev->base_addr, dev->irq);    for (i = 0; i < 6; i++)	printk("%02X%s", dev->dev_addr[i], ((i<5) ? ":" : "\n"));    if (info->phy_id != -1) {	DEBUG(0, "  MII transceiver at index %d, status %x.\n", info->phy_id, j);    } else {	printk(KERN_NOTICE "  No MII transceivers found!\n");    }    return 0;cs_failed:    cs_error(link, last_fn, last_ret);failed:    axnet_release(link);    return -ENODEV;} /* axnet_config *//*======================================================================    After a card is removed, axnet_release() will unregister the net    device, and release the PCMCIA configuration.  If the device is    still open, this will be postponed until it is closed.======================================================================*/static void axnet_release(struct pcmcia_device *link){	pcmcia_disable_device(link);}static int axnet_suspend(struct pcmcia_device *link){	struct net_device *dev = link->priv;	if (link->open)		netif_device_detach(dev);	return 0;}static int axnet_resume(struct pcmcia_device *link){	struct net_device *dev = link->priv;	if (link->open) {		axnet_reset_8390(dev);		AX88190_init(dev, 1);		netif_device_attach(dev);	}	return 0;}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品丝袜在线| 蜜桃av噜噜一区| 亚洲.国产.中文慕字在线| 免费看欧美美女黄的网站| 粉嫩高潮美女一区二区三区| 91福利在线看| 久久久久久亚洲综合| 一区二区三区美女视频| 国产真实乱子伦精品视频| 欧美伊人久久久久久午夜久久久久| 日韩一卡二卡三卡四卡| 亚洲最新视频在线播放| 国产一区不卡视频| 日韩一区二区在线看| 一区二区免费视频| 成人激情动漫在线观看| 久久在线观看免费| 男女男精品视频网| 欧洲视频一区二区| 国产精品久久久久aaaa| 国产一区免费电影| 欧美一区二区成人6969| 亚洲在线观看免费| 色欧美乱欧美15图片| 国产女主播一区| 国产自产高清不卡| 欧美videofree性高清杂交| 午夜精品久久久| 欧美在线免费视屏| 一区二区三区日韩精品| 99久久精品国产观看| 日本一二三不卡| 成人综合在线网站| 中文字幕不卡在线播放| 国产福利91精品| 久久久久久夜精品精品免费| 六月婷婷色综合| 精品三级在线看| 激情深爱一区二区| 精品国产乱码久久久久久浪潮| 石原莉奈在线亚洲三区| 欧美二区在线观看| 青娱乐精品视频| 日韩精品一区二区三区视频 | 一区二区三区国产| 91激情五月电影| 亚洲国产精品久久一线不卡| 一本久道久久综合中文字幕| 亚洲精品v日韩精品| 欧美在线视频日韩| 日韩影院精彩在线| 国产精品美女久久福利网站| 国产精品资源在线看| 日本一区二区免费在线观看视频 | 精品一区二区三区免费观看| 精品国产制服丝袜高跟| 国产成人精品免费在线| 日韩一区在线播放| 欧美日韩视频第一区| 三级欧美韩日大片在线看| 日韩精品一区二区三区四区| 国产成人av一区二区三区在线观看| 欧美国产一区二区在线观看| 色哦色哦哦色天天综合| 爽好久久久欧美精品| 精品成人一区二区三区| 9l国产精品久久久久麻豆| 亚洲地区一二三色| 精品国产99国产精品| 不卡影院免费观看| 视频在线观看91| 国产亚洲一区字幕| 在线精品视频小说1| 久久疯狂做爰流白浆xx| 一区免费观看视频| 日韩午夜av一区| 99天天综合性| 蜜桃传媒麻豆第一区在线观看| 久久精品视频免费| 欧美区视频在线观看| 国产精品77777| 亚洲电影一级片| 欧美经典一区二区| 欧美精品九九99久久| 成人黄色片在线观看| 日本不卡视频在线| ...xxx性欧美| 久久久无码精品亚洲日韩按摩| 在线精品亚洲一区二区不卡| 国产精品性做久久久久久| 亚洲成人av电影在线| 国产精品国产成人国产三级| 日韩一区二区电影在线| 在线看日韩精品电影| 床上的激情91.| 国产专区欧美精品| 秋霞av亚洲一区二区三| 一卡二卡三卡日韩欧美| 国产精品女主播av| 久久蜜桃av一区二区天堂| 777午夜精品视频在线播放| 成人免费看的视频| 国产成人综合在线播放| 美女视频一区在线观看| 亚洲v日本v欧美v久久精品| 中文字幕一区二区三区蜜月 | 欧美日韩一区在线| 精品国精品国产尤物美女| 欧美视频一区二区三区在线观看 | 国产99久久久国产精品潘金网站| 亚洲成av人片观看| 亚洲一区国产视频| 亚洲六月丁香色婷婷综合久久 | 91毛片在线观看| 懂色av中文一区二区三区| 国内成人精品2018免费看| 久久se精品一区二区| 日本在线不卡一区| 日韩一区精品字幕| 丝袜诱惑亚洲看片| 免费一级欧美片在线观看| 午夜激情久久久| 午夜私人影院久久久久| 亚洲第一会所有码转帖| 日韩av网站在线观看| 蜜臀久久久久久久| 韩国女主播一区二区三区| 激情伊人五月天久久综合| 国产精品综合av一区二区国产馆| 国产精品一区二区x88av| 国产成人av自拍| 99re视频精品| 欧美午夜在线一二页| 欧美日本国产一区| 精品乱码亚洲一区二区不卡| 2020国产成人综合网| 国产精品美女久久久久久2018| 1024亚洲合集| 亚洲超碰精品一区二区| 久久精品久久综合| 成人午夜免费视频| 在线观看www91| 亚洲在线中文字幕| 日韩电影在线观看电影| 国精产品一区一区三区mba桃花| 风间由美一区二区三区在线观看 | 成人福利视频在线| 91免费视频网| 日韩欧美中文一区二区| 久久久久久麻豆| 亚洲免费观看高清在线观看| 婷婷综合另类小说色区| 国产精品1区2区| 欧美色视频在线| 久久毛片高清国产| 亚洲一区在线观看视频| 国产一区二区在线看| 一本色道久久综合亚洲精品按摩| 91精品麻豆日日躁夜夜躁| 亚洲国产经典视频| 亚洲v日本v欧美v久久精品| 国产一区二区三区精品视频| 色偷偷88欧美精品久久久| 欧美不卡一二三| 亚洲影视资源网| 国产乱一区二区| 91精品国产品国语在线不卡| 国产精品视频线看| 日韩av电影免费观看高清完整版在线观看| 国产一区二区在线电影| 欧美午夜精品一区二区三区| 久久免费的精品国产v∧| 午夜精品一区二区三区免费视频 | 日日噜噜夜夜狠狠视频欧美人| 国产精品羞羞答答xxdd| 欧美视频一区二区在线观看| 中文字幕av一区二区三区高| 免费精品视频最新在线| 欧美在线影院一区二区| 免费日本视频一区| 在线这里只有精品| 中文字幕免费一区| 国产专区欧美精品| 欧美一卡2卡3卡4卡| 亚洲一区二区三区小说| 9i在线看片成人免费| 国产欧美精品区一区二区三区 | 亚洲国产精品自拍| 不卡一区二区在线| 欧美韩国一区二区| 国产精品99久| 久久先锋影音av| 美国毛片一区二区三区| 欧美精品在线一区二区三区| 一区二区三区色| 在线欧美日韩精品| 亚洲影视资源网| 欧美吞精做爰啪啪高潮| 亚洲自拍偷拍综合| 欧洲精品在线观看|