SuperTinyKernel™ RTOS 1.08.x
Lightweight, high-performance, deterministic, bare-metal C++ RTOS for resource-constrained embedded systems. MIT Open Source License.
Loading...
Searching...
No Matches
cmsis_os2_stk.cpp File Reference
#include "stk.h"
#include "sync/stk_sync.h"
#include "time/stk_time.h"
#include "memory/stk_memory.h"
#include "cmsis_os2.h"
Include dependency graph for cmsis_os2_stk.cpp:

Go to the source code of this file.

Classes

class  StkThread
struct  StkMutexBase
struct  StkMutex
struct  StkFastMutex
struct  StkSemaphore
struct  StkEventFlags
class  StkTimer
class  StkMemPool
class  StkMessageQueue

Macros

#define STK_WRAPPER_API_VERSION   20030000UL
#define STK_WRAPPER_KERNEL_VERSION   20030000UL
#define STK_WRAPPER_KERNEL_ID   "STK RTOS2 Wrapper v1.1"
#define CMSIS_STK_MAX_THREADS   (16U)
#define CMSIS_STK_DEFAULT_STACK_WORDS   (256U)
#define CMSIS_STK_MIN_STACK_WORDS   (STK_STACK_SIZE_MIN)
#define STK_CMSIS_USE_FAST_MUTEX   1

Typedefs

using StkKernel

Functions

template<typename T>
static constexpr size_t StkGetWordCountForType ()
static size_t CmsisStrlen (const char str[])
void * malloc (size_t size)
void free (void *ptr)
static __stk_forceinline int32_t CmsisPrioToStk (osPriority_t p)
static __stk_forceinline osPriority_t StkPrioToCmsis (int32_t p)
static __stk_forceinline stk::Timeout CmsisTimeoutToStk (uint32_t ticks)
static __stk_forceinline osStatus_t StkWaitFailToCmsis (stk::Timeout timeout)
static __stk_forceinline osStatus_t StkWaitResultToCmsis (stk::EWaitResult wr, stk::Timeout timeout)
static __stk_forceinline bool IsIrqContext ()
template<typename T, typename... Args>
static T * PlacementNewOrHeap (void *mem, size_t size, const Args &... args)
template<typename T>
static void ObjDestroy (T *obj)
static void StkReapZombieThreads ()
static __stk_forceinline uint32_t CmsisFlagsOptionsToStk (uint32_t options)
static __stk_forceinline uint32_t StkFlagsResultToCmsis (uint32_t result)
osStatus_t osKernelInitialize (void)
osStatus_t osKernelGetInfo (osVersion_t *version, char *id_buf, uint32_t id_size)
osKernelState_t osKernelGetState (void)
osStatus_t osKernelStart (void)
int32_t osKernelLock (void)
int32_t osKernelUnlock (void)
int32_t osKernelRestoreLock (int32_t lock)
uint32_t osKernelSuspend (void)
void osKernelResume (uint32_t sleep_ticks)
uint32_t osKernelGetTickCount (void)
uint32_t osKernelGetTickFreq (void)
uint32_t osKernelGetSysTimerCount (void)
uint64_t osKernelGetSysTimerCount64 (void)
uint32_t osKernelGetSysTimerFreq (void)
osThreadId_t osThreadNew (osThreadFunc_t func, void *argument, const osThreadAttr_t *attr)
const char * osThreadGetName (osThreadId_t thread_id)
osThreadId_t osThreadGetId (void)
osThreadState_t osThreadGetState (osThreadId_t thread_id)
uint32_t osThreadGetStackSize (osThreadId_t thread_id)
uint32_t osThreadGetStackSpace (osThreadId_t thread_id)
osStatus_t osThreadSetPriority (osThreadId_t thread_id, osPriority_t priority)
osPriority_t osThreadGetPriority (osThreadId_t thread_id)
osStatus_t osThreadYield (void)
osStatus_t osThreadSuspend (osThreadId_t thread_id)
osStatus_t osThreadResume (osThreadId_t thread_id)
osStatus_t osThreadDetach (osThreadId_t thread_id)
osStatus_t osThreadJoin (osThreadId_t thread_id)
void osThreadExit (void)
 Terminate execution of current running thread.
