[Tinyos-2-commits] CVS: tinyos-2.x/tos/lib/timer
VirtualizeTimerC.nc, 1.3, 1.4
David Gay
idgay at users.sourceforge.net
Tue Aug 8 15:46:31 PDT 2006
Update of /cvsroot/tinyos/tinyos-2.x/tos/lib/timer
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv10968
Modified Files:
VirtualizeTimerC.nc
Log Message:
simplify timer virtualisation logic a bit
Index: VirtualizeTimerC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/timer/VirtualizeTimerC.nc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** VirtualizeTimerC.nc 7 Aug 2006 22:18:21 -0000 1.3
--- VirtualizeTimerC.nc 8 Aug 2006 22:46:29 -0000 1.4
***************
*** 79,83 ****
int32_t elapsed = then - timer->t0;
int32_t remaining = timer->dt - elapsed;
- bool compute_min_remaining = TRUE;
// If the elapsed time is negative, then t0 is in the future, so
--- 79,82 ----
***************
*** 91,95 ****
{
timer->isrunning = FALSE;
- compute_min_remaining = FALSE;
}
else
--- 90,93 ----
***************
*** 104,114 ****
}
! // check isrunning in case the timer was stopped in the fired event
!
! if (compute_min_remaining && timer->isrunning)
{
! if (remaining < 0)
! min_remaining = 0;
! else if (remaining < min_remaining)
min_remaining = remaining;
min_remaining_isset = TRUE;
--- 102,113 ----
}
! // check isrunning in case the timer was stopped in the fired
! // event or this was a one shot timer; note that a one shot
! // timer that was restarted in its fired event will push us
! // through here with remaining < 0, but we've already scheduled
! // an executeTimers in that case
! if (timer->isrunning)
{
! if (remaining < min_remaining)
min_remaining = remaining;
min_remaining_isset = TRUE;
***************
*** 121,129 ****
uint32_t now = call TimerFrom.getNow();
uint32_t elapsed = now - then;
! if (min_remaining <= elapsed)
post executeTimersNow();
else
call TimerFrom.startOneShotAt(now, min_remaining - elapsed);
}
}
--- 120,130 ----
uint32_t now = call TimerFrom.getNow();
uint32_t elapsed = now - then;
! if (min_remaining < 0 || (uint32_t)min_remaining <= elapsed)
post executeTimersNow();
else
call TimerFrom.startOneShotAt(now, min_remaining - elapsed);
}
+ if (dosleep)
+ t3 = TCNT3 - tt0;
}
More information about the Tinyos-2-commits
mailing list