don't worry about wraparound in rtimer_arch_schedule

This commit is contained in:
Mariano Alvira 2011-09-02 12:36:10 -04:00
parent 6c0bbc492b
commit 43910c1be7
1 changed files with 8 additions and 0 deletions

View File

@ -77,11 +77,19 @@ rtimer_arch_schedule(rtimer_clock_t t)
volatile uint32_t now;
now = rtimer_arch_now();
PRINTF("rtimer_arch_schedule time %u; now is %u\n", t,now);
#if 1
/* If specified time is always in the future, counter can wrap without harm */
*CRM_RTC_TIMEOUT = t - now;
#else
/* Immediate interrupt if specified time is before current time. This may also
happen on counter overflow. */
if(now>t) {
*CRM_RTC_TIMEOUT = 1;
} else {
*CRM_RTC_TIMEOUT = t - now;
}
#endif
clear_rtc_wu_evt();
enable_rtc_wu();