summaryrefslogtreecommitdiffhomepage
path: root/dev/ZKA/Sources/Timer.cxx
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-08-20 02:53:51 +0200
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-08-20 02:53:51 +0200
commit4eb813ba7247d9e2bebf255ecc50f68c0a71bb72 (patch)
treef818bb72f3dcad6e03d77d7b2280b3172f9d29df /dev/ZKA/Sources/Timer.cxx
parent860e40b89cca46050850afc79da958bb651d713f (diff)
+ IMP: Using Hybrid MP services on ZKA_EFI firmware.
+ Implement HPET on HardwareTimer and added a SoftwareTimer. + Implemented Hybrid MP Services on EFI.hxx. Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/ZKA/Sources/Timer.cxx')
-rw-r--r--dev/ZKA/Sources/Timer.cxx18
1 files changed, 11 insertions, 7 deletions
diff --git a/dev/ZKA/Sources/Timer.cxx b/dev/ZKA/Sources/Timer.cxx
index 041c4b67..7a5ebd8d 100644
--- a/dev/ZKA/Sources/Timer.cxx
+++ b/dev/ZKA/Sources/Timer.cxx
@@ -8,36 +8,40 @@
///! BUGS: 0
///! @file Timer.cxx
+///! @brief Software Timer implementation
using namespace Kernel;
/// @brief Unimplemented as it is an interface.
-Int32 HardwareTimerInterface::Wait() noexcept
+Int32 TimerInterface::Wait() noexcept
{
return kErrorUnimplemented;
}
-/// @brief HardwareTimer class, meant to be generic.
+/// @brief SoftwareTimer class, meant to be generic.
-HardwareTimer::HardwareTimer(Int64 seconds)
+SoftwareTimer::SoftwareTimer(Int64 seconds)
: fWaitFor(seconds)
{
- MUST_PASS(fWaitFor > 0);
+ fDigitalTimer = new IntPtr();
+ MUST_PASS(fDigitalTimer);
+
}
-HardwareTimer::~HardwareTimer()
+SoftwareTimer::~SoftwareTimer()
{
+ delete fDigitalTimer;
fWaitFor = 0;
}
-Int32 HardwareTimer::Wait() noexcept
+Int32 SoftwareTimer::Wait() noexcept
{
if (fWaitFor < 1)
return -1;
while (*fDigitalTimer < (*fDigitalTimer + fWaitFor))
{
- ;
+ ++fDigitalTimer;
}
return 0;