Contiki 3.x
|
Implementation of the rtimer module for the cc2538. More...
Files | |
file | rtimer-arch.c |
Implementation of the arch-specific rtimer functions for the cc2538. | |
file | rtimer-arch.h |
Header file for the cc2538 rtimer driver. | |
Macros | |
#define | rtimer_arch_now() clock_time() |
Functions | |
void | rtimer_arch_init (void) |
We don't need to explicitly initialise anything but this routine is required by the API. More... | |
void | rtimer_arch_schedule (rtimer_clock_t t) |
Schedules an rtimer task to be triggered at time t. More... | |
rtimer_clock_t | rtimer_arch_next_trigger (void) |
Get the time of the next scheduled rtimer trigger. More... | |
rtimer_clock_t | rtimer_arch_now () |
Returns the current real-time clock time. More... | |
void | rtimer_isr () |
The rtimer ISR. More... | |
Implementation of the rtimer module for the cc2538.
The rtimer runs on the Sleep Timer. This is a design choice, as many parts of Contiki like rtimers with a value of RTIMER_ARCH_SECOND being a power of two. The ST runs on the 32kHz clock, which can provide us with an excellent value of 32768 for RTIMER_ARCH_SECOND.
Additionally, since the ST keeps running in PM2, we can do things like drop to PM2 and schedule a wake-up time through the rtimer API.
rtimer_clock_t rtimer_arch_now | ( | ) | clock_time() |
Definition at line 40 of file rtimer-arch.h.
Referenced by _isr_pit0(), and rtimer_arch_schedule().
void rtimer_arch_init | ( | void | ) |
We don't need to explicitly initialise anything but this routine is required by the API.
The Sleep Timer starts ticking automatically as soon as the device turns on. We don't need to turn on interrupts before the first call to rtimer_arch_schedule()
Definition at line 60 of file rtimer-arch.c.
rtimer_clock_t rtimer_arch_next_trigger | ( | void | ) |
Get the time of the next scheduled rtimer trigger.
Definition at line 106 of file rtimer-arch.c.
rtimer_clock_t rtimer_arch_now | ( | ) |
Returns the current real-time clock time.
Definition at line 116 of file rtimer-arch.c.
References SMWDTHROSC_ST0, SMWDTHROSC_ST1, SMWDTHROSC_ST2, and SMWDTHROSC_ST3.
void rtimer_arch_schedule | ( | rtimer_clock_t | t | ) |
Schedules an rtimer task to be triggered at time t.
t | The time when the task will need executed. This is an absolute time, in other words the task will be executed AT time t, not IN t ticks |
Definition at line 72 of file rtimer-arch.c.
References INTERRUPTS_DISABLE, INTERRUPTS_ENABLE, NVIC_INT_SM_TIMER, nvic_interrupt_enable(), RTIMER_NOW, SMWDTHROSC_ST0, SMWDTHROSC_ST1, SMWDTHROSC_ST2, SMWDTHROSC_ST3, SMWDTHROSC_STLOAD, and SMWDTHROSC_STLOAD_STLOAD.
void rtimer_isr | ( | void | ) |
The rtimer ISR.
Interrupts are only turned on when we have an rtimer task to schedule Once the interrupt fires, the task is called and then interrupts no longer get acknowledged until the next task needs scheduled.
Definition at line 137 of file rtimer-arch.c.