Update for changes in the console

This is basically the same thing that was done for tlaser_uart

--HG--
extra : convert_revision : e0de84b83d1ee4fe0ef769b4de232dbbd7d9c228
This commit is contained in:
Nathan Binkert
2004-01-30 18:12:48 -05:00
parent 35fb439c33
commit bbf952376e
2 changed files with 11 additions and 9 deletions

View File

@@ -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)

View File

@@ -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,