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
stk Namespace Reference

Namespace of STK package. More...

Namespaces

namespace  hw
 Hardware Abstraction Layer (HAL) for architecture-specific operations.
namespace  memory
 Memory-related primitives.
namespace  tz
namespace  util
 Internal utility namespace containing data structure helpers (linked lists, etc.) used by the kernel implementation. Not part of the public user API.
namespace  sync
 Synchronization primitives for task coordination and resource protection.
namespace  time
 Time-related primitives.
namespace  interop_c_helper
namespace  pthread

Classes

class  PlatformArmCortexM
 Concrete implementation of IPlatform driver for the Arm Cortex-M0, M3, M4, M7 processors. More...
struct  FaultContext
 ARMv7-M/ARMv8-M system fault exception context state capture. More...
class  PlatformRiscV
 Concrete implementation of IPlatform driver for the Risc-V processors. More...
class  PlatformContext
 Base platform context for all platform implementations. More...
class  PlatformX86Win32
 Concrete implementation of IPlatform driver for the x86 Win32 platform. More...
class  Kernel
 Concrete implementation of IKernel. More...
class  ArrayView
 Lightweight, non-owning view over a contiguous sequence of elements. More...
struct  TaskStateInfo
 Snapshot of the kernel-side state of a task, filled in by IKernel::GetTaskState(). More...
class  Stack
 Stack descriptor. More...
class  IStackMemory
 Interface for a stack memory region. More...
class  IWaitObject
 Wait object. More...
class  ITraceable
 Traceable object. More...
class  ISyncObject
 Synchronization object interface. More...
class  IMutex
 Interface for mutex synchronization primitive. More...
class  ITask
 Interface for a user task. More...
class  IKernelTask
 Scheduling-strategy-facing interface for a kernel task slot. More...
class  IPlatform
 Interface for a platform driver. More...
class  ITaskSwitchStrategy
 Interface for a task switching strategy implementation. More...
class  IKernel
 Interface for the implementation of the kernel of the scheduler. It supports Soft and Hard Real-Time modes. More...
class  IKernelService
 Interface for the kernel services exposed to the user processes during run-time when Kernel started scheduling the processes. More...
class  StackMemoryDef
 Stack memory type definition. More...
class  Task
 Partial implementation of the user task. More...
class  TaskW
 Partial implementation of the user task with a compile-time scheduling weight. Use when the kernel is configured with SwitchStrategySmoothWeightedRoundRobin. More...
class  StackMemoryWrapper
 Adapts an externally-owned stack memory array to the IStackMemory interface. More...
class  SyncObjectBase
 Default, storage-owning implementation of ISyncObject. More...
class  SwitchStrategyEDF
 Earliest Deadline First (EDF) scheduling strategy: always selects the runnable task with the least time remaining before its deadline expires. More...
class  SwitchStrategyFixedPriority
 Fixed-priority preemptive scheduling strategy with round-robin arbitration within each priority level. More...
class  SwitchStrategyMonotonic
 Monotonic scheduling strategy: Rate-Monotonic (RM) or Deadline-Monotonic (DM), selected at compile time by the TStrategyType template parameter. More...
class  SchedulabilityCheck
 Utility class providing static methods for Worst-Case Response Time (WCRT) schedulability analysis of a monotonic HRT task set. More...
class  SwitchStrategyPreemptionThreshold
 Fixed-priority scheduling with Preemption-Threshold (PTS), modelled on Azure RTOS / ThreadX. Each task has a priority P and a threshold T with T >= P. While a task is running it can be preempted only by tasks whose priority is strictly greater than T. With T == P the task behaves like a normal fixed-priority task. More...
class  SwitchStrategyRoundRobinT
class  SwitchStrategySmoothWeightedRoundRobinT
 Smooth Weighted Round-Robin (SWRR) task-switching strategy: distributes CPU time proportionally to per-task weights while avoiding execution bursts by spreading selections evenly over time. More...

Typedefs

typedef PlatformArmCortexM PlatformDefault
 Default platform implementation.
typedef uintptr_t Word
 Native processor word type.
typedef Word TId
 Task (thread) id.
typedef int32_t Timeout
 Timeout time (ticks).
typedef int64_t Ticks
 Ticks value.
typedef int64_t Time
 Time value.
typedef uint64_t Cycles
 Cycles value.
typedef int32_t Weight
 Weight value (aka priority).
typedef SwitchStrategyFixedPriority< 32 > SwitchStrategyFP32
 Shorthand alias for SwitchStrategyFixedPriority<32>: 32 priority levels (0..31), using a single 32-bit m_ready_bitmap for O(1) highest-priority lookup.
typedef SwitchStrategyFixedPriority< 32, true > SwitchStrategyFP32_NSY
 Shorthand alias for SwitchStrategyFixedPriority<32, true>: same as SwitchStrategyFP32 but Yield() keeps the task runnable and hands the CPU to same-priority peers only (NOSLEEP_YIELD_API = 1).
typedef SwitchStrategyMonotonic< MSS_TYPE_RATE > SwitchStrategyRM
 Shorthand alias for SwitchStrategyMonotonic<MSS_TYPE_RATE>: Rate-Monotonic scheduling (shorter scheduling period -> higher priority).
typedef SwitchStrategyMonotonic< MSS_TYPE_DEADLINE > SwitchStrategyDM
 Shorthand alias for SwitchStrategyMonotonic<MSS_TYPE_DEADLINE>: Deadline-Monotonic scheduling (shorter execution deadline -> higher priority).
typedef SwitchStrategyPreemptionThreshold< 32 > SwitchStrategyPT32
 SwitchStrategyPreemptionThreshold with 32 priority levels.
typedef SwitchStrategyPreemptionThreshold< 32, true > SwitchStrategyPT32_TS
 SwitchStrategyPreemptionThreshold with 32 priority levels and per-task time-slicing, for use with stk::KERNEL_TIMESLICE.
typedef SwitchStrategyRoundRobinT< false > SwitchStrategyRoundRobin
 Shorthand alias for SwitchStrategyRoundRobinT<>.
typedef SwitchStrategyRoundRobinT< false > SwitchStrategyRR
 Shorthand alias for SwitchStrategyRoundRobin.
typedef SwitchStrategyRoundRobinT< true > SwitchStrategyRoundRobinNoSleepYield
 Round-Robin strategy where Yield() keeps the task runnable (NOSLEEP_YIELD_API = 1).
typedef SwitchStrategyRoundRobinT< true > SwitchStrategyRR_NSY
 Shorthand for SwitchStrategyRoundRobinNoSleepYield.
typedef SwitchStrategySmoothWeightedRoundRobinT< false > SwitchStrategySmoothWeightedRoundRobin
 Shorthand alias for SwitchStrategySmoothWeightedRoundRobinT<false>.
typedef SwitchStrategySmoothWeightedRoundRobinT< false > SwitchStrategySWRR
 Shorthand alias for SwitchStrategySmoothWeightedRoundRobin.
typedef SwitchStrategySmoothWeightedRoundRobinT< true > SwitchStrategySmoothWeightedRoundRobinNoSleepYield
 Smooth Weighted Round-Robin strategy where Yield() keeps the task runnable (NOSLEEP_YIELD_API = 1).
typedef SwitchStrategySmoothWeightedRoundRobinT< true > SwitchStrategySWRR_NSY
 Shorthand for SwitchStrategySmoothWeightedRoundRobinNoSleepYield.

Enumerations

enum  EAccessMode : uint32_t {
  ACCESS_USER = 0 ,
  ACCESS_PRIVILEGED = (1 << 0) ,
  ACCESS_SECURE = (1 << 1)
}
 Hardware access modes by the task. More...
enum  EKernelMode : uint8_t {
  KERNEL_STATIC = (1 << 0) ,
  KERNEL_DYNAMIC = (1 << 1) ,
  KERNEL_HRT = (1 << 2) ,
  KERNEL_SYNC = (1 << 3) ,
  KERNEL_TICKLESS = (1 << 4) ,
  KERNEL_TIMESLICE = (1 << 5) ,
  KERNEL_TELEMETRY = (1 << 6)
}
 Kernel operating mode. More...
enum  EKernelPanicId : uint8_t {
  KERNEL_PANIC_NONE = 0U ,
  KERNEL_PANIC_SPINLOCK_DEADLOCK = 1U ,
  KERNEL_PANIC_STACK_CORRUPT = 2U ,
  KERNEL_PANIC_ASSERT = 3U ,
  KERNEL_PANIC_HRT_HARD_FAULT = 4U ,
  KERNEL_PANIC_CPU_EXCEPTION = 5U ,
  KERNEL_PANIC_CS_NESTING_OVERFLOW = 6U ,
  KERNEL_PANIC_UNKNOWN_SVC = 7U ,
  KERNEL_PANIC_BAD_STATE = 8U ,
  KERNEL_PANIC_BAD_MODE = 9U ,
  KERNEL_PANIC_BAD_STACK_TYPE = 10U ,
  KERNEL_PANIC_NS_ACCESS = 11U ,
  KERNEL_PANIC_BAD_MEMORY_REGION = 12U ,
  KERNEL_PANIC_SYNC_DEADLOCK = 13U
}
 Identifies the source of a kernel panic. More...
enum  ETaskState : uint8_t {
  TASK_STATE_REMOVED = 0 ,
  TASK_STATE_READY ,
  TASK_STATE_SLEEPING ,
  TASK_STATE_WAITING ,
  TASK_STATE_SUSPENDED ,
  TASK_STATE_EXITING
}
 Kernel-side state of a task, see IKernel::GetTaskState(). More...
enum  EStackType : uint8_t {
  STACK_USER_TASK = 0 ,
  STACK_SLEEP_TRAP ,
  STACK_EXIT_TRAP
}
 Stack type. More...
