summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Binkert <binkertn@umich.edu>2004-01-30 18:12:48 -0500
committerNathan Binkert <binkertn@umich.edu>2004-01-30 18:12:48 -0500
commitbbf952376e690afed250bcb03ebb78b50f7cf2dd (patch)
tree50a7c2a5633d2dd3951fecf9d4c320983ee0a7ba
parent35fb439c3398bcbb2214df333c6b521ecd46d7b7 (diff)
downloadgem5-bbf952376e690afed250bcb03ebb78b50f7cf2dd.tar.xz
Update for changes in the console
This is basically the same thing that was done for tlaser_uart --HG-- extra : convert_revision : e0de84b83d1ee4fe0ef769b4de232dbbd7d9c228
-rw-r--r--dev/tsunami_uart.cc17
-rw-r--r--dev/tsunami_uart.hh3
2 files changed, 11 insertions, 9 deletions
diff --git a/dev/tsunami_uart.cc b/dev/tsunami_uart.cc
index 870258a6e..d2056e65b 100644
--- a/dev/tsunami_uart.cc
+++ b/dev/tsunami_uart.cc
@@ -34,7 +34,7 @@ using namespace std;
TsunamiUart::TsunamiUart(const string &name, SimConsole *c,
Addr addr, Addr mask, MemoryController *mmu)
: MmapDevice(name, addr, mask, mmu),
- cons(c), status_store(0), next_char(-1)
+ cons(c), status_store(0), valid_char(false)
{
}
@@ -63,11 +63,10 @@ TsunamiUart::read(MemReqPtr req, uint8_t *data)
case 0xD: // Status Register
{
int status = cons->intStatus();
- if (next_char < 0) {
- next_char = cons->in();
- if (next_char < 0) {
+ if (!valid_char) {
+ valid_char = cons->in(next_char);
+ if (!valid_char)
status &= ~CONS_INT_RX;
- }
} else {
status |= CONS_INT_RX;
}
@@ -96,16 +95,16 @@ TsunamiUart::read(MemReqPtr req, uint8_t *data)
}
case 0x8: // Data register (RX)
- if (next_char < 0)
+ if (!valid_char)
panic("Invalid character");
DPRINTF(TsunamiUart, "read data register \'%c\' %#02x\n",
isprint(next_char) ? next_char : ' ', next_char);
*data = next_char;
- next_char = -1;
-// cons.next();
+ valid_char = false;
return No_Fault;
+
case 0x9: // Interrupt Enable Register
*data = 0;
return No_Fault;
@@ -170,6 +169,7 @@ TsunamiUart::serialize(ostream &os)
{
SERIALIZE_SCALAR(status_store);
SERIALIZE_SCALAR(next_char);
+ SERIALIZE_SCALAR(valid_char);
}
void
@@ -177,6 +177,7 @@ TsunamiUart::unserialize(Checkpoint *cp, const std::string &section)
{
UNSERIALIZE_SCALAR(status_store);
UNSERIALIZE_SCALAR(next_char);
+ UNSERIALIZE_SCALAR(valid_char);
}
BEGIN_DECLARE_SIM_OBJECT_PARAMS(TsunamiUart)
diff --git a/dev/tsunami_uart.hh b/dev/tsunami_uart.hh
index a1bd7006d..f32b1ff4c 100644
--- a/dev/tsunami_uart.hh
+++ b/dev/tsunami_uart.hh
@@ -45,7 +45,8 @@ class TsunamiUart : public MmapDevice
protected:
SimConsole *cons;
int status_store;
- int next_char;
+ uint8_t next_char;
+ bool valid_char;
public:
TsunamiUart(const std::string &name, SimConsole *c,