osStatus_t osThreadTerminate (osThreadId_t thread_id)
uint32_t osThreadGetCount (void)
uint32_t osThreadEnumerate (osThreadId_t *thread_array, uint32_t array_items)
uint32_t osThreadFlagsSet (osThreadId_t thread_id, uint32_t flags)
uint32_t osThreadFlagsClear (uint32_t flags)
uint32_t osThreadFlagsGet (void)
uint32_t osThreadFlagsWait (uint32_t flags, uint32_t options, uint32_t timeout)
osStatus_t osDelay (uint32_t ticks)
osStatus_t osDelayUntil (uint32_t ticks)
osTimerId_t osTimerNew (osTimerFunc_t func, osTimerType_t type, void *argument, const osTimerAttr_t *attr)
const char * osTimerGetName (osTimerId_t timer_id)
osStatus_t osTimerStart (osTimerId_t timer_id, uint32_t ticks)
osStatus_t osTimerStop (osTimerId_t timer_id)
uint32_t osTimerIsRunning (osTimerId_t timer_id)
osStatus_t osTimerDelete (osTimerId_t timer_id)
osEventFlagsId_t osEventFlagsNew (const osEventFlagsAttr_t *attr)
const char * osEventFlagsGetName (osEventFlagsId_t ef_id)
uint32_t osEventFlagsSet (osEventFlagsId_t ef_id, uint32_t flags)
uint32_t osEventFlagsClear (osEventFlagsId_t ef_id, uint32_t flags)
uint32_t osEventFlagsGet (osEventFlagsId_t ef_id)
uint32_t osEventFlagsWait (osEventFlagsId_t ef_id, uint32_t flags, uint32_t options, uint32_t timeout)
osStatus_t osEventFlagsDelete (osEventFlagsId_t ef_id)
osMutexId_t osMutexNew (const osMutexAttr_t *attr)
const char * osMutexGetName (osMutexId_t mutex_id)
osStatus_t osMutexAcquire (osMutexId_t mutex_id, uint32_t timeout)
osStatus_t osMutexRelease (osMutexId_t mutex_id)
osThreadId_t osMutexGetOwner (osMutexId_t mutex_id)
osStatus_t osMutexDelete (osMutexId_t mutex_id)
osSemaphoreId_t osSemaphoreNew (uint32_t max_count, uint32_t initial_count, const osSemaphoreAttr_t *attr)
const char * osSemaphoreGetName (osSemaphoreId_t semaphore_id)
osStatus_t osSemaphoreAcquire (osSemaphoreId_t semaphore_id, uint32_t timeout)
osStatus_t osSemaphoreRelease (osSemaphoreId_t semaphore_id)
uint32_t osSemaphoreGetCount (osSemaphoreId_t semaphore_id)
osStatus_t osSemaphoreDelete (osSemaphoreId_t semaphore_id)
osMemoryPoolId_t osMemoryPoolNew (uint32_t block_count, uint32_t block_size, const osMemoryPoolAttr_t *attr)
const char * osMemoryPoolGetName (osMemoryPoolId_t mp_id)
void * osMemoryPoolAlloc (osMemoryPoolId_t mp_id, uint32_t timeout)
osStatus_t osMemoryPoolFree (osMemoryPoolId_t mp_id, void *block)
uint32_t osMemoryPoolGetCapacity (osMemoryPoolId_t mp_id)
uint32_t osMemoryPoolGetBlockSize (osMemoryPoolId_t mp_id)
uint32_t osMemoryPoolGetCount (osMemoryPoolId_t mp_id)
uint32_t osMemoryPoolGetSpace (osMemoryPoolId_t mp_id)
osStatus_t osMemoryPoolDelete (osMemoryPoolId_t mp_id)
osMessageQueueId_t osMessageQueueNew (uint32_t msg_count, uint32_t msg_size, const osMessageQueueAttr_t *attr)
const char * osMessageQueueGetName (osMessageQueueId_t mq_id)
osStatus_t osMessageQueuePut (osMessageQueueId_t mq_id, const void *msg_ptr, uint8_t, uint32_t timeout)
osStatus_t osMessageQueueGet (osMessageQueueId_t mq_id, void *msg_ptr, uint8_t *msg_prio, uint32_t timeout)
uint32_t osMessageQueueGetCapacity (osMessageQueueId_t mq_id)
uint32_t osMessageQueueGetMsgSize (osMessageQueueId_t mq_id)
uint32_t osMessageQueueGetCount (osMessageQueueId_t mq_id)
uint32_t osMessageQueueGetSpace (osMessageQueueId_t mq_id)
osStatus_t osMessageQueueReset (osMessageQueueId_t mq_id)
osStatus_t osMessageQueueDelete (osMessageQueueId_t mq_id)

