📄 nethelp.lst
字号:
1 .file "nethelp.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:
94 .global nethelp_checksum
96 nethelp_checksum:
1:net/nethelp.c **** /*
2:net/nethelp.c **** ,-----------------------------------------------------------------------------------------.
3:net/nethelp.c **** | net/nethelp
4:net/nethelp.c **** |-----------------------------------------------------------------------------------------
5:net/nethelp.c **** | this file implements some helper functions
6:net/nethelp.c **** | - checksum generation -> originally written bei ulrich radig (his rtl8019 webserver)
7:net/nethelp.c **** |
8:net/nethelp.c **** | Author : Simon Schulz / avr{AT}auctionant.de
9:net/nethelp.c **** |
10:net/nethelp.c **** |
11:net/nethelp.c **** |
12:net/nethelp.c **** |-----------------------------------------------------------------------------------------
13:net/nethelp.c **** | License:
14:net/nethelp.c **** | This program is free software; you can redistribute it and/or modify it under
15:net/nethelp.c **** | the terms of the GNU General Public License as published by the Free Software
16:net/nethelp.c **** | Foundation; either version 2 of the License, or (at your option) any later
17:net/nethelp.c **** | version.
18:net/nethelp.c **** | This program is distributed in the hope that it will be useful, but
19:net/nethelp.c **** |
20:net/nethelp.c **** | WITHOUT ANY WARRANTY;
21:net/nethelp.c **** |
22:net/nethelp.c **** | without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
23:net/nethelp.c **** | PURPOSE. See the GNU General Public License for more details.
24:net/nethelp.c **** |
25:net/nethelp.c **** | You should have received a copy of the GNU General Public License along with
26:net/nethelp.c **** | this program; if not, write to the Free Software Foundation, Inc., 51
27:net/nethelp.c **** | Franklin St, Fifth Floor, Boston, MA 02110, USA
28:net/nethelp.c **** |
29:net/nethelp.c **** | http://www.gnu.de/gpl-ger.html
30:net/nethelp.c **** `-----------------------------------------------------------------------------------------*/
31:net/nethelp.c ****
32:net/nethelp.c **** #include "nethelp.h"
33:net/nethelp.c ****
34:net/nethelp.c **** //ACTIVATE DEBUG by editing this file:
35:net/nethelp.c **** #include "debug.h"
36:net/nethelp.c ****
37:net/nethelp.c **** unsigned int nethelp_checksum(unsigned char *buffer, unsigned int len, unsigned long csum32){
97 h r29
98 /* prologue: function */
99 /* frame size = 0 */
100 0000 EF92 movw r14,r24
101 0002 FF92 movw r16,r22
103 0006 1F93 .LM1:
104 0008 CF93 movw r28,r24
105 000a DF93 rjmp .L2
106 .L3:
108 000c 7C01 .LM2:
109 000e 8B01 ld r24,Y
111 .LM3:
112 0010 EC01 ldd r25,Y+1
114 .LM4:
38:net/nethelp.c **** gned int len, unsigned long csum32){
39:net/nethelp.c **** unsigned int res16 = 0x0000;
40:net/nethelp.c **** unsigned char data_hi;
41:net/nethelp.c **** unsigned char data_lo;
42:net/nethelp.c ****
43:net/nethelp.c **** //loop through buffer
44:net/nethelp.c **** while(len > 1){
45:net/nethelp.c **** //read data_hi/lo from pointer:
115 r24,Y
117 0014 8881 .LM3:
46:net/nethelp.c **** read data_hi/lo from pointer:
118 mp .L2
119 .L3:
121 .LM2:
122 ld r24,Y
47:net/nethelp.c **** read data_hi/lo from pointer:
48:net/nethelp.c **** data_hi = *buffer++;
49:net/nethelp.c **** data_lo = *buffer++;
50:net/nethelp.c ****
51:net/nethelp.c **** //generate 16bit var from both:
52:net/nethelp.c **** res16 = ((data_hi << 8) + data_lo);
124 r24
125 rjmp .L2
126 001a F82F .L3:
128 001e DF01 .LM2:
129 0020 A90F ld r24,Y
131 0024 CD01 .LM3:
132 0026 A0E0 ldd r25,Y+1
134 002a 280F .LM4:
135 002c 391F adiw r28,2
137 0030 5B1F .LM5:
53:net/nethelp.c **** ata_hi << 8) + data_lo);
54:net/nethelp.c ****
55:net/nethelp.c **** //add to csum
138 Y+1
140 0032 6250 .LM4:
141 0034 7040 adiw r28,2
143 .LM5:
144 mov r31,r24
145 0036 6230 ldi r30,lo8(0)
146 0038 7105 movw r26,r30
147 003a 00F4 add r26,r25
148 003c F801 adc r27,__zero_reg__
149 003e EE7F movw r24,r26
150 0040 EE0D ldi r26,lo8(0)
151 0042 FF1D ldi r27,hi8(0)
56:net/nethelp.c **** o);
57:net/nethelp.c ****
58:net/nethelp.c **** //add to csum
59:net/nethelp.c **** csum32 = csum32 + res16;
152 r26,r25
153 adc r27,__zero_reg__
154 0044 00FF movw r24,r26
155 0046 00C0 ldi r26,lo8(0)
60:net/nethelp.c **** m32 = csum32 + res16;
61:net/nethelp.c ****
62:net/nethelp.c **** //decrement length (we have read 2 bytes from ptr)
63:net/nethelp.c **** len -=2;
64:net/nethelp.c **** }
65:net/nethelp.c ****
156 ovw r26,r30
157 add r26,r25
158 0048 9081 adc r27,__zero_reg__
159 004a 80E0 movw r24,r26
160 004c A0E0 ldi r26,lo8(0)
161 004e B0E0 ldi r27,hi8(0)
162 0050 280F add r18,r24
163 0052 391F adc r19,r25
164 0054 4A1F adc r20,r26
165 0056 5B1F adc r21,r27
66:net/nethelp.c **** )
67:net/nethelp.c **** len -=2;
68:net/nethelp.c **** }
69:net/nethelp.c ****
167 r24
168 adc r19,r25
169 0058 CA01 adc r20,r26
170 005a AA27 adc r21,r27
172 005e 4070 .LM6:
173 0060 5070 subi r22,lo8(-(-2))
174 0062 820F sbci r23,hi8(-(-2))
175 0064 931F .L2:
177 0068 B51F .LM7:
70:net/nethelp.c **** )
178 -2))
179 sbci r23,hi8(-(-2))
180 006a 9D01 .L2:
182 006e 5527 .LM7:
183 0070 A070 cpi r22,2
184 0072 B070 cpc r23,__zero_reg__
185 0074 280F brsh .L3
186 0076 391F movw r30,r16
187 0078 4A1F andi r30,lo8(-2)
188 007a 5B1F add r30,r14
189 007c 2095 adc r31,r15
71:net/nethelp.c **** d 2 bytes from ptr)
72:net/nethelp.c **** len -=2;
73:net/nethelp.c **** }
74:net/nethelp.c ****
191 2)
192 add r30,r14
193 0080 C901 adc r31,r15
195 0082 DF91 .LM8:
196 0084 CF91 sbrs r16,0
197 0086 1F91 rjmp .L4
199 008a FF90 .LM9:
200 008c EF90 ld r25,Z
201 008e 0895 ldi r24,lo8(0)
202 ldi r26,lo8(0)
203 ldi r27,hi8(0)
204 add r18,r24
205 adc r19,r25
206 adc r20,r26
207 adc r21,r27
208 .L4:
DEFINED SYMBOLS
*ABS*:00000000 nethelp.c
C:\DOCUME~1\ESERVIS\USTAWI~1\Temp/ccAHMvZC.s:2 *ABS*:0000003f __SREG__
C:\DOCUME~1\ESERVIS\USTAWI~1\Temp/ccAHMvZC.s:3 *ABS*:0000003e __SP_H__
C:\DOCUME~1\ESERVIS\USTAWI~1\Temp/ccAHMvZC.s:4 *ABS*:0000003d __SP_L__
C:\DOCUME~1\ESERVIS\USTAWI~1\Temp/ccAHMvZC.s:5 *ABS*:00000034 __CCP__
C:\DOCUME~1\ESERVIS\USTAWI~1\Temp/ccAHMvZC.s:6 *ABS*:00000000 __tmp_reg__
C:\DOCUME~1\ESERVIS\USTAWI~1\Temp/ccAHMvZC.s:7 *ABS*:00000001 __zero_reg__
C:\DOCUME~1\ESERVIS\USTAWI~1\Temp/ccAHMvZC.s:96 .text:00000000 nethelp_checksum
UNDEFINED SYMBOLS
__do_copy_data
__do_clear_bss
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -