mbfuncinput.txt
7.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
; 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\mbfuncinput.o --asm_dir=.\Flash\List\ --list_dir=.\Flash\List\ --depend=.\flash\obj\mbfuncinput.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\mbfuncinput.crf ..\..\MODBUS\modbus\functions\mbfuncinput.c]
THUMB
AREA ||i.eMBFuncReadInputRegister||, CODE, READONLY, ALIGN=1
eMBFuncReadInputRegister PROC
;;;58 eMBException
;;;59 eMBFuncReadInputRegister( UCHAR * pucFrame, USHORT * usLen )
000000 b570 PUSH {r4-r6,lr}
;;;60 {
000002 460c MOV r4,r1
;;;61 USHORT usRegAddress;
;;;62 USHORT usRegCount;
;;;63 UCHAR *pucFrameCur;
;;;64
;;;65 eMBException eStatus = MB_EX_NONE;
000004 2600 MOVS r6,#0
;;;66 eMBErrorCode eRegStatus;
;;;67
;;;68 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|
;;;69 {
;;;70 usRegAddress = ( USHORT )( pucFrame[MB_PDU_FUNC_READ_ADDR_OFF] << 8 );
;;;71 usRegAddress |= ( USHORT )( pucFrame[MB_PDU_FUNC_READ_ADDR_OFF + 1] );
;;;72 usRegAddress++;
;;;73
;;;74 usRegCount = ( USHORT )( pucFrame[MB_PDU_FUNC_READ_REGCNT_OFF] << 8 );
;;;75 usRegCount |= ( USHORT )( pucFrame[MB_PDU_FUNC_READ_REGCNT_OFF + 1] );
;;;76
;;;77 /* Check if the number of registers to read is valid. If not
;;;78 * return Modbus illegal data value exception.
;;;79 */
;;;80 if( ( usRegCount >= 1 )
;;;81 && ( usRegCount < MB_PDU_FUNC_READ_REGCNT_MAX ) )
;;;82 {
;;;83 /* Set the current PDU data pointer to the beginning. */
;;;84 pucFrameCur = &pucFrame[MB_PDU_FUNC_OFF];
;;;85 *usLen = MB_PDU_FUNC_OFF;
;;;86
;;;87 /* First byte contains the function code. */
;;;88 *pucFrameCur++ = MB_FUNC_READ_INPUT_REGISTER;
;;;89 *usLen += 1;
;;;90
;;;91 /* Second byte in the response contain the number of bytes. */
;;;92 *pucFrameCur++ = ( UCHAR )( usRegCount * 2 );
;;;93 *usLen += 1;
;;;94
;;;95 eRegStatus =
;;;96 eMBRegInputCB( pucFrameCur, usRegAddress, usRegCount );
;;;97
;;;98 /* If an error occured convert it into a Modbus exception. */
;;;99 if( eRegStatus != MB_ENOERR )
;;;100 {
;;;101 eStatus = prveMBError2Exception( eRegStatus );
;;;102 }
;;;103 else
;;;104 {
;;;105 *usLen += usRegCount * 2;
;;;106 }
;;;107 }
;;;108 else
;;;109 {
;;;110 eStatus = MB_EX_ILLEGAL_DATA_VALUE;
;;;111 }
;;;112 }
;;;113 else
;;;114 {
;;;115 /* Can't be a valid read input register request because the length
;;;116 * is incorrect. */
;;;117 eStatus = MB_EX_ILLEGAL_DATA_VALUE;
00000c 2603 MOVS r6,#3
|L1.14|
;;;118 }
;;;119 return eStatus;
00000e 4630 MOV r0,r6
;;;120 }
000010 bd70 POP {r4-r6,pc}
|L1.18|
000012 7841 LDRB r1,[r0,#1] ;70
000014 020a LSLS r2,r1,#8 ;70
000016 7881 LDRB r1,[r0,#2] ;71
000018 4311 ORRS r1,r1,r2 ;71
00001a 1c49 ADDS r1,r1,#1 ;72
00001c b289 UXTH r1,r1 ;72
00001e 78c2 LDRB r2,[r0,#3] ;74
000020 0212 LSLS r2,r2,#8 ;74
000022 7905 LDRB r5,[r0,#4] ;75
000024 4315 ORRS r5,r5,r2 ;75
000026 1e6a SUBS r2,r5,#1 ;80
000028 2a7c CMP r2,#0x7c ;80
00002a d219 BCS |L1.96|
00002c 2200 MOVS r2,#0 ;85
00002e 8022 STRH r2,[r4,#0] ;85
000030 2204 MOVS r2,#4 ;88
000032 7002 STRB r2,[r0,#0] ;88
000034 8822 LDRH r2,[r4,#0] ;89
000036 1c52 ADDS r2,r2,#1 ;89
000038 8022 STRH r2,[r4,#0] ;89
00003a 006a LSLS r2,r5,#1 ;92
00003c 7042 STRB r2,[r0,#1] ;92
00003e 1c80 ADDS r0,r0,#2 ;92
000040 8822 LDRH r2,[r4,#0] ;93
000042 1c52 ADDS r2,r2,#1 ;93
000044 8022 STRH r2,[r4,#0] ;93
000046 462a MOV r2,r5 ;95
000048 f7fffffe BL eMBRegInputCB
00004c b118 CBZ r0,|L1.86|
00004e f7fffffe BL prveMBError2Exception
000052 4606 MOV r6,r0 ;101
000054 e7db B |L1.14|
|L1.86|
000056 8820 LDRH r0,[r4,#0] ;105
000058 eb000045 ADD r0,r0,r5,LSL #1 ;105
00005c 8020 STRH r0,[r4,#0] ;105
00005e e7d6 B |L1.14|
|L1.96|
000060 2603 MOVS r6,#3 ;110
000062 e7d4 B |L1.14|
;;;121
ENDP
;*** Start embedded assembler ***
#line 1 "..\\..\\MODBUS\\modbus\\functions\\mbfuncinput.c"
AREA ||.rev16_text||, CODE
THUMB
EXPORT |__asm___13_mbfuncinput_c_35de6167____REV16|
#line 129 "..\\..\\Libraries\\CMSIS\\Include\\core_cmInstr.h"
|__asm___13_mbfuncinput_c_35de6167____REV16| PROC
#line 130
rev16 r0, r0
bx lr
ENDP
AREA ||.revsh_text||, CODE
THUMB
EXPORT |__asm___13_mbfuncinput_c_35de6167____REVSH|
#line 144
|__asm___13_mbfuncinput_c_35de6167____REVSH| PROC
#line 145
revsh r0, r0
bx lr
ENDP
AREA ||.rrx_text||, CODE
THUMB
EXPORT |__asm___13_mbfuncinput_c_35de6167____RRX|
#line 300
|__asm___13_mbfuncinput_c_35de6167____RRX| PROC
#line 301
rrx r0, r0
bx lr
ENDP
;*** End embedded assembler ***