1 /* ---------------------------------------------------------------------------- 2 * Copyright (c) Huawei Technologies Co., Ltd. 2013-2015. All rights reserved. 3 * Description: los_config system configuration items 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 _LOS_CONFIG_H 33 #define _LOS_CONFIG_H 34 35 #include "target_config.h" 36 37 #ifdef __cplusplus 38 #if __cplusplus 39 extern "C" { 40 #endif /* __cplusplus */ 41 #endif /* __cplusplus */ 42 43 /* ============================================================================= 44 System clock module configuration 45 ============================================================================= */ 46 /** 47 * @ingroup los_config 48 * System clock (unit: HZ) 49 */ 50 #ifndef OS_SYS_CLOCK 51 #define OS_SYS_CLOCK 100000000UL 52 #endif 53 54 /** 55 * @ingroup los_config 56 * timer1 clock (unit: HZ) 57 */ 58 #ifndef OS_TIME_TIMER_CLOCK 59 #define OS_TIME_TIMER_CLOCK OS_SYS_CLOCK 60 #endif 61 62 /** 63 * @ingroup los_config 64 * Number of Ticks in one second 65 */ 66 #ifndef LOSCFG_BASE_CORE_TICK_PER_SECOND 67 #define LOSCFG_BASE_CORE_TICK_PER_SECOND 1000UL 68 #endif 69 70 /** 71 * @ingroup los_config 72 * External configuration item for timer tailoring 73 */ 74 #ifndef LOSCFG_BASE_CORE_TICK_HW_TIME1 75 #define LOSCFG_BASE_CORE_TICK_HW_TIME1 YES 76 #endif 77 78 #ifndef LOSCFG_BASE_CORE_TICK_HW_TIME 79 #define LOSCFG_BASE_CORE_TICK_HW_TIME NO 80 #endif 81 82 /* ============================================================================= 83 Hardware interrupt module configuration 84 ============================================================================= */ 85 /** 86 * @ingroup los_config 87 * Configuration item for hardware interrupt tailoring 88 */ 89 #ifndef LOSCFG_PLATFORM_HWI 90 #define LOSCFG_PLATFORM_HWI YES 91 #endif 92 93 /** 94 * @ingroup los_config 95 * Maximum number of used hardware interrupts, including Tick timer interrupts. 96 */ 97 #ifndef LOSCFG_PLATFORM_HWI_LIMIT 98 #define LOSCFG_PLATFORM_HWI_LIMIT 32 99 #endif 100 101 102 /* ============================================================================= 103 Task module configuration 104 ============================================================================= */ 105 /** 106 * @ingroup los_config 107 * Minimum stack size. 108 * 109 * 0x80 bytes, aligned on a boundary of 8. 110 */ 111 #ifndef LOSCFG_BASE_CORE_TSK_MIN_STACK_SIZE 112 #define LOSCFG_BASE_CORE_TSK_MIN_STACK_SIZE (ALIGN(0x80, 4)) 113 #endif 114 115 /** 116 * @ingroup los_config 117 * Default task priority 118 */ 119 #ifndef LOSCFG_BASE_CORE_TSK_DEFAULT_PRIO 120 #define LOSCFG_BASE_CORE_TSK_DEFAULT_PRIO 10 121 #endif 122 123 /** 124 * @ingroup los_config 125 * Maximum supported number of tasks except the idle task rather than the number of usable tasks 126 */ 127 #ifndef LOSCFG_BASE_CORE_TSK_LIMIT 128 #define LOSCFG_BASE_CORE_TSK_LIMIT 5 129 #endif 130 131 /** 132 * @ingroup los_config 133 * Size of the idle task stack 134 */ 135 #ifndef LOSCFG_BASE_CORE_TSK_IDLE_STACK_SIZE 136 #define LOSCFG_BASE_CORE_TSK_IDLE_STACK_SIZE 0x180UL 137 #endif 138 139 /** 140 * @ingroup los_config 141 * Default task stack size 142 */ 143 #ifndef LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE 144 #define LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE 0x400UL 145 #endif 146 147 /** 148 * @ingroup los_config 149 * Configuration item for task Robin tailoring 150 */ 151 #ifndef LOSCFG_BASE_CORE_TIMESLICE 152 #define LOSCFG_BASE_CORE_TIMESLICE YES 153 #endif 154 155 /** 156 * @ingroup los_config 157 * Longest execution time of tasks with the same priorities 158 */ 159 #ifndef LOSCFG_BASE_CORE_TIMESLICE_TIMEOUT 160 #define LOSCFG_BASE_CORE_TIMESLICE_TIMEOUT 10 161 #endif 162 163 /** 164 * @ingroup los_config 165 * Configuration item for task (stack) monitoring module tailoring 166 */ 167 #ifndef LOSCFG_BASE_CORE_TSK_MONITOR 168 #define LOSCFG_BASE_CORE_TSK_MONITOR NO 169 #endif 170 171 /** 172 * @ingroup los_config 173 * Configuration item for task perf task filter hook 174 */ 175 #ifndef LOSCFG_BASE_CORE_EXC_TSK_SWITCH 176 #define LOSCFG_BASE_CORE_EXC_TSK_SWITCH NO 177 #endif 178 179 /** 180 * @ingroup los_config 181 * Define a usable task priority.Highest task priority. 182 */ 183 #ifndef LOS_TASK_PRIORITY_HIGHEST 184 #define LOS_TASK_PRIORITY_HIGHEST 0 185 #endif 186 187 /** 188 * @ingroup los_config 189 * Define a usable task priority.Lowest task priority. 190 */ 191 #ifndef LOS_TASK_PRIORITY_LOWEST 192 #define LOS_TASK_PRIORITY_LOWEST 31 193 #endif 194 195 /** 196 * @ingroup los_config 197 * SP align size 198 */ 199 #ifndef LOSCFG_STACK_POINT_ALIGN_SIZE 200 #define LOSCFG_STACK_POINT_ALIGN_SIZE 8 201 #endif 202 203 /* ============================================================================= 204 Semaphore module configuration 205 ============================================================================= */ 206 /** 207 * @ingroup los_config 208 * Configuration item for semaphore module tailoring 209 */ 210 #ifndef LOSCFG_BASE_IPC_SEM 211 #define LOSCFG_BASE_IPC_SEM YES 212 #endif 213 214 /** 215 * @ingroup los_config 216 * Maximum supported number of semaphores 217 */ 218 #ifndef LOSCFG_BASE_IPC_SEM_LIMIT 219 #define LOSCFG_BASE_IPC_SEM_LIMIT 6 220 #endif 221 222 /* ============================================================================= 223 Mutex module configuration 224 ============================================================================= */ 225 /** 226 * @ingroup los_config 227 * Configuration item for mutex module tailoring 228 */ 229 #ifndef LOSCFG_BASE_IPC_MUX 230 #define LOSCFG_BASE_IPC_MUX YES 231 #endif 232 233 /** 234 * @ingroup los_config 235 * Maximum supported number of mutexes 236 */ 237 #ifndef LOSCFG_BASE_IPC_MUX_LIMIT 238 #define LOSCFG_BASE_IPC_MUX_LIMIT 6 239 #endif 240 241 /* ============================================================================= 242 Queue module configuration 243 ============================================================================= */ 244 /** 245 * @ingroup los_config 246 * Configuration item for queue module tailoring 247 */ 248 #ifndef LOSCFG_BASE_IPC_QUEUE 249 #define LOSCFG_BASE_IPC_QUEUE YES 250 #endif 251 252 /** 253 * @ingroup los_config 254 * Maximum supported number of queues rather than the number of usable queues 255 */ 256 #ifndef LOSCFG_BASE_IPC_QUEUE_LIMIT 257 #define LOSCFG_BASE_IPC_QUEUE_LIMIT 6 258 #endif 259 260 261 /* ============================================================================= 262 Software timer module configuration 263 ============================================================================= */ 264 /** 265 * @ingroup los_config 266 * Configuration item for software timer module tailoring 267 */ 268 #ifndef LOSCFG_BASE_CORE_SWTMR 269 #define LOSCFG_BASE_CORE_SWTMR YES 270 #endif 271 272 /** 273 * @ingroup los_config 274 * Maximum supported number of software timers rather than the number of usable software timers 275 */ 276 #ifndef LOSCFG_BASE_CORE_SWTMR_LIMIT 277 #define LOSCFG_BASE_CORE_SWTMR_LIMIT 5 278 #endif 279 280 /** 281 * @ingroup los_config 282 * Software timer task stack size 283 */ 284 #ifndef LOSCFG_BASE_CORE_TSK_SWTMR_STACK_SIZE 285 #define LOSCFG_BASE_CORE_TSK_SWTMR_STACK_SIZE LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE 286 #endif 287 288 /** 289 * @ingroup los_config 290 * Configurate item for handling software timer interrupt in task tailoring 291 */ 292 #ifndef LOSCFG_BASE_CORE_SWTMR_TASK 293 #define LOSCFG_BASE_CORE_SWTMR_TASK YES 294 #endif 295 296 /** 297 * @ingroup los_config 298 * Configurate item for software timer align tailoring 299 */ 300 #ifndef LOSCFG_BASE_CORE_SWTMR_ALIGN 301 #define LOSCFG_BASE_CORE_SWTMR_ALIGN NO 302 #endif 303 304 #if((LOSCFG_BASE_CORE_SWTMR == NO) && (LOSCFG_BASE_CORE_SWTMR_ALIGN == YES)) 305 #error "swtmr align first need support swmtr, should make LOSCFG_BASE_CORE_SWTMR = YES" 306 #endif 307 308 /** 309 * @ingroup los_config 310 * Max number of software timers ID 311 */ 312 #ifndef OS_SWTMR_MAX_TIMERID 313 #define OS_SWTMR_MAX_TIMERID ((65535 / LOSCFG_BASE_CORE_SWTMR_LIMIT) * LOSCFG_BASE_CORE_SWTMR_LIMIT) 314 #endif 315 316 /** 317 * @ingroup los_config 318 * Maximum size of a software timer queue 319 */ 320 #ifndef OS_SWTMR_HANDLE_QUEUE_SIZE 321 #define OS_SWTMR_HANDLE_QUEUE_SIZE (LOSCFG_BASE_CORE_SWTMR_LIMIT) 322 #endif 323 324 /** 325 * @ingroup los_config 326 * Minimum divisor of software timer multiple alignment 327 */ 328 #ifndef LOS_COMMON_DIVISOR 329 #define LOS_COMMON_DIVISOR 10 330 #endif 331 332 /* ============================================================================= 333 Memory module configuration 334 ============================================================================= */ 335 extern UINT8 *m_aucSysMem0; 336 337 /** 338 * @ingroup los_config 339 * Starting address of the memory 340 */ 341 #ifndef OS_SYS_MEM_ADDR 342 #define OS_SYS_MEM_ADDR (&m_aucSysMem0[0]) 343 #endif 344 345 /** 346 * @ingroup los_config 347 * Ending address of the memory 348 */ 349 extern UINT32 g_sysMemAddrEnd; 350 351 /** 352 * @ingroup los_config 353 * Memory size 354 */ 355 #ifndef OS_SYS_MEM_SIZE 356 #define OS_SYS_MEM_SIZE 0x10000UL 357 #endif 358 359 #ifndef LOSCFG_MEMORY_BESTFIT 360 #define LOSCFG_MEMORY_BESTFIT YES 361 #endif 362 363 /** 364 * @ingroup los_config 365 * Configuration module tailoring of more mempry pool checking 366 */ 367 #ifndef LOSCFG_MEM_MUL_POOL 368 #define LOSCFG_MEM_MUL_POOL NO 369 #endif 370 371 /** 372 * @ingroup los_config 373 * Configuration module tailoring of slab memory 374 */ 375 #ifndef LOSCFG_KERNEL_MEM_SLAB 376 #define LOSCFG_KERNEL_MEM_SLAB YES 377 #endif 378 379 /** 380 * @ingroup los_config 381 * Configuration module tailoring of mem node integrity checking 382 */ 383 #ifndef LOSCFG_BASE_MEM_NODE_INTEGRITY_CHECK 384 #define LOSCFG_BASE_MEM_NODE_INTEGRITY_CHECK NO 385 #endif 386 387 /** 388 * @ingroup los_config 389 * Configuration module tailoring of mem node size checking 390 */ 391 #ifndef LOSCFG_BASE_MEM_NODE_SIZE_CHECK 392 #define LOSCFG_BASE_MEM_NODE_SIZE_CHECK YES 393 #endif 394 395 /** 396 * @ingroup los_config 397 * Configuration module momery alloc and free check 398 */ 399 #ifndef LOSCFG_MEM_ENABLE_ALLOC_CHECK 400 #define LOSCFG_MEM_ENABLE_ALLOC_CHECK YES 401 #endif 402 403 /** 404 * @ingroup los_config 405 * Number of memory checking blocks 406 */ 407 #ifndef OS_SYS_MEM_NUM 408 #define OS_SYS_MEM_NUM 20 409 #endif 410 411 /** 412 * @ingroup los_config 413 * Configuration heap memory peak statistics 414 */ 415 #ifndef LOSCFG_HEAP_MEMORY_PEAK_STATISTICS 416 #define LOSCFG_HEAP_MEMORY_PEAK_STATISTICS YES 417 #endif 418 419 /** 420 * @ingroup los_config 421 * Size of unaligned memory 422 */ 423 #ifndef OS_SYS_NOCACHEMEM_SIZE 424 #define OS_SYS_NOCACHEMEM_SIZE 0x0UL 425 #endif 426 427 /** 428 * @ingroup los_config 429 * Starting address of the unaligned memory 430 */ 431 #if (OS_SYS_NOCACHEMEM_SIZE > 0) 432 extern UINT8 *g_sysNoCacheMem0; 433 #define OS_SYS_NOCACHEMEM_ADDR (&g_sysNoCacheMem0[0]) 434 #endif 435 436 437 /* ============================================================================= 438 Exception module configuration 439 ============================================================================= */ 440 /** 441 * @ingroup los_config 442 * Configuration item for exception tailoring 443 */ 444 #ifndef LOSCFG_PLATFORM_EXC 445 #define LOSCFG_PLATFORM_EXC NO 446 #endif 447 448 /** 449 * @ingroup los_config 450 * Configuration item for saveing exception info tailoring 451 */ 452 #ifndef LOSCFG_SAVE_EXC_INFO 453 #define LOSCFG_SAVE_EXC_INFO NO 454 #endif 455 456 #if(LOSCFG_PLATFORM_EXC == NO && LOSCFG_SAVE_EXC_INFO == YES) 457 #error "save exception info need support platform exception, should make LOSCFG_PLATFORM_EXC = YES" 458 #endif 459 460 /* ============================================================================= 461 MPU module configuration 462 ============================================================================= */ 463 /** 464 * @ingroup los_config 465 * Configuration item for MPU 466 */ 467 #ifndef LOSCFG_BASE_CORE_MPU 468 #define LOSCFG_BASE_CORE_MPU NO 469 #endif 470 471 /** 472 * @ingroup los_config 473 * MPU support number : MPU maximum number of region support(According to the cotex-m4 authority Guide) 474 */ 475 #ifndef LOSCFG_MPU_MAX_SUPPORT 476 #define LOSCFG_MPU_MAX_SUPPORT 8 477 #endif 478 479 /** 480 * @ingroup los_config 481 * MPU support address range : from LOSCFG_MPU_MIN_ADDRESS to LOSCFG_MPU_MAX_ADDRESS 482 */ 483 #ifndef LOSCFG_MPU_MIN_ADDRESS 484 #define LOSCFG_MPU_MIN_ADDRESS 0x0UL // Minimum protected address 485 #endif 486 487 #ifndef LOSCFG_MPU_MAX_ADDRESS 488 #define LOSCFG_MPU_MAX_ADDRESS 0xFFFFFFFFUL // Maximum protected address 489 #endif 490 491 /* ============================================================================= 492 Runstop module configuration 493 ============================================================================= */ 494 /** 495 * @ingroup los_config 496 * Configuration item for runstop module tailoring 497 */ 498 #ifndef LOSCFG_KERNEL_RUNSTOP 499 #define LOSCFG_KERNEL_RUNSTOP YES 500 #endif 501 502 #ifndef LOSCFG_RUNSTOP_THRESHOLD 503 #define LOSCFG_RUNSTOP_THRESHOLD 2 504 #endif 505 506 /* ============================================================================= 507 Perf module configuration 508 ============================================================================= */ 509 /** 510 * @ingroup los_config 511 * Configuration item for performance moniter unit 512 */ 513 #ifndef OS_INCLUDE_PERF 514 #define OS_INCLUDE_PERF NO 515 #endif 516 517 518 /* ============================================================================= 519 CPUP configuration 520 ============================================================================= */ 521 /** 522 * @ingroup los_config 523 * Configuration item for CPU usage tailoring 524 */ 525 #ifndef LOSCFG_BASE_CORE_CPUP 526 #define LOSCFG_BASE_CORE_CPUP NO 527 #endif 528 529 #ifndef LOSCFG_BASE_CORE_CPUP_HWI 530 #define LOSCFG_BASE_CORE_CPUP_HWI NO 531 #endif 532 533 #if(LOSCFG_BASE_CORE_TSK_MONITOR == NO && LOSCFG_BASE_CORE_CPUP == YES) 534 #error "cpup need support task monitor, should make LOSCFG_BASE_CORE_TSK_MONITOR = YES" 535 #endif 536 537 /*============================================================================= 538 FPB configuration 539 =============================================================================*/ 540 #ifndef LOSCFG_BASE_CORE_FPB 541 #define LOSCFG_BASE_CORE_FPB NO 542 #endif 543 544 545 #ifndef LOSCFG_FPB_CONFIG_PCO 546 #define LOSCFG_FPB_CONFIG_PCO 1 547 #endif 548 549 #if (LOSCFG_FPB_CONFIG_PCO > 1) 550 #error "LOSCFG_FPB_CONFIG_PCO can only set 0 or 1!" 551 #endif 552 553 554 /* ============================================================================= 555 fw Interface configuration 556 ============================================================================= */ 557 /** 558 * @ingroup los_config 559 * Configuration item for the monitoring of task communication 560 */ 561 #ifndef LOSCFG_COMPAT_CMSIS_FW 562 #define LOSCFG_COMPAT_CMSIS_FW NO 563 #endif 564 565 566 /* ============================================================================= 567 Shell module configuration 568 ============================================================================= */ 569 /** 570 * @ingroup los_config 571 * Configuration item for shell module tailoring 572 */ 573 #ifndef OS_INCLUDE_SHELL 574 #define OS_INCLUDE_SHELL NO 575 #endif 576 577 /* ============================================================================= 578 Lib configurable feature configuration 579 ============================================================================= */ 580 /** 581 * @ingroup los_config 582 * Configuration lib configurable feature to open 583 */ 584 #ifndef LOSCFG_LIB_CONFIGURABLE 585 #define LOSCFG_LIB_CONFIGURABLE NO 586 #endif 587 588 /* ============================================================================= 589 Test module configuration 590 ============================================================================= */ 591 /** 592 * @ingroup los_config 593 * Configuration test case to open 594 */ 595 #ifndef LOSCFG_TEST 596 #define LOSCFG_TEST NO 597 #endif 598 599 /* ============================================================================= 600 LIBC module configuration 601 ============================================================================= */ 602 /** 603 * @ingroup los_config 604 * Configuration to support libc 605 */ 606 #ifndef LOSCFG_LIB_LIBC 607 #define LOSCFG_LIB_LIBC NO 608 #endif 609 610 /* ============================================================================= 611 LiteOS kernel version configuration 612 ============================================================================= */ 613 /** 614 * @ingroup los_config 615 * Version number 616 */ 617 #ifndef LITEOS_VER 618 #endif 619 620 /** 621 * @ingroup los_config 622 * Configuration CMSIS_OS_VER 623 */ 624 #ifndef CMSIS_OS_VER 625 #define CMSIS_OS_VER 0 626 #endif 627 628 /** 629 * @ingroup los_config 630 * @brief: Task start running function. 631 * 632 * @par Description: 633 * This API is used to start a task. 634 * 635 * @attention: 636 * <ul><li>None.</li></ul> 637 * 638 * @param: None. 639 * 640 * @retval None. 641 * 642 * @par Dependency: 643 * <ul><li>los_config.h: the header file that contains the API declaration.</li></ul> 644 * @see None. 645 */ 646 extern VOID LOS_StartToRun(VOID); 647 648 /** 649 * @ingroup los_config 650 * @brief: Test Task init function. 651 * 652 * @par Description: 653 * This API is used to initialize Test Task. 654 * 655 * @attention: 656 * <ul><li>None.</li></ul> 657 * 658 * @param: None. 659 * 660 * @retval #LOS_OK 0:App_Task initialization success. 661 * 662 * @par Dependency: 663 * <ul><li>los_config.h: the header file that contains the API declaration.</li></ul> 664 * @see None. 665 */ 666 extern UINT32 LOS_TestInit(VOID); 667 #ifdef __cplusplus 668 #if __cplusplus 669 } 670 #endif /* __cplusplus */ 671 #endif /* __cplusplus */ 672 673 #endif /* _LOS_CONFIG_H */ 674