⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 probe_com.txt

📁 ucos2.86版本结合STM板极支持包
💻 TXT
📖 第 1 页 / 共 4 页
字号:
;;;354    {
00038c  b510              PUSH     {r4,lr}
00038e  4686              MOV      lr,r0
;;;355        CPU_INT16U   tx_buf_wr;
;;;356        CPU_INT16U   format;
;;;357        CPU_INT08U  *rx_buf;
;;;358        CPU_INT08U  *tx_buf;
;;;359    
;;;360    
;;;361        rx_buf  = (CPU_INT08U *)rx_pkt;
;;;362        tx_buf  = (CPU_INT08U *)tx_pkt;
000390  4608              MOV      r0,r1
;;;363        format  = (rx_buf[1] << 8) + rx_buf[0];
000392  f89ef89e          LDRB     r1,[lr,#0]
000396  f89ef89e          LDRB     r12,[lr,#1]
00039a  eb01eb01          ADD      r1,r1,r12,LSL #8
00039e  fa1ffa1f          UXTH     r12,r1
;;;364        rx_buf += 2;
0003a2  f10ef10e          ADD      r4,lr,#2
;;;365    
;;;366    #if (PROBE_COM_STAT_EN == DEF_ENABLED)
;;;367        ProbeCom_RxPktCtr++;
0003a6  f8dff8df          LDR      lr,|L1.1012|
0003aa  f8def8de          LDR      r1,[lr,#0]  ; ProbeCom_RxPktCtr
0003ae  1c49              ADDS     r1,r1,#1
0003b0  f8cef8ce          STR      r1,[lr,#0]  ; ProbeCom_RxPktCtr
;;;368        ProbeCom_TxPktCtr++;
0003b4  f8def8de          LDR      r1,[lr,#4]  ; ProbeCom_TxPktCtr
0003b8  1c49              ADDS     r1,r1,#1
0003ba  f8cef8ce          STR      r1,[lr,#4]  ; ProbeCom_TxPktCtr
;;;369    #endif
;;;370    
;;;371        switch (format) {
0003be  f1bcf1bc          CMP      r12,#1
0003c2  d00d              BEQ      |L1.992|
0003c4  f1bcf1bc          CMP      r12,#2
0003c8  d018              BEQ      |L1.1020|
0003ca  f1bcf1bc          CMP      r12,#7
0003ce  d01a              BEQ      |L1.1030|
0003d0  f1bcf1bc          CMP      r12,#9
0003d4  d11c              BNE      |L1.1040|
0003d6  4601              MOV      r1,r0
0003d8  4620              MOV      r0,r4
0003da  e8bde8bd          POP      {r4,lr}
;;;372            case PROBE_COM_FMT_RX_QUERY:
;;;373                 tx_buf_wr = ProbeCom_CmdQuery(     rx_buf, tx_buf, rx_pkt_sz, tx_buf_sz);
;;;374                 break;
;;;375    
;;;376            case PROBE_COM_FMT_RX_SIMPLE_RD:
;;;377                 tx_buf_wr = ProbeCom_CmdSimpleRd(  rx_buf, tx_buf, rx_pkt_sz, tx_buf_sz);
;;;378                 break;
;;;379    
;;;380    #if (PROBE_COM_SUPPORT_WR == DEF_TRUE)
;;;381            case PROBE_COM_FMT_RX_SIMPLE_WR:
;;;382                 tx_buf_wr = ProbeCom_CmdSimpleWr(  rx_buf, tx_buf, rx_pkt_sz, tx_buf_sz);
;;;383                 break;
;;;384    #endif
;;;385    
;;;386            case PROBE_COM_FMT_RX_MULTIPLE_RD:
;;;387                 tx_buf_wr = ProbeCom_CmdMultipleRd(rx_buf, tx_buf,  rx_pkt_sz, tx_buf_sz);
;;;388                 break;
;;;389    
;;;390    #if (PROBE_COM_SUPPORT_STR == DEF_TRUE)
;;;391            case PROBE_COM_FMT_RX_STR_GET:
;;;392                 tx_buf_wr = ProbeCom_CmdStrGet(    rx_buf, tx_buf,  rx_pkt_sz, tx_buf_sz);
0003de  e7fe              B        ProbeCom_CmdStrGet
                  |L1.992|
0003e0  4601              MOV      r1,r0
0003e2  4620              MOV      r0,r4
0003e4  e8bde8bd          POP      {r4,lr}
0003e8  e7fe              B        ProbeCom_CmdQuery
0003ea  0000              DCW      0x0000
                  |L1.1004|
0003ec  00000000          DCD      ProbeComStrBufWrIx
                  |L1.1008|
0003f0  00000000          DCD      ProbeComStrBufRdIx
                  |L1.1012|
0003f4  00000000          DCD      ||.data||
                  |L1.1016|
0003f8  00000000          DCD      ProbeComStrBuf
                  |L1.1020|
0003fc  4601              MOV      r1,r0
0003fe  4620              MOV      r0,r4
000400  e8bde8bd          POP      {r4,lr}
000404  e7fe              B        ProbeCom_CmdSimpleRd
                  |L1.1030|
000406  4601              MOV      r1,r0
000408  4620              MOV      r0,r4
00040a  e8bde8bd          POP      {r4,lr}
00040e  e7fe              B        ProbeCom_CmdMultipleRd
                  |L1.1040|
;;;393                 break;
;;;394    #endif
;;;395    
;;;396            default:
;;;397                 tx_buf_wr = ProbeCom_CmdError(tx_buf, PROBE_COM_STATUS_UNKNOWN_REQUEST);
000410  e8bde8bd          POP      {r4,lr}
000414  21f9              MOVS     r1,#0xf9
000416  e7fe              B        ProbeCom_CmdError
;;;398                 break;
;;;399        }
;;;400    
;;;401        return (tx_buf_wr);
;;;402    }
;;;403    
                          ENDP

                  ProbeCom_TxStr PROC
;;;445                                 CPU_INT16U   dly)
;;;446    {
000418  e92de92d          PUSH     {r4-r12,lr}
00041c  4607              MOV      r7,r0
00041e  4688              MOV      r8,r1
;;;447        CPU_BOOLEAN  ret;
;;;448        CPU_INT32U   len;
;;;449        CPU_INT32U   wr_ix;
;;;450        CPU_INT32U   rd_ix;
;;;451        CPU_INT32U   wr_ix_n;
;;;452    
;;;453        CPU_INT32U   nbytes_free;
;;;454        CPU_INT32U   nbytes_wr;
;;;455    
;;;456    
;;;457        if (dly == 0) {
000420  f1b8f1b8          CMP      r8,#0
000424  d103              BNE      |L1.1070|
;;;458            ret = ProbeCom_OS_Pend(DEF_FALSE);
000426  2000              MOVS     r0,#0
000428  f7fff7ff          BL       ProbeCom_OS_Pend
00042c  e002              B        |L1.1076|
                  |L1.1070|
;;;459        } else {
;;;460            ret = ProbeCom_OS_Pend(DEF_TRUE);
00042e  2001              MOVS     r0,#1
000430  f7fff7ff          BL       ProbeCom_OS_Pend
                  |L1.1076|
;;;461        }
;;;462    
;;;463        if (ret == DEF_FALSE) {
000434  b910              CBNZ     r0,|L1.1084|
;;;464            return (DEF_FALSE);
000436  2000              MOVS     r0,#0
000438  e8bde8bd          POP      {r4-r12,pc}
                  |L1.1084|
;;;465        }
;;;466    
;;;467        len = (CPU_INT32U)Str_Len(s);                                   /* Determine length of the string (without NULL byte    */
00043c  4638              MOV      r0,r7
00043e  f7fff7ff          BL       Str_Len
000442  4604              MOV      r4,r0
;;;468    
;;;469        while (DEF_TRUE) {
000444  f8dff8df          LDR      r10,|L1.1208|
000448  f8dff8df          LDR      r9,|L1.1212|
00044c  f8dff8df          LDR      r11,|L1.1216|
                  |L1.1104|
;;;470            if (len == 0) {                                             /* If entire string has been placed in buffer           */
000450  b924              CBNZ     r4,|L1.1116|
;;;471                ProbeCom_OS_Post();
000452  f7fff7ff          BL       ProbeCom_OS_Post
;;;472                return (DEF_TRUE);                                      /* ... Return DEF_TRUE to indicate success.             */
000456  2001              MOVS     r0,#1
000458  e8bde8bd          POP      {r4-r12,pc}
                  |L1.1116|
;;;473            }
;;;474    
;;;475            rd_ix = ProbeComStrBufRdIx;
00045c  f8daf8da          LDR      r1,[r10,#0]  ; ProbeComStrBufRdIx
;;;476            wr_ix = ProbeComStrBufWrIx;
000460  f8d9f8d9          LDR      r0,[r9,#0]  ; ProbeComStrBufWrIx
;;;477    
;;;478            if (rd_ix > wr_ix) {                                        /* If rd_ix > wr_ix, store string into                  */
000464  4281              CMP      r1,r0
000466  d902              BLS      |L1.1134|
;;;479                                                                        /*           buffer locations [wr_ix, rd_ix - 1)        */
;;;480                nbytes_free = rd_ix - wr_ix - 1;
000468  1a09              SUBS     r1,r1,r0
00046a  1e4d              SUBS     r5,r1,#1
00046c  e005              B        |L1.1146|
                  |L1.1134|
;;;481    
;;;482            } else {
;;;483                if (rd_ix == 0) {                                       /* If rd_ix <= wr_ix && rd_ix == 0, store string at     */
00046e  b911              CBNZ     r1,|L1.1142|
;;;484                                                                        /*           buffer locations [wr_ix, end_ix - 1)       */
;;;485                    nbytes_free = PROBE_COM_STR_BUF_SIZE - wr_ix - 1;
000470  f1c0f1c0          RSB      r5,r0,#0x7f
000474  e001              B        |L1.1146|
                  |L1.1142|
;;;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;
000476  f1c0f1c0          RSB      r5,r0,#0x80
                  |L1.1146|
;;;491                }
;;;492            }
;;;493    
;;;494            if (nbytes_free == 0) {                                     /* If the buffer is full                                */
00047a  b95d              CBNZ     r5,|L1.1172|
;;;495                if (dly == 0) {                                         /* (a) Return if dly = 0                                */
00047c  f1b8f1b8          CMP      r8,#0
000480  d104              BNE      |L1.1164|
;;;496                    ProbeCom_OS_Post();
000482  f7fff7ff          BL       ProbeCom_OS_Post
;;;497                    return (DEF_FALSE);
000486  2000              MOVS     r0,#0
000488  e8bde8bd          POP      {r4-r12,pc}
                  |L1.1164|
;;;498                } else {                                                /* (b) Call OS function to delay and continue           */
;;;499                    ProbeCom_OS_Dly(dly);
00048c  4640              MOV      r0,r8
00048e  f7fff7ff          BL       ProbeCom_OS_Dly
;;;500                    continue;
000492  e7dd              B        |L1.1104|
                  |L1.1172|
;;;501                }
;;;502            }
;;;503    
;;;504            if (nbytes_free > len) {                                    /* If string is shorter than free space                 */
000494  42a5              CMP      r5,r4
000496  d900              BLS      |L1.1178|
;;;505                nbytes_wr = len;
000498  4625              MOV      r5,r4
                  |L1.1178|
;;;506            } else {
;;;507                nbytes_wr = nbytes_free;
;;;508            }
;;;509    
;;;510            wr_ix_n = wr_ix + nbytes_wr;                                /* Assign write index after write                       */
00049a  1946              ADDS     r6,r0,r5
;;;511    
;;;512            if (wr_ix_n == PROBE_COM_STR_BUF_SIZE) {                    /* Wrap buffer index around                             */
00049c  2e80              CMP      r6,#0x80
00049e  d100              BNE      |L1.1186|
;;;513                wr_ix_n = 0;
0004a0  2600              MOVS     r6,#0
                  |L1.1186|
;;;514            }
;;;515    
;;;516            Mem_Copy(&ProbeComStrBuf[wr_ix], s, nbytes_wr);             /* Copy string to buffer                                */
0004a2  4458              ADD      r0,r0,r11
0004a4  462a              MOV      r2,r5
0004a6  4639              MOV      r1,r7
0004a8  f7fff7ff          BL       Mem_Copy
;;;517    
;;;518            ProbeComStrBufWrIx  = wr_ix_n;                              /* Assign new global write index                        */
0004ac  f8c9f8c9          STR      r6,[r9,#0]  ; ProbeComStrBufWrIx
;;;519            s                  += nbytes_wr;                            /* Increase string pointer                              */
0004b0  442f              ADD      r7,r7,r5
;;;520            len                -= nbytes_wr;                            /* Decrease string length                               */
0004b2  1b64              SUBS     r4,r4,r5
0004b4  e7cc              B        |L1.1104|
;;;521        }
;;;522    }
;;;523    #endif
                          ENDP

0004b6  0000              DCW      0x0000
                  |L1.1208|
0004b8  00000000          DCD      ProbeComStrBufRdIx
                  |L1.1212|
0004bc  00000000          DCD      ProbeComStrBufWrIx
                  |L1.1216|
0004c0  00000000          DCD      ProbeComStrBuf

                          AREA ||.data||, DATA, ALIGN=2

                  ProbeCom_RxPktCtr
000000  00000000          DCD      0x00000000
                  ProbeCom_TxPktCtr
000004  00000000          DCD      0x00000000
                  ProbeCom_TxSymCtr
000008  00000000          DCD      0x00000000
                  ProbeCom_TxSymByteCtr
00000c  00000000          DCD      0x00000000
                  ProbeCom_ErrPktCtr
000010  00000000          DCD      0x00000000
                  ProbeCom_TxStrCtr
000014  00000000          DCD      0x00000000
                  ProbeComStrBufWrIx
000018  00000000          DCD      0x00000000
                  ProbeComStrBufRdIx
00001c  00000000          DCD      0x00000000

                          AREA ||.bss||, DATA, NOINIT, ALIGN=0

                  ProbeComStrBuf
                          %        128

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -