probe_com.txt

来自「针对STM32F103的UCOS移植」· 文本 代码 · 共 1,157 行 · 第 1/4 页

TXT
1,157 行
字号
                          ENDP

                  ProbeCom_ParseRxPkt PROC
;;;353                                     CPU_INT16U   tx_buf_sz)
;;;354    {
000388  b510              PUSH     {r4,lr}
00038a  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;
00038c  4608              MOV      r0,r1
;;;363        format  = (rx_buf[1] << 8) + rx_buf[0];
00038e  f89e1000          LDRB     r1,[lr,#0]
000392  f89ec001          LDRB     r12,[lr,#1]
000396  eb01210c          ADD      r1,r1,r12,LSL #8
00039a  fa1ffc81          UXTH     r12,r1
;;;364        rx_buf += 2;
00039e  f10e0402          ADD      r4,lr,#2
;;;365    
;;;366    #if (PROBE_COM_STAT_EN == DEF_ENABLED)
;;;367        ProbeCom_RxPktCtr++;
0003a2  f8dfe044          LDR      lr,|L1.1000|
0003a6  f8de1000          LDR      r1,[lr,#0]  ; ProbeCom_RxPktCtr
0003aa  1c49              ADDS     r1,r1,#1
0003ac  f8ce1000          STR      r1,[lr,#0]  ; ProbeCom_RxPktCtr
;;;368        ProbeCom_TxPktCtr++;
0003b0  f8de1004          LDR      r1,[lr,#4]  ; ProbeCom_TxPktCtr
0003b4  1c49              ADDS     r1,r1,#1
0003b6  f8ce1004          STR      r1,[lr,#4]  ; ProbeCom_TxPktCtr
;;;369    #endif
;;;370    
;;;371        switch (format) {
0003ba  f1bc0f01          CMP      r12,#1
0003be  d00d              BEQ      |L1.988|
0003c0  f1bc0f02          CMP      r12,#2
0003c4  d014              BEQ      |L1.1008|
0003c6  f1bc0f07          CMP      r12,#7
0003ca  d016              BEQ      |L1.1018|
0003cc  f1bc0f09          CMP      r12,#9
0003d0  d118              BNE      |L1.1028|
;;;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);
0003d2  4601              MOV      r1,r0
0003d4  4620              MOV      r0,r4
0003d6  e8bd4010          POP      {r4,lr}
0003da  e7fe              B        ProbeCom_CmdStrGet
                  |L1.988|
0003dc  4601              MOV      r1,r0                 ;373
0003de  4620              MOV      r0,r4                 ;373
0003e0  e8bd4010          POP      {r4,lr}               ;373
0003e4  e7fe              B        ProbeCom_CmdQuery
0003e6  0000              DCW      0x0000
                  |L1.1000|
0003e8  00000000          DCD      ||.data||
                  |L1.1004|
0003ec  00000000          DCD      ||.bss||
                  |L1.1008|
0003f0  4601              MOV      r1,r0                 ;377
0003f2  4620              MOV      r0,r4                 ;377
0003f4  e8bd4010          POP      {r4,lr}               ;377
0003f8  e7fe              B        ProbeCom_CmdSimpleRd
                  |L1.1018|
0003fa  4601              MOV      r1,r0                 ;387
0003fc  4620              MOV      r0,r4                 ;387
0003fe  e8bd4010          POP      {r4,lr}               ;387
000402  e7fe              B        ProbeCom_CmdMultipleRd
                  |L1.1028|
;;;393                 break;
;;;394    #endif
;;;395    
;;;396            default:
;;;397                 tx_buf_wr = ProbeCom_CmdError(tx_buf, PROBE_COM_STATUS_UNKNOWN_REQUEST);
000404  e8bd4010          POP      {r4,lr}
000408  21f9              MOVS     r1,#0xf9
00040a  e7fe              B        ProbeCom_CmdError
;;;398                 break;
;;;399        }
;;;400    
;;;401        return (tx_buf_wr);
;;;402    }
;;;403    
                          ENDP

                  ProbeCom_TxStr PROC
;;;445                                 CPU_INT16U   dly)
;;;446    {
00040c  e92d47f0          PUSH     {r4-r10,lr}
000410  4607              MOV      r7,r0
000412  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) {
000414  f1b80f00          CMP      r8,#0
000418  d103              BNE      |L1.1058|
;;;458            ret = ProbeCom_OS_Pend(DEF_FALSE);
00041a  2000              MOVS     r0,#0
00041c  f7fffffe          BL       ProbeCom_OS_Pend
000420  e002              B        |L1.1064|
                  |L1.1058|
;;;459        } else {
;;;460            ret = ProbeCom_OS_Pend(DEF_TRUE);
000422  2001              MOVS     r0,#1
000424  f7fffffe          BL       ProbeCom_OS_Pend
                  |L1.1064|
;;;461        }
;;;462    
;;;463        if (ret == DEF_FALSE) {
000428  b910              CBNZ     r0,|L1.1072|
;;;464            return (DEF_FALSE);
00042a  2000              MOVS     r0,#0
;;;465        }
;;;466    
;;;467        len = (CPU_INT32U)Str_Len(s);                                   /* Determine length of the string (without NULL byte    */
;;;468    
;;;469        while (DEF_TRUE) {
;;;470            if (len == 0) {                                             /* If entire string has been placed in buffer           */
;;;471                ProbeCom_OS_Post();
;;;472                return (DEF_TRUE);                                      /* ... Return DEF_TRUE to indicate success.             */
;;;473            }
;;;474    
;;;475            rd_ix = ProbeComStrBufRdIx;
;;;476            wr_ix = ProbeComStrBufWrIx;
;;;477    
;;;478            if (rd_ix > wr_ix) {                                        /* If rd_ix > wr_ix, store string into                  */
;;;479                                                                        /*           buffer locations [wr_ix, rd_ix - 1)        */
;;;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);
;;;500                    continue;
;;;501                }
;;;502            }
;;;503    
;;;504            if (nbytes_free > len) {                                    /* If string is shorter than free space                 */
;;;505                nbytes_wr = len;
;;;506            } else {
;;;507                nbytes_wr = nbytes_free;
;;;508            }
;;;509    
;;;510            wr_ix_n = wr_ix + nbytes_wr;                                /* Assign write index after write                       */
;;;511    
;;;512            if (wr_ix_n == PROBE_COM_STR_BUF_SIZE) {                    /* Wrap buffer index around                             */
;;;513                wr_ix_n = 0;
;;;514            }
;;;515    
;;;516            Mem_Copy(&ProbeComStrBuf[wr_ix], s, nbytes_wr);             /* Copy string to buffer                                */
;;;517    
;;;518            ProbeComStrBufWrIx  = wr_ix_n;                              /* Assign new global write index                        */
;;;519            s                  += nbytes_wr;                            /* Increase string pointer                              */
;;;520            len                -= nbytes_wr;                            /* Decrease string length                               */
;;;521        }
;;;522    }
00042c  e8bd87f0          POP      {r4-r10,pc}
                  |L1.1072|
000430  4638              MOV      r0,r7                 ;467
000432  f7fffffe          BL       Str_Len
000436  4604              MOV      r4,r0                 ;467
000438  f8df906c          LDR      r9,|L1.1192|
00043c  f8dfa06c          LDR      r10,|L1.1196|
                  |L1.1088|
000440  b924              CBNZ     r4,|L1.1100|
000442  f7fffffe          BL       ProbeCom_OS_Post
000446  2001              MOVS     r0,#1                 ;472
000448  e8bd87f0          POP      {r4-r10,pc}
                  |L1.1100|
00044c  f8d9001c          LDR      r0,[r9,#0x1c]         ;475  ; ProbeComStrBufRdIx
000450  f8d91018          LDR      r1,[r9,#0x18]         ;476  ; ProbeComStrBufWrIx
000454  4288              CMP      r0,r1                 ;478
000456  d902              BLS      |L1.1118|
000458  1a40              SUBS     r0,r0,r1              ;480
00045a  1e45              SUBS     r5,r0,#1              ;480
00045c  e005              B        |L1.1130|
                  |L1.1118|
00045e  b910              CBNZ     r0,|L1.1126|
000460  f1c1057f          RSB      r5,r1,#0x7f           ;485
000464  e001              B        |L1.1130|
                  |L1.1126|
000466  f1c10580          RSB      r5,r1,#0x80           ;490
                  |L1.1130|
00046a  b95d              CBNZ     r5,|L1.1156|
00046c  f1b80f00          CMP      r8,#0                 ;495
000470  d104              BNE      |L1.1148|
000472  f7fffffe          BL       ProbeCom_OS_Post
000476  2000              MOVS     r0,#0                 ;497
000478  e8bd87f0          POP      {r4-r10,pc}
                  |L1.1148|
00047c  4640              MOV      r0,r8                 ;499
00047e  f7fffffe          BL       ProbeCom_OS_Dly
000482  e7dd              B        |L1.1088|
                  |L1.1156|
000484  42a5              CMP      r5,r4                 ;504
000486  d900              BLS      |L1.1162|
000488  4625              MOV      r5,r4                 ;505
                  |L1.1162|
00048a  194e              ADDS     r6,r1,r5              ;510
00048c  2e80              CMP      r6,#0x80              ;512
00048e  d100              BNE      |L1.1170|
000490  2600              MOVS     r6,#0                 ;513
                  |L1.1170|
000492  eb0a0001          ADD      r0,r10,r1             ;516
000496  462a              MOV      r2,r5                 ;516
000498  4639              MOV      r1,r7                 ;516
00049a  f7fffffe          BL       Mem_Copy
00049e  f8c96018          STR      r6,[r9,#0x18]         ;518  ; ProbeComStrBufWrIx
0004a2  442f              ADD      r7,r7,r5              ;519
0004a4  1b64              SUBS     r4,r4,r5              ;520
0004a6  e7cb              B        |L1.1088|
;;;523    #endif
                          ENDP

                  |L1.1192|
0004a8  00000000          DCD      ||.data||
                  |L1.1196|
0004ac  00000000          DCD      ||.bss||

                          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 + =
减小字号Ctrl + -
显示快捷键?