1 /* ---------------------------------------------------------------------------- 2 * Copyright (c) Huawei Technologies Co., Ltd. 2019-2019. All rights reserved. 3 * Description: target config 4 * Redistribution and use in source and binary forms, with or without modification, 5 * are permitted provided that the following conditions are met: 6 * 1. Redistributions of source code must retain the above copyright notice, this list of 7 * conditions and the following disclaimer. 8 * 2. Redistributions in binary form must reproduce the above copyright notice, this list 9 * of conditions and the following disclaimer in the documentation and/or other materials 10 * provided with the distribution. 11 * 3. Neither the name of the copyright holder nor the names of its contributors may be used 12 * to endorse or promote products derived from this software without specific prior written 13 * permission. 14 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 15 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 24 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * --------------------------------------------------------------------------- */ 26 27 /** 28 * @defgroup los_config System configuration items 29 * @ingroup kernel 30 */ 31 32 #ifndef _TARGET_CONFIG_H 33 #define _TARGET_CONFIG_H 34 35 #include "hal_sectors.h" 36 #include "hi3861.h" 37 #include "system_config.h" 38 39 #ifdef __cplusplus 40 #if __cplusplus 41 extern "C" { 42 #endif /* __cplusplus */ 43 #endif /* __cplusplus */ 44 45 #define LOSCFG_CORTEX_M3 46 47 #define _T(x) x 48 49 /*============================================================================= 50 Lib configurable feature configuration 51 =============================================================================*/ 52 /** 53 * @ingroup los_config 54 * Configuration lib configurable feature to open 55 */ 56 #ifdef LIB_CONFIGURABLE 57 #define LOSCFG_LIB_CONFIGURABLE YES 58 #else 59 #define LOSCFG_LIB_CONFIGURABLE NO 60 #endif 61 62 /*============================================================================= 63 Test module configuration 64 =============================================================================*/ 65 /** 66 * @ingroup los_config 67 * Configuration test case to open 68 */ 69 #ifdef HI1131TEST 70 #define LOSCFG_TEST YES 71 #endif 72 73 /*============================================================================= 74 LIBC module configuration 75 =============================================================================*/ 76 /** 77 * @ingroup los_config 78 * Configuration to support libc 79 */ 80 #define LOSCFG_LIB_LIBC YES 81 82 /*============================================================================= 83 System clock module configuration 84 =============================================================================*/ 85 /** 86 * @ingroup los_config 87 * System clock (unit: HZ) 88 */ 89 #if (LOSCFG_LIB_CONFIGURABLE == YES) 90 extern UINT32 g_osSysClock; 91 #define OS_SYS_CLOCK g_osSysClock 92 #else 93 #define OS_SYS_CLOCK (40000000UL) /* ԭΪ80000000 */ 94 #endif 95 96 /** 97 * @ingroup los_config 98 * Number of Ticks in one second 99 */ 100 #if (LOSCFG_LIB_CONFIGURABLE == YES) 101 extern UINT32 g_minusOneTickPerSecond; 102 #define LOSCFG_BASE_CORE_TICK_PER_SECOND (g_minusOneTickPerSecond + 1) /* tick per sencond plus 1 */ 103 #else 104 #define LOSCFG_BASE_CORE_TICK_PER_SECOND (100UL) 105 #endif 106 107 /** 108 * @ingroup los_config 109 * External configuration item for timer tailoring 110 */ 111 #define LOSCFG_BASE_CORE_TICK_HW_TIME YES 112 113 /*============================================================================= 114 Hardware interrupt module configuration 115 =============================================================================*/ 116 /** 117 * @ingroup los_config 118 * Configuration item for hardware interrupt tailoring 119 */ 120 #define LOSCFG_PLATFORM_HWI YES 121 122 /** 123 * @ingroup los_config 124 * Highest priority of a hardware interrupt. 125 */ 126 #ifndef OS_HWI_PRIO_HIGHEST 127 #define OS_HWI_PRIO_HIGHEST 7 128 #endif 129 /** 130 * @ingroup los_config 131 * Lowest priority of a hardware interrupt. 132 */ 133 #ifndef OS_HWI_PRIO_LOWEST 134 #define OS_HWI_PRIO_LOWEST 1 135 #endif 136 137 /*============================================================================= 138 Task module configuration 139 =============================================================================*/ 140 /** 141 * @ingroup los_config 142 * Minimum stack size. 143 * 144 * 0x80 bytes, aligned on a boundary of 4. 145 */ 146 #if (LOSCFG_LIB_CONFIGURABLE == YES) 147 extern UINT32 g_taskMinStkSize; 148 #define LOSCFG_BASE_CORE_TSK_MIN_STACK_SIZE g_taskMinStkSize 149 #else 150 #define LOSCFG_BASE_CORE_TSK_MIN_STACK_SIZE (ALIGN(0x180, 4)) 151 #endif 152 153 /** 154 * @ingroup los_config 155 * Idle task stack size. 156 */ 157 #if (LOSCFG_LIB_CONFIGURABLE == YES) 158 extern UINT32 g_taskIdleStkSize; 159 #define LOSCFG_BASE_CORE_TSK_IDLE_STACK_SIZE g_taskIdleStkSize 160 #else 161 #define LOSCFG_BASE_CORE_TSK_IDLE_STACK_SIZE (0x180UL) 162 #endif 163 164 /** 165 * @ingroup los_config 166 * Maximum supported number of tasks except the idle task rather than the number of usable tasks 167 */ 168 #if (LOSCFG_LIB_CONFIGURABLE == YES) 169 extern UINT32 g_taskLimit; 170 #define LOSCFG_BASE_CORE_TSK_LIMIT g_taskLimit 171 #else 172 #define LOSCFG_BASE_CORE_TSK_LIMIT 32 173 #endif 174 175 /** 176 * @ingroup los_config 177 * Soft timer task stack size 178 */ 179 #if (LOSCFG_LIB_CONFIGURABLE == YES) 180 extern UINT32 g_taskSwtmrStkSize; 181 #define LOSCFG_BASE_CORE_TSK_SWTMR_STACK_SIZE g_taskSwtmrStkSize 182 #else 183 #define LOSCFG_BASE_CORE_TSK_SWTMR_STACK_SIZE (0x1000UL) 184 #endif 185 186 /** 187 * @ingroup los_config 188 * Default task stack size 189 */ 190 #if (LOSCFG_LIB_CONFIGURABLE == YES) 191 extern UINT32 g_taskDfltStkSize; 192 #define LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE g_taskDfltStkSize 193 #else 194 #define LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE (0x1000UL) 195 #endif 196 197 /** 198 * @ingroup los_config 199 * Longest execution time of tasks with the same priorities 200 */ 201 #if (LOSCFG_LIB_CONFIGURABLE == YES) 202 extern UINT32 g_timeSliceTimeOut; 203 #define LOSCFG_BASE_CORE_TIMESLICE_TIMEOUT g_timeSliceTimeOut 204 #else 205 #define LOSCFG_BASE_CORE_TIMESLICE_TIMEOUT 2 206 #endif 207 208 /****************************** PMP module configuration ******************************/ 209 /** 210 * @ingroup los_config 211 * Configuration item for PMP 212 */ 213 #define LOSCFG_BASE_CORE_PMP YES 214 215 /** 216 * @ingroup los_config 217 * PMP support number : PMP maximum number of region support 218 */ 219 #define LOSCFG_PMP_MAX_SUPPORT 16 // PMP maximum support number 220 221 /** 222 * @ingroup los_config 223 * PMP support address range : from LOSCFG_PMP_MIN_ADDRESS to LOSCFG_PMP_MAX_ADDRESS 224 */ 225 #define LOSCFG_PMP_MIN_ADDRESS 0x00000000UL // Minimum protected address 226 #define LOSCFG_PMP_MAX_ADDRESS 0x07FFFFFFUL // Maximum protected address 227 228 /** 229 * @ingroup los_config 230 * The PMP entry size granularity must be the multiple of cache line size. 231 */ 232 #define CACHE_LINE_SIZE 32 // cache line size, 233 #define LOSCFG_PMP_MAX_SIZE 0xFFFFFFFF 234 235 /*============================================================================= 236 Semaphore module configuration 237 =============================================================================*/ 238 /** 239 * @ingroup los_config 240 * Maximum supported number of semaphores 241 */ 242 #if (LOSCFG_LIB_CONFIGURABLE == YES) 243 extern UINT32 g_semLimit; 244 #define LOSCFG_BASE_IPC_SEM_LIMIT g_semLimit 245 #else 246 #define LOSCFG_BASE_IPC_SEM_LIMIT 100 247 #endif 248 249 /*============================================================================= 250 Mutex module configuration 251 =============================================================================*/ 252 /** 253 * @ingroup los_config 254 * Maximum supported number of mutexes 255 */ 256 #if (LOSCFG_LIB_CONFIGURABLE == YES) 257 extern UINT32 g_muxLimit; 258 #define LOSCFG_BASE_IPC_MUX_LIMIT g_muxLimit 259 #else 260 #define LOSCFG_BASE_IPC_MUX_LIMIT 64 261 #endif 262 263 /*============================================================================= 264 Queue module configuration 265 =============================================================================*/ 266 /** 267 * @ingroup los_config 268 * Maximum supported number of queues rather than the number of usable queues 269 */ 270 #if (LOSCFG_LIB_CONFIGURABLE == YES) 271 extern UINT32 g_queueLimit; 272 #define LOSCFG_BASE_IPC_QUEUE_LIMIT g_queueLimit 273 #else 274 #define LOSCFG_BASE_IPC_QUEUE_LIMIT 64 275 #endif 276 277 /*============================================================================= 278 Software timer module configuration 279 =============================================================================*/ 280 /** 281 * @ingroup los_config 282 * Maximum supported number of software timers rather than the number of usable software timers 283 */ 284 #if (LOSCFG_LIB_CONFIGURABLE == YES) 285 extern UINT32 g_swtmrLimit; 286 #define LOSCFG_BASE_CORE_SWTMR_LIMIT g_swtmrLimit 287 #else 288 #define LOSCFG_BASE_CORE_SWTMR_LIMIT 80 289 #endif 290 291 /*============================================================================= 292 Memory module configuration 293 =============================================================================*/ 294 /** 295 * @ingroup los_config 296 * Starting address of the memory 297 */ 298 #define OS_SYS_MEM_ADDR (g_halSectorsRamHeapStart) 299 300 /** 301 * @ingroup los_config 302 * Memory size 303 */ 304 #define OS_SYS_MEM_SIZE (g_halSectorsRamHeapSize) 305 306 #define LOSCFG_MEMORY_BESTFIT YES 307 308 /** 309 * @ingroup los_config 310 * Configuration module tailoring of membox 311 */ 312 #define LOSCFG_MEMBOX NO 313 314 /** 315 * @ingroup los_config 316 * Configuration module momery water line 317 */ 318 #define LOSCFG_MEM_WATERLINE YES 319 320 /** 321 * @ingroup los_config 322 * Configuration module tailoring of mem node size checking 323 */ 324 #define LOSCFG_BASE_MEM_NODE_SIZE_CHECK NO 325 326 /** 327 * @ingroup los_config 328 * Configuration module momery alloc and free check 329 */ 330 #define LOSCFG_MEM_ENABLE_ALLOC_CHECK NO 331 332 /*============================================================================= 333 Exception module configuration 334 =============================================================================*/ 335 /** 336 * @ingroup los_config 337 * Configuration item for exception tailoring 338 */ 339 #define LOSCFG_PLATFORM_EXC YES 340 341 /*============================================================================= 342 Runstop module configuration 343 =============================================================================*/ 344 /** 345 * @ingroup los_config 346 * Configuration item for runstop 347 */ 348 #define LOSCFG_RUNSTOP_THRESHOLD 2 349 350 /*============================================================================= 351 track configuration 352 =============================================================================*/ 353 /** 354 * @ingroup los_config 355 * Configuration item for track 356 */ 357 #define LOSCFG_BASE_MISC_TRACK YES 358 359 /** 360 * @ingroup los_config 361 * Max count of track items 362 */ 363 #define LOSCFG_BASE_MISC_TRACK_MAX_COUNT 1000 364 365 /** 366 * @ingroup los_config 367 * Configuration item for task (stack) monitoring module tailoring 368 */ 369 #define LOSCFG_BASE_CORE_TSK_MONITOR YES 370 371 /*============================================================================= 372 CPUP configuration 373 =============================================================================*/ 374 #if (LOSCFG_BASE_CORE_TSK_MONITOR == YES) 375 /** 376 * @ingroup los_config 377 * Configuration item for CPU task usage tailoring 378 */ 379 #define LOSCFG_BASE_CORE_CPUP YES 380 /** 381 * @ingroup los_config 382 * Configuration item for CPU hwi usage tailoring 383 */ 384 #if (LOSCFG_BASE_CORE_CPUP == YES) 385 #define LOSCFG_BASE_CORE_CPUP_HWI YES 386 #endif 387 388 #endif 389 390 /*============================================================================= 391 FPB configuration 392 =============================================================================*/ 393 /** 394 * @ingroup los_config 395 * Configuration item for flash patch 396 */ 397 #define LOSCFG_BASE_CORE_FPB YES 398 399 /** 400 * @ingroup los_config 401 * flash patch type 402 */ 403 #define LOSCFG_FPB_CONFIG_PCO 1 404 405 #ifdef LOSCFG_DEBUG_KASAN 406 #if (LOSCFG_LIB_CONFIGURABLE == YES) 407 extern UINT32 g_kasanLimit; 408 #define LOSCFG_KASAN_TASK_STACK_NUM g_kasanLimit 409 #else 410 #define LOSCFG_KASAN_TASK_STACK_NUM 3 411 #endif 412 #endif 413 414 #ifdef __cplusplus 415 #if __cplusplus 416 } 417 #endif /* __cplusplus */ 418 #endif /* __cplusplus */ 419 420 #endif /* _TARGET_CONFIG_H */ 421