QTechOS/kernel/drivers/opensbi/extensions/timer.cpp
Quantum dbfd13630d
OpenSBI: Added timer extension
NOTE: I didn't switch to the new functions in the kernel because for
some reason we get a page fault when trying to fetch the first
instruction of set_timer(addi sp, sp, -48). I doubt this is related to
the set_timer funcion itself and is instead some kind of paging or
linking problem because it works fine with paging disabled and really
just doesnt make sense.
2022-01-23 23:56:46 -05:00

25 lines
531 B
C++

#include "opensbi/extensions/timer.h"
namespace drivers {
namespace opensbi::timer {
namespace {
enum class ExtensionId {
TIMER = 0x54494D45
};
enum class FunctionId {
SET_TIMER,
};
}
SbiRet set_timer(uint64_t stime_value) {
return ecall(
static_cast<sbiword_t>(ExtensionId::TIMER),
static_cast<sbiword_t>(FunctionId::SET_TIMER),
stime_value);
}
} // End namespace opensbi::timer
} // End namespace drivers