ia64/xen-unstable

view xen/include/xen/ac_timer.h @ 6552:a9873d384da4

Merge.
author adsharma@los-vmm.sc.intel.com
date Thu Aug 25 12:24:48 2005 -0700 (2005-08-25)
parents 112d44270733 fa0754a9f64f
children dfaf788ab18c
line source
1 /******************************************************************************
2 * ac_timer.h
3 *
4 * Copyright (c) 2002-2003 Rolf Neugebauer
5 * Copyright (c) 2002-2005 K A Fraser
6 */
8 #ifndef _AC_TIMER_H_
9 #define _AC_TIMER_H_
11 #include <xen/spinlock.h>
12 #include <xen/time.h>
13 #include <xen/string.h>
15 struct ac_timer {
16 /* System time expiry value (nanoseconds since boot). */
17 s_time_t expires;
18 /* CPU on which this timer will be installed and executed. */
19 unsigned int cpu;
20 /* On expiry, '(*function)(data)' will be executed in softirq context. */
21 void (*function)(void *);
22 void *data;
23 /* Timer-heap offset. */
24 unsigned int heap_offset;
25 };
27 /*
28 * All functions below can be called for any CPU from any CPU in any context.
29 */
31 /* Returns TRUE if the given timer is on a timer list. */
32 static __inline__ int active_ac_timer(struct ac_timer *timer)
33 {
34 return (timer->heap_offset != 0);
35 }
37 /*
38 * It initialises the static fields of the ac_timer structure.
39 * It can be called multiple times to reinitialise a single (inactive) timer.
40 */
41 static __inline__ void init_ac_timer(
42 struct ac_timer *timer,
43 void (*function)(void *),
44 void *data,
45 unsigned int cpu)
46 {
47 memset(timer, 0, sizeof(*timer));
48 timer->function = function;
49 timer->data = data;
50 timer->cpu = cpu;
51 }
53 /*
54 * Set the expiry time and activate a timer (which must previously have been
55 * initialised by init_ac_timer).
56 */
57 extern void set_ac_timer(struct ac_timer *timer, s_time_t expires);
59 /*
60 * Deactivate a timer (which must previously have been initialised by
61 * init_ac_timer). This function has no effect if the timer is not currently
62 * active.
63 */
64 extern void rem_ac_timer(struct ac_timer *timer);
66 #endif /* _AC_TIMER_H_ */
68 /*
69 * Local variables:
70 * mode: C
71 * c-set-style: "BSD"
72 * c-basic-offset: 4
73 * tab-width: 4
74 * indent-tabs-mode: nil
75 * End:
76 */