mirror of
https://github.com/tailix/kernel.git
synced 2024-10-30 12:03:52 -04:00
18 lines
370 B
C
18 lines
370 B
C
#include "timer.h"
|
|
|
|
#include "logger.h"
|
|
#include "asm.h"
|
|
|
|
void timer_initialize(unsigned int frequency)
|
|
{
|
|
logger_info("Initialize timer.");
|
|
|
|
const unsigned int divisor = 1193180 / frequency;
|
|
|
|
const unsigned char l = divisor & 0xFF;
|
|
const unsigned char h = (divisor >> 8) & 0xFF;
|
|
|
|
outportb(0x43, 0x36);
|
|
outportb(0x40, l);
|
|
outportb(0x40, h);
|
|
}
|