Search
lxdream.org :: lxdream :: r1127:4b8194e3974c
lxdream 0.9.1
released Jun 29
Download Now
changeset1127:4b8194e3974c
parent1126:1f2c7cdee73e
child1128:180abbb2a1f3
authornkeynes
dateTue Sep 14 19:59:05 2010 +1000 (10 years ago)
Fix TMU counter reading to only update the count if the timer is actually
running - fixes various timing issues in KOS
src/sh4/timer.c
1.1 --- a/src/sh4/timer.c Mon Sep 13 19:01:15 2010 +1000
1.2 +++ b/src/sh4/timer.c Tue Sep 14 19:59:05 2010 +1000
1.3 @@ -283,13 +283,16 @@
1.4 reg &= 0xFFF;
1.5 switch( reg ) {
1.6 case TCNT0:
1.7 - TMU_count( 0, sh4r.slice_cycle );
1.8 + if( TMU_IS_RUNNING(0) )
1.9 + TMU_count( 0, sh4r.slice_cycle );
1.10 break;
1.11 case TCNT1:
1.12 - TMU_count( 1, sh4r.slice_cycle );
1.13 + if( TMU_IS_RUNNING(1) )
1.14 + TMU_count( 1, sh4r.slice_cycle );
1.15 break;
1.16 case TCNT2:
1.17 - TMU_count( 2, sh4r.slice_cycle );
1.18 + if( TMU_IS_RUNNING(2) )
1.19 + TMU_count( 2, sh4r.slice_cycle );
1.20 break;
1.21 }
1.22 return MMIO_READ( TMU, reg );
.