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>
18 mc146818_read(unsigned reg
)
25 mc146818_write(unsigned reg
, unsigned datum
)
28 outb(IO_RTC
+1, datum
);
35 /* initialize 8253 clock to interrupt 100 times/sec */
36 outb(TIMER_MODE
, TIMER_SEL0
| TIMER_RATEGEN
| TIMER_16BIT
);
37 outb(IO_TIMER1
, TIMER_DIV(100) % 256);
38 outb(IO_TIMER1
, TIMER_DIV(100) / 256);
39 cprintf(" Setup timer interrupts via 8259A\n");
40 irq_setmask_8259A(irq_mask_8259A
& ~(1<<0));
41 cprintf(" unmasked timer interrupt\n");