hos/kernel/sys/timer.cc
josh bc7064e92a got interrupts working, added sys/{pic,timer,cpu} modules, ready to work on multitasking
git-svn-id: svn://anubis/hos/trunk@69 5b3e749e-e535-0410-8002-a9bb6afbdfca
2009-07-29 22:30:52 +00:00

13 lines
287 B
C++

#include "timer.h"
#include "portio.h"
void timer_init(u32_t freq)
{
/* how many ticks the PIT must wait before issuing an interrupt */
u32_t wait = 1193180 / freq;
outportb(0x43, 0x34);
outportb(0x40, wait); /* LSB */
outportb(0x40, wait >> 8); /* MSB */
}