![]() |
SuperTinyKernel™ RTOS 1.06.x
Lightweight, high-performance, deterministic, bare-metal C++ RTOS for resource-constrained embedded systems. MIT Open Source License.
|
Partial implementation of the user task. 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. | |
| size_t | GetStackSizeBytes () const override |
| Get size of the memory in bytes. | |
| EAccessMode | GetAccessMode () const override |
| Get hardware access mode of the user 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 Weight | GetWeight () const |
| Get static base weight of the task. | |
| TId | GetId () const |
| Get task Id set by application. | |
| virtual const char * | GetTraceName () const |
| Get task trace name set by application. | |
| virtual size_t | GetStackSpace () const |
| Get available stack space. | |
Protected Member Functions | |
| Task (const Task &)=delete | |
| Task & | operator= (const Task &)=delete |
| Task () | |
| Initializes task instance and zero-initializes its internal stack memory. | |
| ~Task ()=default | |
| Destructor. | |
Private Attributes | |
| StackMemoryDef< _StackSize >::Type | m_stack |
| Stack memory region, 16-byte aligned. | |
Partial implementation of the user task.
Provides stack storage and default implementations of all optional ITask methods. Inherit from this class and implement GetFunc() and GetFuncUserData() to make a schedulable task. Use ACCESS_USER for unprivileged tasks and ACCESS_PRIVILEGED for tasks requiring full hardware access.
Usage example:
Definition at line 49 of file stk_helper.h.
| anonymous enum |
|
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 69 of file stk_helper.h.
References m_stack.
|
protecteddefault |
Destructor.
|
inlineoverridevirtual |
Get hardware access mode of the user task.
Implements stk::ITask.
Definition at line 57 of file stk_helper.h.
|
inlineinherited |
Get task Id set by application.
Implementation of ITask::GetId, see ITask. Placed here as it depends on GetTidFromUserTask.
Definition at line 234 of file stk_helper.h.
References stk::GetTidFromUserTask().
Referenced by stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelTask::Bind(), and stk_task_get_id().
|
inlineoverridevirtual |
Get pointer to the stack memory.
Implements stk::IStackMemory.
Definition at line 54 of file stk_helper.h.
References m_stack.
|
inlineoverridevirtual |
Get number of elements of the stack memory array.
Implements stk::IStackMemory.
Definition at line 55 of file stk_helper.h.
|
inlineoverridevirtual |
Get size of the memory in bytes.
Implements stk::IStackMemory.
Definition at line 56 of file stk_helper.h.
|
inlinevirtualinherited |
Get available stack space.
Definition at line 318 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 648 of file stk_common.h.
|
inlinevirtualinherited |
Get static base weight of the task.
Reimplemented in FrtosTask, stk::TaskW< _Weight, _StackSize, _AccessMode >, stk::time::TimerHost::TimerWorkerTask, StkThread, and TaskWrapper.
Definition at line 635 of file stk_common.h.
References stk::DEFAULT_WEIGHT.
Referenced by stk::ISyncObject::FindWeightHigherThan().
|
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 618 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 628 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 78 of file stk_helper.h.
Referenced by GetStack(), and Task().