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

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

?? smc91113.c

?? 10/100M以太網(wǎng)驅(qū)動(dòng)源代碼
?? C
?? 第 1 頁(yè) / 共 3 頁(yè)
字號(hào):
/*------------------------------------------------------------------------ . smc91113.c . This is a driver for SMSC's 91C113 single-chip Ethernet device. . "Features" of the SMC chip: .   Integrated PHY/MAC for 10/100BaseT Operation .   Supports internal and external MII .   Integrated 8K packet memory .   EEPROM interface for configuration . . Arguments: . 	io	= for the base address .	irq	= for the IRQ . . Hardware multicast code from Peter Cammaert ( pc@denkart.be ) . . Sources: .    o   SMSC LAN91C111 databook (www.smsc.com) .    o   smc9194.c by Erik Stahlman .    o   skeleton.c by Donald Becker ( becker@cesdis.gsfc.nasa.gov ) . ----------------------------------------------------------------------------*///#include "armboot.h"//#include "command.h"#include "..\inc\smc91113.h"#include "..\inc\ethernet.h"#include "..\inc\mac.h"//#include "net.h"//#ifdef CONFIG_DRIVER_SMC91113   //xu// Use power-down feature of the chip#define POWER_DOWN	0#define NO_AUTOPROBEstatic const char version[] =	" EV44B0II ethernet driver v1.0 2003/01/08 by Qinwei, MICETEK Shanghai\n";#define SMC_DEBUG 0/*------------------------------------------------------------------------ . . Configuration options, for the experienced user to change. . -------------------------------------------------------------------------*//* . Wait time for memory to be free.  This probably shouldn't be . tuned that much, as waiting for this means nothing else happens . in the system*/#define MEMORY_WAIT_TIME 16#if (SMC_DEBUG > 2 )//#define PRINTK3(args...) printf(args)#else//#define PRINTK3(args...)#endif#if SMC_DEBUG > 1//#define PRINTK2(args...) printf(args)#else//#define PRINTK2(args...)#endif#ifdef SMC_DEBUG//#define PRINTK(args...) printf(args)#else//#define PRINTK(args...)#endif/*------------------------------------------------------------------------ . . The internal workings of the driver.  If you are changing anything . here with the SMC stuff, you should have the datasheet and know . what you are doing. . -------------------------------------------------------------------------*/#define CARDNAME "LAN91C113"// Memory sizing constant#define LAN91C113_MEMORY_MULTIPLIER	(1024*2)#ifndef CONFIG_SMC91113_BASE#define CONFIG_SMC91113_BASE 0x2000300#endif#define SMC_BASE_ADDRESS CONFIG_SMC91113_BASE #define SMC_DEV_NAME "SMC91113"#define SMC_PHY_ADDR 0x0000#define SMC_ALLOC_MAX_TRY 5//#define SMC_TX_TIMEOUT 30   //del by xu#define SMC_TX_TIMEOUT 50             // 原來(lái)是5;#define SMC_PHY_CLOCK_DELAY 1000#define ETH_ZLEN 60#ifdef  CONFIG_SMC_USE_32_BIT#define USE_32_BIT  #else#undef USE_32_BIT #endif#define MAX_LENGTH 1024/*----------------------------------------------------------------- . .  The driver can be entered at any of the following entry points. . .------------------------------------------------------------------  */extern int eth_init(void);extern void eth_halt(void);extern int eth_rx(void);int smc_send_packet(volatile void *packet, int packet_length);//extern int eth_send(volatile void *packet, int length);  //xu/* . This is called by  register_netdev().  It is responsible for . checking the portlist for the SMC9000 series chipset.  If it finds . one, then it will initialize the device, find the hardware information, . and sets up the appropriate device parameters. . NOTE: Interrupts are *OFF* when this procedure is called. . . NB:This shouldn't be static since it is referred to externally.*/int smc_init(void);/* . This is called by  unregister_netdev().  It is responsible for . cleaning up before the driver is finally unregistered and discarded.*/void smc_destructor(void);/* . The kernel calls this function when someone wants to use the device, . typically 'ifconfig ethX up'.*/static int smc_open(void);/* . This is called by the kernel in response to 'ifconfig ethX down'.  It . is responsible for cleaning up everything that the open routine . does, and maybe putting the card into a powerdown state.*/static int smc_close(void);/* . Configures the PHY through the MII Management interface*/static void smc_phy_configure(void);/* . This is a separate procedure to handle the receipt of a packet, to . leave the interrupt code looking slightly cleaner*/int smc_rcv(void);/* ------------------------------------------------------------ . . Internal routines . ------------------------------------------------------------*///static char smc_mac_addr[] = {0x02, 0x80, 0xad, 0x20, 0x31, 0xb8}; /* * This function must be called before smc_open() if you want to override * the default mac address. */void smc_set_mac_addr(const char *addr) {	int i;	for (i=0; i < sizeof(smc_mac_addr); i++){	    smc_mac_addr[i] = addr[i];	}}/* * smc_get_macaddr is no longer used. If you want to override the default * mac address, call smc_get_mac_addr as a part of the board initialisation. */#if 0void smc_get_macaddr( byte *addr ) {	/* MAC ADDRESS AT FLASHBLOCK 1 / OFFSET 0x10 */        unsigned char *dnp1110_mac = (unsigned char *) (0xE8000000 + 0x20010);	int i;        for (i=0; i<6; i++) {            addr[0] = *(dnp1110_mac+0);            addr[1] = *(dnp1110_mac+1);            addr[2] = *(dnp1110_mac+2);            addr[3] = *(dnp1110_mac+3);            addr[4] = *(dnp1110_mac+4);            addr[5] = *(dnp1110_mac+5);        }}#endif/*********************************************** * Show available memory                       * ***********************************************/void dump_memory_info(void){        word mem_info;        word old_bank;        old_bank = SMC_inw(BANK_SELECT)&0xF;        SMC_SELECT_BANK(0);        mem_info = SMC_inw( MIR_REG );//        PRINTK2("Memory: %4d available\n", (mem_info >> 8)*2048);        SMC_SELECT_BANK(old_bank);}/* . A rather simple routine to print out a packet for debugging purposes.*/#if SMC_DEBUG > 2static void print_packet( byte *, int );#endif#define tx_done(dev) 1/* this does a soft reset on the device */static void smc_reset( void );/* Enable Interrupts, Receive, and Transmit */static void smc_enable( void );/* this puts the device in an inactive state */static void smc_shutdown( void );/* Routines to Read and Write the PHY Registers across the   MII Management Interface*/static word smc_read_phy_register(byte phyreg);static void smc_write_phy_register(byte phyreg, word phydata);static int poll4int( byte mask, int timeout ) {      //mask=IM_TX_INT.//  int CFG_HZ;                                      //add by xu    //    int tmo = get_timer(0) + timeout * CFG_HZ;     //xu  要先測(cè)試延遲時(shí)間在給參數(shù);//    int is_timeout = 0;      int is_timeout;    word old_bank = SMC_inw(BSR_REG);//    PRINTK2("Polling...\n");    SMC_SELECT_BANK(2);    while((SMC_inw(INT_REG) & mask) == 0)     {      	is_timeout=is_timeout-1;        if (is_timeout <= 1)   //xu        {    //	  is_timeout = 1;          break;    	}    }    /* restore old bank selection */    SMC_SELECT_BANK(old_bank);    if (is_timeout)	return 1;    else	return 0;}/* . Function: smc_reset( void ) . Purpose: .  	This sets the SMC91113 chip to its normal state, hopefully from whatever . 	mess that any other DOS driver has put it in. . . Maybe I should reset more registers to defaults in here?  SOFTRST  should . do that for me. . . Method: .	1.  send a SOFT RESET .	2.  wait for it to finish .	3.  enable autorelease mode .	4.  reset the memory management unit .	5.  clear all interrupts .*/static void smc_reset( void ){    short temp = 0;//	PRINTK2("%s:smc_reset\n", SMC_DEV_NAME);	/* This resets the registers mostly to defaults, but doesn't	   affect EEPROM.  That seems unnecessary 本程序不用EEPROM */	SMC_SELECT_BANK( 0 );	SMC_outw( RCR_SOFTRST, RCR_REG );                   //Soft reset. set 1 start,and clear 0 stop.    while(1)    {        temp ++;        if ((SMC_inw(RCR_REG ) & RCR_SOFTRST) == 0)            break;        udelay (10000); /* Delay 10ms, try 5 times*/        if (temp >=5)        {            SMC_outw( (SMC_inw(RCR_REG ) & (~RCR_SOFTRST)) , RCR_REG );  //stop reset.            break;        }    }	/* Setup the Configuration Register */	/* This is necessary because the CONFIG_REG is not affected by a soft reset*/	SMC_SELECT_BANK( 1 );#if defined(CONFIG_SMC91113_EXT_PHY)	SMC_outw( CONFIG_DEFAULT | CONFIG_EXT_PHY, CONFIG_REG);     //這里不用外部#else	SMC_outw( CONFIG_DEFAULT, CONFIG_REG);                      //設(shè)置為默認(rèn)值;#endif	/* Release from possible power-down state */	/* Configuration register is not affected by Soft Reset */	SMC_outw( SMC_inw( CONFIG_REG ) | CONFIG_EPH_POWER_EN, CONFIG_REG  );	SMC_SELECT_BANK( 0 );	/* this should pause enough for the chip to be happy */	udelay(5);	/* Disable transmit and receive functionality */	SMC_outw( RCR_CLEAR, RCR_REG );	udelay(5);                           //add by xu.	SMC_outw( TCR_CLEAR, TCR_REG );	udelay(5);                           //add by xu.			/* set the control register */	SMC_SELECT_BANK( 1 );	udelay(5);                           //add by xu.	SMC_outw( CTL_DEFAULT, CTL_REG );	udelay(5);                           //add by xu.	/* Reset the MMU */	SMC_SELECT_BANK( 2 );	udelay(5);                           //add by xu.	SMC_outw( MC_RESET, MMU_CMD_REG );	while ( SMC_inw( MMU_CMD_REG ) & MC_BUSY )		udelay(5); // Wait until not busy	/* Note:  It doesn't seem that waiting for the MMU busy is needed here,	   but this is a place where future chipsets _COULD_ break.  Be wary 	   of issuing another MMU command right after this */	/* Disable all interrupts */	SMC_outb( 0, IM_REG );}/* . Function: smc_enable . Purpose: let the chip talk to the outside work . Method: .	1.  Enable the transmitter .	2.  Enable the receiver .	3.  Enable interrupts*/static void smc_enable(){      unsigned short i,j;    unsigned char k;//	PRINTK2("%s:smc_enable\n", SMC_DEV_NAME);	SMC_SELECT_BANK( 0 );	/* see the header file for options in TCR/RCR DEFAULT*///    SMC_outw( TCR_DEFAULT, TCR_REG );         //xu 好像PAD 不成功;	SMC_outw(0X81,TCR_REG);    udelay(5);//  i=SMC_inw( TCR_REG);    udelay(5);//    SMC_outw( RCR_DEFAULT, RCR_REG );         //strip CRC and enable RX.and rx all multicast.	SMC_outw(0X304,RCR_REG);	udelay(5);//	j=SMC_inw( RCR_REG );	SMC_SELECT_BANK( 2 );	udelay(5);	SMC_outb( 0x00, IM_REG );                  //enable rx interrupt. add by xu.	udelay(5);//	k=SMC_inb( IM_REG );	udelay(5);	/* clear MII_DIS *///	smc_write_phy_register(PHY_CNTL_REG, 0x0000);}/* . Function: smc_shutdown . Purpose:  closes down the SMC91xxx chip. . Method: .	1. zero the interrupt mask .	2. clear the enable receive flag .	3. clear the enable xmit flags . . TODO: .   (1) maybe utilize power down mode. .	Why not yet?  Because while the chip will go into power down mode, .	the manual says that it will wake up in response to any I/O requests .	in the register space.   Empirical results do not show this working.*/static void smc_shutdown(){//	PRINTK2(CARDNAME ":smc_shutdown\n");	/* no more interrupts for me */	SMC_SELECT_BANK( 2 );	SMC_outb( 0, IM_REG );	/* and tell the card to stay away from that nasty outside world */	SMC_SELECT_BANK( 0 );	SMC_outb( RCR_CLEAR, RCR_REG );	SMC_outb( TCR_CLEAR, TCR_REG );}/* . Function:  smc_hardware_send_packet(struct net_device * ) . Purpose: .	This sends the actual packet to the SMC9xxx chip. . . Algorithm: . 	First, see if a saved_skb is available. .		( this should NOT be called if there is no 'saved_skb' .	Now, find the packet number that the chip allocated .	Point the data pointers at it in memory .	Set the length word in the chip's memory .	Dump the packet to chip memory .	Check if a last byte is needed ( odd length packet ) .		if so, set the control flag right . 	Tell the card to send it .	Enable the transmit interrupt, so I know if it failed . 	Free the kernel data if I actually sent it.*/int smc_send_packet(volatile void *packet, int packet_length)  //static is del by xu.//int smc_send_packet(volatile unsigned char *packet, int packet_length){	byte	 		packet_no;          //packet number	unsigned long		ioaddr;         //io address	byte			* buf;   //del by xu//	unsigned short *buf;	int			length;	int         length16;	int			numPages;	int			try = 0;	int			time_out;	byte		status;	unsigned char temp0;	unsigned short temp1;	//	PRINTK3("%s:smc_hardware_send_packet\n", SMC_DEV_NAME);	length = ETH_ZLEN < packet_length ? packet_length : ETH_ZLEN;  //ETH_ZLEN = 60 min frame size.		/* allocate memory	** The MMU wants the number of pages to be the number of 256 bytes	** 'pages', minus 1 ( since a packet can't ever have 0 pages :) )	**	** The 91C111 ignores the size bits, but the code is left intact	** for backwards and future compatibility.	**	** Pkt size for allocating is data length +6 (for additional status	** words, length and ctl!)	**	** If odd size then last byte is included in this header.	*/	numPages =   ((length & 0xfffe) + 6);           //得到的是發(fā)送緩沖區(qū)需要的字節(jié)數(shù);	numPages >>= 8; // Divide by 256	if (numPages > 7 ) {//		printf("%s: Far too big packet error. \n", SMC_DEV_NAME);  //要發(fā)送的報(bào)太長(zhǎng);		return 0;	}	/* now, try to allocate the memory */	SMC_SELECT_BANK( 2 );	SMC_outw( MC_ALLOC | numPages, MMU_CMD_REG );     //SMC_outw(d,r); numPages寫(xiě)入保留區(qū),沒(méi)用?!again:	try++;	time_out = MEMORY_WAIT_TIME;                      //=16.	do {		status = SMC_inb( INT_REG );		if ( status & IM_ALLOC_INT ) {			/* acknowledge the interrupt */			SMC_outb( IM_ALLOC_INT, INT_REG );        //not defined.  			break;		}   	} while ( -- time_out );   	if ( !time_out ) {//			PRINTK2("%s: memory allocation, try %d failed ...\n",//				SMC_DEV_NAME, try);			if (try < SMC_ALLOC_MAX_TRY)              //SMC_ALLOC_MAX_TRY=5.				goto again;			else				return 0;			}	//	PRINTK2("%s: memory allocation, try %d succeeded ...\n",//		SMC_DEV_NAME,//		try);	/* I can send the packet now.. */	ioaddr = SMC_BASE_ADDRESS;	buf = (byte *)packet;  //del bu xu.	/* If I get here, I _know_ there is a packet slot waiting for me */	packet_no = SMC_inb( AR_REG );                   //allocation result.	if ( packet_no & AR_FAILED ) {		/* or isn't there?  BAD CHIP! *///		printf("%s: Memory allocation failed. \n",//			SMC_DEV_NAME);		return 0;	}	/* we have a packet address, so tell the card to use it */	SMC_outb( packet_no, PN_REG );                  //packet no.	/* point to the beginning of the packet */

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
裸体在线国模精品偷拍| 成人激情午夜影院| 国产在线精品视频| 色噜噜狠狠成人中文综合 | 韩国欧美国产1区| 99热精品国产| 欧美成人video| 亚洲精品国产精华液| 国产精品99久久久久久久女警 | 欧美日韩大陆在线| 日本一区二区综合亚洲| 午夜激情综合网| 99re亚洲国产精品| 久久久亚洲午夜电影| 亚洲成人在线网站| 99精品偷自拍| 国产欧美综合在线| 久久成人免费电影| 欧美日高清视频| 亚洲蜜桃精久久久久久久| 国产一区二区三区精品欧美日韩一区二区三区 | 91精品国产品国语在线不卡| 亚洲欧美乱综合| 国产精品88888| 久久综合一区二区| 麻豆久久一区二区| 在线不卡一区二区| 午夜电影一区二区三区| 91蜜桃视频在线| 国产精品网站在线| 国产一区二区三区四| 欧美本精品男人aⅴ天堂| 日韩精品午夜视频| 91精品国产91久久综合桃花| 亚洲第一福利一区| 欧美日韩在线三级| 亚洲韩国精品一区| 欧美最猛性xxxxx直播| 亚洲欧美一区二区三区久本道91 | 亚洲免费高清视频在线| 成人性生交大合| 国产亚洲一区二区三区四区| 韩国在线一区二区| 久久尤物电影视频在线观看| 国产一区二区三区在线观看精品 | 欧美高清激情brazzers| 午夜欧美在线一二页| 欧美精品v国产精品v日韩精品| 一区二区三区高清在线| 欧美日韩在线免费视频| 蜜桃一区二区三区四区| 欧美r级在线观看| 国产成人免费视频| 亚洲欧美激情在线| 欧美综合天天夜夜久久| 日韩精品视频网站| 久久综合久色欧美综合狠狠| 成人在线视频首页| 亚洲欧美韩国综合色| 欧美日韩一区二区三区视频| 欧美a一区二区| wwwwxxxxx欧美| 91丨porny丨最新| 午夜伦理一区二区| www国产精品av| 97se狠狠狠综合亚洲狠狠| 一区二区激情视频| 日韩久久久精品| 不卡区在线中文字幕| 亚洲成人777| 久久影院视频免费| 欧美系列一区二区| 极品少妇xxxx偷拍精品少妇| 中文字幕一区二| 欧美男生操女生| 国产传媒一区在线| 五月天视频一区| 国产三级三级三级精品8ⅰ区| 色吧成人激情小说| 美女视频黄 久久| 亚洲欧美另类图片小说| 日韩区在线观看| av在线播放不卡| 另类调教123区 | 亚洲精品欧美激情| www国产成人免费观看视频 深夜成人网 | 国产精品久久久久影院| 在线播放91灌醉迷j高跟美女| 国产成人精品亚洲777人妖| 性做久久久久久| 国产精品久久久一本精品 | 亚洲第一主播视频| 久久精品亚洲精品国产欧美 | 精品国产一区二区精华| 欧美午夜一区二区三区免费大片| 午夜精品福利在线| 亚洲视频一二三区| 国产三区在线成人av| 91麻豆精品国产91久久久使用方法 | 成人小视频免费观看| 欧美aaaaaa午夜精品| 亚洲综合丝袜美腿| 最好看的中文字幕久久| 久久精品亚洲一区二区三区浴池| 91麻豆精品国产91久久久使用方法| 99国产精品国产精品久久| 国产一区二区三区蝌蚪| 久久99热狠狠色一区二区| 亚洲成人在线观看视频| 夜夜嗨av一区二区三区| 一色屋精品亚洲香蕉网站| 国产免费观看久久| 国产女人aaa级久久久级 | 久久久一区二区| 精品国产凹凸成av人网站| 91精品国产一区二区三区| 欧美日韩高清一区二区不卡| 在线看不卡av| 色婷婷香蕉在线一区二区| 91小视频免费看| 91在线国产福利| 91亚洲精品久久久蜜桃网站| 97久久精品人人做人人爽| 99re亚洲国产精品| 色综合中文字幕国产| 色菇凉天天综合网| 欧美日韩一区二区在线观看| 欧美日本在线看| 7777精品伊人久久久大香线蕉 | 一区二区三区国产精品| 亚洲一区视频在线| 日韩中文字幕不卡| 麻豆91免费观看| 国产剧情一区二区| 成人性生交大片免费看中文| av综合在线播放| 91在线观看视频| 欧美亚洲一区二区三区四区| 欧美精品日韩一本| 精品剧情在线观看| 国产午夜精品久久久久久久 | 国产成人久久精品77777最新版本 国产成人鲁色资源国产91色综 | 捆绑调教一区二区三区| 狠狠狠色丁香婷婷综合久久五月| 国产成人av电影在线观看| 91亚洲精品乱码久久久久久蜜桃 | 欧美日韩一区二区三区免费看| 欧美男男青年gay1069videost| 日韩视频在线你懂得| 久久久99精品久久| 亚洲精品视频在线观看免费| 日韩精品欧美精品| 国产精品中文字幕欧美| 一本大道久久a久久综合婷婷| 欧美午夜一区二区| 久久先锋资源网| 亚洲欧美另类图片小说| 免费三级欧美电影| 成人禁用看黄a在线| 欧美浪妇xxxx高跟鞋交| 国产喷白浆一区二区三区| 亚洲黄色av一区| 精品亚洲porn| 欧美网站一区二区| 久久久久国产一区二区三区四区| 亚洲精品国产成人久久av盗摄| 精品制服美女久久| 91黄色在线观看| 国产三级欧美三级日产三级99 | 亚洲国产视频一区二区| 国产一区二区三区最好精华液| 91久久精品日日躁夜夜躁欧美| 欧美成人福利视频| 亚洲午夜免费视频| 国产精品亚洲视频| 欧美一区二区视频在线观看2022| 亚洲国产精品成人久久综合一区| 水野朝阳av一区二区三区| 成人美女视频在线观看| 欧美大片国产精品| 午夜欧美大尺度福利影院在线看 | 日本一区二区三区四区| 日韩成人精品在线| 欧美性一级生活| 国产欧美日韩视频在线观看| 日本在线播放一区二区三区| 欧美曰成人黄网| 国产精品美女一区二区| 国产一区二区91| 欧美一级专区免费大片| 午夜精品在线看| 91国产福利在线| 国产精品久久久久久久久免费丝袜 | 亚洲欧美区自拍先锋| 成人h精品动漫一区二区三区| 久久精品夜色噜噜亚洲a∨| 久久精品999| 精品美女被调教视频大全网站| 婷婷六月综合网| 欧美日韩中文字幕精品|