udp.txt
7.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
; generated by Component: ARM Compiler 5.06 update 6 (build 750) Tool: ArmCC [4d3637]
; commandline ArmCC [--c99 --list --split_sections --debug -c --asm --interleave -o.\flash\obj\udp.o --asm_dir=.\Flash\List\ --list_dir=.\Flash\List\ --depend=.\flash\obj\udp.d --cpu=Cortex-M4.fp --apcs=interwork -O1 --diag_suppress=9931,870 -I..\..\Libraries\CMSIS\Include -I..\..\Libraries\CMSIS\Device\ST\STM32F4xx\Include -I..\..\Libraries\STM32F4xx_StdPeriph_Driver\inc -I..\..\uCOS-III\uC-CPU -I..\..\uCOS-III\uC-LIB -I..\..\uCOS-III\uCOS-III\Ports -I..\..\uCOS-III\uCOS-III\Source -I..\..\uCOS-III\uC-CPU\ARM-Cortex-M4\RealView -I..\..\uCOS-III\uC-LIB\Ports\ARM-Cortex-M4\RealView -I..\..\uCOS-III\uCOS-III\Ports\ARM-Cortex-M4\Generic\RealView -I..\..\User -I..\..\User\bsp -I..\..\User\bsp\inc -I..\..\User\libapp -I..\..\RL-ARM\Config -I..\..\RL-ARM\Driver -I..\..\RL-ARM\RL-RTX\inc -I..\..\User\bsp\BSP -I..\..\RL-ARM\RL-CAN -I..\..\Libraries\DSP_LIB\Include -I..\..\MODBUS\modbus\rtu -I..\..\MODBUS\BARE\port -I..\..\MODBUS\modbus\include -I..\..\User\bsp\BSP -I..\..\PLC -I..\..\Avoid -I..\..\User\parameter -I..\..\User\LaserMotionCtr -I..\..\User\W5100S -I..\..\User\bsp -I..\..\User\CHASSIS -I..\..\User\CONTROLFUNCTION -I..\..\User\DATAUPDATE -I..\..\User\HARAWARE -I..\..\User\MOTORDRIVER -I..\..\User\NAVAGATION -I..\..\User\PLATFORM -I..\..\User\SENSOR -I.\RTE\_Flash -IC:\Users\YDJ\AppData\Local\Arm\Packs\ARM\CMSIS\5.5.1\CMSIS\Core\Include -IC:\Users\YDJ\AppData\Local\Arm\Packs\Keil\STM32F4xx_DFP\2.13.0\Drivers\CMSIS\Device\ST\STM32F4xx\Include -D__UVISION_VERSION=527 -D_RTE_ -DSTM32F407xx -DUSE_STDPERIPH_DRIVER -DSTM32F40_41xxx -D__RTX -D__FPU_USED=1 --omf_browse=.\flash\obj\udp.crf ..\..\User\W5100S\udp.c]
THUMB
AREA ||i.do_udp||, CODE, READONLY, ALIGN=2
REQUIRE _printf_percent
REQUIRE _printf_d
REQUIRE _printf_int_dec
REQUIRE _printf_s
REQUIRE _printf_str
do_udp PROC
;;;23
;;;24 void do_udp(void)
000000 b538 PUSH {r3-r5,lr}
;;;25 {
;;;26 switch(getSn_SR(SOCK_UDPS)) // 获取socket的状态
000002 f2406003 MOV r0,#0x603
000006 f7fffffe BL WIZCHIP_READ
00000a b370 CBZ r0,|L1.106|
00000c 2822 CMP r0,#0x22
00000e d12b BNE |L1.104|
;;;27 {
;;;28 case SOCK_CLOSED: // socket处于关闭状态
;;;29 socket(SOCK_UDPS,Sn_MR_UDP,local_port,0); // 初始化socket
;;;30 break;
;;;31 case SOCK_UDP: // socket初始化完成
;;;32 if(getSn_IR(SOCK_UDPS) & Sn_IR_RECV)
000010 f2406402 MOV r4,#0x602
000014 4620 MOV r0,r4
000016 f7fffffe BL WIZCHIP_READ
00001a 0740 LSLS r0,r0,#29
00001c d503 BPL |L1.38|
;;;33 {
;;;34 setSn_IR(SOCK_UDPS, Sn_IR_RECV); // 清接收中断
00001e 2104 MOVS r1,#4
000020 4620 MOV r0,r4
000022 f7fffffe BL WIZCHIP_WRITE
|L1.38|
;;;35 }
;;;36 if((len=getSn_RX_RSR(SOCK_UDPS))>0) // 接收到数据
000026 2002 MOVS r0,#2
000028 f7fffffe BL getSn_RX_RSR
00002c 4c14 LDR r4,|L1.128|
00002e 2800 CMP r0,#0
000030 8020 STRH r0,[r4,#0]
000032 d019 BEQ |L1.104|
;;;37 {
;;;38 printf("len = %d\r\n",len);
000034 4601 MOV r1,r0
000036 a013 ADR r0,|L1.132|
000038 f7fffffe BL __2printf
;;;39 recvfrom(SOCK_UDPS,UdpBuff, len, remote_ip,&remote_port); // W5500接收计算机发送来的数据
00003c 4d14 LDR r5,|L1.144|
00003e 9500 STR r5,[sp,#0]
000040 4b14 LDR r3,|L1.148|
000042 8822 LDRH r2,[r4,#0] ; len
000044 4914 LDR r1,|L1.152|
000046 2002 MOVS r0,#2
000048 f7fffffe BL recvfrom
;;;40 printf("%s\r\n",UdpBuff); // 打印接收缓存
00004c 4912 LDR r1,|L1.152|
00004e a013 ADR r0,|L1.156|
000050 f7fffffe BL __2printf
;;;41 sendto(SOCK_UDPS,UdpBuff,len-8, remote_ip, remote_port); // W5500把接收到的数据发送给Remote
000054 8828 LDRH r0,[r5,#0] ; remote_port
000056 9000 STR r0,[sp,#0]
000058 8820 LDRH r0,[r4,#0] ; len
00005a 4b0e LDR r3,|L1.148|
00005c 3808 SUBS r0,r0,#8
00005e b282 UXTH r2,r0
000060 490d LDR r1,|L1.152|
000062 2002 MOVS r0,#2
000064 f7fffffe BL sendto
|L1.104|
;;;42 }
;;;43 break;
;;;44 }
;;;45 }
000068 bd38 POP {r3-r5,pc}
|L1.106|
00006a e7ff B |L1.108|
|L1.108|
00006c 480d LDR r0,|L1.164|
00006e 2300 MOVS r3,#0 ;29
000070 2102 MOVS r1,#2 ;29
000072 8802 LDRH r2,[r0,#0] ;29 ; local_port
000074 b001 ADD sp,sp,#4 ;29
000076 4608 MOV r0,r1 ;29
000078 e8bd4030 POP {r4,r5,lr} ;29
00007c f7ffbffe B.W socket
ENDP
|L1.128|
DCD ||.data||
|L1.132|
000084 6c656e20 DCB "len = %d\r\n",0
000088 3d202564
00008c 0d0a00
00008f 00 DCB 0
|L1.144|
DCD remote_port
|L1.148|
DCD remote_ip
|L1.152|
DCD ||.bss||
|L1.156|
00009c 25730d0a DCB "%s\r\n",0
0000a0 00
0000a1 00 DCB 0
0000a2 00 DCB 0
0000a3 00 DCB 0
|L1.164|
DCD local_port
AREA ||.bss||, DATA, NOINIT, ALIGN=0
UdpBuff
% 2048
AREA ||.data||, DATA, ALIGN=1
len
000000 0000 DCW 0x0000
;*** Start embedded assembler ***
#line 1 "..\\..\\User\\W5100S\\udp.c"
AREA ||.rev16_text||, CODE
THUMB
EXPORT |__asm___5_udp_c_UdpBuff____REV16|
#line 129 "..\\..\\Libraries\\CMSIS\\Include\\core_cmInstr.h"
|__asm___5_udp_c_UdpBuff____REV16| PROC
#line 130
rev16 r0, r0
bx lr
ENDP
AREA ||.revsh_text||, CODE
THUMB
EXPORT |__asm___5_udp_c_UdpBuff____REVSH|
#line 144
|__asm___5_udp_c_UdpBuff____REVSH| PROC
#line 145
revsh r0, r0
bx lr
ENDP
AREA ||.rrx_text||, CODE
THUMB
EXPORT |__asm___5_udp_c_UdpBuff____RRX|
#line 300
|__asm___5_udp_c_UdpBuff____RRX| PROC
#line 301
rrx r0, r0
bx lr
ENDP
;*** End embedded assembler ***