mirror of
https://github.com/wichtounet/thor-os.git
synced 2025-09-13 14:36:37 -04:00
Rename frequency() -> timer_frequency()
This commit is contained in:
parent
63437983eb
commit
b08c84dbc4
@ -40,12 +40,12 @@ void tick();
|
|||||||
/*!
|
/*!
|
||||||
* \brief Return the frequency in Hz of the current timer system.
|
* \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.
|
* \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
|
} //end of timer namespace
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ void hpet::late_install(){
|
|||||||
|
|
||||||
// Update the current frequency (this will update the sleeping task as well)
|
// 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
|
// Uninstall the PIT driver
|
||||||
pit::remove();
|
pit::remove();
|
||||||
|
@ -29,7 +29,7 @@ bool pit::install(){
|
|||||||
out_byte(0x40, static_cast<uint8_t>(divisor >> 8));
|
out_byte(0x40, static_cast<uint8_t>(divisor >> 8));
|
||||||
|
|
||||||
// Indicate the timer frequency
|
// Indicate the timer frequency
|
||||||
timer::frequency(1000);
|
timer::timer_frequency(1000);
|
||||||
|
|
||||||
if(!interrupt::register_irq_handler(0, timer_handler, nullptr)){
|
if(!interrupt::register_irq_handler(0, timer_handler, nullptr)){
|
||||||
logging::logf(logging::log_level::ERROR, "Unable to register PIT IRQ handler 0\n");
|
logging::logf(logging::log_level::ERROR, "Unable to register PIT IRQ handler 0\n");
|
||||||
|
@ -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");
|
thor_assert(pcb[pid].state == process_state::RUNNING, "Only RUNNING processes can sleep");
|
||||||
|
|
||||||
// Compute the amount of ticks to 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;
|
sleep_ticks = !sleep_ticks ? 1 : sleep_ticks;
|
||||||
|
|
||||||
logging::logf(logging::log_level::DEBUG, "Put %u to sleep for %u ticks\n", pid, sleep_ticks);
|
logging::logf(logging::log_level::DEBUG, "Put %u to sleep for %u ticks\n", pid, sleep_ticks);
|
||||||
|
@ -167,7 +167,7 @@ void AcpiOsSleep(UINT64 ms){
|
|||||||
*/
|
*/
|
||||||
void AcpiOsStall(UINT32 us){
|
void AcpiOsStall(UINT32 us){
|
||||||
auto ticks = timer::ticks();
|
auto ticks = timer::ticks();
|
||||||
auto wait = us * (timer::frequency() / 1000000);
|
auto wait = us * (timer::timer_frequency() / 1000000);
|
||||||
wait = !wait ? 1 : wait;
|
wait = !wait ? 1 : wait;
|
||||||
|
|
||||||
while(timer::ticks() != ticks + wait){
|
while(timer::ticks() != ticks + wait){
|
||||||
|
@ -59,11 +59,11 @@ void timer::tick(){
|
|||||||
|
|
||||||
scheduler::tick();
|
scheduler::tick();
|
||||||
|
|
||||||
if(_timer_ticks % frequency() == 0){
|
if(_timer_ticks % timer_frequency() == 0){
|
||||||
++_timer_seconds;
|
++_timer_seconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_timer_ticks % (frequency() / 1000) == 0){
|
if(_timer_ticks % (timer_frequency() / 1000) == 0){
|
||||||
++_timer_milliseconds;
|
++_timer_milliseconds;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -80,11 +80,11 @@ uint64_t timer::milliseconds(){
|
|||||||
return _timer_milliseconds;
|
return _timer_milliseconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t timer::frequency(){
|
uint64_t timer::timer_frequency(){
|
||||||
return _timer_frequency;
|
return _timer_frequency;
|
||||||
}
|
}
|
||||||
|
|
||||||
void timer::frequency(uint64_t freq){
|
void timer::timer_frequency(uint64_t freq){
|
||||||
auto old_frequency = _timer_frequency;
|
auto old_frequency = _timer_frequency;
|
||||||
|
|
||||||
_timer_frequency = freq;
|
_timer_frequency = freq;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user