ARM: Fix timer calculations.
authorAli Saidi <Ali.Saidi@ARM.com>
Sat, 12 Feb 2011 00:29:35 +0000 (18:29 -0600)
committerAli Saidi <Ali.Saidi@ARM.com>
Sat, 12 Feb 2011 00:29:35 +0000 (18:29 -0600)
The timer calculations were a bit off so time would run faster than
it otherwise should

src/dev/arm/timer_sp804.cc

index 04668d26857f6300b9340690e42caa9c9bd28b85..e6d2657ea9124cb3014eb4e6534fcb98e4e07456 100644 (file)
@@ -178,11 +178,11 @@ Sp804::Timer::restartCounter(uint32_t val)
     if (!control.timerEnable)
         return;
 
-    Tick time = clock << power(16, control.timerPrescale);
+    Tick time = clock * power(16, control.timerPrescale);
     if (control.timerSize)
-        time *= bits(val,15,0);
-    else
         time *= val;
+    else
+        time *= bits(val,15,0);
 
     if (zeroEvent.scheduled()) {
         DPRINTF(Timer, "-- Event was already schedule, de-scheduling\n");