Clone of mbed rtos 2 for easy accessibility.
Fork of mbed-rtos by
rtx/TARGET_CORTEX_M/RTX_Conf_CM.c@119:19af2d39a542, 2016-08-10 (annotated)
- Committer:
- Kojto
- Date:
- Wed Aug 10 16:09:20 2016 +0100
- Revision:
- 119:19af2d39a542
- Parent:
- 118:6635230e06ba
- Child:
- 120:4dc938e301cc
RTOS rev119
Compatible with the mbed library v123
Changes:
- new targets: NRF52 and NUC472
- mbed singleton mutex addition
- main thread with timers fix
- Thread - mutex addition for synchronization
- Semaphore - default count argument set to 0
- RTOSTimer - add new ctor with Callback
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 49:77c8e4604045 | 1 | /*---------------------------------------------------------------------------- |
mbed_official | 112:53ace74b190c | 2 | * CMSIS-RTOS - RTX |
mbed_official | 49:77c8e4604045 | 3 | *---------------------------------------------------------------------------- |
mbed_official | 49:77c8e4604045 | 4 | * Name: RTX_Conf_CM.C |
mbed_official | 49:77c8e4604045 | 5 | * Purpose: Configuration of CMSIS RTX Kernel for Cortex-M |
mbed_official | 112:53ace74b190c | 6 | * Rev.: V4.70.1 |
mbed_official | 49:77c8e4604045 | 7 | *---------------------------------------------------------------------------- |
mbed_official | 49:77c8e4604045 | 8 | * |
mbed_official | 112:53ace74b190c | 9 | * Copyright (c) 1999-2009 KEIL, 2009-2015 ARM Germany GmbH |
mbed_official | 49:77c8e4604045 | 10 | * All rights reserved. |
mbed_official | 49:77c8e4604045 | 11 | * Redistribution and use in source and binary forms, with or without |
mbed_official | 49:77c8e4604045 | 12 | * modification, are permitted provided that the following conditions are met: |
mbed_official | 49:77c8e4604045 | 13 | * - Redistributions of source code must retain the above copyright |
mbed_official | 49:77c8e4604045 | 14 | * notice, this list of conditions and the following disclaimer. |
mbed_official | 49:77c8e4604045 | 15 | * - Redistributions in binary form must reproduce the above copyright |
mbed_official | 49:77c8e4604045 | 16 | * notice, this list of conditions and the following disclaimer in the |
mbed_official | 49:77c8e4604045 | 17 | * documentation and/or other materials provided with the distribution. |
mbed_official | 49:77c8e4604045 | 18 | * - Neither the name of ARM nor the names of its contributors may be used |
mbed_official | 49:77c8e4604045 | 19 | * to endorse or promote products derived from this software without |
mbed_official | 49:77c8e4604045 | 20 | * specific prior written permission. |
mbed_official | 49:77c8e4604045 | 21 | * |
mbed_official | 49:77c8e4604045 | 22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
mbed_official | 49:77c8e4604045 | 23 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
mbed_official | 49:77c8e4604045 | 24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
mbed_official | 49:77c8e4604045 | 25 | * ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE |
mbed_official | 49:77c8e4604045 | 26 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
mbed_official | 49:77c8e4604045 | 27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
mbed_official | 49:77c8e4604045 | 28 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
mbed_official | 49:77c8e4604045 | 29 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
mbed_official | 49:77c8e4604045 | 30 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
mbed_official | 49:77c8e4604045 | 31 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
mbed_official | 49:77c8e4604045 | 32 | * POSSIBILITY OF SUCH DAMAGE. |
mbed_official | 49:77c8e4604045 | 33 | *---------------------------------------------------------------------------*/ |
mbed_official | 49:77c8e4604045 | 34 | |
mbed_official | 49:77c8e4604045 | 35 | #include "cmsis_os.h" |
mbed_official | 49:77c8e4604045 | 36 | |
mbed_official | 49:77c8e4604045 | 37 | |
mbed_official | 49:77c8e4604045 | 38 | /*---------------------------------------------------------------------------- |
mbed_official | 49:77c8e4604045 | 39 | * RTX User configuration part BEGIN |
mbed_official | 49:77c8e4604045 | 40 | *---------------------------------------------------------------------------*/ |
mbed_official | 49:77c8e4604045 | 41 | |
mbed_official | 49:77c8e4604045 | 42 | //-------- <<< Use Configuration Wizard in Context Menu >>> ----------------- |
mbed_official | 49:77c8e4604045 | 43 | // |
mbed_official | 49:77c8e4604045 | 44 | // <h>Thread Configuration |
mbed_official | 49:77c8e4604045 | 45 | // ======================= |
mbed_official | 49:77c8e4604045 | 46 | // |
mbed_official | 112:53ace74b190c | 47 | // <o>Number of concurrent running user threads <1-250> |
mbed_official | 112:53ace74b190c | 48 | // <i> Defines max. number of user threads that will run at the same time. |
mbed_official | 49:77c8e4604045 | 49 | // <i> Default: 6 |
mbed_official | 49:77c8e4604045 | 50 | #ifndef OS_TASKCNT |
mbed_official | 64:ab4200083b07 | 51 | # if defined(TARGET_LPC1768) || defined(TARGET_LPC2368) || defined(TARGET_LPC4088) || defined(TARGET_LPC4088_DM) || defined(TARGET_LPC4330) || defined(TARGET_LPC4337) || defined(TARGET_LPC1347) || defined(TARGET_K64F) || defined(TARGET_STM32F401RE)\ |
mbed_official | 97:6c35e082773a | 52 | || defined(TARGET_STM32F410RB) || defined(TARGET_KL46Z) || defined(TARGET_KL43Z) || defined(TARGET_STM32F407) || defined(TARGET_F407VG) || defined(TARGET_STM32F303VC) || defined(TARGET_LPC1549) || defined(TARGET_LPC11U68) \ |
Kojto | 119:19af2d39a542 | 53 | || defined(TARGET_STM32F411RE) || defined(TARGET_STM32F207ZG) || defined(TARGET_STM32F405RG) || defined(TARGET_K22F) || defined(TARGET_STM32F429ZI) || defined(TARGET_STM32F401VC) || defined(TARGET_MAX32610) || defined(TARGET_MAX32600) || defined(TARGET_TEENSY3_1) \ |
Kojto | 118:6635230e06ba | 54 | || defined(TARGET_STM32L152RE) || defined(TARGET_STM32F446RE) || defined(TARGET_STM32F446VE) || defined(TARGET_STM32F446ZE) || defined(TARGET_STM32L432KC) || defined(TARGET_STM32L476VG) || defined(TARGET_STM32L476RG) || defined(TARGET_STM32F469NI) || defined(TARGET_STM32F746NG) || defined(TARGET_STM32F746ZG) || defined(TARGET_STM32L152RC) \ |
Kojto | 119:19af2d39a542 | 55 | || defined(TARGET_EFM32GG_STK3700) || defined(TARGET_EFM32WG_STK3800) || defined(TARGET_EFM32LG_STK3600) || defined(TARGET_EFM32PG_STK3401) || defined(TARGET_STM32F767ZI) \ |
Kojto | 119:19af2d39a542 | 56 | || defined(TARGET_NUMAKER_PFM_NUC472) |
mbed_official | 49:77c8e4604045 | 57 | # define OS_TASKCNT 14 |
mbed_official | 95:12552ef4e980 | 58 | # elif defined(TARGET_LPC11U24) || defined(TARGET_STM32F303RE) || defined(TARGET_STM32F303K8) || defined(TARGET_LPC11U35_401) || defined(TARGET_LPC11U35_501) || defined(TARGET_LPCCAPPUCCINO) || defined(TARGET_LPC1114) \ |
mbed_official | 111:162b12aea5f2 | 59 | || defined(TARGET_LPC812) || defined(TARGET_KL25Z) || defined(TARGET_KL26Z) || defined(TARGET_KL27Z) || defined(TARGET_KL05Z) || defined(TARGET_STM32F100RB) || defined(TARGET_STM32F051R8) \ |
mbed_official | 59:28712e303960 | 60 | || defined(TARGET_STM32F103RB) || defined(TARGET_LPC824) || defined(TARGET_STM32F302R8) || defined(TARGET_STM32F334R8) || defined(TARGET_STM32F334C8) \ |
mbed_official | 108:ac4f3830f9ff | 61 | || defined(TARGET_STM32L031K6) || defined(TARGET_STM32L053R8) || defined(TARGET_STM32L053C8) || defined(TARGET_STM32L073RZ) || defined(TARGET_STM32F072RB) || defined(TARGET_STM32F091RC) || defined(TARGET_NZ32_SC151) \ |
Kojto | 118:6635230e06ba | 62 | || defined(TARGET_SSCI824) || defined(TARGET_STM32F030R8) || defined(TARGET_STM32F070RB) \ |
Kojto | 119:19af2d39a542 | 63 | || defined(TARGET_EFM32HG_STK3400) || defined(TARGET_MCU_NRF51822) || defined(TARGET_BEETLE) || defined(TARGET_MCU_NRF52832) |
mbed_official | 49:77c8e4604045 | 64 | # define OS_TASKCNT 6 |
mbed_official | 49:77c8e4604045 | 65 | # else |
mbed_official | 49:77c8e4604045 | 66 | # error "no target defined" |
mbed_official | 49:77c8e4604045 | 67 | # endif |
mbed_official | 49:77c8e4604045 | 68 | #endif |
mbed_official | 49:77c8e4604045 | 69 | |
mbed_official | 112:53ace74b190c | 70 | #ifdef __MBED_CMSIS_RTOS_CM |
mbed_official | 112:53ace74b190c | 71 | // <o>Idle stack size [bytes] <64-4096:8><#/4> |
mbed_official | 112:53ace74b190c | 72 | // <i> Defines default stack size for the Idle thread. |
mbed_official | 112:53ace74b190c | 73 | #ifndef OS_IDLESTKSIZE |
mbed_official | 112:53ace74b190c | 74 | #define OS_IDLESTKSIZE 128 |
mbed_official | 112:53ace74b190c | 75 | #endif |
mbed_official | 112:53ace74b190c | 76 | #else // __MBED_CMSIS_RTOS_CM |
mbed_official | 112:53ace74b190c | 77 | // <o>Default Thread stack size [bytes] <64-4096:8><#/4> |
mbed_official | 112:53ace74b190c | 78 | // <i> Defines default stack size for threads with osThreadDef stacksz = 0 |
mbed_official | 112:53ace74b190c | 79 | // <i> Default: 200 |
mbed_official | 112:53ace74b190c | 80 | #ifndef OS_STKSIZE |
mbed_official | 112:53ace74b190c | 81 | #define OS_STKSIZE 200 |
mbed_official | 112:53ace74b190c | 82 | #endif |
mbed_official | 112:53ace74b190c | 83 | #endif // __MBED_CMSIS_RTOS_CM |
mbed_official | 112:53ace74b190c | 84 | |
mbed_official | 112:53ace74b190c | 85 | // <o>Main Thread stack size [bytes] <64-32768:8><#/4> |
mbed_official | 112:53ace74b190c | 86 | #ifndef OS_MAINSTKSIZE |
mbed_official | 64:ab4200083b07 | 87 | # if defined(TARGET_LPC1768) || defined(TARGET_LPC2368) || defined(TARGET_LPC4088) || defined(TARGET_LPC4088_DM) || defined(TARGET_LPC4330) || defined(TARGET_LPC4337) || defined(TARGET_LPC1347) || defined(TARGET_K64F) || defined(TARGET_STM32F401RE)\ |
mbed_official | 97:6c35e082773a | 88 | || defined(TARGET_STM32F410RB) || defined(TARGET_KL46Z) || defined(TARGET_KL43Z) || defined(TARGET_STM32F407) || defined(TARGET_F407VG) || defined(TARGET_STM32F303VC) || defined(TARGET_LPC1549) || defined(TARGET_LPC11U68) \ |
mbed_official | 79:c586ffeebfb4 | 89 | || defined(TARGET_STM32F411RE) || defined(TARGET_STM32F405RG) || defined(TARGET_K22F) || defined(TARGET_STM32F429ZI) || defined(TARGET_STM32F401VC) || defined(TARGET_MAX32610) || defined(TARGET_MAX32600) || defined(TARGET_TEENSY3_1) \ |
Kojto | 118:6635230e06ba | 90 | || defined(TARGET_STM32L152RE) || defined(TARGET_STM32F446RE) || defined(TARGET_STM32F446VE) || defined(TARGET_STM32F446ZE) || defined(TARGET_STM32L432KC) || defined(TARGET_STM32L476VG) || defined(TARGET_STM32L476RG) || defined(TARGET_STM32F469NI) || defined(TARGET_STM32F746NG) || defined(TARGET_STM32F746ZG) || defined(TARGET_STM32L152RC) \ |
Kojto | 119:19af2d39a542 | 91 | ||defined(TARGET_EFM32GG_STK3700) || defined(TARGET_STM32F767ZI) || defined(TARGET_STM32F207ZG) \ |
Kojto | 119:19af2d39a542 | 92 | || defined(TARGET_NUMAKER_PFM_NUC472) |
mbed_official | 112:53ace74b190c | 93 | # define OS_MAINSTKSIZE 256 |
mbed_official | 49:77c8e4604045 | 94 | # elif defined(TARGET_LPC11U24) || defined(TARGET_LPC11U35_401) || defined(TARGET_LPC11U35_501) || defined(TARGET_LPCCAPPUCCINO) || defined(TARGET_LPC1114) \ |
mbed_official | 111:162b12aea5f2 | 95 | || defined(TARGET_LPC812) || defined(TARGET_KL25Z) || defined(TARGET_KL26Z) || defined(TARGET_KL27Z) || defined(TARGET_KL05Z) || defined(TARGET_STM32F100RB) || defined(TARGET_STM32F051R8) \ |
mbed_official | 104:07314541bd12 | 96 | || defined(TARGET_STM32F103RB) || defined(TARGET_LPC824) || defined(TARGET_STM32F302R8) || defined(TARGET_STM32F072RB) || defined(TARGET_STM32F091RC) || defined(TARGET_NZ32_SC151) \ |
Kojto | 118:6635230e06ba | 97 | || defined(TARGET_SSCI824) || defined(TARGET_STM32F030R8) || defined(TARGET_STM32F070RB) \ |
Kojto | 118:6635230e06ba | 98 | || defined(TARGET_EFM32WG_STK3800) || defined(TARGET_EFM32LG_STK3600) || defined(TARGET_EFM32PG_STK3401) |
mbed_official | 112:53ace74b190c | 99 | # define OS_MAINSTKSIZE 128 |
Kojto | 118:6635230e06ba | 100 | # elif defined(TARGET_STM32F334R8) || defined(TARGET_STM32F303RE) || defined(TARGET_STM32F303K8) || defined(TARGET_STM32F334C8) \ |
Kojto | 118:6635230e06ba | 101 | || defined(TARGET_STM32L031K6) || defined(TARGET_STM32L053R8) || defined(TARGET_STM32L053C8) || defined(TARGET_STM32L073RZ) \ |
Kojto | 118:6635230e06ba | 102 | || defined(TARGET_EFM32HG_STK3400) || defined(TARGET_BEETLE) |
mbed_official | 112:53ace74b190c | 103 | # define OS_MAINSTKSIZE 112 |
Kojto | 119:19af2d39a542 | 104 | # elif defined(TARGET_MCU_NRF51822) || defined(TARGET_MCU_NRF52832) |
Kojto | 118:6635230e06ba | 105 | # define OS_MAINSTKSIZE 512 |
mbed_official | 49:77c8e4604045 | 106 | # else |
mbed_official | 49:77c8e4604045 | 107 | # error "no target defined" |
mbed_official | 49:77c8e4604045 | 108 | # endif |
mbed_official | 49:77c8e4604045 | 109 | #endif |
mbed_official | 49:77c8e4604045 | 110 | |
mbed_official | 112:53ace74b190c | 111 | #ifndef __MBED_CMSIS_RTOS_CM |
mbed_official | 112:53ace74b190c | 112 | // <o>Number of threads with user-provided stack size <0-250> |
mbed_official | 112:53ace74b190c | 113 | // <i> Defines the number of threads with user-provided stack size. |
mbed_official | 112:53ace74b190c | 114 | // <i> Default: 0 |
mbed_official | 112:53ace74b190c | 115 | #ifndef OS_PRIVCNT |
mbed_official | 112:53ace74b190c | 116 | #define OS_PRIVCNT 0 |
mbed_official | 49:77c8e4604045 | 117 | #endif |
Kojto | 118:6635230e06ba | 118 | |
mbed_official | 112:53ace74b190c | 119 | // <o>Total stack size [bytes] for threads with user-provided stack size <0-1048576:8><#/4> |
mbed_official | 112:53ace74b190c | 120 | // <i> Defines the combined stack size for threads with user-provided stack size. |
mbed_official | 112:53ace74b190c | 121 | // <i> Default: 0 |
mbed_official | 112:53ace74b190c | 122 | #ifndef OS_PRIVSTKSIZE |
mbed_official | 112:53ace74b190c | 123 | #define OS_PRIVSTKSIZE 0 // this stack size value is in words |
mbed_official | 112:53ace74b190c | 124 | #endif |
mbed_official | 112:53ace74b190c | 125 | #endif // __MBED_CMSIS_RTOS_CM |
mbed_official | 49:77c8e4604045 | 126 | |
mbed_official | 112:53ace74b190c | 127 | // <q>Stack overflow checking |
mbed_official | 112:53ace74b190c | 128 | // <i> Enable stack overflow checks at thread switch. |
mbed_official | 112:53ace74b190c | 129 | // <i> Enabling this option increases slightly the execution time of a thread switch. |
mbed_official | 49:77c8e4604045 | 130 | #ifndef OS_STKCHECK |
mbed_official | 49:77c8e4604045 | 131 | #define OS_STKCHECK 1 |
mbed_official | 49:77c8e4604045 | 132 | #endif |
Kojto | 118:6635230e06ba | 133 | |
mbed_official | 112:53ace74b190c | 134 | // <q>Stack usage watermark |
mbed_official | 112:53ace74b190c | 135 | // <i> Initialize thread stack with watermark pattern for analyzing stack usage (current/maximum) in System and Thread Viewer. |
mbed_official | 112:53ace74b190c | 136 | // <i> Enabling this option increases significantly the execution time of osThreadCreate. |
mbed_official | 112:53ace74b190c | 137 | #ifndef OS_STKINIT |
mbed_official | 112:53ace74b190c | 138 | #define OS_STKINIT 0 |
mbed_official | 112:53ace74b190c | 139 | #endif |
Kojto | 118:6635230e06ba | 140 | |
Kojto | 118:6635230e06ba | 141 | // <o>Processor mode for thread execution |
Kojto | 118:6635230e06ba | 142 | // <0=> Unprivileged mode |
mbed_official | 112:53ace74b190c | 143 | // <1=> Privileged mode |
mbed_official | 112:53ace74b190c | 144 | // <i> Default: Privileged mode |
mbed_official | 49:77c8e4604045 | 145 | #ifndef OS_RUNPRIV |
mbed_official | 49:77c8e4604045 | 146 | #define OS_RUNPRIV 1 |
mbed_official | 49:77c8e4604045 | 147 | #endif |
mbed_official | 49:77c8e4604045 | 148 | |
mbed_official | 49:77c8e4604045 | 149 | // </h> |
Kojto | 118:6635230e06ba | 150 | |
mbed_official | 112:53ace74b190c | 151 | // <h>RTX Kernel Timer Tick Configuration |
mbed_official | 112:53ace74b190c | 152 | // ====================================== |
mbed_official | 112:53ace74b190c | 153 | // <q> Use Cortex-M SysTick timer as RTX Kernel Timer |
Kojto | 118:6635230e06ba | 154 | // <i> Cortex-M processors provide in most cases a SysTick timer that can be used as |
mbed_official | 112:53ace74b190c | 155 | // <i> as time-base for RTX. |
mbed_official | 112:53ace74b190c | 156 | #ifndef OS_SYSTICK |
Kojto | 118:6635230e06ba | 157 | # if defined(TARGET_MCU_NRF51822) |
Kojto | 118:6635230e06ba | 158 | # define OS_SYSTICK 0 |
Kojto | 118:6635230e06ba | 159 | # else |
Kojto | 118:6635230e06ba | 160 | # define OS_SYSTICK 1 |
Kojto | 118:6635230e06ba | 161 | # endif |
mbed_official | 112:53ace74b190c | 162 | #endif |
mbed_official | 49:77c8e4604045 | 163 | // |
mbed_official | 112:53ace74b190c | 164 | // <o>RTOS Kernel Timer input clock frequency [Hz] <1-1000000000> |
Kojto | 118:6635230e06ba | 165 | // <i> Defines the input frequency of the RTOS Kernel Timer. |
Kojto | 118:6635230e06ba | 166 | // <i> When the Cortex-M SysTick timer is used, the input clock |
mbed_official | 112:53ace74b190c | 167 | // <i> is on most systems identical with the core clock. |
mbed_official | 49:77c8e4604045 | 168 | #ifndef OS_CLOCK |
mbed_official | 102:f62a48e9da94 | 169 | # if defined(TARGET_LPC1768) || defined(TARGET_LPC2368) || defined(TARGET_TEENSY3_1) |
mbed_official | 49:77c8e4604045 | 170 | # define OS_CLOCK 96000000 |
mbed_official | 49:77c8e4604045 | 171 | |
mbed_official | 102:f62a48e9da94 | 172 | # elif defined(TARGET_LPC1347) || defined(TARGET_STM32F303VC) || defined(TARGET_LPC1549) || defined(TARGET_STM32F334R8) || defined(TARGET_STM32F334C8) || defined(TARGET_STM32F303RE) |
mbed_official | 49:77c8e4604045 | 173 | # define OS_CLOCK 72000000 |
mbed_official | 49:77c8e4604045 | 174 | |
mbed_official | 95:12552ef4e980 | 175 | # elif defined(TARGET_STM32F303K8) |
mbed_official | 95:12552ef4e980 | 176 | # define OS_CLOCK 64000000 |
mbed_official | 95:12552ef4e980 | 177 | |
mbed_official | 59:28712e303960 | 178 | # elif defined(TARGET_LPC11U24) || defined(TARGET_LPC11U35_401) || defined(TARGET_LPC11U35_501) || defined(TARGET_LPCCAPPUCCINO) || defined(TARGET_LPC1114) || defined(TARGET_KL25Z) \ |
mbed_official | 111:162b12aea5f2 | 179 | || defined(TARGET_KL26Z) || defined(TARGET_KL27Z) || defined(TARGET_KL05Z) || defined(TARGET_KL46Z) || defined(TARGET_KL43Z) || defined(TARGET_STM32F051R8) || defined(TARGET_LPC11U68) || defined(TARGET_STM32F072RB) || defined(TARGET_STM32F091RC) |
mbed_official | 49:77c8e4604045 | 180 | # define OS_CLOCK 48000000 |
mbed_official | 49:77c8e4604045 | 181 | |
mbed_official | 49:77c8e4604045 | 182 | # elif defined(TARGET_LPC812) |
mbed_official | 49:77c8e4604045 | 183 | # define OS_CLOCK 36000000 |
mbed_official | 49:77c8e4604045 | 184 | |
mbed_official | 81:e45e4ac7c3c8 | 185 | # elif defined(TARGET_LPC824) || defined(TARGET_SSCI824) |
mbed_official | 49:77c8e4604045 | 186 | # define OS_CLOCK 30000000 |
mbed_official | 49:77c8e4604045 | 187 | |
Kojto | 118:6635230e06ba | 188 | # elif defined(TARGET_STM32F100RB) || defined(TARGET_BEETLE) |
mbed_official | 49:77c8e4604045 | 189 | # define OS_CLOCK 24000000 |
mbed_official | 49:77c8e4604045 | 190 | |
Kojto | 119:19af2d39a542 | 191 | # elif defined(TARGET_LPC4088) || defined(TARGET_LPC4088_DM) || defined(TARGET_K64F) |
mbed_official | 49:77c8e4604045 | 192 | # define OS_CLOCK 120000000 |
mbed_official | 49:77c8e4604045 | 193 | |
mbed_official | 63:5448826aa700 | 194 | # elif defined(TARGET_LPC4330) |
mbed_official | 63:5448826aa700 | 195 | # define OS_CLOCK 204000000 |
mbed_official | 63:5448826aa700 | 196 | |
mbed_official | 49:77c8e4604045 | 197 | # elif defined(TARGET_LPC4337) |
mbed_official | 49:77c8e4604045 | 198 | # define OS_CLOCK 204000000 |
mbed_official | 49:77c8e4604045 | 199 | |
mbed_official | 49:77c8e4604045 | 200 | # elif defined(TARGET_STM32F407) || defined(TARGET_F407VG) |
mbed_official | 49:77c8e4604045 | 201 | # define OS_CLOCK 168000000 |
mbed_official | 49:77c8e4604045 | 202 | |
mbed_official | 49:77c8e4604045 | 203 | # elif defined(TARGET_STM32F401RE) |
mbed_official | 49:77c8e4604045 | 204 | # define OS_CLOCK 84000000 |
mbed_official | 49:77c8e4604045 | 205 | |
mbed_official | 49:77c8e4604045 | 206 | # elif defined(TARGET_STM32F411RE) |
mbed_official | 49:77c8e4604045 | 207 | # define OS_CLOCK 100000000 |
mbed_official | 49:77c8e4604045 | 208 | |
Kojto | 119:19af2d39a542 | 209 | # elif defined(TARGET_STM32F207ZG) |
Kojto | 119:19af2d39a542 | 210 | # define OS_CLOCK 120000000 |
Kojto | 119:19af2d39a542 | 211 | |
mbed_official | 97:6c35e082773a | 212 | # elif defined(TARGET_STM32F410RB) |
mbed_official | 97:6c35e082773a | 213 | # define OS_CLOCK 100000000 |
mbed_official | 97:6c35e082773a | 214 | |
mbed_official | 78:2db19f47c2ba | 215 | #elif defined(TARGET_STM32F103RB) |
mbed_official | 49:77c8e4604045 | 216 | # define OS_CLOCK 72000000 |
mbed_official | 49:77c8e4604045 | 217 | |
mbed_official | 57:430de2831ec7 | 218 | #elif defined(TARGET_STM32F429ZI) |
mbed_official | 58:13a25134ac60 | 219 | # define OS_CLOCK 168000000 |
mbed_official | 57:430de2831ec7 | 220 | |
mbed_official | 59:28712e303960 | 221 | #elif defined(TARGET_STM32F302R8) |
mbed_official | 75:557d5b275f31 | 222 | # define OS_CLOCK 72000000 |
mbed_official | 59:28712e303960 | 223 | |
mbed_official | 108:ac4f3830f9ff | 224 | #elif defined(TARGET_STM32L031K6) || defined(TARGET_STM32L053R8) || defined(TARGET_STM32L053C8) || defined(TARGET_STM32L073RZ) |
mbed_official | 59:28712e303960 | 225 | # define OS_CLOCK 32000000 |
mbed_official | 59:28712e303960 | 226 | |
mbed_official | 60:f4d3d8971bc3 | 227 | #elif defined(TARGET_STM32F401VC) |
mbed_official | 60:f4d3d8971bc3 | 228 | # define OS_CLOCK 84000000 |
mbed_official | 60:f4d3d8971bc3 | 229 | |
Kojto | 118:6635230e06ba | 230 | # elif defined(TARGET_STM32F746NG) || defined(TARGET_STM32F746ZG) || defined(TARGET_STM32F767ZI) |
mbed_official | 98:c825593ece39 | 231 | # define OS_CLOCK 216000000 |
mbed_official | 98:c825593ece39 | 232 | |
mbed_official | 73:34292fba723c | 233 | #elif defined(TARGET_MAX32610) || defined(TARGET_MAX32600) |
mbed_official | 71:570e569a5b59 | 234 | # define OS_CLOCK 24000000 |
mbed_official | 71:570e569a5b59 | 235 | |
mbed_official | 104:07314541bd12 | 236 | #elif defined(TARGET_NZ32_SC151) |
mbed_official | 78:2db19f47c2ba | 237 | # define OS_CLOCK 32000000 |
mbed_official | 78:2db19f47c2ba | 238 | |
mbed_official | 78:2db19f47c2ba | 239 | #elif defined(TARGET_STM32L152RE) |
mbed_official | 78:2db19f47c2ba | 240 | # define OS_CLOCK 24000000 |
mbed_official | 78:2db19f47c2ba | 241 | |
Kojto | 118:6635230e06ba | 242 | #elif defined(TARGET_STM32F446RE) || defined(TARGET_STM32F446ZE) || defined(TARGET_STM32F446VE) |
mbed_official | 79:c586ffeebfb4 | 243 | # define OS_CLOCK 180000000 |
mbed_official | 79:c586ffeebfb4 | 244 | |
mbed_official | 87:e695cd34556b | 245 | #elif defined(TARGET_STM32F030R8) |
mbed_official | 87:e695cd34556b | 246 | # define OS_CLOCK 48000000 |
mbed_official | 87:e695cd34556b | 247 | |
mbed_official | 87:e695cd34556b | 248 | #elif defined(TARGET_STM32F070RB) |
mbed_official | 87:e695cd34556b | 249 | # define OS_CLOCK 48000000 |
mbed_official | 79:c586ffeebfb4 | 250 | |
Kojto | 119:19af2d39a542 | 251 | #elif defined(TARGET_STM32L432KC) || defined(TARGET_STM32L476VG) || defined(TARGET_STM32L476RG) || defined(TARGET_K22F) |
mbed_official | 91:9d001ed5feec | 252 | # define OS_CLOCK 80000000 |
mbed_official | 91:9d001ed5feec | 253 | |
mbed_official | 96:6d90423c236e | 254 | #elif defined(TARGET_STM32F469NI) |
mbed_official | 96:6d90423c236e | 255 | # define OS_CLOCK 168000000 |
mbed_official | 96:6d90423c236e | 256 | |
mbed_official | 99:79d2f32f753f | 257 | #elif defined(TARGET_STM32L152RC) |
mbed_official | 99:79d2f32f753f | 258 | # define OS_CLOCK 24000000 |
mbed_official | 99:79d2f32f753f | 259 | |
Kojto | 118:6635230e06ba | 260 | #elif defined(TARGET_EFM32) |
Kojto | 118:6635230e06ba | 261 | # include "clocking.h" |
Kojto | 118:6635230e06ba | 262 | # define OS_CLOCK REFERENCE_FREQUENCY |
Kojto | 118:6635230e06ba | 263 | |
Kojto | 118:6635230e06ba | 264 | #elif defined(TARGET_MCU_NRF51822) |
Kojto | 118:6635230e06ba | 265 | # define OS_CLOCK 32768 |
Kojto | 118:6635230e06ba | 266 | |
Kojto | 119:19af2d39a542 | 267 | #elif defined(TARGET_MCU_NRF52832) |
Kojto | 119:19af2d39a542 | 268 | # define OS_CLOCK 64000000 |
Kojto | 119:19af2d39a542 | 269 | |
Kojto | 119:19af2d39a542 | 270 | #elif defined(TARGET_NUMAKER_PFM_NUC472) |
Kojto | 119:19af2d39a542 | 271 | # define OS_CLOCK 84000000 |
Kojto | 119:19af2d39a542 | 272 | |
mbed_official | 49:77c8e4604045 | 273 | # else |
mbed_official | 49:77c8e4604045 | 274 | # error "no target defined" |
mbed_official | 49:77c8e4604045 | 275 | # endif |
mbed_official | 49:77c8e4604045 | 276 | #endif |
Kojto | 118:6635230e06ba | 277 | |
mbed_official | 112:53ace74b190c | 278 | // <o>RTX Timer tick interval value [us] <1-1000000> |
mbed_official | 112:53ace74b190c | 279 | // <i> The RTX Timer tick interval value is used to calculate timeout values. |
mbed_official | 112:53ace74b190c | 280 | // <i> When the Cortex-M SysTick timer is enabled, the value also configures the SysTick timer. |
mbed_official | 49:77c8e4604045 | 281 | // <i> Default: 1000 (1ms) |
mbed_official | 49:77c8e4604045 | 282 | #ifndef OS_TICK |
mbed_official | 49:77c8e4604045 | 283 | #define OS_TICK 1000 |
mbed_official | 49:77c8e4604045 | 284 | #endif |
mbed_official | 49:77c8e4604045 | 285 | |
mbed_official | 49:77c8e4604045 | 286 | // </h> |
mbed_official | 49:77c8e4604045 | 287 | |
mbed_official | 49:77c8e4604045 | 288 | // <h>System Configuration |
mbed_official | 49:77c8e4604045 | 289 | // ======================= |
mbed_official | 49:77c8e4604045 | 290 | // |
mbed_official | 49:77c8e4604045 | 291 | // <e>Round-Robin Thread switching |
mbed_official | 49:77c8e4604045 | 292 | // =============================== |
mbed_official | 49:77c8e4604045 | 293 | // |
mbed_official | 49:77c8e4604045 | 294 | // <i> Enables Round-Robin Thread switching. |
mbed_official | 49:77c8e4604045 | 295 | #ifndef OS_ROBIN |
mbed_official | 49:77c8e4604045 | 296 | #define OS_ROBIN 1 |
mbed_official | 49:77c8e4604045 | 297 | #endif |
mbed_official | 49:77c8e4604045 | 298 | |
mbed_official | 49:77c8e4604045 | 299 | // <o>Round-Robin Timeout [ticks] <1-1000> |
mbed_official | 49:77c8e4604045 | 300 | // <i> Defines how long a thread will execute before a thread switch. |
mbed_official | 49:77c8e4604045 | 301 | // <i> Default: 5 |
mbed_official | 49:77c8e4604045 | 302 | #ifndef OS_ROBINTOUT |
mbed_official | 49:77c8e4604045 | 303 | #define OS_ROBINTOUT 5 |
mbed_official | 49:77c8e4604045 | 304 | #endif |
mbed_official | 49:77c8e4604045 | 305 | |
mbed_official | 49:77c8e4604045 | 306 | // </e> |
mbed_official | 49:77c8e4604045 | 307 | |
mbed_official | 49:77c8e4604045 | 308 | // <e>User Timers |
mbed_official | 49:77c8e4604045 | 309 | // ============== |
mbed_official | 49:77c8e4604045 | 310 | // <i> Enables user Timers |
mbed_official | 49:77c8e4604045 | 311 | #ifndef OS_TIMERS |
mbed_official | 49:77c8e4604045 | 312 | #define OS_TIMERS 1 |
mbed_official | 49:77c8e4604045 | 313 | #endif |
mbed_official | 49:77c8e4604045 | 314 | |
mbed_official | 49:77c8e4604045 | 315 | // <o>Timer Thread Priority |
mbed_official | 49:77c8e4604045 | 316 | // <1=> Low |
mbed_official | 112:53ace74b190c | 317 | // <2=> Below Normal <3=> Normal <4=> Above Normal |
mbed_official | 49:77c8e4604045 | 318 | // <5=> High |
mbed_official | 49:77c8e4604045 | 319 | // <6=> Realtime (highest) |
mbed_official | 49:77c8e4604045 | 320 | // <i> Defines priority for Timer Thread |
mbed_official | 49:77c8e4604045 | 321 | // <i> Default: High |
mbed_official | 49:77c8e4604045 | 322 | #ifndef OS_TIMERPRIO |
mbed_official | 49:77c8e4604045 | 323 | #define OS_TIMERPRIO 5 |
mbed_official | 49:77c8e4604045 | 324 | #endif |
Kojto | 118:6635230e06ba | 325 | |
mbed_official | 112:53ace74b190c | 326 | // <o>Timer Thread stack size [bytes] <64-4096:8><#/4> |
mbed_official | 112:53ace74b190c | 327 | // <i> Defines stack size for Timer thread. |
mbed_official | 112:53ace74b190c | 328 | // <i> Default: 200 |
mbed_official | 112:53ace74b190c | 329 | #ifndef OS_TIMERSTKSZ |
mbed_official | 112:53ace74b190c | 330 | #define OS_TIMERSTKSZ 200 |
mbed_official | 112:53ace74b190c | 331 | #endif |
Kojto | 118:6635230e06ba | 332 | |
mbed_official | 49:77c8e4604045 | 333 | // <o>Timer Callback Queue size <1-32> |
mbed_official | 49:77c8e4604045 | 334 | // <i> Number of concurrent active timer callback functions. |
mbed_official | 49:77c8e4604045 | 335 | // <i> Default: 4 |
mbed_official | 112:53ace74b190c | 336 | #ifndef OS_TIMERCBQS |
mbed_official | 49:77c8e4604045 | 337 | #define OS_TIMERCBQS 4 |
mbed_official | 49:77c8e4604045 | 338 | #endif |
mbed_official | 49:77c8e4604045 | 339 | |
mbed_official | 49:77c8e4604045 | 340 | // </e> |
mbed_official | 49:77c8e4604045 | 341 | |
mbed_official | 49:77c8e4604045 | 342 | // <o>ISR FIFO Queue size<4=> 4 entries <8=> 8 entries |
mbed_official | 49:77c8e4604045 | 343 | // <12=> 12 entries <16=> 16 entries |
mbed_official | 49:77c8e4604045 | 344 | // <24=> 24 entries <32=> 32 entries |
mbed_official | 49:77c8e4604045 | 345 | // <48=> 48 entries <64=> 64 entries |
mbed_official | 49:77c8e4604045 | 346 | // <96=> 96 entries |
mbed_official | 49:77c8e4604045 | 347 | // <i> ISR functions store requests to this buffer, |
mbed_official | 49:77c8e4604045 | 348 | // <i> when they are called from the interrupt handler. |
mbed_official | 49:77c8e4604045 | 349 | // <i> Default: 16 entries |
mbed_official | 49:77c8e4604045 | 350 | #ifndef OS_FIFOSZ |
mbed_official | 49:77c8e4604045 | 351 | #define OS_FIFOSZ 16 |
mbed_official | 49:77c8e4604045 | 352 | #endif |
mbed_official | 49:77c8e4604045 | 353 | |
mbed_official | 49:77c8e4604045 | 354 | // </h> |
mbed_official | 49:77c8e4604045 | 355 | |
mbed_official | 49:77c8e4604045 | 356 | //------------- <<< end of configuration section >>> ----------------------- |
mbed_official | 49:77c8e4604045 | 357 | |
mbed_official | 49:77c8e4604045 | 358 | // Standard library system mutexes |
mbed_official | 49:77c8e4604045 | 359 | // =============================== |
mbed_official | 49:77c8e4604045 | 360 | // Define max. number system mutexes that are used to protect |
mbed_official | 49:77c8e4604045 | 361 | // the arm standard runtime library. For microlib they are not used. |
mbed_official | 49:77c8e4604045 | 362 | #ifndef OS_MUTEXCNT |
mbed_official | 49:77c8e4604045 | 363 | #define OS_MUTEXCNT 12 |
mbed_official | 49:77c8e4604045 | 364 | #endif |
mbed_official | 49:77c8e4604045 | 365 | |
mbed_official | 49:77c8e4604045 | 366 | /*---------------------------------------------------------------------------- |
mbed_official | 49:77c8e4604045 | 367 | * RTX User configuration part END |
mbed_official | 49:77c8e4604045 | 368 | *---------------------------------------------------------------------------*/ |
mbed_official | 49:77c8e4604045 | 369 | |
mbed_official | 49:77c8e4604045 | 370 | #define OS_TRV ((uint32_t)(((double)OS_CLOCK*(double)OS_TICK)/1E6)-1) |
mbed_official | 49:77c8e4604045 | 371 | |
mbed_official | 49:77c8e4604045 | 372 | |
mbed_official | 49:77c8e4604045 | 373 | /*---------------------------------------------------------------------------- |
mbed_official | 49:77c8e4604045 | 374 | * OS Idle daemon |
mbed_official | 49:77c8e4604045 | 375 | *---------------------------------------------------------------------------*/ |
mbed_official | 107:bdd541595fc5 | 376 | extern void rtos_idle_loop(void); |
mbed_official | 49:77c8e4604045 | 377 | |
mbed_official | 107:bdd541595fc5 | 378 | void os_idle_demon (void) { |
mbed_official | 107:bdd541595fc5 | 379 | /* The idle demon is a system thread, running when no other thread is */ |
mbed_official | 107:bdd541595fc5 | 380 | /* ready to run. */ |
mbed_official | 107:bdd541595fc5 | 381 | rtos_idle_loop(); |
mbed_official | 49:77c8e4604045 | 382 | } |
mbed_official | 49:77c8e4604045 | 383 | |
mbed_official | 49:77c8e4604045 | 384 | /*---------------------------------------------------------------------------- |
mbed_official | 49:77c8e4604045 | 385 | * RTX Errors |
mbed_official | 49:77c8e4604045 | 386 | *---------------------------------------------------------------------------*/ |
mbed_official | 112:53ace74b190c | 387 | extern void error(const char* format, ...); |
mbed_official | 112:53ace74b190c | 388 | extern osThreadId svcThreadGetId (void); |
mbed_official | 112:53ace74b190c | 389 | |
mbed_official | 49:77c8e4604045 | 390 | void os_error (uint32_t err_code) { |
mbed_official | 49:77c8e4604045 | 391 | /* This function is called when a runtime error is detected. Parameter */ |
mbed_official | 112:53ace74b190c | 392 | /* 'err_code' holds the runtime error code (defined in RTX_Config.h). */ |
mbed_official | 112:53ace74b190c | 393 | osThreadId err_task = svcThreadGetId(); |
mbed_official | 113:d9366c711a75 | 394 | error("RTX error code: 0x%08X, task ID: 0x%08X\n", err_code, err_task); |
mbed_official | 49:77c8e4604045 | 395 | } |
mbed_official | 49:77c8e4604045 | 396 | |
mbed_official | 49:77c8e4604045 | 397 | void sysThreadError(osStatus status) { |
mbed_official | 49:77c8e4604045 | 398 | if (status != osOK) { |
mbed_official | 113:d9366c711a75 | 399 | osThreadId err_task = svcThreadGetId(); |
mbed_official | 113:d9366c711a75 | 400 | error("CMSIS-RTOS error status: 0x%08X, task ID: 0x%08X\n", status, err_task); |
mbed_official | 49:77c8e4604045 | 401 | } |
mbed_official | 49:77c8e4604045 | 402 | } |
mbed_official | 49:77c8e4604045 | 403 | |
mbed_official | 49:77c8e4604045 | 404 | /*---------------------------------------------------------------------------- |
mbed_official | 49:77c8e4604045 | 405 | * RTX Configuration Functions |
mbed_official | 49:77c8e4604045 | 406 | *---------------------------------------------------------------------------*/ |
mbed_official | 49:77c8e4604045 | 407 | |
mbed_official | 49:77c8e4604045 | 408 | #include "RTX_CM_lib.h" |
mbed_official | 49:77c8e4604045 | 409 | |
mbed_official | 49:77c8e4604045 | 410 | /*---------------------------------------------------------------------------- |
mbed_official | 49:77c8e4604045 | 411 | * end of file |
mbed_official | 49:77c8e4604045 | 412 | *---------------------------------------------------------------------------*/ |