2017-11-03 04:19:48 +00:00
|
|
|
#include "timer.h"
|
|
|
|
|
2021-12-20 06:14:07 +00:00
|
|
|
#include <kernaux/asm/i386.h>
|
2022-06-23 10:51:42 +00:00
|
|
|
#include <kernaux/drivers/console.h>
|
2022-06-24 02:07:53 +00:00
|
|
|
#include <kernaux/drivers/intel_8253_pit.h>
|
2017-11-03 04:19:48 +00:00
|
|
|
|
|
|
|
void timer_initialize(unsigned int frequency)
|
|
|
|
{
|
2022-06-23 10:51:42 +00:00
|
|
|
kernaux_drivers_console_print("[INFO] timer: Initialize timer.\n");
|
2022-06-24 02:07:53 +00:00
|
|
|
kernaux_drivers_intel_8253_pit_initialize(frequency);
|
2017-11-03 04:19:48 +00:00
|
|
|
}
|
2017-11-03 05:10:07 +00:00
|
|
|
|
|
|
|
void timer_register_handler(timer_handler_t handler)
|
|
|
|
{
|
|
|
|
hwint_register_handler(0, handler);
|
|
|
|
}
|
2017-11-06 12:06:28 +00:00
|
|
|
|
|
|
|
void timer_unregister_handler()
|
|
|
|
{
|
|
|
|
hwint_unregister_handler(0);
|
|
|
|
}
|