probe_com.txt

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

TXT
1,157
字号
;;;1262   
;;;1263                   ProbeComStrBufRdIx = rd_ix_n;                       /*              (J) Update global read index            */
;;;1264               }
;;;1265           }
;;;1266   
;;;1267         *(tx_buf_p + nbytes) = 0;
;;;1268   
;;;1269   #if (PROBE_COM_STAT_EN == DEF_ENABLED)
;;;1270           ProbeCom_TxStrCtr += nbytes;
;;;1271   #endif
;;;1272   
;;;1273           return (nbytes + PROBE_COM_SIZE_TX_HEADER + 1);             /*  (d) Return TX data segment size                     */
;;;1274                                                                       /*        =  nbytes (= String    size)                  */
;;;1275                                                                       /*        +  4      (= Tx header size)                  */
;;;1276                                                                       /*        +  1      (= NULL byte     )                  */
;;;1277       }
;;;1278   }
0000be  b004              ADD      sp,sp,#0x10
0000c0  e8bd9ff0          POP      {r4-r12,pc}
                  |L1.196|
0000c4  f2480109          MOV      r1,#0x8009            ;1192
0000c8  a801              ADD      r0,sp,#4              ;1192
0000ca  f7fffffe          BL       ProbeCom_StoINT16U
0000ce  2101              MOVS     r1,#1                 ;1193
0000d0  a801              ADD      r0,sp,#4              ;1193
0000d2  f7fffffe          BL       ProbeCom_StoINT8U
0000d6  2100              MOVS     r1,#0                 ;1194
0000d8  a801              ADD      r0,sp,#4              ;1194
0000da  f7fffffe          BL       ProbeCom_StoINT8U
0000de  9801              LDR      r0,[sp,#4]            ;1196
0000e0  4681              MOV      r9,r0                 ;1196
0000e2  1f7e              SUBS     r6,r7,#5              ;1198
0000e4  49c1              LDR      r1,|L1.1004|
0000e6  42a5              CMP      r5,r4                 ;1198
0000e8  d90c              BLS      |L1.260|
0000ea  1b2a              SUBS     r2,r5,r4              ;1201
0000ec  42b2              CMP      r2,r6                 ;1203
0000ee  d302              BCC      |L1.246|
0000f0  1f7a              SUBS     r2,r7,#5              ;1207
0000f2  19e3              ADDS     r3,r4,r7              ;1208
0000f4  1f1d              SUBS     r5,r3,#4              ;1208
                  |L1.246|
0000f6  b296              UXTH     r6,r2                 ;1214
0000f8  4421              ADD      r1,r1,r4              ;1216
0000fa  f7fffffe          BL       Mem_Copy
0000fe  f8c8501c          STR      r5,[r8,#0x1c]         ;1218  ; ProbeComStrBufRdIx
000102  e028              B        |L1.342|
                  |L1.260|
000104  f1c40b80          RSB      r11,r4,#0x80          ;1224
000108  45b3              CMP      r11,r6                ;1226
00010a  d309              BCC      |L1.288|
00010c  b2b6              UXTH     r6,r6                 ;1229
00010e  19e2              ADDS     r2,r4,r7              ;1230
000110  1f15              SUBS     r5,r2,#4              ;1230
000112  4421              ADD      r1,r1,r4              ;1232
000114  4632              MOV      r2,r6                 ;1232
000116  f7fffffe          BL       Mem_Copy
00011a  f8c8501c          STR      r5,[r8,#0x1c]         ;1234  ; ProbeComStrBufRdIx
00011e  e01a              B        |L1.342|
                  |L1.288|
000120  fa1ffa8b          UXTH     r10,r11               ;1240
000124  49b1              LDR      r1,|L1.1004|
000126  465a              MOV      r2,r11                ;1244
000128  4421              ADD      r1,r1,r4              ;1244
00012a  f7fffffe          BL       Mem_Copy
00012e  9801              LDR      r0,[sp,#4]            ;1248
000130  4458              ADD      r0,r0,r11             ;1248
000132  9001              STR      r0,[sp,#4]            ;1248
000134  462a              MOV      r2,r5                 ;1249
000136  eb02010a          ADD      r1,r2,r10             ;1252
00013a  42b1              CMP      r1,r6                 ;1252
00013c  d302              BCC      |L1.324|
00013e  eba7010a          SUB      r1,r7,r10             ;1254
000142  1f4a              SUBS     r2,r1,#5              ;1254
                  |L1.324|
000144  eb0a0102          ADD      r1,r10,r2             ;1257
000148  b28e              UXTH     r6,r1                 ;1257
00014a  4614              MOV      r4,r2                 ;1258
00014c  49a7              LDR      r1,|L1.1004|
00014e  f7fffffe          BL       Mem_Copy
000152  f8c8401c          STR      r4,[r8,#0x1c]         ;1263  ; ProbeComStrBufRdIx
                  |L1.342|
000156  2000              MOVS     r0,#0                 ;1267
000158  f8090006          STRB     r0,[r9,r6]            ;1267
00015c  f8d80014          LDR      r0,[r8,#0x14]         ;1270  ; ProbeCom_TxStrCtr
000160  4430              ADD      r0,r0,r6              ;1270
000162  f8c80014          STR      r0,[r8,#0x14]         ;1270  ; ProbeCom_TxStrCtr
000166  1d70              ADDS     r0,r6,#5              ;1273
000168  b280              UXTH     r0,r0                 ;1273
00016a  b004              ADD      sp,sp,#0x10
00016c  e8bd9ff0          POP      {r4-r12,pc}
;;;1279   #endif
                          ENDP

                  ProbeCom_CmdMultipleRd PROC
;;;1035                                               CPU_INT16U   tx_buf_sz)
;;;1036   {
000170  e92d4fff          PUSH     {r0-r11,lr}
000174  b081              SUB      sp,sp,#4
000176  4604              MOV      r4,r0
000178  460e              MOV      r6,r1
00017a  4692              MOV      r10,r2
;;;1037       CPU_INT08U  *tx_buf_start;
;;;1038       CPU_INT32U   tx_length;
;;;1039   
;;;1040       CPU_INT32U   addr;
;;;1041       CPU_INT16U   nbytes;
;;;1042       CPU_INT32U   rx_pkt_ix;
;;;1043   
;;;1044   #if (PROBE_COM_STAT_EN == DEF_ENABLED)
;;;1045       CPU_INT32U   sym_ctr;
;;;1046       CPU_INT32U   sym_byte_ctr;
;;;1047   #endif
;;;1048   
;;;1049       tx_buf_start = tx_buf;                                          /* Save beginning of TX buffer in case packet           */
00017c  9600              STR      r6,[sp,#0]
;;;1050                                                                       /*  ... ends up being too long.                         */
;;;1051       tx_length    = PROBE_COM_SIZE_TX_HEADER;                        /* Initial TX packet length = 4 = size of header        */
00017e  2504              MOVS     r5,#4
;;;1052   
;;;1053       if (rx_pkt_sz  < 7) {                                           /* If the RX data packet is NOT expected size           */
000180  f1ba0f07          CMP      r10,#7
000184  d205              BCS      |L1.402|
;;;1054                                                                       /*        =  2      (= Rx header size   )               */
;;;1055                                                                       /*        +  5      (= 1 item descriptor)               */
;;;1056           return (ProbeCom_CmdError(tx_buf, PROBE_COM_STATUS_RX_PKT_WRONG_SIZE));
000186  4630              MOV      r0,r6
000188  b005              ADD      sp,sp,#0x14
00018a  e8bd4ff0          POP      {r4-r11,lr}
00018e  21fe              MOVS     r1,#0xfe
000190  e7fe              B        ProbeCom_CmdError
                  |L1.402|
;;;1057       }
;;;1058   
;;;1059                                                                       /* No error (yet)                                       */
;;;1060                                                                       /*  (a) Save TX data segment header                     */
;;;1061       tx_buf[0]  = PROBE_COM_FMT_TX_MULTIPLE_RD_LO;                   /*          (i) TX packet format                        */
000192  2007              MOVS     r0,#7
000194  7030              STRB     r0,[r6,#0]
;;;1062       tx_buf[1]  = PROBE_COM_FMT_TX_MULTIPLE_RD_HI;
000196  2080              MOVS     r0,#0x80
000198  7070              STRB     r0,[r6,#1]
;;;1063       tx_buf[2]  = PROBE_COM_STATUS_OK;                               /*         (ii) Target status                           */
00019a  2001              MOVS     r0,#1
00019c  70b0              STRB     r0,[r6,#2]
;;;1064       tx_buf[3]  = ProbeCom_PktModifier();                            /*        (iii) Modifier                                */
00019e  f7fffffe          BL       ProbeCom_PktModifier
0001a2  70f0              STRB     r0,[r6,#3]
;;;1065       tx_buf    += PROBE_COM_SIZE_TX_HEADER;
0001a4  f1060b04          ADD      r11,r6,#4
;;;1066   
;;;1067       rx_pkt_ix  = 7;                                                 /*  (b) Receive packet index after first item           */
0001a8  2707              MOVS     r7,#7
;;;1068                                                                       /*        =  2      (= Rx header size   )               */
;;;1069                                                                       /*        +  5      (= 1 item descriptor)               */
;;;1070   
;;;1071   #if (PROBE_COM_STAT_EN == DEF_ENABLED)
;;;1072       sym_ctr      = 0;
0001aa  f04f0800          MOV      r8,#0
;;;1073       sym_byte_ctr = 0;
0001ae  f04f0900          MOV      r9,#0
                  |L1.434|
;;;1074   #endif
;;;1075                                                                       /*  (c) Store data for each item                        */
;;;1076       while (rx_pkt_ix <= rx_pkt_sz) {
;;;1077           nbytes     =  rx_buf[0];
0001b2  7826              LDRB     r6,[r4,#0]
;;;1078           addr       = (rx_buf[4] << 8) + rx_buf[3];
0001b4  78e0              LDRB     r0,[r4,#3]
0001b6  7921              LDRB     r1,[r4,#4]
0001b8  eb002001          ADD      r0,r0,r1,LSL #8
;;;1079           addr       = (addr      << 8) + rx_buf[2];
0001bc  78a1              LDRB     r1,[r4,#2]
0001be  eb012000          ADD      r0,r1,r0,LSL #8
;;;1080           addr       = (addr      << 8) + rx_buf[1];
0001c2  7861              LDRB     r1,[r4,#1]
0001c4  eb012100          ADD      r1,r1,r0,LSL #8
;;;1081   
;;;1082           rx_buf    += 5;
0001c8  1d64              ADDS     r4,r4,#5
;;;1083   
;;;1084           tx_length += nbytes;                                        /*        (iii) Add number of bytes to pkt len.         */
0001ca  4435              ADD      r5,r5,r6
;;;1085   
;;;1086           if (tx_length > tx_buf_sz) {                                /*         (iv) Will be too long for TX buffer?         */
0001cc  9804              LDR      r0,[sp,#0x10]
0001ce  4285              CMP      r5,r0
0001d0  d905              BLS      |L1.478|
;;;1087               tx_buf = tx_buf_start;
0001d2  9800              LDR      r0,[sp,#0]
;;;1088               return (ProbeCom_CmdError(tx_buf, PROBE_COM_STATUS_TX_PKT_TOO_LARGE));
0001d4  b005              ADD      sp,sp,#0x14
0001d6  e8bd4ff0          POP      {r4-r11,lr}
0001da  21fd              MOVS     r1,#0xfd
0001dc  e7fe              B        ProbeCom_CmdError
                  |L1.478|
;;;1089           }
;;;1090   
;;;1091   #if (PROBE_COM_STAT_EN == DEF_ENABLED)
;;;1092           sym_ctr++;                                                  /*          (v) Increment local sym. counter            */
0001de  f1080801          ADD      r8,r8,#1
;;;1093           sym_byte_ctr += nbytes;
0001e2  44b1              ADD      r9,r9,r6
;;;1094   #endif
;;;1095   
;;;1096           Mem_Copy((void *)tx_buf, (void *)((CPU_ADDR)addr), nbytes); /*         (vi) Otherwise, save TX data                 */
0001e4  4632              MOV      r2,r6
0001e6  4658              MOV      r0,r11
0001e8  f7fffffe          BL       Mem_Copy
;;;1097   
;;;1098           tx_buf    += nbytes;
0001ec  44b3              ADD      r11,r11,r6
;;;1099           rx_pkt_ix += 5;
0001ee  1d7f              ADDS     r7,r7,#5
0001f0  4557              CMP      r7,r10                ;1076
0001f2  d9de              BLS      |L1.434|
;;;1100       }
;;;1101   
;;;1102   #if (PROBE_COM_STAT_EN == DEF_ENABLED)
;;;1103           ProbeCom_TxSymCtr     += sym_ctr;                           /* Increment global sym. counter                        */
0001f4  487c              LDR      r0,|L1.1000|
0001f6  6881              LDR      r1,[r0,#8]  ; ProbeCom_TxSymCtr
0001f8  4441              ADD      r1,r1,r8
0001fa  6081              STR      r1,[r0,#8]  ; ProbeCom_TxSymCtr
;;;1104           ProbeCom_TxSymByteCtr += sym_byte_ctr;
0001fc  68c1              LDR      r1,[r0,#0xc]  ; ProbeCom_TxSymByteCtr
0001fe  4449              ADD      r1,r1,r9
000200  60c1              STR      r1,[r0,#0xc]  ; ProbeCom_TxSymByteCtr
;;;1105   #endif
;;;1106   
;;;1107       return (tx_length);
000202  b2a8              UXTH     r0,r5
;;;1108   }
000204  b005              ADD      sp,sp,#0x14
000206  e8bd8ff0          POP      {r4-r11,pc}
;;;1109   
                          ENDP

                  ProbeCom_GetINT8U PROC
;;;1303   {
;;;1304       return (*((*buf)++));
00020a  6801              LDR      r1,[r0,#0]
00020c  1c4a              ADDS     r2,r1,#1
00020e  6002              STR      r2,[r0,#0]
000210  7808              LDRB     r0,[r1,#0]
;;;1305   }
000212  4770              BX       lr
;;;1306   
                          ENDP

                  ProbeCom_GetINT16U PROC
;;;1308   static  CPU_INT16U  ProbeCom_GetINT16U (CPU_INT08U **buf)
;;;1309   {
000214  b510              PUSH     {r4,lr}
000216  4604              MOV      r4,r0
;;;1310       CPU_INT16U  lowbyte;
;;;1311       CPU_INT16U  highbyte;
;;;1312   
;;;1313   
;;;1314       lowbyte  = ProbeCom_GetINT8U(buf);
000218  4620              MOV      r0,r4
00021a  f7fffffe          BL       ProbeCom_GetINT8U
00021e  4603              MOV      r3,r0
;;;1315       highbyte = ProbeCom_GetINT8U(buf);
000220  4620              MOV      r0,r4
000222  f7fffffe          BL       ProbeCom_GetINT8U
;;;1316       return ((highbyte << 8) | lowbyte);
000226  ea432000          ORR      r0,r3,r0,LSL #8
;;;1317   }
00022a  bd10              POP      {r4,pc}
;;;1318   
                          ENDP

                  ProbeCom_GetINT32U PROC
;;;1320   static  CPU_INT32U  ProbeCom_GetINT32U (CPU_INT08U **buf)
;;;1321   {
00022c  b530              PUSH     {r4,r5,lr}
00022e  4605              MOV      r5,r0
;;;1322       CPU_INT32U  highword;
;;;1323       CPU_INT32U  lowword;
;;;1324   
;;;1325   
;;;1326       lowword  = ProbeCom_GetINT16U(buf);
000230  4628              MOV      r0,r5
000232  f7fffffe          BL       ProbeCom_GetINT16U
000236  4604              MOV      r4,r0
;;;1327       highword = ProbeCom_GetINT16U(buf);
000238  4628              MOV      r0,r5
00023a  f7fffffe          BL       ProbeCom_GetINT16U
;;;1328       return ((highword << 16) | lowword);

⌨️ 快捷键说明

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