Contiki-NG
|
The real-time module handles the scheduling and execution of real-time tasks (with predictable execution times). More...
Data Structures | |
struct | rtimer |
Representation of a real-time task. More... | |
Macros | |
#define | RTIMER_CLOCK_SIZE 4 |
The rtimer size (in bytes) | |
#define | RTIMER_NOW() |
Get the current clock time. More... | |
#define | RTIMER_TIME(task) |
Get the time that a task last was executed. More... | |
#define | RTIMER_BUSYWAIT_UNTIL_ABS(cond, t0, max_time) |
Busy-wait until a condition. More... | |
#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. | |
Functions | |
void | rtimer_init (void) |
Initialize the real-time scheduler. More... | |
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. More... | |
void | rtimer_run_next (void) |
Execute the next real-time task and schedule the next task, if any. More... | |
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... | |
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_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 160 of file rtimer.h.
Referenced by update_ticks().
#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.
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()
We don't need to explicitly initialise anything but this routine is required by the API.
The RTC is initialised elsewhere
We don't need to explicitly initialise anything but this routine is required by the API.
Definition at line 59 of file rtimer-arch.c.
Referenced by rtimer_init().
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 |
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.
This function schedules a one-shot event with the AON RTC.
This functions converts to a value suitable for the AON RTC.
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.
This function schedules a one-shot event with the nRF RTC.
Schedules an rtimer task to be triggered at time t.
t | The time when the task will need executed. \p t is an absolute time, in other words the task will be executed AT time \p t, not IN \p t rtimer ticks. This function schedules a one-shot event with the AON RTC. This functions converts \p t to a value suitable for the AON RTC. |
Definition at line 71 of file rtimer-arch.c.
void rtimer_init | ( | void | ) |
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 61 of file rtimer.c.
References rtimer_arch_init().
Referenced by soc_init().
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 92 of file rtimer.c.
Referenced by timer_event_handler().
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 previously declared with RTIMER_TASK(). |
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.