📄 probe_rs232.lst
字号:
\ 00000003 DS8 1
\ 00000004 DS8 2
\ 00000006 DS8 2
\ 00000008 DS8 2
\ 0000000A DS8 2
\ CPU_INT32U __data ProbeRS232_RxCtr
\ ProbeRS232_RxCtr:
\ 0000000C DS8 4
\ CPU_INT32U __data ProbeRS232_TxCtr
\ ProbeRS232_TxCtr:
\ 00000010 DS8 4
149 static CPU_INT16U ProbeRS232_RxRemainLen; /* Remaining bytes of data to read. */
150
151 /* ----------------- RX PKT VARIABLES ----------------- */
152 static CPU_INT16U ProbeRS232_RxLen; /* Length of data in current pkt. */
\ In segment DATA_Z, align 4, align-sorted
153 static CPU_INT08U ProbeRS232_RxBuf[PROBE_RS232_RX_BUF_SIZE]; /* Data of current pkt. */
\ ProbeRS232_RxBuf:
\ 00000000 DS8 128
154 #if (PROBE_RS232_USE_CHECKSUM == DEF_TRUE)
155 static CPU_INT08U ProbeRS232_RxChkSum; /* Checksum of current pkt. */
156 #endif
157
158 /* --------------- RX DATA BUF VARIABLE --------------- */
\ In segment DATA_Z, align 2, align-sorted
159 static CPU_INT16U ProbeRS232_RxBufWrIx; /* Index of next write; also number of bytes in buf. */
\ ProbeRS232_RxBufWrIx:
\ 00000000 DS8 2
160
161 /* ---------------- TX STATE VARIABLES ---------------- */
162 static CPU_INT08U ProbeRS232_TxState; /* Current state of TX state machine. */
163 static CPU_BOOLEAN ProbeRS232_TxActiveFlag; /* Indicates TX is currently active. */
164
165 /* ----------------- TX PKT VARIABLES ----------------- */
166 static CPU_INT16U ProbeRS232_TxLen; /* Length of data in current pkt. */
\ In segment DATA_Z, align 4, align-sorted
167 static CPU_INT08U ProbeRS232_TxBuf[PROBE_RS232_TX_BUF_SIZE]; /* Data of current pkt. */
\ ProbeRS232_TxBuf:
\ 00000000 DS8 128
168 #if (PROBE_RS232_USE_CHECKSUM == DEF_TRUE)
169 static CPU_INT08U ProbeRS232_TxChkSum; /* Checksum of current pkt. */
170 #endif
171
172 /* --------------- TX DATA BUF VARIABLES -------------- */
173 static CPU_BOOLEAN ProbeRS232_TxBufInUse; /* Indicates TX buf currently holds a pkt. */
174 static CPU_INT16U ProbeRS232_TxBufRdIx; /* Index of next read. */
175
176
177
178 /*
179 *********************************************************************************************************
180 * LOCAL FUNCTION PROTOTYPES
181 *********************************************************************************************************
182 */
183
184 static CPU_INT16U ProbeRS232_ParseRxPkt(void);
185
186 static void ProbeRS232_RxPkt (void);
187
188 static void ProbeRS232_RxStoINT8U(CPU_INT08U rx_data);
189
190 static void ProbeRS232_RxBufClr (void);
191
192 static void ProbeRS232_TxStart (void);
193
194
195 /*
196 *********************************************************************************************************
197 * LOCAL CONFIGURATION ERRORS
198 *********************************************************************************************************
199 */
200
201
202 /*
203 *********************************************************************************************************
204 * ProbeRS232_Init()
205 *
206 * Description : Initialize the RS-232 communication module.
207 *
208 * Argument(s) : baud_rate The RS-232 baud rate which will be passed to the hardware initialization.
209 *
210 * Return(s) : none.
211 *
212 * Caller(s) : Application.
213 *
214 * Note(s) : none.
215 *********************************************************************************************************
216 */
217
\ In segment CODE, align 4, keep-with-next
218 void ProbeRS232_Init (CPU_INT32U baud_rate)
219 {
\ ProbeRS232_Init:
\ 00000000 10B5 PUSH {R4,LR}
\ 00000002 0400 MOVS R4,R0
220 ProbeRS232_RxState = PROBE_RS232_RX_STATE_SD0; /* Setup Rx and Tx state machines. */
\ 00000004 0020 MOVS R0,#+0
\ 00000006 .... LDR.N R1,??DataTable4 ;; ProbeRS232_RxState
\ 00000008 0200 MOVS R2,R0
\ 0000000A 0A70 STRB R2,[R1, #+0]
221 ProbeRS232_TxState = PROBE_RS232_TX_STATE_SD0;
\ 0000000C 4A70 STRB R2,[R1, #+1]
222
223 ProbeRS232_TxLen = 0;
\ 0000000E 0A81 STRH R2,[R1, #+8]
224 ProbeRS232_TxActiveFlag = DEF_FALSE;
\ 00000010 8A70 STRB R2,[R1, #+2]
225 ProbeRS232_TxBufInUse = DEF_FALSE;
\ 00000012 CA70 STRB R2,[R1, #+3]
226
227 #if (PROBE_COM_STAT_EN == DEF_ENABLED)
228 ProbeRS232_RxCtr = 0;
\ 00000014 C860 STR R0,[R1, #+12]
229 ProbeRS232_TxCtr = 0;
\ 00000016 0861 STR R0,[R1, #+16]
230 #endif
231
232 #if (PROBE_RS232_PARSE_TASK == DEF_TRUE)
233 ProbeRS232_OS_Init();
\ 00000018 ........ _BLF ProbeRS232_OS_Init,??ProbeRS232_OS_Init??rT
234 #endif
235
236 ProbeRS232_InitTarget(baud_rate); /* Initialize target specific code. */
\ 0000001C 2000 MOVS R0,R4
\ 0000001E ........ _BLF ProbeRS232_InitTarget,??ProbeRS232_InitTarget??rT
237 }
\ 00000022 10BD POP {R4,PC} ;; return
238
239
240 /*
241 *********************************************************************************************************
242 * ProbeRS232_Task()
243 *
244 * Description : The task which parses the received packet, forms a response, and begins transmission.
245 *
246 * Argument(s) : p_arg The argument passed to 'ProbeRS232_Task()' by 'ProbeRS232_OS_Task()'.
247 *
248 * Return(s) : none.
249 *
250 * Caller(s) : ProbeRS232_OS_Task().
251 *
252 * Note(s) : none.
253 *********************************************************************************************************
254 */
255
256 #if (PROBE_RS232_PARSE_TASK == DEF_TRUE)
\ In segment CODE, align 4, keep-with-next
257 void ProbeRS232_Task (void *p_arg)
258 {
\ ProbeRS232_Task:
\ 00000000 00B5 PUSH {LR}
259 CPU_INT16U len;
260
261
262 (void)p_arg;
263
264 while (DEF_TRUE) {
265 ProbeRS232_OS_Pend(); /* Wait for a packet to be received. */
\ ??ProbeRS232_Task_0:
\ 00000002 ........ _BLF ProbeRS232_OS_Pend,??ProbeRS232_OS_Pend??rT
266
267 len = ProbeRS232_ParseRxPkt(); /* Parse packet and formulate a response. */
\ 00000006 ........ BL ProbeRS232_ParseRxPkt
268
269 if (len > 0) { /* If we have a response. */
\ 0000000A 0100 MOVS R1,R0
\ 0000000C F9D0 BEQ.N ??ProbeRS232_Task_0
270 ProbeRS232_TxLen = len;
\ 0000000E 0249 LDR.N R1,??ProbeRS232_Task_1 ;; ProbeRS232_RxState + 8
\ 00000010 0880 STRH R0,[R1, #+0]
271 ProbeRS232_TxStart();
\ 00000012 ........ BL ProbeRS232_TxStart
\ 00000016 F4E7 B.N ??ProbeRS232_Task_0
\ ??ProbeRS232_Task_1:
\ 00000018 ........ DC32 ProbeRS232_RxState + 8
272 }
273 }
274 }
275 #endif
276
277
278 /*
279 *********************************************************************************************************
280 *********************************************************************************************************
281 * RX & TX HANDLERS
282 *********************************************************************************************************
283 *********************************************************************************************************
284 */
285
286 /*
287 *********************************************************************************************************
288 * ProbeRS232_RxHandler()
289 *
290 * Description : Handle a received byte.
291 *
292 * Argument(s) : rx_data Received data byte.
293 *
294 * Return(s) : none.
295 *
296 * Caller(s) : Rx ISR.
297 *
298 * Note(s) : none.
299 *********************************************************************************************************
300 */
301
\ In segment CODE, align 4, keep-with-next
302 void ProbeRS232_RxHandler (CPU_INT08U rx_data)
303 {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -