blob: 280f377d1798b00887bebb6eb2ae16eddadcc554 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
/* -*- Mode:C; c-basic-offset:4; tab-width:4 -*-
****************************************************************************
* (C) 2002 - Rolf Neugebauer - Intel Research Cambridge
****************************************************************************
*
* File: ac_timer.h
* Author: Rolf Neugebauer (neugebar@dcs.gla.ac.uk)
* Changes:
*
* Date: Nov 2002
*
* Environment: Xen Hypervisor
* Description: Accurate timer for the Hypervisor
*
****************************************************************************
* $Id: h-insert.h,v 1.4 2002/11/08 16:03:55 rn Exp $
****************************************************************************
*/
#ifndef _AC_TIMER_H_
#define _AC_TIMER_H_
#include <xeno/time.h> /* include notion of time */
/*
* The Xen Hypervisor provides two types of timers:
*
* - Linux style, jiffy based timers for legacy code and coarse grain timeouts
* These are defined in ./include/xeno/timer.h and implemented in
* ./common/timer.c. Unlike in Linux they are executed not on a periodic
* timer interrupt but "occasionally" with somewhat lesser accuracy.
*
* - accurate timers defined in this file and implemented in
* ./common/ac_timer.c. These are implemented using a programmable timer
* interrupt and are thus as accurate as the hardware allows. Where possible
* we use the local APIC for this purpose. However, this fact is hidden
* behind a architecture independent layer.
* accurate timers are programmed using system time.
*
* The interface to accurate timers is very similar to Linux timers with the
* exception that the expires value is not expressed in jiffies but in ns from
* boot time. Its implementation however, is entirely different.
*/
struct ac_timer {
struct list_head timer_list;
s_time_t expires; /* system time time out value */
unsigned long data;
void (*function)(unsigned long);
};
/* interface for "clients" */
extern int add_ac_timer(struct ac_timer *timer);
extern int rem_ac_timer(struct ac_timer *timer);
extern int mod_ac_timer(struct ac_timer *timer, s_time_t new_time);
static inline void init_ac_timer(struct ac_timer *timer)
{
timer->timer_list.next = NULL;
}
/* interface used by programmable timer, implemented hardware dependent */
extern int reprogram_ac_timer(s_time_t timeout);
extern void do_ac_timer(void);
#endif /* _AC_TIMER_H_ */
|