Zigbee Protocol Controller 1.6.0
ctimer.h
Go to the documentation of this file.
1
15/*
16 * Copyright (c) 2006, Swedish Institute of Computer Science.
17 * All rights reserved.
18 *
19 * Redistribution and use in source and binary forms, with or without
20 * modification, are permitted provided that the following conditions
21 * are met:
22 * 1. Redistributions of source code must retain the above copyright
23 * notice, this list of conditions and the following disclaimer.
24 * 2. Redistributions in binary form must reproduce the above copyright
25 * notice, this list of conditions and the following disclaimer in the
26 * documentation and/or other materials provided with the distribution.
27 * 3. Neither the name of the Institute nor the names of its contributors
28 * may be used to endorse or promote products derived from this software
29 * without specific prior written permission.
30 *
31 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
32 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
33 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
34 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
35 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
39 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
40 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
41 * SUCH DAMAGE.
42 *
43 * This file is part of the Contiki operating system.
44 *
45 * $Id: ctimer.h,v 1.2 2010/06/14 07:35:53 adamdunkels Exp $
46 */
47
55#ifndef __CTIMER_H__
56#define __CTIMER_H__
57
58#include "sys/etimer.h"
59
60#ifdef __cplusplus
61extern "C" {
62#endif
63
64struct ctimer {
65 struct ctimer *next;
66 struct etimer etimer;
67 struct process *p;
68 void (*f)(void *);
69 void *ptr;
70};
71
87void ctimer_reset(struct ctimer *c);
88
104void ctimer_restart(struct ctimer *c);
105
118void ctimer_set(struct ctimer *c, clock_time_t t,
119 void (*f)(void *), void *ptr);
120
131void ctimer_stop(struct ctimer *c);
132
141int ctimer_expired(struct ctimer *c);
142
149void ctimer_init(void);
150
151#ifdef __cplusplus
152}
153#endif
154
155#endif /* __CTIMER_H__ */
uint32_t clock_time_t
Definition: contiki-conf.h:31
void ctimer_init(void)
Initialize the callback timer library.
Definition: ctimer.c:95
void ctimer_stop(struct ctimer *c)
Stop a pending callback timer.
Definition: ctimer.c:151
void ctimer_set(struct ctimer *c, clock_time_t t, void(*f)(void *), void *ptr)
Set a callback timer.
Definition: ctimer.c:103
int ctimer_expired(struct ctimer *c)
Check if a callback timer has expired.
Definition: ctimer.c:163
void ctimer_reset(struct ctimer *c)
Reset a callback timer with the same interval as was previously set.
Definition: ctimer.c:125
void ctimer_restart(struct ctimer *c)
Restart a callback timer from the current point in time.
Definition: ctimer.c:138
Definition: ctimer.h:64
void(* f)(void *)
Definition: ctimer.h:68
void * ptr
Definition: ctimer.h:69
struct ctimer * next
Definition: ctimer.h:65
struct process * p
Definition: ctimer.h:67
Definition: etimer.h:81
Definition: process.h:327