OUT=out/
# Source files
-SRCBOTH=output.c util.c floppy.c ata.c kbd.c pci.c boot.c serial.c
-SRC16=$(SRCBOTH) disk.c system.c clock.c mouse.c cdrom.c apm.c pcibios.c
+SRCBOTH=output.c util.c floppy.c ata.c kbd.c pci.c boot.c serial.c clock.c
+SRC16=$(SRCBOTH) disk.c system.c mouse.c cdrom.c apm.c pcibios.c
SRC32=$(SRCBOTH) post.c rombios32.c post_menu.c
TABLESRC=font.c cbt.c floppy_dbt.c
#define DEBUGF1(fmt, args...) bprintf(0, fmt , ##args)
#define DEBUGF(fmt, args...)
+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);
+}
+
+void
+timer_setup()
+{
+ pit_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
init_rtc()
{
, offsetof(struct extended_bios_data_area_s, fdpt[1]));
}
-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()
{
init_handlers();
init_ebda();
- pit_setup();
+ timer_setup();
kbd_setup();
lpt_setup();
serial_setup();
- timer_setup();
pic_setup();
rom_scan(0xc0000, 0xc7800);
void lpt_setup();
// clock.c
+void timer_setup();
void handle_1583(struct bregs *regs);
// apm.c