10#ifndef STK_ARCH_COMMON_H_
11#define STK_ARCH_COMMON_H_
43 uint32_t resolution_us)
65 for (
size_t i = 0U; i < stack.
GetSize(); ++i)
92#ifndef STK_ARCH_GET_CPU_ID
93 #define STK_ARCH_GET_CPU_ID() (0)
99#ifndef _STK_UNDER_TEST
100 #define GetContext() s_StkPlatformContext[STK_ARCH_GET_CPU_ID()]
110 return ((
static_cast<Cycles>(time_us) * clock_freq) / 1000000ULL);
Contains interface definitions of the library.
#define __stk_forceinline
Forces compiler to always inline the decorated function, regardless of optimisation level.
#define STK_ASSERT(e)
Runtime assertion. Halts execution if the expression e evaluates to false.
#define STK_STACK_MEMORY_ALIGN
Stack memory alignment.
#define STK_STACK_MEMORY_FILLER
Sentinel value written to the entire stack region at initialization (stack watermark pattern).
#define STK_VIRT_DTOR
Makes destructors virtual and compliant to strict rules if STK_STRICT_COMPLIANCY=0.
Namespace of STK package.
uintptr_t Word
Native processor word type.
static __stk_forceinline Cycles ConvertTimeUsToClockCycles(uint32_t clock_freq, Ticks time_us)
Convert time (microseconds) to core clock cycles.
@ STACK_SIZE_MIN
Minimum stack size in elements of Word. Used as a lower bound for all stack allocations (user task,...
int64_t Ticks
Ticks value.
uint64_t Cycles
Cycles value.
static constexpr Word PtrToWord(T *const ptr) noexcept
Cast a pointer to a CPU register-width integer.
Memory-related primitives.
virtual void Initialize(IPlatform::IEventHandler *handler, IKernelService *service, Stack *exit_trap, uint32_t resolution_us)
Initialize context.
IPlatform::IEventHandler * m_handler
kernel event handler
static Word InitStackMemory(IStackMemory *const memory)
Initialize stack memory by filling it with STK_STACK_MEMORY_FILLER.
Stack * m_stack_active
active task stack
STK_VIRT_DTOR ~PlatformContext()=default
Destructor.
Stack * m_stack_idle
idle task stack
IKernelService * m_service
kernel service
uint32_t m_tick_resolution
system tick resolution (microseconds)
STK_NONCOPYABLE_CLASS(PlatformContext)
Lightweight, non-owning view over a contiguous sequence of elements.
size_t GetSize() const
Get number of elements in the view.
Interface for a stack memory region.
Interface for a back-end event handler.
Interface for the kernel services exposed to the user processes during run-time when Kernel started s...