ia64/xen-unstable

view xen/include/xeno/ac_timer.h @ 945:db2e1ea917df

bitkeeper revision 1.596.1.3 (3fb3b41eWUoRU0H8A0jEX5roXjxKkA)

Many files:
Greatly simplified Xen softirqs. They are now only executed in outermost Xen activation; they are never called within an irq context.
author kaf24@scramble.cl.cam.ac.uk
date Thu Nov 13 16:41:02 2003 +0000 (2003-11-13)
parents 3f44ecdcb631
children 7a554cbf0f58
line source
1 /* -*- Mode:C; c-basic-offset:4; tab-width:4 -*-
2 ****************************************************************************
3 * (C) 2002 - Rolf Neugebauer - Intel Research Cambridge
4 ****************************************************************************
5 *
6 * File: ac_timer.h
7 * Author: Rolf Neugebauer (neugebar@dcs.gla.ac.uk)
8 * Changes:
9 *
10 * Date: Nov 2002
11 *
12 * Environment: Xen Hypervisor
13 * Description: Accurate timer for the Hypervisor
14 *
15 ****************************************************************************
16 * $Id: h-insert.h,v 1.4 2002/11/08 16:03:55 rn Exp $
17 ****************************************************************************
18 */
20 #ifndef _AC_TIMER_H_
21 #define _AC_TIMER_H_
23 #include <xeno/time.h> /* include notion of time */
25 /*
26 * The Xen Hypervisor provides two types of timers:
27 *
28 * - Linux style, jiffy based timers for legacy code and coarse grain timeouts
29 * These are defined in ./include/xeno/timer.h and implemented in
30 * ./common/timer.c. Unlike in Linux they are executed not on a periodic
31 * timer interrupt but "occasionally" with somewhat lesser accuracy.
32 *
33 * - accurate timers defined in this file and implemented in
34 * ./common/ac_timer.c. These are implemented using a programmable timer
35 * interrupt and are thus as accurate as the hardware allows. Where possible
36 * we use the local APIC for this purpose. However, this fact is hidden
37 * behind a architecture independent layer.
38 * accurate timers are programmed using system time.
39 *
40 * The interface to accurate timers is very similar to Linux timers with the
41 * exception that the expires value is not expressed in jiffies but in ns from
42 * boot time. Its implementation however, is entirely different.
43 */
45 struct ac_timer {
46 s_time_t expires; /* system time time out value */
47 unsigned long data;
48 void (*function)(unsigned long);
49 unsigned int cpu;
50 unsigned int heap_offset;
51 };
53 /* interface for "clients" */
54 extern void add_ac_timer(struct ac_timer *timer);
55 extern void rem_ac_timer(struct ac_timer *timer);
56 extern void mod_ac_timer(struct ac_timer *timer, s_time_t new_time);
57 static __inline__ void init_ac_timer(struct ac_timer *timer, int cpu)
58 {
59 timer->cpu = cpu;
60 timer->heap_offset = 0;
61 }
62 /* check if ac_timer is active, i.e., on the list */
63 static __inline__ int active_ac_timer(struct ac_timer *timer)
64 {
65 return (timer->heap_offset != 0);
66 }
68 /* interface used by programmable timer, implemented hardware dependent */
69 extern int reprogram_ac_timer(s_time_t timeout);
71 #endif /* _AC_TIMER_H_ */