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.
Fork of mbed-rtos by
RTX_Conf_CM.c
00001 /*---------------------------------------------------------------------------- 00002 * RL-ARM - RTX 00003 *---------------------------------------------------------------------------- 00004 * Name: RTX_Conf_CM.C 00005 * Purpose: Configuration of CMSIS RTX Kernel for Cortex-M 00006 * Rev.: V4.60 00007 *---------------------------------------------------------------------------- 00008 * 00009 * Copyright (c) 1999-2009 KEIL, 2009-2012 ARM Germany GmbH 00010 * All rights reserved. 00011 * Redistribution and use in source and binary forms, with or without 00012 * modification, are permitted provided that the following conditions are met: 00013 * - Redistributions of source code must retain the above copyright 00014 * notice, this list of conditions and the following disclaimer. 00015 * - Redistributions in binary form must reproduce the above copyright 00016 * notice, this list of conditions and the following disclaimer in the 00017 * documentation and/or other materials provided with the distribution. 00018 * - Neither the name of ARM nor the names of its contributors may be used 00019 * to endorse or promote products derived from this software without 00020 * specific prior written permission. 00021 * 00022 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00023 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00024 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00025 * ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE 00026 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00027 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00028 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00029 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00030 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00031 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00032 * POSSIBILITY OF SUCH DAMAGE. 00033 *---------------------------------------------------------------------------*/ 00034 00035 #include "cmsis_os.h" 00036 00037 00038 /*---------------------------------------------------------------------------- 00039 * RTX User configuration part BEGIN 00040 *---------------------------------------------------------------------------*/ 00041 00042 //-------- <<< Use Configuration Wizard in Context Menu >>> ----------------- 00043 // 00044 // <h>Thread Configuration 00045 // ======================= 00046 // 00047 // <o>Number of concurrent running threads <0-250> 00048 // <i> Defines max. number of threads that will run at the same time. 00049 // counting "main", but not counting "osTimerThread" 00050 // <i> Default: 6 00051 #ifndef OS_TASKCNT 00052 # if defined(TARGET_LPC1768) || defined(TARGET_LPC2368) || defined(TARGET_LPC4088) || defined(TARGET_LPC1347) || defined(TARGET_K64F) \ 00053 || defined(TARGET_KL46Z) || defined(TARGET_STM32F407) || defined(TARGET_F407VG) 00054 # define OS_TASKCNT 14 00055 # elif defined(TARGET_LPC11U24) || defined(TARGET_LPC11U35_401) || defined(TARGET_LPC11U35_501) || defined(TARGET_LPC1114) || defined(TARGET_LPC812) || defined(TARGET_KL25Z) || defined(TARGET_STM32F100RB) || defined(TARGET_STM32F051R8) 00056 # define OS_TASKCNT 6 00057 # else 00058 # error "no target defined" 00059 # endif 00060 #endif 00061 00062 // <o>Scheduler (+ interrupts) stack size [bytes] <64-4096:8><#/4> 00063 #ifndef OS_SCHEDULERSTKSIZE 00064 # if defined(TARGET_LPC1768) || defined(TARGET_LPC2368) || defined(TARGET_LPC4088) || defined(TARGET_LPC1347) || defined(TARGET_K64F) \ 00065 || defined(TARGET_KL46Z) || defined(TARGET_STM32F407) || defined(TARGET_F407VG) 00066 # define OS_SCHEDULERSTKSIZE 256 00067 # elif defined(TARGET_LPC11U24) || defined(TARGET_LPC11U35_401) || defined(TARGET_LPC11U35_501) || defined(TARGET_LPC1114) || defined(TARGET_LPC812) || defined(TARGET_KL25Z) || defined(TARGET_STM32F100RB) || defined(TARGET_STM32F051R8) 00068 # define OS_SCHEDULERSTKSIZE 128 00069 # else 00070 # error "no target defined" 00071 # endif 00072 #endif 00073 00074 // <o>Idle stack size [bytes] <64-4096:8><#/4> 00075 // <i> Defines default stack size for the Idle thread. 00076 #ifndef OS_IDLESTKSIZE 00077 #define OS_IDLESTKSIZE 128 00078 #endif 00079 00080 // <o>Timer Thread stack size [bytes] <64-4096:8><#/4> 00081 // <i> Defines stack size for Timer thread. 00082 // <i> Default: 200 00083 #ifndef OS_TIMERSTKSZ 00084 #define OS_TIMERSTKSZ WORDS_STACK_SIZE 00085 #endif 00086 00087 // <q>Check for stack overflow 00088 // <i> Includes the stack checking code for stack overflow. 00089 // <i> Note that additional code reduces the Kernel performance. 00090 #ifndef OS_STKCHECK 00091 #define OS_STKCHECK 1 00092 #endif 00093 00094 // <o>Processor mode for thread execution 00095 // <0=> Unprivileged mode 00096 // <1=> Privileged mode 00097 // <i> Default: Privileged mode 00098 #ifndef OS_RUNPRIV 00099 #define OS_RUNPRIV 1 00100 #endif 00101 00102 // </h> 00103 // <h>SysTick Timer Configuration 00104 // ============================== 00105 // 00106 // <o>Timer clock value [Hz] <1-1000000000> 00107 // <i> Defines the timer clock value. 00108 // <i> Default: 6000000 (6MHz) 00109 #ifndef OS_CLOCK 00110 # if defined(TARGET_LPC1768) || defined(TARGET_LPC2368) 00111 # define OS_CLOCK 96000000 00112 00113 # elif defined(TARGET_LPC1347) 00114 # define OS_CLOCK 72000000 00115 00116 # elif defined(TARGET_LPC11U24) || defined(TARGET_LPC11U35_401) || defined(TARGET_LPC11U35_501) || defined(TARGET_LPC1114) || defined(TARGET_KL25Z) || defined(TARGET_KL46Z) || defined(TARGET_STM32F051R8) 00117 # define OS_CLOCK 48000000 00118 00119 # elif defined(TARGET_LPC812) 00120 # define OS_CLOCK 36000000 00121 00122 # elif defined(TARGET_STM32F100RB) 00123 # define OS_CLOCK 24000000 00124 00125 # elif defined(TARGET_LPC4088) || defined(TARGET_K64F) 00126 # define OS_CLOCK 120000000 00127 00128 # elif defined(TARGET_STM32F407) || defined(TARGET_F407VG) 00129 # define OS_CLOCK 168000000 00130 00131 # else 00132 # error "no target defined" 00133 # endif 00134 #endif 00135 00136 // <o>Timer tick value [us] <1-1000000> 00137 // <i> Defines the timer tick value. 00138 // <i> Default: 1000 (1ms) 00139 #ifndef OS_TICK 00140 #define OS_TICK 1000 00141 #endif 00142 00143 // </h> 00144 00145 // <h>System Configuration 00146 // ======================= 00147 // 00148 // <e>Round-Robin Thread switching 00149 // =============================== 00150 // 00151 // <i> Enables Round-Robin Thread switching. 00152 #ifndef OS_ROBIN 00153 #define OS_ROBIN 1 00154 #endif 00155 00156 // <o>Round-Robin Timeout [ticks] <1-1000> 00157 // <i> Defines how long a thread will execute before a thread switch. 00158 // <i> Default: 5 00159 #ifndef OS_ROBINTOUT 00160 #define OS_ROBINTOUT 5 00161 #endif 00162 00163 // </e> 00164 00165 // <e>User Timers 00166 // ============== 00167 // <i> Enables user Timers 00168 #ifndef OS_TIMERS 00169 #define OS_TIMERS 1 00170 #endif 00171 00172 // <o>Timer Thread Priority 00173 // <1=> Low 00174 // <2=> Below Normal 00175 // <3=> Normal 00176 // <4=> Above Normal 00177 // <5=> High 00178 // <6=> Realtime (highest) 00179 // <i> Defines priority for Timer Thread 00180 // <i> Default: High 00181 #ifndef OS_TIMERPRIO 00182 #define OS_TIMERPRIO 5 00183 #endif 00184 00185 // <o>Timer Callback Queue size <1-32> 00186 // <i> Number of concurrent active timer callback functions. 00187 // <i> Default: 4 00188 #ifndef OS_TIMERCBQSZ 00189 #define OS_TIMERCBQS 4 00190 #endif 00191 00192 // </e> 00193 00194 // <o>ISR FIFO Queue size<4=> 4 entries <8=> 8 entries 00195 // <12=> 12 entries <16=> 16 entries 00196 // <24=> 24 entries <32=> 32 entries 00197 // <48=> 48 entries <64=> 64 entries 00198 // <96=> 96 entries 00199 // <i> ISR functions store requests to this buffer, 00200 // <i> when they are called from the interrupt handler. 00201 // <i> Default: 16 entries 00202 #ifndef OS_FIFOSZ 00203 #define OS_FIFOSZ 16 00204 #endif 00205 00206 // </h> 00207 00208 //------------- <<< end of configuration section >>> ----------------------- 00209 00210 // Standard library system mutexes 00211 // =============================== 00212 // Define max. number system mutexes that are used to protect 00213 // the arm standard runtime library. For microlib they are not used. 00214 #ifndef OS_MUTEXCNT 00215 #define OS_MUTEXCNT 12 00216 #endif 00217 00218 /*---------------------------------------------------------------------------- 00219 * RTX User configuration part END 00220 *---------------------------------------------------------------------------*/ 00221 00222 #define OS_TRV ((uint32_t)(((double)OS_CLOCK*(double)OS_TICK)/1E6)-1) 00223 00224 00225 /*---------------------------------------------------------------------------- 00226 * OS Idle daemon 00227 *---------------------------------------------------------------------------*/ 00228 void os_idle_demon (void) { 00229 /* The idle demon is a system thread, running when no other thread is */ 00230 /* ready to run. */ 00231 00232 /* Sleep: ideally, we should put the chip to sleep. 00233 Unfortunately, this usually requires disconnecting the interface chip (debugger). 00234 This can be done, but it would break the local file system. 00235 */ 00236 for (;;) { 00237 // sleep(); 00238 } 00239 } 00240 00241 /*---------------------------------------------------------------------------- 00242 * RTX Errors 00243 *---------------------------------------------------------------------------*/ 00244 extern void mbed_die(void); 00245 00246 void os_error (uint32_t err_code) { 00247 /* This function is called when a runtime error is detected. Parameter */ 00248 /* 'err_code' holds the runtime error code (defined in RTX_Conf.h). */ 00249 mbed_die(); 00250 } 00251 00252 void sysThreadError(osStatus status) { 00253 if (status != osOK) { 00254 mbed_die(); 00255 } 00256 } 00257 00258 /*---------------------------------------------------------------------------- 00259 * RTX Configuration Functions 00260 *---------------------------------------------------------------------------*/ 00261 00262 #include "RTX_CM_lib.h" 00263 00264 /*---------------------------------------------------------------------------- 00265 * end of file 00266 *---------------------------------------------------------------------------*/
Generated on Tue Jul 12 2022 19:15:06 by
1.7.2
