mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 15:58:11 +00:00
Implement event loop timers.
GObjects can now register a timer with the GEventLoop. This will eventually cause GTimerEvents to be dispatched to the GObject. This needed a few supporting changes in the kernel: - The PIT now ticks 1000 times/sec. - select() now supports an arbitrary timeout. - gettimeofday() now returns something in the tv_usec field. With these changes, the clock window in guitest2 finally ticks on its own.
This commit is contained in:
parent
9153666e72
commit
95c3442d59
10 changed files with 140 additions and 7 deletions
|
@ -57,16 +57,26 @@ asm(
|
|||
|
||||
#define BASE_FREQUENCY 1193182
|
||||
|
||||
static dword s_ticks_since_boot;
|
||||
|
||||
void timer_interrupt_handler(RegisterDump& regs)
|
||||
{
|
||||
IRQHandlerScope scope(IRQ_TIMER);
|
||||
++s_ticks_since_boot;
|
||||
Scheduler::timer_tick(regs);
|
||||
}
|
||||
|
||||
namespace PIT {
|
||||
|
||||
dword ticks_since_boot()
|
||||
{
|
||||
return s_ticks_since_boot;
|
||||
}
|
||||
|
||||
void initialize()
|
||||
{
|
||||
s_ticks_since_boot = 0;
|
||||
|
||||
word timer_reload;
|
||||
|
||||
IO::out8(PIT_CTL, TIMER0_SELECT | WRITE_WORD | MODE_SQUARE_WAVE);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue