1 /* 2 * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. 3 * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. 4 * Copyright (C) 2022 Beken Corporation 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 /**@defgroup los_config System configuration items 19 * @ingroup kernel 20 */ 21 22 #ifndef _TARGET_CONFIG_H_ 23 #define _TARGET_CONFIG_H_ 24 25 #ifdef __cplusplus 26 #if __cplusplus 27 extern "C" { 28 #endif /* __cplusplus */ 29 #endif /* __cplusplus */ 30 31 #include "soc.h" 32 33 #ifndef CONFIG_LITEOS_M_BK 34 #define CONFIG_LITEOS_M_BK 1 35 #endif 36 37 #define CMSIS_OS_VER 2 38 #define LOSCFG_KERNEL_PRINTF 1 39 #define LOSCFG_KERNEL_PM 1 40 41 #define LOS_TICK_UNIT_CLOCK 26000000 42 #define LOS_TICK_MS 2 43 #define LOS_TICKS_PER_SECOND (1000UL/LOS_TICK_MS) 44 45 /*============================================================================= 46 *System clock module configuration 47 *=============================================================================*/ 48 #define OS_SYS_CLOCK (LOS_TICK_UNIT_CLOCK) 49 #define LOSCFG_BASE_CORE_TICK_PER_SECOND (LOS_TICKS_PER_SECOND) 50 #define LOSCFG_BASE_CORE_TICK_HW_TIME 0 51 #define LOSCFG_BASE_CORE_TICK_WTIMER 1 52 #define LOSCFG_BASE_CORE_TICK_RESPONSE_MAX (0xFFFFFFFFFFFFFFFFULL) 53 54 /*============================================================================= 55 *Hardware interrupt module configuration 56 *=============================================================================*/ 57 #define LOSCFG_PLATFORM_HWI 1 58 #define LOSCFG_PLATFORM_HWI_LIMIT 128 59 60 /*============================================================================= 61 *Task module configuration 62 *=============================================================================*/ 63 #define LOSCFG_BASE_CORE_TSK_LIMIT 30 64 #define LOSCFG_BASE_CORE_TSK_IDLE_STACK_SIZE (0x1180U) 65 #define LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE (0x1180U) 66 67 /*scheduler occupies too much stack for every thread*/ 68 #define LOSCFG_BASE_CORE_TSK_MIN_STACK_SIZE (0x400U) 69 #define LOSCFG_BASE_CORE_TIMESLICE 1 70 #define LOSCFG_BASE_CORE_TIMESLICE_TIMEOUT 20000 71 #define LOSCFG_BASE_CORE_TSK_DEFAULT_PRIO 15 72 73 /*============================================================================= 74 *Semaphore module configuration 75 *=============================================================================*/ 76 #define LOSCFG_BASE_IPC_SEM 1 77 #define LOSCFG_BASE_IPC_SEM_LIMIT 32 78 79 /*============================================================================= 80 *Mutex module configuration 81 *=============================================================================*/ 82 #define LOSCFG_BASE_IPC_MUX 1 83 #define LOSCFG_BASE_IPC_MUX_LIMIT 64 84 85 /*============================================================================= 86 *Queue module configuration 87 *=============================================================================*/ 88 #define LOSCFG_BASE_IPC_QUEUE 1 89 #define LOSCFG_BASE_IPC_QUEUE_LIMIT 32 90 91 /*============================================================================= 92 *Software timer module configuration 93 *=============================================================================*/ 94 #define LOSCFG_BASE_CORE_SWTMR 1 95 #define LOSCFG_BASE_CORE_SWTMR_ALIGN 1 96 #define LOSCFG_BASE_CORE_SWTMR_LIMIT 32 97 98 /*============================================================================= 99 *Memory module configuration 100 *=============================================================================*/ 101 extern unsigned char _end; //the end of bss section in sram 102 extern unsigned char *m_aucSysMem0; 103 104 #define LOSCFG_SYS_EXTERNAL_HEAP 0 105 106 #if (LOSCFG_SYS_EXTERNAL_HEAP == 1) 107 #define LOSCFG_SYS_HEAP_ADDR (&_end) 108 #else 109 #define LOSCFG_SYS_HEAP_ADDR (&m_aucSysMem0[0]) 110 #define LOSCFG_SYS_HEAP_SIZE ( size_t ) ( 160 * 1024 ) 111 #endif 112 113 114 //#define OS_SYS_MEM_SIZE 0x0001000 115 #define LOSCFG_BASE_MEM_NODE_INTEGRITY_CHECK 0 116 #define LOSCFG_BASE_MEM_NODE_SIZE_CHECK 1 117 #define LOSCFG_MEM_MUL_POOL 1 118 #define OS_SYS_MEM_NUM 20 119 #define LOSCFG_KERNEL_MEM_SLAB 0 120 #define LOSCFG_PLATFORM_HWI_WITH_ARG 1 121 122 123 /*============================================================================= 124 *Exception module configuration 125 *=============================================================================*/ 126 #ifndef LOSCFG_PLATFORM_EXC 127 #define LOSCFG_PLATFORM_EXC 0 128 #endif 129 #define LOSCFG_BASE_CORE_TSK_MONITOR 1 130 131 #ifndef LOSCFG_BACKTRACE_TYPE 132 #define LOSCFG_BACKTRACE_TYPE 0 133 #endif 134 135 #define LOSCFG_MEM_LEAKCHECK 0 136 137 extern void uart_putc(char c); 138 139 140 141 /* ============================================================================= 142 backtrace configuration 143 ============================================================================= */ 144 /** 145 * @ingroup los_config 146 * Configuration backtrace type 147 * 0: Close stack analysis module. 148 * 1: Call stack analysis for cortex-m series by scanning the stack. 149 * 2: Call stack analysis for risc-v by using frame pointer. 150 * 3: Call stack analysis for risc-v by scanning the stack. 151 * others: Not currently supported. 152 */ 153 #ifndef LOSCFG_BACKTRACE_TYPE 154 #define LOSCFG_BACKTRACE_TYPE 0 155 #endif 156 157 /** 158 * @ingroup los_config 159 * Configuration backtrace depth. 160 */ 161 #ifndef LOSCFG_BACKTRACE_DEPTH 162 #define LOSCFG_BACKTRACE_DEPTH 15 163 #endif 164 165 166 167 168 #ifdef __cplusplus 169 #if __cplusplus 170 } 171 #endif /* __cplusplus */ 172 #endif /* __cplusplus */ 173 174 175 #endif /* _TARGET_CONFIG_H */ 176