Use the RTC only as the main timer.

This is a major change to how the main tick interrupt is handled on
the mc1322x platforms. Instead of using two timer resources, TMR0 and
RTC, this patch unifies all the timers to use the RTC. This is enabled by
implementing etimers as scheduled rtimers. The main advantage (aside
from freeing TMR0 for general use) is have the Contiki timebase come
from the same source that will be used for sleeping and wakeup.
This commit is contained in:
Mariano Alvira 2013-02-03 14:50:30 -05:00
parent ad55ccdec4
commit fb8bbf37cf
9 changed files with 128 additions and 233 deletions

View file

@ -47,15 +47,15 @@
#include "sys/rtimer.h"
/* mc1322x */
#include "crm.h"
#include "utils.h"
#include "mc1322x.h"
#if USE_32KHZ_XTAL
#define RTIMER_ARCH_SECOND 32768
#else
#define RTIMER_ARCH_SECOND 18778 /* close --- should get calibrated */
#define RTIMER_ARCH_SECOND 2000
#endif
#define rtimer_arch_now() (*CRM_RTC_COUNT)
#define rtimer_arch_now() (CRM->RTC_COUNT)
#endif /* __RTIMER_ARCH_H__ */