revision 264:e3b8a3ab32b8
summary |
tree |
shortlog |
changelog |
graph |
changeset |
raw | bz2 | zip | gz changeset | 264:e3b8a3ab32b8 |
parent | 263:6f641270b2aa |
child | 265:5daf59b7f31b |
author | nkeynes |
date | Sat Jan 06 04:05:32 2007 +0000 (17 years ago) |
Fix start/stop timing
src/sh4/timer.c | view | annotate | diff | log |
1.1 --- a/src/sh4/timer.c Wed Jan 03 09:05:13 2007 +00001.2 +++ b/src/sh4/timer.c Sat Jan 06 04:05:32 2007 +00001.3 @@ -1,5 +1,5 @@1.4 /**1.5 - * $Id: timer.c,v 1.5 2007-01-03 09:00:17 nkeynes Exp $1.6 + * $Id: timer.c,v 1.6 2007-01-06 04:05:32 nkeynes Exp $1.7 *1.8 * SH4 Timer/Clock peripheral modules (CPG, TMU, RTC), combined together to1.9 * keep things simple (they intertwine a bit).1.10 @@ -191,9 +191,13 @@1.11 TMU_timers[timer].timer_remainder = 0;1.12 }1.14 +/**1.15 + * Stop the given timer. Run it up to the current time and leave it there.1.16 + */1.17 void TMU_stop( int timer )1.18 {1.19 -1.20 + TMU_count( timer, sh4r.slice_cycle );1.21 + TMU_timers[timer].timer_run = sh4r.slice_cycle;1.22 }1.24 /**1.25 @@ -232,9 +236,9 @@1.26 oldval = MMIO_READ( TMU, TSTR );1.27 for( i=0; i<3; i++ ) {1.28 uint32_t tmp = 1<<i;1.29 - if( (oldval & tmp) == 1 && (val&tmp) == 0 )1.30 + if( (oldval & tmp) != 0 && (val&tmp) == 0 )1.31 TMU_stop(i);1.32 - else if( (oldval&tmp) == 0 && (val&tmp) == 1 )1.33 + else if( (oldval&tmp) == 0 && (val&tmp) != 0 )1.34 TMU_start(i);1.35 }1.36 break;
.