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

📄 lib_str.lst

📁 stm32+ucos-ii
💻 LST
📖 第 1 页 / 共 5 页
字号:
    127             (CPU_INT32U)(DEF_INT_32U_MAX_VAL / 26u),         /* 32-bit mult ovf th for base 26.  */
    128             (CPU_INT32U)(DEF_INT_32U_MAX_VAL / 27u),         /* 32-bit mult ovf th for base 27.  */
    129             (CPU_INT32U)(DEF_INT_32U_MAX_VAL / 28u),         /* 32-bit mult ovf th for base 28.  */
    130             (CPU_INT32U)(DEF_INT_32U_MAX_VAL / 29u),         /* 32-bit mult ovf th for base 29.  */
    131             (CPU_INT32U)(DEF_INT_32U_MAX_VAL / 30u),         /* 32-bit mult ovf th for base 30.  */
    132             (CPU_INT32U)(DEF_INT_32U_MAX_VAL / 31u),         /* 32-bit mult ovf th for base 31.  */
    133             (CPU_INT32U)(DEF_INT_32U_MAX_VAL / 32u),         /* 32-bit mult ovf th for base 32.  */
    134             (CPU_INT32U)(DEF_INT_32U_MAX_VAL / 33u),         /* 32-bit mult ovf th for base 33.  */
    135             (CPU_INT32U)(DEF_INT_32U_MAX_VAL / 34u),         /* 32-bit mult ovf th for base 34.  */
    136             (CPU_INT32U)(DEF_INT_32U_MAX_VAL / 35u),         /* 32-bit mult ovf th for base 35.  */
    137             (CPU_INT32U)(DEF_INT_32U_MAX_VAL / 36u)          /* 32-bit mult ovf th for base 36.  */
    138          };
    139          
    140          
    141          /*
    142          *********************************************************************************************************
    143          *                                       LOCAL GLOBAL VARIABLES
    144          *********************************************************************************************************
    145          */
    146          
    147          
    148          /*$PAGE*/
    149          /*
    150          *********************************************************************************************************
    151          *                                      LOCAL FUNCTION PROTOTYPES
    152          *********************************************************************************************************
    153          */
    154          
    155          static  CPU_CHAR    *Str_FmtNbr_Int32  (       CPU_INT32U     nbr,
    156                                                         CPU_INT08U     nbr_dig,
    157                                                         CPU_INT08U     nbr_base,
    158                                                         CPU_BOOLEAN    nbr_neg,
    159                                                         CPU_CHAR       lead_char,
    160                                                         CPU_BOOLEAN    lower_case,
    161                                                         CPU_BOOLEAN    nul,
    162                                                         CPU_CHAR      *pstr);
    163          
    164          static  CPU_INT32U   Str_ParseNbr_Int32(const  CPU_CHAR      *pstr,
    165                                                         CPU_CHAR     **pstr_next,
    166                                                         CPU_INT08U     nbr_base,
    167                                                         CPU_BOOLEAN    nbr_signed,
    168                                                         CPU_BOOLEAN   *pnbr_neg);
    169          
    170          
    171          /*
    172          *********************************************************************************************************
    173          *                                     LOCAL CONFIGURATION ERRORS
    174          *********************************************************************************************************
    175          */
    176          
    177          
    178          /*$PAGE*/
    179          /*
    180          *********************************************************************************************************
    181          *                                              Str_Len()
    182          *
    183          * Description : Calculate length of a string.
    184          *
    185          * Argument(s) : pstr        Pointer to string (see Note #1).
    186          *
    187          * Return(s)   : Length of string; number of characters in string before terminating NULL character 
    188          *                   (see Note #2b1).
    189          *
    190          * Caller(s)   : Application.
    191          *
    192          * Note(s)     : (1) String buffer NOT modified.
    193          *
    194          *               (2) (a) IEEE Std 1003.1, 2004 Edition, Section 'strlen() : DESCRIPTION' states that :
    195          *
    196          *                       (1) "The strlen() function shall compute the number of bytes in the string to 
    197          *                            which 's' ('pstr') points," ...
    198          *                       (2) "not including the terminating null byte."
    199          *
    200          *                   (b) IEEE Std 1003.1, 2004 Edition, Section 'strlen() : RETURN VALUE' states that :
    201          *
    202          *                       (1) "The strlen() function shall return the length of 's' ('pstr');" ...
    203          *                       (2) "no return value shall be reserved to indicate an error."
    204          *
    205          *               (3) String length calculation terminates when :
    206          *
    207          *                   (a) String pointer points to NULL.
    208          *                       (1) String buffer overlaps with NULL address.
    209          *                       (2) String length calculated for string up to but NOT beyond or including
    210          *                           the NULL address.
    211          *
    212          *                   (b) Terminating NULL character found.
    213          *                       (1) String length calculated for string up to but NOT           including
    214          *                           the NULL character (see Note #2a2).
    215          *********************************************************************************************************
    216          */
    217          

   \                                 In section .text, align 2, keep-with-next
    218          CPU_SIZE_T  Str_Len (const  CPU_CHAR  *pstr)
    219          {
   \                     Str_Len:
   \   00000000   38B5               PUSH     {R3-R5,LR}
   \   00000002   0400               MOVS     R4,R0
    220              CPU_SIZE_T  len;
    221          
    222          
    223              len = Str_Len_N(pstr,
    224                              DEF_INT_CPU_U_MAX_VAL);
   \   00000004   5FF0FF31           MOVS     R1,#-1
   \   00000008   2000               MOVS     R0,R4
   \   0000000A   ........           BL       Str_Len_N
   \   0000000E   0500               MOVS     R5,R0
    225          
    226              return (len);
   \   00000010   2800               MOVS     R0,R5
   \   00000012   32BD               POP      {R1,R4,R5,PC}    ;; return
    227          }
    228          
    229          
    230          /*$PAGE*/
    231          /*
    232          *********************************************************************************************************
    233          *                                             Str_Len_N()
    234          *
    235          * Description : Calculate length of a string, up to a maximum number of characters.
    236          *
    237          * Argument(s) : pstr        Pointer to string (see Note #1).
    238          *
    239          *               len_max     Maximum number of characters to search (see Note #3c).
    240          *
    241          * Return(s)   : Length of string; number of characters in string before terminating NULL character, 
    242          *                   if terminating NULL character     found (see Note #2b1).
    243          *
    244          *               Requested maximum number of characters to search, 
    245          *                   if terminating NULL character NOT found (see Note #3c).
    246          *
    247          * Caller(s)   : Application.
    248          *
    249          * Note(s)     : (1) String buffer NOT modified.
    250          *
    251          *               (2) (a) IEEE Std 1003.1, 2004 Edition, Section 'strlen() : DESCRIPTION' states that :
    252          *
    253          *                       (1) "The strlen() function shall compute the number of bytes in the string to 
    254          *                            which 's' ('pstr') points," ...
    255          *                       (2) "not including the terminating null byte."
    256          *
    257          *                   (b) IEEE Std 1003.1, 2004 Edition, Section 'strlen() : RETURN VALUE' states that :
    258          *
    259          *                       (1) "The strlen() function shall return the length of 's' ('pstr');" ...
    260          *                       (2) "no return value shall be reserved to indicate an error."
    261          *
    262          *               (3) String length calculation terminates when :
    263          *
    264          *                   (a) String pointer points to NULL.
    265          *                       (1) String buffer overlaps with NULL address.
    266          *                       (2) String length calculated for string up to but NOT beyond or including
    267          *                           the NULL address.
    268          *
    269          *                   (b) Terminating NULL character found.
    270          *                       (1) String length calculated for string up to but NOT           including
    271          *                           the NULL character (see Note #2a2).
    272          *
    273          *                   (c) 'len_max' number of characters searched.
    274          *                       (1) 'len_max' number of characters does NOT include the terminating NULL character.
    275          *********************************************************************************************************
    276          */
    277          

   \                                 In section .text, align 2, keep-with-next
    278          CPU_SIZE_T  Str_Len_N (const  CPU_CHAR    *pstr,
    279                                        CPU_SIZE_T   len_max)
    280          {
   \                     Str_Len_N:
   \   00000000   10B4               PUSH     {R4}
   \   00000002   0200               MOVS     R2,R0
    281              const  CPU_CHAR    *pstr_len;
    282                     CPU_SIZE_T   len;
    283          
    284          
    285              pstr_len = pstr;
   \   00000004   1300               MOVS     R3,R2
    286              len      = 0u;
   \   00000006   0024               MOVS     R4,#+0
   \   00000008   2000               MOVS     R0,R4
    287              while (( pstr_len != (const CPU_CHAR *)  0 ) &&             /* Calc str len until NULL ptr (see Note #3a) ...       */
    288                     (*pstr_len != (      CPU_CHAR  )'\0') &&             /* ... or NULL char found      (see Note #3b) ...       */
    289                     ( len      <  (      CPU_SIZE_T)len_max)) {          /* ... or max nbr chars srch'd (see Note #3c).          */
   \                     ??Str_Len_N_0:
   \   0000000A   002B               CMP      R3,#+0
   \   0000000C   07D0               BEQ.N    ??Str_Len_N_1
   \   0000000E   1C78               LDRB     R4,[R3, #+0]
   \   00000010   002C               CMP      R4,#+0
   \   00000012   04D0               BEQ.N    ??Str_Len_N_1
   \   00000014   8842               CMP      R0,R1
   \   00000016   02D2               BCS.N    ??Str_Len_N_1
    290                  pstr_len++;
   \   00000018   5B1C               ADDS     R3,R3,#+1
    291                  len++;
   \   0000001A   401C               ADDS     R0,R0,#+1
   \   0000001C   F5E7               B.N      ??Str_Len_N_0
    292              }
    293          
    294              return (len);                                               /* Rtn str len (see Note #3b1).                         */
   \                     ??Str_Len_N_1:
   \   0000001E   10BC               POP      {R4}

⌨️ 快捷键说明

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