utility.txt
31.4 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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
; 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\utility.o --asm_dir=.\Flash\List\ --list_dir=.\Flash\List\ --depend=.\flash\obj\utility.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\utility.crf ..\..\User\W5100S\utility.c]
THUMB
AREA ||i.atoi16||, CODE, READONLY, ALIGN=1
atoi16 PROC
;;;99 */
;;;100 uint16 atoi16(char* str,uint16 base)
000000 b510 PUSH {r4,lr}
;;;101 {
000002 4602 MOV r2,r0
000004 460c MOV r4,r1
;;;102 unsigned int num = 0;
000006 2300 MOVS r3,#0
000008 e004 B |L1.20|
|L1.10|
;;;103 while (*str !=0)
;;;104 num = num * base + c2d(*str++);
00000a 1c52 ADDS r2,r2,#1
00000c f7fffffe BL ||c2d||
000010 fb030304 MLA r3,r3,r4,r0
|L1.20|
000014 7810 LDRB r0,[r2,#0] ;103
000016 2800 CMP r0,#0 ;103
000018 d1f7 BNE |L1.10|
;;;105 return num;
00001a b298 UXTH r0,r3
;;;106 }
00001c bd10 POP {r4,pc}
;;;107
ENDP
AREA ||i.atoi32||, CODE, READONLY, ALIGN=1
atoi32 PROC
;;;112 */
;;;113 uint32 atoi32(char* str,uint16 base )
000000 b510 PUSH {r4,lr}
;;;114 {
000002 4602 MOV r2,r0
000004 460c MOV r4,r1
;;;115 uint32 num = 0;
000006 2300 MOVS r3,#0
000008 e004 B |L2.20|
|L2.10|
;;;116 while (*str !=0)
;;;117 num = num * base + c2d(*str++);
00000a 1c52 ADDS r2,r2,#1
00000c f7fffffe BL ||c2d||
000010 fb030304 MLA r3,r3,r4,r0
|L2.20|
000014 7810 LDRB r0,[r2,#0] ;116
000016 2800 CMP r0,#0 ;116
000018 d1f7 BNE |L2.10|
;;;118 return num;
00001a 4618 MOV r0,r3
;;;119 }
00001c bd10 POP {r4,pc}
;;;120
ENDP
AREA ||i.c2d||, CODE, READONLY, ALIGN=1
||c2d|| PROC
;;;178 */
;;;179 char c2d(uint8 c )
000000 f1a00130 SUB r1,r0,#0x30
;;;180 {
;;;181 if (c >= '0' && c <= '9')
000004 2909 CMP r1,#9
000006 d801 BHI |L3.12|
;;;182 return c - '0';
000008 b2c8 UXTB r0,r1
;;;183 if (c >= 'a' && c <= 'f')
;;;184 return 10 + c -'a';
;;;185 if (c >= 'A' && c <= 'F')
;;;186 return 10 + c -'A';
;;;187 return (char)c;
;;;188 }
00000a 4770 BX lr
|L3.12|
00000c f1a00161 SUB r1,r0,#0x61 ;183
000010 2905 CMP r1,#5 ;183
000012 d802 BHI |L3.26|
000014 3857 SUBS r0,r0,#0x57 ;184
000016 b2c0 UXTB r0,r0 ;184
|L3.24|
000018 4770 BX lr
|L3.26|
00001a f1a00141 SUB r1,r0,#0x41 ;185
00001e 2905 CMP r1,#5 ;185
000020 d8fa BHI |L3.24|
000022 3837 SUBS r0,r0,#0x37 ;186
000024 b2c0 UXTB r0,r0 ;186
000026 4770 BX lr
;;;189
ENDP
AREA ||i.checksum||, CODE, READONLY, ALIGN=1
checksum PROC
;;;388 */
;;;389 unsigned short checksum(unsigned char * src,unsigned int len)
000000 b5f0 PUSH {r4-r7,lr}
;;;390 {
;;;391 u_int sum, tsum, i, j;
;;;392 u_long lsum;
;;;393
;;;394 j = len >> 1;
000002 f3c1054f UBFX r5,r1,#1,#16
;;;395
;;;396 lsum = 0;
000006 2300 MOVS r3,#0
;;;397
;;;398 for (i = 0; i < j; i++)
000008 2200 MOVS r2,#0
;;;399 {
;;;400 tsum = src[i * 2];
;;;401 tsum = tsum << 8;
00000a f64f76ff MOV r6,#0xffff
00000e e00b B |L4.40|
|L4.16|
000010 f8104012 LDRB r4,[r0,r2,LSL #1] ;400
000014 ea062404 AND r4,r6,r4,LSL #8
;;;402 tsum += src[i * 2 + 1];
000018 eb000742 ADD r7,r0,r2,LSL #1
00001c 787f LDRB r7,[r7,#1]
00001e 443c ADD r4,r4,r7
000020 b2a4 UXTH r4,r4
;;;403 lsum += tsum;
000022 4423 ADD r3,r3,r4
000024 1c52 ADDS r2,r2,#1 ;398
000026 b292 UXTH r2,r2 ;398
|L4.40|
000028 42aa CMP r2,r5 ;398
00002a d3f1 BCC |L4.16|
;;;404 }
;;;405
;;;406 if (len % 2)
00002c 07c9 LSLS r1,r1,#31
00002e d003 BEQ |L4.56|
;;;407 {
;;;408 tsum = src[i * 2];
000030 f8100012 LDRB r0,[r0,r2,LSL #1]
;;;409 lsum += (tsum << 8);
000034 eb032300 ADD r3,r3,r0,LSL #8
|L4.56|
;;;410 }
;;;411
;;;412 sum = lsum;
;;;413 sum = ~(sum + (lsum >> 16));
000038 eb034013 ADD r0,r3,r3,LSR #16
00003c 43c0 MVNS r0,r0
00003e b280 UXTH r0,r0
;;;414 return (u_short) sum;
;;;415 }
000040 bdf0 POP {r4-r7,pc}
ENDP
AREA ||i.delay_ms1||, CODE, READONLY, ALIGN=2
delay_ms1 PROC
;;;59 */
;;;60 void delay_ms1( uint32 time_ms )
000000 4908 LDR r1,|L5.36|
;;;61 {
;;;62 u32 temp;
;;;63 SysTick->LOAD=(u32)time_ms*fac_ms; /*时间加载(SysTick->LOAD为24bit)*/
000002 8849 LDRH r1,[r1,#2] ; fac_ms
000004 4348 MULS r0,r1,r0
000006 f04f21e0 MOV r1,#0xe000e000
00000a 6148 STR r0,[r1,#0x14]
;;;64 SysTick->VAL =0x00; /*清空计数器*/
00000c 2300 MOVS r3,#0
00000e 618b STR r3,[r1,#0x18]
;;;65 SysTick->CTRL=0x01 ; /*开始倒数*/
000010 2001 MOVS r0,#1
000012 6108 STR r0,[r1,#0x10]
|L5.20|
;;;66 do
;;;67 {
;;;68 temp=SysTick->CTRL;
000014 6908 LDR r0,[r1,#0x10]
;;;69 }
;;;70 while(temp&0x01&&!(temp&(1<<16))); /*等待时间到达*/
000016 07c2 LSLS r2,r0,#31
000018 d001 BEQ |L5.30|
00001a 03c0 LSLS r0,r0,#15
00001c d5fa BPL |L5.20|
|L5.30|
;;;71 SysTick->CTRL=0x00; /*关闭计数器*/
00001e 610b STR r3,[r1,#0x10]
;;;72 SysTick->VAL =0X00; /*清空计数器*/
000020 618b STR r3,[r1,#0x18]
;;;73 }
000022 4770 BX lr
;;;74
ENDP
|L5.36|
DCD ||.data||
AREA ||i.delay_s||, CODE, READONLY, ALIGN=1
delay_s PROC
;;;47 extern void delay_ms(u16 nms);
;;;48 void delay_s( uint32 time_s )
000000 b570 PUSH {r4-r6,lr}
;;;49 {
000002 4604 MOV r4,r0
;;;50 for(;time_s>0;time_s--)
000004 2c00 CMP r4,#0
000006 d007 BEQ |L6.24|
;;;51 bsp_DelayMS(1000);
000008 f44f757a MOV r5,#0x3e8
|L6.12|
00000c 4628 MOV r0,r5
00000e f7fffffe BL bsp_DelayMS
000012 1e64 SUBS r4,r4,#1 ;50
000014 2c00 CMP r4,#0 ;50
000016 d1f9 BNE |L6.12|
|L6.24|
;;;52 // Delay(100);
;;;53 }
000018 bd70 POP {r4-r6,pc}
;;;54
ENDP
AREA ||i.delay_us1||, CODE, READONLY, ALIGN=2
delay_us1 PROC
;;;79 */
;;;80 void delay_us1( uint32 time_us )
000000 4908 LDR r1,|L7.36|
;;;81 {
;;;82 u32 temp;
;;;83 SysTick->LOAD=time_us*fac_us; /*时间加载*/
000002 7809 LDRB r1,[r1,#0] ; fac_us
000004 4348 MULS r0,r1,r0
000006 f04f21e0 MOV r1,#0xe000e000
00000a 6148 STR r0,[r1,#0x14]
;;;84 SysTick->VAL=0x00; /*清空计数器*/
00000c 2300 MOVS r3,#0
00000e 618b STR r3,[r1,#0x18]
;;;85 SysTick->CTRL=0x01 ; /*开始倒数 */
000010 2001 MOVS r0,#1
000012 6108 STR r0,[r1,#0x10]
|L7.20|
;;;86 do
;;;87 {
;;;88 temp=SysTick->CTRL;
000014 6908 LDR r0,[r1,#0x10]
;;;89 }
;;;90 while(temp&0x01&&!(temp&(1<<16))); /*等待时间到达*/
000016 07c2 LSLS r2,r0,#31
000018 d001 BEQ |L7.30|
00001a 03c0 LSLS r0,r0,#15
00001c d5fa BPL |L7.20|
|L7.30|
;;;91 SysTick->CTRL=0x00; /*关闭计数器*/
00001e 610b STR r3,[r1,#0x10]
;;;92 SysTick->VAL =0X00; /*清空计数器*/
000020 618b STR r3,[r1,#0x18]
;;;93 }
000022 4770 BX lr
;;;94
ENDP
|L7.36|
DCD ||.data||
AREA ||i.htonl||, CODE, READONLY, ALIGN=1
htonl PROC
;;;344 */
;;;345 unsigned long htonl(unsigned long hostlong)
000000 f7ffbffe B.W swapl
;;;346 {
;;;347 /**< hostshort - A 32-bit number in host byte order. */
;;;348 #if ( SYSTEM_ENDIAN == _ENDIAN_LITTLE_ )
;;;349 return swapl(hostlong);
;;;350 #else
;;;351 return hostlong;
;;;352 #endif
;;;353 }
;;;354
ENDP
AREA ||i.htons||, CODE, READONLY, ALIGN=1
htons PROC
;;;329 */
;;;330 uint16 htons( uint16 hostshort)
000000 f7ffbffe B.W swaps
;;;331 {
;;;332 /**< A 16-bit number in host byte order. */
;;;333 #if ( SYSTEM_ENDIAN == _ENDIAN_LITTLE_ )
;;;334 return swaps(hostshort);
;;;335 #else
;;;336 return hostshort;
;;;337 #endif
;;;338 }
;;;339
ENDP
AREA ||i.inet_addr_||, CODE, READONLY, ALIGN=2
inet_addr_ PROC
;;;240 */
;;;241 void inet_addr_(unsigned char* addr,unsigned char *ip)
000000 b530 PUSH {r4,r5,lr}
;;;242 {
000002 b089 SUB sp,sp,#0x24
000004 460d MOV r5,r1
;;;243 int i;
;;;244 char taddr[30];
;;;245 char * nexttok;
;;;246 char num;
;;;247 strcpy(taddr,(char *)addr);
000006 4601 MOV r1,r0
000008 a801 ADD r0,sp,#4
00000a f7fffffe BL strcpy
;;;248
;;;249 nexttok = taddr;
00000e a801 ADD r0,sp,#4
;;;250 for(i = 0; i < 4 ; i++)
000010 2400 MOVS r4,#0
|L10.18|
;;;251 {
;;;252 nexttok = strtok(nexttok,".");
000012 a10d ADR r1,|L10.72|
000014 f7fffffe BL strtok
;;;253 if(nexttok[0] == '0' && nexttok[1] == 'x')
000018 7801 LDRB r1,[r0,#0]
00001a 2930 CMP r1,#0x30
00001c d102 BNE |L10.36|
00001e 7841 LDRB r1,[r0,#1]
000020 2978 CMP r1,#0x78
000022 d00a BEQ |L10.58|
|L10.36|
;;;254 num = atoi16(nexttok+2,0x10);
;;;255 else
;;;256 num = atoi16(nexttok,10);
000024 210a MOVS r1,#0xa
000026 f7fffffe BL atoi16
00002a b2c0 UXTB r0,r0
|L10.44|
;;;257
;;;258 ip[i] = num;
00002c 5528 STRB r0,[r5,r4]
;;;259 nexttok = NULL;
00002e 2000 MOVS r0,#0
000030 1c64 ADDS r4,r4,#1 ;250
000032 2c04 CMP r4,#4 ;250
000034 dbed BLT |L10.18|
;;;260 }
;;;261 }
000036 b009 ADD sp,sp,#0x24
000038 bd30 POP {r4,r5,pc}
|L10.58|
00003a 2110 MOVS r1,#0x10 ;254
00003c 1c80 ADDS r0,r0,#2 ;254
00003e f7fffffe BL atoi16
000042 b2c0 UXTB r0,r0 ;254
000044 e7f2 B |L10.44|
;;;262
ENDP
000046 0000 DCW 0x0000
|L10.72|
000048 2e00 DCB ".",0
00004a 00 DCB 0
00004b 00 DCB 0
AREA ||i.inet_ntoa||, CODE, READONLY, ALIGN=2
REQUIRE _printf_percent
REQUIRE _printf_d
REQUIRE _printf_int_dec
inet_ntoa PROC
;;;267 */
;;;268 char* inet_ntoa(unsigned long addr)
000000 b51c PUSH {r2-r4,lr}
;;;269 {
000002 4604 MOV r4,r0
;;;270 static char addr_str[32];
;;;271 memset(addr_str,0,32);
000004 2120 MOVS r1,#0x20
000006 4808 LDR r0,|L11.40|
000008 f7fffffe BL __aeabi_memclr
;;;272 sprintf(addr_str,"%d.%d.%d.%d",(int)(addr>>24 & 0xFF),(int)(addr>>16 & 0xFF),(int)(addr>>8 & 0xFF),(int)(addr & 0xFF));
00000c b2e0 UXTB r0,r4
00000e f3c42107 UBFX r1,r4,#8,#8
000012 e9cd1000 STRD r1,r0,[sp,#0]
000016 0e22 LSRS r2,r4,#24
000018 f3c44307 UBFX r3,r4,#16,#8
00001c a103 ADR r1,|L11.44|
00001e 4802 LDR r0,|L11.40|
000020 f7fffffe BL __2sprintf
;;;273 return addr_str;
000024 4800 LDR r0,|L11.40|
;;;274 }
000026 bd1c POP {r2-r4,pc}
;;;275
ENDP
|L11.40|
DCD ||.bss||
|L11.44|
00002c 25642e25 DCB "%d.%d.%d.%d",0
000030 642e2564
000034 2e256400
AREA ||i.inet_ntoa_pad||, CODE, READONLY, ALIGN=2
inet_ntoa_pad PROC
;;;280 */
;;;281 char* inet_ntoa_pad(unsigned long addr)
000000 b51c PUSH {r2-r4,lr}
;;;282 {
000002 4604 MOV r4,r0
;;;283 static char addr_str[16];
;;;284 memset(addr_str,0,16);
000004 2110 MOVS r1,#0x10
000006 4808 LDR r0,|L12.40|
000008 f7fffffe BL __aeabi_memclr
;;;285 printf(addr_str,"%03d.%03d.%03d.%03d",(int)(addr>>24 & 0xFF),(int)(addr>>16 & 0xFF),(int)(addr>>8 & 0xFF),(int)(addr & 0xFF));
00000c b2e0 UXTB r0,r4
00000e f3c42107 UBFX r1,r4,#8,#8
000012 e9cd1000 STRD r1,r0,[sp,#0]
000016 0e22 LSRS r2,r4,#24
000018 f3c44307 UBFX r3,r4,#16,#8
00001c a103 ADR r1,|L12.44|
00001e 4802 LDR r0,|L12.40|
000020 f7fffffe BL printf
;;;286 return addr_str;
000024 4800 LDR r0,|L12.40|
;;;287 }
000026 bd1c POP {r2-r4,pc}
;;;288
ENDP
|L12.40|
DCD ||.bss||+0x20
|L12.44|
00002c 25303364 DCB "%03d.%03d.%03d.%03d",0
000030 2e253033
000034 642e2530
000038 33642e25
00003c 30336400
AREA ||i.itoa||, CODE, READONLY, ALIGN=1
itoa PROC
;;;125 */
;;;126 void itoa(uint16 n,uint8 str[5], uint8 len)
000000 b570 PUSH {r4-r6,lr}
;;;127 {
000002 460e MOV r6,r1
000004 4605 MOV r5,r0
000006 4611 MOV r1,r2
;;;128 uint8 i=len-1;
000008 1e48 SUBS r0,r1,#1
00000a b2c4 UXTB r4,r0
;;;129
;;;130 memset(str,0x20,len);
00000c 2220 MOVS r2,#0x20
00000e 4630 MOV r0,r6
000010 f7fffffe BL __aeabi_memset
;;;131 do{
;;;132 str[i--]=n%10+'0';
000014 200a MOVS r0,#0xa
|L13.22|
000016 fbb5f1f0 UDIV r1,r5,r0
00001a fb005111 MLS r1,r0,r1,r5
00001e 3130 ADDS r1,r1,#0x30
000020 4622 MOV r2,r4
000022 1e64 SUBS r4,r4,#1
000024 b2e4 UXTB r4,r4
000026 54b1 STRB r1,[r6,r2]
;;;133
;;;134 }while((n/=10)>0);
000028 fbb5f5f0 UDIV r5,r5,r0
00002c 2d00 CMP r5,#0
00002e d1f2 BNE |L13.22|
;;;135
;;;136 return;
;;;137 }
000030 bd70 POP {r4-r6,pc}
;;;138
ENDP
AREA ||i.mid||, CODE, READONLY, ALIGN=1
mid PROC
;;;221 */
;;;222 void mid(int8* src, int8* s1, int8* s2, int8* sub)
000000 e92d41f0 PUSH {r4-r8,lr}
;;;223 {
000004 460f MOV r7,r1
000006 4615 MOV r5,r2
000008 461e MOV r6,r3
;;;224 int8* sub1;
;;;225 int8* sub2;
;;;226 uint16 n;
;;;227
;;;228 sub1=strstr(src,s1);
00000a 4639 MOV r1,r7
00000c f7fffffe BL strstr
000010 4604 MOV r4,r0
;;;229 sub1+=strlen(s1);
000012 4638 MOV r0,r7
000014 f7fffffe BL strlen
000018 4404 ADD r4,r4,r0
;;;230 sub2=strstr(sub1,s2);
00001a 4629 MOV r1,r5
00001c 4620 MOV r0,r4
00001e f7fffffe BL strstr
;;;231 n=sub2-sub1;
000022 1b00 SUBS r0,r0,r4
000024 b285 UXTH r5,r0
;;;232 strncpy(sub,sub1,n);
000026 462a MOV r2,r5
000028 4621 MOV r1,r4
00002a 4630 MOV r0,r6
00002c f7fffffe BL strncpy
;;;233 sub[n]=0;
000030 2000 MOVS r0,#0
000032 5570 STRB r0,[r6,r5]
;;;234 }
000034 e8bd81f0 POP {r4-r8,pc}
;;;235
ENDP
AREA ||i.ntohl||, CODE, READONLY, ALIGN=1
ntohl PROC
;;;374 */
;;;375 unsigned long ntohl(unsigned long netlong)
000000 f7ffbffe B.W htonl
;;;376 {
;;;377 #if ( SYSTEM_ENDIAN == _ENDIAN_LITTLE_ )
;;;378 return htonl(netlong);
;;;379 #else
;;;380 return netlong;
;;;381 #endif
;;;382 }
;;;383
ENDP
AREA ||i.ntohs||, CODE, READONLY, ALIGN=1
ntohs PROC
;;;359 */
;;;360 unsigned long ntohs(unsigned short netshort)
000000 f7ffbffe B.W htons
;;;361 {
;;;362 /**< netshort - network odering 16bit value */
;;;363 #if ( SYSTEM_ENDIAN == _ENDIAN_LITTLE_ )
;;;364 return htons(netshort);
;;;365 #else
;;;366 return netshort;
;;;367 #endif
;;;368 }
;;;369
ENDP
AREA ||i.replacetochar||, CODE, READONLY, ALIGN=1
replacetochar PROC
;;;165 */
;;;166 void replacetochar(char * str, char oldchar,char newchar )
000000 b510 PUSH {r4,lr}
;;;167 {
;;;168 int x;
;;;169 for (x = 0; str[x]; x++)
000002 2300 MOVS r3,#0
000004 e003 B |L17.14|
|L17.6|
;;;170 if (str[x] == oldchar)
000006 428c CMP r4,r1
000008 d100 BNE |L17.12|
;;;171 str[x] = newchar;
00000a 54c2 STRB r2,[r0,r3]
|L17.12|
00000c 1c5b ADDS r3,r3,#1 ;169
|L17.14|
00000e 5cc4 LDRB r4,[r0,r3] ;169
000010 2c00 CMP r4,#0 ;169
000012 d1f8 BNE |L17.6|
;;;172 }
000014 bd10 POP {r4,pc}
;;;173
ENDP
AREA ||i.swapl||, CODE, READONLY, ALIGN=1
swapl PROC
;;;206 */
;;;207 uint32 swapl(uint32 l)
000000 0601 LSLS r1,r0,#24
;;;208 {
;;;209 uint32 ret=0;
;;;210 ret = (l & 0xFF) << 24;
;;;211 ret |= ((l >> 8) & 0xFF) << 16;
000002 f3c02207 UBFX r2,r0,#8,#8
000006 ea414102 ORR r1,r1,r2,LSL #16
;;;212 ret |= ((l >> 16) & 0xFF) << 8;
00000a f3c04207 UBFX r2,r0,#16,#8
00000e ea412102 ORR r1,r1,r2,LSL #8
;;;213 ret |= ((l >> 24) & 0xFF);
000012 ea416010 ORR r0,r1,r0,LSR #24
;;;214 return ret;
;;;215 }
000016 4770 BX lr
;;;216
ENDP
AREA ||i.swaps||, CODE, READONLY, ALIGN=1
swaps PROC
;;;194 */
;;;195 uint16 swaps(uint16 i)
000000 0601 LSLS r1,r0,#24
;;;196 {
;;;197 uint16 ret=0;
;;;198 ret = (i & 0xFF) << 8;
000002 0c09 LSRS r1,r1,#16
;;;199 ret |= ((i >> 8)& 0xFF);
000004 ea412010 ORR r0,r1,r0,LSR #8
;;;200 return ret;
;;;201 }
000008 4770 BX lr
;;;202 /**
ENDP
AREA ||i.systick_init||, CODE, READONLY, ALIGN=2
systick_init PROC
;;;33 */
;;;34 void systick_init (u8 sysclk)
000000 f04f21e0 MOV r1,#0xe000e000
;;;35 {
;;;36 SysTick->CTRL&=0xfffffffb; /*bit2清空,选择外部时钟 HCLK/8*/
000004 690a LDR r2,[r1,#0x10]
000006 f0220204 BIC r2,r2,#4
00000a 610a STR r2,[r1,#0x10]
;;;37 fac_us=sysclk/8;
00000c 4906 LDR r1,|L20.40|
00000e 08c0 LSRS r0,r0,#3
000010 7008 STRB r0,[r1,#0]
;;;38 fac_ms=(u16)fac_us*1000;
000012 eb000240 ADD r2,r0,r0,LSL #1
000016 ebc210c0 RSB r0,r2,r0,LSL #7
00001a f64f72ff MOV r2,#0xffff
00001e ea0200c0 AND r0,r2,r0,LSL #3
000022 8048 STRH r0,[r1,#2]
;;;39 }
000024 4770 BX lr
;;;40
ENDP
000026 0000 DCW 0x0000
|L20.40|
DCD ||.data||
AREA ||i.validatoi||, CODE, READONLY, ALIGN=1
validatoi PROC
;;;144 */
;;;145 int validatoi(char* str, int base,int* ret)
000000 b570 PUSH {r4-r6,lr}
;;;146 {
000002 4604 MOV r4,r0
000004 460e MOV r6,r1
000006 4615 MOV r5,r2
;;;147 int c;
;;;148 char* tstr = str;
;;;149 if(str == 0 || *str == '\0') return 0;
000008 0023 MOVS r3,r4
00000a d001 BEQ |L21.16|
00000c 7820 LDRB r0,[r4,#0]
00000e b940 CBNZ r0,|L21.34|
|L21.16|
000010 2000 MOVS r0,#0
;;;150 while(*tstr != '\0')
;;;151 {
;;;152 c = c2d(*tstr);
;;;153 if( c >= 0 && c < base) tstr++;
;;;154 else return 0;
;;;155 }
;;;156
;;;157 *ret = atoi16(str,base);
;;;158 return 1;
;;;159 }
000012 bd70 POP {r4-r6,pc}
|L21.20|
000014 f7fffffe BL ||c2d||
000018 2800 CMP r0,#0 ;153
00001a db0c BLT |L21.54|
00001c 42b0 CMP r0,r6 ;153
00001e da0a BGE |L21.54|
000020 1c5b ADDS r3,r3,#1 ;153
|L21.34|
000022 7818 LDRB r0,[r3,#0] ;150
000024 2800 CMP r0,#0 ;150
000026 d1f5 BNE |L21.20|
000028 b2b1 UXTH r1,r6 ;157
00002a 4620 MOV r0,r4 ;157
00002c f7fffffe BL atoi16
000030 6028 STR r0,[r5,#0] ;157
000032 2001 MOVS r0,#1 ;158
000034 bd70 POP {r4-r6,pc}
|L21.54|
000036 2000 MOVS r0,#0 ;154
000038 bd70 POP {r4-r6,pc}
;;;160
ENDP
AREA ||i.verify_ip_address||, CODE, READONLY, ALIGN=2
verify_ip_address PROC
;;;293 */
;;;294 char verify_ip_address(char* src, uint8 * ip)
000000 b570 PUSH {r4-r6,lr}
;;;295 {
000002 b08e SUB sp,sp,#0x38
000004 460e MOV r6,r1
;;;296 int i;
;;;297 int tnum;
;;;298 char tsrc[50];
;;;299 char* tok = tsrc;
000006 466d MOV r5,sp
;;;300
;;;301 strcpy(tsrc,src);
000008 4601 MOV r1,r0
00000a 4668 MOV r0,sp
00000c f7fffffe BL strcpy
;;;302
;;;303 for(i = 0; i < 4; i++)
000010 2400 MOVS r4,#0
|L22.18|
;;;304 {
;;;305 tok = strtok(tok,".");
000012 a116 ADR r1,|L22.108|
000014 4628 MOV r0,r5
000016 f7fffffe BL strtok
;;;306 if ( !tok )
00001a b118 CBZ r0,|L22.36|
;;;307 return 0;
;;;308 if(tok[0] == '0' && tok[1] == 'x')
00001c 7801 LDRB r1,[r0,#0]
00001e 2930 CMP r1,#0x30
000020 d003 BEQ |L22.42|
000022 e005 B |L22.48|
|L22.36|
000024 2000 MOVS r0,#0 ;307
|L22.38|
;;;309 {
;;;310 if(!validatoi(tok+2,0x10,&tnum))
;;;311 return 0;
;;;312 }
;;;313 else if(!validatoi(tok,10,&tnum))
;;;314 return 0;
;;;315
;;;316 ip[i] = tnum;
;;;317
;;;318 if(tnum < 0 || tnum > 255)
;;;319 return 0;
;;;320 tok = NULL;
;;;321 }
;;;322 return 1;
;;;323 }
000026 b00e ADD sp,sp,#0x38
000028 bd70 POP {r4-r6,pc}
|L22.42|
00002a 7841 LDRB r1,[r0,#1] ;308
00002c 2978 CMP r1,#0x78 ;308
00002e d005 BEQ |L22.60|
|L22.48|
000030 aa0d ADD r2,sp,#0x34 ;313
000032 210a MOVS r1,#0xa ;313
000034 f7fffffe BL validatoi
000038 b178 CBZ r0,|L22.90|
00003a e005 B |L22.72|
|L22.60|
00003c aa0d ADD r2,sp,#0x34 ;310
00003e 2110 MOVS r1,#0x10 ;310
000040 1c80 ADDS r0,r0,#2 ;310
000042 f7fffffe BL validatoi
000046 b130 CBZ r0,|L22.86|
|L22.72|
000048 980d LDR r0,[sp,#0x34] ;316
00004a 5530 STRB r0,[r6,r4] ;316
00004c 980d LDR r0,[sp,#0x34] ;318
00004e 28ff CMP r0,#0xff ;318
000050 d905 BLS |L22.94|
000052 2000 MOVS r0,#0 ;319
000054 e7e7 B |L22.38|
|L22.86|
000056 2000 MOVS r0,#0 ;311
000058 e7e5 B |L22.38|
|L22.90|
00005a 2000 MOVS r0,#0 ;314
00005c e7e3 B |L22.38|
|L22.94|
00005e 2500 MOVS r5,#0 ;320
000060 1c64 ADDS r4,r4,#1 ;303
000062 2c04 CMP r4,#4 ;303
000064 dbd5 BLT |L22.18|
000066 2001 MOVS r0,#1 ;322
000068 e7dd B |L22.38|
;;;324
ENDP
00006a 0000 DCW 0x0000
|L22.108|
00006c 2e00 DCB ".",0
00006e 00 DCB 0
00006f 00 DCB 0
AREA ||.bss||, DATA, NOINIT, ALIGN=0
addr_str
% 32
|symbol_number.57|
% 16
AREA ||.data||, DATA, ALIGN=1
fac_us
000000 0000 DCB 0x00,0x00
fac_ms
000002 0000 DCW 0x0000
;*** Start embedded assembler ***
#line 1 "..\\..\\User\\W5100S\\utility.c"
AREA ||.rev16_text||, CODE
THUMB
EXPORT |__asm___9_utility_c_57e5245c____REV16|
#line 129 "..\\..\\Libraries\\CMSIS\\Include\\core_cmInstr.h"
|__asm___9_utility_c_57e5245c____REV16| PROC
#line 130
rev16 r0, r0
bx lr
ENDP
AREA ||.revsh_text||, CODE
THUMB
EXPORT |__asm___9_utility_c_57e5245c____REVSH|
#line 144
|__asm___9_utility_c_57e5245c____REVSH| PROC
#line 145
revsh r0, r0
bx lr
ENDP
AREA ||.rrx_text||, CODE
THUMB
EXPORT |__asm___9_utility_c_57e5245c____RRX|
#line 300
|__asm___9_utility_c_57e5245c____RRX| PROC
#line 301
rrx r0, r0
bx lr
ENDP
;*** End embedded assembler ***