Move timer setup from post.c to clock.c.
diff --git a/src/post.c b/src/post.c
index ad60f99..1b9fc5b 100644
--- a/src/post.c
+++ b/src/post.c
@@ -82,35 +82,6 @@
}
static void
-pit_setup()
-{
- // timer0: binary count, 16bit count, mode 2
- outb(0x34, PORT_PIT_MODE);
- // maximum count of 0000H = 18.2Hz
- outb(0x0, PORT_PIT_COUNTER0);
- outb(0x0, PORT_PIT_COUNTER0);
-}
-
-static u32
-bcd2bin(u8 val)
-{
- return (val & 0xf) + ((val >> 4) * 10);
-}
-
-static void
-timer_setup()
-{
- u32 seconds = bcd2bin(inb_cmos(CMOS_RTC_SECONDS));
- u32 ticks = (seconds * 18206507) / 1000000;
- u32 minutes = bcd2bin(inb_cmos(CMOS_RTC_MINUTES));
- ticks += (minutes * 10923904) / 10000;
- u32 hours = bcd2bin(inb_cmos(CMOS_RTC_HOURS));
- ticks += (hours * 65543427) / 1000;
- SET_BDA(timer_counter, ticks);
- SET_BDA(timer_rollover, 0);
-}
-
-static void
pic_setup()
{
outb(0x11, PORT_PIC1);
@@ -215,11 +186,10 @@
init_handlers();
init_ebda();
- pit_setup();
+ timer_setup();
kbd_setup();
lpt_setup();
serial_setup();
- timer_setup();
pic_setup();
rom_scan(0xc0000, 0xc7800);