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

📄 probe_com.lst

📁 编译环境是 iar EWARM ,STM32 下的UCOSII
💻 LST
📖 第 1 页 / 共 5 页
字号:
    726          *
    727          * Description : Get packet modfier byte.
    728          *
    729          * Argument(s) : none.
    730          *
    731          * Return(s)   : The modifier byte.
    732          *
    733          * Caller(s)   : Various command handlers (ProbeCom_Cmd????()).
    734          *
    735          * Note(s)     : none.
    736          *********************************************************************************************************
    737          */
    738          

   \                                 In segment CODE, align 4, keep-with-next
    739          static  CPU_INT08U  ProbeCom_PktModifier (void)
    740          {
    741              CPU_INT08U  mod;
    742          
    743          
    744              mod = PROBE_COM_MODIFIER_NONE;
    745          
    746          #if (PROBE_COM_SUPPORT_STR == DEF_TRUE)
    747              if (ProbeCom_StrRdy() == DEF_TRUE) {
    748                  DEF_BIT_SET(mod, PROBE_COM_MODIFIER_STR_HAVE);
    749              }
    750          #endif
    751          
    752              return (mod);
   \                     ProbeCom_PktModifier:
   \   00000000   0020               MOVS     R0,#+0
   \   00000002   7047               BX       LR               ;; return
    753          }
    754          
    755          
    756          /*
    757          *********************************************************************************************************
    758          *                                           ProbeCom_CmdErr()
    759          *
    760          * Description : Formulate error response when the target receives a request it cannot handle.
    761          *
    762          * Argument(s) : ptx_buf      Pointer to the transmit buffer
    763          *
    764          *               comm_err     Error that occurred
    765          *
    766          * Return(s)   : The number of bytes written to the tx buffer.
    767          *
    768          * Caller(s)   : Various command handlers (ProbeCom_Cmd????()).
    769          *
    770          * Note(s)     : (1) The TX format:
    771          *
    772          *                   (A) A 2-byte format  , indicating the data segment format;
    773          *                   (B) A 1-byte constant, PROBE_RS232_OK,   if the location can    be read;
    774          *                       A 1-byte constant, PROBE_RS232_FAIL, if the location cannot be read.
    775          *                   (C) A 1-byte modifier.
    776          *
    777          *                         +-------------------------+------------+------------+
    778          *                         |          Format         |   Status   |  Modifier  |
    779          *                         +-------------------------+------------+------------+
    780          *********************************************************************************************************
    781          */
    782          

   \                                 In segment CODE, align 4, keep-with-next
    783          static  CPU_INT16U  ProbeCom_CmdErr (CPU_INT08U  *ptx_buf,
    784                                               CPU_INT08U   comm_err)
    785          {
   \                     ProbeCom_CmdErr:
   \   00000000   11B5               PUSH     {R0,R4,LR}
   \   00000002   0C00               MOVS     R4,R1
    786          #if (PROBE_COM_STAT_EN == DEF_ENABLED)
    787              ProbeCom_ErrPktCtr++;
   \   00000004   ....               LDR.N    R0,??DataTable9  ;; ProbeCom_RxPktCtr
   \   00000006   0169               LDR      R1,[R0, #+16]
   \   00000008   491C               ADDS     R1,R1,#+1
   \   0000000A   0161               STR      R1,[R0, #+16]
    788          #endif
    789          
    790              ProbeCom_StoINT16U(&ptx_buf, PROBE_COM_FMT_TX_ERROR);       /* TX pkt format.                                  */
   \   0000000C   5FF40041           MOVS     R1,#+32768
   \   00000010   6846               MOV      R0,SP
   \   00000012   ........           BL       ProbeCom_StoINT16U
    791              ProbeCom_StoINT8U( &ptx_buf, comm_err);                     /* Target status.                                  */
   \   00000016   2100               MOVS     R1,R4
   \   00000018   6846               MOV      R0,SP
   \   0000001A   ........           BL       ProbeCom_StoINT8U
    792              ProbeCom_StoINT8U( &ptx_buf, ProbeCom_PktModifier());       /* Modifier.                                       */
   \   0000001E   ........           BL       ProbeCom_PktModifier
   \   00000022   0100               MOVS     R1,R0
   \   00000024   6846               MOV      R0,SP
   \   00000026   ........           BL       ProbeCom_StoINT8U
    793              return (PROBE_COM_SIZE_TX_HDR);                             /* Rtn TX data segment size =  4 (= Tx hdr size).  */
   \   0000002A   0420               MOVS     R0,#+4
   \   0000002C   12BD               POP      {R1,R4,PC}       ;; return
    794          }
    795          
    796          
    797          /*
    798          *********************************************************************************************************
    799          *                                           ProbeCom_CmdQuery()
    800          *
    801          * Description : Parse the FMT_QUERY command & formulate response.  This command asks the target
    802          *               about its capabilities, which are returned in response.
    803          *
    804          * Argument(s) : prx_buf         Pointer to the receive  buffer
    805          *
    806          *               ptx_buf         Pointer to the transmit buffer
    807          *
    808          *               rx_pkt_size     Size of the receive  packet
    809          *
    810          *               tx_buf_size     Size of the transmit buffer
    811          *
    812          * Return(s)   : The number of bytes written to the tx buffer.
    813          *
    814          * Caller(s)   : ProbeCom_ParseRxPkt().
    815          *
    816          * Note(s)     : (1) The RX format:
    817          *
    818          *                   (A) A 2-byte format, indicating the data segment format;
    819          *                   (B) A 2-byte query , indicating the query type.
    820          *
    821          *                         +-------------------------+-------------------------+
    822          *                         |          Format         |          Query          |
    823          *                         +-------------------------+-------------------------+
    824          *
    825          *              (2) The TX format:
    826          *
    827          *                   (A) A 2-byte format, indicating the data segment format;
    828          *                   (B) A 1-byte status, indicating the status after the request;
    829          *                   (C) A 1-byte modifier;
    830          *                   (E) A n-byte answer, the answer to the query.
    831          *
    832          *                         +-------------------------+------------+------------+
    833          *                         |          Format         |   Status   |  Modifier  |
    834          *                         +-------------------------+------------+------------+
    835          *                         |                       Answer                      |
    836          *                         |                         .                         |
    837          *                         |                         .                         |
    838          *                         |                         .                         |
    839          *                         +---------------------------------------------------+
    840          *
    841          *********************************************************************************************************
    842          */
    843          

   \                                 In segment CODE, align 4, keep-with-next
    844          static  CPU_INT16U  ProbeCom_CmdQuery (CPU_INT08U  *prx_buf,
    845                                                 CPU_INT08U  *ptx_buf,
    846                                                 CPU_INT16U   rx_pkt_size,
    847                                                 CPU_INT16U   tx_buf_size)
    848          {
   \                     ProbeCom_CmdQuery:
   \   00000000   33B5               PUSH     {R0,R1,R4,R5,LR}
   \   00000002   81B0               SUB      SP,SP,#+4
    849              CPU_INT16U  query;
    850              CPU_INT16U  nbytes;
    851              CPU_INT32U  version;
    852          
    853          
    854              query  = 0;
    855              nbytes = 0;
    856          
    857                                                                          /* ------------------- CHK PKT SIZE ------------------- */
    858                                                                          /* Expected size =  2 (= Rx header size)                */
    859                                                                          /*               +  2 (= Query         ).               */
    860              if (rx_pkt_size != 4) {
   \   00000004   042A               CMP      R2,#+4
   \   00000006   04D0               BEQ.N    ??ProbeCom_CmdQuery_0
    861                  return (ProbeCom_CmdErr(ptx_buf, PROBE_COM_STATUS_RX_PKT_WRONG_SIZE));
   \   00000008   FE21               MOVS     R1,#+254
   \   0000000A   0298               LDR      R0,[SP, #+8]
   \   0000000C   ........           BL       ProbeCom_CmdErr
   \   00000010   3EBD               POP      {R1-R5,PC}
    862              }
    863          
    864                                                                          /* ------------------- HANDLE QUERY ------------------- */
    865              query = ProbeCom_GetINT16U(&prx_buf);                       /* Read the query.                                      */
   \                     ??ProbeCom_CmdQuery_0:
   \   00000012   01A8               ADD      R0,SP,#+4
   \   00000014   ........           BL       ProbeCom_GetINT16U
   \   00000018   0400               MOVS     R4,R0
    866          
    867              switch (query) {
   \   0000001A   2E49               LDR.N    R1,??ProbeCom_CmdQuery_1  ;; 0x101
   \   0000001C   401A               SUBS     R0,R0,R1
   \   0000001E   0128               CMP      R0,#+1
   \   00000020   06D9               BLS.N    ??ProbeCom_CmdQuery_2
   \   00000022   491E               SUBS     R1,R1,#+1
   \   00000024   401A               SUBS     R0,R0,R1
   \   00000026   03D0               BEQ.N    ??ProbeCom_CmdQuery_2
   \   00000028   5FF46061           MOVS     R1,#+3584
   \   0000002C   401A               SUBS     R0,R0,R1
   \   0000002E   20D1               BNE.N    ??ProbeCom_CmdQuery_3
    868                  case PROBE_COM_QUERY_MAX_RX_SIZE:
    869                  case PROBE_COM_QUERY_MAX_TX_SIZE:
    870                  case PROBE_COM_QUERY_FMT_SUPPORT:
    871                  case PROBE_COM_QUERY_ENDIANNESS_TEST:
    872                       break;
    873          
    874                  default:
    875                       return (ProbeCom_CmdErr(ptx_buf, PROBE_COM_STATUS_QUERY_NOT_SUPPORTED));
    876              }
    877          
    878                                                                          /* Store TX pkt header :                                */
    879              ProbeCom_StoINT16U(&ptx_buf, PROBE_COM_FMT_TX_QUERY);       /*  (a) TX pkt format.                                  */
   \                     ??ProbeCom_CmdQuery_2:
   \   00000030   2949               LDR.N    R1,??ProbeCom_CmdQuery_1+0x4  ;; 0x8001
   \   00000032   02A8               ADD      R0,SP,#+8
   \   00000034   ........           BL       ProbeCom_StoINT16U
    880              ProbeCom_StoINT8U( &ptx_buf, PROBE_COM_STATUS_OK);          /*  (b) Target status.                                  */
   \   00000038   0121               MOVS     R1,#+1
   \   0000003A   02A8               ADD      R0,SP,#+8
   \   0000003C   ........           BL       ProbeCom_StoINT8U
    881              ProbeCom_StoINT8U( &ptx_buf, ProbeCom_PktModifier());       /*  (c) Modifier.                                       */
   \   00000040   ........           BL       ProbeCom_PktModifier
   \   00000044   0100               MOVS     R1,R0
   \   00000046   02A8               ADD      R0,SP,#+8
   \   00000048   ........           BL       ProbeCom_StoINT8U
    882       

⌨️ 快捷键说明

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