📄 probe_com.lst
字号:
337 * Parse Receive Packet
338 *
339 * Description: This routine is called after a complete packet has been received.
340 *
341 * Argument(s): rx_pkt is a pointer to the receive packet buffer
342 * tx_pkt is a pointer to the transmit packet buffer
343 * rx_pkt_sz is the size of the received packet
344 * tx_pkt_sz is the size of the transmit packet buffer
345 *
346 * Returns : The number of bytes in the data segment of the packet to transmit in response.
347 *********************************************************************************************************
348 */
349
\ In segment CODE, align 4, keep-with-next
350 CPU_INT16U ProbeCom_ParseRxPkt (void *rx_pkt,
351 void *tx_pkt,
352 CPU_INT16U rx_pkt_sz,
353 CPU_INT16U tx_buf_sz)
354 {
\ ProbeCom_ParseRxPkt:
\ 00000000 70B5 PUSH {R4-R6,LR}
\ 00000002 0C00 MOVS R4,R1
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;
363 format = (rx_buf[1] << 8) + rx_buf[0];
\ 00000004 4178 LDRB R1,[R0, #+1]
\ 00000006 0578 LDRB R5,[R0, #+0]
\ 00000008 15EB0121 ADDS R1,R5,R1, LSL #+8
\ 0000000C 89B2 UXTH R1,R1
364 rx_buf += 2;
\ 0000000E 801C ADDS R0,R0,#+2
365
366 #if (PROBE_COM_STAT_EN == DEF_ENABLED)
367 ProbeCom_RxPktCtr++;
\ 00000010 .... LDR.N R5,??DataTable1 ;; ProbeCom_RxPktCtr
\ 00000012 2E68 LDR R6,[R5, #+0]
\ 00000014 761C ADDS R6,R6,#+1
\ 00000016 2E60 STR R6,[R5, #+0]
368 ProbeCom_TxPktCtr++;
\ 00000018 6E68 LDR R6,[R5, #+4]
\ 0000001A 761C ADDS R6,R6,#+1
\ 0000001C 6E60 STR R6,[R5, #+4]
369 #endif
370
371 switch (format) {
\ 0000001E 0129 CMP R1,#+1
\ 00000020 06D0 BEQ.N ??ProbeCom_ParseRxPkt_0
\ 00000022 0229 CMP R1,#+2
\ 00000024 08D0 BEQ.N ??ProbeCom_ParseRxPkt_1
\ 00000026 0729 CMP R1,#+7
\ 00000028 0AD0 BEQ.N ??ProbeCom_ParseRxPkt_2
\ 0000002A 0929 CMP R1,#+9
\ 0000002C 0CD0 BEQ.N ??ProbeCom_ParseRxPkt_3
\ 0000002E 0FE0 B.N ??ProbeCom_ParseRxPkt_4
372 case PROBE_COM_FMT_RX_QUERY:
373 tx_buf_wr = ProbeCom_CmdQuery( rx_buf, tx_buf, rx_pkt_sz, tx_buf_sz);
\ ??ProbeCom_ParseRxPkt_0:
\ 00000030 2100 MOVS R1,R4
\ 00000032 ........ BL ProbeCom_CmdQuery
\ 00000036 70BD POP {R4-R6,PC}
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);
\ ??ProbeCom_ParseRxPkt_1:
\ 00000038 2100 MOVS R1,R4
\ 0000003A ........ BL ProbeCom_CmdSimpleRd
\ 0000003E 70BD POP {R4-R6,PC}
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);
\ ??ProbeCom_ParseRxPkt_2:
\ 00000040 2100 MOVS R1,R4
\ 00000042 ........ BL ProbeCom_CmdMultipleRd
\ 00000046 70BD POP {R4-R6,PC}
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);
\ ??ProbeCom_ParseRxPkt_3:
\ 00000048 2100 MOVS R1,R4
\ 0000004A ........ BL ProbeCom_CmdStrGet
\ 0000004E 70BD POP {R4-R6,PC}
393 break;
394 #endif
395
396 default:
397 tx_buf_wr = ProbeCom_CmdError(tx_buf, PROBE_COM_STATUS_UNKNOWN_REQUEST);
\ ??ProbeCom_ParseRxPkt_4:
\ 00000050 F921 MOVS R1,#+249
\ 00000052 2000 MOVS R0,R4
\ 00000054 ........ BL ProbeCom_CmdError
398 break;
399 }
400
401 return (tx_buf_wr);
\ 00000058 70BD POP {R4-R6,PC} ;; return
402 }
403
404
405 /*
406 *********************************************************************************************************
407 * Queue String for Transmission
408 *
409 * Description: This routine is called to append a string in the string buffer.
410 *
411 * Argument(s): s is a pointer to the string to send.
412 *
413 * dly allows the calling task to delay for a certain number of milliseconds until
414 * the entire string has been queued in the buffer. If this value is zero, then
415 * the function will return after queueing in the buffer the portion that fits
416 * immediately.
417 *
418 * Returns : DEF_TRUE if the entire string was queued in the buffer.
419 * DEF_FALSE if the entire string could not be queued in the buffer.
420 *
421 * Note(s) : (1) The string buffer is implemented as a circular buffer. This function is one of two
422 * points of access for this buffer, the other being in the task or ISR which forms the .
423 * tx packets. Only this function should modify the global current write index
424 * (ProbeComStrBufWrIx); only the task or ISR which forms the packets should modify the
425 * global current read index (ProbeComStrBufRdIx).
426 *
427 * (2) The global current write index (ProbeComStrBufWrIx) is the index of the next location
428 * in the buffer to write. The global current read index (ProbeComStrBufRdIx) is the
429 * index of the next location in the buffer to read.
430 *
431 * (3) The string buffer, an array of PROBE_COM_STR_BUF_SIZE bytes, can only hold
432 * (PROBE_COM_STR_BUF_SIZE - 1) bytes so that the condition
433 *
434 * ProbeComStrBufWrIx == ProbeComStrBufRdIx
435 *
436 * will be true if and only if the buffer is empty. Consequently, this function
437 * always leaves an empty space in the buffer.
438 *
439 * (4) If called from an ISR, dly MUST be 0.
440 *********************************************************************************************************
441 */
442
443 #if (PROBE_COM_SUPPORT_STR == DEF_TRUE)
\ In segment CODE, align 4, keep-with-next
444 CPU_BOOLEAN ProbeCom_TxStr (CPU_CHAR *s,
445 CPU_INT16U dly)
446 {
\ ProbeCom_TxStr:
\ 00000000 2DE9F043 PUSH {R4-R9,LR}
\ 00000004 8046 MOV R8,R0
\ 00000006 8946 MOV R9,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) {
\ 00000008 4846 MOV R0,R9
\ 0000000A 0028 CMP R0,#+0
\ 0000000C 02D1 BNE.N ??ProbeCom_TxStr_0
458 ret = ProbeCom_OS_Pend(DEF_FALSE);
\ 0000000E ........ _BLF ProbeCom_OS_Pend,??ProbeCom_OS_Pend??rT
\ 00000012 02E0 B.N ??ProbeCom_TxStr_1
459 } else {
460 ret = ProbeCom_OS_Pend(DEF_TRUE);
\ ??ProbeCom_TxStr_0:
\ 00000014 0120 MOVS R0,#+1
\ 00000016 ........ _BLF ProbeCom_OS_Pend,??ProbeCom_OS_Pend??rT
461 }
462
463 if (ret == DEF_FALSE) {
\ ??ProbeCom_TxStr_1:
\ 0000001A 0028 CMP R0,#+0
\ 0000001C 02D1 BNE.N ??ProbeCom_TxStr_2
464 return (DEF_FALSE);
\ ??ProbeCom_TxStr_3:
\ 0000001E 0020 MOVS R0,#+0
\ ??ProbeCom_TxStr_4:
\ 00000020 BDE8F083 POP {R4-R9,PC} ;; return
465 }
466
467 len = (CPU_INT32U)Str_Len(s); /* Determine length of the string (without NULL byte */
\ ??ProbeCom_TxStr_2:
\ 00000024 4046 MOV R0,R8
\ 00000026 ........ _BLF Str_Len,??Str_Len??rT
\ 0000002A 0500 MOVS R5,R0
\ 0000002C .... LDR.N R6,??DataTable7 ;; ProbeCom_RxPktCtr
\ 0000002E 01E0 B.N ??ProbeCom_TxStr_5
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) */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -