10#ifndef STK_ARCH_COMMON_H_
11#define STK_ARCH_COMMON_H_
43 uint32_t resolution_us)
61 Word *stack_top = itr + stack_size;
66 while (itr < stack_top)
88#ifndef STK_ARCH_GET_CPU_ID
89 #define STK_ARCH_GET_CPU_ID() (0)
95#ifndef _STK_UNDER_TEST
96 #define GetContext() s_StkPlatformContext[STK_ARCH_GET_CPU_ID()]
106 return ((clock_freq *
static_cast<Cycles>(time_us)) / 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).
Namespace of STK package.
uintptr_t Word
Native processor word type.
static __stk_forceinline Cycles ConvertTimeUsToClockCycles(Cycles clock_freq, Ticks time_us)
Convert time (microseconds) to core clock cycles.
int64_t Ticks
Ticks value.
@ STACK_SIZE_MIN
Minimum stack size in elements of Word. Used as a lower bound for all stack allocations (user task,...
uint64_t Cycles
Cycles value.
__stk_forceinline Word PtrToWord(T *ptr) noexcept
Cast a pointer to a CPU register-width integer.
virtual void Initialize(IPlatform::IEventHandler *handler, IKernelService *service, Stack *exit_trap, uint32_t resolution_us)
Initialize context.
IPlatform::IEventHandler * m_handler
kernel event handler
Stack * m_stack_active
active task stack
~PlatformContext()
Destructor.
static Word * InitStackMemory(IStackMemory *memory)
Initialize stack memory by filling it with STK_STACK_MEMORY_FILLER.
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)
Interface for a stack memory region.
virtual size_t GetStackSize() const =0
Get number of elements of the stack memory array.
virtual Word * GetStack() const =0
Get pointer to the stack memory.
Interface for a back-end event handler.
Interface for the kernel services exposed to the user processes during run-time when Kernel started s...