Contiki-NG
Files | Macros | Functions

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...
 

Detailed Description

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.

Note
If the 32kHz clock is running on the 32kHz RC OSC, the rtimer is not 100% accurate (the RC OSC does not run at exactly 32.768 kHz). For applications requiring higher accuracy, the 32kHz clock should be changed to use the XOSC as its source. To see which low-frequency OSC the 32kHz clock is running on, see cpu/cc2538/clock.c.
See also
cpu/cc2538/clock.c

Macro Definition Documentation

◆ rtimer_arch_now

rtimer_clock_t rtimer_arch_now ( )    clock_time()
See also
RTIMER_NOW()

Definition at line 47 of file rtimer-arch.h.

Function Documentation

◆ rtimer_arch_init()

void rtimer_arch_init ( void  )

We don't need to explicitly initialise anything but this routine is required by the API.

Initialized the architecture-dependent part of rtimer.

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 59 of file rtimer-arch.c.

Referenced by rtimer_init().

◆ rtimer_arch_next_trigger()

rtimer_clock_t rtimer_arch_next_trigger ( void  )

Get the time of the next scheduled rtimer trigger.

Returns
The time next rtimer ISR is scheduled for

Definition at line 105 of file rtimer-arch.c.

◆ rtimer_arch_now()

rtimer_clock_t rtimer_arch_now ( )

Returns the current real-time clock time.

Returns
The current rtimer time in ticks
See also
RTIMER_NOW()

Definition at line 115 of file rtimer-arch.c.

◆ rtimer_arch_schedule()

void rtimer_arch_schedule ( rtimer_clock_t  t)

Schedules an rtimer task to be triggered at time t.

Schedule the call to rtimer_run_next at the time t.

Parameters
tThe 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 71 of file rtimer-arch.c.

◆ rtimer_isr()

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 136 of file rtimer-arch.c.