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

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

?? socket.c

?? WIZNET公司W(wǎng)3100API庫(kù)用于TCPIP開發(fā)簡(jiǎn)化你的網(wǎng)絡(luò)接入開發(fā)步驟
?? C
?? 第 1 頁(yè) / 共 4 頁(yè)
字號(hào):
/*
********************************************************************************
* Wiznet.
* 5F Simmtech Bldg., 228-3, Nonhyun-dong, Kangnam-gu,
* Seoul, Korea
*
* (c) Copyright 2002, Wiznet, Seoul, Korea
*
* Filename      : socket.c
* Programmer(s) : Wooyoul Kim
* Version       : 2.2 
* Created       : 2002/04/10
* Modified      : 2002/06/20 - added delay in initseqnum() function
		               to complete write operation of TX Pointer Registers.
		  2002/09/27 - Vesion Up
                             - Global Interrupt Status Variable & MACRO Renaming
				      S_STATUS[] --> I_STATUS[]
				      INT_STATUS --> INT_REG
				      STATUS(i) --> INT_STATUS(i)
				      C_STATUS(i) --> SOCK_STATUS(i)
		   	     - When you read UDP or IP RAW Header at recvfrom() function, Verify Rx_Pointer Wrap-off
			     - At close() function, Modify "while(S_STATUS[s] !=  SCLOSED)" statement to while(!(S_STATUS[s] & SCLOSED)).
			     - At sendto()function, Checke previous send command before destination update
                                                    Error handling
                             - At select() and recvfrom() function,  
                                       Received UDP data process is modified 'packet size' to 'bulk size'
		  2002/10/20 - Version Up
			     - At select() function,
                                       Modify to caculate free buffer size at UDP,IP_RAW protocol
		  2002/10/28 - Version Up
			     - At select(), integrated each received size caculation of TCP, UDP or IP_RAW into one calculation.
			     - At recvfrom(), Received data is processed by packet unit.
                                       
* Description   : Driver API program of W3100A (Big Endian for Keil Compiler)
********************************************************************************
*/

/*
###############################################################################
File Include Section
###############################################################################
*/
#include <at89x51.h>                   // 8051 SFR definition file
//#include <stdio.h>
#include "serial.h"                    // serial related functions
#include "socket.h"                    // W3100A driver file

/*
###############################################################################
Define Part
###############################################################################
*/
//#define DEBUG                        // Add debugging code

/*
###############################################################################
Local Variable Declaration Section
###############################################################################
*/
u_char xdata I_STATUS[4];              // Store Interrupt Status according to channels
u_int xdata Local_Port;                // Designate Local Port
un_l2cval xdata SEQ_NUM;               // Set initial sequence number
                                                
u_long xdata SMASK[MAX_SOCK_NUM];      // Variable to store MASK of Tx in each channel, on setting dynamic memory size.
u_long xdata RMASK[MAX_SOCK_NUM];      // Variable to store MASK of Rx in each channel, on setting dynamic memory size.
int xdata SSIZE[MAX_SOCK_NUM];         // Maximun Tx memory size by each channel
int xdata RSIZE[MAX_SOCK_NUM];         // Maximun Rx memory size by each channel
u_char xdata* SBUFBASEADDRESS[MAX_SOCK_NUM];     // Maximun Tx memory base address by each channel
u_char xdata* RBUFBASEADDRESS[MAX_SOCK_NUM];     // Maximun Rx memory base address by each channel

/*
###############################################################################
Function Implementation Section
###############################################################################
*/


