Real-time task scheduling
[Contiki system]

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

Files

file  rtimer.c
 

Implementation of the architecture-agnostic parts of the real-time timer module.


file  rtimer.h
 

Header file for the real-time timer module.


Defines

#define RTIMER_NOW()
 Get the current clock time.
#define RTIMER_TIME(task)
 Get the time that a task last was executed.

Functions

void rtimer_init (void)
 Initialize the real-time scheduler.
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.

Detailed Description

The real-time module handles the scheduling and execution of real-time tasks (with predictable execution times).


Define Documentation

 
#define RTIMER_NOW (  ) 

Get the current clock time.

Returns:
The current 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.

Examples:
example-rudolph1.c.

Definition at line 133 of file rtimer.h.

Referenced by main().

#define RTIMER_TIME ( task   ) 

Get the time that a task last was executed.

Parameters:
task The task
Returns:
The time that a task last was executed

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.

Examples:
example-rudolph1.c.

Definition at line 146 of file rtimer.h.


Function Documentation

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.

Referenced by main().

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.

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.

Parameters:
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.
Returns:
Non-zero (true) if the task could be scheduled, zero (false) if the task could not be scheduled.

This function schedules a real-time task at a specified time in the future.

Examples:
example-rudolph1.c.

Referenced by main().


Generated on Mon Apr 11 14:23:53 2011 for Contiki 2.5 by  doxygen 1.6.1