uart: use integer versions of time instead of messing around with floats
authorNathan Binkert <nate@binkert.org>
Mon, 1 Mar 2010 03:28:09 +0000 (19:28 -0800)
committerNathan Binkert <nate@binkert.org>
Mon, 1 Mar 2010 03:28:09 +0000 (19:28 -0800)
src/dev/uart8250.cc

index e3eacaaa20bd6316a53851c2ea1877ce0bd279e3..f131ab69f966b6bad90782480d5e68b0f58c2ca4 100644 (file)
@@ -90,7 +90,7 @@ Uart8250::IntrEvent::process()
 void
 Uart8250::IntrEvent::scheduleIntr()
 {
-    static const Tick interval = (Tick)((Clock::Float::s / 2e9) * 450);
+    static const Tick interval = 225 * Clock::Int::ns;
     DPRINTF(Uart, "Scheduling IER interrupt for %#x, at cycle %lld\n", intrBit,
             curTick + interval);
     if (!scheduled())
@@ -217,8 +217,7 @@ Uart8250::write(PacketPtr pkt)
                 if (UART_IER_THRI & IER)
                 {
                     DPRINTF(Uart, "IER: IER_THRI set, scheduling TX intrrupt\n");
-                    if (curTick - lastTxInt >
-                            (Tick)((Clock::Float::s / 2e9) * 450))  {
+                    if (curTick - lastTxInt > 225 * Clock::Int::ns) {
                         DPRINTF(Uart, "-- Interrupting Immediately... %d,%d\n",
                                 curTick, lastTxInt);
                         txIntrEvent.process();