/*
********************************************************************************
*               Interrupt handling function of the W3100A
*
* Description :
*   Stores the status information that each function waits for in the global variable S_STATUS for transfer.
*   S_STATUS stores the interrupt status value for each channel.
* Arguments   : None
* Returns     : None
* Note        : Internal Function
********************************************************************************
*/
void Int0(void) interrupt 0
{
	u_char status;

	EX0 = 0;                      	  // INT0 DISABLE

	status = INT_REG;

	while (status) {
		if (status & 0x01) {      // channel 0 interrupt(sysinit, sockinit, established, closed, timeout, send_ok, recv_ok)
			I_STATUS[0] = INT_STATUS(0);

//			if (I_STATUS[0] & SESTABLISHED) ISR_ESTABLISHED(0);
//			if (I_STATUS[0] & SCLOSED) ISR_CLOSED(0);

			INT_REG = 0x01;
		}

		if (status & 0x02) {      // channel 1 interrupt(sysinit, sockinit, established, closed, timeout, send_ok, recv_ok)
			I_STATUS[1] = INT_STATUS(1);

//			if (I_STATUS[1] & SESTABLISHED) ISR_ESTABLISHED(1);
//			if (I_STATUS[1] & SCLOSED) ISR_CLOSED(1);

			INT_REG = 0x02;
		}

		if (status & 0x04) {      // channel 2 interrupt(sysinit, sockinit, established, closed, timeout, send_ok, recv_ok)
			I_STATUS[2] = INT_STATUS(2);

//			if (I_STATUS[2] & SESTABLISHED) ISR_ESTABLISHED(2);
//			if (I_STATUS[2] & SCLOSED) ISR_CLOSED(2);

			INT_REG = 0x04;
		}

		if (status & 0x08) {      // channel 3 interrupt(sysinit, sockinit, established, closed, timeout, send_ok, recv_ok)
			I_STATUS[3] = INT_STATUS(3);

//			if (I_STATUS[3] & SESTABLISHED) ISR_ESTABLISHED(3);
//			if (I_STATUS[3] & SCLOSED) ISR_CLOSED(3);

			INT_REG = 0x08;
		}

		if (status & 0x10) {      // channel 0 receive interrupt
//			ISR_RX(0);
			INT_REG = 0x10;
		}

		if (status & 0x20) {      // channel 1 receive interrupt
//			ISR_RX(1);
			INT_REG = 0x20;
		}

		if (status & 0x40) {      // channel 2 receive interrupt
//			ISR_RX(2);
			INT_REG = 0x40;
		}

		if (status & 0x80) {      // channel 3 receive interrupt
//			ISR_RX(3);
			INT_REG = 0x80;
		}

		status = INT_REG;
	}

	INT_REG = 0xFF;

	EX0 = 1;
}

/*
********************************************************************************
*               Established connection interrupt handling function.
*
* Description : 
*   Called upon connection establishment, and may be inserted in user code if needed by the programmer.
* Arguments   : None
* Returns     : None
* Note        : Internal Function
********************************************************************************
*/
/*
void ISR_ESTABLISHED(SOCKET s) 
{
	// TO ADD YOUR CODE
}
*/

/*
********************************************************************************
*               Closed connection interrupt handling function
*
* Description :  
*   Called upon connection closure, and may be inserted in user code if needed by the programmer.
* Arguments   : None
* Returns     : None
* Note        : Internal Function
********************************************************************************
*/
/*
void ISR_CLOSED(SOCKET s) 
{
	// TO ADD YOUR CODE
}
*/

/*
********************************************************************************
*               Received data interrupt handling function
*
* Description :  
*   Called upon receiving data, and may be inserted in user code if needed by the programmer.
* Arguments   : None
* Returns     : None
* Note        : Internal Function
********************************************************************************
*/
/*
void ISR_RX(SOCKET s) 
{
	// TO ADD YOUR CODE
}
*/

/*
********************************************************************************
*               W3100A initialization function
*
* Description :
*   Function for S/W resetting of the W3100A.
*   Sets the initial SEQ# to be used for TCP communication.
* Arguments   : None
* Returns     : None
* Note        : API Function
********************************************************************************
*/
void initW3100A(void)
{
#ifdef DEBUG
//	printf("initW3100A()\r\n");
    PutStringLn("initW3100A()");
#endif 
    Local_Port = 1000;          // This default value will be set if you didn't designate it when you create a socket
                                // If you don't designate port number and create a socket continuously,
                                // the port number will be assigned with incremented by one to Local_Port
    SEQ_NUM.lVal = 0x12233445;  // Sets the initial SEQ# to be used for TCP communication. (It should be ramdom value)
    COMMAND(0) = CSW_RESET;     // Software RESET
}

