Modified by Osama Ashaikh
Fork of mbed-rtos by
rtx/TARGET_ARM7/RTX_Conf_CM.c@107:bdd541595fc5, 2016-03-15 (annotated)
- Committer:
- mbed_official
- Date:
- Tue Mar 15 09:00:39 2016 +0000
- Revision:
- 107:bdd541595fc5
- Parent:
- 80:2dab120a94c2
Synchronized with git revision 3afb55095212c88fc1c17177348bc1e16259c1ca
Full URL: https://github.com/mbedmicro/mbed/commit/3afb55095212c88fc1c17177348bc1e16259c1ca/
[STM32F4] Add DEVICE_RTC_LSI=0 to all targets
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 80:2dab120a94c2 | 1 | /*---------------------------------------------------------------------------- |
mbed_official | 80:2dab120a94c2 | 2 | * RL-ARM - RTX |
mbed_official | 80:2dab120a94c2 | 3 | *---------------------------------------------------------------------------- |
mbed_official | 80:2dab120a94c2 | 4 | * Name: RTX_Conf_CM.C |
mbed_official | 80:2dab120a94c2 | 5 | * Purpose: Configuration of CMSIS RTX Kernel for ARM7TDMI |
mbed_official | 80:2dab120a94c2 | 6 | * Rev.: V1.0 |
mbed_official | 80:2dab120a94c2 | 7 | *---------------------------------------------------------------------------- |
mbed_official | 80:2dab120a94c2 | 8 | * |
mbed_official | 80:2dab120a94c2 | 9 | * Copyright (c) 1999-2009 KEIL, 2009-2015 ARM Germany GmbH |
mbed_official | 80:2dab120a94c2 | 10 | * All rights reserved. |
mbed_official | 80:2dab120a94c2 | 11 | * Redistribution and use in source and binary forms, with or without |
mbed_official | 80:2dab120a94c2 | 12 | * modification, are permitted provided that the following conditions are met: |
mbed_official | 80:2dab120a94c2 | 13 | * - Redistributions of source code must retain the above copyright |
mbed_official | 80:2dab120a94c2 | 14 | * notice, this list of conditions and the following disclaimer. |
mbed_official | 80:2dab120a94c2 | 15 | * - Redistributions in binary form must reproduce the above copyright |
mbed_official | 80:2dab120a94c2 | 16 | * notice, this list of conditions and the following disclaimer in the |
mbed_official | 80:2dab120a94c2 | 17 | * documentation and/or other materials provided with the distribution. |
mbed_official | 80:2dab120a94c2 | 18 | * - Neither the name of ARM nor the names of its contributors may be used |
mbed_official | 80:2dab120a94c2 | 19 | * to endorse or promote products derived from this software without |
mbed_official | 80:2dab120a94c2 | 20 | * specific prior written permission. |
mbed_official | 80:2dab120a94c2 | 21 | * |
mbed_official | 80:2dab120a94c2 | 22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
mbed_official | 80:2dab120a94c2 | 23 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
mbed_official | 80:2dab120a94c2 | 24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
mbed_official | 80:2dab120a94c2 | 25 | * ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE |
mbed_official | 80:2dab120a94c2 | 26 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
mbed_official | 80:2dab120a94c2 | 27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
mbed_official | 80:2dab120a94c2 | 28 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
mbed_official | 80:2dab120a94c2 | 29 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
mbed_official | 80:2dab120a94c2 | 30 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
mbed_official | 80:2dab120a94c2 | 31 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
mbed_official | 80:2dab120a94c2 | 32 | * POSSIBILITY OF SUCH DAMAGE. |
mbed_official | 80:2dab120a94c2 | 33 | *---------------------------------------------------------------------------*/ |
mbed_official | 80:2dab120a94c2 | 34 | |
mbed_official | 80:2dab120a94c2 | 35 | #include "cmsis_os.h" |
mbed_official | 80:2dab120a94c2 | 36 | |
mbed_official | 80:2dab120a94c2 | 37 | |
mbed_official | 80:2dab120a94c2 | 38 | /*---------------------------------------------------------------------------- |
mbed_official | 80:2dab120a94c2 | 39 | * RTX User configuration part BEGIN |
mbed_official | 80:2dab120a94c2 | 40 | *---------------------------------------------------------------------------*/ |
mbed_official | 80:2dab120a94c2 | 41 | |
mbed_official | 80:2dab120a94c2 | 42 | //-------- <<< Use Configuration Wizard in Context Menu >>> ----------------- |
mbed_official | 80:2dab120a94c2 | 43 | // |
mbed_official | 80:2dab120a94c2 | 44 | // <h>Thread Configuration |
mbed_official | 80:2dab120a94c2 | 45 | // ======================= |
mbed_official | 80:2dab120a94c2 | 46 | // |
mbed_official | 80:2dab120a94c2 | 47 | // <o>Number of concurrent running threads <0-250> |
mbed_official | 80:2dab120a94c2 | 48 | // <i> Defines max. number of threads that will run at the same time. |
mbed_official | 80:2dab120a94c2 | 49 | // counting "main", but not counting "osTimerThread" |
mbed_official | 80:2dab120a94c2 | 50 | // <i> Default: 6 |
mbed_official | 80:2dab120a94c2 | 51 | #ifndef OS_TASKCNT |
mbed_official | 80:2dab120a94c2 | 52 | # if defined(TARGET_LPC2368) || defined(TARGET_LPC2460) |
mbed_official | 80:2dab120a94c2 | 53 | # define OS_TASKCNT 14 |
mbed_official | 80:2dab120a94c2 | 54 | # else |
mbed_official | 80:2dab120a94c2 | 55 | # error "no target defined" |
mbed_official | 80:2dab120a94c2 | 56 | # endif |
mbed_official | 80:2dab120a94c2 | 57 | #endif |
mbed_official | 80:2dab120a94c2 | 58 | |
mbed_official | 80:2dab120a94c2 | 59 | // <o>Scheduler (+ interrupts) stack size [bytes] <64-4096:8><#/4> |
mbed_official | 80:2dab120a94c2 | 60 | #ifndef OS_SCHEDULERSTKSIZE |
mbed_official | 80:2dab120a94c2 | 61 | # if defined(TARGET_LPC2368) || defined(TARGET_LPC2460) |
mbed_official | 80:2dab120a94c2 | 62 | # define OS_SCHEDULERSTKSIZE (136*2) |
mbed_official | 80:2dab120a94c2 | 63 | # else |
mbed_official | 80:2dab120a94c2 | 64 | # error "no target defined" |
mbed_official | 80:2dab120a94c2 | 65 | # endif |
mbed_official | 80:2dab120a94c2 | 66 | #endif |
mbed_official | 80:2dab120a94c2 | 67 | |
mbed_official | 80:2dab120a94c2 | 68 | // <o>Idle stack size [bytes] <64-4096:8><#/4> |
mbed_official | 80:2dab120a94c2 | 69 | // <i> Defines default stack size for the Idle thread. |
mbed_official | 80:2dab120a94c2 | 70 | #ifndef OS_IDLESTKSIZE |
mbed_official | 80:2dab120a94c2 | 71 | #define OS_IDLESTKSIZE 136 |
mbed_official | 80:2dab120a94c2 | 72 | #endif |
mbed_official | 80:2dab120a94c2 | 73 | |
mbed_official | 80:2dab120a94c2 | 74 | // <o>Timer Thread stack size [bytes] <64-4096:8><#/4> |
mbed_official | 80:2dab120a94c2 | 75 | // <i> Defines stack size for Timer thread. |
mbed_official | 80:2dab120a94c2 | 76 | // <i> Default: 200 |
mbed_official | 80:2dab120a94c2 | 77 | #ifndef OS_TIMERSTKSZ |
mbed_official | 80:2dab120a94c2 | 78 | #define OS_TIMERSTKSZ WORDS_STACK_SIZE |
mbed_official | 80:2dab120a94c2 | 79 | #endif |
mbed_official | 80:2dab120a94c2 | 80 | |
mbed_official | 80:2dab120a94c2 | 81 | // <q>Check for stack overflow |
mbed_official | 80:2dab120a94c2 | 82 | // <i> Includes the stack checking code for stack overflow. |
mbed_official | 80:2dab120a94c2 | 83 | // <i> Note that additional code reduces the Kernel performance. |
mbed_official | 80:2dab120a94c2 | 84 | #ifndef OS_STKCHECK |
mbed_official | 80:2dab120a94c2 | 85 | #define OS_STKCHECK 1 |
mbed_official | 80:2dab120a94c2 | 86 | #endif |
mbed_official | 80:2dab120a94c2 | 87 | |
mbed_official | 80:2dab120a94c2 | 88 | // <o>Processor mode for thread execution |
mbed_official | 80:2dab120a94c2 | 89 | // <0=> Unprivileged mode |
mbed_official | 80:2dab120a94c2 | 90 | // <1=> Privileged mode |
mbed_official | 80:2dab120a94c2 | 91 | // <i> Default: Privileged mode |
mbed_official | 80:2dab120a94c2 | 92 | #ifndef OS_RUNPRIV |
mbed_official | 80:2dab120a94c2 | 93 | #define OS_RUNPRIV 1 |
mbed_official | 80:2dab120a94c2 | 94 | #endif |
mbed_official | 80:2dab120a94c2 | 95 | |
mbed_official | 80:2dab120a94c2 | 96 | // </h> |
mbed_official | 80:2dab120a94c2 | 97 | // <h>SysTick Timer Configuration |
mbed_official | 80:2dab120a94c2 | 98 | // ============================== |
mbed_official | 80:2dab120a94c2 | 99 | // |
mbed_official | 80:2dab120a94c2 | 100 | // <o>Timer clock value [Hz] <1-1000000000> |
mbed_official | 80:2dab120a94c2 | 101 | // <i> Defines the timer clock value. |
mbed_official | 80:2dab120a94c2 | 102 | // <i> Default: 6000000 (6MHz) |
mbed_official | 80:2dab120a94c2 | 103 | #ifndef OS_CLOCK |
mbed_official | 80:2dab120a94c2 | 104 | # if defined(TARGET_LPC2368) |
mbed_official | 80:2dab120a94c2 | 105 | # define OS_CLOCK 96000000 |
mbed_official | 80:2dab120a94c2 | 106 | |
mbed_official | 80:2dab120a94c2 | 107 | # elif defined(TARGET_LPC2460) |
mbed_official | 80:2dab120a94c2 | 108 | # define OS_CLOCK 72000000 |
mbed_official | 80:2dab120a94c2 | 109 | |
mbed_official | 80:2dab120a94c2 | 110 | # else |
mbed_official | 80:2dab120a94c2 | 111 | # error "no target defined" |
mbed_official | 80:2dab120a94c2 | 112 | # endif |
mbed_official | 80:2dab120a94c2 | 113 | #endif |
mbed_official | 80:2dab120a94c2 | 114 | |
mbed_official | 80:2dab120a94c2 | 115 | // <o>Timer tick value [us] <1-1000000> |
mbed_official | 80:2dab120a94c2 | 116 | // <i> Defines the timer tick value. |
mbed_official | 80:2dab120a94c2 | 117 | // <i> Default: 1000 (1ms) |
mbed_official | 80:2dab120a94c2 | 118 | #ifndef OS_TICK |
mbed_official | 80:2dab120a94c2 | 119 | #define OS_TICK 1000 |
mbed_official | 80:2dab120a94c2 | 120 | #endif |
mbed_official | 80:2dab120a94c2 | 121 | |
mbed_official | 80:2dab120a94c2 | 122 | // </h> |
mbed_official | 80:2dab120a94c2 | 123 | |
mbed_official | 80:2dab120a94c2 | 124 | // <h>System Configuration |
mbed_official | 80:2dab120a94c2 | 125 | // ======================= |
mbed_official | 80:2dab120a94c2 | 126 | // |
mbed_official | 80:2dab120a94c2 | 127 | // <e>Round-Robin Thread switching |
mbed_official | 80:2dab120a94c2 | 128 | // =============================== |
mbed_official | 80:2dab120a94c2 | 129 | // |
mbed_official | 80:2dab120a94c2 | 130 | // <i> Enables Round-Robin Thread switching. |
mbed_official | 80:2dab120a94c2 | 131 | #ifndef OS_ROBIN |
mbed_official | 80:2dab120a94c2 | 132 | #define OS_ROBIN 1 |
mbed_official | 80:2dab120a94c2 | 133 | #endif |
mbed_official | 80:2dab120a94c2 | 134 | |
mbed_official | 80:2dab120a94c2 | 135 | // <o>Round-Robin Timeout [ticks] <1-1000> |
mbed_official | 80:2dab120a94c2 | 136 | // <i> Defines how long a thread will execute before a thread switch. |
mbed_official | 80:2dab120a94c2 | 137 | // <i> Default: 5 |
mbed_official | 80:2dab120a94c2 | 138 | #ifndef OS_ROBINTOUT |
mbed_official | 80:2dab120a94c2 | 139 | #define OS_ROBINTOUT 5 |
mbed_official | 80:2dab120a94c2 | 140 | #endif |
mbed_official | 80:2dab120a94c2 | 141 | |
mbed_official | 80:2dab120a94c2 | 142 | // </e> |
mbed_official | 80:2dab120a94c2 | 143 | |
mbed_official | 80:2dab120a94c2 | 144 | // <e>User Timers |
mbed_official | 80:2dab120a94c2 | 145 | // ============== |
mbed_official | 80:2dab120a94c2 | 146 | // <i> Enables user Timers |
mbed_official | 80:2dab120a94c2 | 147 | #ifndef OS_TIMERS |
mbed_official | 80:2dab120a94c2 | 148 | #define OS_TIMERS 1 |
mbed_official | 80:2dab120a94c2 | 149 | #endif |
mbed_official | 80:2dab120a94c2 | 150 | |
mbed_official | 80:2dab120a94c2 | 151 | // <o>Timer Thread Priority |
mbed_official | 80:2dab120a94c2 | 152 | // <1=> Low |
mbed_official | 80:2dab120a94c2 | 153 | // <2=> Below Normal |
mbed_official | 80:2dab120a94c2 | 154 | // <3=> Normal |
mbed_official | 80:2dab120a94c2 | 155 | // <4=> Above Normal |
mbed_official | 80:2dab120a94c2 | 156 | // <5=> High |
mbed_official | 80:2dab120a94c2 | 157 | // <6=> Realtime (highest) |
mbed_official | 80:2dab120a94c2 | 158 | // <i> Defines priority for Timer Thread |
mbed_official | 80:2dab120a94c2 | 159 | // <i> Default: High |
mbed_official | 80:2dab120a94c2 | 160 | #ifndef OS_TIMERPRIO |
mbed_official | 80:2dab120a94c2 | 161 | #define OS_TIMERPRIO 5 |
mbed_official | 80:2dab120a94c2 | 162 | #endif |
mbed_official | 80:2dab120a94c2 | 163 | |
mbed_official | 80:2dab120a94c2 | 164 | // <o>Timer Callback Queue size <1-32> |
mbed_official | 80:2dab120a94c2 | 165 | // <i> Number of concurrent active timer callback functions. |
mbed_official | 80:2dab120a94c2 | 166 | // <i> Default: 4 |
mbed_official | 80:2dab120a94c2 | 167 | #ifndef OS_TIMERCBQSZ |
mbed_official | 80:2dab120a94c2 | 168 | #define OS_TIMERCBQS 4 |
mbed_official | 80:2dab120a94c2 | 169 | #endif |
mbed_official | 80:2dab120a94c2 | 170 | |
mbed_official | 80:2dab120a94c2 | 171 | // </e> |
mbed_official | 80:2dab120a94c2 | 172 | |
mbed_official | 80:2dab120a94c2 | 173 | // <o>ISR FIFO Queue size<4=> 4 entries <8=> 8 entries |
mbed_official | 80:2dab120a94c2 | 174 | // <12=> 12 entries <16=> 16 entries |
mbed_official | 80:2dab120a94c2 | 175 | // <24=> 24 entries <32=> 32 entries |
mbed_official | 80:2dab120a94c2 | 176 | // <48=> 48 entries <64=> 64 entries |
mbed_official | 80:2dab120a94c2 | 177 | // <96=> 96 entries |
mbed_official | 80:2dab120a94c2 | 178 | // <i> ISR functions store requests to this buffer, |
mbed_official | 80:2dab120a94c2 | 179 | // <i> when they are called from the interrupt handler. |
mbed_official | 80:2dab120a94c2 | 180 | // <i> Default: 16 entries |
mbed_official | 80:2dab120a94c2 | 181 | #ifndef OS_FIFOSZ |
mbed_official | 80:2dab120a94c2 | 182 | #define OS_FIFOSZ 16 |
mbed_official | 80:2dab120a94c2 | 183 | #endif |
mbed_official | 80:2dab120a94c2 | 184 | |
mbed_official | 80:2dab120a94c2 | 185 | // </h> |
mbed_official | 80:2dab120a94c2 | 186 | |
mbed_official | 80:2dab120a94c2 | 187 | //------------- <<< end of configuration section >>> ----------------------- |
mbed_official | 80:2dab120a94c2 | 188 | |
mbed_official | 80:2dab120a94c2 | 189 | // Standard library system mutexes |
mbed_official | 80:2dab120a94c2 | 190 | // =============================== |
mbed_official | 80:2dab120a94c2 | 191 | // Define max. number system mutexes that are used to protect |
mbed_official | 80:2dab120a94c2 | 192 | // the arm standard runtime library. For microlib they are not used. |
mbed_official | 80:2dab120a94c2 | 193 | #ifndef OS_MUTEXCNT |
mbed_official | 80:2dab120a94c2 | 194 | #define OS_MUTEXCNT 12 |
mbed_official | 80:2dab120a94c2 | 195 | #endif |
mbed_official | 80:2dab120a94c2 | 196 | |
mbed_official | 80:2dab120a94c2 | 197 | /*---------------------------------------------------------------------------- |
mbed_official | 80:2dab120a94c2 | 198 | * RTX User configuration part END |
mbed_official | 80:2dab120a94c2 | 199 | *---------------------------------------------------------------------------*/ |
mbed_official | 80:2dab120a94c2 | 200 | |
mbed_official | 80:2dab120a94c2 | 201 | #define OS_TRV ((uint32_t)(((double)OS_CLOCK*(double)OS_TICK)/1E6)-1) |
mbed_official | 80:2dab120a94c2 | 202 | |
mbed_official | 80:2dab120a94c2 | 203 | |
mbed_official | 80:2dab120a94c2 | 204 | /*---------------------------------------------------------------------------- |
mbed_official | 80:2dab120a94c2 | 205 | * OS Idle daemon |
mbed_official | 80:2dab120a94c2 | 206 | *---------------------------------------------------------------------------*/ |
mbed_official | 107:bdd541595fc5 | 207 | extern void rtos_idle_loop(void); |
mbed_official | 80:2dab120a94c2 | 208 | |
mbed_official | 107:bdd541595fc5 | 209 | void os_idle_demon (void) { |
mbed_official | 107:bdd541595fc5 | 210 | /* The idle demon is a system thread, running when no other thread is */ |
mbed_official | 107:bdd541595fc5 | 211 | /* ready to run. */ |
mbed_official | 107:bdd541595fc5 | 212 | rtos_idle_loop(); |
mbed_official | 80:2dab120a94c2 | 213 | } |
mbed_official | 80:2dab120a94c2 | 214 | |
mbed_official | 80:2dab120a94c2 | 215 | /*---------------------------------------------------------------------------- |
mbed_official | 80:2dab120a94c2 | 216 | * RTX Errors |
mbed_official | 80:2dab120a94c2 | 217 | *---------------------------------------------------------------------------*/ |
mbed_official | 80:2dab120a94c2 | 218 | extern void mbed_die(void); |
mbed_official | 80:2dab120a94c2 | 219 | |
mbed_official | 80:2dab120a94c2 | 220 | void os_error (uint32_t err_code) { |
mbed_official | 80:2dab120a94c2 | 221 | /* This function is called when a runtime error is detected. Parameter */ |
mbed_official | 80:2dab120a94c2 | 222 | /* 'err_code' holds the runtime error code (defined in RTX_Conf.h). */ |
mbed_official | 80:2dab120a94c2 | 223 | mbed_die(); |
mbed_official | 80:2dab120a94c2 | 224 | } |
mbed_official | 80:2dab120a94c2 | 225 | |
mbed_official | 80:2dab120a94c2 | 226 | void sysThreadError(osStatus status) { |
mbed_official | 80:2dab120a94c2 | 227 | if (status != osOK) { |
mbed_official | 80:2dab120a94c2 | 228 | mbed_die(); |
mbed_official | 80:2dab120a94c2 | 229 | } |
mbed_official | 80:2dab120a94c2 | 230 | } |
mbed_official | 80:2dab120a94c2 | 231 | |
mbed_official | 80:2dab120a94c2 | 232 | /*---------------------------------------------------------------------------- |
mbed_official | 80:2dab120a94c2 | 233 | * RTX Configuration Functions |
mbed_official | 80:2dab120a94c2 | 234 | *---------------------------------------------------------------------------*/ |
mbed_official | 80:2dab120a94c2 | 235 | |
mbed_official | 80:2dab120a94c2 | 236 | #include "RTX_CM_lib.h" |
mbed_official | 80:2dab120a94c2 | 237 | |
mbed_official | 80:2dab120a94c2 | 238 | /*---------------------------------------------------------------------------- |
mbed_official | 80:2dab120a94c2 | 239 | * end of file |
mbed_official | 80:2dab120a94c2 | 240 | *---------------------------------------------------------------------------*/ |
mbed_official | 80:2dab120a94c2 | 241 |