Official mbed Real Time Operating System based on the RTX implementation of the CMSIS-RTOS API open standard.
Dependents: denki-yohou_b TestY201 Network-RTOS NTPClient_HelloWorld ... more
Deprecated
This is the mbed 2 rtos library. mbed OS 5 integrates the mbed library with mbed-rtos. With this, we have provided thread safety for all mbed APIs. If you'd like to learn about using mbed OS 5, please see the docs.
Diff: rtx/TARGET_CORTEX_M/cmsis_os.h
- Revision:
- 118:6635230e06ba
- Parent:
- 114:031a41d65add
- Child:
- 119:19af2d39a542
--- a/rtx/TARGET_CORTEX_M/cmsis_os.h Mon May 23 11:00:15 2016 +0100 +++ b/rtx/TARGET_CORTEX_M/cmsis_os.h Mon Jul 25 14:12:24 2016 +0100 @@ -57,9 +57,13 @@ #define CMSIS_OS_RTX // __MBED_CMSIS_RTOS_CM captures our changes to the RTX kernel +#ifndef __MBED_CMSIS_RTOS_CM #define __MBED_CMSIS_RTOS_CM +#endif // we use __CMSIS_RTOS version, which changes some API in the kernel +#ifndef __CMSIS_RTOS #define __CMSIS_RTOS +#endif // The stack space occupied is mainly dependent on the underling C standard library #if defined(TOOLCHAIN_GCC) || defined(TOOLCHAIN_ARM_STD) || defined(TOOLCHAIN_IAR) @@ -68,6 +72,24 @@ # define WORDS_STACK_SIZE 128 #endif +#ifdef __MBED_CMSIS_RTOS_CM + +/* Single thread - disable timers and set task count to one */ +#if defined(MBED_RTOS_SINGLE_THREAD) +#define OS_TASKCNT 1 +#define OS_TIMERS 0 +#endif + +/* If os timers macro is set to 0, there's no timer thread created, therefore + * main thread has tid 0x01 + */ +#if (OS_TIMERS != 0) +#define MAIN_THREAD_ID 0x02 +#else +#define MAIN_THREAD_ID 0x01 +#endif +#endif + #define DEFAULT_STACK_SIZE (WORDS_STACK_SIZE*4) #define osCMSIS 0x10002U ///< CMSIS-RTOS API version (main [31:16] .sub [15:0]) @@ -313,6 +335,8 @@ /// \return thread ID for reference by other functions or NULL in case of error. osThreadId osThreadCreate (const osThreadDef_t *thread_def, void *argument); +osThreadId osThreadContextCreate (const osThreadDef_t *thread_def, void *argument, void *context); + /// Return the thread ID of the current running thread. /// \return thread ID for reference by other functions or NULL in case of error. osThreadId osThreadGetId (void);