summaryrefslogtreecommitdiff
path: root/dev/uart.cc
diff options
context:
space:
mode:
authorNathan Binkert <binkertn@umich.edu>2005-03-29 07:55:44 -0500
committerNathan Binkert <binkertn@umich.edu>2005-03-29 07:55:44 -0500
commit43a9caa2214faffaa1fd5ce1730063f9959a8ce8 (patch)
treec4e76e7d0dffaee04f58f131e458b23d8be06611 /dev/uart.cc
parenta86b95cb182b435bda5d76197cd9f32ba6db83c2 (diff)
downloadgem5-43a9caa2214faffaa1fd5ce1730063f9959a8ce8.tar.xz
expose variables for number of global events per simulated second,
millisecond, microsecond, etc. so that the user can explicitly convert between system ticks and time and know what sorts of expensive operations are being used for that conversion. arch/alpha/alpha_tru64_process.cc: arch/alpha/pseudo_inst.cc: dev/etherdump.cc: dev/etherlink.cc: dev/ns_gige.cc: dev/sinic.cc: dev/tsunami_io.cc: dev/uart.cc: sim/stat_control.cc: sim/syscall_emul.hh: Use the new variables for getting the event clock dev/etherdump.hh: delete variables that are no longer needed. --HG-- extra : convert_revision : d95fc7d44909443e1b7952a24ef822ef051c7cf2
Diffstat (limited to 'dev/uart.cc')
-rw-r--r--dev/uart.cc21
1 files changed, 16 insertions, 5 deletions
diff --git a/dev/uart.cc b/dev/uart.cc
index 3c4ab6d04..caa169a2e 100644
--- a/dev/uart.cc
+++ b/dev/uart.cc
@@ -73,17 +73,28 @@ Uart::IntrEvent::process()
}
+/* The linux serial driver (8250.c about line 1182) loops reading from
+ * the device until the device reports it has no more data to
+ * read. After a maximum of 255 iterations the code prints "serial8250
+ * too much work for irq X," and breaks out of the loop. Since the
+ * simulated system is so much slower than the actual system, if a
+ * user is typing on the keyboard it is very easy for them to provide
+ * input at a fast enough rate to not allow the loop to exit and thus
+ * the error to be printed. This magic number provides a delay between
+ * the time the UART receives a character to send to the simulated
+ * system and the time it actually notifies the system it has a
+ * character to send to alleviate this problem. --Ali
+ */
void
Uart::IntrEvent::scheduleIntr()
{
+ static const Tick interval = (Tick)((Clock::Float::s / 2e9) * 450);
DPRINTF(Uart, "Scheduling IER interrupt for %#x, at cycle %lld\n", intrBit,
- curTick + (ticksPerSecond/2000) * 350);
+ curTick + interval);
if (!scheduled())
- /* @todo Make this cleaner, will be much easier with
- * nanosecond time everywhere. Hint hint Nate. */
- schedule(curTick + (ticksPerSecond/2000000000) * 450);
+ schedule(curTick + interval);
else
- reschedule(curTick + (ticksPerSecond/2000000000) * 450);
+ reschedule(curTick + interval);
}
Uart::Uart(const string &name, SimConsole *c, MemoryController *mmu, Addr a,