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

📄 icmp.lst

📁 ENC system full - ENC28J60
💻 LST
字号:
   1               		.file	"icmp.c"
   2               	__SREG__ = 0x3f
   3               	__SP_H__ = 0x3e
   4               	__SP_L__ = 0x3d
   5               	__CCP__  = 0x34
   6               	__tmp_reg__ = 0
   7               	__zero_reg__ = 1
   8               		.global __do_copy_data
   9               		.global __do_clear_bss
  11               		.text
  12               	.Ltext0:
 120               	.global	icmp_packet_in
 122               	icmp_packet_in:
   1:net/icmp.c    **** /*
   2:net/icmp.c    **** ,-----------------------------------------------------------------------------------------.
   3:net/icmp.c    **** | net/icmp
   4:net/icmp.c    **** |-----------------------------------------------------------------------------------------
   5:net/icmp.c    **** | this file implements a very basic icmp protocol
   6:net/icmp.c    **** | - ethernet packet generation is done
   7:net/icmp.c    **** | - received ping request is answered with reply
   8:net/icmp.c    **** | - thats it! we can not send a ping request for example...
   9:net/icmp.c    **** |
  10:net/icmp.c    **** | Author   : Simon Schulz / avr{AT}auctionant.de
  11:net/icmp.c    **** |
  12:net/icmp.c    **** | 
  13:net/icmp.c    **** |
  14:net/icmp.c    **** |-----------------------------------------------------------------------------------------
  15:net/icmp.c    **** | License:
  16:net/icmp.c    **** | This program is free software; you can redistribute it and/or modify it under
  17:net/icmp.c    **** | the terms of the GNU General Public License as published by the Free Software
  18:net/icmp.c    **** | Foundation; either version 2 of the License, or (at your option) any later
  19:net/icmp.c    **** | version.
  20:net/icmp.c    **** | This program is distributed in the hope that it will be useful, but
  21:net/icmp.c    **** |
  22:net/icmp.c    **** | WITHOUT ANY WARRANTY;
  23:net/icmp.c    **** |
  24:net/icmp.c    **** | without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  25:net/icmp.c    **** | PURPOSE. See the GNU General Public License for more details.
  26:net/icmp.c    **** |
  27:net/icmp.c    **** | You should have received a copy of the GNU General Public License along with
  28:net/icmp.c    **** | this program; if not, write to the Free Software Foundation, Inc., 51
  29:net/icmp.c    **** | Franklin St, Fifth Floor, Boston, MA 02110, USA
  30:net/icmp.c    **** |
  31:net/icmp.c    **** | http://www.gnu.de/gpl-ger.html
  32:net/icmp.c    **** `-----------------------------------------------------------------------------------------*/
  33:net/icmp.c    **** 
  34:net/icmp.c    **** #include "icmp.h"
  35:net/icmp.c    **** #include "mynic.h"
  36:net/icmp.c    **** #include "ip.h"
  37:net/icmp.c    **** 
  38:net/icmp.c    **** //ACTIVATE DEBUG by editing this file:
  39:net/icmp.c    **** #include "debug.h"
  40:net/icmp.c    **** 
  41:net/icmp.c    **** //called if icmp packet comes in
  42:net/icmp.c    **** void icmp_packet_in(unsigned char *buffer,unsigned int len){
 123               	_in
 126 0000 EF92      	.global	icmp_packet_in
 128 0004 0F93      	icmp_packet_in:
 130 0008 CF93      	.LM0:
 131 000a DF93      	.LFBB1:
 132               		push r14
 133               		push r15
 134 000c EC01      		push r16
 135 000e 7B01      		push r17
  43:net/icmp.c    **** _packet_in(unsigned char *buffer,unsigned int len){
  44:net/icmp.c    **** 	int i;
  45:net/icmp.c    **** 	int pos;
  46:net/icmp.c    **** 
  47:net/icmp.c    **** 	//we only support ICMP echo request (ping) packets:
 136               	p_packet_in
 138 0010 8AA1      	icmp_packet_in:
 140 0014 01F0      	.LM0:
 141 0016 00C0      	.LFBB1:
  48:net/icmp.c    ****  only support ICMP echo request (ping) packets:
  49:net/icmp.c    **** 	if (buffer[ICMP_POS_TYPE] == ICMP_TYPE_ECHO_REQUEST){
  50:net/icmp.c    **** 		#if ICMP_DEBUG
  51:net/icmp.c    **** 		softuart_puts_progmem("ICMP: echo reply sent");
  52:net/icmp.c    **** 		softuart_putnewline();
  53:net/icmp.c    **** 		#endif
  54:net/icmp.c    **** 		//reuse buffer for the ICMP echo reply:
  55:net/icmp.c    **** 
  56:net/icmp.c    **** 		//*******************************
  57:net/icmp.c    **** 		//setup the eth packet:
 142               	8
 144 0018 8E01      	.global	icmp_packet_in
 146 001c 1F4F      	icmp_packet_in:
 148 0020 0E94 0000 	.LM0:
 149 0024 0E94 0000 	.LFBB1:
  58:net/icmp.c    **** ************
 150               	8
 152 0028 97FF      	.global	icmp_packet_in
 154 002c FE01      	icmp_packet_in:
 156 0030 30E0      	.LM0:
 157               	.LFBB1:
  59:net/icmp.c    **** y:
  60:net/icmp.c    **** 
  61:net/icmp.c    **** 		//*******************************
 158               	8
 160 0032 8681      	.global	icmp_packet_in
 162               	icmp_packet_in:
 164 0036 2F5F      	.LM0:
 165 0038 3F4F      	.LFBB1:
 166 003a 2630      		push r14
 167 003c 3105      		push r15
 168 003e 01F4      		push r16
 169 0040 00C0      		push r17
 170               		push r28
 171 0042 DC01      		push r29
 172 0044 33E0      	/* prologue: function */
 173 0046 AA0F      	/* frame size = 0 */
 174 0048 BB1F      		movw r28,r24
 175 004a 3A95      		movw r14,r22
 177 004e 880F      	.LM1:
 178 0050 991F      		ldd r24,Y+34
 179 0052 A80F      		cpi r24,lo8(8)
 180 0054 B91F      		breq .+2
 181 0056 A050      		rjmp .L9
 183 005a 20E0      	.LM2:
 184 005c 30E0      		movw r16,r28
 185               		subi r16,lo8(-(26))
  62:net/icmp.c    **** y:
  63:net/icmp.c    **** 
  64:net/icmp.c    **** 		//*******************************
  65:net/icmp.c    **** 		//setup the eth packet:
 186               	1
 187               	.LM1:
 188 005e FE01      		ldd r24,Y+34
 189 0060 E20F      		cpi r24,lo8(8)
 190 0062 F31F      		breq .+2
 191 0064 8D91      		rjmp .L9
 193               	.LM2:
 194               		movw r16,r28
 195 0068 2F5F      		subi r16,lo8(-(26))
 196 006a 3F4F      		sbci r17,hi8(-(26))
 197 006c 2630      		movw r24,r16
 198 006e 3105      		call nic_buffer_to_ip
 199 0070 01F4      		call arp_search_by_ip
  66:net/icmp.c    **** ************
  67:net/icmp.c    **** 		//setup the eth packet:
  68:net/icmp.c    **** 		//get packet target mac from arp table:
  69:net/icmp.c    **** 		pos = arp_search_by_ip(nic_buffer_to_ip(&buffer[IP_POS_SRC_IP]));
 201               	6,lo8(-(26))
 202               		sbci r17,hi8(-(26))
 203 0072 CE01      		movw r24,r16
 204 0074 0696      		call nic_buffer_to_ip
 205 0076 0E94 0000 		call arp_search_by_ip
  70:net/icmp.c    **** ffer_to_ip(&buffer[IP_POS_SRC_IP]));
  71:net/icmp.c    **** 		if (pos<0){
  72:net/icmp.c    **** 			//no match, copy src to target ...
 206               	
 207               	.LM2:
 208 007a 1AA2      		movw r16,r28
  73:net/icmp.c    **** //no match, copy src to target ...
  74:net/icmp.c    **** 			for(i=0; i<6; i++)
  75:net/icmp.c    **** 				buffer[i] = buffer[6+i];
  76:net/icmp.c    **** 		}else{
  77:net/icmp.c    **** 			//match, copy mac from arp table:
 209               	abn	68,0,47,.LM1-.LFBB1
 210               	.LM1:
 211 007c 8CA1      		ldd r24,Y+34
 212 007e 883F      		cpi r24,lo8(8)
 213 0080 00F0      		breq .+2
  78:net/icmp.c    **** atch, copy mac from arp table:
 214               	ction */
 215               	/* frame size = 0 */
 216 0082 8DA1      		movw r28,r24
 217 0084 8F5F      		movw r14,r22
 219               	.LM1:
  79:net/icmp.c    **** atch, copy mac from arp table:
  80:net/icmp.c    **** 			for(i=0; i<6; i++)
 220               	sh r17
 221               		push r28
 222 0088 8CA1      		push r29
 223 008a 885F      	/* prologue: function */
 224 008c 8CA3      	/* frame size = 0 */
 225 008e FE01      		movw r28,r24
 226 0090 20E0      		movw r14,r22
 228               	.LM1:
  81:net/icmp.c    ****  table:
  82:net/icmp.c    **** 			for(i=0; i<6; i++)
  83:net/icmp.c    **** 				buffer[i] = arp_table[pos].mac[i];
  84:net/icmp.c    **** 		}
  85:net/icmp.c    **** 
 229               	sh r17
 230               		push r28
 231 0094 828D      		push r29
 232 0096 868F      	/* prologue: function */
 233               	/* frame size = 0 */
 234               		movw r28,r24
 235 0098 2F5F      		movw r14,r22
 237 009c 3196      	.LM1:
 238 009e 2430      		ldd r24,Y+34
 239 00a0 3105      		cpi r24,lo8(8)
 240 00a2 01F4      		breq .+2
  86:net/icmp.c    **** rp_table[pos].mac[i];
  87:net/icmp.c    **** 		}
  88:net/icmp.c    **** 
  89:net/icmp.c    **** 		//packet source mac:
 241               	ction */
 242               	/* frame size = 0 */
 243 00a4 4091 0000 		movw r28,r24
 244 00a8 5091 0000 		movw r14,r22
 246 00b0 7091 0000 	.LM1:
 247 00b4 C801      		ldd r24,Y+34
 248 00b6 0E94 0000 		cpi r24,lo8(8)
  90:net/icmp.c    **** }
  91:net/icmp.c    **** 
  92:net/icmp.c    **** 		//packet source mac:
 249               	ologue: function */
 250               	/* frame size = 0 */
 251 00ba CE01      		movw r28,r24
 252 00bc B701      		movw r14,r22
 254               	.LM1:
 255               		ldd r24,Y+34
  93:net/icmp.c    **** }
  94:net/icmp.c    **** 
 256               	8
 257               		push r29
 258 00c2 DF91      	/* prologue: function */
 259 00c4 CF91      	/* frame size = 0 */
 260 00c6 1F91      		movw r28,r24
 261 00c8 0F91      		movw r14,r22
 263 00cc EF90      	.LM1:
 264 00ce 0895      		ldd r24,Y+34
 265               		cpi r24,lo8(8)
 266               		breq .+2
 267               		rjmp .L9
 269               	.LM2:
 270               		movw r16,r28
 271               		subi r16,lo8(-(26))
 272               		sbci r17,hi8(-(26))
