summaryrefslogtreecommitdiffstats
path: root/usr.bin/doscmd/timer.c
diff options
context:
space:
mode:
authordyson <dyson@FreeBSD.org>1997-08-09 01:43:15 +0000
committerdyson <dyson@FreeBSD.org>1997-08-09 01:43:15 +0000
commit305573cb2990c5d329d149cef5a3b5533b1e8fd9 (patch)
treedf06304b637358dbe8a006fdb7a6ea5955fee179 /usr.bin/doscmd/timer.c
parentdede28832bba6a9de7a428ff58df92439bddbc9c (diff)
downloadFreeBSD-src-305573cb2990c5d329d149cef5a3b5533b1e8fd9.zip
FreeBSD-src-305573cb2990c5d329d149cef5a3b5533b1e8fd9.tar.gz
Add our doscmd to the tree. This is a result of work from BSDI, and
a group of dos emulator developers. Submitted by: Jonathan Lemon <jlemon@americantv.com> Obtained from: BSDI
Diffstat (limited to 'usr.bin/doscmd/timer.c')
-rw-r--r--usr.bin/doscmd/timer.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/usr.bin/doscmd/timer.c b/usr.bin/doscmd/timer.c
new file mode 100644
index 0000000..afaa69f
--- /dev/null
+++ b/usr.bin/doscmd/timer.c
@@ -0,0 +1,50 @@
+/*
+** No copyright?!
+**
+** $Id: timer.c,v 1.3 1996/09/22 15:42:59 miff Exp $
+*/
+#include "doscmd.h"
+
+static void
+int08(regcontext_t *REGS)
+{
+ softint(0x1c);
+}
+
+static void
+int1c(regcontext_t *REGS)
+{
+}
+
+unsigned char timer;
+
+static u_char
+inb_timer(int port)
+{
+ return (--timer);
+}
+
+void
+timer_init(void)
+{
+ u_long vec;
+ struct itimerval itv;
+
+ vec = insert_hardint_trampoline();
+ ivec[0x08] = vec;
+ register_callback(vec, int08, "int 08");
+
+ vec = insert_softint_trampoline();
+ ivec[0x1c] = vec;
+ register_callback(vec, int1c, "int 1c");
+
+ define_input_port_handler(0x42, inb_timer);
+ define_input_port_handler(0x40, inb_timer);
+
+ itv.it_interval.tv_sec = 0;
+ itv.it_interval.tv_usec = 54925; /* 1193182/65536 times per second */
+ itv.it_value.tv_sec = 0;
+ itv.it_value.tv_usec = 54925; /* 1193182/65536 times per second */
+ if (! timer_disable)
+ setitimer(ITIMER_REAL, &itv, 0);
+}
OpenPOWER on IntegriCloud