aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2013-09-14 13:09:27 -0400
committerKevin O'Connor <kevin@koconnor.net>2013-09-18 20:48:34 -0400
commit0ac5e9e0fc84032c99d9be6c4903afb2d616c97f (patch)
tree2621518698d9f9d10ac0f72c620150876b49f1ca
parentb9c6a960808451d75acd9c048f418dd2c92ac59d (diff)
downloadseabios-0ac5e9e0fc84032c99d9be6c4903afb2d616c97f.tar.gz
Move keyboard calling code from util.c to boot.c.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r--src/boot.c44
-rw-r--r--src/util.c41
-rw-r--r--src/util.h1
3 files changed, 43 insertions, 43 deletions
diff --git a/src/boot.c b/src/boot.c
index bbe9155..3542283 100644
--- a/src/boot.c
+++ b/src/boot.c
@@ -1,6 +1,6 @@
// Code to load disk image and start system boot.
//
-// Copyright (C) 2008-2010 Kevin O'Connor <kevin@koconnor.net>
+// Copyright (C) 2008-2013 Kevin O'Connor <kevin@koconnor.net>
// Copyright (C) 2002 MandrakeSoft S.A.
//
// This file may be distributed under the terms of the GNU LGPLv3 license.
@@ -396,6 +396,48 @@ boot_add_cbfs(void *data, const char *desc, int prio)
/****************************************************************
+ * Keyboard calls
+ ****************************************************************/
+
+// See if a keystroke is pending in the keyboard buffer.
+static int
+check_for_keystroke(void)
+{
+ struct bregs br;
+ memset(&br, 0, sizeof(br));
+ br.flags = F_IF|F_ZF;
+ br.ah = 1;
+ call16_int(0x16, &br);
+ return !(br.flags & F_ZF);
+}
+
+// Return a keystroke - waiting forever if necessary.
+static int
+get_raw_keystroke(void)
+{
+ struct bregs br;
+ memset(&br, 0, sizeof(br));
+ br.flags = F_IF;
+ call16_int(0x16, &br);
+ return br.ah;
+}
+
+// Read a keystroke - waiting up to 'msec' milliseconds.
+static int
+get_keystroke(int msec)
+{
+ u32 end = irqtimer_calc(msec);
+ for (;;) {
+ if (check_for_keystroke())
+ return get_raw_keystroke();
+ if (irqtimer_check(end))
+ return -1;
+ yield_toirq();
+ }
+}
+
+
+/****************************************************************
* Boot menu and BCV execution
****************************************************************/
diff --git a/src/util.c b/src/util.c
index dd7afdf..ee59b13 100644
--- a/src/util.c
+++ b/src/util.c
@@ -233,44 +233,3 @@ nullTrailingSpace(char *buf)
while (end >= buf && *end <= ' ')
*(end--) = '\0';
}
-
-/****************************************************************
- * Keyboard calls
- ****************************************************************/
-
-// See if a keystroke is pending in the keyboard buffer.
-static int
-check_for_keystroke(void)
-{
- struct bregs br;
- memset(&br, 0, sizeof(br));
- br.flags = F_IF|F_ZF;
- br.ah = 1;
- call16_int(0x16, &br);
- return !(br.flags & F_ZF);
-}
-
-// Return a keystroke - waiting forever if necessary.
-static int
-get_raw_keystroke(void)
-{
- struct bregs br;
- memset(&br, 0, sizeof(br));
- br.flags = F_IF;
- call16_int(0x16, &br);
- return br.ah;
-}
-
-// Read a keystroke - waiting up to 'msec' milliseconds.
-int
-get_keystroke(int msec)
-{
- u32 end = irqtimer_calc(msec);
- for (;;) {
- if (check_for_keystroke())
- return get_raw_keystroke();
- if (irqtimer_check(end))
- return -1;
- yield_toirq();
- }
-}
diff --git a/src/util.h b/src/util.h
index 70114a6..4fa0939 100644
--- a/src/util.h
+++ b/src/util.h
@@ -30,7 +30,6 @@ void *memmove(void *d, const void *s, size_t len);
char *strtcpy(char *dest, const char *src, size_t len);
char *strchr(const char *s, int c);
void nullTrailingSpace(char *buf);
-int get_keystroke(int msec);
// stacks.c
extern u8 ExtraStack[], *StackPos;