enum  EConsts : uint32_t {
  PERIODICITY_MAX = 99000 ,
  PERIODICITY_DEFAULT = 1000 ,
  STACK_SIZE_MIN = (32U)
}
 Constants. More...
enum  ESystemTaskId : uint32_t {
  SYS_TASK_ID_SLEEP = 0xFFFFFFFF ,
  SYS_TASK_ID_EXIT = 0xFFFFFFFE
}
 System task id. More...
enum  ETraceEventId : uint32_t {
  TRACE_EVENT_UNKNOWN = 0 ,
  TRACE_EVENT_SWITCH = 1000 + 0 ,
  TRACE_EVENT_SLEEP = 1000 + 1 ,
  TRACE_EVENT_WAIT = 1000 + 2 ,
  TRACE_EVENT_SUSPEND = 1000 + 3
}
 Trace event identifiers for tracing task suspension and resume with debugging tools (e.g. SEGGER SystemView). More...
enum  EWaitResult : int8_t {
  WAIT_RESULT_FAIL = -1 ,
  WAIT_RESULT_SIGNAL = 0 ,
  WAIT_RESULT_TIMEOUT = 1 ,
  WAIT_RESULT_CANCELED = 2
}
 Wait result (see IKernelService::Wait). More...
enum  EHwException : int8_t {
  HW_EXCEPT_FATAL = 0 ,
  HW_EXCEPT_MEMACCESS = 1
}
 Hardware exception id (see IPlatform::IEventOverrider::OnException). More...
enum  EMonotonicSwitchStrategyType {
  MSS_TYPE_RATE ,
  MSS_TYPE_DEADLINE
}
 Policy selector for SwitchStrategyMonotonic: determines the timing attribute used to assign fixed priorities to tasks at AddTask() time. More...

Functions

static __stk_forceinline Cycles ConvertTimeUsToClockCycles (uint32_t clock_freq, Ticks time_us)
 Convert time (microseconds) to core clock cycles.
template<bool TicklessMode>
Timeout GetInitialSleepTicks ()
template<>
Timeout GetInitialSleepTicks< true > ()
template<>
Timeout GetInitialSleepTicks< false > ()
static void STK_KERNEL_PANIC (stk::EKernelPanicId id)
 Called when the kernel detects an unrecoverable internal fault.
static constexpr TId GetTidFromUserTask (const ITask *task) noexcept
 Get task identifier from ITask instance.
static constexpr ITask * GetUserTaskFromTid (TId task_id) noexcept
 Get task instance from its identifier.
static constexpr bool IsIsrTid (TId id)
 Test whether a task identifier represents an ISR context.
template<typename T>
static constexpr T Min (T a, T b) noexcept
 Compile-time minimum of two values.
template<typename T>
static constexpr T Max (T a, T b) noexcept
 Compile-time maximum of two values.
template<typename T>
static constexpr T Align (T v, T align) noexcept
 Aligns a value towards the next larger size multiple.
template<typename T>
static constexpr T AlignPow2 (T v, T align) noexcept
 Fast compile-time alignment for power-of-two boundaries.
static uint32_t CountLeadingZeros (const uint32_t value) noexcept
 Count leading zeros.
static TId GetTid ()
 Get task/thread Id of the calling task.
static uint32_t GetTickResolution ()
 Get number of microseconds in one tick.
static Time GetMsFromTicks (Ticks tick_count, uint32_t resolution)
 Convert ticks to milliseconds.
static Ticks GetTicksFromMs (Time ms, uint32_t resolution)
 Convert milliseconds to ticks.
static Ticks GetTicksFromMs (Time ms)
 Convert milliseconds to ticks using the current kernel tick resolution.
static Timeout GetTicksFromMsClampedToTimeout (Timeout ms)
 Convert milliseconds to ticks and clamp the result to a Timeout type.
static Ticks GetTicks ()
 Get number of ticks elapsed since kernel start.
static Time GetTimeNowMs ()
 Get current time in milliseconds since kernel start.
static Cycles GetSysTimerCount ()
 Get system timer count value.
static uint32_t GetSysTimerFrequency ()
 Get system timer frequency.
static void Sleep (Timeout tick_count)
 Put calling process into a sleep state.
static void SleepMs (Timeout ms)
 Put calling process into a sleep state.
static bool SleepUntil (Ticks timestamp)
 Put calling process into a sleep state until the specified timestamp.
static void SleepCancel (TId task_id)
 Cancel sleep of the task.
static void Yield ()
 Notify scheduler to switch to the next runnable task.
static Weight SetWeight (TId tid, Weight weight)
 Change the base scheduling weight of a task at run-time.
static Weight SetWeight (Weight weight)
 Change the base scheduling weight of the calling task at run-time.
static Timeout SetTimeSlice (TId tid, Timeout ticks)
 Change the time-slice quantum of a task at run-time and reload its slice.
static Timeout SetTimeSlice (Timeout ticks)
 Change the time-slice quantum of the calling task at run-time and reload its slice.
static void Delay (Timeout tick_count)
 Delay calling process by busy-waiting until the deadline expires.
static void DelayMs (Timeout ms)
 Delay calling process by busy-waiting until the deadline expires.
template<typename T, typename Mem, typename... Args>
static T * ConstructIn (Mem &mem, Args &&... args)
 Construct object T in-place inside a C memory container.

Variables

static constexpr TId TID_ISR_N = static_cast<TId>(0xFFFFF000U)
 Bitmask sentinel for ISR-context task identifiers.
static constexpr TId TID_NONE = static_cast<TId>(0U)
 Reserved task/thread id representing zero/none thread id.
static constexpr Timeout WAIT_INFINITE = INT32_MAX
 Timeout value: block indefinitely until the synchronization object is signaled.
static constexpr Timeout NO_WAIT = 0
 Timeout value: return immediately if the synchronization object is not yet signaled (non-blocking poll).
static constexpr Weight NO_WEIGHT = -1
 Weight value: weight is not set.
static constexpr Weight DEFAULT_WEIGHT = 1
 Weight value: default weight of value (1) (see SwitchStrategySmoothWeightedRoundRobin).
static constexpr Timeout NO_TIME_SLICE = 0
 Time-slice quantum value: no time-slicing for the task (it runs until it blocks, yields or is preempted).

Detailed Description

Namespace of STK package.

Typedef Documentation

◆ Cycles

typedef uint64_t stk::Cycles

Cycles value.

Definition at line 185 of file stk_common.h.

◆ PlatformDefault

Default platform implementation.

Definition at line 170 of file stk_arch_arm-cortex-m.h.

◆ SwitchStrategyDM

Shorthand alias for SwitchStrategyMonotonic<MSS_TYPE_DEADLINE>: Deadline-Monotonic scheduling (shorter execution deadline -> higher priority).

See also
SwitchStrategyMonotonic, SchedulabilityCheck

Definition at line 547 of file stk_strategy_monotonic.h.

◆ SwitchStrategyFP32

Shorthand alias for SwitchStrategyFixedPriority<32>: 32 priority levels (0..31), using a single 32-bit m_ready_bitmap for O(1) highest-priority lookup.

See also
SwitchStrategyFixedPriority

Definition at line 451 of file stk_strategy_fpriority.h.

◆ SwitchStrategyFP32_NSY

Shorthand alias for SwitchStrategyFixedPriority<32, true>: same as SwitchStrategyFP32 but Yield() keeps the task runnable and hands the CPU to same-priority peers only (NOSLEEP_YIELD_API = 1).

See also
SwitchStrategyFixedPriority

Definition at line 458 of file stk_strategy_fpriority.h.

◆ SwitchStrategyPT32

◆ SwitchStrategyPT32_TS

SwitchStrategyPreemptionThreshold with 32 priority levels and per-task time-slicing, for use with stk::KERNEL_TIMESLICE.

Definition at line 578 of file stk_strategy_pthreshold.h.

◆ SwitchStrategyRM

Shorthand alias for SwitchStrategyMonotonic<MSS_TYPE_RATE>: Rate-Monotonic scheduling (shorter scheduling period -> higher priority).

See also
SwitchStrategyMonotonic, SchedulabilityCheck

Definition at line 540 of file stk_strategy_monotonic.h.

◆ SwitchStrategyRoundRobin

◆ SwitchStrategyRoundRobinNoSleepYield

Round-Robin strategy where Yield() keeps the task runnable (NOSLEEP_YIELD_API = 1).

See also
SwitchStrategyRoundRobinT

Definition at line 302 of file stk_strategy_rrobin.h.

◆ SwitchStrategyRR

◆ SwitchStrategyRR_NSY

◆ SwitchStrategySmoothWeightedRoundRobin

◆ SwitchStrategySmoothWeightedRoundRobinNoSleepYield

Smooth Weighted Round-Robin strategy where Yield() keeps the task runnable (NOSLEEP_YIELD_API = 1).

See also
SwitchStrategySmoothWeightedRoundRobinT

Definition at line 381 of file stk_strategy_swrrobin.h.

◆ SwitchStrategySWRR

◆ SwitchStrategySWRR_NSY

◆ Ticks

typedef int64_t stk::Ticks

Ticks value.

Definition at line 175 of file stk_common.h.

◆ TId

typedef Word stk::TId

Task (thread) id.

Definition at line 165 of file stk_common.h.

◆ Time

typedef int64_t stk::Time

Time value.

Definition at line 180 of file stk_common.h.

◆ Timeout

typedef int32_t stk::Timeout

Timeout time (ticks).

Definition at line 170 of file stk_common.h.

◆ Weight

typedef int32_t stk::Weight

Weight value (aka priority).

Definition at line 190 of file stk_common.h.

◆ Word

typedef uintptr_t stk::Word

Native processor word type.

