Contiki-NG
rtimer.h File Reference

Header file for the real-time timer module. More...

#include "contiki.h"
#include "dev/watchdog.h"
#include <stdbool.h>
#include "rtimer-arch.h"

Go to the source code of this file.

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

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

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

  • RTIMER_ARCH_SECOND
  • US_TO_RTIMERTICKS(us)
  • RTIMERTICKS_TO_US(t)
  • RTIMERTICKS_TO_US_64(t)
void rtimer_arch_init (void)
 Initialized the architecture-dependent part of rtimer. More...
 
void rtimer_arch_schedule (rtimer_clock_t t)
 Schedules an rtimer task to be triggered at time t. More...
 

Detailed Description

Header file for the real-time timer module.

Author
Adam Dunkels adam@.nosp@m.sics.nosp@m..se

Definition in file rtimer.h.