test

Dependencies:   F7_Ethernet mbed BSP_DISCO_F746NG SDFileSystem RF24

Committer:
lowlowry
Date:
Tue Jun 08 16:21:16 2021 +0000
Revision:
3:1c6da30ca347
Parent:
0:d984976f1f1c
test final

Who changed what in which revision?

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