DEFINED SYMBOLS
                            *ABS*:00000000 icmp.c
C:\DOCUME~1\ESERVIS\USTAWI~1\Temp/ccknZnc6.s:2      *ABS*:0000003f __SREG__
C:\DOCUME~1\ESERVIS\USTAWI~1\Temp/ccknZnc6.s:3      *ABS*:0000003e __SP_H__
C:\DOCUME~1\ESERVIS\USTAWI~1\Temp/ccknZnc6.s:4      *ABS*:0000003d __SP_L__
C:\DOCUME~1\ESERVIS\USTAWI~1\Temp/ccknZnc6.s:5      *ABS*:00000034 __CCP__
C:\DOCUME~1\ESERVIS\USTAWI~1\Temp/ccknZnc6.s:6      *ABS*:00000000 __tmp_reg__
C:\DOCUME~1\ESERVIS\USTAWI~1\Temp/ccknZnc6.s:7      *ABS*:00000001 __zero_reg__
C:\DOCUME~1\ESERVIS\USTAWI~1\Temp/ccknZnc6.s:122    .text:00000000 icmp_packet_in

UNDEFINED SYMBOLS
__do_copy_data
__do_clear_bss
nic_buffer_to_ip
arp_search_by_ip
arp_table
nic_copy_mac_to_buf
nic_ip
nic_ip_to_buffer
nic_send_packet

⌨️ 快捷键说明

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