summaryrefslogtreecommitdiff
path: root/dev/console.cc
diff options
context:
space:
mode:
authorNathan Binkert <binkertn@umich.edu>2003-12-22 17:51:14 -0500
committerNathan Binkert <binkertn@umich.edu>2003-12-22 17:51:14 -0500
commit318e0c93edd23aec24cfc16a1bf5e4119253b5f7 (patch)
tree0a3de3e6107b04dd437bb6892204e6d8ebff2a46 /dev/console.cc
parentc3ba166e65b0f2c0ac4a92fedddd86d071e21640 (diff)
downloadgem5-318e0c93edd23aec24cfc16a1bf5e4119253b5f7.tar.xz
add support for simple character input via the system console
dev/alpha_access.h: - use our standard types instead of this extra typedef - advance the ALPHA_ACCESS version since the interface has changed. *this means you need a new console binary* - shuffle a couple things around to pack the data structure a bit better - add a placeholder for character input dev/alpha_console.cc: Clean up the read code path a bit and add support for character input via the console Clean up the write path and use a switch instead of a bunch of if statements --HG-- extra : convert_revision : a1a5bc8fed9ec9c4c46548fdf79604661668b81a
Diffstat (limited to 'dev/console.cc')
-rw-r--r--dev/console.cc27
1 files changed, 19 insertions, 8 deletions
diff --git a/dev/console.cc b/dev/console.cc
index ab2a284aa..f4156207d 100644
--- a/dev/console.cc
+++ b/dev/console.cc
@@ -223,21 +223,32 @@ SimConsole::configTerm()
}
}
-int
+#define MORE_PENDING (ULL(1) << 61)
+#define RECEIVE_SUCCESS (ULL(0) << 62)
+#define RECEIVE_NONE (ULL(2) << 62)
+#define RECEIVE_ERROR (ULL(3) << 62)
+
+uint64_t
SimConsole::in()
{
+ char c = 0;
+ uint64_t val = 0;
if (rxbuf.empty()) {
clearInt(ReceiveInterrupt);
- return -1;
+ val |= RECEIVE_NONE;
+ return 0x8;
+ } else {
+ uint64_t val;
+ rxbuf.read(&c, 1);
+ val |= RECEIVE_SUCCESS | c;
+ if (!rxbuf.empty())
+ val |= MORE_PENDING;
}
- char c;
- rxbuf.read(&c, 1);
-
- DPRINTF(ConsoleVerbose, "in: \'%c\' %#02x status: %#x\n",
- isprint(c) ? c : ' ', c, _status);
+ DPRINTF(ConsoleVerbose, "in: \'%c\' %#02x retval: %#x\n",
+ isprint(c) ? c : ' ', c, val);
- return c;
+ return val;
}
void