⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uipavr.lst

📁 uIP是免费的TCP/IP协议栈,我们将它移植到我们的AVR以太网开发板中
💻 LST
📖 第 1 页 / 共 5 页
字号:
(0155)       // process an ARP packet
(0156)       else if(BUF->type == htons(UIP_ETHTYPE_ARP))
    13DE E006      LDI	R16,6
    13DF E018      LDI	R17,0x8
    13E0 940E27BF  CALL	_htons
    13E2 90202BD6  LDS	R2,0x2BD6
    13E4 90302BD7  LDS	R3,0x2BD7
    13E6 1620      CP	R2,R16
    13E7 0631      CPC	R3,R17
    13E8 F461      BNE	0x13F5
(0157)       {
(0158)         uip_arp_arpin();
    13E9 940E2A51  CALL	_uip_arp_arpin
(0159) 
(0160)         // transmit a packet, if one is ready
(0161)         if(uip_len > 0)
    13EB 90202BC2  LDS	R2,uip_len
    13ED 90302BC3  LDS	R3,uip_len+1
    13EF 2022      TST	R2
    13F0 F411      BNE	0x13F3
    13F1 2033      TST	R3
    13F2 F011      BEQ	0x13F5
(0162)           nic_send();
    13F3 940E13FC  CALL	_nic_send
    13F5 CF80      RJMP	0x1376
(0163)       }
(0164)     }
(0165)   }
(0166) 
(0167)   return 1;
    13F6 E001      LDI	R16,1
    13F7 E010      LDI	R17,0
    13F8 9508      RET
