2019-04-07 22:43:09 +00:00
|
|
|
#include <kernel/utils.h>
|
2019-06-27 18:57:54 +00:00
|
|
|
#include <kernel.h>
|
2019-04-07 22:43:09 +00:00
|
|
|
#include <kernel/serial.h>
|
2019-06-27 18:57:54 +00:00
|
|
|
#include <kernel/descriptor_tables.h>
|
2019-04-07 22:43:09 +00:00
|
|
|
|
|
|
|
size_t timer_ticks = 0;
|
|
|
|
size_t flag = 0;
|
2019-06-27 18:57:54 +00:00
|
|
|
void timer_handler(struct int_frame* r) {
|
|
|
|
gdb_end();
|
2019-04-07 22:43:09 +00:00
|
|
|
timer_ticks++;
|
|
|
|
|
|
|
|
if(timer_ticks % 18 == 0) {
|
|
|
|
if(++flag % 2 == 0) {
|
|
|
|
serial_print(0x3F8, "Tick.");
|
|
|
|
} else {
|
|
|
|
serial_print(0x3F8, "Tock.");
|
|
|
|
}
|
|
|
|
}
|
2019-06-27 18:57:54 +00:00
|
|
|
|
|
|
|
if(timer_ticks > 18)
|
|
|
|
timer_ticks = 0;
|
2019-04-07 22:43:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void timer_install() {
|
2019-06-27 18:57:54 +00:00
|
|
|
irq_install_handler(0, &timer_handler);
|
2019-04-07 22:43:09 +00:00
|
|
|
}
|