28 class CmseISyncObjectWrapper;
408#if STK_MPU && STK_MPU_STACK_GUARD
409template <u
int8_t REGIONS_COUNT>
419 static constexpr uint8_t NUM_REGIONS = REGIONS_COUNT;
434typedef ArrayView<const struct MpuRegionConfig> MpuRegionList;
449 static constexpr uint32_t MPU_OFF = 0U;
460 MpuConfig(
const MpuRegionList ®ions_, uint32_t mode_) : regions(regions_), mode(mode_)
463 MpuRegionList regions;
476#if STK_MPU && STK_MPU_STACK_GUARD
478 #ifdef _STK_CORTEX_M_TRUSTZONE
482#if STK_TLS && !STK_TLS_PREFER_REGISTER
485#if STK_STACK_NEEDS_TASK_ID
514 const size_t total_size = stack.
GetSize();
517 for (
size_t i = 0U; i < total_size; ++i)
578 virtual void Wake(
bool timeout) = 0;
608#if STK_SYNC_DEBUG_NAMES
619 #if STK_SYNC_DEBUG_NAMES
631 #if STK_SYNC_DEBUG_NAMES
644#if STK_SYNC_DEBUG_NAMES
645 const char *m_trace_name;
909 virtual IStackMemory *GetSecureStackMemory() {
return nullptr; }
956 virtual const MpuRegionList *GetMpuRegions()
const
1172 #
if STK_TICKLESS_IDLE
1240 virtual const MpuConfig *OnConfigureMpu()
const
1743 template <
size_t TMaxCount,
typename TCallback>
1748 ITask *tasks[TMaxCount] = {};
1751 bool fetch_next =
true;
1753 while ((i < count) && fetch_next)
1755 fetch_next = callback(tasks[i]);
Compiler and platform low-level definitions for STK.
#define STK_UNUSED(X)
Explicitly marks a variable as unused to suppress compiler warnings.
#define __stk_forceinline
Forces compiler to always inline the decorated function, regardless of optimisation level.
#define STK_NONCOPYABLE_CLASS(TYPE)
Deletes (= delete) the copy constructor and copy assignment operator of a class.
#define STK_ASSERT(e)
Runtime assertion. Halts execution if the expression e evaluates to false.
#define STK_STACK_SIZE_MIN
Minimum stack size in elements of Word, shared by all stack allocation lower-bound checks.
#define STK_STACK_MEMORY_FILLER
Sentinel value written to the entire stack region at initialization (stack watermark pattern).
#define STK_STATIC_ASSERT(X)
Compile-time assertion. Produces a compilation error if X is false.
Intrusive doubly-linked list implementation used internally by the kernel.
Namespace of STK package.
uintptr_t Word
Native processor word type.
static constexpr TId TID_ISR_N
Bitmask sentinel for ISR-context task identifiers.
ESuspendResult
Result of IKernel::SuspendTask().
@ SUSPEND_DONE
Task was runnable and is suspended now.
@ SUSPEND_DEFERRED
Task is sleeping/waiting: it will be suspended when the sleep/wait ends (wait result is preserved).
@ SUSPEND_ALREADY
Task is already suspended or already has a deferred suspension pending.
@ SUSPEND_FAIL
Task is not bound to the kernel, or is exiting.
EAccessMode
Hardware access modes by the task.
@ ACCESS_USER
Unprivileged access mode (access to some hardware is restricted, see CPU manual for details)....
@ ACCESS_PRIVILEGED
Privileged access mode (access to hardware is fully unrestricted).
@ ACCESS_SECURE
Secure access mode (ARM TrustZone, Secure binary).
static constexpr Timeout NO_WAIT
Timeout value: return immediately if the synchronization object is not yet signaled (non-blocking pol...
EAddResult
Result of IKernel::AddTask() (both the Soft Real-Time and the Hard Real-Time overloads).
@ ADD_FAIL_POOL_FULL
No free kernel slot left (TASKS_MAX reached). In KERNEL_DYNAMIC mode retry later, once a task has exi...
@ ADD_FAIL_INVALID
Invalid call: task is nullptr, kernel is not initialized, or adding is not allowed in the current ker...
@ ADD_FAIL_DUPLICATE
The task (or its stack) is already added to the kernel. Application design failure.
EWaitResult
Wait result (see IKernelService::Wait).
@ WAIT_RESULT_FAIL
IKernelService::Wait returned with error without waiting.
@ WAIT_RESULT_CANCELED
The wait was cancelled by another task via IKernel::CancelTaskWait(), independent of signal/timeout.
@ WAIT_RESULT_TIMEOUT
The wake was caused by a timeout expiry.
@ WAIT_RESULT_SIGNAL
The wake was caused by a signal.
@ 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,...
@ PERIODICITY_MAX
Maximum periodicity (microseconds), 99 milliseconds (note: this value is the highest working on a rea...
int64_t Ticks
Ticks value.
EKernelPanicId
Identifies the source of a kernel panic.
@ KERNEL_PANIC_UNKNOWN_SVC
Unknown service command received by SVC handler.
@ KERNEL_PANIC_BAD_STACK_TYPE
Stack type is unknown.
@ KERNEL_PANIC_NS_ACCESS
Non-secure access to protected resource.
@ KERNEL_PANIC_BAD_MODE
Kernel is in bad/unsupported mode for the current operation.
@ KERNEL_PANIC_HRT_HARD_FAULT
Kernel running in KERNEL_HRT mode reported deadline failure of the task.
@ KERNEL_PANIC_CS_NESTING_OVERFLOW
Critical section nesting limit exceeded: violation of STK_CS_NESTINGS_MAX.
@ KERNEL_PANIC_NONE
Panic is absent (no fault).
@ KERNEL_PANIC_BAD_MEMORY_REGION
Bad memory region (ARM TrustZone: provided memory region overlaps with another one; memory pools: a p...
@ KERNEL_PANIC_CPU_EXCEPTION
CPU reported an exception and halted execution.
@ KERNEL_PANIC_NO_MEM
Out of memory: a mandatory allocation (heap or a fixed-size static pool) failed in a context that can...
@ KERNEL_PANIC_SYNC_DEADLOCK
Deadlock caused by a synchronization primitive: a task tried to acquire a non-recursive primitive (e....
@ KERNEL_PANIC_STACK_CORRUPT
Stack integrity check failed.
@ KERNEL_PANIC_SPINLOCK_DEADLOCK
Spin-lock timeout expired: lock owner never released.
@ KERNEL_PANIC_BAD_STATE
Kernel entered unexpected (bad) state.
@ KERNEL_PANIC_ASSERT
Internal assertion failed (maps from STK_ASSERT).
ETaskState
Kernel-side state of a task, see IKernel::GetTaskState().
@ TASK_STATE_EXITING
Run() has returned, the slot is released on the next tick (KERNEL_DYNAMIC mode only).
@ TASK_STATE_SLEEPING
Sleeping via Sleep()/SleepUntil(), with a finite or an infinite timeout.
@ TASK_STATE_SUSPENDED
Suspended by IKernel::SuspendTask().
@ TASK_STATE_REMOVED
The task is not bound to a kernel slot (never added, or already removed).
@ TASK_STATE_WAITING
Blocked on a synchronization object (IKernelService::Wait). KERNEL_SYNC mode only.
@ TASK_STATE_READY
Runnable: running, or waiting for the CPU.
int32_t Timeout
Timeout time (ticks).
ELockResult
Result of IKernel::SetSchedulerLock(), IKernelService::LockScheduler(), UnlockScheduler() and Restore...
@ LOCK_WAS_UNLOCKED
LockScheduler/UnlockScheduler: previous state was unlocked. RestoreSchedulerLock: now unlocked.
@ LOCK_FAIL
Kernel is not running, is suspended, or is in KERNEL_HRT mode.
@ LOCK_FAIL_ISR
Called from an ISR.
@ LOCK_WAS_LOCKED
LockScheduler/UnlockScheduler: previous state was locked. RestoreSchedulerLock: now locked.
ESystemTaskId
System task id.
@ SYS_TASK_ID_EXIT
Exit trap.
@ SYS_TASK_ID_SLEEP
Sleep trap.
static constexpr Weight DEFAULT_WEIGHT
Weight value: default weight of value (1) (see SwitchStrategySmoothWeightedRoundRobin).
static constexpr bool IsIsrTid(TId id)
Test whether a task identifier represents an ISR context.
static constexpr Timeout NO_TIME_SLICE
Time-slice quantum value: no time-slicing for the task (it runs until it blocks, yields or is preempt...
static constexpr Weight NO_WEIGHT
Weight value: weight is not set.
static constexpr Timeout WAIT_INFINITE
Timeout value: block indefinitely until the synchronization object is signaled.
static constexpr TId TID_NONE
Reserved task/thread id representing zero/none thread id.
ETraceEventId
Trace event identifiers for tracing task suspension and resume with debugging tools (e....
@ TRACE_EVENT_UNKNOWN
Unknown / uninitialized trace event.
@ TRACE_EVENT_SLEEP
Task entered a sleep state.
@ TRACE_EVENT_SUSPEND
Task suspended via Suspend.
@ TRACE_EVENT_SWITCH
Task blocked by the context switch.
@ TRACE_EVENT_WAIT
Task suspended on a sync object.
@ STACK_SLEEP_TRAP
Stack of the Sleep trap.
@ STACK_USER_TASK
Stack of the user task.
@ STACK_EXIT_TRAP
Stack of the Exit trap.
EResumeResult
Result of IKernel::ResumeTask().
@ RESUME_FAIL
Task is not bound to the kernel, or is exiting.
@ RESUME_LIFTED
Deferred suspension was cancelled before it took effect.
@ RESUME_NOT_SUSPENDED
Task was not suspended by SuspendTask() (no-op).
@ RESUME_DONE
Suspended task has been resumed.
uint64_t Cycles
Cycles value.
EHwException
Hardware exception id (see IPlatform::IEventOverrider::OnException).
@ HW_EXCEPT_MEMACCESS
MemManage on ARM / Page Fault or PMP violation on RISC-V.
@ HW_EXCEPT_FATAL
HardFault on ARM / Unhandled Fatal Trap on RISC-V.
Word TId
Task (thread) id.
int32_t Weight
Weight value (aka priority).
EKernelMode
Kernel operating mode.
@ KERNEL_TELEMETRY
Enable introspection functions for diagnostics / telemetry (see IKernel::GetTaskState).
@ KERNEL_TIMESLICE
Time-slicing: running task is rotated behind its same-priority peers when its quantum (see ITask::Get...
@ KERNEL_TICKLESS
Tickless mode. To use this mode STK_TICKLESS_IDLE must be defined to 1 in stk_config....
@ KERNEL_SYNC
Synchronization support (see Event).
@ KERNEL_HRT
Hard Real-Time (HRT) behavior (tasks are scheduled periodically and have an execution deadline,...
@ KERNEL_STATIC
All tasks are static and can not exit.
@ KERNEL_DYNAMIC
Tasks can be added or removed and therefore exit when done.
Internal utility namespace containing data structure helpers (linked lists, etc.) used by the kernel ...
ARMv7-M/ARMv8-M system fault exception context state capture.
Lightweight, non-owning view over a contiguous sequence of elements.
ArrayView()
Construct an empty ArrayView with a null pointer and zero size.
T & UncheckedAt(size_t index) const
Deviation MISRA-CPP-2008-5-0-15 \reason Array indexing on a base pointer is required for a dynamic-si...
T * GetPtr()
Get pointer to the beginning of elements in the view.
ArrayView(T *ptr, size_t size)
Construct an ArrayView from a raw pointer and size.
size_t GetSize() const
Get number of elements in the view.
const T * GetPtr() const
Get constant pointer to the beginning of elements in the view.
T & operator[](size_t index) const
Subscript operator for element access.
T * m_ptr
Pointer to the underlying memory block.
size_t m_size
Total number of elements in the view.
Snapshot of the kernel-side state of a task, filled in by IKernel::GetTaskState().
ETaskState state
Task state.
uint32_t access_mode
Bitfield with hardware access mode of the task (see EAccessMode).
TId tid
Task id (see STK_SEGGER_SYSVIEW, STK_MPU_STACK_GUARD).
Word SP
Offset 0: Stack Pointer (SP) register (note: must always be at offset 0).
Interface for a stack memory region.
~IStackMemory()=default
Destructor.
virtual size_t GetStackSize() const =0
Get number of elements of the stack memory array.
virtual size_t GetStackSpace() const
Get available stack space.
virtual const Word * GetStack() const =0
Get pointer to the stack memory.
EState
State of the WaitObject.
@ STATE_CANCELLED
Wait was cancelled via Cancel() rather than Wake()/timeout.
@ STATE_TIMEOUT
Wait expired due to timeout rather than a Wake() signal.
@ STATE_SIGNALED
Wake signaled.
@ STATE_NONE
Not waiting, no result pending.
@ STATE_WAIT
Wait is active.
DLEntryType ListEntryType
List entry type of IWaitObject elements.
DLHeadType ListHeadType
List head type for IWaitObject elements.
virtual TId GetTid() const =0
Get thread Id of the task that owns this wait object.
virtual void Wake(bool timeout)=0
Wake task.
~IWaitObject()=default
Destructor.
virtual EState GetState() const =0
Get current state.
virtual bool Tick(Timeout elapsed_ticks)=0
Update wait object's waiting time.
const char * GetTraceName() const
Get name.
void SetTraceName(const char *name)
Set name.
~ITraceable()=default
Destructor.
Synchronization object interface.
virtual void WakeAll()=0
Wake all tasks currently in the wait list.
virtual bool Tick(Timeout elapsed_ticks)
Called by kernel on every system tick to handle timeout logic of waiting tasks.
DLEntryType ListEntryType
List entry type of ISyncObject elements.
~ISyncObject()=default
Destructor.
virtual void WakeOne()=0
Wake the first task in the wait list (FIFO order).
TId GetFirstWaiterTid() const
Get id of the task which is first in the wait list (FIFO order), i.e. the one that WakeOne() would wa...
DLHeadType ListHeadType
List head type for ISyncObject elements.
friend class tz::nsec::detail::CmseISyncObjectWrapper
static void AddWaitObject(IWaitObject::ListHeadType &wlist, IWaitObject *wobj)
Called by kernel when a new task starts waiting on this event.
virtual IWaitObject::ListHeadType & GetMutableWaitList()=0
Get list of tasks blocked on this object.
friend class IKernelService
static void WakeAll(IWaitObject::ListHeadType &wlist)
Wake all tasks currently in the wait list.
static void RemoveWaitObject(IWaitObject::ListHeadType &wlist, IWaitObject *wobj)
Called by kernel when a waiting task is being removed (timeout expired, wait aborted,...
virtual const IWaitObject::ListHeadType & GetWaitList() const =0
Get list of tasks blocked on this object.
Weight FindWeightHigherThan(Weight comp) const
Find higher weight within linked wait objects.
virtual void RemoveWaitObject(IWaitObject *wobj)=0
Called by kernel when a waiting task is being removed (timeout expired, wait aborted,...
virtual void AddWaitObject(IWaitObject *wobj)=0
Called by kernel when a new task starts waiting on this event.
static void WakeOne(IWaitObject::ListHeadType &wlist)
Wake the first task in the wait list (FIFO order).
Interface for mutex synchronization primitive.
~IMutex()=default
Destructor.
virtual bool TryLock()=0
Try locking the mutex in a single non-blocking attempt.
virtual void Unlock()=0
Unlock the mutex.
virtual void Lock()=0
Lock the mutex.
ScopedLock(IMutex &mutex)
Interface for a user task.
virtual Weight GetWeight() const
Get static base weight of the task.
virtual EAccessMode GetAccessMode() const =0
Get pointer to the stack memory.
virtual const char * GetTraceName() const
Get task trace name set by application.
virtual void Run()=0
Entry point of the user task.
virtual void OnExit()
Called by the kernel before removal from the scheduling (see stk::KERNEL_DYNAMIC).
virtual Timeout GetTimeSlice() const
Get time-slice quantum of the task (ticks). KERNEL_TIMESLICE only.
~ITask()=default
Destructor.
virtual void OnDeadlineMissed(uint32_t duration)
Called by the scheduler if deadline of the task is missed when Kernel is operating in Hard Real-Time ...
Scheduling-strategy-facing interface for a kernel task slot.
virtual void Wake()=0
Wake a sleeping task on the next scheduling tick.
DLEntryType ListEntryType
List entry type of IKernelTask elements.
virtual Weight GetCurrentWeight() const =0
Get the current dynamic weight value of this task.
virtual Weight GetWeight() const =0
Get the effective weight of the task.
virtual Timeout GetHrtRelativeDeadline() const =0
Get HRT task's remaining deadline.
virtual Weight GetBaseWeight() const =0
Get the base (configured) weight of the task, ignoring any priority-inheritance boost.
virtual Timeout GetHrtDeadline() const =0
Get HRT task deadline (max allowed task execution time).
DLHeadType ListHeadType
List head type for IKernelTask elements.
virtual bool IsSleeping() const =0
Check whether the task is currently sleeping.
virtual Timeout GetHrtPeriodicity() const =0
Get HRT task execution periodicity.
virtual ITask * GetUserTask()=0
Get user task.
virtual void SetCurrentWeight(Weight weight)=0
Set the current dynamic weight value used by the scheduling strategy.
virtual Stack GetUserStack() const =0
Get user task's Stack info.
~IKernelTask()=default
Destructor.
Interface for a platform driver.
virtual void ProcessTick()=0
Process one tick.
virtual Word GetCallerSP() const =0
Get caller's Stack Pointer (SP).
virtual TId GetTid() const =0
Get thread Id.
~IPlatform()=default
Destructor.
virtual void Initialize(IEventHandler *event_handler, IKernelService *service, uint32_t resolution_us, Stack *exit_trap)=0
Initialize scheduler's context.
virtual Timeout Suspend()=0
Suspend scheduling.
virtual Cycles GetSysTimerCount() const =0
Get system timer count value.
virtual void Start()=0
Start scheduling.
virtual void Stop()=0
Stop scheduling.
virtual uint32_t GetSysTimerFrequency() const =0
Get system timer frequency.
virtual void Resume(Timeout elapsed_ticks)=0
Resume scheduling after a prior Suspend() call.
virtual void ForceContextSwitch(TId id)=0
Force context switch.
virtual uint32_t GetTickResolution() const =0
Get resolution of the system tick timer in microseconds. Resolution means a number of microseconds be...
virtual void InitStack(EStackType stack_type, Stack *stack, IStackMemory *stack_memory, ITask *user_task)=0
Initialize stack memory of the user task.
virtual void SetEventOverrider(IEventOverrider *overrider, bool non_secure=false)=0
Set platform event overrider.
virtual void ProcessHardFault()=0
Cause a hard fault of the system.
virtual void SetCpuFrequency(uint8_t core_id, uint32_t frequency)=0
Notify the scheduler of a CPU core's operating frequency.
Interface for a back-end event handler.
virtual void OnTaskExit(const Stack *stack)=0
Called from the Thread process when task finished (its Run function exited by return).
virtual bool OnTick(Stack *&idle, Stack *&active, Timeout &ticks)=0
Called by ISR handler to notify about the next system tick.
virtual void OnStart(Stack *&active)=0
Called by ISR handler to notify that scheduling is about to start.
virtual bool OnForceContextSwitch(TId id, Stack *&idle, Stack *&active)=0
Called when a task state change forces a context switch (sleep, wait, suspend, yield,...
virtual TId OnGetTid(Word caller_SP)=0
Called from the Thread process when for getting task/thread id of the process.
virtual void OnStop()=0
Called by driver to notify that scheduling is stopped.
virtual void OnSuspend(bool suspended)=0
Called by the driver when scheduling is suspended or resumed (tickless suspend, see IPlatform::Suspen...
Interface for a platform event overrider.
virtual bool OnSleep(Timeout sleep_ticks)
Called by the Kernel when it is entering a sleep mode.
virtual bool OnHardFault()
Called by Kernel when hard fault happens.
virtual bool OnException(EHwException exc_id, TId tid, const struct FaultContext *const ctx)
Called by the platform driver during initialization to obtain global, application-defined MPU configu...
Interface for a task switching strategy implementation.
virtual void RemoveTask(IKernelTask *task)=0
Remove task.
virtual void OnTaskSleep(IKernelTask *task)=0
Notification that a task has entered sleep/blocked state.
virtual void OnTaskWake(IKernelTask *task)=0
Notification that a task is becoming runnable again.
~ITaskSwitchStrategy()=default
Destructor.
virtual bool OnTaskTimeSlice(IKernelTask *task)
Notification that the running task's time slice expired (KERNEL_TIMESLICE only).
virtual bool OnTaskDeadlineMissed(IKernelTask *task)
Notification that a task has exceeded its HRT deadline; returns whether the strategy can recover with...
virtual IKernelTask * GetFirst()=0
Get first task.
virtual void OnTaskWeightChange(IKernelTask *task, Weight old_weight)
Notification that a runnable task's scheduling weight has changed.
virtual bool OnTaskYield(IKernelTask *task)
Notification that the running task called Yield() (non-HRT kernel modes only).
virtual size_t GetSize() const =0
Get number of tasks currently managed by this strategy.
virtual IKernelTask * GetNext()=0
Advance the internal iterator and return the next runnable task.
virtual void AddTask(IKernelTask *task)=0
Add task.
Interface for the implementation of the kernel of the scheduler. It supports Soft and Hard Real-Time ...
EKernelState
Kernel state.
@ KSTATE_RUNNING
Initialized and running, IKernel::Start() was called successfully.
@ KSTATE_SUSPENDED
Scheduling is suspended with IKernelService::Suspend().
@ KSTATE_LOCKED
Running, but task switching is disabled with IKernelService::LockScheduler(). Ticks,...
@ KSTATE_INACTIVE
Not ready, IKernel::Initialize() must be called.
@ KSTATE_READY
Ready to start, IKernel::Start() must be called.
virtual EAddResult AddTask(ITask *user_task)=0
Add user task.
void SuspendTask(ITask *user_task, bool &suspended)
Suspend task (legacy form).
virtual ELockResult SetSchedulerLock(bool lock)=0
Lock or unlock task switching. Ticks, timeouts and ISRs keep running.
virtual IPlatform * GetPlatform()=0
Get platform driver instance.
virtual size_t EnumerateTasks(ArrayView< ITask * > user_tasks)=0
Enumerate user tasks.
virtual EKernelState GetState() const =0
Get a snapshot of the kernel state.
~IKernel()=default
Destructor.
virtual void RemoveTask(ITask *user_task)=0
Remove a previously added task from the kernel when it is not started.
virtual ESuspendResult SuspendTask(ITask *user_task)=0
Suspend task.
virtual bool GetTaskState(ITask *user_task, TaskStateInfo &info) const =0
Get a snapshot of the kernel-side state of a task.
size_t EnumerateTasksT(TCallback &&callback)
Enumerate tasks, invoking a callback for each active task.
virtual EAddResult AddTask(ITask *user_task, Timeout periodicity_tc, Timeout deadline_tc, Timeout start_delay_tc)=0
Add user task.
virtual size_t EnumerateKernelTasks(ArrayView< IKernelTask * > tasks)=0
Enumerate kernel tasks.
virtual EResumeResult ResumeTask(ITask *user_task)=0
Resume task suspended by SuspendTask(), or lift its deferred suspension.
virtual void ScheduleTaskRemoval(ITask *user_task)=0
Schedule task removal from scheduling (exit).
virtual void Initialize(uint32_t resolution_us=PERIODICITY_DEFAULT)=0
Initialize kernel.
virtual ITaskSwitchStrategy * GetSwitchStrategy()=0
Get switch strategy instance.
virtual void CancelTaskWait(ITask *user_task)=0
Cancel a task's in-progress wait or sleep, waking it early.
virtual void Start()=0
Start kernel scheduling.
Interface for the kernel services exposed to the user processes during run-time when Kernel started s...
virtual TId GetTid() const =0
Get thread Id of the currently running task.
virtual Timeout SetTimeSlice(TId tid, Timeout ticks)=0
Change the time-slice quantum of the task at run-time and reload its slice.
virtual void Wake(ISyncObject *sobj, bool all)=0
Wake one or all tasks currently waiting on a synchronization object.
virtual ELockResult UnlockScheduler()=0
Enable task switching (equivalent of CMSIS-RTOS2 osKernelUnlock).
virtual void SleepCancel(TId task_id)=0
Cancel sleep of the task.
virtual void InheritWeight(TId tid, Weight weight)=0
Inherit weight for the task.
virtual bool Sleep(Timeout ticks)=0
Put calling process into a sleep state.
static IKernelService * GetInstance()
Get CPU-local instance of the kernel service.
virtual uint32_t GetTickResolution() const =0
Get number of microseconds in one tick.
~IKernelService()=default
Destructor.
virtual bool SleepUntil(Ticks timestamp)=0
Put calling process into a sleep state until the specified timestamp.
virtual Ticks GetTicks() const =0
Get number of ticks elapsed since kernel start.
virtual void SwitchToNext()=0
Notify scheduler to switch to the next task (yield).
virtual void Resume(Timeout elapsed_ticks)=0
Resume scheduling after a prior Suspend() call.
virtual Weight SetWeight(TId tid, Weight weight)=0
Change the base weight of the task at run-time (replaces ITask::GetWeight() value).
virtual void ExitTask()=0
Terminate the calling task: schedule its removal and switch it out. Does not return.
virtual EWaitResult Wait(ISyncObject *sobj, IMutex *mutex, Timeout timeout)=0
Put calling process into a waiting state until synchronization object is signaled or timeout occurs.
virtual ELockResult LockScheduler()=0
Disable task switching (equivalent of CMSIS-RTOS2 osKernelLock). Ticks, timeouts and ISRs keep runnin...
virtual ELockResult RestoreSchedulerLock(bool locked)=0
Set the lock state (equivalent of CMSIS-RTOS2 osKernelRestoreLock).
virtual Cycles GetSysTimerCount() const =0
Get system timer count value.
virtual uint32_t GetSysTimerFrequency() const =0
Get system timer frequency.
virtual Timeout Suspend()=0
Suspend scheduling.
virtual void RestoreWeight(TId tid, ISyncObject *sobj=nullptr)=0
Restore weight of the task to the original value.
static IWaitObject::ListHeadType & GetMutableWaitList(ISyncObject *sobj)
Access helper to the mutable IWaitObject::GetWaitList().
virtual void Delay(Timeout ticks)=0
Delay calling process.
const ELockResult m_result
void LinkBack(DLEntryType *entry)
Append entry to the back of the list (pointer overload).
void Unlink(DLEntryType *entry)
Remove entry from this list.
DLEntryType * GetFirst()
Get the first (front) entry without removing it.
Intrusive doubly-linked list node. Embed this as a base class in any object (T) that needs to partici...
DListEntry< IWaitObject, TClosedLoop > DLEntryType
DLHeadType * GetHead()
Get the list head this entry currently belongs to.
DListHead< IWaitObject, TClosedLoop > DLHeadType
static __stk_forceinline TTargetType * ListEntryToParent(TSourceType *const lentry)
Casts an intrusive list entry to the concrete type that derives from it.
MPU region descriptor (raw hardware register values).
MPU descriptor of the task (a set of NUM_REGIONS regions), see TaskMpu / TaskMpuNs.
Aggregated hardware MPU setup configuration and state descriptor.