summaryrefslogtreecommitdiffstats
path: root/src/core/timer.c
diff options
context:
space:
mode:
authorMichael Brown2005-03-08 19:53:11 +0100
committerMichael Brown2005-03-08 19:53:11 +0100
commit3d6123e69ab879c72ff489afc5bf93ef0b7a94ce (patch)
tree9f3277569153a550fa8d81ebd61bd88f266eb8da /src/core/timer.c
downloadipxe-3d6123e69ab879c72ff489afc5bf93ef0b7a94ce.tar.gz
ipxe-3d6123e69ab879c72ff489afc5bf93ef0b7a94ce.tar.xz
ipxe-3d6123e69ab879c72ff489afc5bf93ef0b7a94ce.zip
Initial revision
Diffstat (limited to 'src/core/timer.c')
-rw-r--r--src/core/timer.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/core/timer.c b/src/core/timer.c
new file mode 100644
index 00000000..d4d38ad5
--- /dev/null
+++ b/src/core/timer.c
@@ -0,0 +1,30 @@
+/* A couple of routines to implement a low-overhead timer for drivers */
+
+ /*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2, or (at
+ * your option) any later version.
+ */
+
+#include "etherboot.h"
+#include "timer.h"
+
+/* Machine Independant timer helper functions */
+
+void mdelay(unsigned int msecs)
+{
+ unsigned int i;
+ for(i = 0; i < msecs; i++) {
+ udelay(1000);
+ poll_interruptions();
+ }
+}
+
+void waiton_timer2(unsigned int ticks)
+{
+ load_timer2(ticks);
+ while(timer2_running()) {
+ poll_interruptions();
+ }
+}