Represents natural data width of the CPU (matching uintptr_t). Used for stack allocation, register storage, pointer value storage, and memory alignment to ensure atomic access, optimal performance, and hardware compatibility.

Definition at line 160 of file stk_common.h.

Enumeration Type Documentation

◆ EAccessMode

enum stk::EAccessMode : uint32_t

Hardware access modes by the task.

Note
Can be used as a bit-field.
Enumerator
ACCESS_USER 

Unprivileged access mode (access to some hardware is restricted, see CPU manual for details). If compiled as ARM TrustZone, this is also a Non-Secure mode.

ACCESS_PRIVILEGED 

Privileged access mode (access to hardware is fully unrestricted).

ACCESS_SECURE 

Secure access mode (ARM TrustZone, Secure binary).

Definition at line 35 of file stk_common.h.

36{
37 ACCESS_USER = 0,
38 ACCESS_PRIVILEGED = (1 << 0),
39 ACCESS_SECURE = (1 << 1)
40};
@ ACCESS_USER
Unprivileged access mode (access to some hardware is restricted, see CPU manual for details)....
Definition stk_common.h:37
@ ACCESS_PRIVILEGED
Privileged access mode (access to hardware is fully unrestricted).
Definition stk_common.h:38
@ ACCESS_SECURE
Secure access mode (ARM TrustZone, Secure binary).
Definition stk_common.h:39

◆ EConsts

enum stk::EConsts : uint32_t

Constants.

Enumerator
PERIODICITY_MAX 

Maximum periodicity (microseconds), 99 milliseconds (note: this value is the highest working on a real hardware and QEMU).

PERIODICITY_DEFAULT 

Default periodicity (microseconds), 1 millisecond.

STACK_SIZE_MIN 

Minimum stack size in elements of Word. Used as a lower bound for all stack allocations (user task, sleep trap, exit trap). See: StackMemoryDef, StackMemoryWrapper.

Definition at line 104 of file stk_common.h.

