bsp_usart.txt
76.2 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
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
; 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\bsp_usart.o --asm_dir=.\Flash\List\ --list_dir=.\Flash\List\ --depend=.\flash\obj\bsp_usart.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\bsp_usart.crf ..\..\User\bsp\BSP\bsp_usart.c]
THUMB
AREA ||i.ProcessDataFormUartCard||, CODE, READONLY, ALIGN=1
ProcessDataFormUartCard PROC
;;;563 }
;;;564 void ProcessDataFormUartCard()
000000 b500 PUSH {lr}
;;;565 {
000002 b090 SUB sp,sp,#0x40
;;;566 unsigned char buff[64];
;;;567 unsigned int len;
;;;568 unsigned i;
;;;569 len = ReadUart(COM6,buff,12);
000004 220c MOVS r2,#0xc
000006 4669 MOV r1,sp
000008 2006 MOVS r0,#6
00000a f7fffffe BL ReadUart
;;;570
;;;571 if( len > 0)
00000e 2800 CMP r0,#0
000010 d004 BEQ |L1.28|
;;;572 {
;;;573 for(i = 0; i < len; i++)
000012 2100 MOVS r1,#0
000014 e000 B |L1.24|
|L1.22|
000016 1c49 ADDS r1,r1,#1
|L1.24|
000018 4281 CMP r1,r0
00001a d3fc BCC |L1.22|
|L1.28|
;;;574 {
;;;575
;;;576 }
;;;577 }
;;;578 }
00001c b010 ADD sp,sp,#0x40
00001e bd00 POP {pc}
;;;579
ENDP
AREA ||i.ProcessDataFormUartGoya||, CODE, READONLY, ALIGN=1
ProcessDataFormUartGoya PROC
;;;680
;;;681 void ProcessDataFormUartGoya()
000000 b570 PUSH {r4-r6,lr}
;;;682 {
000002 b0ad SUB sp,sp,#0xb4
;;;683 unsigned char buff[180];
;;;684 unsigned int len;
;;;685 unsigned i;
;;;686 len = ReadUart(COM3,buff,180);
000004 22b4 MOVS r2,#0xb4
000006 4669 MOV r1,sp
000008 2003 MOVS r0,#3
00000a f7fffffe BL ReadUart
00000e 4605 MOV r5,r0
;;;687 //WriteUart(COM1,buff,len);
;;;688 if( len > 0)
000010 0028 MOVS r0,r5
000012 d008 BEQ |L2.38|
;;;689 {
;;;690 for(i = 0; i < len; i++)
000014 2400 MOVS r4,#0
000016 466e MOV r6,sp ;683
000018 e003 B |L2.34|
|L2.26|
;;;691 {
;;;692 getdata(buff[i]);
00001a 5d30 LDRB r0,[r6,r4]
00001c f7fffffe BL getdata
000020 1c64 ADDS r4,r4,#1 ;690
|L2.34|
000022 42ac CMP r4,r5 ;690
000024 d3f9 BCC |L2.26|
|L2.38|
;;;693 }
;;;694 }
;;;695 }
000026 b02d ADD sp,sp,#0xb4
000028 bd70 POP {r4-r6,pc}
;;;696
ENDP
AREA ||i.ReadUart||, CODE, READONLY, ALIGN=2
ReadUart PROC
;;;434 */
;;;435 unsigned int ReadUart(unsigned char UartID,unsigned char *buff,unsigned int length)
000000 b570 PUSH {r4-r6,lr}
;;;436 {
000002 4603 MOV r3,r0
;;;437 unsigned int i = 0;
000004 2400 MOVS r4,#0
;;;438 unsigned int count = 0;
000006 2000 MOVS r0,#0
;;;439 UartStruct *pUartStu;
;;;440
;;;441 if(UartID == COM1)
000008 2b01 CMP r3,#1
00000a d006 BEQ |L3.26|
;;;442 pUartStu = &Uart1Stu;
;;;443 else if(UartID == COM2)
00000c 2b02 CMP r3,#2
00000e d006 BEQ |L3.30|
;;;444 pUartStu = &Uart2Stu;
;;;445 else if(UartID == COM3)
000010 2b03 CMP r3,#3
000012 d006 BEQ |L3.34|
;;;446 pUartStu = &Uart3Stu;
;;;447 else if(UartID == COM6)
000014 2b06 CMP r3,#6
000016 d006 BEQ |L3.38|
|L3.24|
;;;448 pUartStu = &Uart6Stu;
;;;449 else
;;;450 return 0;
;;;451
;;;452 for(i = 0; i < length; i++)
;;;453 {
;;;454 if(pUartStu->RxBuf_In == pUartStu->RxBuf_Out)
;;;455 break;
;;;456 count += 1;
;;;457 buff[i] = pUartStu->RxBuf[(pUartStu->RxBuf_Out)];
;;;458 pUartStu->RxBuf_Out = (pUartStu->RxBuf_Out + 1) & UART_BUF_LEN;
;;;459 }
;;;460 return count;
;;;461 }
000018 bd70 POP {r4-r6,pc}
|L3.26|
00001a 4b0f LDR r3,|L3.88|
00001c e018 B |L3.80|
|L3.30|
00001e 4b0f LDR r3,|L3.92|
000020 e016 B |L3.80|
|L3.34|
000022 4b0f LDR r3,|L3.96|
000024 e014 B |L3.80|
|L3.38|
000026 4b0f LDR r3,|L3.100|
000028 e012 B |L3.80|
|L3.42|
00002a f8b35800 LDRH r5,[r3,#0x800] ;454
00002e f8b36802 LDRH r6,[r3,#0x802] ;454
000032 42b5 CMP r5,r6 ;454
000034 d0f0 BEQ |L3.24|
000036 1c40 ADDS r0,r0,#1 ;456
000038 f8b35802 LDRH r5,[r3,#0x802] ;457
00003c 5d5d LDRB r5,[r3,r5] ;457
00003e 550d STRB r5,[r1,r4] ;457
000040 f8b35802 LDRH r5,[r3,#0x802] ;458
000044 1c6d ADDS r5,r5,#1 ;458
000046 f3c50509 UBFX r5,r5,#0,#10 ;458
00004a f8a35802 STRH r5,[r3,#0x802] ;458
00004e 1c64 ADDS r4,r4,#1 ;452
|L3.80|
000050 4294 CMP r4,r2 ;452
000052 d3ea BCC |L3.42|
000054 bd70 POP {r4-r6,pc}
;;;462
ENDP
000056 0000 DCW 0x0000
|L3.88|
DCD ||.bss||+0x46
|L3.92|
DCD ||.bss||+0x84e
|L3.96|
DCD ||.bss||+0x1056
|L3.100|
DCD ||.bss||+0x185e
AREA ||i.SetRS485ReadCOM||, CODE, READONLY, ALIGN=2
SetRS485ReadCOM PROC
;;;352
;;;353 void SetRS485ReadCOM()
000000 f44f7180 MOV r1,#0x100
;;;354 {
;;;355 GPIO_ResetBits(GPIOC,GPIO_Pin_8);
000004 4801 LDR r0,|L4.12|
000006 f7ffbffe B.W GPIO_ResetBits
;;;356 }
;;;357
ENDP
00000a 0000 DCW 0x0000
|L4.12|
DCD 0x40020800
AREA ||i.SetRS485WriteCOM||, CODE, READONLY, ALIGN=2
SetRS485WriteCOM PROC
;;;357
;;;358 void SetRS485WriteCOM()
000000 f44f7180 MOV r1,#0x100
;;;359 {
;;;360 GPIO_SetBits(GPIOC,GPIO_Pin_8);
000004 4801 LDR r0,|L5.12|
000006 f7ffbffe B.W GPIO_SetBits
;;;361 }
;;;362
ENDP
00000a 0000 DCW 0x0000
|L5.12|
DCD 0x40020800
AREA ||i.USART1_IRQHandler||, CODE, READONLY, ALIGN=2
USART1_IRQHandler PROC
;;;220 #if 1
;;;221 void USART1_IRQHandler(void)
000000 e92d41f0 PUSH {r4-r8,lr}
;;;222 {
;;;223 CPU_SR_ALLOC();
;;;224 unsigned int i;
;;;225 unsigned char ch;
;;;226 CPU_CRITICAL_ENTER();
000004 f7fffffe BL CPU_SR_Save
000008 4604 MOV r4,r0
;;;227 OSIntEnter();
00000a f7fffffe BL OSIntEnter
;;;228 CPU_CRITICAL_EXIT();
00000e 4620 MOV r0,r4
000010 f7fffffe BL CPU_SR_Restore
;;;229 /*接收中断*/
;;;230 if (USART_GetITStatus(USART1, USART_IT_RXNE) != RESET)
000014 4d36 LDR r5,|L6.240|
000016 f2405125 MOV r1,#0x525
00001a 4628 MOV r0,r5
00001c f7fffffe BL USART_GetITStatus
;;;231 {
;;;232 /* Read one byte from the receive data register */
;;;233 ch = USART_ReceiveData(USART1);
;;;234 if(((Uart1Stu.RxBuf_In + 1) & UART_BUF_LEN) == Uart1Stu.RxBuf_Out)
000020 4c34 LDR r4,|L6.244|
000022 b1b0 CBZ r0,|L6.82|
000024 4628 MOV r0,r5 ;233
000026 f7fffffe BL USART_ReceiveData
00002a b2c1 UXTB r1,r0 ;233
00002c f8b42800 LDRH r2,[r4,#0x800] ; Uart1Stu
000030 1c52 ADDS r2,r2,#1
000032 f3c20009 UBFX r0,r2,#0,#10
000036 f8b42802 LDRH r2,[r4,#0x802] ; Uart1Stu
00003a 4290 CMP r0,r2
00003c d009 BEQ |L6.82|
;;;235 {
;;;236
;;;237 }
;;;238 else
;;;239 {
;;;240 Uart1Stu.RxBuf[(Uart1Stu.RxBuf_In)] = ch;
00003e f8b40800 LDRH r0,[r4,#0x800] ; Uart1Stu
000042 5421 STRB r1,[r4,r0]
;;;241 Uart1Stu.RxBuf_In = (Uart1Stu.RxBuf_In + 1) & UART_BUF_LEN;
000044 f8b40800 LDRH r0,[r4,#0x800] ; Uart1Stu
000048 1c40 ADDS r0,r0,#1
00004a f3c00009 UBFX r0,r0,#0,#10
00004e f8a40800 STRH r0,[r4,#0x800]
|L6.82|
;;;242 }
;;;243 }
;;;244 /* 发送缓冲区空中断 */
;;;245 if (USART_GetITStatus(USART1, USART_IT_TXE) != RESET)
000052 f2407627 MOV r6,#0x727
000056 4631 MOV r1,r6
000058 4628 MOV r0,r5
00005a f7fffffe BL USART_GetITStatus
;;;246 {
;;;247 if(Uart1Stu.TxBuf_In != Uart1Stu.TxBuf_Out)
;;;248 {
;;;249 i = Uart1Stu.TxBuf_Out;
;;;250 Uart1Stu.TxBuf_Out = (Uart1Stu.TxBuf_Out + 1) & UART_BUF_LEN;
;;;251 ch = Uart1Stu.TxBuf[i];
;;;252 USART_SendData(USART1,ch);
;;;253 }
;;;254 else
;;;255 {
;;;256 /* 禁止发送缓冲区空中断,使能发送完毕中断 */
;;;257 USART_ITConfig(USART1, USART_IT_TXE, DISABLE);
;;;258 USART_ITConfig(USART1, USART_IT_TC, ENABLE);
00005e f2406726 MOV r7,#0x626
000062 b300 CBZ r0,|L6.166|
000064 f8b40804 LDRH r0,[r4,#0x804] ;247 ; Uart1Stu
000068 f8b41806 LDRH r1,[r4,#0x806] ;247 ; Uart1Stu
00006c 4288 CMP r0,r1 ;247
00006e d00f BEQ |L6.144|
000070 f8b41806 LDRH r1,[r4,#0x806] ;249 ; Uart1Stu
000074 f8b40806 LDRH r0,[r4,#0x806] ;250 ; Uart1Stu
000078 1c40 ADDS r0,r0,#1 ;250
00007a f3c00009 UBFX r0,r0,#0,#10 ;250
00007e f8a40806 STRH r0,[r4,#0x806] ;250
000082 1860 ADDS r0,r4,r1 ;251
000084 f8901400 LDRB r1,[r0,#0x400] ;251
000088 4628 MOV r0,r5 ;252
00008a f7fffffe BL USART_SendData
00008e e02a B |L6.230|
|L6.144|
000090 2200 MOVS r2,#0 ;257
000092 4631 MOV r1,r6 ;257
000094 4628 MOV r0,r5 ;257
000096 f7fffffe BL USART_ITConfig
00009a 2201 MOVS r2,#1
00009c 4639 MOV r1,r7
00009e 4628 MOV r0,r5
0000a0 f7fffffe BL USART_ITConfig
0000a4 e01f B |L6.230|
|L6.166|
;;;259 }
;;;260 }
;;;261 /* 1个字节发送完毕的中断 */
;;;262 else if (USART_GetITStatus(USART1, USART_IT_TC) != RESET)
0000a6 4639 MOV r1,r7
0000a8 4628 MOV r0,r5
0000aa f7fffffe BL USART_GetITStatus
0000ae b1d0 CBZ r0,|L6.230|
;;;263 {
;;;264 if(Uart1Stu.TxBuf_In != Uart1Stu.TxBuf_Out)
0000b0 f8b40804 LDRH r0,[r4,#0x804] ; Uart1Stu
0000b4 f8b41806 LDRH r1,[r4,#0x806] ; Uart1Stu
0000b8 4288 CMP r0,r1
0000ba d00f BEQ |L6.220|
;;;265 {
;;;266 i = Uart1Stu.TxBuf_Out;
0000bc f8b41806 LDRH r1,[r4,#0x806] ; Uart1Stu
;;;267 Uart1Stu.TxBuf_Out = (Uart1Stu.TxBuf_Out + 1) & UART_BUF_LEN;
0000c0 f8b40806 LDRH r0,[r4,#0x806] ; Uart1Stu
0000c4 1c40 ADDS r0,r0,#1
0000c6 f3c00009 UBFX r0,r0,#0,#10
0000ca f8a40806 STRH r0,[r4,#0x806]
;;;268 ch = Uart1Stu.TxBuf[i];
0000ce 1860 ADDS r0,r4,r1
0000d0 f8901400 LDRB r1,[r0,#0x400]
;;;269 USART_SendData(USART1,ch);
0000d4 4628 MOV r0,r5
0000d6 f7fffffe BL USART_SendData
0000da e004 B |L6.230|
|L6.220|
;;;270 }
;;;271 else
;;;272 {
;;;273 /* 禁止发送缓冲区空中断,使能发送完毕中断 */
;;;274 USART_ITConfig(USART1, USART_IT_TC, DISABLE);
0000dc 2200 MOVS r2,#0
0000de 4639 MOV r1,r7
0000e0 4628 MOV r0,r5
0000e2 f7fffffe BL USART_ITConfig
|L6.230|
;;;275 }
;;;276 }
;;;277 OSIntExit();
0000e6 e8bd41f0 POP {r4-r8,lr}
0000ea f7ffbffe B.W OSIntExit
;;;278 }
;;;279 #endif
ENDP
0000ee 0000 DCW 0x0000
|L6.240|
DCD 0x40011000
|L6.244|
DCD ||.bss||+0x46
AREA ||i.USART3_IRQHandler||, CODE, READONLY, ALIGN=2
USART3_IRQHandler PROC
;;;291
;;;292 void USART3_IRQHandler(void)
000000 e92d41f0 PUSH {r4-r8,lr}
;;;293 {
;;;294 unsigned int i;
;;;295 unsigned char ch;
;;;296 CPU_SR_ALLOC();
;;;297 CPU_CRITICAL_ENTER();
000004 f7fffffe BL CPU_SR_Save
000008 4604 MOV r4,r0
;;;298 OSIntEnter();
00000a f7fffffe BL OSIntEnter
;;;299 CPU_CRITICAL_EXIT();
00000e 4620 MOV r0,r4
000010 f7fffffe BL CPU_SR_Restore
;;;300
;;;301 /*接收中断*/
;;;302 if (USART_GetITStatus(USART3, USART_IT_RXNE) != RESET)
000014 4d36 LDR r5,|L7.240|
000016 f2405125 MOV r1,#0x525
00001a 4628 MOV r0,r5
00001c f7fffffe BL USART_GetITStatus
;;;303 {
;;;304 /* Read one byte from the receive data register */
;;;305 ch = USART_ReceiveData(USART3);
;;;306 if(((Uart3Stu.RxBuf_In + 1) & UART_BUF_LEN) == Uart3Stu.RxBuf_Out)
000020 4c34 LDR r4,|L7.244|
000022 b1b0 CBZ r0,|L7.82|
000024 4628 MOV r0,r5 ;305
000026 f7fffffe BL USART_ReceiveData
00002a b2c1 UXTB r1,r0 ;305
00002c f8b42800 LDRH r2,[r4,#0x800] ; Uart3Stu
000030 1c52 ADDS r2,r2,#1
000032 f3c20009 UBFX r0,r2,#0,#10
000036 f8b42802 LDRH r2,[r4,#0x802] ; Uart3Stu
00003a 4290 CMP r0,r2
00003c d009 BEQ |L7.82|
;;;307 {
;;;308
;;;309 }
;;;310 else
;;;311 {
;;;312 Uart3Stu.RxBuf[(Uart3Stu.RxBuf_In)] = ch;
00003e f8b40800 LDRH r0,[r4,#0x800] ; Uart3Stu
000042 5421 STRB r1,[r4,r0]
;;;313 Uart3Stu.RxBuf_In = (Uart3Stu.RxBuf_In + 1) & UART_BUF_LEN;
000044 f8b40800 LDRH r0,[r4,#0x800] ; Uart3Stu
000048 1c40 ADDS r0,r0,#1
00004a f3c00009 UBFX r0,r0,#0,#10
00004e f8a40800 STRH r0,[r4,#0x800]
|L7.82|
;;;314 }
;;;315 }
;;;316 /* 发送缓冲区空中断 */
;;;317 if (USART_GetITStatus(USART3, USART_IT_TXE) != RESET)
000052 f2407627 MOV r6,#0x727
000056 4631 MOV r1,r6
000058 4628 MOV r0,r5
00005a f7fffffe BL USART_GetITStatus
;;;318 {
;;;319 if(Uart3Stu.TxBuf_In != Uart3Stu.TxBuf_Out)
;;;320 {
;;;321 i = Uart3Stu.TxBuf_Out;
;;;322 Uart3Stu.TxBuf_Out = (Uart3Stu.TxBuf_Out + 1) & UART_BUF_LEN;
;;;323 ch = Uart3Stu.TxBuf[i];
;;;324 USART_SendData(USART3,ch);
;;;325 }
;;;326 else
;;;327 {
;;;328 /* 禁止发送缓冲区空中断,使能发送完毕中断 */
;;;329 USART_ITConfig(USART3, USART_IT_TXE, DISABLE);
;;;330 USART_ITConfig(USART3, USART_IT_TC, ENABLE);
00005e f2406726 MOV r7,#0x626
000062 b300 CBZ r0,|L7.166|
000064 f8b40804 LDRH r0,[r4,#0x804] ;319 ; Uart3Stu
000068 f8b41806 LDRH r1,[r4,#0x806] ;319 ; Uart3Stu
00006c 4288 CMP r0,r1 ;319
00006e d00f BEQ |L7.144|
000070 f8b41806 LDRH r1,[r4,#0x806] ;321 ; Uart3Stu
000074 f8b40806 LDRH r0,[r4,#0x806] ;322 ; Uart3Stu
000078 1c40 ADDS r0,r0,#1 ;322
00007a f3c00009 UBFX r0,r0,#0,#10 ;322
00007e f8a40806 STRH r0,[r4,#0x806] ;322
000082 1860 ADDS r0,r4,r1 ;323
000084 f8901400 LDRB r1,[r0,#0x400] ;323
000088 4628 MOV r0,r5 ;324
00008a f7fffffe BL USART_SendData
00008e e02a B |L7.230|
|L7.144|
000090 2200 MOVS r2,#0 ;329
000092 4631 MOV r1,r6 ;329
000094 4628 MOV r0,r5 ;329
000096 f7fffffe BL USART_ITConfig
00009a 2201 MOVS r2,#1
00009c 4639 MOV r1,r7
00009e 4628 MOV r0,r5
0000a0 f7fffffe BL USART_ITConfig
0000a4 e01f B |L7.230|
|L7.166|
;;;331 }
;;;332 }
;;;333 /* 1个字节发送完毕的中断 */
;;;334 else if (USART_GetITStatus(USART3, USART_IT_TC) != RESET)
0000a6 4639 MOV r1,r7
0000a8 4628 MOV r0,r5
0000aa f7fffffe BL USART_GetITStatus
0000ae b1d0 CBZ r0,|L7.230|
;;;335 {
;;;336 if(Uart3Stu.TxBuf_In != Uart3Stu.TxBuf_Out)
0000b0 f8b40804 LDRH r0,[r4,#0x804] ; Uart3Stu
0000b4 f8b41806 LDRH r1,[r4,#0x806] ; Uart3Stu
0000b8 4288 CMP r0,r1
0000ba d00f BEQ |L7.220|
;;;337 {
;;;338 i = Uart3Stu.TxBuf_Out;
0000bc f8b41806 LDRH r1,[r4,#0x806] ; Uart3Stu
;;;339 Uart3Stu.TxBuf_Out = (Uart3Stu.TxBuf_Out + 1) & UART_BUF_LEN;
0000c0 f8b40806 LDRH r0,[r4,#0x806] ; Uart3Stu
0000c4 1c40 ADDS r0,r0,#1
0000c6 f3c00009 UBFX r0,r0,#0,#10
0000ca f8a40806 STRH r0,[r4,#0x806]
;;;340 ch = Uart3Stu.TxBuf[i];
0000ce 1860 ADDS r0,r4,r1
0000d0 f8901400 LDRB r1,[r0,#0x400]
;;;341 USART_SendData(USART3,ch);
0000d4 4628 MOV r0,r5
0000d6 f7fffffe BL USART_SendData
0000da e004 B |L7.230|
|L7.220|
;;;342 }
;;;343 else
;;;344 {
;;;345 /* 禁止发送缓冲区空中断,使能发送完毕中断 */
;;;346 USART_ITConfig(USART3, USART_IT_TC, DISABLE);
0000dc 2200 MOVS r2,#0
0000de 4639 MOV r1,r7
0000e0 4628 MOV r0,r5
0000e2 f7fffffe BL USART_ITConfig
|L7.230|
;;;347 }
;;;348 }
;;;349 OSIntExit();
0000e6 e8bd41f0 POP {r4-r8,lr}
0000ea f7ffbffe B.W OSIntExit
;;;350 }
;;;351
ENDP
0000ee 0000 DCW 0x0000
|L7.240|
DCD 0x40004800
|L7.244|
DCD ||.bss||+0x1056
AREA ||i.USART6_IRQHandler||, CODE, READONLY, ALIGN=2
USART6_IRQHandler PROC
;;;363
;;;364 void USART6_IRQHandler(void)
000000 e92d41f0 PUSH {r4-r8,lr}
;;;365 {
;;;366 unsigned int i;
;;;367 unsigned char ch;
;;;368 CPU_SR_ALLOC();
;;;369 CPU_CRITICAL_ENTER();
000004 f7fffffe BL CPU_SR_Save
000008 4604 MOV r4,r0
;;;370 OSIntEnter();
00000a f7fffffe BL OSIntEnter
;;;371 CPU_CRITICAL_EXIT();
00000e 4620 MOV r0,r4
000010 f7fffffe BL CPU_SR_Restore
;;;372
;;;373 /*接收中断*/
;;;374 if (USART_GetITStatus(USART6, USART_IT_RXNE) != RESET)
000014 4d3a LDR r5,|L8.256|
000016 f2405125 MOV r1,#0x525
00001a 4628 MOV r0,r5
00001c f7fffffe BL USART_GetITStatus
;;;375 {
;;;376 /* Read one byte from the receive data register */
;;;377 ch = USART_ReceiveData(USART6);
;;;378 if(((Uart6Stu.RxBuf_In + 1) & UART_BUF_LEN) == Uart6Stu.RxBuf_Out)
000020 4c38 LDR r4,|L8.260|
000022 b1b0 CBZ r0,|L8.82|
000024 4628 MOV r0,r5 ;377
000026 f7fffffe BL USART_ReceiveData
00002a b2c1 UXTB r1,r0 ;377
00002c f8b42800 LDRH r2,[r4,#0x800] ; Uart6Stu
000030 1c52 ADDS r2,r2,#1
000032 f3c20009 UBFX r0,r2,#0,#10
000036 f8b42802 LDRH r2,[r4,#0x802] ; Uart6Stu
00003a 4290 CMP r0,r2
00003c d009 BEQ |L8.82|
;;;379 {
;;;380
;;;381 }
;;;382 else
;;;383 {
;;;384 Uart6Stu.RxBuf[(Uart6Stu.RxBuf_In)] = ch;
00003e f8b40800 LDRH r0,[r4,#0x800] ; Uart6Stu
000042 5421 STRB r1,[r4,r0]
;;;385 Uart6Stu.RxBuf_In = (Uart6Stu.RxBuf_In + 1) & UART_BUF_LEN;
000044 f8b40800 LDRH r0,[r4,#0x800] ; Uart6Stu
000048 1c40 ADDS r0,r0,#1
00004a f3c00009 UBFX r0,r0,#0,#10
00004e f8a40800 STRH r0,[r4,#0x800]
|L8.82|
;;;386 }
;;;387 }
;;;388 /* 发送缓冲区空中断 */
;;;389 if (USART_GetITStatus(USART6, USART_IT_TXE) != RESET)
000052 f2407627 MOV r6,#0x727
000056 4631 MOV r1,r6
000058 4628 MOV r0,r5
00005a f7fffffe BL USART_GetITStatus
;;;390 {
;;;391 if(Uart6Stu.TxBuf_In != Uart6Stu.TxBuf_Out)
;;;392 {
;;;393 i = Uart6Stu.TxBuf_Out;
;;;394 Uart6Stu.TxBuf_Out = (Uart6Stu.TxBuf_Out + 1) & UART_BUF_LEN;
;;;395 ch = Uart6Stu.TxBuf[i];
;;;396 SetRS485WriteCOM();
;;;397 USART_SendData(USART6,ch);
;;;398 }
;;;399 else
;;;400 {
;;;401 /* 禁止发送缓冲区空中断,使能发送完毕中断 */
;;;402 USART_ITConfig(USART6, USART_IT_TXE, DISABLE);
;;;403 USART_ITConfig(USART6, USART_IT_TC, ENABLE);
00005e f2406726 MOV r7,#0x626
000062 b318 CBZ r0,|L8.172|
000064 f8b40804 LDRH r0,[r4,#0x804] ;391 ; Uart6Stu
000068 f8b41806 LDRH r1,[r4,#0x806] ;391 ; Uart6Stu
00006c 4288 CMP r0,r1 ;391
00006e d012 BEQ |L8.150|
000070 f8b41806 LDRH r1,[r4,#0x806] ;393 ; Uart6Stu
000074 f8b40806 LDRH r0,[r4,#0x806] ;394 ; Uart6Stu
000078 1c40 ADDS r0,r0,#1 ;394
00007a f3c00009 UBFX r0,r0,#0,#10 ;394
00007e f8a40806 STRH r0,[r4,#0x806] ;394
000082 1860 ADDS r0,r4,r1 ;395
000084 f8904400 LDRB r4,[r0,#0x400] ;395
000088 f7fffffe BL SetRS485WriteCOM
00008c 4621 MOV r1,r4 ;397
00008e 4628 MOV r0,r5 ;397
000090 f7fffffe BL USART_SendData
000094 e02f B |L8.246|
|L8.150|
000096 2200 MOVS r2,#0 ;402
000098 4631 MOV r1,r6 ;402
00009a 4628 MOV r0,r5 ;402
00009c f7fffffe BL USART_ITConfig
0000a0 2201 MOVS r2,#1
0000a2 4639 MOV r1,r7
0000a4 4628 MOV r0,r5
0000a6 f7fffffe BL USART_ITConfig
0000aa e024 B |L8.246|
|L8.172|
;;;404 }
;;;405 }
;;;406 /* 1个字节发送完毕的中断 */
;;;407 else if (USART_GetITStatus(USART6, USART_IT_TC) != RESET)
0000ac 4639 MOV r1,r7
0000ae 4628 MOV r0,r5
0000b0 f7fffffe BL USART_GetITStatus
0000b4 b1f8 CBZ r0,|L8.246|
;;;408 {
;;;409 if(Uart6Stu.TxBuf_In != Uart6Stu.TxBuf_Out)
0000b6 f8b40804 LDRH r0,[r4,#0x804] ; Uart6Stu
0000ba f8b41806 LDRH r1,[r4,#0x806] ; Uart6Stu
0000be 4288 CMP r0,r1
0000c0 d012 BEQ |L8.232|
;;;410 {
;;;411 i = Uart6Stu.TxBuf_Out;
0000c2 f8b41806 LDRH r1,[r4,#0x806] ; Uart6Stu
;;;412 Uart6Stu.TxBuf_Out = (Uart6Stu.TxBuf_Out + 1) & UART_BUF_LEN;
0000c6 f8b40806 LDRH r0,[r4,#0x806] ; Uart6Stu
0000ca 1c40 ADDS r0,r0,#1
0000cc f3c00009 UBFX r0,r0,#0,#10
0000d0 f8a40806 STRH r0,[r4,#0x806]
;;;413 ch = Uart6Stu.TxBuf[i];
0000d4 1860 ADDS r0,r4,r1
0000d6 f8904400 LDRB r4,[r0,#0x400]
;;;414 SetRS485WriteCOM();
0000da f7fffffe BL SetRS485WriteCOM
;;;415 USART_SendData(USART6,ch);
0000de 4621 MOV r1,r4
0000e0 4628 MOV r0,r5
0000e2 f7fffffe BL USART_SendData
0000e6 e006 B |L8.246|
|L8.232|
;;;416 }
;;;417 else
;;;418 {
;;;419 /* 禁止发送缓冲区空中断,使能发送完毕中断 */
;;;420 USART_ITConfig(USART6, USART_IT_TC, DISABLE);
0000e8 2200 MOVS r2,#0
0000ea 4639 MOV r1,r7
0000ec 4628 MOV r0,r5
0000ee f7fffffe BL USART_ITConfig
;;;421 SetRS485ReadCOM();
0000f2 f7fffffe BL SetRS485ReadCOM
|L8.246|
;;;422 }
;;;423 }
;;;424 OSIntExit();
0000f6 e8bd41f0 POP {r4-r8,lr}
0000fa f7ffbffe B.W OSIntExit
;;;425 }
;;;426
ENDP
0000fe 0000 DCW 0x0000
|L8.256|
DCD 0x40011400
|L8.260|
DCD ||.bss||+0x185e
AREA ||i.Uart1_Init||, CODE, READONLY, ALIGN=2
Uart1_Init PROC
;;;41
;;;42 void Uart1_Init(u32 baud)//232-1
000000 e92d41f0 PUSH {r4-r8,lr}
;;;43 {
000004 b088 SUB sp,sp,#0x20
000006 4607 MOV r7,r0
;;;44 //GPIO端口设置
;;;45 GPIO_InitTypeDef GPIO_InitStructure;
;;;46 USART_InitTypeDef USART_InitStructure;
;;;47 NVIC_InitTypeDef NVIC_InitStructure;
;;;48
;;;49 RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOF,ENABLE); //使能GPIOF时钟
000008 2101 MOVS r1,#1
00000a 2020 MOVS r0,#0x20
00000c f7fffffe BL RCC_AHB1PeriphClockCmd
;;;50 GPIO_ResetBits(GPIOF, GPIO_Pin_5);//RS485方向选择
000010 f8df80f0 LDR r8,|L9.260|
000014 2120 MOVS r1,#0x20
000016 4640 MOV r0,r8
000018 f7fffffe BL GPIO_ResetBits
;;;51 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5;
00001c 2020 MOVS r0,#0x20
00001e 9006 STR r0,[sp,#0x18]
;;;52 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;//普通输出模式
000020 2501 MOVS r5,#1
000022 f88d501c STRB r5,[sp,#0x1c]
;;;53 GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
000026 2400 MOVS r4,#0
000028 f88d401e STRB r4,[sp,#0x1e]
;;;54 GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
00002c 2003 MOVS r0,#3
00002e f88d001d STRB r0,[sp,#0x1d]
;;;55 GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN;
000032 2602 MOVS r6,#2
000034 f88d601f STRB r6,[sp,#0x1f]
;;;56 GPIO_Init(GPIOF, &GPIO_InitStructure);
000038 a906 ADD r1,sp,#0x18
00003a 4640 MOV r0,r8
00003c f7fffffe BL GPIO_Init
;;;57
;;;58 RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA,ENABLE); //使能GPIOA时钟
000040 2101 MOVS r1,#1
000042 4608 MOV r0,r1
000044 f7fffffe BL RCC_AHB1PeriphClockCmd
;;;59 RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1,ENABLE);//使能USART1时钟
000048 2101 MOVS r1,#1
00004a 2010 MOVS r0,#0x10
00004c f7fffffe BL RCC_APB2PeriphClockCmd
;;;60
;;;61 //串口1对应引脚复用映射
;;;62 GPIO_PinAFConfig(GPIOA,GPIO_PinSource9,GPIO_AF_USART1); //GPIOA9复用为USART1
000050 f8df80b4 LDR r8,|L9.264|
000054 2207 MOVS r2,#7
000056 2109 MOVS r1,#9
000058 4640 MOV r0,r8
00005a f7fffffe BL GPIO_PinAFConfig
;;;63 GPIO_PinAFConfig(GPIOA,GPIO_PinSource10,GPIO_AF_USART1); //GPIOA10复用为USART1
00005e 2207 MOVS r2,#7
000060 210a MOVS r1,#0xa
000062 4640 MOV r0,r8
000064 f7fffffe BL GPIO_PinAFConfig
;;;64
;;;65 //USART1端口配置
;;;66 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9 | GPIO_Pin_10; //GPIOA9与GPIOA10
000068 f44f60c0 MOV r0,#0x600
00006c 9006 STR r0,[sp,#0x18]
;;;67 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;//复用功能
00006e f88d601c STRB r6,[sp,#0x1c]
;;;68 GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; //速度50MHz
000072 f88d601d STRB r6,[sp,#0x1d]
;;;69 GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; //推挽复用输出
000076 f88d401e STRB r4,[sp,#0x1e]
;;;70 GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; //上拉
00007a f88d501f STRB r5,[sp,#0x1f]
;;;71 GPIO_Init(GPIOA,&GPIO_InitStructure); //初始化PA9,PA10
00007e a906 ADD r1,sp,#0x18
000080 4640 MOV r0,r8
000082 f7fffffe BL GPIO_Init
;;;72
;;;73 //Usart1 NVIC 配置
;;;74 NVIC_InitStructure.NVIC_IRQChannel = USART1_IRQn;//串口1中断通道
000086 2025 MOVS r0,#0x25
000088 f88d0004 STRB r0,[sp,#4]
;;;75 NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;//抢占优先级3
00008c f88d4005 STRB r4,[sp,#5]
;;;76 NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; //子优先级3
000090 f88d4006 STRB r4,[sp,#6]
;;;77 NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; //IRQ通道使能
000094 f88d5007 STRB r5,[sp,#7]
;;;78 NVIC_Init(&NVIC_InitStructure); //根据指定的参数初始化VIC寄存器、
000098 a801 ADD r0,sp,#4
00009a f7fffffe BL NVIC_Init
;;;79
;;;80 //USART1 初始化设置
;;;81 USART_InitStructure.USART_BaudRate = baud;//波特率设置
00009e 9702 STR r7,[sp,#8]
;;;82 USART_InitStructure.USART_WordLength = USART_WordLength_8b;//字长为8位数据格式
0000a0 f8ad400c STRH r4,[sp,#0xc]
;;;83 USART_InitStructure.USART_StopBits = USART_StopBits_1;//一个停止位
0000a4 f8ad400e STRH r4,[sp,#0xe]
;;;84 USART_InitStructure.USART_Parity = USART_Parity_No;//无奇偶校验位
0000a8 f8ad4010 STRH r4,[sp,#0x10]
;;;85 USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;//无硬件数据流控制
0000ac f8ad4014 STRH r4,[sp,#0x14]
;;;86 USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx; //收发模式
0000b0 200c MOVS r0,#0xc
0000b2 f8ad0012 STRH r0,[sp,#0x12]
;;;87 USART_Init(USART1, &USART_InitStructure); //初始化串口1
0000b6 4d15 LDR r5,|L9.268|
0000b8 a902 ADD r1,sp,#8
0000ba 4628 MOV r0,r5
0000bc f7fffffe BL USART_Init
;;;88
;;;89 USART_ITConfig(USART1, USART_IT_RXNE, ENABLE);
0000c0 2201 MOVS r2,#1
0000c2 f2405125 MOV r1,#0x525
0000c6 4628 MOV r0,r5
0000c8 f7fffffe BL USART_ITConfig
;;;90 USART_ITConfig(USART1, USART_IT_TXE, ENABLE);
0000cc f2407627 MOV r6,#0x727
0000d0 2201 MOVS r2,#1
0000d2 4631 MOV r1,r6
0000d4 4628 MOV r0,r5
0000d6 f7fffffe BL USART_ITConfig
;;;91
;;;92 USART_ClearFlag(USART1, USART_IT_TXE);
0000da 4631 MOV r1,r6
0000dc 4628 MOV r0,r5
0000de f7fffffe BL USART_ClearFlag
;;;93 USART_ClearFlag(USART1, USART_FLAG_TC);
0000e2 2140 MOVS r1,#0x40
0000e4 4628 MOV r0,r5
0000e6 f7fffffe BL USART_ClearFlag
;;;94 Uart1Stu.RxBuf_In = 0;
0000ea 4909 LDR r1,|L9.272|
0000ec 800c STRH r4,[r1,#0]
;;;95 Uart1Stu.RxBuf_Out = 0;
0000ee 804c STRH r4,[r1,#2]
;;;96 Uart1Stu.TxBuf_In = 0;
0000f0 808c STRH r4,[r1,#4]
;;;97 Uart1Stu.TxBuf_Out = 0;
0000f2 80cc STRH r4,[r1,#6]
;;;98
;;;99 USART_Cmd(USART1, ENABLE); //使能串口1
0000f4 2101 MOVS r1,#1
0000f6 4628 MOV r0,r5
0000f8 f7fffffe BL USART_Cmd
;;;100 }
0000fc b008 ADD sp,sp,#0x20
0000fe e8bd81f0 POP {r4-r8,pc}
;;;101
ENDP
000102 0000 DCW 0x0000
|L9.260|
DCD 0x40021400
|L9.264|
DCD 0x40020000
|L9.268|
DCD 0x40011000
|L9.272|
DCD ||.bss||+0x846
AREA ||i.Uart3_Init||, CODE, READONLY, ALIGN=2
Uart3_Init PROC
;;;101
;;;102 void Uart3_Init(u32 baud) // 232-2
000000 b5f0 PUSH {r4-r7,lr}
;;;103 {
000002 b087 SUB sp,sp,#0x1c
000004 4606 MOV r6,r0
;;;104 GPIO_InitTypeDef GPIO_InitStructure;
;;;105 USART_InitTypeDef USART_InitStructure;
;;;106 NVIC_InitTypeDef NVIC_InitStructure;
;;;107
;;;108 RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOC,ENABLE);
000006 2101 MOVS r1,#1
000008 2004 MOVS r0,#4
00000a f7fffffe BL RCC_AHB1PeriphClockCmd
;;;109 RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3,ENABLE); // 打开串口USART3时钟!
00000e 2101 MOVS r1,#1
000010 0488 LSLS r0,r1,#18
000012 f7fffffe BL RCC_APB1PeriphClockCmd
;;;110
;;;111 GPIO_PinAFConfig(GPIOC,GPIO_PinSource10,GPIO_AF_USART3); //GPIOC10复用为USART3 --- COM2
000016 4f23 LDR r7,|L10.164|
000018 2207 MOVS r2,#7
00001a 210a MOVS r1,#0xa
00001c 4638 MOV r0,r7
00001e f7fffffe BL GPIO_PinAFConfig
;;;112 GPIO_PinAFConfig(GPIOC,GPIO_PinSource11,GPIO_AF_USART3); //GPIOC11复用为USART3
000022 2207 MOVS r2,#7
000024 210b MOVS r1,#0xb
000026 4638 MOV r0,r7
000028 f7fffffe BL GPIO_PinAFConfig
;;;113
;;;114 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10 | GPIO_Pin_11; //GPIOC10与GPIOC11
00002c f44f6040 MOV r0,#0xc00
000030 9005 STR r0,[sp,#0x14]
;;;115 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;//复用功能
000032 2102 MOVS r1,#2
000034 f88d1018 STRB r1,[sp,#0x18]
;;;116 GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; //速度50MHz
000038 f88d1019 STRB r1,[sp,#0x19]
;;;117 GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; //推挽复用输出
00003c 2400 MOVS r4,#0
00003e f88d401a STRB r4,[sp,#0x1a]
;;;118 GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; //上拉
000042 2501 MOVS r5,#1
000044 f88d501b STRB r5,[sp,#0x1b]
;;;119 GPIO_Init(GPIOC,&GPIO_InitStructure); //初始化PC10,PC11
000048 a905 ADD r1,sp,#0x14
00004a 4638 MOV r0,r7
00004c f7fffffe BL GPIO_Init
;;;120
;;;121 /* Enable the USARTy Interrupt */
;;;122 NVIC_InitStructure.NVIC_IRQChannel = USART3_IRQn;//串口3中断通道
000050 2027 MOVS r0,#0x27
000052 f88d0000 STRB r0,[sp,#0]
;;;123 NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority=3;//抢占优先级3
000056 2103 MOVS r1,#3
000058 f88d1001 STRB r1,[sp,#1]
;;;124 NVIC_InitStructure.NVIC_IRQChannelSubPriority =3; //子优先级3
00005c f88d1002 STRB r1,[sp,#2]
;;;125 NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; //IRQ通道使能
000060 f88d5003 STRB r5,[sp,#3]
;;;126 NVIC_Init(&NVIC_InitStructure); //根据指定的参数初始化VIC寄存器
000064 4668 MOV r0,sp
000066 f7fffffe BL NVIC_Init
;;;127
;;;128
;;;129 USART_InitStructure.USART_BaudRate = baud;
00006a 9601 STR r6,[sp,#4]
;;;130 USART_InitStructure.USART_WordLength = USART_WordLength_8b;
00006c f8ad4008 STRH r4,[sp,#8]
;;;131 USART_InitStructure.USART_StopBits = USART_StopBits_1;
000070 f8ad400a STRH r4,[sp,#0xa]
;;;132 USART_InitStructure.USART_Parity = USART_Parity_No;
000074 f8ad400c STRH r4,[sp,#0xc]
;;;133 USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
000078 f8ad4010 STRH r4,[sp,#0x10]
;;;134 USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
00007c 200c MOVS r0,#0xc
00007e f8ad000e STRH r0,[sp,#0xe]
;;;135
;;;136 USART_Init(USART3, &USART_InitStructure);
000082 4c09 LDR r4,|L10.168|
000084 a901 ADD r1,sp,#4
000086 4620 MOV r0,r4
000088 f7fffffe BL USART_Init
;;;137 USART_ITConfig(USART3, USART_IT_RXNE, ENABLE);//开启相关中断
00008c 2201 MOVS r2,#1
00008e f2405125 MOV r1,#0x525
000092 4620 MOV r0,r4
000094 f7fffffe BL USART_ITConfig
;;;138 /* Enable USART1 */
;;;139 USART_Cmd(USART3, ENABLE);
000098 2101 MOVS r1,#1
00009a 4620 MOV r0,r4
00009c f7fffffe BL USART_Cmd
;;;140 }
0000a0 b007 ADD sp,sp,#0x1c
0000a2 bdf0 POP {r4-r7,pc}
;;;141
ENDP
|L10.164|
DCD 0x40020800
|L10.168|
DCD 0x40004800
AREA ||i.Uart6_Init||, CODE, READONLY, ALIGN=2
Uart6_Init PROC
;;;141
;;;142 void Uart6_Init()
000000 b5f0 PUSH {r4-r7,lr}
;;;143 {
000002 b087 SUB sp,sp,#0x1c
;;;144 //GPIO端口设置
;;;145 GPIO_InitTypeDef GPIO_InitStructure;
;;;146 USART_InitTypeDef USART_InitStructure;
;;;147 NVIC_InitTypeDef NVIC_InitStructure;
;;;148
;;;149 RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOC,ENABLE); //使能GPIOF时钟
000004 2101 MOVS r1,#1
000006 2004 MOVS r0,#4
000008 f7fffffe BL RCC_AHB1PeriphClockCmd
;;;150 GPIO_ResetBits(GPIOC, GPIO_Pin_8);//RS485方向选择
00000c 4f3a LDR r7,|L11.248|
00000e f44f7480 MOV r4,#0x100
000012 4621 MOV r1,r4
000014 4638 MOV r0,r7
000016 f7fffffe BL GPIO_ResetBits
;;;151 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8;
00001a 9405 STR r4,[sp,#0x14]
;;;152 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;//普通输出模式
00001c 2501 MOVS r5,#1
00001e f88d5018 STRB r5,[sp,#0x18]
;;;153 GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
000022 2400 MOVS r4,#0
000024 f88d401a STRB r4,[sp,#0x1a]
;;;154 GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
000028 2003 MOVS r0,#3
00002a f88d0019 STRB r0,[sp,#0x19]
;;;155 GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN;
00002e 2602 MOVS r6,#2
000030 f88d601b STRB r6,[sp,#0x1b]
;;;156 GPIO_Init(GPIOC, &GPIO_InitStructure);
000034 a905 ADD r1,sp,#0x14
000036 4638 MOV r0,r7
000038 f7fffffe BL GPIO_Init
;;;157
;;;158 //RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOC,ENABLE); //使能GPIOD时钟
;;;159 RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART6, ENABLE);//使能USART2时钟
00003c 2101 MOVS r1,#1
00003e 2020 MOVS r0,#0x20
000040 f7fffffe BL RCC_APB2PeriphClockCmd
;;;160
;;;161 //串口2对应引脚复用映射
;;;162 GPIO_PinAFConfig(GPIOC, GPIO_PinSource6, GPIO_AF_USART6); //GPIOD5复用为USART2
000044 2208 MOVS r2,#8
000046 2106 MOVS r1,#6
000048 4638 MOV r0,r7
00004a f7fffffe BL GPIO_PinAFConfig
;;;163 GPIO_PinAFConfig(GPIOC, GPIO_PinSource7, GPIO_AF_USART6); //GPIOD6复用为USART2
00004e 2208 MOVS r2,#8
000050 2107 MOVS r1,#7
000052 4638 MOV r0,r7
000054 f7fffffe BL GPIO_PinAFConfig
;;;164
;;;165 //USART2端口配置
;;;166 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6 | GPIO_Pin_7;
000058 20c0 MOVS r0,#0xc0
00005a 9005 STR r0,[sp,#0x14]
;;;167 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;//复用功能
00005c f88d6018 STRB r6,[sp,#0x18]
;;;168 GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; //速度50MHz
000060 f88d6019 STRB r6,[sp,#0x19]
;;;169 GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; //推挽复用输出
000064 f88d401a STRB r4,[sp,#0x1a]
;;;170 GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; //上拉
000068 f88d501b STRB r5,[sp,#0x1b]
;;;171 GPIO_Init(GPIOC,&GPIO_InitStructure);
00006c a905 ADD r1,sp,#0x14
00006e 4638 MOV r0,r7
000070 f7fffffe BL GPIO_Init
;;;172
;;;173 //Usart2 NVIC 配置
;;;174 NVIC_InitStructure.NVIC_IRQChannel = USART6_IRQn;//串口2中断通道
000074 2047 MOVS r0,#0x47
000076 f88d0000 STRB r0,[sp,#0]
;;;175 NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;//抢占优先级3
00007a f88d4001 STRB r4,[sp,#1]
;;;176 NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
00007e f88d4002 STRB r4,[sp,#2]
;;;177 NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; //IRQ通道使能
000082 f88d5003 STRB r5,[sp,#3]
;;;178 NVIC_Init(&NVIC_InitStructure); //根据指定的参数初始化VIC寄存器、
000086 4668 MOV r0,sp
000088 f7fffffe BL NVIC_Init
;;;179
;;;180
;;;181 USART_InitStructure.USART_BaudRate = 115200;//波特率设置
00008c f44f30e1 MOV r0,#0x1c200
000090 9001 STR r0,[sp,#4]
;;;182
;;;183 USART_InitStructure.USART_WordLength = USART_WordLength_9b;//字长为8位数据格式
000092 0328 LSLS r0,r5,#12
000094 f8ad0008 STRH r0,[sp,#8]
;;;184 USART_InitStructure.USART_StopBits = USART_StopBits_1;//一个停止位
000098 f8ad400a STRH r4,[sp,#0xa]
;;;185 USART_InitStructure.USART_Parity = USART_Parity_Even;//USART_Parity_No;//无奇偶校验位
00009c 1080 ASRS r0,r0,#2
00009e f8ad000c STRH r0,[sp,#0xc]
;;;186 USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;//无硬件数据流控制
0000a2 f8ad4010 STRH r4,[sp,#0x10]
;;;187 USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx; //收发模式
0000a6 200c MOVS r0,#0xc
0000a8 f8ad000e STRH r0,[sp,#0xe]
;;;188 USART_Init(USART6, &USART_InitStructure); //初始化串口2
0000ac 4d13 LDR r5,|L11.252|
0000ae a901 ADD r1,sp,#4
0000b0 4628 MOV r0,r5
0000b2 f7fffffe BL USART_Init
;;;189
;;;190 USART_ITConfig(USART6, USART_IT_RXNE, ENABLE);
0000b6 2201 MOVS r2,#1
0000b8 f2405125 MOV r1,#0x525
0000bc 4628 MOV r0,r5
0000be f7fffffe BL USART_ITConfig
;;;191 USART_ITConfig(USART6, USART_IT_TXE, ENABLE);
0000c2 f2407627 MOV r6,#0x727
0000c6 2201 MOVS r2,#1
0000c8 4631 MOV r1,r6
0000ca 4628 MOV r0,r5
0000cc f7fffffe BL USART_ITConfig
;;;192
;;;193 USART_ClearFlag(USART6, USART_IT_TXE);
0000d0 4631 MOV r1,r6
0000d2 4628 MOV r0,r5
0000d4 f7fffffe BL USART_ClearFlag
;;;194 USART_ClearFlag(USART6, USART_FLAG_TC);
0000d8 2140 MOVS r1,#0x40
0000da 4628 MOV r0,r5
0000dc f7fffffe BL USART_ClearFlag
;;;195
;;;196 Uart6Stu.RxBuf_In = 0;
0000e0 4907 LDR r1,|L11.256|
0000e2 800c STRH r4,[r1,#0]
;;;197 Uart6Stu.RxBuf_Out = 0;
0000e4 804c STRH r4,[r1,#2]
;;;198 Uart6Stu.TxBuf_In = 0;
0000e6 808c STRH r4,[r1,#4]
;;;199 Uart6Stu.TxBuf_Out = 0;
0000e8 80cc STRH r4,[r1,#6]
;;;200
;;;201 USART_Cmd(USART6, ENABLE); //使能串口2
0000ea 2101 MOVS r1,#1
0000ec 4628 MOV r0,r5
0000ee f7fffffe BL USART_Cmd
;;;202 }
0000f2 b007 ADD sp,sp,#0x1c
0000f4 bdf0 POP {r4-r7,pc}
;;;203
ENDP
0000f6 0000 DCW 0x0000
|L11.248|
DCD 0x40020800
|L11.252|
DCD 0x40011400
|L11.256|
DCD ||.bss||+0x205e
AREA ||i.UartSend||, CODE, READONLY, ALIGN=2
UartSend PROC
;;;525
;;;526 void UartSend(unsigned char UartID,unsigned char *buff,unsigned int length)
000000 e92d47f0 PUSH {r4-r10,lr}
;;;527 {
000004 460f MOV r7,r1
000006 4690 MOV r8,r2
;;;528 unsigned int i;
;;;529 unsigned int time;
;;;530 USART_TypeDef* USARTx;
;;;531
;;;532 if(UartID == COM1)
000008 2801 CMP r0,#1
00000a d00e BEQ |L12.42|
;;;533 USARTx = USART1;
;;;534 else if(UartID == COM2)
00000c 2802 CMP r0,#2
00000e d00e BEQ |L12.46|
;;;535 USARTx = USART2;
;;;536 else if(UartID == COM3)
000010 2803 CMP r0,#3
000012 d00e BEQ |L12.50|
;;;537 USARTx = USART3;
;;;538 else if(UartID == COM4)
000014 2804 CMP r0,#4
000016 d00e BEQ |L12.54|
;;;539 USARTx = UART4;
;;;540 else if(UartID == COM5)
000018 2805 CMP r0,#5
00001a d00e BEQ |L12.58|
;;;541 USARTx = UART5;
;;;542 else if(UartID == COM6)
00001c 2806 CMP r0,#6
00001e d120 BNE |L12.98|
;;;543 USARTx = USART6;
000020 4e11 LDR r6,|L12.104|
|L12.34|
;;;544 else
;;;545 return;
;;;546
;;;547 for(i = 0; i < length; i++)
000022 2500 MOVS r5,#0
;;;548 {
;;;549 /* 写一个字节到USART1 */
;;;550 USART_SendData(USARTx, buff[i]);
;;;551
;;;552 /* 等待发送结束 */
;;;553 time = 0;
;;;554 while (USART_GetFlagStatus(USARTx, USART_FLAG_TC) == RESET)
;;;555 {
;;;556 time++;
;;;557 if(time > 100000)
000024 f8df9044 LDR r9,|L12.108|
000028 e019 B |L12.94|
|L12.42|
00002a 4e11 LDR r6,|L12.112|
00002c e7f9 B |L12.34|
|L12.46|
00002e 4e11 LDR r6,|L12.116|
000030 e7f7 B |L12.34|
|L12.50|
000032 4e11 LDR r6,|L12.120|
000034 e7f5 B |L12.34|
|L12.54|
000036 4e11 LDR r6,|L12.124|
000038 e7f3 B |L12.34|
|L12.58|
00003a 4e11 LDR r6,|L12.128|
00003c e7f1 B |L12.34|
|L12.62|
00003e 5d79 LDRB r1,[r7,r5] ;550
000040 4630 MOV r0,r6 ;550
000042 f7fffffe BL USART_SendData
000046 2400 MOVS r4,#0 ;553
000048 e002 B |L12.80|
|L12.74|
00004a 1c64 ADDS r4,r4,#1 ;556
00004c 454c CMP r4,r9
00004e d805 BHI |L12.92|
|L12.80|
000050 2140 MOVS r1,#0x40 ;554
000052 4630 MOV r0,r6 ;554
000054 f7fffffe BL USART_GetFlagStatus
000058 2800 CMP r0,#0 ;554
00005a d0f6 BEQ |L12.74|
|L12.92|
00005c 1c6d ADDS r5,r5,#1 ;547
|L12.94|
00005e 4545 CMP r5,r8 ;547
000060 d3ed BCC |L12.62|
|L12.98|
;;;558 {
;;;559 break;
;;;560 }
;;;561 };
;;;562 }
;;;563 }
000062 e8bd87f0 POP {r4-r10,pc}
;;;564 void ProcessDataFormUartCard()
ENDP
000066 0000 DCW 0x0000
|L12.104|
DCD 0x40011400
|L12.108|
DCD 0x000186a0
|L12.112|
DCD 0x40011000
|L12.116|
DCD 0x40004400
|L12.120|
DCD 0x40004800
|L12.124|
DCD 0x40004c00
|L12.128|
DCD 0x40005000
AREA ||i.Uart_Printf||, CODE, READONLY, ALIGN=1
Uart_Printf PROC
;;;707 *********************************************************************************************************/
;;;708 void Uart_Printf(unsigned char UartID, const char *fmt,...)
000000 b40f PUSH {r0-r3}
;;;709 {
000002 b510 PUSH {r4,lr}
000004 f5ad6d80 SUB sp,sp,#0x400
000008 4604 MOV r4,r0
;;;710 va_list ap;
;;;711 char string[1024];
;;;712
;;;713 va_start(ap,fmt);
00000a f50d6282 ADD r2,sp,#0x410
;;;714 vsprintf(string,fmt,ap);
00000e 4668 MOV r0,sp
000010 f8dd140c LDR r1,[sp,#0x40c]
000014 f7fffffe BL vsprintf
;;;715
;;;716 WriteUart(UartID,(unsigned char *)string,strlen(string));
000018 4668 MOV r0,sp
00001a f7fffffe BL strlen
00001e 4602 MOV r2,r0
000020 4669 MOV r1,sp
000022 4620 MOV r0,r4
000024 f7fffffe BL WriteUart
;;;717 va_end(ap);
;;;718 }
000028 f50d6d80 ADD sp,sp,#0x400
00002c bc10 POP {r4}
00002e f85dfb14 LDR pc,[sp],#0x14
;;;719
ENDP
AREA ||i.WriteUart||, CODE, READONLY, ALIGN=2
WriteUart PROC
;;;469 */
;;;470 void WriteUart(unsigned char UartID,unsigned char *buff,unsigned int length)
000000 b4f0 PUSH {r4-r7}
;;;471 {
;;;472 unsigned int i;
;;;473 UartStruct *pUartStu;
;;;474 USART_TypeDef* USARTx;
;;;475 unsigned char write;
;;;476
;;;477 if(UartID == COM1)
000002 2801 CMP r0,#1
000004 d00f BEQ |L14.38|
;;;478 {
;;;479 pUartStu = &Uart1Stu;
;;;480 USARTx = USART1;
;;;481 }
;;;482 else if(UartID == COM2)
000006 2802 CMP r0,#2
000008 d010 BEQ |L14.44|
;;;483 {
;;;484 pUartStu = &Uart2Stu;
;;;485 USARTx = USART2;
;;;486 }
;;;487 else if(UartID == COM3)
00000a 2803 CMP r0,#3
00000c d011 BEQ |L14.50|
;;;488 {
;;;489 pUartStu = &Uart3Stu;
;;;490 USARTx = USART3;
;;;491 }
;;;492 else if(UartID == COM6)
00000e 2806 CMP r0,#6
000010 d137 BNE |L14.130|
;;;493 {
;;;494 pUartStu = &Uart6Stu;
000012 4b1d LDR r3,|L14.136|
;;;495 USARTx = USART6;
000014 481d LDR r0,|L14.140|
|L14.22|
;;;496 }
;;;497 else
;;;498 return;
;;;499
;;;500 if(pUartStu->TxBuf_In == pUartStu->TxBuf_Out)
000016 f8b34804 LDRH r4,[r3,#0x804]
00001a f8b35806 LDRH r5,[r3,#0x806]
00001e 42ac CMP r4,r5
000020 d10a BNE |L14.56|
;;;501 {
;;;502 write = 1;
000022 2701 MOVS r7,#1
000024 e009 B |L14.58|
|L14.38|
000026 4b1a LDR r3,|L14.144|
000028 481a LDR r0,|L14.148|
00002a e7f4 B |L14.22|
|L14.44|
00002c 4b1a LDR r3,|L14.152|
00002e 481b LDR r0,|L14.156|
000030 e7f1 B |L14.22|
|L14.50|
000032 4b1b LDR r3,|L14.160|
000034 481b LDR r0,|L14.164|
000036 e7ee B |L14.22|
|L14.56|
;;;503 }
;;;504 else
;;;505 {
;;;506 write = 0;
000038 2700 MOVS r7,#0
|L14.58|
;;;507 }
;;;508
;;;509 for(i = 0; i < length; i++)
00003a 2400 MOVS r4,#0
;;;510 {
;;;511 if(((pUartStu->TxBuf_In + 1) & UART_BUF_LEN) != pUartStu->TxBuf_Out)
;;;512 {
;;;513 pUartStu->TxBuf[(pUartStu->TxBuf_In)] = buff[i];
00003c f5036680 ADD r6,r3,#0x400
000040 e015 B |L14.110|
|L14.66|
000042 f8b35804 LDRH r5,[r3,#0x804] ;511
000046 f8b3c806 LDRH r12,[r3,#0x806] ;511
00004a 1c6d ADDS r5,r5,#1 ;511
00004c f3c50509 UBFX r5,r5,#0,#10 ;511
000050 4565 CMP r5,r12 ;511
000052 d00e BEQ |L14.114|
000054 5d0d LDRB r5,[r1,r4]
000056 f8b3c804 LDRH r12,[r3,#0x804]
00005a f80c5006 STRB r5,[r12,r6]
;;;514 pUartStu->TxBuf_In = (pUartStu->TxBuf_In + 1) & UART_BUF_LEN;
00005e f8b35804 LDRH r5,[r3,#0x804]
000062 1c6d ADDS r5,r5,#1
000064 f3c50509 UBFX r5,r5,#0,#10
000068 f8a35804 STRH r5,[r3,#0x804]
00006c 1c64 ADDS r4,r4,#1 ;509
|L14.110|
00006e 4294 CMP r4,r2 ;509
000070 d3e7 BCC |L14.66|
|L14.114|
;;;515 }
;;;516 else
;;;517 break;
;;;518 }
;;;519
;;;520 if(write)
000072 2f00 CMP r7,#0
000074 d005 BEQ |L14.130|
;;;521 {
;;;522 USART_ITConfig(USARTx, USART_IT_TXE, ENABLE);
000076 bcf0 POP {r4-r7}
000078 2201 MOVS r2,#1
00007a f2407127 MOV r1,#0x727
00007e f7ffbffe B.W USART_ITConfig
|L14.130|
;;;523 }
;;;524 }
000082 bcf0 POP {r4-r7}
000084 4770 BX lr
;;;525
ENDP
000086 0000 DCW 0x0000
|L14.136|
DCD ||.bss||+0x185e
|L14.140|
DCD 0x40011400
|L14.144|
DCD ||.bss||+0x46
|L14.148|
DCD 0x40011000
|L14.152|
DCD ||.bss||+0x84e
|L14.156|
DCD 0x40004400
|L14.160|
DCD ||.bss||+0x1056
|L14.164|
DCD 0x40004800
AREA ||i._getData||, CODE, READONLY, ALIGN=2
_getData PROC
;;;596
;;;597 float _getData(unsigned char *Res)
000000 b570 PUSH {r4-r6,lr}
;;;598 {
;;;599 int x = 1;
000002 2101 MOVS r1,#1
;;;600 int gewei = Res[1] >> 4;
000004 7842 LDRB r2,[r0,#1]
000006 0913 LSRS r3,r2,#4
;;;601 int dian1 = Res[1] & 0xf;
000008 f002040f AND r4,r2,#0xf
;;;602 int dian2 = Res[2] >> 4;
00000c 7882 LDRB r2,[r0,#2]
00000e 0915 LSRS r5,r2,#4
;;;603 int dian3 = Res[2] & 0xf;
000010 f002020f AND r2,r2,#0xf
;;;604
;;;605 if ((Res[0] >> 4) == 1)
000014 7800 LDRB r0,[r0,#0]
000016 2601 MOVS r6,#1
000018 ebb61f10 CMP r6,r0,LSR #4
00001c d100 BNE |L15.32|
;;;606 {
;;;607 x = -1;
00001e 1e89 SUBS r1,r1,#2
|L15.32|
;;;608 }
;;;609
;;;610 return x * ((float)gewei + (float)dian1 * 0.1f + (float)dian2 * 0.01f + (float)dian3 * 0.001f);
000020 ee003a10 VMOV s0,r3
000024 ee004a90 VMOV s1,r4
000028 ed9f1a0f VLDR s2,|L15.104|
00002c eeb80ac0 VCVT.F32.S32 s0,s0
000030 eef80ae0 VCVT.F32.S32 s1,s1
000034 ee000a81 VMLA.F32 s0,s1,s2
000038 ee005a90 VMOV s1,r5
00003c ed9f1a0b VLDR s2,|L15.108|
000040 eef80ae0 VCVT.F32.S32 s1,s1
000044 ee000a81 VMLA.F32 s0,s1,s2
000048 ee002a90 VMOV s1,r2
00004c ed9f1a08 VLDR s2,|L15.112|
000050 eef80ae0 VCVT.F32.S32 s1,s1
000054 ee000a81 VMLA.F32 s0,s1,s2
000058 ee001a90 VMOV s1,r1
00005c eef80ae0 VCVT.F32.S32 s1,s1
000060 ee200a20 VMUL.F32 s0,s0,s1
;;;611 }
000064 bd70 POP {r4-r6,pc}
;;;612
ENDP
000066 0000 DCW 0x0000
|L15.104|
000068 3dcccccd DCFS 0x3dcccccd ; 0.10000000149011612
|L15.108|
00006c 3c23d70a DCFS 0x3c23d70a ; 0.0099999997764825821
|L15.112|
000070 3a83126f DCFS 0x3a83126f ; 0.0010000000474974513
AREA ||i._sys_exit||, CODE, READONLY, ALIGN=1
_sys_exit PROC
;;;730 //定义_sys_exit()以避免使用半主机模式
;;;731 void _sys_exit(int x)
000000 4770 BX lr
;;;732 {
;;;733 x = x;
;;;734 }
;;;735 //重定义fputc函数
ENDP
AREA ||i.bsp_InitUart||, CODE, READONLY, ALIGN=1
bsp_InitUart PROC
;;;205
;;;206 void bsp_InitUart(void)
000000 b510 PUSH {r4,lr}
;;;207 {
;;;208 Uart1_Init(115200);
000002 f44f34e1 MOV r4,#0x1c200
000006 4620 MOV r0,r4
000008 f7fffffe BL Uart1_Init
;;;209 Uart3_Init(115200);
00000c 4620 MOV r0,r4
00000e f7fffffe BL Uart3_Init
;;;210 Uart6_Init();
000012 e8bd4010 POP {r4,lr}
000016 f7ffbffe B.W Uart6_Init
;;;211 }
;;;212
ENDP
AREA ||i.fputc||, CODE, READONLY, ALIGN=1
fputc PROC
;;;735 //重定义fputc函数
;;;736 int fputc(int ch, FILE *f)
000000 4770 BX lr
;;;737 {
;;;738 // while((USART3->SR&0X40)==0);//循环发送,直到发送完毕
;;;739 // USART3->DR = (u8) ch;
;;;740 return ch;
;;;741 }
ENDP
AREA ||i.getData||, CODE, READONLY, ALIGN=2
getData PROC
;;;579
;;;580 float getData(unsigned char *Res)
000000 b5f0 PUSH {r4-r7,lr}
;;;581 {
;;;582 int x = 1;
000002 2101 MOVS r1,#1
;;;583 int baiwei = Res[0] & 0xf;
000004 7802 LDRB r2,[r0,#0]
000006 f002040f AND r4,r2,#0xf
;;;584 int shiwei = Res[1] >> 4;
00000a 7843 LDRB r3,[r0,#1]
00000c 091d LSRS r5,r3,#4
;;;585 int gewei = Res[1] & 0xf;
00000e f003030f AND r3,r3,#0xf
;;;586 int dian1 = Res[2] >> 4;
000012 7880 LDRB r0,[r0,#2]
000014 0906 LSRS r6,r0,#4
;;;587 int dian2 = Res[2] & 0xf;
000016 f000000f AND r0,r0,#0xf
;;;588
;;;589 if ((Res[0] >> 4) == 1)
00001a 2701 MOVS r7,#1
00001c ebb71f12 CMP r7,r2,LSR #4
000020 d100 BNE |L19.36|
;;;590 {
;;;591 x = -1;
000022 1e89 SUBS r1,r1,#2
|L19.36|
;;;592 }
;;;593
;;;594 return x * ((float)baiwei * 100.0f + (float)shiwei * 10.0f + (float)gewei + (float)dian1 * 0.1f + (float)dian2 * 0.01f);
000024 ee004a10 VMOV s0,r4
000028 eddf0a15 VLDR s1,|L19.128|
00002c eeb21a04 VMOV.F32 s2,#10.00000000
000030 eeb80ac0 VCVT.F32.S32 s0,s0
000034 ee600a20 VMUL.F32 s1,s0,s1
000038 ee005a10 VMOV s0,r5
00003c eeb80ac0 VCVT.F32.S32 s0,s0
000040 ee400a01 VMLA.F32 s1,s0,s2
000044 ee003a10 VMOV s0,r3
000048 ed9f1a0e VLDR s2,|L19.132|
00004c eeb80ac0 VCVT.F32.S32 s0,s0
000050 ee300a80 VADD.F32 s0,s1,s0
000054 ee006a90 VMOV s1,r6
000058 eef80ae0 VCVT.F32.S32 s1,s1
00005c ee000a81 VMLA.F32 s0,s1,s2
000060 ee000a90 VMOV s1,r0
000064 ed9f1a08 VLDR s2,|L19.136|
000068 eef80ae0 VCVT.F32.S32 s1,s1
00006c ee000a81 VMLA.F32 s0,s1,s2
000070 ee001a90 VMOV s1,r1
000074 eef80ae0 VCVT.F32.S32 s1,s1
000078 ee200a20 VMUL.F32 s0,s0,s1
;;;595 }
00007c bdf0 POP {r4-r7,pc}
;;;596
ENDP
00007e 0000 DCW 0x0000
|L19.128|
000080 42c80000 DCFS 0x42c80000 ; 100
|L19.132|
000084 3dcccccd DCFS 0x3dcccccd ; 0.10000000149011612
|L19.136|
000088 3c23d70a DCFS 0x3c23d70a ; 0.0099999997764825821
AREA ||i.getdata||, CODE, READONLY, ALIGN=2
getdata PROC
;;;612
;;;613 void getdata(unsigned char Res)
000000 b530 PUSH {r4,r5,lr}
;;;614 {
;;;615 static int offset = 0;
;;;616 static unsigned char buffer[70];
;;;617 static int step = 0;
;;;618 buffer[offset++] = Res;
000002 493e LDR r1,|L20.252|
000004 4d3e LDR r5,|L20.256|
000006 680b LDR r3,[r1,#0] ; offset
000008 1c5a ADDS r2,r3,#1
00000a 600a STR r2,[r1,#0] ; offset
00000c 54e8 STRB r0,[r5,r3]
;;;619 // Uart_Printf(COM1,"%02X",Res);
;;;620 if (offset > 69)
00000e 2300 MOVS r3,#0
000010 2a45 CMP r2,#0x45
000012 dd00 BLE |L20.22|
;;;621 offset = 0;
000014 600b STR r3,[r1,#0] ; offset
|L20.22|
;;;622 if (Res == 0x68 && step == 0)
000016 2868 CMP r0,#0x68
000018 d101 BNE |L20.30|
00001a 684a LDR r2,[r1,#4] ; step
00001c b112 CBZ r2,|L20.36|
|L20.30|
;;;623 {
;;;624 // Uart_Printf(COM1,"step0\r\n");
;;;625 step = 1;
;;;626 }
;;;627 else if (Res == 0x21 && step == 1)
00001e 2821 CMP r0,#0x21
000020 d003 BEQ |L20.42|
000022 e005 B |L20.48|
|L20.36|
000024 2001 MOVS r0,#1 ;625
000026 6048 STR r0,[r1,#4] ;625 ; step
000028 e014 B |L20.84|
|L20.42|
00002a 684a LDR r2,[r1,#4] ; step
00002c 2a01 CMP r2,#1
00002e d001 BEQ |L20.52|
|L20.48|
;;;628 {
;;;629 // Uart_Printf(COM1,"step1\r\n");
;;;630 step = 2;
;;;631 }
;;;632 else if (Res == 0x00 && step == 2)
000030 b118 CBZ r0,|L20.58|
000032 e005 B |L20.64|
|L20.52|
000034 2002 MOVS r0,#2 ;630
000036 6048 STR r0,[r1,#4] ;630 ; step
000038 e00c B |L20.84|
|L20.58|
00003a 684a LDR r2,[r1,#4] ; step
00003c 2a02 CMP r2,#2
00003e d002 BEQ |L20.70|
|L20.64|
;;;633 {
;;;634 // Uart_Printf(COM1,"step2\r\n");
;;;635 step = 3;
;;;636 }
;;;637 else if (Res == 0x84 && step == 3)
000040 2884 CMP r0,#0x84
000042 d003 BEQ |L20.76|
000044 e005 B |L20.82|
|L20.70|
000046 2003 MOVS r0,#3 ;635
000048 6048 STR r0,[r1,#4] ;635 ; step
00004a e003 B |L20.84|
|L20.76|
00004c 6848 LDR r0,[r1,#4] ; step
00004e 2803 CMP r0,#3
000050 d051 BEQ |L20.246|
|L20.82|
;;;638 {
;;;639 // Uart_Printf(COM1,"step3\r\n");
;;;640 step = 0;
;;;641 offset = 0;
;;;642 // Uart_Printf(COM1,"get one frame\r\n");
;;;643 }
;;;644 else
;;;645 {
;;;646 step = 0;
000052 604b STR r3,[r1,#4] ; step
|L20.84|
;;;647 }
;;;648
;;;649 if (offset == 30)
000054 6808 LDR r0,[r1,#0] ; offset
000056 281e CMP r0,#0x1e
000058 d14c BNE |L20.244|
;;;650 {
;;;651 unsigned char sum = 0xa5;
00005a 21a5 MOVS r1,#0xa5
;;;652 for (int i = 0; i < 29;)
00005c 2000 MOVS r0,#0
|L20.94|
;;;653 {
;;;654 sum += buffer[i];
00005e 5c2a LDRB r2,[r5,r0]
000060 4411 ADD r1,r1,r2
000062 b2c9 UXTB r1,r1
;;;655 i++;
000064 1c40 ADDS r0,r0,#1
000066 281d CMP r0,#0x1d ;652
000068 dbf9 BLT |L20.94|
;;;656 }
;;;657 if (sum == buffer[29])
00006a 7f68 LDRB r0,[r5,#0x1d] ; buffer
00006c 4288 CMP r0,r1
00006e d141 BNE |L20.244|
;;;658 {
;;;659 imu_msg.angular_velocity_x = (getData(buffer + 18)) * 0.017453f; //Gx;//*0.017453f; //raw_msg->raw_angular_velocity.x - gyroscope_bias_["x"];
000070 4823 LDR r0,|L20.256|
000072 3012 ADDS r0,r0,#0x12
000074 f7fffffe BL getData
000078 eddf1a22 VLDR s3,|L20.260|
00007c 4c22 LDR r4,|L20.264|
00007e ee200a21 VMUL.F32 s0,s0,s3
000082 ed840a00 VSTR s0,[r4,#0]
;;;660 imu_msg.angular_velocity_y = (getData(buffer + 21)) * 0.017453f; //Gy;//*0.017453f; //raw_msg->raw_angular_velocity.y - gyroscope_bias_["y"];
000086 481e LDR r0,|L20.256|
000088 3015 ADDS r0,r0,#0x15
00008a f7fffffe BL getData
00008e ee200a21 VMUL.F32 s0,s0,s3
000092 ed840a01 VSTR s0,[r4,#4]
;;;661 imu_msg.angular_velocity_z = (getData(buffer + 24)) * 0.017453f; //*0.017453f; //raw_msg->raw_angular_velocity.z - gyroscope_bias_["z"];
000096 481a LDR r0,|L20.256|
000098 3018 ADDS r0,r0,#0x18
00009a f7fffffe BL getData
00009e ee200a21 VMUL.F32 s0,s0,s3
0000a2 ed840a02 VSTR s0,[r4,#8]
;;;662
;;;663 imu_msg.linear_acceleration_x = (_getData(buffer + 9)); //raw_msg->raw_linear_acceleration.x - acceleration_bias_["x"];
0000a6 4816 LDR r0,|L20.256|
0000a8 3009 ADDS r0,r0,#9
0000aa f7fffffe BL _getData
0000ae ed840a03 VSTR s0,[r4,#0xc]
;;;664 imu_msg.linear_acceleration_y = (_getData(buffer + 12)); //raw_msg->raw_linear_acceleration.y - acceleration_bias_["y"];
0000b2 4813 LDR r0,|L20.256|
0000b4 300c ADDS r0,r0,#0xc
0000b6 f7fffffe BL _getData
0000ba ed840a04 VSTR s0,[r4,#0x10]
;;;665 imu_msg.linear_acceleration_z = (_getData(buffer + 15)); //raw_msg->raw_linear_acceleration.z - acceleration_bias_["z"];
0000be 4810 LDR r0,|L20.256|
0000c0 300f ADDS r0,r0,#0xf
0000c2 f7fffffe BL _getData
0000c6 ed840a05 VSTR s0,[r4,#0x14]
;;;666
;;;667 imu_msg.angular_roll = getData(buffer) * 0.017453f;
0000ca 480d LDR r0,|L20.256|
0000cc f7fffffe BL getData
0000d0 ee200a21 VMUL.F32 s0,s0,s3
0000d4 ed840a06 VSTR s0,[r4,#0x18]
;;;668 imu_msg.angular_pitch = getData(buffer + 3) * 0.017453f;
0000d8 1ce8 ADDS r0,r5,#3
0000da f7fffffe BL getData
0000de ee200a21 VMUL.F32 s0,s0,s3
0000e2 ed840a07 VSTR s0,[r4,#0x1c]
;;;669 imu_msg.angular_yaw = getData(buffer + 6) * 0.017453f;
0000e6 1da8 ADDS r0,r5,#6
0000e8 f7fffffe BL getData
0000ec ee200a21 VMUL.F32 s0,s0,s3
0000f0 ed840a08 VSTR s0,[r4,#0x20]
|L20.244|
;;;670 // static u8 testCount = 0;
;;;671 // if(testCount ++ > 15)
;;;672 // {
;;;673 // Uart_Printf(COM1,"imu_msg.angular_yaw = %f\r\n",imu_msg.angular_yaw*180.0f/PI);
;;;674 // testCount = 0;
;;;675 // }
;;;676 }
;;;677 }
;;;678 }
0000f4 bd30 POP {r4,r5,pc}
|L20.246|
0000f6 604b STR r3,[r1,#4] ;640 ; step
0000f8 600b STR r3,[r1,#0] ;641 ; offset
0000fa e7ab B |L20.84|
;;;679
ENDP
|L20.252|
DCD ||.data||
|L20.256|
DCD ||.bss||
|L20.260|
000104 3c8ef998 DCFS 0x3c8ef998 ; 0.017452999949455261
|L20.264|
DCD ||.bss||+0x2068
AREA ||.bss||, DATA, NOINIT, ALIGN=2
buffer
% 70
Uart1Stu
% 2056
Uart2Stu
% 2056
Uart3Stu
% 2056
Uart6Stu
% 2058
imu_msg
% 44
AREA ||.data||, DATA, ALIGN=2
offset
DCD 0x00000000
step
DCD 0x00000000
AREA ||area_number.25||, DATA, ALIGN=2
EXPORTAS ||area_number.25||, ||.data||
__stdout
DCD 0x00000000
;*** Start embedded assembler ***
#line 1 "..\\..\\User\\bsp\\BSP\\bsp_usart.c"
AREA ||.rev16_text||, CODE
THUMB
EXPORT |__asm___11_bsp_usart_c_339aca0c____REV16|
#line 129 "..\\..\\Libraries\\CMSIS\\Include\\core_cmInstr.h"
|__asm___11_bsp_usart_c_339aca0c____REV16| PROC
#line 130
rev16 r0, r0
bx lr
ENDP
AREA ||.revsh_text||, CODE
THUMB
EXPORT |__asm___11_bsp_usart_c_339aca0c____REVSH|
#line 144
|__asm___11_bsp_usart_c_339aca0c____REVSH| PROC
#line 145
revsh r0, r0
bx lr
ENDP
AREA ||.rrx_text||, CODE
THUMB
EXPORT |__asm___11_bsp_usart_c_339aca0c____RRX|
#line 300
|__asm___11_bsp_usart_c_339aca0c____RRX| PROC
#line 301
rrx r0, r0
bx lr
ENDP
;*** End embedded assembler ***