📄 probe_com.lst
字号:
480 nbytes_free = rd_ix - wr_ix - 1;
481
482 } else {
483 if (rd_ix == 0) { /* If rd_ix <= wr_ix && rd_ix == 0, store string at */
484 /* buffer locations [wr_ix, end_ix - 1) */
485 nbytes_free = PROBE_COM_STR_BUF_SIZE - wr_ix - 1;
486
487 } else { /* If rd_ix <= wr_ix && rd_ix != 0, store string at */
488 /* buffer locations [wr_ix, end_ix) */
489
490 nbytes_free = PROBE_COM_STR_BUF_SIZE - wr_ix;
491 }
492 }
493
494 if (nbytes_free == 0) { /* If the buffer is full */
495 if (dly == 0) { /* (a) Return if dly = 0 */
496 ProbeCom_OS_Post();
497 return (DEF_FALSE);
498 } else { /* (b) Call OS function to delay and continue */
499 ProbeCom_OS_Dly(dly);
\ ??ProbeCom_TxStr_6:
\ 00000030 ........ _BLF ProbeCom_OS_Dly,??ProbeCom_OS_Dly??rT
500 continue;
501 }
\ ??ProbeCom_TxStr_5:
\ 00000034 002D CMP R5,#+0
\ 00000036 03D1 BNE.N ??ProbeCom_TxStr_7
\ 00000038 ........ _BLF ProbeCom_OS_Post,??ProbeCom_OS_Post??rT
\ 0000003C 0120 MOVS R0,#+1
\ 0000003E EFE7 B.N ??ProbeCom_TxStr_4
\ ??ProbeCom_TxStr_7:
\ 00000040 F169 LDR R1,[R6, #+28]
\ 00000042 B069 LDR R0,[R6, #+24]
\ 00000044 8842 CMP R0,R1
\ 00000046 02D2 BCS.N ??ProbeCom_TxStr_8
\ 00000048 0C1A SUBS R4,R1,R0
\ 0000004A 641E SUBS R4,R4,#+1
\ 0000004C 06E0 B.N ??ProbeCom_TxStr_9
\ ??ProbeCom_TxStr_8:
\ 0000004E 0029 CMP R1,#+0
\ 00000050 02D1 BNE.N ??ProbeCom_TxStr_10
\ 00000052 7F21 MOVS R1,#+127
\ 00000054 0C1A SUBS R4,R1,R0
\ 00000056 01E0 B.N ??ProbeCom_TxStr_9
\ ??ProbeCom_TxStr_10:
\ 00000058 8021 MOVS R1,#+128
\ 0000005A 0C1A SUBS R4,R1,R0
\ ??ProbeCom_TxStr_9:
\ 0000005C 002C CMP R4,#+0
\ 0000005E 05D1 BNE.N ??ProbeCom_TxStr_11
\ 00000060 4846 MOV R0,R9
\ 00000062 0028 CMP R0,#+0
\ 00000064 E4D1 BNE.N ??ProbeCom_TxStr_6
\ 00000066 ........ _BLF ProbeCom_OS_Post,??ProbeCom_OS_Post??rT
\ 0000006A D8E7 B.N ??ProbeCom_TxStr_3
502 }
503
504 if (nbytes_free > len) { /* If string is shorter than free space */
\ ??ProbeCom_TxStr_11:
\ 0000006C A542 CMP R5,R4
\ 0000006E 00D2 BCS.N ??ProbeCom_TxStr_12
505 nbytes_wr = len;
\ 00000070 2C00 MOVS R4,R5
506 } else {
507 nbytes_wr = nbytes_free;
508 }
509
510 wr_ix_n = wr_ix + nbytes_wr; /* Assign write index after write */
\ ??ProbeCom_TxStr_12:
\ 00000072 0719 ADDS R7,R0,R4
511
512 if (wr_ix_n == PROBE_COM_STR_BUF_SIZE) { /* Wrap buffer index around */
\ 00000074 802F CMP R7,#+128
\ 00000076 00D1 BNE.N ??ProbeCom_TxStr_13
513 wr_ix_n = 0;
\ 00000078 0027 MOVS R7,#+0
514 }
515
516 Mem_Copy(&ProbeComStrBuf[wr_ix], s, nbytes_wr); /* Copy string to buffer */
\ ??ProbeCom_TxStr_13:
\ 0000007A 2200 MOVS R2,R4
\ 0000007C 4146 MOV R1,R8
\ 0000007E 3018 ADDS R0,R6,R0
\ 00000080 2030 ADDS R0,R0,#+32
\ 00000082 ........ _BLF Mem_Copy,??Mem_Copy??rT
517
518 ProbeComStrBufWrIx = wr_ix_n; /* Assign new global write index */
\ 00000086 B761 STR R7,[R6, #+24]
519 s += nbytes_wr; /* Increase string pointer */
\ 00000088 14EB0808 ADDS R8,R4,R8
520 len -= nbytes_wr; /* Decrease string length */
\ 0000008C 2D1B SUBS R5,R5,R4
\ 0000008E D1E7 B.N ??ProbeCom_TxStr_5
521 }
522 }
523 #endif
524
525
526 /*
527 *********************************************************************************************************
528 *********************************************************************************************************
529 ** Static String-Handling Function
530 *********************************************************************************************************
531 *********************************************************************************************************
532 */
533
534 /*
535 *********************************************************************************************************
536 * Check if a String Is Ready
537 *
538 * Description: This routine is called to check if a string is ready for transmission.
539 *
540 * Argument(s): None
541 *
542 * Returns : DEF_TRUE if a string is in the buffer for transmission.
543 * DEF_FALSE if no string is in the buffer for transmission.
544 *
545 * Note(s) : (1) See Notes for ProbeCom_TxStr().
546 *********************************************************************************************************
547 */
548
549 #if (PROBE_COM_SUPPORT_STR == DEF_TRUE)
\ In segment CODE, align 4, keep-with-next
550 static CPU_BOOLEAN ProbeCom_StrRdy (void)
551 {
552 CPU_BOOLEAN rdy;
553 CPU_INT32U wr_ix;
554 CPU_INT32U rd_ix;
555
556
557 wr_ix = ProbeComStrBufWrIx;
558 rd_ix = ProbeComStrBufRdIx;
559
560 if (wr_ix == rd_ix) {
\ ProbeCom_StrRdy:
\ 00000000 .... LDR.N R0,??DataTable7 ;; ProbeCom_RxPktCtr
\ 00000002 8169 LDR R1,[R0, #+24]
\ 00000004 C069 LDR R0,[R0, #+28]
\ 00000006 8142 CMP R1,R0
\ 00000008 01D1 BNE.N ??ProbeCom_StrRdy_0
561 rdy = DEF_FALSE;
\ 0000000A 0020 MOVS R0,#+0
\ 0000000C 7047 BX LR
562 } else {
563 rdy = DEF_TRUE;
\ ??ProbeCom_StrRdy_0:
\ 0000000E 0120 MOVS R0,#+1
564 }
565
566 return (rdy);
\ 00000010 7047 BX LR ;; return
567 }
568 #endif
569
570
571 /*
572 *********************************************************************************************************
573 *********************************************************************************************************
574 ** Static Packet-Handling Functions
575 *********************************************************************************************************
576 *********************************************************************************************************
577 */
578
\ In segment CODE, align 4, keep-with-next
579 static CPU_INT08U ProbeCom_PktModifier (void)
580 {
\ ProbeCom_PktModifier:
\ 00000000 00B5 PUSH {LR}
581 #if (PROBE_COM_SUPPORT_STR == DEF_TRUE)
582
583 if (ProbeCom_StrRdy() == DEF_TRUE) {
\ 00000002 ........ BL ProbeCom_StrRdy
\ 00000006 0128 CMP R0,#+1
\ 00000008 00D1 BNE.N ??ProbeCom_PktModifier_0
584 return (PROBE_COM_MODIFIER_STR_HAVE);
\ 0000000A 00BD POP {PC}
585 } else {
586 return (PROBE_COM_MODIFIER_NONE);
\ ??ProbeCom_PktModifier_0:
\ 0000000C 0020 MOVS R0,#+0
\ 0000000E 00BD POP {PC} ;; return
587 }
588
589 #else
590
591 return (PROBE_COM_MODIFIER_NONE);
592
593 #endif
594 }
595
596
597 /*
598 *********************************************************************************************************
599 * Send an FMT_ERROR Command
600 *
601 * Description: This routine is called to send an error response when the target receives a request it
602 * cannot handle.
603 *
604 * Argument(s): tx_buf is a pointer to the transmit buffer
605 *
606 * com_error is the error that occurred
607 *
608 * Returns : The number of bytes written to the tx buffer.
609 *
610 * Note(s) : (1) The TX format:
611 * (A) A 2-byte format , indicating the data segment format; AND
612 * (B) A 1-byte constant, PROBE_RS232_OK, if the location can be read; OR
613 * A 1-byte constant, PROBE_RS232_FAIL, if the location cannot be read.
614 * (C) A 1-byte modifier.
615 *
616 * +-------------------------+------------+------------+
617 * | Format | Status | Modifier |
618 * +-------------------------+------------+------------+
619
620 *
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -