![]() |
SuperTinyKernel™ RTOS 1.05.3
Lightweight, high-performance, deterministic, bare-metal C++ RTOS for resource-constrained embedded systems. MIT Open Source License.
|
Pure C interface for C++ API of SuperTinyKernel (STK). More...
Classes | |
| struct | stk_mutex_mem_t |
| Opaque memory container for a Mutex instance. More... | |
| struct | stk_spinlock_mem_t |
| Opaque memory container for SpinLock object. More... | |
| struct | stk_cv_mem_t |
| Opaque memory container for a ConditionVariable instance. More... | |
| struct | stk_event_mem_t |
| Opaque memory container for an Event instance. More... | |
| struct | stk_sem_mem_t |
| Opaque memory container for a Semaphore instance. More... | |
| struct | stk_ef_mem_t |
| Opaque memory container for an EventFlags instance. More... | |
| struct | stk_pipe_mem_t |
| Opaque memory container for a Pipe instance. More... | |
| struct | stk_rwmutex_mem_t |
| Opaque memory container for an RWMutex instance. More... | |
Macros | |
| #define | STK_C_KERNEL_MAX_TASKS (4) |
| Maximum number of tasks per kernel instance (default: 4). | |
| #define | STK_C_CPU_COUNT (1) |
| Number of kernel instances / CPU cores supported (default: 1). | |
| #define | STK_SYNC_DEBUG_NAMES (0) |
| Enable names for synchronization primitives for debugging/tracing purpose. | |
| #define | STK_C_ASSERT(e) |
| Assertion macro used inside STK C bindings. | |
| #define | __stk_c_stack_attr |
| Stack attribute (applies required alignment). | |
| #define | STK_PERIODICITY_DEFAULT (1000U) |
| Default tick period (1 ms). | |
| #define | STK_WAIT_INFINITE (INT32_MAX) |
| Infinite timeout constant. | |
| #define | STK_NO_WAIT (0) |
| No timeout constant. | |
| #define | STK_TLS_GET(type) |
| Typed helper for getting TLS value. | |
| #define | STK_TLS_SET(ptr) |
| Typed helper for setting TLS value. | |
| #define | STK_MUTEX_IMPL_SIZE (10 + (STK_SYNC_DEBUG_NAMES ? 1 : 0)) |
| A memory size (multiples of stk_word_t) required for Mutex instance. | |
| #define | STK_SPINLOCK_IMPL_SIZE (1) |
| A memory size (multiples of stk_word_t) required for SpinLock instance. | |
| #define | STK_CV_IMPL_SIZE (7 + (STK_SYNC_DEBUG_NAMES ? 1 : 0)) |
| A memory size (multiples of stk_word_t) required for ConditionVariable instance. | |
| #define | STK_EVENT_IMPL_SIZE (8 + (STK_SYNC_DEBUG_NAMES ? 1 : 0)) |
| A memory size (multiples of stk_word_t) required for Event instance. | |
| #define | STK_SEM_IMPL_SIZE (8 + (STK_SYNC_DEBUG_NAMES ? 1 : 0)) |
| A memory size (multiples of stk_word_t) required for Semaphore instance. | |
| #define | STK_EF_OPT_WAIT_ANY (0x00000000U) |
| Options bitmask constants for stk_ef_wait() / stk_ef_trywait(). | |
| #define | STK_EF_OPT_WAIT_ALL (0x00000001U) |
| #define | STK_EF_OPT_NO_CLEAR (0x00000002U) |
| #define | STK_EF_ERROR_PARAMETER (0x80000001U) |
| Return-value error sentinels (bit 31 set indicates an error). | |
| #define | STK_EF_ERROR_TIMEOUT (0x80000002U) |
| #define | STK_EF_ERROR_ISR (0x80000004U) |
| #define | STK_EF_ERROR_MASK (0x80000000U) |
| #define | STK_EF_IMPL_SIZE (STK_CV_IMPL_SIZE + 1 + (STK_SYNC_DEBUG_NAMES ? 1 : 0)) |
| A memory size (multiples of stk_word_t) required for EventFlags instance. | |
| #define | STK_PIPE_SIZE 16 |
| Size of the Pipe: Pipe<stk_word_t, STK_PIPE_SIZE>. | |
| #define | STK_PIPE_IMPL_SIZE ((27 + (STK_SYNC_DEBUG_NAMES ? 3 : 0)) + STK_PIPE_SIZE) |
| A memory size (multiples of stk_word_t) required for Pipe instance. | |
| #define | STK_RWMUTEX_IMPL_SIZE (17 + (STK_SYNC_DEBUG_NAMES ? 3 : 0)) |
| A memory size (multiples of stk_word_t) required for RWMutex instance. | |
Typedefs | |
| typedef uintptr_t | stk_word_t |
| CPU register type. | |
| typedef stk_word_t | stk_tid_t |
| Task id. | |
| typedef struct stk_kernel_t | stk_kernel_t |
| Opaque handle to a kernel instance. | |
| typedef struct stk_task_t | stk_task_t |
| Opaque handle to a task instance. | |
| typedef void(* | stk_task_entry_t) (void *arg) |
| Task entry point function type. | |
| typedef enum _EKernelState | EKernelState |
| Kernel state. | |
| typedef struct stk_mutex_mem_t | stk_mutex_mem_t |
| Opaque memory container for a Mutex instance. | |
| typedef struct stk_mutex_t | stk_mutex_t |
| Opaque handle to a Mutex instance. | |
| typedef struct stk_spinlock_t | stk_spinlock_t |
| Opaque handle to a SpinLock instance. | |
| typedef struct stk_cv_mem_t | stk_cv_mem_t |
| Opaque memory container for a ConditionVariable instance. | |
| typedef struct stk_cv_t | stk_cv_t |
| Opaque handle to a Condition Variable instance. | |
| typedef struct stk_event_mem_t | stk_event_mem_t |
| Opaque memory container for an Event instance. | |
| typedef struct stk_event_t | stk_event_t |
| Opaque handle to an Event instance. | |
| typedef struct stk_sem_mem_t | stk_sem_mem_t |
| Opaque memory container for a Semaphore instance. | |
| typedef struct stk_sem_t | stk_sem_t |
| Opaque handle to a Semaphore instance. | |
| typedef struct stk_ef_mem_t | stk_ef_mem_t |
| Opaque memory container for an EventFlags instance. | |
| typedef struct stk_ef_t | stk_ef_t |
| Opaque handle to an EventFlags instance. | |
| typedef struct stk_pipe_mem_t | stk_pipe_mem_t |
| Opaque memory container for a Pipe instance. | |
| typedef struct stk_pipe_t | stk_pipe_t |
| Opaque handle to a Pipe instance. | |
| typedef struct stk_rwmutex_mem_t | stk_rwmutex_mem_t |
| Opaque memory container for an RWMutex instance. | |
| typedef struct stk_rwmutex_t | stk_rwmutex_t |
| Opaque handle to an RWMutex instance. | |
Enumerations | |
| enum | _EKernelState { STK_KERNEL_STATE_INACTIVE = 0 , STK_KERNEL_STATE_READY = 1 , STK_KERNEL_STATE_RUNNING = 2 } |
| Kernel state. More... | |
Functions | |
| stk_kernel_t * | stk_kernel_create (uint8_t core_nr) |
| Create kernel. | |
| void | stk_kernel_init (stk_kernel_t *k, uint32_t tick_period_us) |
| Initialize kernel with given tick period. | |
| void | stk_kernel_add_task (stk_kernel_t *k, stk_task_t *task) |
| Add task to non-HRT kernel (static or dynamic). | |
| void | stk_kernel_add_task_hrt (stk_kernel_t *k, stk_task_t *task, int32_t periodicity_ticks, int32_t deadline_ticks, int32_t start_delay_ticks) |
| Add task with HRT timing parameters (HRT kernels only). | |
| void | stk_kernel_remove_task (stk_kernel_t *k, stk_task_t *task) |
| Remove finished task from dynamic kernel. | |
| void | stk_kernel_start (stk_kernel_t *k) |
| Start the scheduler - never returns. | |
| EKernelState | stk_kernel_get_state (const stk_kernel_t *k) |
| Get state of the scheduler. | |
| bool | stk_kernel_is_schedulable (const stk_kernel_t *k) |
| Test whether currently configured task set is schedulable. | |
| stk_task_t * | stk_task_create_privileged (stk_task_entry_t entry, void *arg, stk_word_t *stack, uint32_t stack_size) |
| Create privileged-mode (kernel-mode) task. | |
| stk_task_t * | stk_task_create_user (stk_task_entry_t entry, void *arg, stk_word_t *stack, uint32_t stack_size) |
| Create user-mode task. | |
| void | stk_task_set_weight (stk_task_t *task, uint32_t weight) |
| Set task weight (used only by Smooth Weighted Round Robin). | |
| void | stk_task_set_priority (stk_task_t *task, uint8_t priority) |
| Set task priority (used only by Fixed Priority scheduler). | |
| void | stk_task_set_id (stk_task_t *task, uint32_t tid) |
| Assign application-defined task ID (for tracing/debugging). | |
| void | stk_task_set_name (stk_task_t *task, const char *tname) |
| Assign human-readable task name (for tracing/debugging). | |
| stk_tid_t | stk_tid (void) |
| Returns current task/thread ID (the value set by stk_task_set_id). | |
| int64_t | stk_ticks (void) |
| Returns number of ticks elapsed since kernel start. | |
| int32_t | stk_tick_resolution (void) |
| Returns how many microseconds correspond to one kernel tick. | |
| int64_t | stk_ticks_from_ms (int64_t msec) |
| Get ticks from milliseconds using current kernel tick resolution. | |
| static int64_t | stk_ticks_from_ms_r (int64_t msec, int32_t resolution) |
| Get ticks from milliseconds using an explicit tick resolution. | |
| int64_t | stk_time_now_ms (void) |
| Returns current time in milliseconds since kernel start. | |
| void | stk_delay (uint32_t ticks) |
| Busy-wait delay (other tasks continue to run). | |
| void | stk_delay_ms (uint32_t ms) |
| Busy-wait delay (other tasks continue to run). | |
| void | stk_sleep (uint32_t ticks) |
| Put current task to sleep (non-HRT kernels only). | |
| void | stk_sleep_ms (uint32_t ms) |
| Put current task to sleep (non-HRT kernels only). | |
| void | stk_sleep_until (int64_t ts) |
| Put current task to sleep (non-HRT kernels only). | |
| void | stk_yield (void) |
| Voluntarily give up CPU to another ready task (cooperative yield). | |
| void | stk_kernel_destroy (stk_kernel_t *k) |
| Destroy dynamic kernel instance (only when not running). | |
| void | stk_task_destroy (stk_task_t *task) |
| Destroy dynamically created task object. | |
| void * | stk_tls_get (void) |
| Get thread-local pointer (platform-specific slot). | |
| void | stk_tls_set (void *ptr) |
| Set thread-local pointer. | |
| void | stk_critical_section_enter (void) |
| Enter critical section — disable context switches on current core. | |
| void | stk_critical_section_exit (void) |
| Leave critical section — re-enable context switches. | |
| stk_mutex_t * | stk_mutex_create (stk_mutex_mem_t *memory, uint32_t memory_size) |
| Create a Mutex (using provided memory). | |
| void | stk_mutex_destroy (stk_mutex_t *mtx) |
| Destroy a Mutex. | |
| void | stk_mutex_lock (stk_mutex_t *mtx) |
| Lock the mutex. Blocks until available. | |
| bool | stk_mutex_trylock (stk_mutex_t *mtx) |
| Try locking the mutex. Does not block if already locked. | |
| void | stk_mutex_unlock (stk_mutex_t *mtx) |
| Unlock the mutex. | |
| bool | stk_mutex_timed_lock (stk_mutex_t *mtx, int32_t timeout) |
| Try to lock the mutex with a timeout. | |
| stk_spinlock_t * | stk_spinlock_create (stk_spinlock_mem_t *memory, uint32_t memory_size) |
| Create a recursive SpinLock. | |
| void | stk_spinlock_destroy (stk_spinlock_t *lock) |
| Destroy the SpinLock. | |
| void | stk_spinlock_lock (stk_spinlock_t *lock) |
| Acquire the SpinLock (recursive). | |
| bool | stk_spinlock_trylock (stk_spinlock_t *lock) |
| Attempt to acquire the SpinLock immediately. | |
| void | stk_spinlock_unlock (stk_spinlock_t *lock) |
| Release the SpinLock. | |
| stk_cv_t * | stk_cv_create (stk_cv_mem_t *memory, uint32_t memory_size) |
| Create a Condition Variable (using provided memory). | |
| void | stk_cv_destroy (stk_cv_t *cv) |
| Destroy a Condition Variable. | |
| bool | stk_cv_wait (stk_cv_t *cv, stk_mutex_t *mtx, int32_t timeout) |
| Wait for a signal on the condition variable. | |
| void | stk_cv_notify_one (stk_cv_t *cv) |
| Wake one task waiting on the condition variable. | |
| void | stk_cv_notify_all (stk_cv_t *cv) |
| Wake all tasks waiting on the condition variable. | |
| stk_event_t * | stk_event_create (stk_event_mem_t *memory, uint32_t memory_size, bool manual_reset) |
| Create an Event (using provided memory). | |
| void | stk_event_destroy (stk_event_t *ev) |
| Destroy an Event. | |
| bool | stk_event_wait (stk_event_t *ev, int32_t timeout) |
| Wait for the event to become signaled. | |
| bool | stk_event_trywait (stk_event_t *ev) |
| Wait for the event to become signaled. | |
| void | stk_event_set (stk_event_t *ev) |
| Set the event to signaled state. | |
| void | stk_event_reset (stk_event_t *ev) |
| Reset the event to non-signaled state. | |
| void | stk_event_pulse (stk_event_t *ev) |
| Pulse the event (signal then immediately reset). | |
| stk_sem_t * | stk_sem_create (stk_sem_mem_t *memory, uint32_t memory_size, uint32_t initial_count) |
| Create a Semaphore (using provided memory). | |
| void | stk_sem_destroy (stk_sem_t *sem) |
| Destroy a Semaphore. | |
| bool | stk_sem_wait (stk_sem_t *sem, int32_t timeout) |
| Wait for a semaphore resource. | |
| void | stk_sem_signal (stk_sem_t *sem) |
| Signal/Release a semaphore resource. | |
| static bool | stk_ef_is_error (uint32_t result) |
| Returns true if a value returned by stk_ef_set(), stk_ef_clear(), stk_ef_wait(), or stk_ef_trywait() is an error sentinel (bit 31 set). | |
| stk_ef_t * | stk_ef_create (stk_ef_mem_t *memory, uint32_t memory_size, uint32_t initial_flags) |
| Create an EventFlags object (using provided memory). | |
| void | stk_ef_destroy (stk_ef_t *ef) |
| Destroy an EventFlags object. | |
| uint32_t | stk_ef_set (stk_ef_t *ef, uint32_t flags) |
| Set one or more flags. | |
| uint32_t | stk_ef_clear (stk_ef_t *ef, uint32_t flags) |
| Clear one or more flags. | |
| uint32_t | stk_ef_get (stk_ef_t *ef) |
| Read the current flags word without modifying it. | |
| uint32_t | stk_ef_wait (stk_ef_t *ef, uint32_t flags, uint32_t options, int32_t timeout) |
| Wait for one or more flags to be set. | |
| uint32_t | stk_ef_trywait (stk_ef_t *ef, uint32_t flags, uint32_t options) |
| Non-blocking flag poll. | |
| stk_pipe_t * | stk_pipe_create (stk_pipe_mem_t *memory, uint32_t memory_size) |
| Create a Pipe (using provided memory). | |
| void | stk_pipe_destroy (stk_pipe_t *pipe) |
| Destroy a Pipe. | |
| bool | stk_pipe_write (stk_pipe_t *pipe, stk_word_t data, int32_t timeout) |
| Write data to the pipe. | |
| bool | stk_pipe_read (stk_pipe_t *pipe, stk_word_t *data, int32_t timeout) |
| Read data from the pipe. | |
| size_t | stk_pipe_write_bulk (stk_pipe_t *pipe, const stk_word_t *src, size_t count, int32_t timeout) |
| Write multiple elements to the pipe. | |
| size_t | stk_pipe_read_bulk (stk_pipe_t *pipe, stk_word_t *dst, size_t count, int32_t timeout) |
| Read multiple elements from the pipe. | |
| size_t | stk_pipe_get_size (stk_pipe_t *pipe) |
| Get current number of elements in the pipe. | |
| stk_rwmutex_t * | stk_rwmutex_create (stk_rwmutex_mem_t *memory, uint32_t memory_size) |
| Create an RWMutex (using provided memory). | |
| void | stk_rwmutex_destroy (stk_rwmutex_t *rw) |
| Destroy an RWMutex. | |
| void | stk_rwmutex_read_lock (stk_rwmutex_t *rw) |
| Acquire the lock for shared reading. Blocks until available. | |
| bool | stk_rwmutex_try_read_lock (stk_rwmutex_t *rw) |
| Try to acquire the read lock without blocking. | |
| bool | stk_rwmutex_timed_read_lock (stk_rwmutex_t *rw, int32_t timeout) |
| Try to acquire the read lock with a timeout. | |
| void | stk_rwmutex_read_unlock (stk_rwmutex_t *rw) |
| Release the shared reader lock. | |
| void | stk_rwmutex_lock (stk_rwmutex_t *rw) |
| Acquire the lock for exclusive writing. Blocks until available. | |
| bool | stk_rwmutex_trylock (stk_rwmutex_t *rw) |
| Try to acquire the write lock without blocking. | |
| bool | stk_rwmutex_timed_lock (stk_rwmutex_t *rw, int32_t timeout) |
| Try to acquire the write lock with a timeout. | |
| void | stk_rwmutex_unlock (stk_rwmutex_t *rw) |
| Release the exclusive writer lock. | |
Pure C interface for C++ API of SuperTinyKernel (STK).
| #define __stk_c_stack_attr |
Stack attribute (applies required alignment).
| #define STK_C_ASSERT | ( | e | ) |
| #define STK_C_CPU_COUNT (1) |
Number of kernel instances / CPU cores supported (default: 1).
Definition at line 51 of file stk_c.h.
Referenced by stk_timerhost_get().
| #define STK_C_KERNEL_MAX_TASKS (4) |
| #define STK_CV_IMPL_SIZE (7 + (STK_SYNC_DEBUG_NAMES ? 1 : 0)) |
A memory size (multiples of stk_word_t) required for ConditionVariable instance.
| #define STK_EF_ERROR_ISR (0x80000004U) |
| #define STK_EF_ERROR_MASK (0x80000000U) |
Mask for testing any error; bit 31 set means error
Definition at line 764 of file stk_c.h.
Referenced by stk_ef_is_error().
| #define STK_EF_ERROR_PARAMETER (0x80000001U) |
| #define STK_EF_ERROR_TIMEOUT (0x80000002U) |
| #define STK_EF_IMPL_SIZE (STK_CV_IMPL_SIZE + 1 + (STK_SYNC_DEBUG_NAMES ? 1 : 0)) |
A memory size (multiples of stk_word_t) required for EventFlags instance.
| #define STK_EF_OPT_NO_CLEAR (0x00000002U) |
| #define STK_EF_OPT_WAIT_ALL (0x00000001U) |
| #define STK_EF_OPT_WAIT_ANY (0x00000000U) |
Options bitmask constants for stk_ef_wait() / stk_ef_trywait().
Unblock when ANY requested bit is set (OR semantics, default)
| #define STK_EVENT_IMPL_SIZE (8 + (STK_SYNC_DEBUG_NAMES ? 1 : 0)) |
A memory size (multiples of stk_word_t) required for Event instance.
| #define STK_MUTEX_IMPL_SIZE (10 + (STK_SYNC_DEBUG_NAMES ? 1 : 0)) |
A memory size (multiples of stk_word_t) required for Mutex instance.
| #define STK_PERIODICITY_DEFAULT (1000U) |
| #define STK_PIPE_IMPL_SIZE ((27 + (STK_SYNC_DEBUG_NAMES ? 3 : 0)) + STK_PIPE_SIZE) |
A memory size (multiples of stk_word_t) required for Pipe instance.
| #define STK_PIPE_SIZE 16 |
| #define STK_RWMUTEX_IMPL_SIZE (17 + (STK_SYNC_DEBUG_NAMES ? 3 : 0)) |
A memory size (multiples of stk_word_t) required for RWMutex instance.
| #define STK_SEM_IMPL_SIZE (8 + (STK_SYNC_DEBUG_NAMES ? 1 : 0)) |
A memory size (multiples of stk_word_t) required for Semaphore instance.
| #define STK_SPINLOCK_IMPL_SIZE (1) |
A memory size (multiples of stk_word_t) required for SpinLock instance.
| #define STK_SYNC_DEBUG_NAMES (0) |
| #define STK_TLS_GET | ( | type | ) |
Typed helper for getting TLS value.
| #define STK_TLS_SET | ( | ptr | ) |
Typed helper for setting TLS value.
| #define STK_WAIT_INFINITE (INT32_MAX) |
| typedef enum _EKernelState EKernelState |
| typedef struct stk_cv_mem_t stk_cv_mem_t |
Opaque memory container for a ConditionVariable instance.
| typedef struct stk_cv_t stk_cv_t |
| typedef struct stk_ef_mem_t stk_ef_mem_t |
Opaque memory container for an EventFlags instance.
| typedef struct stk_ef_t stk_ef_t |
| typedef struct stk_event_mem_t stk_event_mem_t |
Opaque memory container for an Event instance.
| typedef struct stk_event_t stk_event_t |
| typedef struct stk_kernel_t stk_kernel_t |
Opaque handle to a kernel instance.
| typedef struct stk_mutex_mem_t stk_mutex_mem_t |
Opaque memory container for a Mutex instance.
| typedef struct stk_mutex_t stk_mutex_t |
| typedef struct stk_pipe_mem_t stk_pipe_mem_t |
Opaque memory container for a Pipe instance.
| typedef struct stk_pipe_t stk_pipe_t |
| typedef struct stk_rwmutex_mem_t stk_rwmutex_mem_t |
Opaque memory container for an RWMutex instance.
| typedef struct stk_rwmutex_t stk_rwmutex_t |
| typedef struct stk_sem_mem_t stk_sem_mem_t |
Opaque memory container for a Semaphore instance.
| typedef struct stk_sem_t stk_sem_t |
| typedef struct stk_spinlock_t stk_spinlock_t |
| typedef void(* stk_task_entry_t) (void *arg) |
Task entry point function type.
| [in] | arg | User-supplied argument (may be NULL) |
| typedef struct stk_task_t stk_task_t |
| typedef stk_word_t stk_tid_t |
Task id.
| typedef uintptr_t stk_word_t |
CPU register type.
| enum _EKernelState |
Kernel state.
| Enumerator | |
|---|---|
| STK_KERNEL_STATE_INACTIVE | not ready, stk_kernel_init() must be called |
| STK_KERNEL_STATE_READY | ready to start, stk_kernel_start() must be called |
| STK_KERNEL_STATE_RUNNING | initialized and running, stk_kernel_start() was called successfully |
Definition at line 268 of file stk_c.h.
| void stk_critical_section_enter | ( | void | ) |
Enter critical section — disable context switches on current core.
Definition at line 351 of file stk_c.cpp.
References stk::hw::CriticalSection::Enter().
| void stk_critical_section_exit | ( | void | ) |
Leave critical section — re-enable context switches.
Definition at line 356 of file stk_c.cpp.
References stk::hw::CriticalSection::Exit().
| stk_cv_t * stk_cv_create | ( | stk_cv_mem_t * | memory, |
| uint32_t | memory_size ) |
Create a Condition Variable (using provided memory).
| [in] | memory | Pointer to static memory container. |
| [in] | memory_size | Size of the container (must be >= sizeof(stk_cv_mem_t)). |
Definition at line 131 of file stk_c_sync.cpp.
References stk_cv_mem_t::data, and STK_ASSERT.
| void stk_cv_destroy | ( | stk_cv_t * | cv | ) |
Destroy a Condition Variable.
| [in] | cv | CV handle. |
Definition at line 142 of file stk_c_sync.cpp.
| void stk_cv_notify_all | ( | stk_cv_t * | cv | ) |
Wake all tasks waiting on the condition variable.
| [in] | cv | CV handle. |
Definition at line 163 of file stk_c_sync.cpp.
References stk_cv_t::handle, stk::sync::ConditionVariable::NotifyAll(), and STK_ASSERT.
| void stk_cv_notify_one | ( | stk_cv_t * | cv | ) |
Wake one task waiting on the condition variable.
| [in] | cv | CV handle. |
Definition at line 156 of file stk_c_sync.cpp.
References stk_cv_t::handle, stk::sync::ConditionVariable::NotifyOne(), and STK_ASSERT.
| bool stk_cv_wait | ( | stk_cv_t * | cv, |
| stk_mutex_t * | mtx, | ||
| int32_t | timeout ) |
Wait for a signal on the condition variable.
Atomically releases the mutex and suspends the task. The mutex is re-acquired before returning.
| [in] | cv | CV handle. |
| [in] | mtx | Locked mutex handle protecting the state. |
| [in] | timeout | Max time to wait (or STK_WAIT_INFINITE). |
Definition at line 148 of file stk_c_sync.cpp.
References stk_cv_t::handle, stk_mutex_t::handle, STK_ASSERT, and stk::sync::ConditionVariable::Wait().
| void stk_delay | ( | uint32_t | ticks | ) |
Busy-wait delay (other tasks continue to run).
| [in] | ticks | Ticks to delay. |
Definition at line 328 of file stk_c.cpp.
References stk::Delay().
| void stk_delay_ms | ( | uint32_t | ms | ) |
Busy-wait delay (other tasks continue to run).
| [in] | ms | Milliseconds to delay. |
Definition at line 330 of file stk_c.cpp.
References stk::DelayMs().
| uint32_t stk_ef_clear | ( | stk_ef_t * | ef, |
| uint32_t | flags ) |
Clear one or more flags.
Atomically clears the specified bits.
| [in] | ef | EventFlags handle. |
| [in] | flags | Bitmask of bits to clear. Must not be 0 and must not have bit 31 set. |
STK_EF_ERROR_PARAMETER on invalid input. Definition at line 307 of file stk_c_sync.cpp.
References stk::sync::EventFlags::Clear(), stk_ef_t::handle, and STK_ASSERT.
| stk_ef_t * stk_ef_create | ( | stk_ef_mem_t * | memory, |
| uint32_t | memory_size, | ||
| uint32_t | initial_flags ) |
Create an EventFlags object (using provided memory).
| [in] | memory | Pointer to static memory container. |
| [in] | memory_size | Size of the container (must be >= sizeof(stk_ef_mem_t)). |
| [in] | initial_flags | Initial value of the 32-bit flags word (bits 0..30 only; bit 31 is reserved and must not be set). |
Definition at line 284 of file stk_c_sync.cpp.
References stk_ef_mem_t::data, and STK_ASSERT.
| void stk_ef_destroy | ( | stk_ef_t * | ef | ) |
Destroy an EventFlags object.
| [in] | ef | EventFlags handle. |
Definition at line 294 of file stk_c_sync.cpp.
| uint32_t stk_ef_get | ( | stk_ef_t * | ef | ) |
Read the current flags word without modifying it.
| [in] | ef | EventFlags handle. |
Definition at line 314 of file stk_c_sync.cpp.
References stk::sync::EventFlags::Get(), stk_ef_t::handle, and STK_ASSERT.
|
inlinestatic |
Returns true if a value returned by stk_ef_set(), stk_ef_clear(), stk_ef_wait(), or stk_ef_trywait() is an error sentinel (bit 31 set).
< Mask for testing any error; bit 31 set means error
Definition at line 769 of file stk_c.h.
References STK_EF_ERROR_MASK.
| uint32_t stk_ef_set | ( | stk_ef_t * | ef, |
| uint32_t | flags ) |
Set one or more flags.
Atomically OR-sets the specified bits and wakes all current waiters so each can re-evaluate its own predicate.
| [in] | ef:EventFlags | handle. |
| [in] | flags | Bitmask of bits to set. Must not be 0 and must not have bit 31 set. |
STK_EF_ERROR_PARAMETER on invalid input. Definition at line 300 of file stk_c_sync.cpp.
References stk_ef_t::handle, stk::sync::EventFlags::Set(), and STK_ASSERT.
| uint32_t stk_ef_trywait | ( | stk_ef_t * | ef, |
| uint32_t | flags, | ||
| uint32_t | options ) |
Non-blocking flag poll.
Checks immediately whether the flag condition is satisfied. Clears matched bits on success unless STK_EF_OPT_NO_CLEAR is set.
| [in] | ef | EventFlags handle. |
| [in] | flags | Bitmask of flag bits to watch. |
| [in] | options | STK_EF_OPT_WAIT_ANY (default) or STK_EF_OPT_WAIT_ALL, optionally OR-ed with STK_EF_OPT_NO_CLEAR. |
STK_EF_ERROR_TIMEOUT immediately if the condition is not met. Definition at line 328 of file stk_c_sync.cpp.
References stk_ef_t::handle, STK_ASSERT, and stk::sync::EventFlags::TryWait().
| uint32_t stk_ef_wait | ( | stk_ef_t * | ef, |
| uint32_t | flags, | ||
| uint32_t | options, | ||
| int32_t | timeout ) |
Wait for one or more flags to be set.
Suspends the calling task until the requested flag condition is satisfied or the timeout expires. On success, matched bits are atomically cleared unless STK_EF_OPT_NO_CLEAR is set in options.
| [in] | ef | EventFlags handle. |
| [in] | flags | Bitmask of flag bits to watch. Must not be 0 and must not have bit 31 set. |
| [in] | options | Combination of STK_EF_OPT_WAIT_ANY / STK_EF_OPT_WAIT_ALL and optionally STK_EF_OPT_NO_CLEAR. |
| [in] | timeout | Maximum time to wait (ticks). Use STK_WAIT_INFINITE to block indefinitely, STK_NO_WAIT for a non-blocking poll. |
STK_EF_ERROR_* sentinel on failure. Always check stk_ef_is_error() before using the return value as a flags mask. STK_NO_WAIT, ISR-unsafe otherwise. Definition at line 321 of file stk_c_sync.cpp.
References stk_ef_t::handle, STK_ASSERT, and stk::sync::EventFlags::Wait().
| stk_event_t * stk_event_create | ( | stk_event_mem_t * | memory, |
| uint32_t | memory_size, | ||
| bool | manual_reset ) |
Create an Event (using provided memory).
| [in] | memory | Pointer to static memory container. |
| [in] | memory_size | Size of the container (must be >= sizeof(stk_event_mem_t)). |
| [in] | manual_reset | True for manual-reset, False for auto-reset. |
Definition at line 181 of file stk_c_sync.cpp.
References stk_event_mem_t::data, and STK_ASSERT.
| void stk_event_destroy | ( | stk_event_t * | ev | ) |
Destroy an Event.
| [in] | ev | Event handle. |
Definition at line 191 of file stk_c_sync.cpp.
| void stk_event_pulse | ( | stk_event_t * | ev | ) |
Pulse the event (signal then immediately reset).
| [in] | ev | Event handle. |
Definition at line 225 of file stk_c_sync.cpp.
References stk_event_t::handle, stk::sync::Event::Pulse(), and STK_ASSERT.
| void stk_event_reset | ( | stk_event_t * | ev | ) |
Reset the event to non-signaled state.
| [in] | ev | Event handle. |
Definition at line 218 of file stk_c_sync.cpp.
References stk_event_t::handle, stk::sync::Event::Reset(), and STK_ASSERT.
| void stk_event_set | ( | stk_event_t * | ev | ) |
Set the event to signaled state.
| [in] | ev | Event handle. |
Definition at line 211 of file stk_c_sync.cpp.
References stk_event_t::handle, stk::sync::Event::Set(), and STK_ASSERT.
| bool stk_event_trywait | ( | stk_event_t * | ev | ) |
Wait for the event to become signaled.
| [in] | ev | Event handle. |
Definition at line 204 of file stk_c_sync.cpp.
References stk_event_t::handle, STK_ASSERT, and stk::sync::Event::TryWait().
| bool stk_event_wait | ( | stk_event_t * | ev, |
| int32_t | timeout ) |
Wait for the event to become signaled.
| [in] | ev | Event handle. |
| [in] | timeout | Max time to wait in milliseconds. |
Definition at line 197 of file stk_c_sync.cpp.
References stk_event_t::handle, STK_ASSERT, and stk::sync::Event::Wait().
| void stk_kernel_add_task | ( | stk_kernel_t * | k, |
| stk_task_t * | task ) |
Add task to non-HRT kernel (static or dynamic).
| [in] | k | Kernel handle. |
| [in] | task | Task handle created with one of stk_task_create_* functions. |
Definition at line 225 of file stk_c.cpp.
References stk_task_t::handle, and STK_ASSERT.
| void stk_kernel_add_task_hrt | ( | stk_kernel_t * | k, |
| stk_task_t * | task, | ||
| int32_t | periodicity_ticks, | ||
| int32_t | deadline_ticks, | ||
| int32_t | start_delay_ticks ) |
Add task with HRT timing parameters (HRT kernels only).
| [in] | k | Kernel handle. |
| [in] | task | Task handle. |
| [in] | periodicity_ticks | Period in ticks. |
| [in] | deadline_ticks | Relative deadline in ticks. |
| [in] | start_delay_ticks | Initial offset / phase in ticks (>= 0). |
Definition at line 241 of file stk_c.cpp.
References stk_task_t::handle, and STK_ASSERT.
| stk_kernel_t * stk_kernel_create | ( | uint8_t | core_nr | ) |
Create kernel.
| [in] | core_nr | CPU core number (starts with 0). Max: 7 (for 8 cores). |
Definition at line 153 of file stk_c.cpp.
References STK_KERNEL_CASE.
| void stk_kernel_destroy | ( | stk_kernel_t * | k | ) |
Destroy dynamic kernel instance (only when not running).
| [in] | k | Kernel handle. |
Definition at line 186 of file stk_c.cpp.
References STK_ASSERT.
| EKernelState stk_kernel_get_state | ( | const stk_kernel_t * | k | ) |
Get state of the scheduler.
| [in] | k | Kernel handle. |
Definition at line 210 of file stk_c.cpp.
References stk::IKernel::GetState(), and STK_ASSERT.
| void stk_kernel_init | ( | stk_kernel_t * | k, |
| uint32_t | tick_period_us ) |
Initialize kernel with given tick period.
| [in] | k | Kernel handle. |
| [in] | tick_period_us | System tick period in microseconds (usually 100–10000). |
Definition at line 196 of file stk_c.cpp.
References STK_ASSERT.
| bool stk_kernel_is_schedulable | ( | const stk_kernel_t * | k | ) |
Test whether currently configured task set is schedulable.
| [in] | k | Kernel handle. |
Definition at line 217 of file stk_c.cpp.
References stk::SchedulabilityCheck::IsSchedulableWCRT(), and STK_ASSERT.
| void stk_kernel_remove_task | ( | stk_kernel_t * | k, |
| stk_task_t * | task ) |
Remove finished task from dynamic kernel.
| [in] | k | Kernel handle. |
| [in] | task | Task that has already returned from its entry function. |
Definition at line 233 of file stk_c.cpp.
References stk_task_t::handle, and STK_ASSERT.
| void stk_kernel_start | ( | stk_kernel_t * | k | ) |
Start the scheduler - never returns.
| [in] | k | Kernel handle. |
Definition at line 203 of file stk_c.cpp.
References STK_ASSERT.
| stk_mutex_t * stk_mutex_create | ( | stk_mutex_mem_t * | memory, |
| uint32_t | memory_size ) |
Create a Mutex (using provided memory).
| [in] | memory | Pointer to static memory container. |
| [in] | memory_size | Size of the container (must be >= sizeof(stk_mutex_mem_t)). |
Definition at line 36 of file stk_c_sync.cpp.
References stk_mutex_mem_t::data, and STK_ASSERT.
| void stk_mutex_destroy | ( | stk_mutex_t * | mtx | ) |
Destroy a Mutex.
| [in] | mtx | Mutex handle. |
Definition at line 47 of file stk_c_sync.cpp.
| void stk_mutex_lock | ( | stk_mutex_t * | mtx | ) |
Lock the mutex. Blocks until available.
| [in] | mtx | Mutex handle. |
Definition at line 53 of file stk_c_sync.cpp.
References stk_mutex_t::handle, stk::sync::Mutex::Lock(), and STK_ASSERT.
| bool stk_mutex_timed_lock | ( | stk_mutex_t * | mtx, |
| int32_t | timeout ) |
Try to lock the mutex with a timeout.
| [in] | mtx | Mutex handle. |
| [in] | timeout | Max time to wait in milliseconds. |
Definition at line 74 of file stk_c_sync.cpp.
References stk_mutex_t::handle, STK_ASSERT, and stk::sync::Mutex::TimedLock().
| bool stk_mutex_trylock | ( | stk_mutex_t * | mtx | ) |
Try locking the mutex. Does not block if already locked.
| [in] | mtx | Mutex handle. |
Definition at line 60 of file stk_c_sync.cpp.
References stk_mutex_t::handle, STK_ASSERT, and stk::sync::Mutex::TryLock().
| void stk_mutex_unlock | ( | stk_mutex_t * | mtx | ) |
Unlock the mutex.
| [in] | mtx | Mutex handle. |
Definition at line 67 of file stk_c_sync.cpp.
References stk_mutex_t::handle, STK_ASSERT, and stk::sync::Mutex::Unlock().
| stk_pipe_t * stk_pipe_create | ( | stk_pipe_mem_t * | memory, |
| uint32_t | memory_size ) |
Create a Pipe (using provided memory).
| [in] | memory | Pointer to static memory container. |
| [in] | memory_size | Size of the container (must be >= sizeof(stk_pipe_mem_t)). |
Definition at line 345 of file stk_c_sync.cpp.
References stk_pipe_mem_t::data, and STK_ASSERT.
| void stk_pipe_destroy | ( | stk_pipe_t * | pipe | ) |
Destroy a Pipe.
| [in] | pipe | Pipe handle. |
Definition at line 355 of file stk_c_sync.cpp.
| size_t stk_pipe_get_size | ( | stk_pipe_t * | pipe | ) |
Get current number of elements in the pipe.
| [in] | pipe | Pipe handle. |
Definition at line 390 of file stk_c_sync.cpp.
References stk::sync::Pipe< T, N >::GetSize(), stk_pipe_t::handle, and STK_ASSERT.
| bool stk_pipe_read | ( | stk_pipe_t * | pipe, |
| stk_word_t * | data, | ||
| int32_t | timeout ) |
Read data from the pipe.
| [in] | pipe | Pipe handle. |
| [out] | data | Pointer to variable receiving the data. |
| [in] | timeout | Max time to wait in milliseconds. |
Definition at line 368 of file stk_c_sync.cpp.
References stk_pipe_t::handle, stk::sync::Pipe< T, N >::Read(), and STK_ASSERT.
| size_t stk_pipe_read_bulk | ( | stk_pipe_t * | pipe, |
| stk_word_t * | dst, | ||
| size_t | count, | ||
| int32_t | timeout ) |
Read multiple elements from the pipe.
| [in] | pipe | Pipe handle. |
| [out] | dst | Pointer to destination array. |
| [in] | count | Number of elements to read. |
| [in] | timeout | Max time to wait in milliseconds. |
Definition at line 383 of file stk_c_sync.cpp.
References stk_pipe_t::handle, stk::sync::Pipe< T, N >::ReadBulk(), and STK_ASSERT.
| bool stk_pipe_write | ( | stk_pipe_t * | pipe, |
| stk_word_t | data, | ||
| int32_t | timeout ) |
Write data to the pipe.
| [in] | pipe | Pipe handle. |
| [in] | data | Value to write. |
| [in] | timeout | Max time to wait in milliseconds. |
Definition at line 361 of file stk_c_sync.cpp.
References stk_pipe_t::handle, STK_ASSERT, and stk::sync::Pipe< T, N >::Write().
| size_t stk_pipe_write_bulk | ( | stk_pipe_t * | pipe, |
| const stk_word_t * | src, | ||
| size_t | count, | ||
| int32_t | timeout ) |
Write multiple elements to the pipe.
| [in] | pipe | Pipe handle. |
| [in] | src | Pointer to source array. |
| [in] | count | Number of elements to write. |
| [in] | timeout | Max time to wait in milliseconds. |
Definition at line 376 of file stk_c_sync.cpp.
References stk_pipe_t::handle, STK_ASSERT, and stk::sync::Pipe< T, N >::WriteBulk().
| stk_rwmutex_t * stk_rwmutex_create | ( | stk_rwmutex_mem_t * | memory, |
| uint32_t | memory_size ) |
Create an RWMutex (using provided memory).
| [in] | memory | Pointer to static memory container. |
| [in] | memory_size | Size of the container (must be >= sizeof(stk_rwmutex_mem_t)). |
Definition at line 405 of file stk_c_sync.cpp.
References stk_rwmutex_mem_t::data, and STK_ASSERT.
| void stk_rwmutex_destroy | ( | stk_rwmutex_t * | rw | ) |
Destroy an RWMutex.
| [in] | rw | RWMutex handle. |
Definition at line 415 of file stk_c_sync.cpp.
| void stk_rwmutex_lock | ( | stk_rwmutex_t * | rw | ) |
Acquire the lock for exclusive writing. Blocks until available.
Blocks until all active readers have released their locks and no other writer is active.
| [in] | rw | RWMutex handle. |
Definition at line 449 of file stk_c_sync.cpp.
References stk_rwmutex_t::handle, stk::sync::RWMutex::Lock(), and STK_ASSERT.
| void stk_rwmutex_read_lock | ( | stk_rwmutex_t * | rw | ) |
Acquire the lock for shared reading. Blocks until available.
Blocks if a writer is currently active or writers are waiting (Writer Preference Policy).
| [in] | rw | RWMutex handle. |
Definition at line 421 of file stk_c_sync.cpp.
References stk_rwmutex_t::handle, stk::sync::RWMutex::ReadLock(), and STK_ASSERT.
| void stk_rwmutex_read_unlock | ( | stk_rwmutex_t * | rw | ) |
Release the shared reader lock.
If this is the last active reader, waiting writers are notified.
| [in] | rw | RWMutex handle. |
Definition at line 442 of file stk_c_sync.cpp.
References stk_rwmutex_t::handle, stk::sync::RWMutex::ReadUnlock(), and STK_ASSERT.
| bool stk_rwmutex_timed_lock | ( | stk_rwmutex_t * | rw, |
| int32_t | timeout ) |
Try to acquire the write lock with a timeout.
| [in] | rw | RWMutex handle. |
| [in] | timeout | Max time to wait (ticks). Use STK_NO_WAIT for non-blocking. |
Definition at line 463 of file stk_c_sync.cpp.
References stk_rwmutex_t::handle, STK_ASSERT, and stk::sync::RWMutex::TimedLock().
| bool stk_rwmutex_timed_read_lock | ( | stk_rwmutex_t * | rw, |
| int32_t | timeout ) |
Try to acquire the read lock with a timeout.
| [in] | rw | RWMutex handle. |
| [in] | timeout | Max time to wait (ticks). Use STK_NO_WAIT for non-blocking. |
Definition at line 435 of file stk_c_sync.cpp.
References stk_rwmutex_t::handle, STK_ASSERT, and stk::sync::RWMutex::TimedReadLock().
| bool stk_rwmutex_try_read_lock | ( | stk_rwmutex_t * | rw | ) |
Try to acquire the read lock without blocking.
| [in] | rw | RWMutex handle. |
Definition at line 428 of file stk_c_sync.cpp.
References stk_rwmutex_t::handle, STK_ASSERT, and stk::sync::RWMutex::TryReadLock().
| bool stk_rwmutex_trylock | ( | stk_rwmutex_t * | rw | ) |
Try to acquire the write lock without blocking.
| [in] | rw | RWMutex handle. |
Definition at line 456 of file stk_c_sync.cpp.
References stk_rwmutex_t::handle, STK_ASSERT, and stk::sync::RWMutex::TryLock().
| void stk_rwmutex_unlock | ( | stk_rwmutex_t * | rw | ) |
Release the exclusive writer lock.
Prioritizes waking waiting writers. If none are waiting, all waiting readers are woken (Writer Preference Policy).
| [in] | rw | RWMutex handle. |
Definition at line 470 of file stk_c_sync.cpp.
References stk_rwmutex_t::handle, STK_ASSERT, and stk::sync::RWMutex::Unlock().
| stk_sem_t * stk_sem_create | ( | stk_sem_mem_t * | memory, |
| uint32_t | memory_size, | ||
| uint32_t | initial_count ) |
Create a Semaphore (using provided memory).
| [in] | memory | Pointer to static memory container. |
| [in] | memory_size | Size of the container (must be >= sizeof(stk_sem_mem_t)). |
| [in] | initial_count | Starting value of the resource counter. |
Definition at line 243 of file stk_c_sync.cpp.
References stk_sem_mem_t::data, and STK_ASSERT.
| void stk_sem_destroy | ( | stk_sem_t * | sem | ) |
Destroy a Semaphore.
| [in] | sem | Semaphore handle. |
Definition at line 253 of file stk_c_sync.cpp.
| void stk_sem_signal | ( | stk_sem_t * | sem | ) |
Signal/Release a semaphore resource.
| [in] | sem | Semaphore handle. |
Definition at line 266 of file stk_c_sync.cpp.
References stk_sem_t::handle, stk::sync::Semaphore::Signal(), and STK_ASSERT.
| bool stk_sem_wait | ( | stk_sem_t * | sem, |
| int32_t | timeout ) |
Wait for a semaphore resource.
| [in] | sem | Semaphore handle. |
| [in] | timeout | Max time to wait in milliseconds. |
Definition at line 259 of file stk_c_sync.cpp.
References stk_sem_t::handle, STK_ASSERT, and stk::sync::Semaphore::Wait().
| void stk_sleep | ( | uint32_t | ticks | ) |
Put current task to sleep (non-HRT kernels only).
| [in] | ms | Ticks to sleep. |
Definition at line 329 of file stk_c.cpp.
References stk::Sleep().
| void stk_sleep_ms | ( | uint32_t | ms | ) |
Put current task to sleep (non-HRT kernels only).
| [in] | ms | Milliseconds to sleep. |
Definition at line 331 of file stk_c.cpp.
References stk::SleepMs().
| void stk_sleep_until | ( | int64_t | ts | ) |
Put current task to sleep (non-HRT kernels only).
| [in] | ts | Absolute time, a deadline for a sleep period. |
Definition at line 332 of file stk_c.cpp.
References stk::SleepUntil().
| stk_spinlock_t * stk_spinlock_create | ( | stk_spinlock_mem_t * | memory, |
| uint32_t | memory_size ) |
Create a recursive SpinLock.
| [in] | memory | Pointer to static memory container. |
| [in] | memory_size | Size of the container (must be >= sizeof(stk_spinlock_mem_t)). |
Definition at line 89 of file stk_c_sync.cpp.
References stk_spinlock_mem_t::data, and STK_ASSERT.
| void stk_spinlock_destroy | ( | stk_spinlock_t * | lock | ) |
Destroy the SpinLock.
Definition at line 99 of file stk_c_sync.cpp.
| void stk_spinlock_lock | ( | stk_spinlock_t * | lock | ) |
Acquire the SpinLock (recursive).
Definition at line 105 of file stk_c_sync.cpp.
References stk_spinlock_t::handle, stk::sync::SpinLock::Lock(), and STK_ASSERT.
| bool stk_spinlock_trylock | ( | stk_spinlock_t * | lock | ) |
Attempt to acquire the SpinLock immediately.
Definition at line 111 of file stk_c_sync.cpp.
References stk_spinlock_t::handle, STK_ASSERT, and stk::sync::SpinLock::TryLock().
| void stk_spinlock_unlock | ( | stk_spinlock_t * | lock | ) |
Release the SpinLock.
Definition at line 117 of file stk_c_sync.cpp.
References stk_spinlock_t::handle, STK_ASSERT, and stk::sync::SpinLock::Unlock().
| stk_task_t * stk_task_create_privileged | ( | stk_task_entry_t | entry, |
| void * | arg, | ||
| stk_word_t * | stack, | ||
| uint32_t | stack_size ) |
Create privileged-mode (kernel-mode) task.
| [in] | entry | Task entry function. |
| [in] | arg | Argument passed to entry function. |
| [in] | stack | Pointer to stack buffer (array of stk_word_t). |
| [in] | stack_size | Number of elements (words) in the stack buffer. |
Definition at line 260 of file stk_c.cpp.
References stk::ACCESS_PRIVILEGED, AllocateTask(), and STK_ASSERT.
| stk_task_t * stk_task_create_user | ( | stk_task_entry_t | entry, |
| void * | arg, | ||
| stk_word_t * | stack, | ||
| uint32_t | stack_size ) |
Create user-mode task.
| [in] | entry | Task entry function. |
| [in] | arg | Argument passed to entry function. |
| [in] | stack | Pointer to stack buffer (array of stk_word_t). |
| [in] | stack_size | Number of elements (words) in the stack buffer. |
Definition at line 272 of file stk_c.cpp.
References stk::ACCESS_USER, AllocateTask(), and STK_ASSERT.
| void stk_task_destroy | ( | stk_task_t * | task | ) |
Destroy dynamically created task object.
| [in] | task | Task handle. |
Definition at line 313 of file stk_c.cpp.
References FreeTask(), and STK_ASSERT.
| void stk_task_set_id | ( | stk_task_t * | task, |
| uint32_t | tid ) |
Assign application-defined task ID (for tracing/debugging).
| [in] | task | Task handle. |
| [in] | tid | Arbitrary 32-bit task identifier. |
Definition at line 299 of file stk_c.cpp.
References stk_task_t::handle, TaskWrapper::SetId(), and STK_ASSERT.
| void stk_task_set_name | ( | stk_task_t * | task, |
| const char * | tname ) |
Assign human-readable task name (for tracing/debugging).
| [in] | task | Task handle. |
| [in] | tname | Null-terminated string (may be NULL). |
Definition at line 306 of file stk_c.cpp.
References stk_task_t::handle, TaskWrapper::SetName(), and STK_ASSERT.
| void stk_task_set_priority | ( | stk_task_t * | task, |
| uint8_t | priority ) |
Set task priority (used only by Fixed Priority scheduler).
| [in] | task | Task handle. |
| [in] | priority | Priority level [0 = lowest … 31 = highest]. |
Definition at line 292 of file stk_c.cpp.
References STK_ASSERT, and stk_task_set_weight().
| void stk_task_set_weight | ( | stk_task_t * | task, |
| uint32_t | weight ) |
Set task weight (used only by Smooth Weighted Round Robin).
| [in] | task | Task handle. |
| [in] | weight | Positive weight value (recommended 1–16777215). |
Definition at line 284 of file stk_c.cpp.
References stk_task_t::handle, TaskWrapper::SetWeight(), and STK_ASSERT.
Referenced by stk_task_set_priority().
| int32_t stk_tick_resolution | ( | void | ) |
Returns how many microseconds correspond to one kernel tick.
Definition at line 325 of file stk_c.cpp.
References stk::GetTickResolution().
| int64_t stk_ticks | ( | void | ) |
Returns number of ticks elapsed since kernel start.
Definition at line 324 of file stk_c.cpp.
References stk::GetTicks().
| int64_t stk_ticks_from_ms | ( | int64_t | msec | ) |
Get ticks from milliseconds using current kernel tick resolution.
| [in] | msec | Milliseconds to convert. |
Definition at line 327 of file stk_c.cpp.
References stk::GetTickResolution(), and stk_ticks_from_ms_r().
|
inlinestatic |
Get ticks from milliseconds using an explicit tick resolution.
| [in] | msec | Milliseconds to convert. |
| [in] | resolution | Microseconds per tick (see stk_tick_resolution()). |
Definition at line 378 of file stk_c.h.
Referenced by stk_ticks_from_ms().
| stk_tid_t stk_tid | ( | void | ) |
Returns current task/thread ID (the value set by stk_task_set_id).
Definition at line 323 of file stk_c.cpp.
References stk::GetTid().
| int64_t stk_time_now_ms | ( | void | ) |
Returns current time in milliseconds since kernel start.
Definition at line 326 of file stk_c.cpp.
References stk::GetTimeNowMs().
| void * stk_tls_get | ( | void | ) |
Get thread-local pointer (platform-specific slot).
Definition at line 338 of file stk_c.cpp.
References stk::hw::GetTlsPtr().
| void stk_tls_set | ( | void * | ptr | ) |
Set thread-local pointer.
| [in] | ptr | Pointer value to store for the current task/thread. |
Definition at line 343 of file stk_c.cpp.
References stk::hw::SetTlsPtr().
| void stk_yield | ( | void | ) |
Voluntarily give up CPU to another ready task (cooperative yield).
Definition at line 333 of file stk_c.cpp.
References stk::Yield().