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

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

?? socket.c

?? 硬件協議棧芯片w3100a的DHCP實現
?? C
?? 第 1 頁 / 共 4 頁
字號:
/*
********************************************************************************
* 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;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美无乱码久久久免费午夜一区| 一区二区三区中文字幕| 18欧美亚洲精品| 免费欧美高清视频| 91丨porny丨首页| 欧美一级片在线观看| 亚洲人精品午夜| 国产不卡在线视频| 日韩欧美一卡二卡| 一区二区三区视频在线看| 国产一区久久久| 欧美精品黑人性xxxx| 国产精品久久久久影视| 精久久久久久久久久久| 欧美二区乱c少妇| 亚洲欧美韩国综合色| 国产**成人网毛片九色 | 91网站最新网址| 久久精品人人做人人综合| 日韩国产精品久久久久久亚洲| 99re亚洲国产精品| 国产女人18毛片水真多成人如厕| 精品伊人久久久久7777人| 欧美一区二区三区的| 天天综合网 天天综合色| 欧美体内she精视频| 亚洲图片欧美综合| 在线观看一区日韩| 亚洲一区免费视频| 欧美网站一区二区| 亚洲国产精品久久人人爱| 91久久精品网| 亚洲制服丝袜av| 欧美日韩成人一区| 五月天激情小说综合| 欧美高清激情brazzers| 午夜影视日本亚洲欧洲精品| 欧美巨大另类极品videosbest| 日本女人一区二区三区| 欧美一级片在线看| 国产精品自拍av| 国产精品免费av| 91网上在线视频| 亚洲成av人片一区二区梦乃 | 99久久亚洲一区二区三区青草 | 国产亚洲成av人在线观看导航| 精品亚洲aⅴ乱码一区二区三区| 精品国产sm最大网站免费看| 激情六月婷婷久久| 国产精品久久久久影院老司| 91免费看视频| 日韩精品乱码av一区二区| 欧美一区二区三区免费在线看| 狠狠网亚洲精品| 中文字幕日本乱码精品影院| 在线观看不卡视频| 久久精品国产亚洲aⅴ| 国产亚洲一区二区三区| heyzo一本久久综合| 亚洲福利视频三区| 久久久久久久网| 色欧美乱欧美15图片| 奇米一区二区三区av| 久久久蜜桃精品| 欧美日韩中文字幕精品| 蜜桃视频第一区免费观看| 欧美经典一区二区三区| 色哟哟精品一区| 免费看欧美美女黄的网站| 国产亚洲一区二区三区| 欧美性淫爽ww久久久久无| 极品少妇xxxx偷拍精品少妇| 亚洲欧美激情视频在线观看一区二区三区 | 奇米888四色在线精品| 国产拍揄自揄精品视频麻豆| 欧美日韩在线综合| 成人黄页毛片网站| 三级在线观看一区二区| 国产精品久久久久一区| 日韩欧美一区在线| 91在线视频官网| 狠狠色丁香婷婷综合| 亚洲妇女屁股眼交7| 国产精品久久久久久久久动漫 | 亚洲欧美一区二区在线观看| 91精品国产一区二区| 91在线高清观看| 国产a级毛片一区| 日韩黄色一级片| 亚洲综合激情另类小说区| 中日韩av电影| 精品处破学生在线二十三| 欧美精品九九99久久| 日本道精品一区二区三区 | 国产在线观看免费一区| 亚洲国产成人tv| 一区二区三区在线观看视频| 中文字幕不卡在线| 国产网红主播福利一区二区| 欧美一卡2卡3卡4卡| 777午夜精品视频在线播放| 欧美在线制服丝袜| 色综合久久中文综合久久牛| 成人av手机在线观看| 成人性生交大合| 国产乱对白刺激视频不卡| 免播放器亚洲一区| 亚洲r级在线视频| 亚洲亚洲精品在线观看| 亚洲人吸女人奶水| 亚洲人123区| 日韩伦理av电影| 亚洲欧美激情小说另类| 亚洲欧美另类在线| 亚洲精品日韩专区silk| 亚洲美女少妇撒尿| 亚洲一区二区三区视频在线播放| 一区二区三区日韩在线观看| 亚洲美女在线一区| 亚洲欧美电影院| 亚洲日本成人在线观看| 中文字幕 久热精品 视频在线| 国产精品私人影院| 国产精品欧美一区喷水| 中文字幕中文字幕在线一区| 综合激情成人伊人| 亚洲女子a中天字幕| 亚洲高清免费一级二级三级| 日韩高清中文字幕一区| 国内精品写真在线观看| 国产成人亚洲精品狼色在线| 99热这里都是精品| 91国偷自产一区二区三区观看 | 亚洲午夜国产一区99re久久| 手机精品视频在线观看| 韩国女主播成人在线观看| 成人综合婷婷国产精品久久 | 亚洲va欧美va人人爽| 美脚の诱脚舐め脚责91| 国产精品亚洲成人| 欧美中文字幕不卡| 久久蜜桃av一区精品变态类天堂 | 在线精品视频免费观看| 91精品国产欧美一区二区| wwwwxxxxx欧美| 亚洲欧洲精品一区二区三区| 五月婷婷激情综合网| 国产一区二区三区在线观看精品| 99精品国产视频| 日韩一区国产二区欧美三区| 中日韩av电影| 青青草国产成人av片免费| 99久久国产免费看| 91精品国产美女浴室洗澡无遮挡| 2021久久国产精品不只是精品| 亚洲欧美日韩在线播放| 免费观看久久久4p| 色婷婷综合在线| 国产午夜精品一区二区三区嫩草 | 99精品国产热久久91蜜凸| 欧美一级在线观看| 亚洲欧美怡红院| 激情久久五月天| 欧美日韩成人综合在线一区二区| 国产性做久久久久久| 亚洲成人精品一区| 成人av网站在线| 久久综合久久久久88| 午夜视频在线观看一区二区三区| 成人激情视频网站| 久久这里只有精品6| 五月天久久比比资源色| 91在线视频播放地址| 久久女同互慰一区二区三区| 青青草精品视频| 精品视频免费看| 一区二区三区四区亚洲| 大白屁股一区二区视频| 精品国产人成亚洲区| 日日噜噜夜夜狠狠视频欧美人| 一本一本大道香蕉久在线精品| 久久久av毛片精品| 国产自产高清不卡| 欧美成人性战久久| 国产999精品久久久久久绿帽| 日韩一区二区中文字幕| 视频在线观看91| 欧美日韩午夜在线| 亚洲高清免费一级二级三级| 91福利在线看| 亚洲国产视频在线| 在线精品观看国产| 亚洲国产精品一区二区尤物区| 色综合亚洲欧洲| 中文字幕一区不卡| 色偷偷88欧美精品久久久| 亚洲卡通欧美制服中文| 日本高清视频一区二区| 一区二区三区产品免费精品久久75| 99精品久久99久久久久|