📄 mynic.lst
字号:
1 .file "mynic.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:
119 .global nic_copy_mac_to_buf
121 nic_copy_mac_to_buf:
1:net/mynic.c **** /*
2:net/mynic.c **** ,-----------------------------------------------------------------------------------------.
3:net/mynic.c **** | net/nic
4:net/mynic.c **** |-----------------------------------------------------------------------------------------
5:net/mynic.c **** | this file implements some basic nic function
6:net/mynic.c **** | - wrapper for enc28j60 ethernet control lib
7:net/mynic.c **** | - ip/mac buffer conversion tools
8:net/mynic.c **** |
9:net/mynic.c **** | Author : Simon Schulz / avr{AT}auctionant.de
10:net/mynic.c **** |
11:net/mynic.c **** |
12:net/mynic.c **** |
13:net/mynic.c **** |-----------------------------------------------------------------------------------------
14:net/mynic.c **** | License:
15:net/mynic.c **** | This program is free software; you can redistribute it and/or modify it under
16:net/mynic.c **** | the terms of the GNU General Public License as published by the Free Software
17:net/mynic.c **** | Foundation; either version 2 of the License, or (at your option) any later
18:net/mynic.c **** | version.
19:net/mynic.c **** | This program is distributed in the hope that it will be useful, but
20:net/mynic.c **** |
21:net/mynic.c **** | WITHOUT ANY WARRANTY;
22:net/mynic.c **** |
23:net/mynic.c **** | without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
24:net/mynic.c **** | PURPOSE. See the GNU General Public License for more details.
25:net/mynic.c **** |
26:net/mynic.c **** | You should have received a copy of the GNU General Public License along with
27:net/mynic.c **** | this program; if not, write to the Free Software Foundation, Inc., 51
28:net/mynic.c **** | Franklin St, Fifth Floor, Boston, MA 02110, USA
29:net/mynic.c **** |
30:net/mynic.c **** | http://www.gnu.de/gpl-ger.html
31:net/mynic.c **** `-----------------------------------------------------------------------------------------*/
32:net/mynic.c **** #include "net/mynic.h"
33:net/mynic.c **** #include "io/enc28j60.h"
34:net/mynic.c ****
35:net/mynic.c **** //ACTIVATE DEBUG by editing this file:
36:net/mynic.c **** #include "debug.h"
37:net/mynic.c ****
38:net/mynic.c **** uint32_t nic_ip;
39:net/mynic.c **** uint8_t nic_mac[6];
40:net/mynic.c **** uint32_t nic_gateway_ip;
41:net/mynic.c ****
42:net/mynic.c **** void nic_init(){
43:net/mynic.c **** //init enc28j60
44:net/mynic.c **** #if NIC_DEBUG
45:net/mynic.c **** softuart_puts_progmem("NIC : enc28j60 init... ");
46:net/mynic.c **** #endif
47:net/mynic.c **** enc28j60_init();
48:net/mynic.c **** //enc28j60Init();
49:net/mynic.c **** #if NIC_DEBUG
50:net/mynic.c **** softuart_puts_progmem("done\r\n");
51:net/mynic.c **** #endif
52:net/mynic.c ****
53:net/mynic.c **** //set mac:
54:net/mynic.c **** nic_copy_mac_to_buf(nic_mac);
55:net/mynic.c **** //enc28j60_set_mac_address(&nic_mac[0]);
56:net/mynic.c ****
57:net/mynic.c **** //set ip:
58:net/mynic.c **** nic_ip = NIC_IP_ADDRESS;
59:net/mynic.c ****
60:net/mynic.c **** #if NIC_DEBUG
61:net/mynic.c **** softuart_puts_progmem("NIC : ");
62:net/mynic.c **** softuart_put_ip(nic_ip);
63:net/mynic.c **** softuart_putnewline();
64:net/mynic.c **** #endif
65:net/mynic.c ****
66:net/mynic.c **** //setup default gw ip:
67:net/mynic.c **** nic_gateway_ip = NIC_GATEWAY_IP_ADDRESS;
68:net/mynic.c **** }
69:net/mynic.c ****
70:net/mynic.c **** inline void nic_send_packet(unsigned char *buffer, unsigned int len){
71:net/mynic.c **** enc28j60_send_packet(buffer,len);
72:net/mynic.c **** //enc28j60PacketSend(len,buffer);
73:net/mynic.c **** }
74:net/mynic.c ****
75:net/mynic.c **** inline unsigned int nic_receive_packet(unsigned char *buffer, unsigned int maxlen){
76:net/mynic.c **** return enc28j60_receive_packet(buffer,maxlen);
77:net/mynic.c **** //return enc28j60PacketReceive(maxlen,buffer);
78:net/mynic.c **** }
79:net/mynic.c ****
80:net/mynic.c **** void nic_copy_mac_to_buf(unsigned char * buffer){
122
123 .LM0:
124 .LFBB1:
125 /* prologue: function */
126 /* frame size = 0 */
127 0000 FC01 movw r30,r24
81:net/mynic.c **** y_mac_to_buf(unsigned char * buffer){
128 bn 68,0,81,.LM1-.LFBB1
129 .LM1:
130 0002 8CEA ldi r24,lo8(-84)
131 0004 8083 st Z,r24
82:net/mynic.c **** y_mac_to_buf(unsigned char * buffer){
132 abn 68,0,82,.LM2-.LFBB1
133 .LM2:
134 0006 8EED ldi r24,lo8(-34)
135 0008 8183 std Z+1,r24
83:net/mynic.c **** y_mac_to_buf(unsigned char * buffer){
136 abn 68,0,83,.LM3-.LFBB1
137 .LM3:
138 000a 88E4 ldi r24,lo8(72)
139 000c 8283 std Z+2,r24
84:net/mynic.c **** y_mac_to_buf(unsigned char * buffer){
140 abn 68,0,84,.LM4-.LFBB1
141 .LM4:
142 000e 8AEA ldi r24,lo8(-86)
143 0010 8383 std Z+3,r24
85:net/mynic.c **** y_mac_to_buf(unsigned char * buffer){
144 abn 68,0,85,.LM5-.LFBB1
145 .LM5:
146 0012 8BEB ldi r24,lo8(-69)
147 0014 8483 std Z+4,r24
86:net/mynic.c **** y_mac_to_buf(unsigned char * buffer){
148 abn 68,0,86,.LM6-.LFBB1
149 .LM6:
150 0016 8CEC ldi r24,lo8(-52)
151 0018 8583 std Z+5,r24
152 /* epilogue start */
87:net/mynic.c **** y_mac_to_buf(unsigned char * buffer){
153 bn 68,0,87,.LM7-.LFBB1
154 .LM7:
155 001a 0895 ret
157 .Lscope1:
160 .global nic_buffer_to_unsigned_int
162 nic_buffer_to_unsigned_int:
88:net/mynic.c **** y_mac_to_buf(unsigned char * buffer){
89:net/mynic.c **** buffer[0] = NIC_MAC0;
163 ,0,89,.LM8-.LFBB2
164 .LM8:
165 .LFBB2:
166 /* prologue: function */
167 /* frame size = 0 */
168 001c FC01 movw r30,r24
170 .LM9:
171 001e 9489 ldd r25,Z+20
172 0020 80E0 ldi r24,lo8(0)
173 0022 2589 ldd r18,Z+21
174 0024 30E0 ldi r19,lo8(0)
175 0026 282B or r18,r24
176 0028 392B or r19,r25
90:net/mynic.c **** ar * buffer){
91:net/mynic.c **** buffer[0] = NIC_MAC0;
92:net/mynic.c **** buffer[1] = NIC_MAC1;
177 2,.LM10-.LFBB2
178 .LM10:
179 002a C901 movw r24,r18
180 /* epilogue start */
181 002c 0895 ret
183 .Lscope2:
186 .global nic_buffer_to_ip
188 nic_buffer_to_ip:
93:net/mynic.c **** = NIC_MAC0;
94:net/mynic.c **** buffer[1] = NIC_MAC1;
189 ,94,.LM11-.LFBB3
190 .LM11:
191 .LFBB3:
192 /* prologue: function */
193 /* frame size = 0 */
194 002e FC01 movw r30,r24
196 .LM12:
197 0030 2381 ldd r18,Z+3
198 0032 30E0 ldi r19,lo8(0)
199 0034 40E0 ldi r20,lo8(0)
200 0036 50E0 ldi r21,hi8(0)
201 0038 8081 ld r24,Z
202 003a 90E0 ldi r25,lo8(0)
203 003c A0E0 ldi r26,lo8(0)
204 003e B0E0 ldi r27,hi8(0)
205 0040 B82F mov r27,r24
206 0042 AA27 clr r26
207 0044 9927 clr r25
208 0046 8827 clr r24
209 0048 282B or r18,r24
210 004a 392B or r19,r25
211 004c 4A2B or r20,r26
212 004e 5B2B or r21,r27
213 0050 8181 ldd r24,Z+1
214 0052 90E0 ldi r25,lo8(0)
215 0054 A0E0 ldi r26,lo8(0)
216 0056 B0E0 ldi r27,hi8(0)
217 0058 DC01 movw r26,r24
218 005a 9927 clr r25
219 005c 8827 clr r24
220 005e 282B or r18,r24
221 0060 392B or r19,r25
222 0062 4A2B or r20,r26
223 0064 5B2B or r21,r27
224 0066 8281 ldd r24,Z+2
225 0068 90E0 ldi r25,lo8(0)
226 006a A0E0 ldi r26,lo8(0)
227 006c B0E0 ldi r27,hi8(0)
228 006e BA2F mov r27,r26
229 0070 A92F mov r26,r25
230 0072 982F mov r25,r24
231 0074 8827 clr r24
232 0076 282B or r18,r24
233 0078 392B or r19,r25
234 007a 4A2B or r20,r26
235 007c 5B2B or r21,r27
95:net/mynic.c **** = NIC_MAC0;
96:net/mynic.c **** buffer[1] = NIC_MAC1;
97:net/mynic.c **** buffer[2] = NIC_MAC2;
236 18
237 movw r24,r20
238 007e B901 /* epilogue start */
239 0080 CA01 ret
241 0082 0895 .Lscope3:
245 .global nic_ip_to_buffer
247 nic_ip_to_buffer:
249 .LM14:
98:net/mynic.c **** = NIC_MAC1;
99:net/mynic.c **** buffer[2] = NIC_MAC2;
250 logue: function */
251 /* frame size = 0 */
252 movw r30,r24
254 .LM15:
255 0084 FC01 mov r24,r23
100:net/mynic.c **** = NIC_MAC1;
256 25
257 clr r26
258 0086 872F clr r27
259 0088 9927 st Z,r24
261 008c BB27 .LM16:
262 008e 8083 movw r24,r22
101:net/mynic.c **** = NIC_MAC0;
263 6
264 clr r27
265 0090 CB01 std Z+1,r24
267 0094 BB27 .LM17:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -