![]() |
SuperTinyKernel™ RTOS 1.08.x
Lightweight, high-performance, deterministic, bare-metal C++ RTOS for resource-constrained embedded systems. MIT Open Source License.
|
Partial implementation of the user task with a compile-time scheduling weight. Use when the kernel is configured with SwitchStrategySmoothWeightedRoundRobin. More...
#include <stk_helper.h>
Public Types | |
| enum | { STACK_SIZE = _StackSize } |
Public Member Functions | |
| const Word * | GetStack () const override |
| Get pointer to the stack memory. | |
| size_t | GetStackSize () const override |
| Get number of elements of the stack memory array. | |
| EAccessMode | GetAccessMode () const override |
| Get pointer to the stack memory. | |
| Weight | GetWeight () const override |
| Get static base weight of the task. | |
| virtual void | Run ()=0 |
| Entry point of the user task. | |
| 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 mode (see stk::KERNEL_HRT). | |
| virtual void | OnExit () |
| Called by the kernel before removal from the scheduling (see stk::KERNEL_DYNAMIC). | |
| virtual const char * | GetTraceName () const |
| Get task trace name set by application. | |
| virtual size_t | GetStackSpace () const |
| Get available stack space. | |
Protected Member Functions | |
| TaskW (const TaskW &)=delete | |
| TaskW & | operator= (const TaskW &)=delete |
| TaskW () | |
| Initializes task instance and zero-initializes its internal stack memory. | |
| ~TaskW ()=default | |
| Destructor. | |
Private Attributes | |
| StackMemoryDef< _StackSize >::Type | m_stack |
| Stack memory region, 16-byte aligned. | |
Partial implementation of the user task with a compile-time scheduling weight. Use when the kernel is configured with SwitchStrategySmoothWeightedRoundRobin.
| _Weight | Static scheduling weight (positive, non-zero 24-bit integer). Higher values cause this task to receive proportionally more CPU time. |
| _StackSize | Stack size in elements of Word. |
| _AccessMode | Hardware access mode (ACCESS_USER or ACCESS_PRIVILEGED). |
See Task for full usage example, implementation guidance, and TrustZone Non-Secure inheritance notes.
Definition at line 144 of file stk_helper.h.
| anonymous enum |
| Enumerator | |
|---|---|
| STACK_SIZE | |
Definition at line 152 of file stk_helper.h.
|
protecteddelete |
|
inlineprotected |
Initializes task instance and zero-initializes its internal stack memory.
The constructor is protected to ensure that the Task class can only be instantiated through a derived subclass. It handles the allocation (if applicable) and zero-initialization of the m_stack member based on the _StackSize template parameter.
Definition at line 169 of file stk_helper.h.
References m_stack.
|
protecteddefault |
|
inlineoverridevirtual |
Get pointer to the stack memory.
Get up to (STK_MPU_TASK_REGIONS - 1) application-defined MPU regions for this task.
When STK_MPU_STACK_GUARD is enabled, each task owns STK_MPU_TASK_REGIONS (2, 4, 6, 8, 12 or 16, see STK_MPU_TASK_REGIONS) hardware MPU region slots. Slot 0 is always the automatic stack guard, computed by the driver from the task's own stack memory (see IStackMemory::GetStack/GetStackSize). This hook supplies the remaining STK_MPU_TASK_REGIONS-1 slots, letting an application additionally sandbox a task to e.g. a private data buffer, a specific peripheral block, or a shared IPC region - on top of its stack guard.
MpuRegionList containing up to (STK_MPU_TASK_REGIONS - 1) region descriptors, or nullptr if no extra task regions are configured. Array element i is applied at task-relative region index i +1 (i.e. the slots following the stack guard). STK_MPU_STACK_GUARD is enabled; a no-op on platforms/builds without MPU stack-guard support. MpuRegionList instance referenced by the returned pointer must remain valid (e.g. a static const instance); a stack-local temporary is invalid once this function returns. Get hardware access mode of the user task.
Implements stk::ITask.
Definition at line 156 of file stk_helper.h.
|
inlineoverridevirtual |
Get pointer to the stack memory.
Implements stk::IStackMemory.
Definition at line 154 of file stk_helper.h.
References m_stack.
|
inlineoverridevirtual |
Get number of elements of the stack memory array.
Implements stk::IStackMemory.
Definition at line 155 of file stk_helper.h.
|
inlinevirtualinherited |
Get available stack space.
Definition at line 430 of file stk_common.h.
References stk::ArrayView< T >::GetSize(), GetStack(), GetStackSize(), and STK_STACK_MEMORY_FILLER.
Referenced by FrtosTask::GetStackHighWaterMark(), and osThreadGetStackSpace().
|
inlinevirtualinherited |
Get task trace name set by application.
NULL if unused. Reimplemented in FrtosTask, stk::time::TimerHost::TimerWorkerTask, StkThread, and TaskWrapper.
Definition at line 866 of file stk_common.h.
|
inlineoverridevirtual |
Get static base weight of the task.
Reimplemented from stk::ITask.
Definition at line 157 of file stk_helper.h.
|
inlinevirtualinherited |
Called by the scheduler if deadline of the task is missed when Kernel is operating in Hard Real-Time mode (see stk::KERNEL_HRT).
| [in] | duration | Elapsed active time in ticks at the point the deadline was detected. Always greater than the task's configured deadline (ticks). |
Reimplemented in FrtosTask, stk::time::TimerHost::TimerWorkerTask, StkThread, and TaskWrapper.
Definition at line 842 of file stk_common.h.
References STK_UNUSED.
|
inlinevirtualinherited |
Called by the kernel before removal from the scheduling (see stk::KERNEL_DYNAMIC).
Reimplemented in FrtosTask, stk::time::TimerHost::TimerWorkerTask, StkThread, and TaskWrapper.
Definition at line 852 of file stk_common.h.
|
protecteddelete |
|
pure virtualinherited |
Entry point of the user task.
Kernel is configured as KERNEL_STATIC, the body must contain an infinite loop. Implemented in FrtosTask, stk::time::TimerHost::TimerWorkerTask, StkThread, and TaskWrapper.
|
private |
Stack memory region, 16-byte aligned.
Definition at line 177 of file stk_helper.h.
Referenced by GetStack(), and TaskW().