Variables

static StkKernel g_StkKernel
static uint32_t g_StkKernelLocked = 0U
static StkThread * g_ZombieThreads = nullptr
static stk::time::TimerHost * g_TimerHost = nullptr
static stk::Word g_TimerHostBuf [StkGetWordCountForType< stk::time::TimerHost >()]

Macro Definition Documentation

◆ CMSIS_STK_DEFAULT_STACK_WORDS

#define CMSIS_STK_DEFAULT_STACK_WORDS   (256U)

Definition at line 39 of file cmsis_os2_stk.cpp.

Referenced by osThreadNew().

◆ CMSIS_STK_MAX_THREADS

#define CMSIS_STK_MAX_THREADS   (16U)

Definition at line 34 of file cmsis_os2_stk.cpp.

◆ CMSIS_STK_MIN_STACK_WORDS

#define CMSIS_STK_MIN_STACK_WORDS   (STK_STACK_SIZE_MIN)

Definition at line 43 of file cmsis_os2_stk.cpp.

Referenced by osThreadNew().

◆ STK_CMSIS_USE_FAST_MUTEX

#define STK_CMSIS_USE_FAST_MUTEX   1

Definition at line 327 of file cmsis_os2_stk.cpp.

Referenced by osMutexNew().

◆ STK_WRAPPER_API_VERSION

#define STK_WRAPPER_API_VERSION   20030000UL

Definition at line 23 of file cmsis_os2_stk.cpp.

Referenced by osKernelGetInfo().

◆ STK_WRAPPER_KERNEL_ID

#define STK_WRAPPER_KERNEL_ID   "STK RTOS2 Wrapper v1.1"

Definition at line 25 of file cmsis_os2_stk.cpp.

Referenced by osKernelGetInfo().

◆ STK_WRAPPER_KERNEL_VERSION

#define STK_WRAPPER_KERNEL_VERSION   20030000UL

Definition at line 24 of file cmsis_os2_stk.cpp.

Referenced by osKernelGetInfo().

Typedef Documentation

◆ StkKernel

using StkKernel
Initial value:
SwitchStrategyFixedPriority< 32 > SwitchStrategyFP32
Shorthand alias for SwitchStrategyFixedPriority<32>: 32 priority levels (0..31), using a single 32-bi...
PlatformArmCortexM PlatformDefault
Default platform implementation.
@ KERNEL_TICKLESS
Tickless mode. To use this mode STK_TICKLESS_IDLE must be defined to 1 in stk_config....
Definition stk_common.h:51
@ KERNEL_SYNC
Synchronization support (see Event).
Definition stk_common.h:50
@ KERNEL_DYNAMIC
Tasks can be added or removed and therefore exit when done.
Definition stk_common.h:48
Concrete implementation of IKernel.
Definition stk.h:97

Definition at line 193 of file cmsis_os2_stk.cpp.

Function Documentation

◆ CmsisFlagsOptionsToStk()

__stk_forceinline uint32_t CmsisFlagsOptionsToStk ( uint32_t options)
static

Definition at line 649 of file cmsis_os2_stk.cpp.

