📄 probe_rs232.lst
字号:
272
273
274 /*
275 *********************************************************************************************************
276 *********************************************************************************************************
277 ** Rx and Tx Handlers
278 *********************************************************************************************************
279 *********************************************************************************************************
280 */
281
282 /*
283 *********************************************************************************************************
284 * Rx Handler
285 *
286 * Description: This routine is called from the Rx interrupt service handler.
287 *
288 * Argument(s): rx_data is a received data byte.
289 *
290 * Returns : None
291 *********************************************************************************************************
292 */
293
\ In segment CODE, align 4, keep-with-next
294 void ProbeRS232_RxHandler (CPU_INT08U rx_data)
295 {
\ ProbeRS232_RxHandler:
\ 00000000 F0B5 PUSH {R4-R7,LR}
296 ProbeRS232_RxCtr++;
\ 00000002 .... LDR.N R4,??DataTable4 ;; ProbeRS232_RxState
\ 00000004 2169 LDR R1,[R4, #+16]
\ 00000006 491C ADDS R1,R1,#+1
\ 00000008 2161 STR R1,[R4, #+16]
297
298 switch (ProbeRS232_RxState) {
\ 0000000A 6178 LDRB R1,[R4, #+1]
\ 0000000C 0D18 ADDS R5,R1,R0
\ 0000000E E688 LDRH R6,[R4, #+6]
\ 00000010 0100 MOVS R1,R0
\ 00000012 0027 MOVS R7,#+0
\ 00000014 2278 LDRB R2,[R4, #+0]
\ 00000016 0A2A CMP R2,#+10
\ 00000018 53D8 BHI.N ??ProbeRS232_RxHandler_1
\ 0000001A DFE802F0 TBB [PC, R2]
\ ??ProbeRS232_RxHandler_0:
\ 0000001E 060D141B DC8 +6,+13,+20,+27
\ 00000022 22273437 DC8 +34,+39,+52,+55
\ 00000026 3A454900 DC8 +58,+69,+73,+0
299
300 case PROBE_RS232_RX_STATE_SD0: /* Receive the start first start delimiter (SD0) */
301 if (rx_data == PROBE_RS232_PROTOCOL_RX_SD0) {
\ ??ProbeRS232_RxHandler_2:
\ 0000002A 7528 CMP R0,#+117
\ 0000002C 4AD1 BNE.N ??ProbeRS232_RxHandler_3
302 ProbeRS232_RxState = PROBE_RS232_RX_STATE_SD1;
\ 0000002E 0120 MOVS R0,#+1
\ 00000030 2070 STRB R0,[R4, #+0]
303 ProbeRS232_RxBufClr();
\ 00000032 ........ BL ProbeRS232_RxBufClr
\ 00000036 F0BD POP {R4-R7,PC}
304 }
305 break;
306
307 case PROBE_RS232_RX_STATE_SD1: /* Receive the start second start delimiter (SD1) */
308 if (rx_data == PROBE_RS232_PROTOCOL_RX_SD1) {
\ ??ProbeRS232_RxHandler_4:
\ 00000038 4328 CMP R0,#+67
\ 0000003A 02D1 BNE.N ??ProbeRS232_RxHandler_5
309 ProbeRS232_RxState = PROBE_RS232_RX_STATE_SD2;
\ 0000003C 0220 MOVS R0,#+2
\ 0000003E 2070 STRB R0,[R4, #+0]
\ 00000040 F0BD POP {R4-R7,PC}
310 } else {
311 ProbeRS232_RxState = PROBE_RS232_RX_STATE_SD0;
\ ??ProbeRS232_RxHandler_5:
\ 00000042 2770 STRB R7,[R4, #+0]
\ 00000044 F0BD POP {R4-R7,PC}
312 }
313 break;
314
315 case PROBE_RS232_RX_STATE_SD2: /* Receive the start third start delimiter (SD2) */
316 if (rx_data == PROBE_RS232_PROTOCOL_RX_SD2) {
\ ??ProbeRS232_RxHandler_6:
\ 00000046 5028 CMP R0,#+80
\ 00000048 02D1 BNE.N ??ProbeRS232_RxHandler_7
317 ProbeRS232_RxState = PROBE_RS232_RX_STATE_SD3;
\ 0000004A 0320 MOVS R0,#+3
\ 0000004C 2070 STRB R0,[R4, #+0]
\ 0000004E F0BD POP {R4-R7,PC}
318 } else {
319 ProbeRS232_RxState = PROBE_RS232_RX_STATE_SD0;
\ ??ProbeRS232_RxHandler_7:
\ 00000050 2770 STRB R7,[R4, #+0]
\ 00000052 F0BD POP {R4-R7,PC}
320 }
321 break;
322
323 case PROBE_RS232_RX_STATE_SD3: /* Receive the start fourth start delimiter (SD3) */
324 if (rx_data == PROBE_RS232_PROTOCOL_RX_SD3) {
\ ??ProbeRS232_RxHandler_8:
\ 00000054 7228 CMP R0,#+114
\ 00000056 02D1 BNE.N ??ProbeRS232_RxHandler_9
325 ProbeRS232_RxState = PROBE_RS232_RX_STATE_LEN1;
\ 00000058 0420 MOVS R0,#+4
\ 0000005A 2070 STRB R0,[R4, #+0]
\ 0000005C F0BD POP {R4-R7,PC}
326 } else {
327 ProbeRS232_RxState = PROBE_RS232_RX_STATE_SD0;
\ ??ProbeRS232_RxHandler_9:
\ 0000005E 2770 STRB R7,[R4, #+0]
\ 00000060 F0BD POP {R4-R7,PC}
328 }
329 break;
330
331
332 case PROBE_RS232_RX_STATE_LEN1: /* Receive the first length byte */
333 ProbeRS232_RxChkSum = rx_data;
\ ??ProbeRS232_RxHandler_10:
\ 00000062 6070 STRB R0,[R4, #+1]
334 ProbeRS232_RxRemainLen = rx_data;
\ 00000064 E180 STRH R1,[R4, #+6]
335 ProbeRS232_RxState = PROBE_RS232_RX_STATE_LEN2;
\ 00000066 0520 MOVS R0,#+5
\ 00000068 2070 STRB R0,[R4, #+0]
\ 0000006A F0BD POP {R4-R7,PC}
336 break;
337
338 case PROBE_RS232_RX_STATE_LEN2: /* Receive the second length byte */
339 ProbeRS232_RxChkSum += rx_data;
\ ??ProbeRS232_RxHandler_11:
\ 0000006C 6570 STRB R5,[R4, #+1]
340 ProbeRS232_RxRemainLen |= rx_data << 8;
\ 0000006E 56EA0120 ORRS R0,R6,R1, LSL #+8
\ 00000072 E080 STRH R0,[R4, #+6]
341
342 if ((ProbeRS232_RxRemainLen == 0) || (ProbeRS232_RxRemainLen > PROBE_RS232_RX_BUF_SIZE)) {
\ 00000074 01D0 BEQ.N ??ProbeRS232_RxHandler_12
\ 00000076 4128 CMP R0,#+65
\ 00000078 01D3 BCC.N ??ProbeRS232_RxHandler_13
343
344 ProbeRS232_RxState = PROBE_RS232_RX_STATE_SD0; /* ... Cannot handle a packet of this size */
\ ??ProbeRS232_RxHandler_12:
\ 0000007A 2770 STRB R7,[R4, #+0]
\ 0000007C F0BD POP {R4-R7,PC}
345 } else {
346
347 ProbeRS232_RxLen = ProbeRS232_RxRemainLen;
\ ??ProbeRS232_RxHandler_13:
\ 0000007E 2081 STRH R0,[R4, #+8]
348 ProbeRS232_RxState = PROBE_RS232_RX_STATE_PAD1;
\ 00000080 0620 MOVS R0,#+6
\ 00000082 2070 STRB R0,[R4, #+0]
\ 00000084 F0BD POP {R4-R7,PC}
349 }
350 break;
351
352
353 case PROBE_RS232_RX_STATE_PAD1: /* Receive the first padding byte */
354 ProbeRS232_RxState = PROBE_RS232_RX_STATE_PAD2;
\ ??ProbeRS232_RxHandler_14:
\ 00000086 0720 MOVS R0,#+7
\ 00000088 2070 STRB R0,[R4, #+0]
\ 0000008A F0BD POP {R4-R7,PC}
355 break;
356
357 case PROBE_RS232_RX_STATE_PAD2: /* Receive the second padding byte */
358 ProbeRS232_RxState = PROBE_RS232_RX_STATE_DATA;
\ ??ProbeRS232_RxHandler_15:
\ 0000008C 0820 MOVS R0,#+8
\ 0000008E 2070 STRB R0,[R4, #+0]
\ 00000090 F0BD POP {R4-R7,PC}
359 break;
360
361
362
363 case PROBE_RS232_RX_STATE_DATA: /* Receive the data */
364 ProbeRS232_RxStoINT8U(rx_data);
\ ??ProbeRS232_RxHandler_16:
\ 00000092 ........ BL ProbeRS232_RxStoINT8U
365 ProbeRS232_RxChkSum += rx_data;
\ 00000096 6570 STRB R5,[R4, #+1]
366 if (--ProbeRS232_RxRemainLen == 0) {
\ 00000098 761E SUBS R6,R6,#+1
\ 0000009A E680 STRH R6,[R4, #+6]
\ 0000009C B6B2 UXTH R6,R6
\ 0000009E 002E CMP R6,#+0
\ 000000A0 10D1 BNE.N ??ProbeRS232_RxHandler_3
367 ProbeRS232_RxState = PROBE_RS232_RX_STATE_CHKSUM;
\ 000000A2 0920 MOVS R0,#+9
\ 000000A4 2070 STRB R0,[R4, #+0]
\ 000000A6 F0BD POP {R4-R7,PC}
368 }
369 break;
370
371
372
373
374 case PROBE_RS232_RX_STATE_CHKSUM: /* Receive the checksum */
375 ProbeRS232_RxChkSum += rx_data;
\ ??ProbeRS232_RxHandler_17:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -