10#ifndef STK_ARCH_RISC_V_H_
11#define STK_ARCH_RISC_V_H_
71#if STK_TLS && STK_TLS_PREFER_REGISTER
80 __asm
volatile(
"mv %0, tp" :
"=r"(tp) : : );
90 __asm
volatile(
"mv tp, %0" : :
"r"(tp) : );
94#define STK_INLINE_TLS (1)
108#ifndef STK_SUBMICORSECOND_PRECISION_TIMER
109 #define STK_SUBMICORSECOND_PRECISION_TIMER 0
115#ifndef STK_SYSTEM_CORE_CLOCK_FREQUENCY
116 #define STK_SYSTEM_CORE_CLOCK_FREQUENCY 150000000U
static __stk_forceinline void __stk_dmb()
Data memory barrier.
volatile uint32_t STK_SYSTEM_CORE_CLOCK_VAR
System clock frequency in Hz.
Contains interface definitions of the library.
#define __stk_forceinline
Forces compiler to always inline the decorated function, regardless of optimisation level.
#define STK_VIRT_DTOR
Expands to nothing if STK_STRICT_COMPLIANCY=0 (non-virtual destructors, smaller objects),...
Namespace of STK package.
uintptr_t Word
Native processor word type.
int32_t Timeout
Timeout time (ticks).
PlatformArmCortexM PlatformDefault
Default platform implementation.
uint64_t Cycles
Cycles value.
Word TId
Task (thread) id.
Concrete implementation of IPlatform driver for RISC-V processors.
Cycles GetSysTimerCount() const override
Get system timer count value.
Word GetCallerSP() const override
Get caller's Stack Pointer (SP).
void Resume(Timeout elapsed_ticks) override
Resume scheduling after a prior Suspend() call.
void Start() override
Start scheduling.
uint32_t GetTickResolution() const override
Get resolution of the system tick timer in microseconds. Resolution means a number of microseconds be...
uint32_t GetSysTimerFrequency() const override
Get system timer frequency.
void ProcessHardFault() override
Cause a hard fault of the system.
void InitStack(EStackType stack_type, Stack *stack, IStackMemory *stack_memory, ITask *user_task) override
Initialize stack memory of the user task.
void ProcessTick() override
Process one tick.
TId GetTid() const override
Get thread Id.
void ForceContextSwitch(TId id) override
Force context switch.
void SetSpecificEventHandler(ISpecificEventHandler *handler)
void SetCpuFrequency(uint8_t core_id, uint32_t frequency) override
Notify the scheduler of a CPU core's operating frequency.
void SetEventOverrider(IEventOverrider *overrider, bool non_secure) override
Set platform event overrider.
void Stop() override
Stop scheduling.
STK_VIRT_DTOR ~PlatformRiscV()=default
Destructor.
Timeout Suspend() override
Suspend scheduling.
void Initialize(IEventHandler *event_handler, IKernelService *service, uint32_t resolution_us, Stack *exit_trap) override
Initialize scheduler's context.
RISC-V specific event handler, see SetSpecificEventHandler().
virtual bool OnException(Word cause)=0
Called by the trap handler for a RISC-V exception/interrupt cause (IRQ_XXX, see encoding....
Interface for a stack memory region.
Interface for a user task.
Interface for a platform driver.
Interface for a back-end event handler.
Interface for a platform event overrider.
Interface for the kernel services exposed to the user processes during run-time when Kernel started s...