diff --git a/arch/x86/kernel/timer.c b/arch/x86/kernel/timer.c index ff6679f5..81abf83c 100644 --- a/arch/x86/kernel/timer.c +++ b/arch/x86/kernel/timer.c @@ -76,7 +76,7 @@ int timer_init(void) return 0; } -#define LATCH ((CLOCK_TICK_RATE + TIMER_FREQ/2) / TIMER_FREQ) +#define LATCH(f) ((CLOCK_TICK_RATE + f/2) / f) int timer_set_frequency(unsigned int freq) { @@ -85,9 +85,9 @@ int timer_set_frequency(unsigned int freq) /* set the timer frequency */ outportb(0x43, 0x34); udelay(10); - outportb(0x40, LATCH & 0xFF); /* low byte */ + outportb(0x40, LATCH(freq) & 0xFF); /* low byte */ udelay(10); - outportb(0x40, LATCH >> 8); /* high byte */ + outportb(0x40, LATCH(freq) >> 8); /* high byte */ curr_timer_freq = freq;