650{
651 uint32_t stk_opts = stk::sync::EventFlags::OPT_WAIT_ANY; // default
652
653 if ((options & osFlagsWaitAll) != 0U)
654 {
656 }
657
658 if ((options & osFlagsNoClear) != 0U)
659 {
661 }
662
663 return stk_opts;
664}
#define osFlagsWaitAll
Wait for all flags.
Definition cmsis_os2.h:250
#define osFlagsNoClear
Do not clear flags which have been specified to wait for.
Definition cmsis_os2.h:251
static const uint32_t OPT_NO_CLEAR
Do not clear matched flags after a successful wait.
static const uint32_t OPT_WAIT_ALL
Wait for ALL of the specified flags to be set simultaneously (AND semantics).
static const uint32_t OPT_WAIT_ANY
Wait for ANY of the specified flags to be set (OR semantics, default).

References __stk_forceinline, stk::sync::EventFlags::OPT_NO_CLEAR, stk::sync::EventFlags::OPT_WAIT_ALL, stk::sync::EventFlags::OPT_WAIT_ANY, osFlagsNoClear, and osFlagsWaitAll.

Referenced by osEventFlagsWait(), and osThreadFlagsWait().

Here is the caller graph for this function:

◆ CmsisPrioToStk()

__stk_forceinline int32_t CmsisPrioToStk ( osPriority_t p)
static

Definition at line 77 of file cmsis_os2_stk.cpp.

78{
79 int32_t result;
80
81 if (p <= osPriorityIdle)
82 {
83 result = 0;
84 }
85 else if (p >= osPriorityISR)
86 {
87 result = 31;
88 }
89 else
90 {
91 result = ((static_cast<int32_t>(p) * 31) / 56);
92 }
93
94 return result;
95}
@ osPriorityISR
Reserved for ISR deferred thread.
Definition cmsis_os2.h:228
@ osPriorityIdle
Reserved for Idle thread.
Definition cmsis_os2.h:179

References __stk_forceinline, osPriorityIdle, and osPriorityISR.

Referenced by osThreadNew(), osThreadSetPriority(), and StkThread::StkThread().

Here is the caller graph for this function:

◆ CmsisStrlen()

size_t CmsisStrlen ( const char str[])
static

Definition at line 52 of file cmsis_os2_stk.cpp.

53{
54 size_t total_len = 0U;
55
56 while (str[total_len] != '\0')
57 {
58 total_len++;
59 }
60
61 return total_len;
62}

Referenced by osKernelGetInfo().

Here is the caller graph for this function:

◆ CmsisTimeoutToStk()

__stk_forceinline stk::Timeout CmsisTimeoutToStk ( uint32_t ticks)
static

Definition at line 120 of file cmsis_os2_stk.cpp.

