📄 lib_mem.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_mem.c #
# Command line = E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\UCOS-II\uC-LIB\ #
# lib_mem.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_mem.lst #
# Object file = E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\RAM_Debug\Obj\l #
# ib_mem.r79 #
# #
# #
##############################################################################
E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\UCOS-II\uC-LIB\lib_mem.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 * STANDARD MEMORY OPERATIONS
28 *
29 * Filename : lib_mem.c
30 * Version : V1.23
31 * Programmer(s) : ITJ
32 *********************************************************************************************************
33 * Note(s) : (1) NO compiler-supplied standard library functions are used in library or product software.
34 *
35 * (a) ALL standard library functions are implemented in the custom library modules :
36 *
37 * (1) \<Custom Library Directory>\lib*.*
38 *
39 * (2) \<Custom Library Directory>\Ports\<cpu>\<compiler>\lib*_a.*
40 *
41 * where
42 * <Custom Library Directory> directory path for custom library software
43 * <cpu> directory name for specific processor (CPU)
44 * <compiler> directory name for specific compiler
45 *
46 * (b) Product-specific library functions are implemented in individual products.
47 *********************************************************************************************************
48 */
49
50 /*
51 *********************************************************************************************************
52 * INCLUDE FILES
53 *********************************************************************************************************
54 */
55
56 #define LIB_MEM_MODULE
57 #include <lib_mem.h>
58
59
60 /*$PAGE*/
61 /*
62 *********************************************************************************************************
63 * LOCAL DEFINES
64 *********************************************************************************************************
65 */
66
67
68 /*
69 *********************************************************************************************************
70 * LOCAL CONSTANTS
71 *********************************************************************************************************
72 */
73
74
75 /*
76 *********************************************************************************************************
77 * LOCAL DATA TYPES
78 *********************************************************************************************************
79 */
80
81
82 /*
83 *********************************************************************************************************
84 * LOCAL TABLES
85 *********************************************************************************************************
86 */
87
88
89 /*
90 *********************************************************************************************************
91 * LOCAL GLOBAL VARIABLES
92 *********************************************************************************************************
93 */
94
95
96 /*
97 *********************************************************************************************************
98 * LOCAL FUNCTION PROTOTYPES
99 *********************************************************************************************************
100 */
101
102
103 /*
104 *********************************************************************************************************
105 * LOCAL CONFIGURATION ERRORS
106 *********************************************************************************************************
107 */
108
109
110 /*$PAGE*/
111 /*
112 *********************************************************************************************************
113 * Mem_Clr()
114 *
115 * Description : Clear data buffer (see Note #2).
116 *
117 * Argument(s) : pmem Pointer to memory buffer to clear.
118 *
119 * size Number of data buffer octets to clear.
120 *
121 * Return(s) : none.
122 *
123 * Caller(s) : various.
124 *
125 * Note(s) : (1) Null clears allowed (i.e. 0-octet size).
126 *
127 * See also 'Mem_Set() Note #1'.
128 *
129 * (2) Clear data by setting each data octet to 0.
130 *********************************************************************************************************
131 */
132
\ In segment CODE, align 4, keep-with-next
133 void Mem_Clr (void *pmem,
134 CPU_SIZE_T size)
135 {
\ Mem_Clr:
\ 00000000 30402DE9 PUSH {R4,R5,LR}
\ 00000004 0040B0E1 MOVS R4,R0
\ 00000008 0150B0E1 MOVS R5,R1
136 Mem_Set((void *)pmem,
137 (CPU_INT08U)0, /* See Note #2. */
138 (CPU_SIZE_T)size);
\ 0000000C 0520B0E1 MOVS R2,R5
\ 00000010 0010A0E3 MOV R1,#+0
\ 00000014 0400B0E1 MOVS R0,R4
\ 00000018 ........ BL Mem_Set
139 }
\ 0000001C 3080BDE8 POP {R4,R5,PC} ;; return
140
141
142 /*$PAGE*/
143 /*
144 *********************************************************************************************************
145 * Mem_Set()
146 *
147 * Description : Fill data buffer with specified data octet.
148 *
149 * Argument(s) : pmem Pointer to memory buffer to fill with specified data octet.
150 *
151 * data_val Data fill octet value.
152 *
153 * size Number of data buffer octets to fill.
154 *
155 * Return(s) : none.
156 *
157 * Caller(s) : various.
158 *
159 * Note(s) : (1) Null sets allowed (i.e. 0-octet size).
160 *
161 * (2) For best CPU performance, optimized to fill data buffer using 'CPU_ALIGN'-sized data words.
162 *
163 * (a) Since many word-aligned processors REQUIRE that multi-octet words be accessed on
164 * word-aligned addresses, 'CPU_ALIGN'd words MUST be accessed on 'CPU_ALIGN'd addresses.
165 *
166 * (3) Modulo arithmetic is used to determine whether a memory buffer starts on a 'CPU_ALIGN'
167 * address boundary.
168 *
169 * Modulo arithmetic in ANSI-C REQUIREs operations performed on integer values. Thus,
170 * address values MUST be cast to an appropriately-sized integer value PRIOR to any
171 * mem_align_modulo arithmetic operation.
172 *********************************************************************************************************
173 */
174
\ In segment CODE, align 4, keep-with-next
175 void Mem_Set (void *pmem,
176 CPU_INT08U data_val,
177 CPU_SIZE_T size)
178 {
\ Mem_Set:
\ 00000000 F0012DE9 PUSH {R4-R8}
179 CPU_SIZE_T size_rem;
180 CPU_ALIGN data_align;
181 CPU_ALIGN *pmem_align;
182 CPU_INT08U *pmem_08;
183 CPU_INT08U mem_align_modulo;
184 CPU_INT08U i;
185
186
187 if (size < 1) { /* See Note #1. */
\ 00000004 000052E3 CMP R2,#+0
\ 00000008 2D00000A BEQ ??Mem_Set_0
188 return;
189 }
190 if (pmem == (void *)0) {
\ 0000000C 000050E3 CMP R0,#+0
\ 00000010 2B00000A BEQ ??Mem_Set_0
191 return;
192 }
193
194
195 data_align = 0;
\ 00000014 0080A0E3 MOV R8,#+0
\ 00000018 08C0B0E1 MOVS R12,R8
196 for (i = 0; i < sizeof(CPU_ALIGN); i++) { /* Fill each data_align octet with data val. */
\ 0000001C 0080A0E3 MOV R8,#+0
\ 00000020 0870B0E1 MOVS R7,R8
\ ??Mem_Set_1:
\ 00000024 FF7017E2 ANDS R7,R7,#0xFF ;; Zero extend
\ 00000028 040057E3 CMP R7,#+4
\ 0000002C 0400002A BCS ??Mem_Set_2
197 data_align <<= DEF_OCTET_NBR_BITS;
\ 00000030 0CC4B0E1 LSLS R12,R12,#+8
198 data_align |= (CPU_ALIGN)data_val;
\ 00000034 0180B0E1 MOVS R8,R1
\ 00000038 0CC098E1 ORRS R12,R8,R12
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -