📄 probe_com.lst
字号:
362 * Return(s) : none.
363 *
364 * Caller(s) : Application.
365 *
366 * Note(s) : none.
367 *********************************************************************************************************
368 */
369
\ In segment CODE, align 4, keep-with-next
370 void ProbeCom_Init (void)
371 {
372 #if (PROBE_COM_SUPPORT_STR == DEF_TRUE)
373 ProbeCom_StrBufWrIx = 0;
374 ProbeCom_StrBufRdIx = 0;
375
376 ProbeCom_OS_Init();
377 #endif
378
379 #if (PROBE_COM_STAT_EN == DEF_ENABLED)
380 ProbeCom_RxPktCtr = 0;
\ ProbeCom_Init:
\ 00000000 .... LDR.N R0,??DataTable2 ;; ProbeCom_RxPktCtr
\ 00000002 0021 MOVS R1,#+0
\ 00000004 0160 STR R1,[R0, #+0]
381 ProbeCom_TxPktCtr = 0;
\ 00000006 4160 STR R1,[R0, #+4]
382 ProbeCom_TxSymCtr = 0;
\ 00000008 8160 STR R1,[R0, #+8]
383 ProbeCom_TxSymByteCtr = 0;
\ 0000000A C160 STR R1,[R0, #+12]
384 ProbeCom_ErrPktCtr = 0;
\ 0000000C 0161 STR R1,[R0, #+16]
385
386 #if (PROBE_COM_SUPPORT_STR == DEF_TRUE)
387 ProbeCom_TxStrCtr = 0;
388 #endif
389
390 #if (PROBE_COM_SUPPORT_WR == DEF_TRUE)
391 ProbeCom_RxSymCtr = 0;
392 ProbeCom_RxSymByteCtr = 0;
393 #endif
394 #endif
395
396 ProbeCom_EndiannessTest = 0x12345678L;
\ 0000000E .... LDR.N R2,??DataTable6 ;; 0x12345678
\ 00000010 4261 STR R2,[R0, #+20]
397
398 ProbeCom_InfoHndlr = (PROBE_COM_INFO_HDNLR_FNCT)0;
\ 00000012 8161 STR R1,[R0, #+24]
399 #if (PROBE_COM_SUPPORT_STR == DEF_TRUE)
400 ProbeCom_StrHndlr = (PROBE_COM_STR_HDNLR_FNCT )0;
401 #endif
402 }
\ 00000014 7047 BX LR ;; return
403
404
405 /*
406 *********************************************************************************************************
407 * ProbeCom_ParseRxPkt()
408 *
409 * Description : Parse a packet & formulate a response.
410 *
411 * Argument(s) : prx_pkt Pointer to the receive packet buffer
412 *
413 * ptx_pkt Pointer to the transmit packet buffer
414 *
415 * rx_pkt_size Size of the received packet
416 *
417 * tx_pkt_size Size of the transmit packet buffer
418 *
419 * Return(s) : The number of bytes in the data segment of the packet to transmit in response.
420 *
421 * Caller(s) : Tasks/receive handlers in communications-specific drivers, e.g., probe_rs232,
422 * probe_usb, probe_tcpip, etc.).
423 *
424 * Note(s) : none.
425 *********************************************************************************************************
426 */
427
\ In segment CODE, align 4, keep-with-next
428 CPU_INT16U ProbeCom_ParseRxPkt (void *prx_pkt,
429 void *ptx_pkt,
430 CPU_INT16U rx_pkt_size,
431 CPU_INT16U tx_buf_size)
432 {
\ ProbeCom_ParseRxPkt:
\ 00000000 70B5 PUSH {R4-R6,LR}
\ 00000002 0C00 MOVS R4,R1
433 CPU_INT16U tx_buf_wr;
434 CPU_INT16U format;
435 CPU_INT08U *prx_pkt_08;
436 CPU_INT08U *ptx_pkt_08;
437
438
439 if (rx_pkt_size < 2) {
\ 00000004 022A CMP R2,#+2
\ 00000006 01D2 BCS.N ??ProbeCom_ParseRxPkt_0
440 return (0);
\ 00000008 0020 MOVS R0,#+0
\ 0000000A 70BD POP {R4-R6,PC}
441 }
442
443 prx_pkt_08 = (CPU_INT08U *)prx_pkt;
444 ptx_pkt_08 = (CPU_INT08U *)ptx_pkt;
445 format = (prx_pkt_08[1] << 8) + prx_pkt_08[0];
\ ??ProbeCom_ParseRxPkt_0:
\ 0000000C 4178 LDRB R1,[R0, #+1]
\ 0000000E 0578 LDRB R5,[R0, #+0]
\ 00000010 15EB0121 ADDS R1,R5,R1, LSL #+8
\ 00000014 89B2 UXTH R1,R1
446 prx_pkt_08 += 2;
\ 00000016 801C ADDS R0,R0,#+2
447
448 #if (PROBE_COM_STAT_EN == DEF_ENABLED)
449 ProbeCom_RxPktCtr++;
\ 00000018 .... LDR.N R5,??DataTable2 ;; ProbeCom_RxPktCtr
\ 0000001A 2E68 LDR R6,[R5, #+0]
\ 0000001C 761C ADDS R6,R6,#+1
\ 0000001E 2E60 STR R6,[R5, #+0]
450 ProbeCom_TxPktCtr++;
\ 00000020 6E68 LDR R6,[R5, #+4]
\ 00000022 761C ADDS R6,R6,#+1
\ 00000024 6E60 STR R6,[R5, #+4]
451 #endif
452
453 switch (format) {
\ 00000026 0129 CMP R1,#+1
\ 00000028 06D0 BEQ.N ??ProbeCom_ParseRxPkt_1
\ 0000002A 0229 CMP R1,#+2
\ 0000002C 0CD0 BEQ.N ??ProbeCom_ParseRxPkt_2
\ 0000002E 0429 CMP R1,#+4
\ 00000030 06D0 BEQ.N ??ProbeCom_ParseRxPkt_3
\ 00000032 0729 CMP R1,#+7
\ 00000034 0CD0 BEQ.N ??ProbeCom_ParseRxPkt_4
\ 00000036 0FE0 B.N ??ProbeCom_ParseRxPkt_5
454 case PROBE_COM_FMT_RX_QUERY:
455 tx_buf_wr = ProbeCom_CmdQuery( prx_pkt_08, ptx_pkt_08, rx_pkt_size, tx_buf_size);
\ ??ProbeCom_ParseRxPkt_1:
\ 00000038 2100 MOVS R1,R4
\ 0000003A ........ BL ProbeCom_CmdQuery
\ 0000003E 70BD POP {R4-R6,PC}
456 break;
457
458 case PROBE_COM_FMT_RX_INFO:
459 tx_buf_wr = ProbeCom_CmdInfo( prx_pkt_08, ptx_pkt_08, rx_pkt_size, tx_buf_size);
\ ??ProbeCom_ParseRxPkt_3:
\ 00000040 2100 MOVS R1,R4
\ 00000042 ........ BL ProbeCom_CmdInfo
\ 00000046 70BD POP {R4-R6,PC}
460 break;
461
462 case PROBE_COM_FMT_RX_SIMPLE_RD:
463 tx_buf_wr = ProbeCom_CmdSimpleRd( prx_pkt_08, ptx_pkt_08, rx_pkt_size, tx_buf_size);
\ ??ProbeCom_ParseRxPkt_2:
\ 00000048 2100 MOVS R1,R4
\ 0000004A ........ BL ProbeCom_CmdSimpleRd
\ 0000004E 70BD POP {R4-R6,PC}
464 break;
465
466 case PROBE_COM_FMT_RX_MULTIPLE_RD:
467 tx_buf_wr = ProbeCom_CmdMultipleRd( prx_pkt_08, ptx_pkt_08, rx_pkt_size, tx_buf_size);
\ ??ProbeCom_ParseRxPkt_4:
\ 00000050 2100 MOVS R1,R4
\ 00000052 ........ BL ProbeCom_CmdMultipleRd
\ 00000056 70BD POP {R4-R6,PC}
468 break;
469
470 #if (PROBE_COM_SUPPORT_WR == DEF_TRUE)
471 case PROBE_COM_FMT_RX_SIMPLE_WR:
472 tx_buf_wr = ProbeCom_CmdSimpleWr( prx_pkt_08, ptx_pkt_08, rx_pkt_size, tx_buf_size);
473 break;
474
475 case PROBE_COM_FMT_RX_MULTIPLE_WR:
476 tx_buf_wr = ProbeCom_CmdMultipleWr( prx_pkt_08, ptx_pkt_08, rx_pkt_size, tx_buf_size);
477 break;
478 #endif
479
480 #if (PROBE_COM_SUPPORT_STR == DEF_TRUE)
481 case PROBE_COM_FMT_RX_STR_RD:
482 tx_buf_wr = ProbeCom_CmdStrRd( prx_pkt_08, ptx_pkt_08, rx_pkt_size, tx_buf_size);
483 break;
484
485 case PROBE_COM_FMT_RX_STR_WR:
486 tx_buf_wr = ProbeCom_CmdStrWr( prx_pkt_08, ptx_pkt_08, rx_pkt_size, tx_buf_size);
487 break;
488 #endif
489
490 default:
491 tx_buf_wr = ProbeCom_CmdErr( ptx_pkt_08, PROBE_COM_STATUS_UNKNOWN_REQUEST);
\ ??ProbeCom_ParseRxPkt_5:
\ 00000058 F921 MOVS R1,#+249
\ 0000005A 2000 MOVS R0,R4
\ 0000005C ........ BL ProbeCom_CmdErr
492 break;
493 }
494
495 return (tx_buf_wr);
\ 00000060 70BD POP {R4-R6,PC} ;; return
496 }
497
498
499 /*
500 *********************************************************************************************************
501 * ProbeCom_InfoHndlrSet()
502 *
503 * Description : Set the handler that will be invoked when an info packet is received.
504 *
505 * Argument(s) : hndlr The handler that will be invoked.
506 *
507 * Return(s) : none.
508 *
509 * Caller(s) : Application or communications-specific driver.
510 *
511 * Note(s) : none.
512 *********************************************************************************************************
513 */
514
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -