Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
RTX_Config.c
00001 /** 00002 * @file RTX_Config.c 00003 * @brief Project settings for the RTX kernel 00004 * 00005 * DAPLink Interface Firmware 00006 * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved 00007 * SPDX-License-Identifier: Apache-2.0 00008 * 00009 * Licensed under the Apache License, Version 2.0 (the "License"); you may 00010 * not use this file except in compliance with the License. 00011 * You may obtain a copy of the License at 00012 * 00013 * http://www.apache.org/licenses/LICENSE-2.0 00014 * 00015 * Unless required by applicable law or agreed to in writing, software 00016 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 00017 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00018 * See the License for the specific language governing permissions and 00019 * limitations under the License. 00020 */ 00021 00022 #include "RTL.h" 00023 #include "util.h" 00024 #include "cortex_m.h" 00025 00026 /*---------------------------------------------------------------------------- 00027 * RTX User configuration part BEGIN 00028 *---------------------------------------------------------------------------*/ 00029 00030 //-------- <<< Use Configuration Wizard in Context Menu >>> ----------------- 00031 // 00032 // <h>Task Configuration 00033 // ===================== 00034 // 00035 // <o>Number of concurrent running tasks <0-250> 00036 // <i> Define max. number of tasks that will run at the same time. 00037 // <i> Default: 6 00038 #ifndef OS_TASKCNT 00039 #define OS_TASKCNT 4 00040 // Threads with user provided stacks: 00041 // -serial_process 00042 // -hid_process 00043 // -timer_task_30mS 00044 // -main_task 00045 #endif 00046 00047 // <o>Number of tasks with user-provided stack <0-250> 00048 // <i> Define the number of tasks that will use a bigger stack. 00049 // <i> The memory space for the stack is provided by the user. 00050 // <i> Default: 0 00051 #ifndef OS_PRIVCNT 00052 #define OS_PRIVCNT OS_TASKCNT 00053 // All tasks use private stacks (aside from background thread) 00054 #endif 00055 00056 // <o>Task stack size [bytes] <20-4096:8><#/4> 00057 // <i> Set the stack size for tasks which is assigned by the system. 00058 // <i> Default: 200 00059 #ifndef OS_STKSIZE 00060 #define OS_STKSIZE 34 00061 // Used by: 00062 // -os_idle_demon 00063 #endif 00064 00065 // <q>Check for the stack overflow 00066 // =============================== 00067 // <i> Include the stack checking code for a stack overflow. 00068 // <i> Note that additional code reduces the Kernel performance. 00069 #ifndef OS_STKCHECK 00070 #define OS_STKCHECK 1 00071 #endif 00072 00073 // <q>Run in privileged mode 00074 // ========================= 00075 // <i> Run all Tasks in privileged mode. 00076 // <i> Default: Unprivileged 00077 #ifndef OS_RUNPRIV 00078 #define OS_RUNPRIV 1 00079 #endif 00080 00081 // </h> 00082 // <h>SysTick Timer Configuration 00083 // ============================= 00084 // <o>Timer clock value [Hz] <1-1000000000> 00085 // <i> Set the timer clock value for selected timer. 00086 #ifndef OS_CLOCK 00087 #error "OS_CLOCK should be defined by HIC configuration" 00088 #endif 00089 00090 // <o>Timer tick value [us] <1-1000000> 00091 // <i> Set the timer tick value for selected timer. 00092 #ifndef OS_TICK 00093 #error "OS_TICK should be defined by RTOS configuration" 00094 #endif 00095 00096 // </h> 00097 00098 // <h>System Configuration 00099 // ======================= 00100 // <e>Round-Robin Task switching 00101 // ============================= 00102 // <i> Enable Round-Robin Task switching. 00103 #ifndef OS_ROBIN 00104 #define OS_ROBIN 0 00105 #endif 00106 00107 // <o>Round-Robin Timeout [ticks] <1-1000> 00108 // <i> Define how long a task will execute before a task switch. 00109 // <i> Default: 5 00110 #ifndef OS_ROBINTOUT 00111 #define OS_ROBINTOUT 10 00112 #endif 00113 00114 // </e> 00115 00116 // <o>Number of user timers <0-250> 00117 // <i> Define max. number of user timers that will run at the same time. 00118 // <i> Default: 0 (User timers disabled) 00119 #ifndef OS_TIMERCNT 00120 #define OS_TIMERCNT 0 00121 #endif 00122 00123 // <o>ISR FIFO Queue size<4=> 4 entries <8=> 8 entries 00124 // <12=> 12 entries <16=> 16 entries 00125 // <24=> 24 entries <32=> 32 entries 00126 // <48=> 48 entries <64=> 64 entries 00127 // <96=> 96 entries 00128 // <i> ISR functions store requests to this buffer, 00129 // <i> when they are called from the iterrupt handler. 00130 // <i> Default: 16 entries 00131 #ifndef OS_FIFOSZ 00132 #define OS_FIFOSZ 4 00133 #endif 00134 00135 // </h> 00136 00137 //------------- <<< end of configuration section >>> ----------------------- 00138 00139 // Standard library system mutexes 00140 // =============================== 00141 // Define max. number system mutexes that are used to protect 00142 // the arm standard runtime library. For microlib they are not used. 00143 #ifndef OS_MUTEXCNT 00144 #define OS_MUTEXCNT 1 00145 #endif 00146 00147 /*---------------------------------------------------------------------------- 00148 * RTX User configuration part END 00149 *---------------------------------------------------------------------------*/ 00150 00151 #define OS_TRV ((U32)(((double)OS_CLOCK*(double)OS_TICK)/1E6)-1) 00152 00153 /*---------------------------------------------------------------------------- 00154 * Global Functions 00155 *---------------------------------------------------------------------------*/ 00156 00157 /*--------------------------- os_idle_demon ---------------------------------*/ 00158 00159 __task void os_idle_demon(void) 00160 { 00161 /* The idle demon is a system task, running when no other task is ready */ 00162 /* to run. The 'os_xxx' function calls are not allowed from this task. */ 00163 for (;;) { 00164 /* HERE: include optional user code to be executed when no task runs.*/ 00165 } 00166 } 00167 00168 00169 /*--------------------------- os_tmr_call -----------------------------------*/ 00170 00171 void os_tmr_call(U16 info) 00172 { 00173 /* This function is called when the user timer has expired. Parameter */ 00174 /* 'info' holds the value, defined when the timer was created. */ 00175 /* HERE: include optional user code to be executed on timeout. */ 00176 } 00177 00178 00179 /*--------------------------- os_error --------------------------------------*/ 00180 00181 void os_error(U32 err_code) 00182 { 00183 /* This function is called when a runtime error is detected. Parameter */ 00184 /* 'err_code' holds the runtime error code (defined in RTL.H). */ 00185 switch (err_code) { 00186 case OS_ERR_STK_OVF: 00187 util_assert(0); 00188 break; 00189 00190 case OS_ERR_FIFO_OVF: 00191 util_assert(0); 00192 break; 00193 00194 case OS_ERR_MBX_OVF: 00195 util_assert(0); 00196 break; 00197 00198 default: 00199 util_assert(0); 00200 break; 00201 } 00202 00203 SystemReset(); 00204 00205 for (;;); // Wait for reset 00206 } 00207 00208 00209 /*---------------------------------------------------------------------------- 00210 * RTX Configuration Functions 00211 *---------------------------------------------------------------------------*/ 00212 00213 #include "RTX_lib.c" 00214 00215 /*---------------------------------------------------------------------------- 00216 * end of file 00217 *---------------------------------------------------------------------------*/
Generated on Tue Jul 12 2022 15:37:23 by
1.7.2