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_arm-cortex-m.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_ARM_CORTEX_M_H_
11#define STK_ARCH_ARM_CORTEX_M_H_
12
13#include "stk_common.h"
14
18
19namespace stk {
20
25{
26public:
32
33 void Initialize(IEventHandler *event_handler, IKernelService *service, uint32_t resolution_us, Stack *exit_trap);
34 void Start();
35 void Stop();
36 bool InitStack(EStackType stack_type, Stack *stack, IStackMemory *stack_memory, ITask *user_task);
37 uint32_t GetTickResolution() const;
39 void Sleep(Timeout ticks);
40 void SleepUntil(Ticks timestamp);
41 IWaitObject *Wait(ISyncObject *sync_obj, IMutex *mutex, Timeout timeout);
46 TId GetTid() const;
47};
48
53
59{
60 Word tp;
61 __asm volatile("MOV %0, r9" : "=r"(tp) : /* input: none */ : /* clobbers: none */);
62 return tp;
63}
64
70{
71 __asm volatile("MOV r9, %0" : /* output: none */ : "r"(tp) : /* clobbers: none */);
72}
73
74// Notify stk_arch.h that we defined inline versions of GetTls/SetTls.
75#define _STK_INLINE_TLS_DEFINED 1
76
77} // namespace stk
78
82#define __stk_dmb() __asm volatile("dmb sy" ::: "memory")
83
84#endif /* STK_ARCH_ARM_CORTEX_M_H_ */
Contains interface definitions of the library.
#define __stk_forceinline
Forces compiler to always inline the decorated function, regardless of optimisation level.
Definition stk_defs.h:104
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
void SetTls(Word tp)
Set thread-local storage (TLS).
EStackType
Stack type.
Definition stk_common.h:70
Word GetTls()
Get thread-local storage (TLS).
PlatformArmCortexM PlatformDefault
Default platform implementation.
Word TId
Definition stk_common.h:117
Concrete implementation of IPlatform driver for the Arm Cortex-M0, M3, M4, M7 processors.
void SleepUntil(Ticks timestamp)
Put calling process into a sleep state until the specified timestamp.
uint32_t GetTickResolution() const
Get resolution of the system tick timer in microseconds. Resolution means a number of microseconds be...
void ProcessTick()
Process one tick.
void Initialize(IEventHandler *event_handler, IKernelService *service, uint32_t resolution_us, Stack *exit_trap)
Initialize scheduler's context.
TId GetTid() const
Get thread Id.
void Sleep(Timeout ticks)
Put calling process into a sleep state.
Word GetCallerSP() const
Get caller's Stack Pointer (SP).
void Start()
Start scheduling.
void SwitchToNext()
Switch to a next task.
void Stop()
Stop scheduling.
bool InitStack(EStackType stack_type, Stack *stack, IStackMemory *stack_memory, ITask *user_task)
Initialize stack memory of the user task.
void SetEventOverrider(IEventOverrider *overrider)
Set platform event overrider.
IWaitObject * Wait(ISyncObject *sync_obj, IMutex *mutex, Timeout timeout)
void ProcessHardFault()
Cause a hard fault of the system.
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