mbfuncholding.txt
21.9 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
; 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\mbfuncholding.o --asm_dir=.\Flash\List\ --list_dir=.\Flash\List\ --depend=.\flash\obj\mbfuncholding.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\mbfuncholding.crf ..\..\MODBUS\modbus\functions\mbfuncholding.c]
THUMB
AREA ||i.eMBFuncReadHoldingRegister||, CODE, READONLY, ALIGN=1
eMBFuncReadHoldingRegister PROC
;;;169 eMBException
;;;170 eMBFuncReadHoldingRegister( UCHAR * pucFrame, USHORT * usLen )
000000 b570 PUSH {r4-r6,lr}
;;;171 {
000002 460c MOV r4,r1
;;;172 USHORT usRegAddress;
;;;173 USHORT usRegCount;
;;;174 UCHAR *pucFrameCur;
;;;175
;;;176 eMBException eStatus = MB_EX_NONE;
000004 2600 MOVS r6,#0
;;;177 eMBErrorCode eRegStatus;
;;;178
;;;179 if( *usLen == ( MB_PDU_FUNC_READ_SIZE + MB_PDU_SIZE_MIN ) )
000006 8821 LDRH r1,[r4,#0]
000008 2905 CMP r1,#5
00000a d002 BEQ |L1.18|
;;;180 {
;;;181 usRegAddress = ( USHORT )( pucFrame[MB_PDU_FUNC_READ_ADDR_OFF] << 8 );
;;;182 usRegAddress |= ( USHORT )( pucFrame[MB_PDU_FUNC_READ_ADDR_OFF + 1] );
;;;183 usRegAddress++;
;;;184
;;;185 usRegCount = ( USHORT )( pucFrame[MB_PDU_FUNC_READ_REGCNT_OFF] << 8 );
;;;186 usRegCount = ( USHORT )( pucFrame[MB_PDU_FUNC_READ_REGCNT_OFF + 1] );
;;;187
;;;188 /* Check if the number of registers to read is valid. If not
;;;189 * return Modbus illegal data value exception.
;;;190 */
;;;191 if( ( usRegCount >= 1 ) && ( usRegCount <= MB_PDU_FUNC_READ_REGCNT_MAX ) )
;;;192 {
;;;193 /* Set the current PDU data pointer to the beginning. */
;;;194 pucFrameCur = &pucFrame[MB_PDU_FUNC_OFF];
;;;195 *usLen = MB_PDU_FUNC_OFF;
;;;196
;;;197 /* First byte contains the function code. */
;;;198 *pucFrameCur++ = MB_FUNC_READ_HOLDING_REGISTER;
;;;199 *usLen += 1;
;;;200
;;;201 /* Second byte in the response contain the number of bytes. */
;;;202 *pucFrameCur++ = ( UCHAR ) ( usRegCount * 2 );
;;;203 *usLen += 1;
;;;204
;;;205 /* Make callback to fill the buffer. */
;;;206 eRegStatus = eMBRegHoldingCB( pucFrameCur, usRegAddress, usRegCount, MB_REG_READ );
;;;207 /* If an error occured convert it into a Modbus exception. */
;;;208 if( eRegStatus != MB_ENOERR )
;;;209 {
;;;210 eStatus = prveMBError2Exception( eRegStatus );
;;;211 }
;;;212 else
;;;213 {
;;;214 *usLen += usRegCount * 2;
;;;215 }
;;;216 }
;;;217 else
;;;218 {
;;;219 eStatus = MB_EX_ILLEGAL_DATA_VALUE;
;;;220 }
;;;221 }
;;;222 else
;;;223 {
;;;224 /* Can't be a valid request because the length is incorrect. */
;;;225 eStatus = MB_EX_ILLEGAL_DATA_VALUE;
00000c 2603 MOVS r6,#3
|L1.14|
;;;226 }
;;;227 return eStatus;
00000e 4630 MOV r0,r6
;;;228 }
000010 bd70 POP {r4-r6,pc}
|L1.18|
000012 7841 LDRB r1,[r0,#1] ;181
000014 020a LSLS r2,r1,#8 ;181
000016 7881 LDRB r1,[r0,#2] ;182
000018 4311 ORRS r1,r1,r2 ;182
00001a 1c49 ADDS r1,r1,#1 ;183
00001c b289 UXTH r1,r1 ;183
00001e 7905 LDRB r5,[r0,#4] ;186
000020 1e6a SUBS r2,r5,#1 ;191
000022 2a7c CMP r2,#0x7c ;191
000024 d81a BHI |L1.92|
000026 2200 MOVS r2,#0 ;195
000028 8022 STRH r2,[r4,#0] ;195
00002a 2203 MOVS r2,#3 ;198
00002c 7002 STRB r2,[r0,#0] ;198
00002e 8822 LDRH r2,[r4,#0] ;199
000030 1c52 ADDS r2,r2,#1 ;199
000032 8022 STRH r2,[r4,#0] ;199
000034 006a LSLS r2,r5,#1 ;202
000036 7042 STRB r2,[r0,#1] ;202
000038 1c80 ADDS r0,r0,#2 ;202
00003a 8822 LDRH r2,[r4,#0] ;203
00003c 1c52 ADDS r2,r2,#1 ;203
00003e 8022 STRH r2,[r4,#0] ;203
000040 2300 MOVS r3,#0 ;206
000042 462a MOV r2,r5 ;206
000044 f7fffffe BL eMBRegHoldingCB
000048 b118 CBZ r0,|L1.82|
00004a f7fffffe BL prveMBError2Exception
00004e 4606 MOV r6,r0 ;210
000050 e7dd B |L1.14|
|L1.82|
000052 8820 LDRH r0,[r4,#0] ;214
000054 eb000045 ADD r0,r0,r5,LSL #1 ;214
000058 8020 STRH r0,[r4,#0] ;214
00005a e7d8 B |L1.14|
|L1.92|
00005c 2603 MOVS r6,#3 ;219
00005e e7d6 B |L1.14|
;;;229
ENDP
AREA ||i.eMBFuncReadWriteMultipleHoldingRegister||, CODE, READONLY, ALIGN=1
eMBFuncReadWriteMultipleHoldingRegister PROC
;;;234 eMBException
;;;235 eMBFuncReadWriteMultipleHoldingRegister( UCHAR * pucFrame, USHORT * usLen )
000000 e92d41f0 PUSH {r4-r8,lr}
;;;236 {
000004 4604 MOV r4,r0
000006 460d MOV r5,r1
;;;237 USHORT usRegReadAddress;
;;;238 USHORT usRegReadCount;
;;;239 USHORT usRegWriteAddress;
;;;240 USHORT usRegWriteCount;
;;;241 UCHAR ucRegWriteByteCount;
;;;242 UCHAR *pucFrameCur;
;;;243
;;;244 eMBException eStatus = MB_EX_NONE;
000008 2700 MOVS r7,#0
;;;245 eMBErrorCode eRegStatus;
;;;246
;;;247 if( *usLen >= ( MB_PDU_FUNC_READWRITE_SIZE_MIN + MB_PDU_SIZE_MIN ) )
00000a 8828 LDRH r0,[r5,#0]
00000c 280a CMP r0,#0xa
00000e d342 BCC |L2.150|
;;;248 {
;;;249 usRegReadAddress = ( USHORT )( pucFrame[MB_PDU_FUNC_READWRITE_READ_ADDR_OFF] << 8U );
000010 7860 LDRB r0,[r4,#1]
000012 0201 LSLS r1,r0,#8
;;;250 usRegReadAddress |= ( USHORT )( pucFrame[MB_PDU_FUNC_READWRITE_READ_ADDR_OFF + 1] );
000014 78a0 LDRB r0,[r4,#2]
000016 4308 ORRS r0,r0,r1
;;;251 usRegReadAddress++;
000018 1c40 ADDS r0,r0,#1
00001a fa1ff880 UXTH r8,r0
;;;252
;;;253 usRegReadCount = ( USHORT )( pucFrame[MB_PDU_FUNC_READWRITE_READ_REGCNT_OFF] << 8U );
00001e 78e0 LDRB r0,[r4,#3]
000020 0200 LSLS r0,r0,#8
;;;254 usRegReadCount |= ( USHORT )( pucFrame[MB_PDU_FUNC_READWRITE_READ_REGCNT_OFF + 1] );
000022 7926 LDRB r6,[r4,#4]
000024 4306 ORRS r6,r6,r0
;;;255
;;;256 usRegWriteAddress = ( USHORT )( pucFrame[MB_PDU_FUNC_READWRITE_WRITE_ADDR_OFF] << 8U );
000026 7960 LDRB r0,[r4,#5]
000028 0201 LSLS r1,r0,#8
;;;257 usRegWriteAddress |= ( USHORT )( pucFrame[MB_PDU_FUNC_READWRITE_WRITE_ADDR_OFF + 1] );
00002a 79a0 LDRB r0,[r4,#6]
00002c 4308 ORRS r0,r0,r1
;;;258 usRegWriteAddress++;
00002e 1c40 ADDS r0,r0,#1
000030 b281 UXTH r1,r0
;;;259
;;;260 usRegWriteCount = ( USHORT )( pucFrame[MB_PDU_FUNC_READWRITE_WRITE_REGCNT_OFF] << 8U );
000032 79e0 LDRB r0,[r4,#7]
000034 0200 LSLS r0,r0,#8
;;;261 usRegWriteCount |= ( USHORT )( pucFrame[MB_PDU_FUNC_READWRITE_WRITE_REGCNT_OFF + 1] );
000036 7a22 LDRB r2,[r4,#8]
000038 4302 ORRS r2,r2,r0
;;;262
;;;263 ucRegWriteByteCount = pucFrame[MB_PDU_FUNC_READWRITE_BYTECNT_OFF];
00003a 7a60 LDRB r0,[r4,#9]
;;;264
;;;265 if( ( usRegReadCount >= 1 ) && ( usRegReadCount <= 0x7D ) &&
00003c 1e73 SUBS r3,r6,#1
00003e 2b7c CMP r3,#0x7c
000040 d828 BHI |L2.148|
;;;266 ( usRegWriteCount >= 1 ) && ( usRegWriteCount <= 0x79 ) &&
000042 b33a CBZ r2,|L2.148|
000044 2a79 CMP r2,#0x79
000046 d825 BHI |L2.148|
;;;267 ( ( 2 * usRegWriteCount ) == ucRegWriteByteCount ) )
000048 ebb00f42 CMP r0,r2,LSL #1
00004c d122 BNE |L2.148|
;;;268 {
;;;269 /* Make callback to update the register values. */
;;;270 eRegStatus = eMBRegHoldingCB( &pucFrame[MB_PDU_FUNC_READWRITE_WRITE_VALUES_OFF],
00004e 2301 MOVS r3,#1
000050 f104000a ADD r0,r4,#0xa
000054 f7fffffe BL eMBRegHoldingCB
;;;271 usRegWriteAddress, usRegWriteCount, MB_REG_WRITE );
;;;272
;;;273 if( eRegStatus == MB_ENOERR )
000058 b9b8 CBNZ r0,|L2.138|
;;;274 {
;;;275 /* Set the current PDU data pointer to the beginning. */
;;;276 pucFrameCur = &pucFrame[MB_PDU_FUNC_OFF];
00005a 4620 MOV r0,r4
;;;277 *usLen = MB_PDU_FUNC_OFF;
00005c 2100 MOVS r1,#0
00005e 8029 STRH r1,[r5,#0]
;;;278
;;;279 /* First byte contains the function code. */
;;;280 *pucFrameCur++ = MB_FUNC_READWRITE_MULTIPLE_REGISTERS;
000060 2117 MOVS r1,#0x17
000062 7001 STRB r1,[r0,#0]
;;;281 *usLen += 1;
000064 8829 LDRH r1,[r5,#0]
000066 1c49 ADDS r1,r1,#1
000068 8029 STRH r1,[r5,#0]
;;;282
;;;283 /* Second byte in the response contain the number of bytes. */
;;;284 *pucFrameCur++ = ( UCHAR ) ( usRegReadCount * 2 );
00006a 0071 LSLS r1,r6,#1
00006c 7041 STRB r1,[r0,#1]
00006e 1c80 ADDS r0,r0,#2
;;;285 *usLen += 1;
000070 8829 LDRH r1,[r5,#0]
000072 1c49 ADDS r1,r1,#1
000074 8029 STRH r1,[r5,#0]
;;;286
;;;287 /* Make the read callback. */
;;;288 eRegStatus =
000076 2300 MOVS r3,#0
000078 4632 MOV r2,r6
00007a 4641 MOV r1,r8
00007c f7fffffe BL eMBRegHoldingCB
;;;289 eMBRegHoldingCB( pucFrameCur, usRegReadAddress, usRegReadCount, MB_REG_READ );
;;;290 if( eRegStatus == MB_ENOERR )
000080 b918 CBNZ r0,|L2.138|
;;;291 {
;;;292 *usLen += 2 * usRegReadCount;
000082 8829 LDRH r1,[r5,#0]
000084 eb010146 ADD r1,r1,r6,LSL #1
000088 8029 STRH r1,[r5,#0]
|L2.138|
;;;293 }
;;;294 }
;;;295 if( eRegStatus != MB_ENOERR )
00008a b120 CBZ r0,|L2.150|
;;;296 {
;;;297 eStatus = prveMBError2Exception( eRegStatus );
00008c f7fffffe BL prveMBError2Exception
000090 4607 MOV r7,r0
000092 e000 B |L2.150|
|L2.148|
;;;298 }
;;;299 }
;;;300 else
;;;301 {
;;;302 eStatus = MB_EX_ILLEGAL_DATA_VALUE;
000094 2703 MOVS r7,#3
|L2.150|
;;;303 }
;;;304 }
;;;305 return eStatus;
000096 4638 MOV r0,r7
;;;306 }
000098 e8bd81f0 POP {r4-r8,pc}
;;;307
ENDP
AREA ||i.eMBFuncWriteHoldingRegister||, CODE, READONLY, ALIGN=1
eMBFuncWriteHoldingRegister PROC
;;;76 eMBException
;;;77 eMBFuncWriteHoldingRegister( UCHAR * pucFrame, USHORT * usLen )
000000 b510 PUSH {r4,lr}
;;;78 {
;;;79 USHORT usRegAddress;
;;;80 eMBException eStatus = MB_EX_NONE;
000002 2400 MOVS r4,#0
;;;81 eMBErrorCode eRegStatus;
;;;82
;;;83 if( *usLen == ( MB_PDU_FUNC_WRITE_SIZE + MB_PDU_SIZE_MIN ) )
000004 8809 LDRH r1,[r1,#0]
000006 2905 CMP r1,#5
000008 d002 BEQ |L3.16|
;;;84 {
;;;85 usRegAddress = ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_ADDR_OFF] << 8 );
;;;86 usRegAddress |= ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_ADDR_OFF + 1] );
;;;87 usRegAddress++;
;;;88
;;;89 /* Make callback to update the value. */
;;;90 eRegStatus = eMBRegHoldingCB( &pucFrame[MB_PDU_FUNC_WRITE_VALUE_OFF],
;;;91 usRegAddress, 1, MB_REG_WRITE );
;;;92
;;;93 /* If an error occured convert it into a Modbus exception. */
;;;94 if( eRegStatus != MB_ENOERR )
;;;95 {
;;;96 eStatus = prveMBError2Exception( eRegStatus );
;;;97 }
;;;98 }
;;;99 else
;;;100 {
;;;101 /* Can't be a valid request because the length is incorrect. */
;;;102 eStatus = MB_EX_ILLEGAL_DATA_VALUE;
00000a 2403 MOVS r4,#3
|L3.12|
;;;103 }
;;;104 return eStatus;
00000c 4620 MOV r0,r4
;;;105 }
00000e bd10 POP {r4,pc}
|L3.16|
000010 7841 LDRB r1,[r0,#1] ;85
000012 020a LSLS r2,r1,#8 ;85
000014 7881 LDRB r1,[r0,#2] ;86
000016 4311 ORRS r1,r1,r2 ;86
000018 1c49 ADDS r1,r1,#1 ;87
00001a b289 UXTH r1,r1 ;87
00001c 2301 MOVS r3,#1 ;90
00001e 461a MOV r2,r3 ;90
000020 1cc0 ADDS r0,r0,#3 ;90
000022 f7fffffe BL eMBRegHoldingCB
000026 2800 CMP r0,#0 ;94
000028 d0f0 BEQ |L3.12|
00002a f7fffffe BL prveMBError2Exception
00002e 4604 MOV r4,r0 ;96
000030 e7ec B |L3.12|
;;;106 #endif
ENDP
AREA ||i.eMBFuncWriteMultipleHoldingRegister||, CODE, READONLY, ALIGN=1
eMBFuncWriteMultipleHoldingRegister PROC
;;;109 eMBException
;;;110 eMBFuncWriteMultipleHoldingRegister( UCHAR * pucFrame, USHORT * usLen )
000000 b570 PUSH {r4-r6,lr}
;;;111 {
000002 460d MOV r5,r1
;;;112 USHORT usRegAddress;
;;;113 USHORT usRegCount;
;;;114 UCHAR ucRegByteCount;
;;;115
;;;116 eMBException eStatus = MB_EX_NONE;
000004 2400 MOVS r4,#0
;;;117 eMBErrorCode eRegStatus;
;;;118
;;;119 if( *usLen >= ( MB_PDU_FUNC_WRITE_MUL_SIZE_MIN + MB_PDU_SIZE_MIN ) )
000006 8829 LDRH r1,[r5,#0]
000008 2906 CMP r1,#6
00000a d31f BCC |L4.76|
;;;120 {
;;;121 usRegAddress = ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_MUL_ADDR_OFF] << 8 );
00000c 7841 LDRB r1,[r0,#1]
00000e 0209 LSLS r1,r1,#8
;;;122 usRegAddress |= ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_MUL_ADDR_OFF + 1] );
000010 7882 LDRB r2,[r0,#2]
000012 430a ORRS r2,r2,r1
;;;123 usRegAddress++;
000014 1c52 ADDS r2,r2,#1
000016 b291 UXTH r1,r2
;;;124
;;;125 usRegCount = ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_MUL_REGCNT_OFF] << 8 );
000018 78c2 LDRB r2,[r0,#3]
00001a 0213 LSLS r3,r2,#8
;;;126 usRegCount |= ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_MUL_REGCNT_OFF + 1] );
00001c 7902 LDRB r2,[r0,#4]
00001e 431a ORRS r2,r2,r3
;;;127
;;;128 ucRegByteCount = pucFrame[MB_PDU_FUNC_WRITE_MUL_BYTECNT_OFF];
000020 7943 LDRB r3,[r0,#5]
;;;129
;;;130 if( ( usRegCount >= 1 ) &&
000022 1e56 SUBS r6,r2,#1
000024 2e77 CMP r6,#0x77
000026 d80f BHI |L4.72|
;;;131 ( usRegCount <= MB_PDU_FUNC_WRITE_MUL_REGCNT_MAX ) &&
;;;132 ( ucRegByteCount == ( UCHAR ) ( 2 * usRegCount ) ) )
000028 0656 LSLS r6,r2,#25
00002a 0e36 LSRS r6,r6,#24
00002c 429e CMP r6,r3
00002e d10b BNE |L4.72|
;;;133 {
;;;134 /* Make callback to update the register values. */
;;;135 eRegStatus =
000030 2301 MOVS r3,#1
000032 1d80 ADDS r0,r0,#6
000034 f7fffffe BL eMBRegHoldingCB
;;;136 eMBRegHoldingCB( &pucFrame[MB_PDU_FUNC_WRITE_MUL_VALUES_OFF],
;;;137 usRegAddress, usRegCount, MB_REG_WRITE );
;;;138
;;;139 /* If an error occured convert it into a Modbus exception. */
;;;140 if( eRegStatus != MB_ENOERR )
000038 b118 CBZ r0,|L4.66|
;;;141 {
;;;142 eStatus = prveMBError2Exception( eRegStatus );
00003a f7fffffe BL prveMBError2Exception
00003e 4604 MOV r4,r0
000040 e005 B |L4.78|
|L4.66|
;;;143 }
;;;144 else
;;;145 {
;;;146 /* The response contains the function code, the starting
;;;147 * address and the quantity of registers. We reuse the
;;;148 * old values in the buffer because they are still valid.
;;;149 */
;;;150 *usLen = MB_PDU_FUNC_WRITE_MUL_BYTECNT_OFF;
000042 2005 MOVS r0,#5
000044 8028 STRH r0,[r5,#0]
000046 e002 B |L4.78|
|L4.72|
;;;151 }
;;;152 }
;;;153 else
;;;154 {
;;;155 eStatus = MB_EX_ILLEGAL_DATA_VALUE;
000048 2403 MOVS r4,#3
00004a e000 B |L4.78|
|L4.76|
;;;156 }
;;;157 }
;;;158 else
;;;159 {
;;;160 /* Can't be a valid request because the length is incorrect. */
;;;161 eStatus = MB_EX_ILLEGAL_DATA_VALUE;
00004c 2403 MOVS r4,#3
|L4.78|
;;;162 }
;;;163 return eStatus;
00004e 4620 MOV r0,r4
;;;164 }
000050 bd70 POP {r4-r6,pc}
;;;165 #endif
ENDP
;*** Start embedded assembler ***
#line 1 "..\\..\\MODBUS\\modbus\\functions\\mbfuncholding.c"
AREA ||.rev16_text||, CODE
THUMB
EXPORT |__asm___15_mbfuncholding_c_ea59194a____REV16|
#line 129 "..\\..\\Libraries\\CMSIS\\Include\\core_cmInstr.h"
|__asm___15_mbfuncholding_c_ea59194a____REV16| PROC
#line 130
rev16 r0, r0
bx lr
ENDP
AREA ||.revsh_text||, CODE
THUMB
EXPORT |__asm___15_mbfuncholding_c_ea59194a____REVSH|
#line 144
|__asm___15_mbfuncholding_c_ea59194a____REVSH| PROC
#line 145
revsh r0, r0
bx lr
ENDP
AREA ||.rrx_text||, CODE
THUMB
EXPORT |__asm___15_mbfuncholding_c_ea59194a____RRX|
#line 300
|__asm___15_mbfuncholding_c_ea59194a____RRX| PROC
#line 301
rrx r0, r0
bx lr
ENDP
;*** End embedded assembler ***