FILE: D:\hexok项目\AVRNET项目\AVRNET光盘\AVRuIP\nic.c
(0001) /*****************************************************************************
(0002) *  Module Name:       NIC Driver Interface for uIP-AVR Port
(0003) *  
(0004) *  Created By:        Louis Beaudoin (www.embedded-creations.com)
(0005) *
(0006) *  Original Release:  November 16, 2003 
(0007) *
(0008) *  Module Description:  
(0009) *  Provides three functions to interface with a NIC driver
(0010) *  These functions can be called directly from the main uIP control loop
(0011) *  to send packets from uip_buf and uip_appbuf, and store incoming packets to
(0012) *  uip_buf
(0013) *
(0014) *
(0015) *****************************************************************************/
(0016) 
(0017) #include "nic.h"
(0018) 
(0019) 
(0020) #define IP_TCP_HEADER_LENGTH 40
(0021) #define TOTAL_HEADER_LENGTH (IP_TCP_HEADER_LENGTH+ETHERNET_HEADER_LENGTH)
(0022) 
(0023) 
(0024) void nic_init(void)
(0025) {
(0026) 	NICInit();
_nic_init:
    13F9 940E16C5  CALL	_rtl8019Init
    13FB 9508      RET
(0027) }
(0028) 
(0029) 
(0030) void nic_send(void)
(0031) {
(0032) 	NICBeginPacketSend(uip_len);
_nic_send:
    13FC 91002BC2  LDS	R16,uip_len
    13FE 91102BC3  LDS	R17,uip_len+1
    1400 940E1552  CALL	_rtl8019BeginPacketSend
(0033) 	
(0034) 	// send packet, using data in uip_appdata if over the IP+TCP header size
(0035) 	if( uip_len <= TOTAL_HEADER_LENGTH )
    1402 E386      LDI	R24,0x36
    1403 E090      LDI	R25,0
    1404 90202BC2  LDS	R2,uip_len
    1406 90302BC3  LDS	R3,uip_len+1
    1408 1582      CP	R24,R2
    1409 0593      CPC	R25,R3
    140A F048      BCS	0x1414
(0036) 	{
(0037)       NICSendPacketData(uip_buf, uip_len);
    140B 91202BC2  LDS	R18,uip_len
    140D 91302BC3  LDS	R19,uip_len+1
    140F EC0A      LDI	R16,0xCA
    1410 E21B      LDI	R17,0x2B
    1411 940E1585  CALL	_rtl8019SendPacketData
(0038) 	}
    1413 C019      RJMP	0x142D
(0039) 	else
(0040) 	{
(0041)       uip_len -= TOTAL_HEADER_LENGTH;
    1414 91802BC2  LDS	R24,uip_len
    1416 91902BC3  LDS	R25,uip_len+1
    1418 97C6      SBIW	R24,0x36
    1419 93902BC3  STS	uip_len+1,R25
    141B 93802BC2  STS	uip_len,R24
(0042)       NICSendPacketData(uip_buf, TOTAL_HEADER_LENGTH);
    141D E326      LDI	R18,0x36
    141E E030      LDI	R19,0
    141F EC0A      LDI	R16,0xCA
    1420 E21B      LDI	R17,0x2B
    1421 940E1585  CALL	_rtl8019SendPacketData
(0043) 	  NICSendPacketData((unsigned char *)uip_appdata, uip_len);
    1423 91202BC2  LDS	R18,uip_len
    1425 91302BC3  LDS	R19,uip_len+1
    1427 91002BC8  LDS	R16,uip_appdata
    1429 91102BC9  LDS	R17,uip_appdata+1
    142B 940E1585  CALL	_rtl8019SendPacketData
(0044) 	}
(0045) 
(0046) 	NICEndPacketSend();
    142D 940E1599  CALL	_rtl8019EndPacketSend
    142F 9508      RET
_nic_poll:
  packetLength         --> R10
    1430 940E2E6C  CALL	push_gset3x
(0047) }
(0048) 
(0049) 
(0050) 
(0051) #if UIP_BUFSIZE > 255
(0052) unsigned int nic_poll(void)
(0053) #else 
(0054) unsigned char nic_poll(void)
(0055) #endif /* UIP_BUFSIZE > 255 */
(0056) {
(0057) 	unsigned int packetLength;
(0058) 	
(0059) 	packetLength = NICBeginPacketRetreive();
    1432 940E15A0  CALL	_rtl8019BeginPacketRetreive
    1434 0158      MOVW	R10,R16
(0060) 
(0061) 	// if there's no packet or an error - exit without ending the operation
(0062) 	if( !packetLength )
    1435 3000      CPI	R16,0
    1436 0701      CPC	R16,R17
    1437 F419      BNE	0x143B
(0063) 	  return 0;
    1438 2700      CLR	R16
    1439 2711      CLR	R17
    143A C012      RJMP	0x144D
(0064) 
(0065) 	// drop anything too big for the buffer
(0066) 	if( packetLength > UIP_BUFSIZE )
    143B ED8C      LDI	R24,0xDC
    143C E095      LDI	R25,5
    143D 158A      CP	R24,R10
    143E 059B      CPC	R25,R11
    143F F428      BCC	0x1445
(0067) 	{
(0068) 	  NICEndPacketRetreive();
    1440 940E166C  CALL	_rtl8019EndPacketRetreive
(0069)       return 0;
    1442 2700      CLR	R16
    1443 2711      CLR	R17
    1444 C008      RJMP	0x144D
(0070) 	}
(0071) 	
(0072) 	// copy the packet data into the uIP packet buffer
(0073) 	NICRetreivePacketData( uip_buf, packetLength );
    1445 0195      MOVW	R18,R10
    1446 EC0A      LDI	R16,0xCA
    1447 E21B      LDI	R17,0x2B
    1448 940E1615  CALL	_rtl8019RetreivePacketData
(0074) 	NICEndPacketRetreive();
    144A 940E166C  CALL	_rtl8019EndPacketRetreive
(0075) 		
(0076) #if UIP_BUFSIZE > 255
(0077) 	return packetLength;
    144C 0185      MOVW	R16,R10
    144D 940E2E5A  CALL	pop_gset3x
    144F 9508      RET
_load_web_page:
  i                    --> R10
  webfile              --> R16
    1450 940E2E6C  CALL	push_gset3x
FILE: D:\hexok项目\AVRNET项目\AVRNET光盘\AVRuIP\fsdata.c
(0001) #define http_head_len 92
(0002) /*
(0003) 添加文件步骤:
(0004) 1.添加文件名
(0005) 2.加入网页文件(不带http头部)
(0006) 3.修改文件结构列表
(0007) 4.修改文件数
(0008) */
(0009) 
(0010) //文件名
(0011) char file_index_name[6]={'i','n','d','e','x'};
(0012) char file_page1_name[6]={'p','a','g','e','1'};
(0013) char file_page2_name[6]={'p','a','g','e','2'};
(0014) char file_picture_name[7]={'p','i','c','t','u','r','e'};
(0015) 
(0016) //公共网页发送缓冲区(已带http头部)
(0017) char mypage[6000]={ 
(0018)     0x48, 0x54, 0x54, 0x50, 0x2f, 0x31,	0x2e, 0x30,	0x20, 
(0019) 	
(0020) 	0x32, 0x30, 0x30, 0x20, 
(0021) 	0x4f, 0x4b, 0xd, 0xa, 
(0022) 	
(0023) 	0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x3a, 0x20, 0x75, 0x49, 0x50, 0x2f, 0x30, 
(0024) 	0x2e, 0x39, 0x20, 0x28, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 
(0025) 	0x2f, 0x64, 0x75, 0x6e, 0x6b, 0x65, 0x6c, 0x73, 0x2e, 0x63, 
(0026) 	0x6f, 0x6d, 0x2f, 0x61, 0x64, 0x61, 0x6d, 0x2f, 0x75, 0x69, 
(0027) 	0x70, 0x2f, 0x29, 0xd, 0xa, 
(0028) 	
(0029) 	0x43, 0x6f, 0x6e, 0x74, 0x65, 
(0030) 	0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x74, 
(0031) 	0x65, 0x78, 0x74, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x0d, 0x0a, 0x0d, 0x0a
(0032) };
(0033) 
(0034) //网页文件
(0035) #pragma data:code
(0036) const char index_html[]="<html>\
(0037) <head>\
(0038) <meta http-equiv=\"Content-Language\" content=\"zh-cn\">\
(0039) <meta name=\"GENERATOR\" content=\"Microsoft FrontPage 5.0\">\
(0040) <meta name=\"ProgId\" content=\"FrontPage.Editor.Document\">\
(0041) <meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">\
(0042) <title>uIP0.9 AVR by YHR - index</title>\
(0043) </head>\
(0044) <body bgcolor=\"#ADBDED\">\
(0045) <p align=\"left\">\
(0046) <font color=\"#0000FF\">\
(0047) <span style=\"font-size: 33pt; font-weight: 700\">WEB Server at uIP 0.9 TCP/IP Stack</span>\
(0048) </font>\
(0049) </p>\
(0050) <hr>\
(0051) <a href=\"page1.html\">page1</a>\
(0052) <p><img border=\"0\" src=\"/picture.png\"></p>\
(0053) </body>\
(0054) </html>\
(0055) <end>\
(0056) ";
(0057) 
(0058) const char page1_html[]="<html>\
(0059) <head>\
(0060) <meta http-equiv=\"Content-Language\" content=\"zh-cn\">\
(0061) <meta name=\"GENERATOR\" content=\"Microsoft FrontPage 5.0\">\
(0062) <meta name=\"ProgId\" content=\"FrontPage.Editor.Document\">\
(0063) <meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">\
(0064) <title>uIP0.9 AVR by YHR - page1</title>\
(0065) </head>\
(0066) <body bgcolor=\"#ADBDED\">\
(0067) <p align=\"left\">\
(0068) <font color=\"#0000FF\">\
(0069) <span style=\"font-size: 33pt; font-weight: 700\">WEB Server at uIP 0.9 TCP/IP Stack</span>\
(0070) </font>\
(0071) </p>\
(0072) <hr>\
(0073) <a href=\"page2.html\">page2</a>\
(0074) <form method=\"POST\" action=\"page1.html\">\
(0075) <p>\
(0076) <input type=\"radio\" value=\"V1\" name=\"R1\">\
(0077) <input type=\"radio\" name=\"R1\" value=\"V2\">\
(0078) <input type=\"submit\" value=\"提交\" name=\"B1\"><input type=\"reset\" value=\"重置\" name=\"B2\">\
(0079) </p>\
(0080) </form>\
(0081) </body>\
(0082) </html>\
(0083) <end>\
(0084) ";
(0085) 
(0086) const char page2_html[]="<html>\
(0087) <head>\
(0088) <meta http-equiv=\"Content-Language\" content=\"zh-cn\">\
(0089) <meta name=\"GENERATOR\" content=\"Microsoft FrontPage 5.0\">\
(0090) <meta name=\"ProgId\" content=\"FrontPage.Editor.Document\">\
(0091) <meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">\
(0092) <title>uIP0.9 AVR by YHR - page2</title>\
(0093) </head>\
(0094) <body bgcolor=\"#ADBDED\">\
(0095) <p align=\"left\">\
(0096) <font color=\"#0000FF\">\
(0097) <span style=\"font-size: 33pt; font-weight: 700\">WEB Server at uIP 0.9 TCP/IP Stack</span>\
(0098) </font>\
(0099) </p>\
(0100) <hr>\
(0101) <a href=\"/\">index</a>\
(0102) </body>\
(0103) </html>\
(0104) <end>\
(0105) ";
(0106) 
(0107) const char picture_png[]={
(0108) 	0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 
(0109) 	00, 00, 00, 0xd, 0x49, 0x48, 0x44, 0x52, 00, 00, 
(0110) 	0x3, 0x1d, 00, 00, 00, 0x5e, 0x8, 0x6, 00, 00, 
(0111) 	00, 0x46, 0xbd, 0x79, 0xcc, 00, 00, 00, 0x6, 0x62, 
(0112) 	0x4b, 0x47, 0x44, 00, 0xff, 00, 0xff, 00, 0xff, 0xa0, 
(0113) 	0xbd, 0xa7, 0x93, 00, 00, 00, 0x9, 0x70, 0x48, 0x59, 
(0114) 	0x73, 00, 00, 0xb, 0x12, 00, 00, 0xb, 0x12, 0x1, 
(0115) 	0xd2, 0xdd, 0x7e, 0xfc, 00, 00, 00, 0x7, 0x74, 0x49, 
(0116) 	0x4d, 0x45, 0x7, 0xd3, 0xa, 0x5, 0x12, 0x22, 0x33, 0x22, 
(0117) 	0xd0, 0x7c, 0x9a, 00, 00, 00, 0x1d, 0x74, 0x45, 0x58, 
(0118) 	0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 00, 0x43, 
(0119) 	0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x77, 0x69, 0x74, 
(0120) 	0x68, 0x20, 0x54, 0x68, 0x65, 0x20, 0x47, 0x49, 0x4d, 0x50, 
(0121) 	0xef, 0x64, 0x25, 0x6e, 00, 00, 0x3, 0xa0, 0x49, 0x44, 
(0122) 	0x41, 0x54, 0x78, 0xda, 0xed, 0xdd, 0xc1, 0x76, 0x9a, 0x40, 
(0123) 	0x18, 0x80, 0x51, 0x27, 0xc7, 0x5, 0x6c, 0xd1, 0x65, 0x1a, 
(0124) 	0xec, 0xe9, 0xfb, 0xbf, 0x45, 0x9e, 0x23, 0xd5, 0xb4, 0x4b, 
(0125) 	0x71, 0x19, 0xdd, 0x4d, 0x97, 0x36, 0x8a, 0x6, 0x1c, 0x82, 
(0126) 	0x20, 0xf7, 0xee, 0x92, 0xa8, 0x3f, 0xc, 0x68, 0xfa, 0xa1, 
(0127) 	0x3d, 0x9, 0x6f, 0xaf, 0x1f, 0x71, 0x76, 0x26, 0xcc, 0x6e, 
(0128) 	0x15, 0x9e, 0xce, 0xbf, 0x17, 0xe3, 0x71, 0x44, 0xb8, 0xfd, 
(0129) 	0xa1, 0x93, 0xd5, 0x6d, 0x5b, 0x7f, 0xc3, 0x13, 0xef, 0x1e, 
(0130) 	0x86, 0xb3, 0x2d, 0x5d, 0x6d, 0xdb, 0xf2, 0x57, 0x96, 0x34, 
(0131) 	0x77, 0xfb, 0xfb, 0x90, 0x74, 0xff, 0xe5, 0xcf, 0xb4, 0xf9, 
(0132) 	0xbb, 0x4d, 0xda, 0xfc, 0xa2, 0xcc, 0x92, 0xd6, 0xb4, 0x5a, 
(0133) 	0x5f, 0x99, 0xdf, 0xe0, 0x5c, 0x5f, 0xae, 0xb2, 0xd9, 0x20, 
(0134) 	0x85, 0x6f, 0x5c, 0xff, 0x70, 0x7c, 0x2d, 0x5a, 0x94, 0xf9, 
(0135) 	0xf0, 0x76, 0xfd, 0x69, 0x36, 0x39, 0x53, 0xdc, 0xe7, 0x41, 
(0136) 	0xfc, 0x1e, 0x18, 0xe1, 0xef, 0x41, 0xc6, 0xf1, 0x7c, 0xa9, 
(0137) 	0x3d, 0x4f, 0xe3, 0x83, 0x1f, 0xfc, 0xb1, 0x1e, 0x17, 0xcb, 
(0138) 	0x4, 00, 00, 0x68, 0x33, 00, 00, 00, 0xd1, 0x1, 
(0139) 	00, 00, 0x88, 0xe, 00, 00, 0x40, 0x74, 00, 00, 
(0140) 	00, 0x88, 0xe, 00, 00, 0x40, 0x74, 00, 00, 00, 
(0141) 	0xa2, 0x3, 00, 00, 0x40, 0x74, 00, 00, 00, 0xa2, 
(0142) 	0x3, 00, 00, 0x40, 0x74, 00, 00, 00, 0xa2, 0x3, 
(0143) 	00, 00, 0x10, 0x1d, 00, 0x1d, 0xa, 0x96, 00, 00, 
(0144) 	0x44, 0x7, 00, 00, 0x40, 0x4b, 0xe1, 0xed, 0xf5, 0x23, 
(0145) 	0xd6, 0x7c, 0xfb, 0xf6, 0x7, 0xac, 0xc9, 0x98, 0x18, 0x8f, 
(0146) 	0x23, 0xc2, 0x1d, 0xaf, 0x64, 0x86, 0x7b, 0x26, 0x56, 0xe2, 
(0147) 	0x7e, 0x77, 0xba, 0x6e, 0x1d, 0x1f, 0x83, 0xa4, 0x6d, 0xb, 
(0148) 	0xfd, 0x6e, 0x6b, 0x97, 0x6b, 0x1a, 0xee, 0x7c, 0x55, 0x7e, 
(0149) 	0xb1, 0xca, 0x92, 0x9e, 0xb, 0xdb, 0xf5, 0x21, 0x69, 0xfe, 
(0150) 	0x32, 0x61, 0xfe, 0x18, 0x8f, 0xf7, 0xc3, 0xbf, 0x46, 0xd9, 
(0151) 	0xe7, 0xe1, 0xaf, 0xd5, 0xd8, 0xdf, 0x9, 0xf4, 0x4e, 0xe6, 
(0152) 	0x24, 0x9e, 0x2f, 0xb5, 0xe7, 0x69, 0x7c, 0xf0, 0x83, 0x3f, 
(0153) 	0xd6, 0xe3, 0x62, 0x99, 00, 00, 00, 0x6d, 0x6, 00, 
(0154) 	00, 0x20, 0x3a, 00, 00, 00, 0xd1, 0x1, 00, 00, 
(0155) 	0x88, 0xe, 00, 00, 00, 0xd1, 0x1, 00, 00, 0x88, 
(0156) 	0xe, 00, 00, 0x40, 0x74, 00, 00, 00, 0x88, 0xe, 
(0157) 	00, 00, 0x40, 0x74, 00, 00, 00, 0x88, 0xe, 0x98, 
(0158) 	0xaa, 0xe0, 0x59, 0xf, 00, 0x88, 0xe, 00, 0x86, 0x53, 
(0159) 	0xa9, 0x96, 00, 00, 0xd1, 0x1, 00, 00, 0x88, 0xe, 
(0160) 	00, 00, 0x40, 0x74, 00, 00, 00, 0x7c, 0x93, 0xb9, 
(0161) 	0x25, 0x80, 0xfb, 0x28, 0xca, 0xec, 0xe2, 0xcf, 0x42, 0x83, 
(0162) 	0xcf, 0xd1, 0x57, 0xeb, 0xc3, 0xe5, 0x1f, 0x36, 0xb8, 0x9c, 
(0163) 	0xb0, 0x5c, 0x65, 0x49, 0xdb, 0xbf, 0xbd, 0x30, 0x3f, 0x34, 
(0164) 	0xfc, 0x3f, 00, 0x8b, 0x32, 0x6d, 0xfe, 0x6e, 0x73, 0x68, 
(0165) 	0x7f, 0xa7, 0x10, 0xff, 0x9b, 0x9f, 0x27, 0xcd, 0xaf, 0xde, 
(0166) 	0xf7, 0xed, 0x46, 0x9f, 0x1c, 0x93, 0xe2, 0x39, 0xf7, 0x24, 
(0167) 	00, 0x60, 0x32, 0xbc, 0xd3, 0x1, 00, 00, 0x88, 0xe, 
(0168) 	00, 00, 0x40, 0x74, 00, 00, 00, 0x88, 0xe, 00, 
(0169) 	00, 0x40, 0x74, 00, 00, 00, 0x8f, 0x1f, 0x1d, 0xdd, 
(0170) 	0xfe, 0xf9, 0xd9, 0x18, 0xa3, 0x55, 0x6, 00, 00, 0xd1, 
(0171) 	0xc1, 0x64, 0x84, 0x8e, 0x1f, 0x2e, 0x58, 0x52, 00, 00, 
(0172) 	0x44, 0x7, 00, 00, 0x20, 0x3a, 00, 00, 00, 0xd1, 
(0173) 	0x1, 00, 00, 0x20, 0x3a, 00, 00, 00, 0xd1, 0x1, 
(0174) 	00, 00, 0x88, 0xe, 00, 00, 00, 0xd1, 0x1, 00, 
(0175) 	00, 0x88, 0xe, 00, 00, 0x80, 0xb9, 0x25, 0x80, 0xfb, 
(0176) 	0xd8, 0x6d, 0xe, 0x77, 0x9d, 0xbf, 0x5d, 0xa7, 0xcd, 0x5f, 
(0177) 	0xae, 0xb2, 0xa4, 0xfb, 0x57, 0x35, 0xfb, 0xdf, 0xe6, 0x8f, 
(0178) 	0x4d, 0x16, 0x65, 0xbb, 0xf9, 0xa7, 0x8f, 0x5d, 0x6d, 0xf6, 
(0179) 	0xe7, 0x37, 0x88, 0xf1, 0xca, 0x3, 0x7c, 0xfe, 0x72, 0xf1, 
(0180) 	0x92, 0x3b, 0x89, 0x1, 0xa0, 0x21, 0xef, 0x74, 00, 00, 
(0181) 	00, 0xa2, 0x3, 00, 00, 0x10, 0x1d, 00, 00, 00, 
(0182) 	0xa2, 0x63, 0xac, 0xda, 0x7c, 0xce, 0x1d, 00, 00, 0x44, 
(0183) 	0x7, 0xe0, 0x59, 0xd, 00, 0xf8, 0xe7, 0x9, 00, 00, 
(0184) 	0x80, 0xe8, 00, 00, 00, 0x44, 0x7, 00, 00, 0x80, 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -