proj raimes sinal acqusition for biomedical signals

Fork of mbed-rtos by mbed official

Committer:
emilmont
Date:
Fri Nov 23 09:57:31 2012 +0000
Revision:
6:350b53afb889
Child:
9:53e6cccd8782
Merge RTOS C++ API and RTX under the same library; Update RTX to version 4.60; Add proper Thread destructor;

Who changed what in which revision?

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