![]() |
SuperTinyKernel™ RTOS 1.06.x
Lightweight, high-performance, deterministic, bare-metal C++ RTOS for resource-constrained embedded systems. MIT Open Source License.
|
Interface for the kernel services exposed to the user processes during run-time when Kernel started scheduling the processes. More...
#include <stk_common.h>
Public Member Functions | |
| virtual TId | GetTid () const =0 |
| Get thread Id of the currently running task. | |
| virtual Ticks | GetTicks () const =0 |
| Get number of ticks elapsed since kernel start. | |
| virtual uint32_t | GetTickResolution () const =0 |
| Get number of microseconds in one tick. | |
| virtual Cycles | GetSysTimerCount () const =0 |
| Get system timer count value. | |
| virtual uint32_t | GetSysTimerFrequency () const =0 |
| Get system timer frequency. | |
| virtual void | Delay (Timeout ticks)=0 |
| Delay calling process. | |
| virtual void | Sleep (Timeout ticks)=0 |
| Put calling process into a sleep state. | |
| virtual bool | SleepUntil (Ticks timestamp)=0 |
| Put calling process into a sleep state until the specified timestamp. | |
| virtual void | SleepCancel (TId task_id)=0 |
| Cancel sleep of the task. | |
| virtual void | SwitchToNext ()=0 |
| Notify scheduler to switch to the next task (yield). | |
| virtual IWaitObject * | Wait (ISyncObject *sobj, IMutex *mutex, Timeout timeout)=0 |
| Put calling process into a waiting state until synchronization object is signaled or timeout occurs. | |
| virtual Timeout | Suspend ()=0 |
| Suspend scheduling. | |
| virtual void | Resume (Timeout elapsed_ticks)=0 |
| Resume scheduling after a prior Suspend() call. | |
| virtual void | InheritWeight (TId tid, Weight weight)=0 |
| Inherit weight for the task. | |
| virtual void | RestoreWeight (TId tid, ISyncObject *sobj=nullptr)=0 |
| Restore weight of the task to the original value. | |
Static Public Member Functions | |
| static IKernelService * | GetInstance () |
| Get CPU-local instance of the kernel service. | |
Protected Member Functions | |
| ~IKernelService ()=default | |
| Destructor. | |
Interface for the kernel services exposed to the user processes during run-time when Kernel started scheduling the processes.
Definition at line 1280 of file stk_common.h.
|
protecteddefault |
Destructor.
|
pure virtual |
Delay calling process.
| [in] | ticks | Delay time (ticks). |
Implemented in stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelService.
Referenced by stk::Delay().
|
static |
Get CPU-local instance of the kernel service.
Referenced by stk::Delay(), stk::GetSysTimerCount(), stk::GetSysTimerFrequency(), stk::GetTickResolution(), stk::GetTicks(), stk::GetTid(), stk::GetTimeNowMs(), osKernelResume(), osKernelSuspend(), stk::Sleep(), stk::SleepCancel(), stk::SleepUntil(), stk::sync::Mutex::TimedLock(), stk::sync::Mutex::Unlock(), stk::sync::ConditionVariable::Wait(), stk::sync::Event::Wait(), stk::sync::Semaphore::Wait(), and stk::Yield().
|
pure virtual |
Get system timer count value.
Implemented in stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelService.
Referenced by stk::GetSysTimerCount().
|
pure virtual |
Get system timer frequency.
Implemented in stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelService.
Referenced by stk::GetSysTimerFrequency().
|
pure virtual |
Get number of microseconds in one tick.
Implemented in stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelService.
Referenced by stk::GetTickResolution(), and stk::GetTimeNowMs().
|
pure virtual |
Get number of ticks elapsed since kernel start.
Implemented in stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelService.
Referenced by stk::GetTicks(), and stk::GetTimeNowMs().
|
pure virtual |
Get thread Id of the currently running task.
Implemented in stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelService.
Referenced by stk::GetTid(), and stk::sync::Mutex::TimedLock().
Inherit weight for the task.
| [in] | tid | Task id. |
| [in] | weight | New weight, shall be higher than task's current weight (see ITask::GetWeight). |
Implemented in stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelService.
Referenced by stk::sync::Mutex::TimedLock(), and stk::sync::Mutex::Unlock().
|
pure virtual |
Restore weight of the task to the original value.
| [in] | tid | Task id. |
| [in] | sobj | Optional, if provided than weight will be restored to the highest weight of the task in the wait list, otherwise to the original value. |
Implemented in stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelService.
Referenced by stk::sync::Mutex::TimedLock(), and stk::sync::Mutex::Unlock().
|
pure virtual |
Resume scheduling after a prior Suspend() call.
| [in] | elapsed_ticks | Number of ticks that elapsed during the suspended period. The kernel uses this value to advance internal time counters and wake tasks whose sleep deadlines have expired. |
Implemented in stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelService.
Referenced by osKernelResume().
|
pure virtual |
Put calling process into a sleep state.
| [in] | ticks | Sleep time (ticks). |
Implemented in stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelService.
Referenced by stk::Sleep().
|
pure virtual |
Cancel sleep of the task.
| [in] | task_id | Id of the task. |
Implemented in stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelService.
Referenced by stk::SleepCancel().
|
pure virtual |
Put calling process into a sleep state until the specified timestamp.
| [in] | timestamp | Absolute timestamp (ticks). |
Implemented in stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelService.
Referenced by stk::SleepUntil().
|
pure virtual |
Suspend scheduling.
Implemented in stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelService.
Referenced by osKernelSuspend().
|
pure virtual |
Notify scheduler to switch to the next task (yield).
Implemented in stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelService.
Referenced by stk::Yield().
|
pure virtual |
Put calling process into a waiting state until synchronization object is signaled or timeout occurs.
| [in] | sobj | Synchronization object to wait on. |
| [in] | mutex | Mutex protecting the state of the synchronization object. |
| [in] | timeout | Maximum wait time (ticks). Use WAIT_INFINITE to block indefinitely, use NO_WAIT to poll without blocking. |
Implemented in stk::Kernel< TMode, TSize, TStrategy, TPlatform >::KernelService.
Referenced by stk::sync::Mutex::TimedLock(), stk::sync::ConditionVariable::Wait(), stk::sync::Event::Wait(), and stk::sync::Semaphore::Wait().