Search
lxdream.org :: lxdream/src/sh4/timer.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/sh4/timer.c
changeset 264:e3b8a3ab32b8
prev260:c82e26ec0cac
next326:0c107e0d0fe0
author nkeynes
date Sat Jan 06 04:05:32 2007 +0000 (13 years ago)
permissions -rw-r--r--
last change Fix start/stop timing
file annotate diff log raw
1.1 --- a/src/sh4/timer.c Wed Jan 03 09:00:17 2007 +0000
1.2 +++ b/src/sh4/timer.c Sat Jan 06 04:05:32 2007 +0000
1.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 to
1.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.13
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.23
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;
.