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

📄 lib_str.lst

📁 编译环境是 iar EWARM ,STM32 下的UCOSII
💻 LST
📖 第 1 页 / 共 5 页
字号:
   \   00000026   761C               ADDS     R6,R6,#+1
    308              }
   \                     ??Str_Copy_N_2:
   \   00000028   002D               CMP      R5,#+0
   \   0000002A   06D0               BEQ.N    ??Str_Copy_N_4
   \   0000002C   0029               CMP      R1,#+0
   \   0000002E   04D0               BEQ.N    ??Str_Copy_N_4
   \   00000030   0F78               LDRB     R7,[R1, #+0]
   \   00000032   002F               CMP      R7,#+0
   \   00000034   01D0               BEQ.N    ??Str_Copy_N_4
   \   00000036   9642               CMP      R6,R2
   \   00000038   F1D3               BCC.N    ??Str_Copy_N_3
    309          
    310             *pstr = (CPU_CHAR)0;                                         /* Append NULL char (see Note #2b2).                    */
   \                     ??Str_Copy_N_4:
   \   0000003A   2370               STRB     R3,[R4, #+0]
    311          
    312          
    313              return (pdest);
   \   0000003C   F0BD               POP      {R4-R7,PC}       ;; return
    314          }
    315          
    316          
    317          /*$PAGE*/
    318          /*
    319          *********************************************************************************************************
    320          *                                              Str_Cat()
    321          *
    322          * Description : Append concatenation string to destination string.
    323          *
    324          * Argument(s) : pdest       Pointer to destination   string to append concatenation  string (see Note #1).
    325          *
    326          *               pstr_cat    Pointer to concatenation string to append to destination string.
    327          *
    328          * Return(s)   : Pointer to destination string, if NO errors (see Note #2).
    329          *
    330          *               Pointer to NULL,               otherwise.
    331          *
    332          * Caller(s)   : Application.
    333          *
    334          * Note(s)     : (1) Destination string buffer size NOT validated; buffer overruns MUST be prevented by caller.
    335          *
    336          *                   (a) Destination buffer size MUST be large enough to accommodate the entire concatenated
    337          *                       string size including the terminating NULL character.
    338          *
    339          *               (2) String concatenation terminates when :
    340          *
    341          *                   (a) Destination/Concatenation string pointer(s) are passed NULL pointers.
    342          *                       (1) No string concatenation performed; NULL pointer returned.
    343          *
    344          *                   (b) Destination string overlaps with NULL address.
    345          *                       (1) No string concatenation performed; NULL pointer returned.
    346          *
    347          *                   (c) Destination/Concatenation string pointer(s) points to NULL.
    348          *                       (1) String buffer(s) overlap with NULL address.
    349          *                       (2) Concatenation string appended into destination string buffer up to but NOT
    350          *                           beyond or including the NULL address; destination string buffer properly
    351          *                           terminated with NULL character.
    352          *
    353          *                   (d) Concatenation string's terminating NULL character found.
    354          *                       (1) Entire concatenation string appended to destination string.
    355          *********************************************************************************************************
    356          */
    357          

   \                                 In segment CODE, align 4, keep-with-next
    358          CPU_CHAR  *Str_Cat (CPU_CHAR  *pdest,
    359                              CPU_CHAR  *pstr_cat)
    360          {
   \                     Str_Cat:
   \   00000000   10B5               PUSH     {R4,LR}
    361              CPU_CHAR  *pstr;
    362              CPU_CHAR  *pstr_next;
    363          
    364                                                                          /* Rtn NULL if str ptr(s) NULL (see Note #2a).          */
    365              if (pdest == (CPU_CHAR *)0) {
   \   00000002   0028               CMP      R0,#+0
   \   00000004   01D1               BNE.N    ??Str_Cat_0
    366                  return  ((CPU_CHAR *)0);
   \                     ??Str_Cat_1:
   \   00000006   0020               MOVS     R0,#+0
   \   00000008   10BD               POP      {R4,PC}
    367              }
    368              if (pstr_cat == (CPU_CHAR *)0) {
   \                     ??Str_Cat_0:
   \   0000000A   0029               CMP      R1,#+0
   \   0000000C   FBD0               BEQ.N    ??Str_Cat_1
    369                  return  ((CPU_CHAR *)0);
    370              }
    371          
    372          
    373              pstr = pdest;
   \   0000000E   0200               MOVS     R2,R0
   \   00000010   00E0               B.N      ??Str_Cat_2
    374              while (( pstr != (CPU_CHAR *)0) &&                          /* Adv to end of cur dest str until NULL ptr ...        */
    375                     (*pstr != (CPU_CHAR  )0)) {                          /* ... or NULL char found..                             */
    376                  pstr++;
   \                     ??Str_Cat_3:
   \   00000012   521C               ADDS     R2,R2,#+1
    377              }
   \                     ??Str_Cat_2:
   \   00000014   002A               CMP      R2,#+0
   \   00000016   02D0               BEQ.N    ??Str_Cat_4
   \   00000018   1378               LDRB     R3,[R2, #+0]
   \   0000001A   002B               CMP      R3,#+0
   \   0000001C   F9D1               BNE.N    ??Str_Cat_3
    378              if (pstr == (CPU_CHAR *)0) {                                /* If NULL str overrun, rtn NULL (see Note #2b).        */
   \                     ??Str_Cat_4:
   \   0000001E   002A               CMP      R2,#+0
   \   00000020   F1D0               BEQ.N    ??Str_Cat_1
    379                  return ((CPU_CHAR *)0);
    380              }
    381          
    382              pstr_next = pstr;
    383              pstr_next++;
   \   00000022   1300               MOVS     R3,R2
   \   00000024   5B1C               ADDS     R3,R3,#+1
   \   00000026   03E0               B.N      ??Str_Cat_5
    384              while (( pstr_next != (CPU_CHAR *)0) &&                     /* Cat str until NULL ptr(s) (see Note #2c) ...         */
    385                     ( pstr_cat  != (CPU_CHAR *)0) &&
    386                     (*pstr_cat  != (CPU_CHAR  )0)) {                     /* ... or NULL char found    (see Note #2d).            */
    387                 *pstr = *pstr_cat;
   \                     ??Str_Cat_6:
   \   00000028   1470               STRB     R4,[R2, #+0]
    388                  pstr++;
   \   0000002A   521C               ADDS     R2,R2,#+1
    389                  pstr_next++;
   \   0000002C   5B1C               ADDS     R3,R3,#+1
    390                  pstr_cat++;
   \   0000002E   491C               ADDS     R1,R1,#+1
    391              }
   \                     ??Str_Cat_5:
   \   00000030   002B               CMP      R3,#+0
   \   00000032   04D0               BEQ.N    ??Str_Cat_7
   \   00000034   0029               CMP      R1,#+0
   \   00000036   02D0               BEQ.N    ??Str_Cat_7
   \   00000038   0C78               LDRB     R4,[R1, #+0]
   \   0000003A   002C               CMP      R4,#+0
   \   0000003C   F4D1               BNE.N    ??Str_Cat_6
    392          
    393             *pstr = (CPU_CHAR)0;                                         /* Append NULL char (see Note #2c2).                    */
   \                     ??Str_Cat_7:
   \   0000003E   0021               MOVS     R1,#+0
   \   00000040   1170               STRB     R1,[R2, #+0]
    394          
    395          
    396              return (pdest);
   \   00000042   10BD               POP      {R4,PC}          ;; return
    397          }
    398          
    399          
    400          /*$PAGE*/
    401          /*
    402          *********************************************************************************************************
    403          *                                             Str_Cat_N()
    404          *
    405          * Description : Append concatenation string to destination string, up to a maximum number of characters.
    406          *
    407          * Argument(s) : pdest       Pointer to destination   string to append concatenation  string (see Note #1).
    408          *
    409          *               pstr_cat    Pointer to concatenation string to append to destination string.
    410          *
    411          *               len_max     Maximum number of characters to concatenate (see Note #2e).
    412          *
    413          * Return(s)   : Pointer to destination string, if NO errors (see Note #2).
    414          *
    415          *               Pointer to NULL,               otherwise.
    416          *
    417          * Caller(s)   : Application.
    418          *
    419          * Note(s)     : (1) Destination string buffer size NOT validated; buffer overruns MUST be prevented by caller.
    420          *
    421          *                   (a) Destination buffer size MUST be large enough to accommodate the entire concatenated
    422          *                       string size including the terminating NULL character.
    423          *
    424          *               (2) String concatenation terminates when :
    425          *
    426          *                   (a) Destination/Concatenation string pointer(s) are passed NULL pointers.
    427          *                       (1) No string concatenation performed; NULL pointer returned.
    428          *
    429          *                   (b) Destination string overlaps with NULL address.
    430          *                       (1) No string concatenation performed; NULL pointer returned.
    431          *
    432          *                   (c) Destination/Concatenation string pointer(s) points to NULL.
    433          *                       (1) String buffer(s) overlap with NULL address.
    434          *                       (2) Concatenation string appended into destination string buffer up to but NOT
    435          *                           beyond or including the NULL address; destination string buffer properly
    436          *                           terminated with NULL character.
    437          *
    438          *                   (d) Concatenation string's terminating NULL character found.
    439          *                       (1) Entire concatenation string appended to destination string.
    440          *
    441          *                   (e) 'len_max' number of characters concatenated.
    442          *                       (1) 'len_max' number of characters does NOT include the terminating NULL character.
    443          *
    444          *                           See also Note #1a.
    445          *********************************************************************************************************
    446          */
    447          /*$PAGE*/

   \                                 In segment CODE, align 4, keep-with-next
    448          CPU_CHAR  *Str_Cat_N (CPU_CHAR    *pdest,
    449                                CPU_CHAR    *pstr_cat,
    450                                CPU_SIZE_T   len_max)
    451          {
   \                     Str_Cat_N:
   \   00000000   F0B5               PUSH     {R4-R7,LR}
    452              CPU_CHAR    *pstr;
    453              CPU_CHAR    *pstr_next;
    454              CPU_SIZE_T   len_cat;
    455          
    456                                                                          /* Rtn NULL if str ptr(s) NULL     (see Note #2a).      */
    457              if (pdest == (CPU_CHAR *)0) {
   \   00000002   0028               CMP      R0,#+0
   \   00000004   01D1               BNE.N    ??Str_Cat_N_0
    458                  return  ((CPU_CHAR *)0);
   \                     ??Str_Cat_N_1:
   \   00000006   0020               MOVS     R0,#+0
   \   00000008   F0BD               POP      {R4-R7,PC}
    459              }

⌨️ 快捷键说明

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