Zigbee Protocol Controller 1.6.0
rtimer.h
Go to the documentation of this file.
1
21/*
22 * Copyright (c) 2005, Swedish Institute of Computer Science
23 * All rights reserved.
24 *
25 * Redistribution and use in source and binary forms, with or without
26 * modification, are permitted provided that the following conditions
27 * are met:
28 * 1. Redistributions of source code must retain the above copyright
29 * notice, this list of conditions and the following disclaimer.
30 * 2. Redistributions in binary form must reproduce the above copyright
31 * notice, this list of conditions and the following disclaimer in the
32 * documentation and/or other materials provided with the distribution.
33 * 3. Neither the name of the Institute nor the names of its contributors
34 * may be used to endorse or promote products derived from this software
35 * without specific prior written permission.
36 *
37 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
38 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
39 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
40 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
41 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
42 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
43 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
44 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
45 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
46 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
47 * SUCH DAMAGE.
48 *
49 * This file is part of the Contiki operating system.
50 *
51 * @(#)$Id: rtimer.h,v 1.12 2010/09/13 20:46:02 nifi Exp $
52 */
53#ifndef __RTIMER_H__
54#define __RTIMER_H__
55
56#include "contiki-conf.h"
57
58#ifndef RTIMER_CLOCK_LT
59typedef unsigned short rtimer_clock_t;
60#define RTIMER_CLOCK_LT(a,b) ((signed short)((a)-(b)) < 0)
61#endif /* RTIMER_CLOCK_LT */
62
63#ifndef __ASIX_C51__
64#include "rtimer-arch.h"
65#endif
66
74void rtimer_init(void);
75
76struct rtimer;
77
78#ifdef __ASIX_C51__
79typedef void (* rtimer_callback_t)(struct rtimer *t, void *ptr) CC_REENTRANT_ARG;
80#else
81typedef void (* rtimer_callback_t)(struct rtimer *t, void *ptr);
82#endif
83
91struct rtimer {
94 void *ptr;
95};
96
97enum {
102};
103
118int rtimer_set(struct rtimer *task, rtimer_clock_t time,
119 rtimer_clock_t duration, rtimer_callback_t func, void *ptr);
120
129
140#define RTIMER_NOW() rtimer_arch_now()
141
153#define RTIMER_TIME(task) ((task)->time)
154
157/*rtimer_clock_t rtimer_arch_now(void);*/
158
159#define RTIMER_SECOND RTIMER_ARCH_SECOND
160
161#endif /* __RTIMER_H__ */
162
#define CC_REENTRANT_ARG
Definition: cc.h:57
void(* rtimer_callback_t)(struct rtimer *t, void *ptr)
Definition: rtimer.h:81
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_arch_init(void)
void rtimer_run_next(void)
Execute the next real-time task and schedule the next task, if any.
void rtimer_arch_schedule(rtimer_clock_t t)
unsigned short rtimer_clock_t
Definition: rtimer.h:59
@ RTIMER_ERR_TIME
Definition: rtimer.h:100
@ RTIMER_OK
Definition: rtimer.h:98
@ RTIMER_ERR_ALREADY_SCHEDULED
Definition: rtimer.h:101
@ RTIMER_ERR_FULL
Definition: rtimer.h:99
Representation of a real-time task.
Definition: rtimer.h:91
rtimer_clock_t time
Definition: rtimer.h:92
rtimer_callback_t func
Definition: rtimer.h:93
void * ptr
Definition: rtimer.h:94