blob: a1303c036ee59916ef43e443eaa7dd2a74fd16ac [file] [log] [blame]
rjw6c1fd8f2022-11-30 14:33:01 +08001/*****************************************************************************
2* Copyright Statement:
3* --------------------
4* This software is protected by Copyright and the information contained
5* herein is confidential. The software may not be copied and the information
6* contained herein may not be used or disclosed except with the written
7* permission of MediaTek Inc. (C) 2006
8*
9* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
10* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
11* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
12* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
13* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
14* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
15* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
16* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
17* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
18* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
19* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
20* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
21*
22* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
23* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
24* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
25* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
26* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
27*
28* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
29* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
30* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
31* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
32* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
33*
34*****************************************************************************/
35
36/*****************************************************************************
37 *
38 * Filename:
39 * ---------
40 * custom_config.c
41 *
42 * Project:
43 * --------
44 * Maui_Software
45 *
46 * Description:
47 * ------------
48 * This file contain definition of custom component module configuration variables, and routines
49 *
50 * Author:
51 * -------
52 * -------
53 *
54 *============================================================================
55 * HISTORY
56 * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
57 *------------------------------------------------------------------------------
58 * removed!
59 * removed!
60 * removed!
61 *
62 * removed!
63 * removed!
64 * removed!
65 * removed!
66 *
67 * removed!
68 * removed!
69 * removed!
70 *
71 * removed!
72 * removed!
73 * removed!
74 * removed!
75 *
76 * removed!
77 * removed!
78 * removed!
79 *
80 * removed!
81 * removed!
82 * removed!
83 * removed!
84 *
85 * removed!
86 * removed!
87 *
88 * removed!
89 * removed!
90 * removed!
91 * removed!
92 * removed!
93 *
94 * removed!
95 * removed!
96 * removed!
97 *
98 * removed!
99 * removed!
100 * removed!
101 *
102 * removed!
103 * removed!
104 * removed!
105 *
106 * removed!
107 * removed!
108 * removed!
109 *
110 * removed!
111 * removed!
112 * removed!
113 *
114 * removed!
115 * removed!
116 * removed!
117 *
118 * removed!
119 * removed!
120 * removed!
121 *
122 * removed!
123 * removed!
124 * removed!
125 *
126 * removed!
127 * removed!
128 * removed!
129 *
130 * removed!
131 * removed!
132 * removed!
133 * removed!
134 *
135 * removed!
136 * removed!
137 * removed!
138 *
139 * removed!
140 * removed!
141 * removed!
142 *
143 * removed!
144 * removed!
145 * removed!
146 *
147 * removed!
148 * removed!
149 * removed!
150 *
151 * removed!
152 * removed!
153 * removed!
154 *
155 * removed!
156 * removed!
157 * removed!
158 * removed!
159 *
160 * removed!
161 * removed!
162 *
163 * removed!
164 * removed!
165 * removed!
166 *
167 * removed!
168 * removed!
169 * removed!
170 *
171 * removed!
172 * removed!
173 * removed!
174 *
175 * removed!
176 * removed!
177 * removed!
178 * removed!
179 *
180 * removed!
181 * removed!
182 * removed!
183 *
184 * removed!
185 * removed!
186 * removed!
187 * removed!
188 * removed!
189 * removed!
190 * removed!
191 *
192 * removed!
193 * removed!
194 * removed!
195 *
196 * removed!
197 * removed!
198 * removed!
199 *
200 * removed!
201 * removed!
202 * removed!
203 *
204 * removed!
205 * removed!
206 * removed!
207 *
208 * removed!
209 * removed!
210 * removed!
211 *
212 * removed!
213 * removed!
214 * removed!
215 *
216 *------------------------------------------------------------------------------
217 * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
218 *============================================================================
219 ****************************************************************************/
220
221/*************************************************************************
222 * Include Statements
223 *************************************************************************/
224#include "kal_general_types.h"
225#include "kal_public_api.h"
226#include "kal_public_defs.h"
227#include "kal_internal_api.h"
228#include "kal_internal_def.h"
229#include "task_config.h"
230#include "kal_user_mem.h"
231
232/*************************************************************************
233* FUNCTION
234* custom_configmem()
235*
236* DESCRIPTION
237* This routine configure
238*
239* a. system total memory usage
240* Task's stack, external queue, control buffer entries etc.
241* Any one who attempts to create new task or enlarge control
242* buffer size should fine tune the value!
243*
244* b. system total debug memory usage
245* Valid for DEBUG_KAL + DEBUG_[some items, ITC, BUF etc]
246*
247* PARAMETERS
248* system_mem_sz - system all memory usage
249* debug_mem_sz - system all debug memory usage
250*
251* RETURNS
252* None
253*
254* GLOBALS AFFECTED
255*
256*************************************************************************/
257
258#ifdef __MTK_TARGET__
259 #include "sys_mem_size.h"
260#else
261 #include "sys_mem_size_modis.h"
262#endif /*__MTK_TARGET__*/
263
264
265/*Debug mem pool before sys mem for easy debug in case sys mem overflow*/
266
267#if defined(DEBUG_KAL)
268static kal_uint32 Debug_Mem_Pool[(GLOBAL_DEBUG_MEM_SIZE
269#if defined(__KTEST__)
270+ 1024 /*pool for profiling tests*/
271#endif
272)/sizeof(kal_uint32)];
273#endif /* DEBUG_KAL */
274
275static kal_uint32 System_Mem_Pool[(GLOBAL_MEM_SIZE + CUSTOM_CFG_GLOBAL_MEM_SIZE_IN_BYTES
276
277#if defined(ATEST_ENABLE)
278+(10*1024)
279#endif
280#if defined(__KTEST__)
281+(5*1024)
282#endif
283) / sizeof(kal_uint32)];
284
285
286void
287custom_configmem(kal_uint32 *system_mem_sz, kal_uint32** system_mem_addr,
288 kal_uint32 *debug_mem_sz, kal_uint32** debug_mem_addr)
289{
290 *system_mem_sz = sizeof(System_Mem_Pool);
291 *system_mem_addr = System_Mem_Pool;
292
293#if defined(DEBUG_KAL)
294 *debug_mem_addr = Debug_Mem_Pool;
295 *debug_mem_sz = sizeof(Debug_Mem_Pool);
296#else
297 *debug_mem_addr = (kal_uint32 *)0;
298 *debug_mem_sz = 0;
299#endif
300}
301
302/*************************************************************************
303* FUNCTION
304* custom_config_libc_heap()
305*
306* DESCRIPTION
307* This routine configure libc heap size & location.
308*
309* PARAMETERS
310*
311* RETURNS
312* heap size & heap location. if heap_size return 0, then no heap is
313* initialized.
314*
315* GLOBALS AFFECTED
316*
317*************************************************************************/
318#ifdef __GADGET_SUPPORT__
319#define GLOBAL_LIBC_HEAP_SIZE 10240
320#else
321#define GLOBAL_LIBC_HEAP_SIZE 65536 /* 64K Heap for newlib */
322#endif
323#if GLOBAL_LIBC_HEAP_SIZE != 0
324/* if we don't define heap, we won't define a symbol call System_Libc_Heap
325 * using this method, we can detect whether system allow to use
326 * malloc/free/realloc/calloc
327 */
328kal_uint32 System_Libc_Heap[GLOBAL_LIBC_HEAP_SIZE/sizeof(kal_uint32)];
329#endif
330void custom_config_libc_heap(kal_uint32 *heap_size, void **heap_addr)
331{
332#if GLOBAL_LIBC_HEAP_SIZE == 0
333 *heap_size = 0;
334 *heap_addr = 0;
335#else
336 *heap_size = sizeof(System_Libc_Heap);
337 *heap_addr = System_Libc_Heap;
338#endif
339}
340