SuperTinyKernel™ RTOS 1.05.3
Lightweight, high-performance, deterministic, bare-metal C++ RTOS for resource-constrained embedded systems. MIT Open Source License.
Loading...
Searching...
No Matches
stk_arch_x86-win32.h
Go to the documentation of this file.
1/*
2 * SuperTinyKernel(TM) RTOS: Lightweight High-Performance Deterministic C++ RTOS for Embedded Systems.
3 *
4 * Source: https://github.com/SuperTinyKernel-RTOS
5 *
6 * Copyright (c) 2022-2026 Neutron Code Limited <stk@neutroncode.com>. All Rights Reserved.
7 * License: MIT License, see LICENSE for a full text.
8 */
9
10#ifndef STK_ARCH_X86_WIN32_H_
11#define STK_ARCH_X86_WIN32_H_
12
13#include "stk_common.h"
14
18
19namespace stk {
20
26{
27public:
33
34 void Initialize(IEventHandler *event_handler, IKernelService *service, uint32_t resolution_us, Stack *exit_trap);
35 void Start();
36 void Stop();
37 bool InitStack(EStackType stack_type, Stack *stack, IStackMemory *stack_memory, ITask *user_task);
38 uint32_t GetTickResolution() const;
40 void Sleep(Timeout ticks);
41 void SleepUntil(Ticks timestamp);
42 IWaitObject *Wait(ISyncObject *sync_obj, IMutex *mutex, Timeout timeout);
47 TId GetTid() const;
48};
49
54
55} // namespace stk
56
60#if defined(_MSC_VER)
61 #include <intrin.h>
62 #if defined(_M_IX86) || defined(_M_X64)
63 // x86/x64: full hardware serializing fence
64 #define __stk_dmb() _mm_mfence()
65 #elif defined(_M_ARM) || defined(_M_ARM64)
66 // ARM/ARM64: Data Memory Barrier (Inner Shareable)
67 #define __stk_dmb() __dmb(_ARM_BARRIER_ISH)
68 #endif
69#elif defined(__GNUC__) || defined(__clang__)
70 #define __stk_dmb() __sync_synchronize()
71#else
72 #error "__stk_dmb() is not implemented for this compiler."
73#endif
74
75#endif /* STK_ARCH_X86_WIN32_H_ */
Contains interface definitions of the library.
Namespace of STK package.
uintptr_t Word
Native processor word type.
Definition stk_common.h:112
int64_t Ticks
Ticks value.
Definition stk_common.h:150
int32_t Timeout
Timeout time (ticks).
Definition stk_common.h:133
EStackType
Stack type.
Definition stk_common.h:70
PlatformArmCortexM PlatformDefault
Default platform implementation.
Word TId
Definition stk_common.h:117
Concrete implementation of IPlatform driver for the x86 Win32 platform.
bool InitStack(EStackType stack_type, Stack *stack, IStackMemory *stack_memory, ITask *user_task)
Initialize stack memory of the user task.
TId GetTid() const
Get thread Id.
uint32_t GetTickResolution() const
Get resolution of the system tick timer in microseconds. Resolution means a number of microseconds be...
void SetEventOverrider(IEventOverrider *overrider)
Set platform event overrider.
void Start()
Start scheduling.
void Stop()
Stop scheduling.
void SwitchToNext()
Switch to a next task.
void ProcessHardFault()
Cause a hard fault of the system.
void ProcessTick()
Process one tick.
IWaitObject * Wait(ISyncObject *sync_obj, IMutex *mutex, Timeout timeout)
void Sleep(Timeout ticks)
Put calling process into a sleep state.
void SleepUntil(Ticks timestamp)
Put calling process into a sleep state until the specified timestamp.
void Initialize(IEventHandler *event_handler, IKernelService *service, uint32_t resolution_us, Stack *exit_trap)
Initialize scheduler's context.
Word GetCallerSP() const
Get caller's Stack Pointer (SP).
Stack descriptor.
Definition stk_common.h:181
Interface for a stack memory region.
Definition stk_common.h:193
Wait object.
Definition stk_common.h:212
Synchronization object.
Definition stk_common.h:297
Interface for mutex synchronization primitive.
Definition stk_common.h:381
Interface for a user task.
Definition stk_common.h:433
Interface for a platform driver.
Definition stk_common.h:575
Interface for a back-end event handler.
Definition stk_common.h:583
Interface for a platform event overrider.
Definition stk_common.h:659
Interface for the kernel services exposed to the user processes during run-time when Kernel started s...
Definition stk_common.h:929