diff --git a/kernel/include/timer.hpp b/kernel/include/timer.hpp index 1d12088e..e7dff5fe 100644 --- a/kernel/include/timer.hpp +++ b/kernel/include/timer.hpp @@ -40,12 +40,12 @@ void tick(); /*! * \brief Return the frequency in Hz of the current timer system. */ -uint64_t frequency(); +uint64_t timer_frequency(); /*! * \brief Sets the frequency in Hz of the current timer system. */ -void frequency(uint64_t freq); +void timer_frequency(uint64_t freq); } //end of timer namespace diff --git a/kernel/src/drivers/hpet.cpp b/kernel/src/drivers/hpet.cpp index efdab794..b91862e3 100644 --- a/kernel/src/drivers/hpet.cpp +++ b/kernel/src/drivers/hpet.cpp @@ -152,7 +152,7 @@ void hpet::late_install(){ // Update the current frequency (this will update the sleeping task as well) - timer::frequency(current_frequency); + timer::timer_frequency(current_frequency); // Uninstall the PIT driver pit::remove(); diff --git a/kernel/src/drivers/pit.cpp b/kernel/src/drivers/pit.cpp index bf1409cd..a62c9aad 100644 --- a/kernel/src/drivers/pit.cpp +++ b/kernel/src/drivers/pit.cpp @@ -29,7 +29,7 @@ bool pit::install(){ out_byte(0x40, static_cast(divisor >> 8)); // Indicate the timer frequency - timer::frequency(1000); + timer::timer_frequency(1000); if(!interrupt::register_irq_handler(0, timer_handler, nullptr)){ logging::logf(logging::log_level::ERROR, "Unable to register PIT IRQ handler 0\n"); diff --git a/kernel/src/scheduler.cpp b/kernel/src/scheduler.cpp index de2cb665..898e0ec2 100644 --- a/kernel/src/scheduler.cpp +++ b/kernel/src/scheduler.cpp @@ -875,7 +875,7 @@ void scheduler::sleep_ms(pid_t pid, size_t time){ thor_assert(pcb[pid].state == process_state::RUNNING, "Only RUNNING processes can sleep"); // Compute the amount of ticks to sleep - auto sleep_ticks = time * (timer::frequency() / 1000); + auto sleep_ticks = time * (timer::timer_frequency() / 1000); sleep_ticks = !sleep_ticks ? 1 : sleep_ticks; logging::logf(logging::log_level::DEBUG, "Put %u to sleep for %u ticks\n", pid, sleep_ticks); diff --git a/kernel/src/thor_acpi.cpp b/kernel/src/thor_acpi.cpp index a0165e10..7ab07bab 100644 --- a/kernel/src/thor_acpi.cpp +++ b/kernel/src/thor_acpi.cpp @@ -167,7 +167,7 @@ void AcpiOsSleep(UINT64 ms){ */ void AcpiOsStall(UINT32 us){ auto ticks = timer::ticks(); - auto wait = us * (timer::frequency() / 1000000); + auto wait = us * (timer::timer_frequency() / 1000000); wait = !wait ? 1 : wait; while(timer::ticks() != ticks + wait){ diff --git a/kernel/src/timer.cpp b/kernel/src/timer.cpp index 0bd4671c..6791f24f 100644 --- a/kernel/src/timer.cpp +++ b/kernel/src/timer.cpp @@ -59,11 +59,11 @@ void timer::tick(){ scheduler::tick(); - if(_timer_ticks % frequency() == 0){ + if(_timer_ticks % timer_frequency() == 0){ ++_timer_seconds; } - if(_timer_ticks % (frequency() / 1000) == 0){ + if(_timer_ticks % (timer_frequency() / 1000) == 0){ ++_timer_milliseconds; } } @@ -80,11 +80,11 @@ uint64_t timer::milliseconds(){ return _timer_milliseconds; } -uint64_t timer::frequency(){ +uint64_t timer::timer_frequency(){ return _timer_frequency; } -void timer::frequency(uint64_t freq){ +void timer::timer_frequency(uint64_t freq){ auto old_frequency = _timer_frequency; _timer_frequency = freq;