diff options
| author | Amlal El Mahrouss <amlal@el-mahrouss-logic.com> | 2024-05-21 09:10:57 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@el-mahrouss-logic.com> | 2024-05-21 09:10:57 +0200 |
| commit | 0c211cca4d7a4d836f4cb685345e44f3f2814fd1 (patch) | |
| tree | f08901e67cdabe025d8ad40c18c62b27b32c5517 /Kernel/Sources/Timer.cxx | |
| parent | f022a2afeb7af04ce3ef256ef617d19f07d84d9a (diff) | |
MHR-23: New CoreSystem calls and refactors.
Signed-off-by: Amlal El Mahrouss <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'Kernel/Sources/Timer.cxx')
| -rw-r--r-- | Kernel/Sources/Timer.cxx | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/Kernel/Sources/Timer.cxx b/Kernel/Sources/Timer.cxx new file mode 100644 index 00000000..0495677c --- /dev/null +++ b/Kernel/Sources/Timer.cxx @@ -0,0 +1,41 @@ +/* ------------------------------------------- + + Copyright SoftwareLabs + +------------------------------------------- */ + +#include <KernelKit/Timer.hpp> + +///! BUGS: 0 +///! @file Timer.cxx + +using namespace NewOS; + +/// @brief Unimplemented as it is an interface. +Int32 HardwareTimerInterface::Wait() noexcept +{ + return kErrorUnimplemented; +} + +/// @brief HardwareTimer class, meant to be generic. + +HardwareTimer::HardwareTimer(Int64 seconds) + : fWaitFor(seconds) +{ +} +HardwareTimer::~HardwareTimer() +{ + fWaitFor = 0; +} + +Int32 HardwareTimer::Wait() noexcept +{ + if (fWaitFor < 1) + return -1; + + while (*fDigitalTimer < (*fDigitalTimer + fWaitFor)) + { + } + + return 0; +} |
