mbutils.txt
9.53 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
; 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\mbutils.o --asm_dir=.\Flash\List\ --list_dir=.\Flash\List\ --depend=.\flash\obj\mbutils.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\mbutils.crf ..\..\MODBUS\modbus\functions\mbutils.c]
THUMB
AREA ||i.prveMBError2Exception||, CODE, READONLY, ALIGN=1
prveMBError2Exception PROC
;;;116 eMBException
;;;117 prveMBError2Exception( eMBErrorCode eErrorCode )
000000 2800 CMP r0,#0
;;;118 {
000002 d005 BEQ |L1.16|
;;;119 eMBException eStatus;
;;;120
;;;121 switch ( eErrorCode )
000004 2801 CMP r0,#1
000006 d005 BEQ |L1.20|
000008 2807 CMP r0,#7
00000a d005 BEQ |L1.24|
;;;122 {
;;;123 case MB_ENOERR:
;;;124 eStatus = MB_EX_NONE;
;;;125 break;
;;;126
;;;127 case MB_ENOREG:
;;;128 eStatus = MB_EX_ILLEGAL_DATA_ADDRESS;
;;;129 break;
;;;130
;;;131 case MB_ETIMEDOUT:
;;;132 eStatus = MB_EX_SLAVE_BUSY;
;;;133 break;
;;;134
;;;135 default:
;;;136 eStatus = MB_EX_SLAVE_DEVICE_FAILURE;
00000c 2004 MOVS r0,#4
;;;137 break;
;;;138 }
;;;139
;;;140 return eStatus;
;;;141 }
00000e 4770 BX lr
|L1.16|
000010 2000 MOVS r0,#0 ;124
000012 4770 BX lr
|L1.20|
000014 2002 MOVS r0,#2 ;128
000016 4770 BX lr
|L1.24|
000018 2006 MOVS r0,#6 ;132
00001a 4770 BX lr
ENDP
AREA ||i.xMBUtilGetBits||, CODE, READONLY, ALIGN=1
xMBUtilGetBits PROC
;;;85 UCHAR
;;;86 xMBUtilGetBits( UCHAR * ucByteBuf, USHORT usBitOffset, UCHAR ucNBits )
000000 b510 PUSH {r4,lr}
;;;87 {
;;;88 USHORT usWordBuf;
;;;89 USHORT usMask;
;;;90 USHORT usByteOffset;
;;;91 USHORT usNPreBits;
;;;92
;;;93 /* Calculate byte offset for first byte containing the bit values starting
;;;94 * at usBitOffset. */
;;;95 usByteOffset = ( USHORT )( ( usBitOffset ) / BITS_UCHAR );
000002 08cb LSRS r3,r1,#3
;;;96
;;;97 /* How many bits precede our bits to set. */
;;;98 usNPreBits = ( USHORT )( usBitOffset - usByteOffset * BITS_UCHAR );
000004 425c RSBS r4,r3,#0
000006 eb0101c4 ADD r1,r1,r4,LSL #3
;;;99
;;;100 /* Prepare a mask for setting the new bits. */
;;;101 usMask = ( USHORT )( ( 1 << ( USHORT ) ucNBits ) - 1 );
00000a 2401 MOVS r4,#1
00000c 4094 LSLS r4,r4,r2
00000e 1e64 SUBS r4,r4,#1
;;;102
;;;103 /* copy bits into temporary storage. */
;;;104 usWordBuf = ucByteBuf[usByteOffset];
000010 5cc2 LDRB r2,[r0,r3]
;;;105 usWordBuf |= ucByteBuf[usByteOffset + 1] << BITS_UCHAR;
000012 4418 ADD r0,r0,r3
000014 7840 LDRB r0,[r0,#1]
000016 ea422000 ORR r0,r2,r0,LSL #8
;;;106
;;;107 /* throw away unneeded bits. */
;;;108 usWordBuf >>= usNPreBits;
00001a 40c8 LSRS r0,r0,r1
;;;109
;;;110 /* mask away bits above the requested bitfield. */
;;;111 usWordBuf &= usMask;
00001c 4020 ANDS r0,r0,r4
;;;112
;;;113 return ( UCHAR ) usWordBuf;
00001e b2c0 UXTB r0,r0
;;;114 }
000020 bd10 POP {r4,pc}
;;;115
ENDP
AREA ||i.xMBUtilSetBits||, CODE, READONLY, ALIGN=2
xMBUtilSetBits PROC
;;;46 void
;;;47 xMBUtilSetBits( UCHAR * ucByteBuf, USHORT usBitOffset, UCHAR ucNBits,
000000 b570 PUSH {r4-r6,lr}
;;;48 UCHAR ucValue )
;;;49 {
;;;50 USHORT usWordBuf;
;;;51 USHORT usMask;
;;;52 USHORT usByteOffset;
;;;53 USHORT usNPreBits;
;;;54 USHORT usValue = ucValue;
;;;55
;;;56 assert( ucNBits <= 8 );
000002 2a08 CMP r2,#8
000004 d813 BHI |L3.46|
;;;57 assert( ( size_t )BITS_UCHAR == sizeof( UCHAR ) * 8 );
;;;58
;;;59 /* Calculate byte offset for first byte containing the bit values starting
;;;60 * at usBitOffset. */
;;;61 usByteOffset = ( USHORT )( ( usBitOffset ) / BITS_UCHAR );
000006 08cc LSRS r4,r1,#3
;;;62
;;;63 /* How many bits precede our bits to set. */
;;;64 usNPreBits = ( USHORT )( usBitOffset - usByteOffset * BITS_UCHAR );
000008 4265 RSBS r5,r4,#0
00000a eb0101c5 ADD r1,r1,r5,LSL #3
;;;65
;;;66 /* Move bit field into position over bits to set */
;;;67 usValue <<= usNPreBits;
00000e 408b LSLS r3,r3,r1
;;;68
;;;69 /* Prepare a mask for setting the new bits. */
;;;70 usMask = ( USHORT )( ( 1 << ( USHORT ) ucNBits ) - 1 );
000010 2501 MOVS r5,#1
000012 4095 LSLS r5,r5,r2
000014 1e6d SUBS r5,r5,#1
;;;71 usMask <<= usBitOffset - usByteOffset * BITS_UCHAR;
000016 408d LSLS r5,r5,r1
;;;72
;;;73 /* copy bits into temporary storage. */
;;;74 usWordBuf = ucByteBuf[usByteOffset];
000018 5d01 LDRB r1,[r0,r4]
;;;75 usWordBuf |= ucByteBuf[usByteOffset + 1] << BITS_UCHAR;
00001a 1902 ADDS r2,r0,r4
00001c 7856 LDRB r6,[r2,#1]
00001e ea412106 ORR r1,r1,r6,LSL #8
;;;76
;;;77 /* Zero out bit field bits and then or value bits into them. */
;;;78 usWordBuf = ( USHORT )( ( usWordBuf & ( ~usMask ) ) | usValue );
000022 43a9 BICS r1,r1,r5
000024 4319 ORRS r1,r1,r3
;;;79
;;;80 /* move bits back into storage */
;;;81 ucByteBuf[usByteOffset] = ( UCHAR )( usWordBuf & 0xFF );
000026 5501 STRB r1,[r0,r4]
;;;82 ucByteBuf[usByteOffset + 1] = ( UCHAR )( usWordBuf >> BITS_UCHAR );
000028 0a08 LSRS r0,r1,#8
00002a 7050 STRB r0,[r2,#1]
;;;83 }
00002c bd70 POP {r4-r6,pc}
|L3.46|
00002e 2238 MOVS r2,#0x38 ;56
000030 a101 ADR r1,|L3.56|
000032 a00b ADR r0,|L3.96|
000034 f7fffffe BL __aeabi_assert
;;;84
ENDP
|L3.56|
000038 2e2e5c2e DCB "..\\..\\MODBUS\\modbus\\functions\\mbutils.c",0
00003c 2e5c4d4f
000040 44425553
000044 5c6d6f64
000048 6275735c
00004c 66756e63
000050 74696f6e
000054 735c6d62
000058 7574696c
00005c 732e6300
|L3.96|
000060 75634e42 DCB "ucNBits <= 8",0
000064 69747320
000068 3c3d2038
00006c 00
00006d 00 DCB 0
00006e 00 DCB 0
00006f 00 DCB 0
;*** Start embedded assembler ***
#line 1 "..\\..\\MODBUS\\modbus\\functions\\mbutils.c"
AREA ||.rev16_text||, CODE
THUMB
EXPORT |__asm___9_mbutils_c_1da90d20____REV16|
#line 129 "..\\..\\Libraries\\CMSIS\\Include\\core_cmInstr.h"
|__asm___9_mbutils_c_1da90d20____REV16| PROC
#line 130
rev16 r0, r0
bx lr
ENDP
AREA ||.revsh_text||, CODE
THUMB
EXPORT |__asm___9_mbutils_c_1da90d20____REVSH|
#line 144
|__asm___9_mbutils_c_1da90d20____REVSH| PROC
#line 145
revsh r0, r0
bx lr
ENDP
AREA ||.rrx_text||, CODE
THUMB
EXPORT |__asm___9_mbutils_c_1da90d20____RRX|
#line 300
|__asm___9_mbutils_c_1da90d20____RRX| PROC
#line 301
rrx r0, r0
bx lr
ENDP
;*** End embedded assembler ***