![]() |
SuperTinyKernel™ RTOS 1.08.x
Lightweight, high-performance, deterministic, bare-metal C++ RTOS for resource-constrained embedded systems. MIT Open Source License.
|
Interface for a back-end event handler. More...
#include <stk_common.h>
Public Member Functions | |
| virtual void | OnStart (Stack *&enable)=0 |
| Called by ISR handler to notify that scheduling is about to start. | |
| virtual void | OnStop ()=0 |
| Called by driver to notify that scheduling is stopped. | |
| virtual bool | OnTick (Stack *&idle, Stack *&active, Timeout &ticks)=0 |
| Called by ISR handler to notify about the next system tick. | |
| virtual void | OnTaskSwitch (Word caller_SP)=0 |
| Called by Thread process (via IKernelService::SwitchToNext) to switch to a next task. | |
| virtual void | OnTaskSleep (Word caller_SP, Timeout ticks)=0 |
| Called by Thread process (via IKernelService::Sleep) for exclusion of the calling process from scheduling (sleeping). | |
| virtual bool | OnTaskSleepUntil (Word caller_SP, Ticks timestamp)=0 |
| Called by Thread process (via IKernelService::SleepUntil) for exclusion of the calling process from scheduling (sleeping). | |
| virtual void | OnTaskExit (Stack *stack)=0 |
| Called from the Thread process when task finished (its Run function exited by return). | |
| virtual EWaitResult | OnTaskWait (Word caller_SP, ISyncObject *sync_obj, IMutex *mutex, Timeout timeout)=0 |
| Called from the Thread process when task needs to wait. | |
| virtual TId | OnGetTid (Word caller_SP)=0 |
| Called from the Thread process when for getting task/thread id of the process. | |
| virtual void | OnSuspend (bool suspended)=0 |
| Called from the Thread process to suspend scheduling. | |
| virtual bool | OnForceContextSwitch (TId id, Stack *&idle, Stack *&active)=0 |
| Called when task state change forces a context switch (Sleep, SleepUntil, Wait). | |
Interface for a back-end event handler.
It is inherited by the kernel implementation and delivers events from ISR.
Definition at line 985 of file stk_common.h.
|
pure virtual |
Called when task state change forces a context switch (Sleep, SleepUntil, Wait).
| [in] | id | Task id causing this forced context switch. |
| [out] | idle | Stack of the task which must enter Idle state. |
| [out] | active | Stack of the task which must enter Active state (to which context will switch). |
Implemented in stk::Kernel< TMode, TSize, TStrategy, TPlatform >, stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS, 16U, stk::SwitchStrategyFP32, stk::PlatformDefault >, and stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >.
Called from the Thread process when for getting task/thread id of the process.
| [in] | caller_SP | Value of Stack Pointer (SP) register (for locating the calling process inside the kernel). |
Implemented in stk::Kernel< TMode, TSize, TStrategy, TPlatform >, stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS, 16U, stk::SwitchStrategyFP32, stk::PlatformDefault >, and stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >.
|
pure virtual |
Called by ISR handler to notify that scheduling is about to start.
| [out] | active | Stack of the task which must enter Active state (to which context will switch). |
Implemented in stk::Kernel< TMode, TSize, TStrategy, TPlatform >, stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS, 16U, stk::SwitchStrategyFP32, stk::PlatformDefault >, and stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >.
|
pure virtual |
Called by driver to notify that scheduling is stopped.
Implemented in stk::Kernel< TMode, TSize, TStrategy, TPlatform >, stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS, 16U, stk::SwitchStrategyFP32, stk::PlatformDefault >, and stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >.
|
pure virtual |
Called from the Thread process to suspend scheduling.
| [in] | suspended | true if scheduling was successfully suspended, false otherwise. |
Implemented in stk::Kernel< TMode, TSize, TStrategy, TPlatform >, stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS, 16U, stk::SwitchStrategyFP32, stk::PlatformDefault >, and stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >.
|
pure virtual |
Called from the Thread process when task finished (its Run function exited by return).
| [out] | stack | Stack of the exited task. |
Implemented in stk::Kernel< TMode, TSize, TStrategy, TPlatform >, stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS, 16U, stk::SwitchStrategyFP32, stk::PlatformDefault >, and stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >.
|
pure virtual |
Called by Thread process (via IKernelService::Sleep) for exclusion of the calling process from scheduling (sleeping).
| [in] | caller_SP | Value of Stack Pointer (SP) register (for locating the calling process inside the kernel). |
| [in] | ticks | Time to sleep (ticks). |
Implemented in stk::Kernel< TMode, TSize, TStrategy, TPlatform >, stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS, 16U, stk::SwitchStrategyFP32, stk::PlatformDefault >, and stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >.
|
pure virtual |
Called by Thread process (via IKernelService::SleepUntil) for exclusion of the calling process from scheduling (sleeping).
| [in] | caller_SP | Value of Stack Pointer (SP) register (for locating the calling process inside the kernel). |
| [in] | timestamp | Absolute timestamp (ticks). |
Implemented in stk::Kernel< TMode, TSize, TStrategy, TPlatform >, stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS, 16U, stk::SwitchStrategyFP32, stk::PlatformDefault >, and stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >.
|
pure virtual |
Called by Thread process (via IKernelService::SwitchToNext) to switch to a next task.
| [in] | caller_SP | Value of Stack Pointer (SP) register (for locating the calling process inside the kernel). |
Implemented in stk::Kernel< TMode, TSize, TStrategy, TPlatform >, stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS, 16U, stk::SwitchStrategyFP32, stk::PlatformDefault >, and stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >.
|
pure virtual |
Called from the Thread process when task needs to wait.
| [in] | caller_SP | Value of Stack Pointer (SP) register (for locating the calling process inside the kernel). |
| [in] | sync_obj | ISyncObject instance (passed by Wait). |
| [in] | mutex | IMutex instance (passed by Wait). |
| [in] | timeout | Time to sleep (ticks). |
Implemented in stk::Kernel< TMode, TSize, TStrategy, TPlatform >, stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS, 16U, stk::SwitchStrategyFP32, stk::PlatformDefault >, and stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >.
|
pure virtual |
Called by ISR handler to notify about the next system tick.
| [out] | idle | Stack of the task which must enter Idle state. |
| [out] | active | Stack of the task which must enter Active state (to which context will switch). |
| [in,out] | ticks | (STK_TICKLESS_IDLE=1 only) On entry: actual ticks elapsed since the previous call, as measured by the platform driver. On return: the minimum remaining sleep ticks across all active tasks, clamped to [1, STK_TICKLESS_TICKS_MAX]. Platform driver programs this value into the hardware timer to suppress unnecessary wakeups. Absent in non-tickless builds. |
Implemented in stk::Kernel< TMode, TSize, TStrategy, TPlatform >, stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS, 16U, stk::SwitchStrategyFP32, stk::PlatformDefault >, and stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >.