version 1.1.1.1, 2008/06/03 10:38:45 |
version 1.1.1.1.2.1, 2008/08/13 17:12:30 |
|
|
#include <kernel.h> |
#include <kernel.h> |
#include <timer.h> |
#include <timer.h> |
#include <irq.h> |
#include <irq.h> |
#include <cpu.h> |
#include <locore.h> |
|
|
/* Interrupt vector for clock */ |
/* Interrupt vector for clock */ |
#define CLOCK_IRQ 0 |
#define CLOCK_IRQ 0 |
|
|
void |
void |
clock_init(void) |
clock_init(void) |
{ |
{ |
int clock_irq; |
irq_t clock_irq; |
|
|
outb_p(0x34, PIT_CTRL); /* Command to set generator mode */ |
outb_p(0x34, PIT_CTRL); /* Command to set generator mode */ |
outb_p((u_char)(PIT_LATCH & 0xff), PIT_CH0); /* LSB */ |
outb_p((u_char)(PIT_LATCH & 0xff), PIT_CH0); /* LSB */ |
outb_p((u_char)((PIT_LATCH >> 8) & 0xff), PIT_CH0); /* MSB */ |
outb_p((u_char)((PIT_LATCH >> 8) & 0xff), PIT_CH0); /* MSB */ |
|
|
clock_irq = irq_attach(CLOCK_IRQ, IPL_CLOCK, 0, clock_isr, NULL); |
clock_irq = irq_attach(CLOCK_IRQ, IPL_CLOCK, 0, &clock_isr, NULL); |
ASSERT(clock_irq != -1); |
ASSERT(clock_irq != NULL); |
|
|
printk("Clock rate: %d ticks/sec\n", CONFIG_HZ); |
DPRINTF(("Clock rate: %d ticks/sec\n", CONFIG_HZ)); |
} |
} |