13 lines
287 B
C++
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 */
|
|
}
|