1 /* 2 * Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without modification, 5 * are permitted provided that the following conditions are met: 6 * 7 * 1. Redistributions of source code must retain the above copyright notice, this list of 8 * conditions and the following disclaimer. 9 * 10 * 2. Redistributions in binary form must reproduce the above copyright notice, this list 11 * of conditions and the following disclaimer in the documentation and/or other materials 12 * provided with the distribution. 13 * 14 * 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 * to endorse or promote products derived from this software without specific prior written 16 * permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31 #ifndef PRT_CONFIG_H 32 #define PRT_CONFIG_H 33 34 #include "prt_typedef.h" 35 #include "prt_buildef.h" 36 37 #ifdef __cplusplus 38 #if __cplusplus 39 extern "C" { 40 #endif 41 #endif 42 43 /* ***************************** 配置系统基本信息 ******************************* */ 44 /* 芯片主频 */ 45 extern unsigned SystemCoreClock; 46 #define OS_SYS_CLOCK SystemCoreClock 47 48 /* ***************************** 中断模块配置 ************************** */ 49 /* 硬中断最大支持个数 */ 50 #define OS_HWI_MAX_NUM_CONFIG 150 51 52 /* ***************************** 配置Tick中断模块 *************************** */ 53 /* Tick中断模块裁剪开关 */ 54 #define OS_INCLUDE_TICK YES 55 /* Tick中断时间间隔,tick处理时间不能超过1/OS_TICK_PER_SECOND(s) */ 56 #define OS_TICK_PER_SECOND 1000 57 58 /* ***************************** 配置定时器模块 ***************************** */ 59 /* 基于TICK的软件定时器裁剪开关 */ 60 #define OS_INCLUDE_TICK_SWTMER YES 61 /* 基于TICK的软件定时器最大个数 */ 62 #define OS_TICK_SWITIMER_MAX_NUM 8 63 64 /* ***************************** 配置任务模块 ******************************* */ 65 /* 任务模块裁剪开关 */ 66 #define OS_INCLUDE_TASK YES 67 /* 最大支持的任务数,最大共支持254个 */ 68 #define OS_TSK_MAX_SUPPORT_NUM 15 69 /* 缺省的任务栈大小 */ 70 #define OS_TSK_DEFAULT_STACK_SIZE 1024 71 /* IDLE任务栈的大小 */ 72 #define OS_TSK_IDLE_STACK_SIZE 800 73 /* 任务栈初始化魔术字,默认是0xCA,只支持配置一个字节 */ 74 #define OS_TSK_STACK_MAGIC_WORD 0xCA 75 76 /* ***************************** 配置CPU占用率及CPU告警模块 **************** */ 77 /* CPU占用率模块裁剪开关 */ 78 #define OS_INCLUDE_CPUP YES 79 /* 采样时间间隔(单位tick),若其值大于0,则作为采样周期,否则两次调用PRT_CpupNow或PRT_CpupThread间隔作为周期 */ 80 #define OS_CPUP_SAMPLE_INTERVAL 0 81 /* CPU占用率告警动态配置项 */ 82 #define OS_CONFIG_CPUP_WARN NO 83 /* CPU占用率告警阈值(精度为万分比) */ 84 #define OS_CPUP_SHORT_WARN 0 85 /* CPU占用率告警恢复阈值(精度为万分比) */ 86 #define OS_CPUP_SHORT_RESUME 0 87 88 /* ***************************** 配置内存管理模块 ************************** */ 89 /* 用户可以创建的最大分区数,取值范围[0,253] */ 90 #define OS_MEM_MAX_PT_NUM 1 91 /* 私有FSC内存分区起始地址 */ 92 extern unsigned int __heap_start; 93 extern unsigned int __heap_size; 94 #define OS_MEM_FSC_PT_ADDR ((uintptr_t)&__heap_start) 95 /* 私有FSC内存分区大小 */ 96 #define OS_MEM_FSC_PT_SIZE 0xfffc // ((unsigned int)&__heap_size) 97 98 /* ***************************** 配置信号量管理模块 ************************* */ 99 /* 信号量模块裁剪开关 */ 100 #define OS_INCLUDE_SEM YES 101 102 /* 最大支持的信号量数 */ 103 #ifdef LOSCFG_DRIVERS_HDF_TESTS_ENABLE 104 #define OS_SEM_MAX_SUPPORT_NUM 80 105 #elif defined DRIVERS_HDF 106 #define OS_SEM_MAX_SUPPORT_NUM 50 107 #else 108 #define OS_SEM_MAX_SUPPORT_NUM 20 109 #endif 110 /* ***************************** 配置队列模块 ******************************* */ 111 /* 队列模块裁剪开关 */ 112 #define OS_INCLUDE_QUEUE YES 113 /* 最大支持的队列数,范围(0,0xFFFF] */ 114 #define OS_QUEUE_MAX_SUPPORT_NUM 10 115 116 #define OS_OPTION_TASK_DELETE 1 117 118 /* ************************* 钩子模块配置 *********************************** */ 119 /* 硬中断进入钩子最大支持个数, 范围[0, 255] */ 120 #define OS_HOOK_HWI_ENTRY_NUM 0 121 /* 硬中断退出钩子最大支持个数, 范围[0, 255] */ 122 #define OS_HOOK_HWI_EXIT_NUM 0 123 /* 任务切换钩子最大支持个数, 范围[0, 255] */ 124 #define OS_HOOK_TSK_SWITCH_NUM 0 125 /* IDLE钩子最大支持个数, 范围[0, 255] */ 126 #define OS_HOOK_IDLE_NUM 0 127 128 typedef enum OsinitPhaseId { 129 OS_MOUDLE_REG, 130 OS_MOUDLE_INIT, 131 OS_MOUDLE_CONFIG = 2, 132 }; 133 134 #ifdef __cplusplus 135 #if __cplusplus 136 } 137 #endif /* __cpluscplus */ 138 #endif /* __cpluscplus */ 139 140 #endif /* TARGET_CONFIG_H */ 141