📄 lib_str.lst
字号:
##############################################################################
# #
# IAR ARM ANSI C/C++ Compiler V4.42A/W32 EVALUATION 12/Dec/2008 17:14:24 #
# Copyright 1999-2005 IAR Systems. All rights reserved. #
# #
# Cpu mode = arm #
# Endian = little #
# Stack alignment = 4 #
# Source file = E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\UCOS-II\uC-LIB\ #
# lib_str.c #
# Command line = E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\UCOS-II\uC-LIB\ #
# lib_str.c -lCN E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\ #
# RAM_Debug\List\ -o E:\IAR_2478\IAR_2478\26uCOS\Src\u #
# COS\RAM_Debug\Obj\ -z2 --no_cse --no_unroll #
# --no_inline --no_code_motion --no_tbaa #
# --no_clustering --no_scheduling --debug --cpu_mode #
# arm --endian little --cpu ARM7TDMI-S --stack_align #
# 4 -e --fpu None --dlib_config "C:\Program Files\IAR #
# Systems\Embedded Workbench 4.0 #
# Evaluation\arm\LIB\dl4tpannl8n.h" -I #
# E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\include\ -I #
# E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\ucos-ii\include #
# \ -I "C:\Program Files\IAR Systems\Embedded #
# Workbench 4.0 Evaluation\arm\INC\" #
# List file = E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\RAM_Debug\List\ #
# lib_str.lst #
# Object file = E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\RAM_Debug\Obj\l #
# ib_str.r79 #
# #
# #
##############################################################################
E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\UCOS-II\uC-LIB\lib_str.c
1 /*
2 *********************************************************************************************************
3 * uC/LIB
4 * CUSTOM LIBRARY MODULES
5 *
6 * (c) Copyright 2004-2007; Micrium, Inc.; Weston, FL
7 *
8 * All rights reserved. Protected by international copyright laws.
9 *
10 * uC/LIB is provided in source form for FREE evaluation, for educational
11 * use or peaceful research. If you plan on using uC/LIB in a commercial
12 * product you need to contact Micrium to properly license its use in your
13 * product. We provide ALL the source code for your convenience and to
14 * help you experience uC/LIB. The fact that the source code is provided
15 * does NOT mean that you can use it without paying a licensing fee.
16 *
17 * Knowledge of the source code may NOT be used to develop a similar product.
18 *
19 * Please help us continue to provide the Embedded community with the finest
20 * software available. Your honesty is greatly appreciated.
21 *********************************************************************************************************
22 */
23
24 /*
25 *********************************************************************************************************
26 *
27 * ASCII STRING MANAGEMENT
28 *
29 * Filename : lib_str.c
30 * Version : V1.23
31 * Programmer(s) : ITJ
32 * JDH
33 *********************************************************************************************************
34 * Note(s) : (1) NO compiler-supplied standard library functions are used in library or product software.
35 *
36 * (a) ALL standard library functions are implemented in the custom library modules :
37 *
38 * (1) \<Custom Library Directory>\lib*.*
39 *
40 * (2) \<Custom Library Directory>\Ports\<cpu>\<compiler>\lib*_a.*
41 *
42 * where
43 * <Custom Library Directory> directory path for custom library software
44 * <cpu> directory name for specific processor (CPU)
45 * <compiler> directory name for specific compiler
46 *
47 * (b) Product-specific library functions are implemented in individual products.
48 *********************************************************************************************************
49 */
50
51 /*
52 *********************************************************************************************************
53 * INCLUDE FILES
54 *********************************************************************************************************
55 */
56
57 #define LIB_STR_MODULE
58 #include <lib_str.h>
59
60
61 /*$PAGE*/
62 /*
63 *********************************************************************************************************
64 * LOCAL DEFINES
65 *********************************************************************************************************
66 */
67
68
69 /*
70 *********************************************************************************************************
71 * LOCAL CONSTANTS
72 *********************************************************************************************************
73 */
74
75
76 /*
77 *********************************************************************************************************
78 * LOCAL DATA TYPES
79 *********************************************************************************************************
80 */
81
82
83 /*
84 *********************************************************************************************************
85 * LOCAL TABLES
86 *********************************************************************************************************
87 */
88
89
90 /*
91 *********************************************************************************************************
92 * LOCAL GLOBAL VARIABLES
93 *********************************************************************************************************
94 */
95
96
97 /*
98 *********************************************************************************************************
99 * LOCAL FUNCTION PROTOTYPES
100 *********************************************************************************************************
101 */
102
103
104 /*
105 *********************************************************************************************************
106 * LOCAL CONFIGURATION ERRORS
107 *********************************************************************************************************
108 */
109
110
111 /*$PAGE*/
112 /*
113 *********************************************************************************************************
114 * Str_Len()
115 *
116 * Description : Calculate length of a string.
117 *
118 * Argument(s) : pstr Pointer to string (see Note #1).
119 *
120 * Return(s) : Length of string; number of characters in string before terminating NULL character.
121 *
122 * Caller(s) : various.
123 *
124 * Note(s) : (1) String buffer NOT modified.
125 *
126 * (2) String length calculation terminates when :
127 *
128 * (a) String pointer points to NULL.
129 * (1) String buffer overlaps with NULL address.
130 * (2) String length calculated for string up to but NOT beyond or including
131 * the NULL address.
132 *
133 * (b) Terminating NULL character found.
134 * (1) String length calculated for string up to but NOT including
135 * the NULL character.
136 *********************************************************************************************************
137 */
138
\ In segment CODE, align 4, keep-with-next
139 CPU_SIZE_T Str_Len (CPU_CHAR *pstr)
140 {
\ Str_Len:
\ 00000000 0010B0E1 MOVS R1,R0
141 CPU_SIZE_T len;
142
143
144 len = 0;
\ 00000004 0020A0E3 MOV R2,#+0
\ 00000008 0200B0E1 MOVS R0,R2
145 while (( pstr != (CPU_CHAR *)0) && /* Calc str len until NULL ptr (see Note #2a) ... */
146 (*pstr != (CPU_CHAR )0)) { /* ... or NULL char found (see Note #2b). */
\ ??Str_Len_0:
\ 0000000C 000051E3 CMP R1,#+0
\ 00000010 0500000A BEQ ??Str_Len_1
\ 00000014 0020D1E5 LDRB R2,[R1, #+0]
\ 00000018 000052E3 CMP R2,#+0
\ 0000001C 0200000A BEQ ??Str_Len_1
147 len++;
\ 00000020 010090E2 ADDS R0,R0,#+1
148 pstr++;
\ 00000024 011091E2 ADDS R1,R1,#+1
\ 00000028 F7FFFFEA B ??Str_Len_0
149 }
150
151 return (len);
\ ??Str_Len_1:
\ 0000002C 0EF0A0E1 MOV PC,LR ;; return
152 }
153
154
155 /*$PAGE*/
156 /*
157 *********************************************************************************************************
158 * Str_Copy()
159 *
160 * Description : Copy source string to destination string buffer.
161 *
162 * Argument(s) : pdest Pointer to destination string buffer to receive source string copy (see Note #1).
163 *
164 * psrc Pointer to source string to copy into destination string buffer.
165 *
166 * Return(s) : Pointer to destination string, if NO errors (see Note #2).
167 *
168 * Pointer to NULL, otherwise.
169 *
170 * Caller(s) : various.
171 *
172 * Note(s) : (1) Destination buffer size NOT validated; buffer overruns MUST be prevented by caller.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -