+/* for sound we use MIDAS, which takes over the PIT and we can't use it
+ * therefore only compile this file for NO_SOUND builds.
+ */
+#ifdef NO_SOUND
+
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#endif
#ifdef __DJGPP__
-#include <stdint.h>
#include <dpmi.h>
#include <go32.h>
#include <pc.h>
#endif
#include "pit8254.h"
+#include "inttypes.h"
+#include "util.h"
#define PIT_TIMER_INTR 8
#define DOS_TIMER_INTR 0x1c
static void INTERRUPT timer_irq();
-static unsigned long ticks;
+static volatile unsigned long ticks;
static unsigned long tick_interval, ticks_per_dos_intr;
static int inum;
return ticks * tick_interval;
}
+void sleep_msec(unsigned long msec)
+{
+ unsigned long wakeup_time = ticks + msec / tick_interval;
+ while(ticks < wakeup_time) {
+#ifdef USE_HLT
+ halt();
+#endif
+ }
+}
+
static void set_timer_reload(int reload_val)
{
outp(PORT_CMD, CMD_CHAN0 | CMD_ACCESS_BOTH | CMD_OP_SQWAVE);
/* send EOI to the PIC */
outp(PIC1_CMD, OCW2_EOI);
}
+
+#endif /* NO_SOUND */