121{
122 stk::Timeout result;
123
124 if (ticks > static_cast<uint32_t>(stk::WAIT_INFINITE))
125 {
126 result = stk::WAIT_INFINITE;
127 }
128 else if (ticks == 0U)
129 {
130 result = stk::NO_WAIT;
131 }
132 else
133 {
134 // CMSIS ticks are kernel ticks – pass through directly as STK ticks
135 result = static_cast<stk::Timeout>(ticks);
136 }
137
138 return result;
139}
static constexpr Timeout NO_WAIT
Timeout value: return immediately if the synchronization object is not yet signaled (non-blocking pol...
Definition stk_common.h:220
int32_t Timeout
Timeout time (ticks).
Definition stk_common.h:156
static constexpr Timeout WAIT_INFINITE
Timeout value: block indefinitely until the synchronization object is signaled.
Definition stk_common.h:214

References __stk_forceinline, stk::NO_WAIT, and stk::WAIT_INFINITE.

Referenced by osDelay(), osEventFlagsWait(), osMemoryPoolAlloc(), osMessageQueueGet(), osMessageQueuePut(), osMutexAcquire(), osSemaphoreAcquire(), and osThreadFlagsWait().

Here is the caller graph for this function:

◆ free()

void free ( void * ptr)

◆ IsIrqContext()

__stk_forceinline bool IsIrqContext ( )
static

Definition at line 185 of file cmsis_os2_stk.cpp.

186{
187 return stk::hw::IsInsideISR();
188}
bool IsInsideISR()
Check whether the CPU is currently executing inside a hardware interrupt service routine (ISR).

References __stk_forceinline, and stk::hw::IsInsideISR().

Referenced by osDelay(), osDelayUntil(), osEventFlagsDelete(), osEventFlagsNew(), osKernelInitialize(), osKernelLock(), osKernelRestoreLock(), osKernelStart(), osKernelUnlock(), osMemoryPoolAlloc(), osMemoryPoolDelete(), osMemoryPoolNew(), osMessageQueueDelete(), osMessageQueueGet(), osMessageQueueNew(), osMessageQueuePut(), osMessageQueueReset(), osMutexAcquire(), osMutexDelete(), osMutexNew(), osMutexRelease(), osSemaphoreAcquire(), osSemaphoreDelete(), osSemaphoreNew(), osThreadDetach(), osThreadEnumerate(), osThreadFlagsWait(), osThreadGetCount(), osThreadGetId(), osThreadGetPriority(), osThreadGetState(), osThreadJoin(), osThreadNew(), osThreadResume(), osThreadSetPriority(), osThreadSuspend(), osThreadTerminate(), osThreadYield(), osTimerDelete(), osTimerNew(), osTimerStart(), osTimerStop(), ulTaskNotifyTakeIndexed(), vTaskDelay(), xEventGroupCreate(), xEventGroupCreateStatic(), xEventGroupSync(), xEventGroupWaitBits(), xMessageBufferReceive(), xQueueCreate(), xQueueCreateSet(), xQueueCreateStatic(), xQueuePeek(), xQueueReceive(), xQueueSelectFromSet(), xQueueSend(), xQueueSendToFront(), xSemaphoreTake(), xStreamBufferReceive(), xTaskDelayUntil(), xTaskGetCurrentTaskHandle(), xTaskNotifyWaitIndexed(), xTimerCreate(), xTimerCreateStatic(), xTimerPendFunctionCall(), xTimerStart(), and xTimerStop().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ malloc()

void * malloc ( size_t size)

◆ ObjDestroy()

template<typename T>
void ObjDestroy ( T * obj)
static

Definition at line 616 of file cmsis_os2_stk.cpp.

617{
618 if (obj->m_cb_owned)
619 {
620 delete obj;
621 }
622 else
623 {
624 obj->~T();
625 }
626}

Referenced by osEventFlagsDelete(), osMemoryPoolDelete(), osMemoryPoolNew(), osMessageQueueDelete(), osMessageQueueNew(), osMutexDelete(), osSemaphoreDelete(), osThreadDetach(), osThreadJoin(), osThreadNew(), osTimerDelete(), and StkReapZombieThreads().

Here is the caller graph for this function:

◆ PlacementNewOrHeap()

template<typename T, typename... Args>
T * PlacementNewOrHeap ( void * mem,
size_t size,
const Args &... args )
static

Definition at line 593 of file cmsis_os2_stk.cpp.

594{
595 T *obj;
596
597 if ((mem != nullptr) && (size >= sizeof(T)))
598 {
599 obj = new (mem) T(args...);
600 obj->m_cb_owned = false;
601 }
602 else
603 {
604 obj = new (std::nothrow) T(args...);
605 // m_cb_owned is already true from the constructor default
606 STK_ASSERT(obj != nullptr);
607 }
608
609 return obj;
610}
#define STK_ASSERT(e)
Runtime assertion. Halts execution if the expression e evaluates to false.
Definition stk_defs.h:516

References STK_ASSERT.

Referenced by osEventFlagsNew(), osMemoryPoolNew(), osMessageQueueNew(), osMutexNew(), osSemaphoreNew(), osThreadNew(), and osTimerNew().

Here is the caller graph for this function:

◆ StkFlagsResultToCmsis()

__stk_forceinline uint32_t StkFlagsResultToCmsis ( uint32_t result)
static

Definition at line 667 of file cmsis_os2_stk.cpp.

668{
669 uint32_t cmsis_result;
670
672 {
673 cmsis_result = result;
674 }
675 else if (result == stk::sync::EventFlags::ERROR_TIMEOUT)
676 {
677 cmsis_result = osFlagsErrorTimeout;
678 }
680 {
681 cmsis_result = osFlagsErrorParameter;
682 }
683 else if (result == stk::sync::EventFlags::ERROR_ISR)
684 {
685 cmsis_result = osFlagsErrorISR;
686 }
687 else if ((result == stk::sync::EventFlags::ERROR_CANCELED) ||
689 {
690 // CMSIS has no "canceled" flags status: report cancellation and a kernel-rejected wait explicitly
691 cmsis_result = osFlagsErrorUnknown;
692 }
693 else
694 {
695 cmsis_result = osFlagsErrorUnknown;
696 }
697
698 return cmsis_result;
699}
#define osFlagsErrorTimeout
osErrorTimeout (-2).
Definition cmsis_os2.h:256
#define osFlagsErrorUnknown
osError (-1).
Definition cmsis_os2.h:255
#define osFlagsErrorParameter
osErrorParameter (-4).
Definition cmsis_os2.h:258
#define osFlagsErrorISR
osErrorISR (-6).
Definition cmsis_os2.h:259
static const uint32_t ERROR_CANCELED
Return sentinel: the wait was cancelled via IKernel::CancelTaskWait() before the flag condition was m...
static const uint32_t ERROR_ISR
Return sentinel: called from an ISR with a blocking timeout.
static const uint32_t ERROR_FAIL
Return sentinel: the kernel rejected the wait (IKernelService::Wait() returned WAIT_RESULT_FAIL,...
static const uint32_t ERROR_TIMEOUT
Return sentinel: wait timed out before the flags condition was met.
static bool IsError(uint32_t result)
Checks if a return value from Set(), Clear(), or Wait() is an error.
static const uint32_t ERROR_PARAMETER
Return sentinel: invalid flags argument (bit 31 set).

References __stk_forceinline, stk::sync::EventFlags::ERROR_CANCELED, stk::sync::EventFlags::ERROR_FAIL, stk::sync::EventFlags::ERROR_ISR, stk::sync::EventFlags::ERROR_PARAMETER, stk::sync::EventFlags::ERROR_TIMEOUT, stk::sync::EventFlags::IsError(), osFlagsErrorISR, osFlagsErrorParameter, osFlagsErrorTimeout, and osFlagsErrorUnknown.

Referenced by osEventFlagsClear(), osEventFlagsSet(), osEventFlagsWait(), osThreadFlagsClear(), osThreadFlagsSet(), and osThreadFlagsWait().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ StkGetWordCountForType()

template<typename T>
constexpr size_t StkGetWordCountForType ( )
staticconstexpr

Definition at line 46 of file cmsis_os2_stk.cpp.

47{
48 return ((sizeof(T) + sizeof(stk::Word) - 1U) / sizeof(stk::Word));
49}
uintptr_t Word
Native processor word type.
Definition stk_common.h:146

◆ StkPrioToCmsis()

__stk_forceinline osPriority_t StkPrioToCmsis ( int32_t p)
static

Definition at line 96 of file cmsis_os2_stk.cpp.

97{
98 // Inverse: cmsis_prio = (stk_prio * 56) / 31
99 int32_t r = (p * 56) / 31;
100 if (r < static_cast<int32_t>(osPriorityIdle))
101 {
102 r = static_cast<int32_t>(osPriorityIdle);
103 }
104
105 if (r > static_cast<int32_t>(osPriorityISR))
106 {
107 r = static_cast<int32_t>(osPriorityISR);
108 }
109
110 return static_cast<osPriority_t>(r);
111}
osPriority_t
Priority values.
Definition cmsis_os2.h:177

References __stk_forceinline, osPriorityIdle, and osPriorityISR.

Referenced by osThreadGetPriority().

Here is the caller graph for this function:

◆ StkReapZombieThreads()

void StkReapZombieThreads ( )
static

Definition at line 629 of file cmsis_os2_stk.cpp.

630{
631 StkThread *list;
632
633 {
635
636 list = g_ZombieThreads;
637 g_ZombieThreads = nullptr;
638 }
639
640 while (list != nullptr)
641 {
642 StkThread *const next = static_cast<StkThread *>(list->m_argument);
643 ObjDestroy(list);
644 list = next;
645 }
646}
static StkThread * g_ZombieThreads
static void ObjDestroy(T *obj)
RAII-style low-level synchronization primitive for atomic code execution. Used as building brick for ...
Definition stk_sync_cs.h:54
void * m_argument

References g_ZombieThreads, StkThread::m_argument, and ObjDestroy().

Referenced by osThreadEnumerate(), osThreadGetCount(), osThreadNew(), and osThreadTerminate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ StkWaitFailToCmsis()

__stk_forceinline osStatus_t StkWaitFailToCmsis ( stk::Timeout timeout)
static

Definition at line 145 of file cmsis_os2_stk.cpp.

146{
147 return ((timeout == stk::NO_WAIT) ? osErrorResource : osErrorTimeout);
148}
@ osErrorResource
Resource not available.
Definition cmsis_os2.h:301
@ osErrorTimeout
Operation not completed within the timeout period.
Definition cmsis_os2.h:300

References __stk_forceinline, stk::NO_WAIT, osErrorResource, and osErrorTimeout.

Referenced by StkWaitResultToCmsis().

Here is the caller graph for this function:

◆ StkWaitResultToCmsis()

__stk_forceinline osStatus_t StkWaitResultToCmsis ( stk::EWaitResult wr,
stk::Timeout timeout )
static

Definition at line 158 of file cmsis_os2_stk.cpp.

159{
160 osStatus_t result;
161
162 switch (wr)
163 {
165 result = osOK;
166 break;
167
169 result = StkWaitFailToCmsis(timeout);
170 break;
171
174 default:
175 result = osError;
176 break;
177 }
178
179 return result;
180}
static __stk_forceinline osStatus_t StkWaitFailToCmsis(stk::Timeout timeout)
osStatus_t
Status code values returned by CMSIS-RTOS functions.
Definition cmsis_os2.h:297
@ osOK
Operation completed successfully.
Definition cmsis_os2.h:298
@ osError
Unspecified RTOS error: run-time error but no other error message fits.
Definition cmsis_os2.h:299
@ WAIT_RESULT_FAIL
IKernelService::Wait returned with error without waiting.
Definition stk_common.h:124
@ WAIT_RESULT_CANCELED
The wait was cancelled by another task via IKernel::CancelTaskWait(), independent of signal/timeout.
Definition stk_common.h:127
@ WAIT_RESULT_TIMEOUT
The wake was caused by a timeout expiry.
Definition stk_common.h:126
@ WAIT_RESULT_SIGNAL
The wake was caused by a signal.
Definition stk_common.h:125

References __stk_forceinline, osError, osOK, StkWaitFailToCmsis(), stk::WAIT_RESULT_CANCELED, stk::WAIT_RESULT_FAIL, stk::WAIT_RESULT_SIGNAL, and stk::WAIT_RESULT_TIMEOUT.

Referenced by StkFastMutex::Acquire(), StkMutex::Acquire(), osMessageQueueGet(), osMessageQueuePut(), and osSemaphoreAcquire().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ g_StkKernel

◆ g_StkKernelLocked

uint32_t g_StkKernelLocked = 0U
static

◆ g_TimerHost

◆ g_TimerHostBuf

Definition at line 450 of file cmsis_os2_stk.cpp.

Referenced by StkTimer::EnsureTimerHostCreated().

◆ g_ZombieThreads

StkThread* g_ZombieThreads = nullptr
static

Definition at line 226 of file cmsis_os2_stk.cpp.

Referenced by StkThread::OnExit(), and StkReapZombieThreads().