Contiki-NG
|
Data Structures | |
struct | rtimer |
Representation of a real-time task. More... | |
Macros | |
#define | RTIMER_CLOCK_SIZE 4 |
The rtimer size (in bytes) | |
#define | RTIMER_SECOND RTIMER_ARCH_SECOND |
Number of rtimer ticks for 1 second. | |
#define | rtimer_init() |
Initialize the real-time scheduler. | |
#define | RTIMER_NOW() |
Get the current clock time. | |
#define | RTIMER_TIME(task) |
Get the time that a task last was executed. | |
#define | RTIMER_BUSYWAIT_UNTIL_ABS(cond, t0, max_time) |
Busy-wait until a condition. | |
#define | RTIMER_BUSYWAIT_UNTIL(cond, max_time) |
Busy-wait until a condition for at most max_time. | |
#define | RTIMER_BUSYWAIT(duration) RTIMER_BUSYWAIT_UNTIL(0, duration) |
Busy-wait for a fixed duration. | |
Enumerations | |
enum | { RTIMER_OK , RTIMER_ERR_FULL , RTIMER_ERR_TIME , RTIMER_ERR_ALREADY_SCHEDULED } |
TODO: we need to document meanings of these symbols. More... | |
Functions | |
int | rtimer_set (struct rtimer *task, rtimer_clock_t time, rtimer_clock_t duration, rtimer_callback_t func, void *ptr) |
Post a real-time task. | |
void | rtimer_run_next (void) |
Execute the next real-time task and schedule the next task, if any. | |
Architecture-dependent symbols | |
The functions declared in this section must be defined in architecture-dependent implementation of rtimer. Alternatively, they can be defined as macros in rtimer-arch.h. In addition, the architecture-dependent header (rtimer-arch.h) must define the following macros.
| |
void | rtimer_arch_init (void) |
Initialized the architecture-dependent part of rtimer. | |
void | rtimer_arch_schedule (rtimer_clock_t t) |
Schedules an rtimer task to be triggered at time t. | |
The real-time module handles the scheduling and execution of real-time tasks (with predictable execution times).
#define RTIMER_BUSYWAIT_UNTIL_ABS | ( | cond, | |
t0, | |||
max_time ) |
Busy-wait until a condition.
Start time is t0, max wait time is max_time
#define rtimer_init | ( | ) |
Initialize the real-time scheduler.
This function initializes the real-time scheduler and must be called at boot-up, before any other functions from the real-time scheduler is called.
Definition at line 123 of file rtimer.h.
Referenced by soc_init().
#define RTIMER_NOW | ( | ) |
Get the current clock time.
This function returns what the real-time module thinks is the current time. The current time is used to set the timeouts for real-time tasks.
Definition at line 187 of file rtimer.h.
Referenced by read(), rf_core_check_rat_overflow(), rf_core_convert_rat_to_rtimer(), rtimer_arch_schedule(), tsch_get_lock(), update_ticks(), and value().
#define RTIMER_TIME | ( | task | ) |
Get the time that a task last was executed.
task | The task |
This function returns the time that the task was last executed. This typically is used to get a periodic execution of a task without clock drift.
anonymous enum |
void rtimer_arch_init | ( | void | ) |
Initialized the architecture-dependent part of rtimer.
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()
Initialized the architecture-dependent part of rtimer.
The RTC is initialised elsewhere
Initialized the architecture-dependent part of rtimer.
Definition at line 59 of file rtimer-arch.c.
References rtimer_clock_stub(), and rtimer_isr_hook().
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. |
t is an absolute time, in other words the task will be executed AT time t, not IN t rtimer ticks.
Schedules an rtimer task to be triggered at time t.
This functions converts to a value suitable for the AON RTC.
Schedules an rtimer task to be triggered at time t.
Schedules an rtimer task to be triggered at time t.
This functions converts t
to a value suitable for the AON RTC.
< Compare value load status
< STx upload status signal
< ST count/compare value 3
< ST count/compare value 2
< ST count/compare value 1
< ST count/compare value 0
Definition at line 65 of file rtimer-arch.c.
References CLOCK_SECOND, clock_time(), INTERRUPTS_DISABLE, INTERRUPTS_ENABLE, RTIMER_NOW, SMT_IRQn, SMWDTHROSC_ST0, SMWDTHROSC_ST1, SMWDTHROSC_ST2, SMWDTHROSC_ST3, SMWDTHROSC_STLOAD, SMWDTHROSC_STLOAD_STLOAD, and soc_rtc_schedule_one_shot().
Referenced by rtimer_set().
void rtimer_run_next | ( | void | ) |
Execute the next real-time task and schedule the next task, if any.
This function is called by the architecture dependent code to execute and schedule the next real-time task.
Definition at line 78 of file rtimer.c.
Referenced by rtimer_isr(), and rtimer_isr_hook().
int rtimer_set | ( | struct rtimer * | task, |
rtimer_clock_t | time, | ||
rtimer_clock_t | duration, | ||
rtimer_callback_t | func, | ||
void * | ptr ) |
Post a real-time task.
task | A pointer to the task variable allocated somewhere. |
time | The time when the task is to be executed. |
duration | Unused argument. |
func | A function to be called when the task is executed. |
ptr | An opaque pointer that will be supplied as an argument to the callback function. |
This function schedules a real-time task at a specified time in the future.
Definition at line 57 of file rtimer.c.
References rtimer_arch_schedule(), and RTIMER_OK.