10#ifndef STK_ARCH_RISC_V_H_
11#define STK_ARCH_RISC_V_H_
75 __asm
volatile(
"mv %0, tp" :
"=r"(tp) : : );
85 __asm
volatile(
"mv tp, %0" : :
"r"(tp) : );
89#define _STK_INLINE_TLS_DEFINED 1
96#define __stk_dmb() __asm volatile("fence rw, rw" ::: "memory")
102#ifndef STK_SUBMICORSECOND_PRECISION_TIMER
103 #define STK_SUBMICORSECOND_PRECISION_TIMER 0
109#ifndef STK_SYSTEM_CORE_CLOCK_VAR
110 #define STK_SYSTEM_CORE_CLOCK_VAR SystemCoreClock
116#ifndef STK_SYSTEM_CORE_CLOCK_FREQUENCY
117 #define STK_SYSTEM_CORE_CLOCK_FREQUENCY 150000000U
#define STK_SYSTEM_CORE_CLOCK_VAR
Definition of the system core clock variable holding frequency of the CPU in Hz.
Contains interface definitions of the library.
#define __stk_forceinline
Forces compiler to always inline the decorated function, regardless of optimisation level.
Namespace of STK package.
uintptr_t Word
Native processor word type.
int64_t Ticks
Ticks value.
int32_t Timeout
Timeout time (ticks).
void SetTls(Word tp)
Set thread-local storage (TLS).
Word GetTls()
Get thread-local storage (TLS).
PlatformArmCortexM PlatformDefault
Default platform implementation.
Concrete implementation of IPlatform driver for the Risc-V processors.
~PlatformRiscV()
Destructor.
void SetEventOverrider(IEventOverrider *overrider)
Set platform event overrider.
void Initialize(IEventHandler *event_handler, IKernelService *service, uint32_t resolution_us, Stack *exit_trap)
Initialize scheduler's context.
void SleepUntil(Ticks timestamp)
Put calling process into a sleep state until the specified timestamp.
void SetSpecificEventHandler(ISpecificEventHandler *handler)
void Stop()
Stop scheduling.
void Sleep(Timeout ticks)
Put calling process into a sleep state.
void SwitchToNext()
Switch to a next task.
void ProcessTick()
Process one tick.
uint32_t GetTickResolution() const
Get resolution of the system tick timer in microseconds. Resolution means a number of microseconds be...
bool InitStack(EStackType stack_type, Stack *stack, IStackMemory *stack_memory, ITask *user_task)
Initialize stack memory of the user task.
void ProcessHardFault()
Cause a hard fault of the system.
IWaitObject * Wait(ISyncObject *sync_obj, IMutex *mutex, Timeout timeout)
Word GetCallerSP() const
Get caller's Stack Pointer (SP).
TId GetTid() const
Get thread Id.
void Start()
Start scheduling.
virtual bool OnException(Word cause)=0
Called by ISR handler on IRQ_XXX (see encoding.h).
Interface for a stack memory region.
Interface for mutex synchronization primitive.
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...