/*
********************************************************************************
*               W3100A initialization function
*
* Description : 
*   Sets the Tx, Rx memory size by each channel, source MAC, source IP, gateway, and subnet mask
*   to be used by the W3100A to the designated values.
*   May be called when reflecting modified network information or Tx, Rx memory size on the W3100A
*   Include Ping Request for ARP update (In case that a device embedding W3100A is directly connected to Router)
* Arguments   : sbufsize - Tx memory size (00 - 1KByte, 01- 2KBtye, 10 - 4KByte, 11 - 8KByte)
*                          bit 1-0 : Tx memory size of channel #0 
*                          bit 3-2 : Tx memory size of channel #1 
*                          bit 5-4 : Tx memory size of channel #2
*                          bit 7-6 : Tx memory size of channel #3 
*               rbufsize - Rx memory size (00 - 1KByte, 01- 2KBtye, 10 - 4KByte, 11 - 8KByte)
*                          bit 1-0 : Rx memory size of channel #0 
*                          bit 3-2 : Rx memory size of channel #1 
*                          bit 5-4 : Rx memory size of channel #2
*                          bit 7-6 : Rx memory size of channel #3 
* Returns     : None
* Note        : API Function
*               Maximum memory size for Tx, Rx in W3100A is 8KBytes,
*               In the range of 8KBytes, the memory size could be allocated dynamically by each channel 
*               Be attentive to sum of memory size shouldn't exceed 8Kbytes
*               and to data transmission and receiption from non-allocated channel may cause some problems.
*               If 8KBytes memory already is assigned to centain channel, other 3 channels couldn't be used, for there's no available memory.
*               If two 4KBytes memory are assigned to two each channels, other 2 channels couldn't be used, for there's no available memory.
*               (Example of memory assignment)
*                sbufsize => 00000011, rbufsize => 00000011 : Assign 8KBytes for Tx and Rx to channel #0, Cannot use channel #1,#2,#3
*                sbufsize => 00001010, rbufsize => 00001010 : Assign 4KBytes for Tx and Rx to each channel #0,#1 respectively. Cannot use channel #2,#3
*                sbufsize => 01010101, rbufsize => 01010101 : Assign 2KBytes for Tx and Rx to each all channels respectively.
*                sbufsize => 00010110, rbufsize => 01010101 : Assign 4KBytes for Tx, 2KBytes for Rx to channel #0
*                                                             2KBytes for Tx, 2KBytes for Rx to channel #1
*                                                             2KBytes for Tx, 2KBytes for Rx to channel #2
*                                                             2KBytes is available exclusively for Rx in channel #3. There's no memory for Tx.
********************************************************************************
*/
void sysinit(u_char sbufsize, u_char rbufsize)
{
	char i;
	int ssum,rsum;

	ssum = 0;
	rsum = 0;
	
	TX_DMEM_SIZE = sbufsize;                 // Set Tx memory size for each channel
	RX_DMEM_SIZE = rbufsize;                 // Set Rx memory size for each channel
	
	SBUFBASEADDRESS[0] = SEND_DATA_BUF;      // Set Base Address of Tx memory for channel #0
	RBUFBASEADDRESS[0] = RECV_DATA_BUF;      // Set Base Address of Rx memory for channel #0

#ifdef DEBUG
		PutStringLn("Channel : SEND MEM SIZE : RECV MEM SIZE");
#endif

	for(i = 0 ; i < MAX_SOCK_NUM; i++)               // Set maximum memory size for Tx and Rx, mask, base address of memory by each channel
	{
		SSIZE[i] = 0;
		RSIZE[i] = 0;
		if(ssum < 8192)
		{
			switch((sbufsize >> i*2) & 0x03) // Set maximum Tx memory size
			{
			case 0:
				SSIZE[i] = 1024;
				SMASK[i] = 0x000003FF;
				break;
			case 1:
				SSIZE[i] = 2048;
				SMASK[i] = 0x000007FF;
				break;
			case 2:
				SSIZE[i] = 4096;
				SMASK[i] = 0x00000FFF;
				break;
			case 3:
				SSIZE[i] = 8192;
				SMASK[i] = 0x00001FFF;
				break;
			}
		}
		if( rsum < 8192)
		{
			switch((rbufsize>> i*2) & 0x03)  // Set maximum Rx memory size
			{
			case 0:
				RSIZE[i] = 1024;
				RMASK[i] = 0x000003FF;
				break;
			case 1:
				RSIZE[i] = 2048;
				RMASK[i] = 0x000007FF;
				break;
			case 2:
				RSIZE[i] = 4096;
				RMASK[i] = 0x00000FFF;
				break;
			case 3:
				RSIZE[i] = 8192;
				RMASK[i] = 0x00001FFF;
				break;
			}
		}
		ssum += SSIZE[i];
		rsum += RSIZE[i];

		if(i != 0)                               // Set base address of Tx and Rx memory for channel #1,#2,#3
		{
			SBUFBASEADDRESS[i] = SBUFBASEADDRESS[i-1] + SSIZE[i-1];
			RBUFBASEADDRESS[i] = RBUFBASEADDRESS[i-1] + RSIZE[i-1];
		}
#ifdef DEBUG
		PutHTOA(i); PutString("      :    0x");PutITOA(SSIZE[i]); PutString("     :    0x");PutITOA(RSIZE[i]);PutStringLn("");
#endif
	}
	I_STATUS[0] = 0;
	COMMAND(0) = CSYS_INIT;

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
午夜精品123| 欧美精品v国产精品v日韩精品| 国产乱对白刺激视频不卡| 婷婷综合五月天| 香蕉成人伊视频在线观看| 亚洲一卡二卡三卡四卡无卡久久 | 久久亚洲一级片| www久久精品| 精品国产一区二区三区av性色| 精品国产亚洲在线| 2023国产精品视频| 国产性做久久久久久| 久久精品一二三| 国产精品理论在线观看| 一区二区中文视频| 亚洲精品国产第一综合99久久 | 国产成人精品影院| 东方aⅴ免费观看久久av| 波多野结衣91| 色综合久久66| 91精品在线麻豆| 日韩精品中文字幕一区二区三区| 精品国精品国产尤物美女| 精品国产乱码久久久久久久| 欧美国产亚洲另类动漫| 亚洲黄色免费网站| 免费人成黄页网站在线一区二区| 精品写真视频在线观看| 成人免费的视频| 欧美丝袜丝交足nylons图片| 91精品国产综合久久福利 | 青青草原综合久久大伊人精品优势 | 一区二区三区在线影院| 亚洲1区2区3区4区| 精品一区二区三区不卡| 成av人片一区二区| 欧美日韩国产影片| 欧美成人aa大片| 最近日韩中文字幕| 日本怡春院一区二区| 国产精品一区二区无线| 91视频你懂的| 日韩一区二区电影在线| 日本一区二区三区dvd视频在线| 亚洲精品日韩专区silk| 看片网站欧美日韩| 日本精品裸体写真集在线观看| 69av一区二区三区| 国产日产欧美一区二区视频| 亚洲va天堂va国产va久| 国产精品99久久久久久久vr| 在线看国产一区二区| 精品国产免费视频| 一卡二卡三卡日韩欧美| 国产精品一区2区| 欧美日韩国产美| 国产精品毛片久久久久久久| 男女性色大片免费观看一区二区 | 日韩一区二区三区三四区视频在线观看| 久久一留热品黄| 亚洲va在线va天堂| 91小视频免费观看| 久久久www成人免费无遮挡大片| 亚洲一区二区三区国产| 成人白浆超碰人人人人| 日韩精品中文字幕一区二区三区| 夜夜爽夜夜爽精品视频| 国产成人免费在线观看不卡| 日韩一区二区三区视频在线观看 | 色综合久久九月婷婷色综合| 久久综合九色综合97婷婷| 亚洲国产欧美日韩另类综合 | 欧美日韩国产一区| 亚洲欧洲三级电影| 国产一区二区女| 欧美男男青年gay1069videost| 国产精品国产三级国产普通话蜜臀| 久久激情综合网| 欧美日韩精品久久久| 亚洲欧美色图小说| 处破女av一区二区| 久久综合中文字幕| 麻豆精品精品国产自在97香蕉| 欧美日韩精品专区| 亚洲一级不卡视频| 色94色欧美sute亚洲线路一久 | 国产一区二区三区黄视频 | 在线免费观看不卡av| 国产精品视频yy9299一区| 国精品**一区二区三区在线蜜桃| 7777精品伊人久久久大香线蕉超级流畅| 亚洲欧美日韩国产一区二区三区| 风流少妇一区二区| 国产日韩三级在线| 国产不卡一区视频| 久久久99精品免费观看| 国产一区二区三区av电影| 精品国产电影一区二区| 国产在线精品国自产拍免费| 精品国产乱码久久久久久浪潮| 精品一区二区三区在线观看国产| 精品久久久久99| 国产一区不卡视频| 亚洲国产精品av| 99re在线视频这里只有精品| 亚洲特黄一级片| 在线观看精品一区| 亚洲福利视频一区| 欧美福利视频一区| 欧美a级一区二区| 久久婷婷国产综合精品青草| 国产久卡久卡久卡久卡视频精品| 久久综合久久久久88| 懂色av噜噜一区二区三区av| 亚洲欧洲三级电影| 欧美视频一二三区| 免费在线观看日韩欧美| 久久综合久久99| 成人av小说网| 一区二区三区欧美视频| 欧美日韩免费电影| 久久99深爱久久99精品| 久久精品视频免费| 色婷婷av一区二区三区gif | 国产v综合v亚洲欧| 亚洲精品久久久蜜桃| 欧美绝品在线观看成人午夜影视| 奇米色一区二区| 日本一二三不卡| 日本韩国一区二区三区| 人禽交欧美网站| 欧美国产日韩在线观看| 在线观看一区日韩| 奇米在线7777在线精品 | 韩国精品一区二区| 国产精品卡一卡二| 88在线观看91蜜桃国自产| 国产乱子轮精品视频| 亚洲欧美日韩国产另类专区| 欧美一区二区视频在线观看| 成人黄色小视频在线观看| 亚洲国产成人av网| 国产亚洲1区2区3区| 欧美日精品一区视频| 狠狠色狠狠色合久久伊人| 中文字幕在线不卡| 欧美一区二区三区在线观看视频| 国产成人免费视频| 婷婷久久综合九色综合伊人色| 久久亚洲综合色一区二区三区| 色综合天天狠狠| 国内精品伊人久久久久av一坑| 国产精品乱子久久久久| 欧美精品日韩精品| 99精品视频在线播放观看| 日本不卡视频在线| 亚洲男同性视频| 久久久欧美精品sm网站| 欧美日韩国产免费一区二区| 国产99久久久久久免费看农村| 亚洲综合小说图片| 国产精品每日更新在线播放网址| 欧美猛男gaygay网站| av电影在线观看完整版一区二区| 美国欧美日韩国产在线播放| 一区二区三区在线高清| 2020国产精品自拍| 91.xcao| 色婷婷av一区二区三区软件| 国产成人精品aa毛片| 日韩avvvv在线播放| 亚洲黄色免费电影| 欧美激情在线观看视频免费| 欧美一区二区网站| 欧美日韩中文另类| 色婷婷国产精品| eeuss鲁一区二区三区| 国产在线精品免费av| 日韩精品电影在线观看| 怡红院av一区二区三区| 中文字幕精品一区二区精品绿巨人| 欧美久久一区二区| 欧美午夜不卡在线观看免费| 99久久国产综合色|国产精品| 国产福利一区在线| 精品在线你懂的| 日韩电影在线观看一区| 亚洲午夜激情av| 亚洲精品一二三| 中文字幕一区二区三区不卡| 久久奇米777| 亚洲精品一区二区三区四区高清| 日韩欧美一二三| 日韩一区二区免费高清| 欧美体内she精高潮| 欧美日韩中文字幕一区| 欧美三片在线视频观看 | 亚洲女同一区二区| 亚洲色图视频网| 亚洲人快播电影网|