mirror of
https://github.com/RGBCube/serenity
synced 2025-05-25 22:15:06 +00:00
Kernel: Remove "stale callback" concept from time management
If a hardware timer doesn't have a callback registered, it's now simply represented by a null m_callback.
This commit is contained in:
parent
4b1f056e3a
commit
b035267afa
6 changed files with 7 additions and 11 deletions
|
@ -34,11 +34,11 @@ namespace Kernel {
|
||||||
|
|
||||||
NonnullRefPtr<HPETComparator> HPETComparator::create(u8 number, u8 irq, bool periodic_capable)
|
NonnullRefPtr<HPETComparator> HPETComparator::create(u8 number, u8 irq, bool periodic_capable)
|
||||||
{
|
{
|
||||||
return adopt(*new HPETComparator(number, irq, periodic_capable, [](const RegisterState& regs) { TimeManagement::stale_function(regs); }));
|
return adopt(*new HPETComparator(number, irq, periodic_capable));
|
||||||
}
|
}
|
||||||
|
|
||||||
HPETComparator::HPETComparator(u8 number, u8 irq, bool periodic_capable, Function<void(const RegisterState&)> callback)
|
HPETComparator::HPETComparator(u8 number, u8 irq, bool periodic_capable)
|
||||||
: HardwareTimer(irq, move(callback))
|
: HardwareTimer(irq)
|
||||||
, m_periodic(false)
|
, m_periodic(false)
|
||||||
, m_periodic_capable(periodic_capable)
|
, m_periodic_capable(periodic_capable)
|
||||||
, m_comparator_number(number)
|
, m_comparator_number(number)
|
||||||
|
|
|
@ -58,7 +58,7 @@ public:
|
||||||
private:
|
private:
|
||||||
void set_new_countdown();
|
void set_new_countdown();
|
||||||
virtual void handle_irq(const RegisterState&) override;
|
virtual void handle_irq(const RegisterState&) override;
|
||||||
HPETComparator(u8 number, u8 irq, bool periodic_capable, Function<void(const RegisterState&)> callback);
|
HPETComparator(u8 number, u8 irq, bool periodic_capable);
|
||||||
bool m_periodic : 1;
|
bool m_periodic : 1;
|
||||||
bool m_periodic_capable : 1;
|
bool m_periodic_capable : 1;
|
||||||
bool m_edge_triggered : 1;
|
bool m_edge_triggered : 1;
|
||||||
|
|
|
@ -37,7 +37,8 @@ HardwareTimer::HardwareTimer(u8 irq_number, Function<void(const RegisterState&)>
|
||||||
|
|
||||||
void HardwareTimer::handle_irq(const RegisterState& regs)
|
void HardwareTimer::handle_irq(const RegisterState& regs)
|
||||||
{
|
{
|
||||||
m_callback(regs);
|
if (!m_callback)
|
||||||
|
m_callback(regs);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* HardwareTimer::purpose() const
|
const char* HardwareTimer::purpose() const
|
||||||
|
|
|
@ -62,7 +62,7 @@ public:
|
||||||
virtual size_t calculate_nearest_possible_frequency(size_t frequency) const = 0;
|
virtual size_t calculate_nearest_possible_frequency(size_t frequency) const = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
HardwareTimer(u8 irq_number, Function<void(const RegisterState&)>);
|
HardwareTimer(u8 irq_number, Function<void(const RegisterState&)> = nullptr);
|
||||||
//^IRQHandler
|
//^IRQHandler
|
||||||
virtual void handle_irq(const RegisterState&) override;
|
virtual void handle_irq(const RegisterState&) override;
|
||||||
u64 m_frequency { OPTIMAL_TICKS_PER_SECOND_RATE };
|
u64 m_frequency { OPTIMAL_TICKS_PER_SECOND_RATE };
|
||||||
|
|
|
@ -90,10 +90,6 @@ time_t TimeManagement::boot_time() const
|
||||||
return RTC::boot_time();
|
return RTC::boot_time();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TimeManagement::stale_function(const RegisterState&)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
TimeManagement::TimeManagement(bool probe_non_legacy_hardware_timers)
|
TimeManagement::TimeManagement(bool probe_non_legacy_hardware_timers)
|
||||||
{
|
{
|
||||||
if (ACPI::is_enabled()) {
|
if (ACPI::is_enabled()) {
|
||||||
|
|
|
@ -57,7 +57,6 @@ public:
|
||||||
static void update_time(const RegisterState&);
|
static void update_time(const RegisterState&);
|
||||||
void increment_time_since_boot(const RegisterState&);
|
void increment_time_since_boot(const RegisterState&);
|
||||||
|
|
||||||
static void stale_function(const RegisterState&);
|
|
||||||
static bool is_hpet_periodic_mode_allowed();
|
static bool is_hpet_periodic_mode_allowed();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue