1 /* See COPYRIGHT for copyright information. */
3 /* Support for two time-related hardware gadgets: 1) the run time
4 * clock with its NVRAM access functions; 2) the 8253 timer, which
5 * generates interrupts on IRQ 0.
10 #include <inc/isareg.h>
11 #include <inc/timerreg.h>
13 #include <kern/kclock.h>
14 #include <kern/picirq.h>
17 mc146818_read(unsigned reg
)
24 mc146818_write(unsigned reg
, unsigned datum
)
27 outb(IO_RTC
+1, datum
);
33 /* initialize 8253 clock to interrupt 100 times/sec */
34 outb(TIMER_MODE
, TIMER_SEL0
| TIMER_RATEGEN
| TIMER_16BIT
);
35 outb(IO_TIMER1
, TIMER_DIV(100) % 256);
36 outb(IO_TIMER1
, TIMER_DIV(100) / 256);
37 cprintf(" Setup timer interrupts via 8259A\n");
38 irq_setmask_8259A(irq_mask_8259A
& ~(1<<0));
39 cprintf(" unmasked timer interrupt\n");