105{
106 PERIODICITY_MAX = 99000,
107 PERIODICITY_DEFAULT = 1000,
109};
#define STK_STACK_SIZE_MIN
Minimum stack size in elements of Word, shared by all stack allocation lower-bound checks.
Definition stk_defs.h:640
@ PERIODICITY_DEFAULT
Default periodicity (microseconds), 1 millisecond.
Definition stk_common.h:107
@ STACK_SIZE_MIN
Minimum stack size in elements of Word. Used as a lower bound for all stack allocations (user task,...
Definition stk_common.h:108
@ PERIODICITY_MAX
Maximum periodicity (microseconds), 99 milliseconds (note: this value is the highest working on a rea...
Definition stk_common.h:106

◆ EHwException

enum stk::EHwException : int8_t

Hardware exception id (see IPlatform::IEventOverrider::OnException).

Enumerator
HW_EXCEPT_FATAL 

HardFault on ARM / Unhandled Fatal Trap on RISC-V.

HW_EXCEPT_MEMACCESS 

MemManage on ARM / Page Fault or PMP violation on RISC-V.

Definition at line 147 of file stk_common.h.

148{
149 HW_EXCEPT_FATAL = 0,
151};
@ HW_EXCEPT_MEMACCESS
MemManage on ARM / Page Fault or PMP violation on RISC-V.
Definition stk_common.h:150
@ HW_EXCEPT_FATAL
HardFault on ARM / Unhandled Fatal Trap on RISC-V.
Definition stk_common.h:149

◆ EKernelMode

enum stk::EKernelMode : uint8_t

Kernel operating mode.

Enumerator
KERNEL_STATIC 

All tasks are static and can not exit.

KERNEL_DYNAMIC 

Tasks can be added or removed and therefore exit when done.

KERNEL_HRT 

Hard Real-Time (HRT) behavior (tasks are scheduled periodically and have an execution deadline, whole system is failed when task's deadline is failed).

KERNEL_SYNC 

Synchronization support (see Event).

KERNEL_TICKLESS 

Tickless mode. To use this mode STK_TICKLESS_IDLE must be defined to 1 in stk_config.h.

KERNEL_TIMESLICE 

Time-slicing: running task is rotated behind its same-priority peers when its quantum (see ITask::GetTimeSlice) expires. Requires a strategy with TIMESLICE_API = 1, incompatible with KERNEL_HRT.

KERNEL_TELEMETRY 

Enable introspection functions for diagnostics / telemetry (see IKernel::GetTaskState).

Definition at line 45 of file stk_common.h.

46{
47 KERNEL_STATIC = (1 << 0),
48 KERNEL_DYNAMIC = (1 << 1),
49 KERNEL_HRT = (1 << 2),
50 KERNEL_SYNC = (1 << 3),
51 KERNEL_TICKLESS = (1 << 4),
52 KERNEL_TIMESLICE = (1 << 5),
53 KERNEL_TELEMETRY = (1 << 6)
54};
@ KERNEL_TELEMETRY
Enable introspection functions for diagnostics / telemetry (see IKernel::GetTaskState).
Definition stk_common.h:53
@ KERNEL_TIMESLICE
Time-slicing: running task is rotated behind its same-priority peers when its quantum (see ITask::Get...
Definition stk_common.h:52
@ 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_HRT
Hard Real-Time (HRT) behavior (tasks are scheduled periodically and have an execution deadline,...
Definition stk_common.h:49
@ KERNEL_STATIC
All tasks are static and can not exit.
Definition stk_common.h:47
@ KERNEL_DYNAMIC
Tasks can be added or removed and therefore exit when done.
Definition stk_common.h:48

◆ EKernelPanicId

enum stk::EKernelPanicId : uint8_t

Identifies the source of a kernel panic.

Enumerator
KERNEL_PANIC_NONE 

Panic is absent (no fault).

KERNEL_PANIC_SPINLOCK_DEADLOCK 

Spin-lock timeout expired: lock owner never released.

KERNEL_PANIC_STACK_CORRUPT 

Stack integrity check failed.

KERNEL_PANIC_ASSERT 

Internal assertion failed (maps from STK_ASSERT).

KERNEL_PANIC_HRT_HARD_FAULT 

Kernel running in KERNEL_HRT mode reported deadline failure of the task.

KERNEL_PANIC_CPU_EXCEPTION 

CPU reported an exception and halted execution.

KERNEL_PANIC_CS_NESTING_OVERFLOW 

Critical section nesting limit exceeded: violation of STK_CS_NESTINGS_MAX.

KERNEL_PANIC_UNKNOWN_SVC 

Unknown service command received by SVC handler.

KERNEL_PANIC_BAD_STATE 

Kernel entered unexpected (bad) state.

KERNEL_PANIC_BAD_MODE 

Kernel is in bad/unsupported mode for the current operation.

KERNEL_PANIC_BAD_STACK_TYPE 

Stack type is unknown.

KERNEL_PANIC_NS_ACCESS 

Non-secure access to protected resource.

KERNEL_PANIC_BAD_MEMORY_REGION 

Bad memory region (ARM TrustZone: provided memory region overlaps with another one).

KERNEL_PANIC_SYNC_DEADLOCK 

Deadlock caused by a synchronization primitive: a task tried to acquire a non-recursive primitive (e.g. sync::FastMutex) that it already owns and would block forever. Not used for spin-lock timeouts, see KERNEL_PANIC_SPINLOCK_DEADLOCK.

Definition at line 59 of file stk_common.h.

60{
75};
@ KERNEL_PANIC_UNKNOWN_SVC
Unknown service command received by SVC handler.
Definition stk_common.h:68
@ KERNEL_PANIC_BAD_STACK_TYPE
Stack type is unknown.
Definition stk_common.h:71
@ KERNEL_PANIC_NS_ACCESS
Non-secure access to protected resource.
Definition stk_common.h:72
@ KERNEL_PANIC_BAD_MODE
Kernel is in bad/unsupported mode for the current operation.
Definition stk_common.h:70
@ KERNEL_PANIC_HRT_HARD_FAULT
Kernel running in KERNEL_HRT mode reported deadline failure of the task.
Definition stk_common.h:65
@ KERNEL_PANIC_CS_NESTING_OVERFLOW
Critical section nesting limit exceeded: violation of STK_CS_NESTINGS_MAX.
Definition stk_common.h:67
@ KERNEL_PANIC_NONE
Panic is absent (no fault).
Definition stk_common.h:61
@ KERNEL_PANIC_BAD_MEMORY_REGION
Bad memory region (ARM TrustZone: provided memory region overlaps with another one).
Definition stk_common.h:73
@ KERNEL_PANIC_CPU_EXCEPTION
CPU reported an exception and halted execution.
Definition stk_common.h:66
@ KERNEL_PANIC_SYNC_DEADLOCK
Deadlock caused by a synchronization primitive: a task tried to acquire a non-recursive primitive (e....
Definition stk_common.h:74
@ KERNEL_PANIC_STACK_CORRUPT
Stack integrity check failed.
Definition stk_common.h:63
@ KERNEL_PANIC_SPINLOCK_DEADLOCK
Spin-lock timeout expired: lock owner never released.
Definition stk_common.h:62
@ KERNEL_PANIC_BAD_STATE
Kernel entered unexpected (bad) state.
Definition stk_common.h:69
@ KERNEL_PANIC_ASSERT
Internal assertion failed (maps from STK_ASSERT).
Definition stk_common.h:64

◆ EMonotonicSwitchStrategyType

Policy selector for SwitchStrategyMonotonic: determines the timing attribute used to assign fixed priorities to tasks at AddTask() time.

Enumerator
MSS_TYPE_RATE 

Rate-Monotonic (RM): shorter scheduling period -> higher priority. Priority is derived from GetHrtPeriodicity() and is fixed at task registration.

MSS_TYPE_DEADLINE 

Deadline-Monotonic (DM): shorter execution deadline -> higher priority. Priority is derived from GetHrtDeadline() and is fixed at task registration.

Definition at line 27 of file stk_strategy_monotonic.h.

28{
31};
@ MSS_TYPE_DEADLINE
Deadline-Monotonic (DM): shorter execution deadline -> higher priority. Priority is derived from GetH...
@ MSS_TYPE_RATE
Rate-Monotonic (RM): shorter scheduling period -> higher priority. Priority is derived from GetHrtPer...

◆ EStackType

enum stk::EStackType : uint8_t

Stack type.

See also
IPlatform::InitStack
Enumerator
STACK_USER_TASK 

Stack of the user task.

STACK_SLEEP_TRAP 

Stack of the Sleep trap.

STACK_EXIT_TRAP 

Stack of the Exit trap.

Definition at line 94 of file stk_common.h.

95{
96 STACK_USER_TASK = 0,
99};
@ STACK_SLEEP_TRAP
Stack of the Sleep trap.
Definition stk_common.h:97
@ STACK_USER_TASK
Stack of the user task.
Definition stk_common.h:96
@ STACK_EXIT_TRAP
Stack of the Exit trap.
Definition stk_common.h:98

◆ ESystemTaskId

enum stk::ESystemTaskId : uint32_t

System task id.

Enumerator
SYS_TASK_ID_SLEEP 

Sleep trap.

SYS_TASK_ID_EXIT 

Exit trap.

Definition at line 114 of file stk_common.h.

115{
116 SYS_TASK_ID_SLEEP = 0xFFFFFFFF,
117 SYS_TASK_ID_EXIT = 0xFFFFFFFE
118};
@ SYS_TASK_ID_EXIT
Exit trap.
Definition stk_common.h:117
@ SYS_TASK_ID_SLEEP
Sleep trap.
Definition stk_common.h:116

◆ ETaskState

enum stk::ETaskState : uint8_t

Kernel-side state of a task, see IKernel::GetTaskState().

Enumerator
TASK_STATE_REMOVED 

The task is not bound to a kernel slot (never added, or already removed).

TASK_STATE_READY 

Runnable: running, or waiting for the CPU.

TASK_STATE_SLEEPING 

Sleeping via Sleep()/SleepUntil(), with a finite or an infinite timeout.

TASK_STATE_WAITING 

Blocked on a synchronization object (IKernelService::Wait). KERNEL_SYNC mode only.

TASK_STATE_SUSPENDED 

Suspended by IKernel::SuspendTask().

TASK_STATE_EXITING 

Run() has returned, the slot is released on the next tick (KERNEL_DYNAMIC mode only).

Definition at line 80 of file stk_common.h.

81{
88};
@ TASK_STATE_EXITING
Run() has returned, the slot is released on the next tick (KERNEL_DYNAMIC mode only).
Definition stk_common.h:87
@ TASK_STATE_SLEEPING
Sleeping via Sleep()/SleepUntil(), with a finite or an infinite timeout.
Definition stk_common.h:84
@ TASK_STATE_SUSPENDED
Suspended by IKernel::SuspendTask().
Definition stk_common.h:86
@ TASK_STATE_REMOVED
The task is not bound to a kernel slot (never added, or already removed).
Definition stk_common.h:82
@ TASK_STATE_WAITING
Blocked on a synchronization object (IKernelService::Wait). KERNEL_SYNC mode only.
Definition stk_common.h:85
@ TASK_STATE_READY
Runnable: running, or waiting for the CPU.
Definition stk_common.h:83

◆ ETraceEventId

enum stk::ETraceEventId : uint32_t

Trace event identifiers for tracing task suspension and resume with debugging tools (e.g. SEGGER SystemView).

Note
Values are offset by 1000 to avoid collisions with the host tool's built-in system event range (0–999).
Enumerator
TRACE_EVENT_UNKNOWN 

Unknown / uninitialized trace event.

TRACE_EVENT_SWITCH 

Task blocked by the context switch.

TRACE_EVENT_SLEEP 

Task entered a sleep state.

TRACE_EVENT_WAIT 

Task suspended on a sync object.

TRACE_EVENT_SUSPEND 

Task suspended via Suspend.

Definition at line 124 of file stk_common.h.

125{
127 TRACE_EVENT_SWITCH = 1000 + 0,
128 TRACE_EVENT_SLEEP = 1000 + 1,
129 TRACE_EVENT_WAIT = 1000 + 2,
130 TRACE_EVENT_SUSPEND = 1000 + 3,
131};
@ TRACE_EVENT_UNKNOWN
Unknown / uninitialized trace event.
Definition stk_common.h:126
@ TRACE_EVENT_SLEEP
Task entered a sleep state.
Definition stk_common.h:128
@ TRACE_EVENT_SUSPEND
Task suspended via Suspend.
Definition stk_common.h:130
@ TRACE_EVENT_SWITCH
Task blocked by the context switch.
Definition stk_common.h:127
@ TRACE_EVENT_WAIT
Task suspended on a sync object.
Definition stk_common.h:129

◆ EWaitResult

enum stk::EWaitResult : int8_t

Wait result (see IKernelService::Wait).

Enumerator
WAIT_RESULT_FAIL 

IKernelService::Wait returned with error without waiting.

WAIT_RESULT_SIGNAL 

The wake was caused by a signal.

WAIT_RESULT_TIMEOUT 

The wake was caused by a timeout expiry.

WAIT_RESULT_CANCELED 

The wait was cancelled by another task via IKernel::CancelTaskWait(), independent of signal/timeout.

Definition at line 136 of file stk_common.h.

137{
138 WAIT_RESULT_FAIL = -1,
142};
@ WAIT_RESULT_FAIL
IKernelService::Wait returned with error without waiting.
Definition stk_common.h:138
@ WAIT_RESULT_CANCELED
The wait was cancelled by another task via IKernel::CancelTaskWait(), independent of signal/timeout.
Definition stk_common.h:141
@ WAIT_RESULT_TIMEOUT
The wake was caused by a timeout expiry.
Definition stk_common.h:140
@ WAIT_RESULT_SIGNAL
The wake was caused by a signal.
Definition stk_common.h:139

Function Documentation

◆ Align()

template<typename T>
constexpr T stk::Align ( T v,
T align )
staticconstexprnoexcept

Aligns a value towards the next larger size multiple.

Note
Arguments are evaluated exactly once, safe for any expression type.

Definition at line 765 of file stk_defs.h.

766{
767 return ((v + align - static_cast<T>(1U)) / align) * align;
768}

◆ AlignPow2()

template<typename T>
constexpr T stk::AlignPow2 ( T v,
T align )
staticconstexprnoexcept

Fast compile-time alignment for power-of-two boundaries.

Note
Arguments are evaluated exactly once. The 'align' parameter MUST be a power of two.

Definition at line 774 of file stk_defs.h.

775{
776 return (v + align - static_cast<T>(1U)) & ~(align - static_cast<T>(1U));
777}

◆ ConstructIn()

template<typename T, typename Mem, typename... Args>
T * stk::ConstructIn ( Mem & mem,
Args &&... args )
inlinestatic

Construct object T in-place inside a C memory container.

Compile-time checks that the container is large and aligned enough for T, run-time check that the actual storage address is aligned.

Parameters
[in]memMemory container (stk_*_mem_t), must expose a data member.
[in]argsConstructor arguments of T.
Returns
Pointer to the constructed object.
Examples
D:/SVN/private/stk/interop/c/include/stk_c.h.

Definition at line 2581 of file stk_c.h.

2582{
2583 STK_STATIC_ASSERT_DESC((sizeof(T) <= sizeof(Mem)),
2584 "stk_*_mem_t is too small for the C++ object");
2585 STK_STATIC_ASSERT_DESC((alignof(T) <= alignof(Mem)),
2586 "stk_*_mem_t is not sufficiently aligned for the C++ object");
2587
2588 STK_ASSERT((reinterpret_cast<uintptr_t>(mem.data) % alignof(T)) == 0U);
2589
2590 return new (static_cast<void *>(mem.data)) T(static_cast<Args &&>(args)...);
2591}
#define STK_ASSERT(e)
Runtime assertion. Halts execution if the expression e evaluates to false.
Definition stk_defs.h:516
#define STK_STATIC_ASSERT_DESC(X, DESC)
Compile-time assertion with a custom error description. Produces a compilation error if X is false.
Definition stk_defs.h:536

References STK_ASSERT, and STK_STATIC_ASSERT_DESC.

Referenced by stk::pthread::EnsureObject(), stk::pthread::EnsureReaper(), pthread_barrier_init(), pthread_cond_init(), pthread_create(), pthread_mutex_init(), pthread_rwlock_init(), pthread_spin_init(), stk_barrier_create(), stk_blockpool_create(), stk_blockpool_create_static(), stk_cv_create(), stk_ef_create(), stk_event_create(), stk_fastmutex_create(), stk_msgq_create(), stk_mutex_create(), stk_periodic_trigger_create(), stk_pipe_create(), stk_rwmutex_create(), stk_sem_create(), and stk_spinlock_create().

Here is the caller graph for this function:

◆ ConvertTimeUsToClockCycles()

__stk_forceinline Cycles stk::ConvertTimeUsToClockCycles ( uint32_t clock_freq,
Ticks time_us )
static

Convert time (microseconds) to core clock cycles.

Parameters
[in]clock_freqClock frequency.
[in]time_usTime (microseconds).
Returns
Clock cycles.

Definition at line 108 of file stk_arch_common.h.

109{
110 return ((static_cast<Cycles>(time_us) * clock_freq) / 1000000ULL);
111}
uint64_t Cycles
Cycles value.
Definition stk_common.h:185

References __stk_forceinline.

◆ CountLeadingZeros()

uint32_t stk::CountLeadingZeros ( const uint32_t value)
inlinestaticnoexcept

Count leading zeros.

Parameters
[in]valueValue must be non 0.
Warning
Undefined behavior if temp_val is 0, but guaranteed safe by upstream checks.

Definition at line 783 of file stk_defs.h.

784{
785 uint32_t ret_val;
786
787#if defined(__GNUC__) || defined(__clang__)
788 ret_val = static_cast<uint32_t>(__builtin_clz(value));
789#elif defined(__ICCARM__)
790 ret_val = static_cast<uint32_t>(__CLZ(value));
791#else
792 uint32_t temp_val = value;
793 uint32_t count = 0U;
794
795 // note: binary search requires temp_val > 0 to resolve to a max of 31 leading zeros safely
796 if (temp_val <= 0x0000FFFFU) { count += 16U; temp_val = temp_val << 16U; } else { }
797 if (temp_val <= 0x00FFFFFFU) { count += 8U; temp_val = temp_val << 8U; } else { }
798 if (temp_val <= 0x0FFFFFFFU) { count += 4U; temp_val = temp_val << 4U; } else { }
799 if (temp_val <= 0x3FFFFFFFU) { count += 2U; temp_val = temp_val << 2U; } else { }
800 if (temp_val <= 0x7FFFFFFFU) { count += 1U; } else { }
801
802 ret_val = count;
803#endif
804
805 return ret_val;
806}

References __stk_forceinline.

Referenced by stk::SwitchStrategyFixedPriority< 32 >::GetHighestReadyPriority(), and stk::SwitchStrategyPreemptionThreshold< 32 >::GetHighestReadyPriority().

Here is the caller graph for this function:

◆ Delay()

void stk::Delay ( Timeout tick_count)
inlinestatic

Delay calling process by busy-waiting until the deadline expires.

Note
Unlike Sleep this function delays code execution by spinning in a loop until deadline expiry.
Use with care in HRT mode to avoid missed deadline (see stk::KERNEL_HRT, ITask::OnDeadlineMissed).
Parameters
[in]tick_countDelay time (in ticks). Negative will cause an assertion.
Warning
ISR-unsafe. Calling from an ISR context is not permitted and will trigger an assertion.

Definition at line 622 of file stk_helper.h.

623{
624 IKernelService::GetInstance()->Delay(tick_count);
625}
static IKernelService * GetInstance()
Get CPU-local instance of the kernel service.
virtual void Delay(Timeout ticks)=0
Delay calling process.

References __stk_forceinline, stk::IKernelService::Delay(), and stk::IKernelService::GetInstance().

Referenced by DelayMs(), and stk_delay().

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

◆ DelayMs()

void stk::DelayMs ( Timeout ms)
inlinestatic

Delay calling process by busy-waiting until the deadline expires.

Note
Unlike Sleep this function delays code execution by spinning in a loop until deadline expiry.
Use with care in HRT mode to avoid missed deadline (see stk::KERNEL_HRT, ITask::OnDeadlineMissed).
Parameters
[in]msDelay time (milliseconds). Negative will cause an assertion.
Warning
ISR-unsafe. Calling from an ISR context is not permitted and will trigger an assertion.

Definition at line 633 of file stk_helper.h.

634{
636}
static void Delay(Timeout tick_count)
Delay calling process by busy-waiting until the deadline expires.
Definition stk_helper.h:622
static Timeout GetTicksFromMsClampedToTimeout(Timeout ms)
Convert milliseconds to ticks and clamp the result to a Timeout type.
Definition stk_helper.h:437

References __stk_forceinline, Delay(), and GetTicksFromMsClampedToTimeout().

Referenced by stk_delay_ms().

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

◆ GetInitialSleepTicks()

template<bool TicklessMode>
Timeout stk::GetInitialSleepTicks ( )
inline

◆ GetInitialSleepTicks< false >()

template<>
Timeout stk::GetInitialSleepTicks< false > ( )
inline

Definition at line 42 of file stk.h.

42{ return 1; }

References __stk_forceinline.

◆ GetInitialSleepTicks< true >()

template<>
Timeout stk::GetInitialSleepTicks< true > ( )
inline

Definition at line 41 of file stk.h.

41{ return STK_TICKLESS_TICKS_MAX; }
#define STK_TICKLESS_TICKS_MAX
Maximum number of kernel ticks the hardware timer may be suppressed in one tickless idle interval whe...
Definition stk_defs.h:77

References __stk_forceinline, and STK_TICKLESS_TICKS_MAX.

◆ GetMsFromTicks()

Time stk::GetMsFromTicks ( Ticks tick_count,
uint32_t resolution )
inlinestatic

Convert ticks to milliseconds.

Parameters
[in]tick_countTick count to convert.
[in]resolutionMicroseconds per tick, as returned by IKernelService::GetTickResolution().
Returns
Equivalent time in milliseconds.
Note
ISR-safe (performs only arithmetic, no kernel calls).

Definition at line 397 of file stk_helper.h.

398{
399 return static_cast<Time>((tick_count * static_cast<Time>(resolution)) / 1000LL);
400}
int64_t Time
Time value.
Definition stk_common.h:180

References __stk_forceinline.

◆ GetSysTimerCount()

Cycles stk::GetSysTimerCount ( )
inlinestatic

Get system timer count value.

Note
ISR-safe.
Returns
64-bit count value.

Definition at line 477 of file stk_helper.h.

478{
480}
virtual Cycles GetSysTimerCount() const =0
Get system timer count value.

References __stk_forceinline, stk::IKernelService::GetInstance(), and stk::IKernelService::GetSysTimerCount().

Referenced by osKernelGetSysTimerCount(), osKernelGetSysTimerCount64(), and stk_sys_timer_count().

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

◆ GetSysTimerFrequency()

uint32_t stk::GetSysTimerFrequency ( )
inlinestatic

Get system timer frequency.

Note
ISR-safe.
Returns
Frequency (Hz).

Definition at line 486 of file stk_helper.h.

487{
489}
virtual uint32_t GetSysTimerFrequency() const =0
Get system timer frequency.

References __stk_forceinline, stk::IKernelService::GetInstance(), and stk::IKernelService::GetSysTimerFrequency().

Referenced by osKernelGetSysTimerFreq(), and stk_sys_timer_frequency().

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

◆ GetTickResolution()

uint32_t stk::GetTickResolution ( )
inlinestatic

Get number of microseconds in one tick.

Note
Tick is a periodicity of the system timer expressed in microseconds.
ISR-safe.
Returns
Microseconds in one tick.

Definition at line 386 of file stk_helper.h.

387{
389}
virtual uint32_t GetTickResolution() const =0
Get number of microseconds in one tick.

References __stk_forceinline, stk::IKernelService::GetInstance(), and stk::IKernelService::GetTickResolution().

Referenced by GetTicksFromMs(), osKernelGetTickFreq(), stk_tick_resolution(), and stk_ticks_from_ms().

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

◆ GetTicks()

Ticks stk::GetTicks ( )
inlinestatic

Get number of ticks elapsed since kernel start.

Note
ISR-safe.
Returns
Ticks.

Definition at line 452 of file stk_helper.h.

453{
455}
virtual Ticks GetTicks() const =0
Get number of ticks elapsed since kernel start.

References __stk_forceinline, stk::IKernelService::GetInstance(), and stk::IKernelService::GetTicks().

Referenced by stk::time::TimerHost::Timer::GetRemainingTicks(), osKernelGetTickCount(), stk::time::PeriodicTrigger::Poll(), stk::sync::Pipe::ReadBulkEx(), stk::sync::PipeT< Timer *, 32U >::ReadBulkEx(), stk::sync::Pipe::ReadBulkTriggeredEx(), stk::sync::Pipe::ReadEx(), stk::sync::PipeT< Timer *, 32U >::ReadEx(), stk::time::TimerHost::Reset(), stk::time::PeriodicTrigger::Restart(), stk::time::TimerHost::Restart(), anonymous_namespace{threadx_stk.cpp}::StkTimerThread::Run(), stk::time::TimerHost::Start(), stk::time::TimerHost::StartOrReset(), stk_ticks(), stk::memory::BlockMemoryPool::TimedAllocEx(), stk::memory::BytePool::TimedAllocEx(), stk::sync::RWMutex::TimedLockEx(), stk::sync::RWMutex::TimedReadLockEx(), tx_time_get(), tx_time_set(), tx_timer_activate(), tx_timer_info_get(), stk::time::TimerHost::UpdateTime(), stk::sync::EventFlags::Wait(), stk::sync::MessageQueue::WaitNotEmpty(), stk::sync::MessageQueue::WaitNotFull(), stk::sync::Pipe::WriteBulkEx(), stk::sync::PipeT< Timer *, 32U >::WriteBulkEx(), stk::sync::Pipe::WriteEx(), stk::sync::PipeT< Timer *, 32U >::WriteEx(), xTaskGetTickCount(), and xTaskGetTickCountFromISR().

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

◆ GetTicksFromMs() [1/2]

Ticks stk::GetTicksFromMs ( Time ms)
inlinestatic

Convert milliseconds to ticks using the current kernel tick resolution.

Parameters
[in]msTime in milliseconds to convert.
Returns
Equivalent tick count.
Note
Convenience overload that queries GetTickResolution() automatically. Use the two-argument form GetTicksFromMsec(ms, resolution) in ISR context.
Warning
ISR-unsafe (internally calls GetTickResolution() which accesses the kernel service).

Definition at line 427 of file stk_helper.h.

428{
429 return GetTicksFromMs(ms, GetTickResolution());
430}
static Ticks GetTicksFromMs(Time ms, uint32_t resolution)
Convert milliseconds to ticks.
Definition stk_helper.h:408
static uint32_t GetTickResolution()
Get number of microseconds in one tick.
Definition stk_helper.h:386

References __stk_forceinline, GetTickResolution(), and GetTicksFromMs().

Here is the call graph for this function:

◆ GetTicksFromMs() [2/2]

Ticks stk::GetTicksFromMs ( Time ms,
uint32_t resolution )
inlinestatic

Convert milliseconds to ticks.

Parameters
[in]msTime in milliseconds to convert.
[in]resolutionMicroseconds per tick, as returned by IKernelService::GetTickResolution().
Returns
Equivalent tick count.
Note
ISR-safe (performs only arithmetic, no kernel calls).

Definition at line 408 of file stk_helper.h.

409{
410 Ticks tick_count = 0LL;
411
412 if (resolution != 0U)
413 {
414 tick_count = static_cast<Ticks>((ms * 1000LL) / static_cast<Time>(resolution));
415 }
416
417 return tick_count;
418}
int64_t Ticks
Ticks value.
Definition stk_common.h:175

References __stk_forceinline.

Referenced by GetTicksFromMs(), and GetTicksFromMsClampedToTimeout().

Here is the caller graph for this function:

◆ GetTicksFromMsClampedToTimeout()

Timeout stk::GetTicksFromMsClampedToTimeout ( Timeout ms)
inlinestatic

Convert milliseconds to ticks and clamp the result to a Timeout type.

Parameters
[in]msTime in milliseconds to convert.
Returns
Equivalent tick count clamped to the maximum value allowed by Timeout (WAIT_INFINITE).
Note
ISR-unsafe (internally calls GetTickResolution() which accesses the kernel service).

Definition at line 437 of file stk_helper.h.

438{
439 const Time time_ms = static_cast<Time>(ms);
440 const Ticks tick_count = GetTicksFromMs(time_ms);
441
442 const Ticks final_ticks = (tick_count < static_cast<Ticks>(WAIT_INFINITE)) ?
443 tick_count : static_cast<Ticks>(WAIT_INFINITE);
444
445 return static_cast<Timeout>(final_ticks);
446}
int32_t Timeout
Timeout time (ticks).
Definition stk_common.h:170
static constexpr Timeout WAIT_INFINITE
Timeout value: block indefinitely until the synchronization object is signaled.
Definition stk_common.h:228

References __stk_forceinline, GetTicksFromMs(), and WAIT_INFINITE.

Referenced by DelayMs(), SleepMs(), stk_ticks_from_ms_clamped_to_timeout(), and stk::pthread::TimespecToRelativeTimeout().

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

◆ GetTid()

TId stk::GetTid ( )
inlinestatic

Get task/thread Id of the calling task.

Returns
Id of the calling task/thread.
Note
ISR-safe. When called from an ISR context, returns TID_ISR_N | exception_number (see TID_ISR_N) rather than asserting; use IsIsrTid() to test for this.
See also
TID_ISR_N, TID_NONE, IsIsrTid

Definition at line 376 of file stk_helper.h.

377{
379}
virtual TId GetTid() const =0
Get thread Id of the currently running task.

References __stk_forceinline, stk::IKernelService::GetInstance(), and stk::IKernelService::GetTid().

Referenced by StkFastMutex::Acquire(), anonymous_namespace{threadx_stk.cpp}::CurrentThread(), eTaskGetState(), stk::sync::SpinLock::Lock(), osMutexRelease(), osThreadGetId(), SetTimeSlice(), SetWeight(), stk_tid(), FrtosFastMutex::Take(), stk::sync::SpinLock::TryLock(), tx_mutex_put(), stk::sync::FastMutex::Unlock(), stk::sync::Mutex::Unlock(), stk::sync::SpinLock::Unlock(), uxTaskGetStackHighWaterMark(), uxTaskGetStackHighWaterMark2(), uxTaskGetSystemState(), uxTaskPriorityGet(), vTaskDelete(), vTaskList(), vTaskPrioritySet(), vTaskSuspend(), xSemaphoreGive(), xTaskAbortDelay(), and xTaskGetCurrentTaskHandle().

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

◆ GetTidFromUserTask()

constexpr TId stk::GetTidFromUserTask ( const ITask * task)
staticconstexprnoexcept

Get task identifier from ITask instance.

Returns
TId derived from the bound ITask pointer address (unique per task instance).
See also
GetUserTaskFromTid

Definition at line 716 of file stk_arch.h.

716{ return hw::PtrToWord(task); }
static constexpr Word PtrToWord(T *const ptr) noexcept
Cast a pointer to a CPU register-width integer.
Definition stk_arch.h:214

References stk::hw::PtrToWord().

Referenced by anonymous_namespace{threadx_stk.cpp}::EnsureTimerThread(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelTask::GetTid(), stk::Task< _StackSize, _AccessMode >::GetTid(), stk::TaskW< _Weight, _StackSize, _AccessMode >::GetTid(), stk_task_get_id(), tx_thread_preemption_change(), tx_thread_priority_change(), tx_thread_time_slice_change(), and tx_thread_wait_abort().

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

◆ GetTimeNowMs()

Time stk::GetTimeNowMs ( )
inlinestatic

Get current time in milliseconds since kernel start.

Returns
Milliseconds elapsed since IKernel::Start() was called.
Note
ISR-safe.
When the tick resolution is exactly 1000 µs (1 ms, the default PERIODICITY_DEFAULT), the tick count is returned directly without multiplication, avoiding a 64-bit multiply.

Definition at line 463 of file stk_helper.h.

464{
465 const IKernelService *const service = IKernelService::GetInstance();
466 const uint32_t resolution = service->GetTickResolution();
467 const Ticks tick_count = service->GetTicks();
468
469 return ((resolution == 1000U) ? tick_count :
470 ((tick_count * static_cast<Ticks>(resolution)) / 1000LL));
471}
Interface for the kernel services exposed to the user processes during run-time when Kernel started s...

References __stk_forceinline, stk::IKernelService::GetInstance(), stk::IKernelService::GetTickResolution(), and stk::IKernelService::GetTicks().

Referenced by stk_time_now_ms(), and stk::pthread::TimespecToRelativeTimeout().

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

◆ GetUserTaskFromTid()

◆ IsIsrTid()

constexpr bool stk::IsIsrTid ( TId id)
staticconstexpr

Test whether a task identifier represents an ISR context.

Returns true if tid was produced by GetTid() called from an interrupt service routine, i.e. its upper 20 bits match TID_ISR_N. Use this predicate instead of comparing against TID_ISR_N directly.

Parameters
[in]idTask identifier to test.
Returns
true if tid encodes an ISR context, false otherwise.
Note
ISR-safe (bitmask arithmetic only, no kernel calls).
See also
TID_ISR_N

Definition at line 263 of file stk_common.h.

263{ return ((id & TID_ISR_N) == TID_ISR_N); }
static constexpr TId TID_ISR_N
Bitmask sentinel for ISR-context task identifiers.
Definition stk_common.h:217

References TID_ISR_N.

Referenced by anonymous_namespace{threadx_stk.cpp}::ThreadFromTid().

Here is the caller graph for this function:

◆ Max()

template<typename T>
constexpr T stk::Max ( T a,
T b )
staticconstexprnoexcept

Compile-time maximum of two values.

Note
Arguments are evaluated exactly once, safe for any expression type.

Definition at line 759 of file stk_defs.h.

759{ return ((a > b) ? a : b); }

Referenced by stk::memory::BlockMemoryPool::AlignBlockSize(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelTask::GetSleepTicks(), and osThreadNew().

Here is the caller graph for this function:

◆ Min()

◆ SetTimeSlice() [1/2]

Timeout stk::SetTimeSlice ( TId tid,
Timeout ticks )
inlinestatic

Change the time-slice quantum of a task at run-time and reload its slice.

Parameters
[in]tidId of the task.
[in]ticksNew quantum (ticks), NO_TIME_SLICE disables time-slicing for the task.
Returns
Previous quantum (pass it back to restore).
Note
Requires stk::KERNEL_TIMESLICE, asserts otherwise.
Equivalent of ThreadX's tx_thread_time_slice_change.
See also
IKernelService::SetTimeSlice, ITask::GetTimeSlice

Definition at line 601 of file stk_helper.h.

602{
603 return IKernelService::GetInstance()->SetTimeSlice(tid, ticks);
604}
virtual Timeout SetTimeSlice(TId tid, Timeout ticks)=0
Change the time-slice quantum of the task at run-time and reload its slice.

References __stk_forceinline, stk::IKernelService::GetInstance(), and stk::IKernelService::SetTimeSlice().

Referenced by SetTimeSlice(), and tx_thread_time_slice_change().

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

◆ SetTimeSlice() [2/2]

Timeout stk::SetTimeSlice ( Timeout ticks)
inlinestatic

Change the time-slice quantum of the calling task at run-time and reload its slice.

Parameters
[in]ticksNew quantum (ticks), see SetTimeSlice(TId, Timeout).
Returns
Previous quantum.
Warning
ISR-unsafe (resolves the calling task via GetTid()).

Definition at line 611 of file stk_helper.h.

612{
613 return SetTimeSlice(GetTid(), ticks);
614}
static Timeout SetTimeSlice(TId tid, Timeout ticks)
Change the time-slice quantum of a task at run-time and reload its slice.
Definition stk_helper.h:601
static TId GetTid()
Get task/thread Id of the calling task.
Definition stk_helper.h:376

References __stk_forceinline, GetTid(), and SetTimeSlice().

Here is the call graph for this function:

◆ SetWeight() [1/2]

Weight stk::SetWeight ( TId tid,
Weight weight )
inlinestatic

Change the base scheduling weight of a task at run-time.

Parameters
[in]tidId of the task.
[in]weightNew base weight (must not be NO_WEIGHT, must be valid for the active strategy, e.g. built with SwitchStrategyPreemptionThreshold::MakeWeight).
Returns
Previous base weight (pass it back to restore).
Note
Requires a strategy with WEIGHT_API = 1 and PRIORITY_INHERITANCE_API = 1, asserts otherwise.
Takes the kernel critical section internally. Intended for task context.
See also
IKernelService::SetWeight, SwitchStrategyPreemptionThreshold::ChangeThreshold

Definition at line 574 of file stk_helper.h.

575{
576 return IKernelService::GetInstance()->SetWeight(tid, weight);
577}
virtual Weight SetWeight(TId tid, Weight weight)=0
Change the base weight of the task at run-time (replaces ITask::GetWeight() value).

References __stk_forceinline, stk::IKernelService::GetInstance(), and stk::IKernelService::SetWeight().

Referenced by SetWeight(), tx_thread_preemption_change(), and tx_thread_priority_change().

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

◆ SetWeight() [2/2]

Weight stk::SetWeight ( Weight weight)
inlinestatic

Change the base scheduling weight of the calling task at run-time.

Parameters
[in]weightNew base weight, see SetWeight(TId, Weight).
Returns
Previous base weight.
Note
Example (preemption-threshold, equivalent of ThreadX's tx_thread_preemption_change):
const Weight old = stk::SetWeight(SwitchStrategyPT32::MakeWeight(prio, new_threshold));
static Weight SetWeight(TId tid, Weight weight)
Change the base scheduling weight of a task at run-time.
Definition stk_helper.h:574
int32_t Weight
Weight value (aka priority).
Definition stk_common.h:190
static constexpr Weight MakeWeight(uint8_t priority, uint8_t threshold)
Warning
ISR-unsafe (resolves the calling task via GetTid()).

Definition at line 588 of file stk_helper.h.

589{
590 return SetWeight(GetTid(), weight);
591}

References __stk_forceinline, GetTid(), and SetWeight().

Here is the call graph for this function:

◆ Sleep()

void stk::Sleep ( Timeout tick_count)
inlinestatic

Put calling process into a sleep state.

Note
Unlike Delay this function does not waste CPU cycles and allows kernel to put CPU into a low-power state.
Unsupported in HRT mode (see stk::KERNEL_HRT); in HRT mode tasks sleep automatically according to their periodicity and workload.
Parameters
[in]tick_countSleep time (in ticks). 0 does not cause yield, use Yield instead. Negative will cause an assertion.
Warning
ISR-unsafe. Calling from an ISR context is not permitted and will trigger an assertion.

Definition at line 497 of file stk_helper.h.

498{
499 IKernelService::GetInstance()->Sleep(tick_count);
500}
virtual void Sleep(Timeout ticks)=0
Put calling process into a sleep state.

References __stk_forceinline, stk::IKernelService::GetInstance(), and stk::IKernelService::Sleep().

Referenced by osDelay(), osThreadJoin(), pthread_exit(), SleepMs(), stk_sleep(), tx_thread_sleep(), vTaskDelay(), and anonymous_namespace{threadx_stk.cpp}::WaitThreadRemoved().

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

◆ SleepCancel()

void stk::SleepCancel ( TId task_id)
inlinestatic

Cancel sleep of the task.

Parameters
[in]task_idId of the task.

Ends a sleep started by Sleep()/SleepUntil() early. If the task is instead blocked on a synchronization object (KERNEL_SYNC mode, e.g. Mutex, Semaphore, Event, ConditionVariable, MessageQueue), the wait is cancelled the same way as IKernel::CancelTaskWait() does: the task is removed from the object's wait list and its IKernelService::Wait() returns WAIT_RESULT_CANCELED (not WAIT_RESULT_TIMEOUT or WAIT_RESULT_SIGNAL, no resource is acquired or consumed).

Note
No-op if task was neither sleeping nor waiting on a synchronization object.
ISR-safe.

Definition at line 538 of file stk_helper.h.

539{
541}
virtual void SleepCancel(TId task_id)=0
Cancel sleep of the task.

References __stk_forceinline, stk::IKernelService::GetInstance(), and stk::IKernelService::SleepCancel().

Referenced by stk_sleep_cancel(), tx_thread_wait_abort(), and xTaskAbortDelay().

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

◆ SleepMs()

void stk::SleepMs ( Timeout ms)
inlinestatic

Put calling process into a sleep state.

Note
Unlike Delay this function does not waste CPU cycles and allows kernel to put CPU into a low-power state.
Unsupported in HRT mode (see stk::KERNEL_HRT); in HRT mode tasks sleep automatically according to their periodicity and workload.
Converts ms to ticks and calls IKernelService::SleepTicks() which schedules the calling task to sleep and spins until the kernel switches it back in.
Parameters
[in]msSleep time (milliseconds). 0 does not cause yield, use Yield instead. Negative will cause an assertion.
Warning
ISR-unsafe. Calling from an ISR context is not permitted and will trigger an assertion.

Definition at line 510 of file stk_helper.h.

511{
513}
static void Sleep(Timeout tick_count)
Put calling process into a sleep state.
Definition stk_helper.h:497

References __stk_forceinline, GetTicksFromMsClampedToTimeout(), and Sleep().

Referenced by stk_sleep_ms(), and stk::pthread::WaitForTaskExit().

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

◆ SleepUntil()

bool stk::SleepUntil ( Ticks timestamp)
inlinestatic

Put calling process into a sleep state until the specified timestamp.

Note
Unlike Delay this function does not waste CPU cycles and allows kernel to put CPU into a low-power state.
Unsupported in HRT mode (see stk::KERNEL_HRT); in HRT mode tasks sleep automatically according to their periodicity and workload.
Parameters
[in]timestampAbsolute timestamp (ticks). 0 does not cause yield, use Yield instead. Negative will cause an assertion.
Warning
ISR-unsafe. Calling from an ISR context is not permitted and will trigger an assertion.
Returns
True if sleep succeeded, false otherwise.

Definition at line 522 of file stk_helper.h.

523{
524 return IKernelService::GetInstance()->SleepUntil(timestamp);
525}
virtual bool SleepUntil(Ticks timestamp)=0
Put calling process into a sleep state until the specified timestamp.

References __stk_forceinline, stk::IKernelService::GetInstance(), and stk::IKernelService::SleepUntil().

Referenced by osDelayUntil(), stk_sleep_until(), and xTaskDelayUntil().

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

◆ STK_KERNEL_PANIC()

void stk::STK_KERNEL_PANIC ( stk::EKernelPanicId id)
inlinestatic

Called when the kernel detects an unrecoverable internal fault.

Note
Unlike STK_ASSERT (which checks preconditions) this macro is reached only when a runtime invariant has been irreversibly violated - the kernel cannot continue operating correctly from this point.
Default behaviour:
  • In debug builds: triggers a hardware breakpoint so a debugger can inspect state, then falls through to the safe-state handler.
  • In all builds: calls STK_PANIC_HANDLER(id) which must not return.
Override STK_PANIC_HANDLER by defining it before including this header or in stk_config.h. The handler receives a numeric id (EKernelPanicId) and must never return. A minimal safe default is provided below.
Parameters
[in]idEKernelPanicId value identifying the fault.

Definition at line 183 of file stk_arch.h.

184{
185 __stk_debug_break(); // debug aid
186 STK_PANIC_HANDLER(id); // must not return
187}
#define STK_PANIC_HANDLER(id)
Definition stk_arch.h:59
static void __stk_debug_break()
Definition stk_defs.h:479

References __stk_debug_break(), __stk_forceinline, and STK_PANIC_HANDLER.

Referenced by stk::sync::FastMutex::Lock(), stk::sync::Mutex::Lock(), stk::sync::RWMutex::Lock(), stk::sync::SpinLock::MakeLocked(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::OnStart(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::OnTaskExit(), stk::sync::RWMutex::ReadLock(), stk::sync::FastMutex::TimedLockEx(), stk::sync::Mutex::TimedLockEx(), stk::sync::RWMutex::TimedLockEx(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::UpdateFsmState(), and stk::pthread::WaitSignaled().

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

◆ Yield()

void stk::Yield ( )
inlinestatic

Notify scheduler to switch to the next runnable task.

A cooperative scheduling mechanism: the calling task voluntarily gives up the remainder of its time slice. Behavior depends on the kernel mode and the active strategy:

  • Non-HRT modes, strategy with NOSLEEP_YIELD_API = 1 (e.g. stk::SwitchStrategyRR_NSY): the task stays in the runnable set (it is NOT put to sleep) and the strategy hands the CPU to the next task according to its own policy. If no other task is eligible, the call returns almost immediately.
  • Non-HRT modes, strategy with NOSLEEP_YIELD_API = 0, or when the strategy declines the yield (e.g. the task is not in its runnable set): legacy yield, the task is put to sleep for one tick and is not scheduled during that tick, even if no other task is runnable.
  • HRT mode (see stk::KERNEL_HRT): signals completion of the current job and acts as a cooperation point. The task sleeps until its next period; NOSLEEP_YIELD_API is ignored.
    Note
    Not the same as Sleep(0), which does not cause a yield.
    Task context only. The call blocks (busy-waits) until the kernel has switched the task out.
    Warning
    ISR-unsafe. Calling from an ISR context is not permitted and will trigger an assertion.
    See also
    stk::ITaskSwitchStrategy::OnTaskYield, IKernelService::SwitchToNext

Definition at line 560 of file stk_helper.h.

561{
563}
virtual void SwitchToNext()=0
Notify scheduler to switch to the next task (yield).

References __stk_forceinline, stk::IKernelService::GetInstance(), and stk::IKernelService::SwitchToNext().

Referenced by osThreadExit(), osThreadYield(), pthread_yield(), stk_yield(), taskYIELD_impl(), tx_thread_relinquish(), tx_thread_terminate(), and vTaskEndScheduler().

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

Variable Documentation

◆ DEFAULT_WEIGHT

◆ NO_TIME_SLICE

◆ NO_WAIT

Timeout stk::NO_WAIT = 0
staticconstexpr

Timeout value: return immediately if the synchronization object is not yet signaled (non-blocking poll).

Note
Pass as the timeout argument to IKernelService::Wait().

Definition at line 234 of file stk_common.h.

Referenced by stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelTask::WaitObject::Cancel(), CmsisTimeoutToStk(), FrtosTimeoutToStk(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelTask::GetSleepTicks(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelTask::KernelTask(), stk::time::TimerHost::ProcessCommands(), stk::time::TimerHost::PushCommand(), stk::sync::Pipe::ReadBulkEx(), stk::sync::PipeT< Timer *, 32U >::ReadBulkEx(), stk::sync::Pipe::ReadBulkTriggeredEx(), stk::sync::Pipe::ReadEx(), stk::sync::PipeT< Timer *, 32U >::ReadEx(), StkWaitFailToCmsis(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelTask::WaitObject::Tick(), stk::memory::BlockMemoryPool::TimedAllocEx(), stk::memory::BytePool::TimedAllocEx(), stk::sync::FastMutex::TimedLockEx(), stk::sync::Mutex::TimedLockEx(), stk::sync::RWMutex::TimedLockEx(), stk::sync::RWMutex::TimedReadLockEx(), anonymous_namespace{threadx_stk.cpp}::ToStkTimeout(), stk::memory::BlockMemoryPool::TryAlloc(), stk::memory::BytePool::TryAlloc(), stk::memory::BlockMemoryPool::TryAllocT(), stk::memory::BytePool::TryAllocT(), stk::sync::MessageQueue::TryGet(), stk::sync::FastMutex::TryLock(), stk::sync::Mutex::TryLock(), stk::sync::RWMutex::TryLock(), stk::sync::MessageQueue::TryPeek(), stk::sync::MessageQueue::TryPeekFront(), stk::sync::MessageQueue::TryPut(), stk::sync::MessageQueue::TryPutFront(), stk::sync::Pipe::TryRead(), stk::sync::PipeT< Timer *, 32U >::TryRead(), stk::sync::Pipe::TryReadBulk(), stk::sync::PipeT< Timer *, 32U >::TryReadBulk(), stk::sync::Pipe::TryReadBulkTriggered(), stk::sync::RWMutex::TryReadLock(), stk::sync::EventFlags::TryWait(), stk::sync::Semaphore::TryWait(), stk::sync::Pipe::TryWrite(), stk::sync::PipeT< Timer *, 32U >::TryWrite(), stk::sync::Pipe::TryWriteBulk(), stk::sync::PipeT< Timer *, 32U >::TryWriteBulk(), stk::time::TimerHost::UpdateTime(), stk::sync::EventFlags::Wait(), stk::sync::ConditionVariable::WaitEx(), stk::sync::Event::WaitEx(), stk::sync::Semaphore::WaitEx(), stk::sync::MessageQueue::WaitNotEmpty(), stk::sync::MessageQueue::WaitNotFull(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelTask::WaitObject::WaitObject(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelTask::WaitObject::Wake(), stk::sync::Pipe::WriteBulkEx(), stk::sync::PipeT< Timer *, 32U >::WriteBulkEx(), stk::sync::Pipe::WriteEx(), stk::sync::PipeT< Timer *, 32U >::WriteEx(), xMessageBufferSend(), and xMessageBufferSendFromISR().

◆ NO_WEIGHT

◆ TID_ISR_N

TId stk::TID_ISR_N = static_cast<TId>(0xFFFFF000U)
staticconstexpr

Bitmask sentinel for ISR-context task identifiers.

The upper 20 bits of the TId space are reserved for ISR contexts. When GetTid() is called from an interrupt service routine, it returns TID_ISR_N | exception_number, where exception_number is the raw value:

// bits[31:12] = 0xFFFFF (this sentinel mask)
// bits[11:0] = exception number

This encoding guarantees uniqueness per exception, so two ISRs at different priority levels or with different exception numbers are never treated as the same owner by synchronization primitives.

Task TIds are word-aligned pointers. On all supported Cortex-M and RISC-V targets they fall in the range 0x00000000..0xEFFFFFFF, so no overlap with the 0xFFFFF000..0xFFFFFFFF sentinel range is possible.

Note
Use IsIsrTid() to test for this sentinel rather than comparing against this constant directly.
See also
IsIsrTid()

Definition at line 217 of file stk_common.h.

Referenced by IsIsrTid().

◆ TID_NONE

TId stk::TID_NONE = static_cast<TId>(0U)
staticconstexpr

Reserved task/thread id representing zero/none thread id.

Definition at line 222 of file stk_common.h.

Referenced by stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelTask::Bind(), anonymous_namespace{threadx_stk.cpp}::CurrentThread(), stk::sync::FastMutex::FastMutex(), anonymous_namespace{threadx_stk.cpp}::FillSuspended(), anonymous_namespace{threadx_stk.cpp}::FillSuspended(), stk::ISyncObject::GetFirstWaiterTid(), stk::sync::FastMutex::IsLocked(), stk::sync::Mutex::IsLocked(), stk::sync::SpinLock::MakeLocked(), stk::sync::Mutex::Mutex(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::OnInheritWeight(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::OnRestoreWeight(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::OnSetTimeSlice(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::OnSetWeight(), stk::sync::SpinLock::SpinLock(), FrtosFastMutex::Take(), anonymous_namespace{threadx_stk.cpp}::ThreadFromTid(), stk::sync::FastMutex::TimedLockEx(), stk::sync::Mutex::TimedLockEx(), stk::sync::FastMutex::Unlock(), stk::sync::Mutex::Unlock(), stk::sync::SpinLock::Unlock(), uxSemaphoreGetCount(), xSemaphoreGetMutexHolder(), xSemaphoreGetMutexHolderFromISR(), xSemaphoreGive(), and stk::sync::SpinLock::~SpinLock().

◆ WAIT_INFINITE

Timeout stk::WAIT_INFINITE = INT32_MAX
staticconstexpr

Timeout value: block indefinitely until the synchronization object is signaled.

Note
Pass as the timeout argument to IKernelService::Wait().

Definition at line 228 of file stk_common.h.

Referenced by stk::memory::BlockMemoryPool::Alloc(), stk::memory::BytePool::Alloc(), stk::memory::BlockMemoryPool::AllocT(), stk::memory::BytePool::AllocT(), CmsisTimeoutToStk(), FrtosTimeoutToStk(), stk::sync::MessageQueue::Get(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::GetTaskState(), GetTicksFromMsClampedToTimeout(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelTask::IsSleepInfinite(), stk::sync::FastMutex::Lock(), stk::sync::Mutex::Lock(), stk::sync::RWMutex::Lock(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::OnTaskSleepUntil(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::OnTaskWait(), osThreadJoin(), stk::sync::MessageQueue::Peek(), stk::sync::MessageQueue::PeekFront(), stk::time::TimerHost::ProcessCommands(), pthread_cond_wait(), pthread_exit(), stk::sync::MessageQueue::Put(), stk::sync::MessageQueue::PutFront(), stk::sync::Pipe::Read(), stk::sync::PipeT< Timer *, 32U >::Read(), stk::sync::Pipe::ReadBulk(), stk::sync::PipeT< Timer *, 32U >::ReadBulk(), stk::sync::Pipe::ReadBulkEx(), stk::sync::PipeT< Timer *, 32U >::ReadBulkEx(), stk::sync::Pipe::ReadBulkTriggered(), stk::sync::Pipe::ReadBulkTriggeredEx(), stk::sync::Pipe::ReadEx(), stk::sync::PipeT< Timer *, 32U >::ReadEx(), stk::sync::RWMutex::ReadLock(), stk::time::TimerHost::Restart(), anonymous_namespace{threadx_stk.cpp}::StkTimerThread::Run(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelTask::ScheduleRemoval(), stk::sync::RWMutex::ScopedTimedLock::ScopedTimedLock(), stk::sync::RWMutex::ScopedTimedReadMutex::ScopedTimedReadMutex(), stk::time::TimerHost::SetPeriod(), stk::time::TimerHost::Start(), stk::time::TimerHost::StartOrReset(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::SuspendTask(), anonymous_namespace{threadx_stk.cpp}::ThreadStateOf(), stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelTask::WaitObject::Tick(), stk::memory::BlockMemoryPool::TimedAllocEx(), stk::memory::BytePool::TimedAllocEx(), stk::sync::RWMutex::TimedLockEx(), stk::sync::RWMutex::TimedReadLockEx(), anonymous_namespace{threadx_stk.cpp}::ToStkTimeout(), tx_thread_time_slice_change(), tx_thread_wait_abort(), stk::time::TimerHost::UpdateTime(), stk::sync::Event::Wait(), stk::sync::EventFlags::Wait(), stk::sync::Semaphore::Wait(), stk::sync::Barrier::WaitEx(), stk::sync::MessageQueue::WaitNotEmpty(), stk::sync::MessageQueue::WaitNotFull(), stk::pthread::WaitSignaled(), stk::sync::Pipe::Write(), stk::sync::PipeT< Timer *, 32U >::Write(), stk::sync::Pipe::WriteBulk(), stk::sync::PipeT< Timer *, 32U >::WriteBulk(), stk::sync::Pipe::WriteBulkEx(), stk::sync::PipeT< Timer *, 32U >::WriteBulkEx(), stk::sync::Pipe::WriteEx(), stk::sync::PipeT< Timer *, 32U >::WriteEx(), stk::sync::EventFlags::~EventFlags(), stk::sync::MessageQueue::~MessageQueue(), and stk::sync::Pipe::~Pipe().