FreeBSD/Linux Kernel Cross Reference
sys/mach/timer.h
1 /*
2 * Mach Operating System
3 * Copyright (c) 1993,1992 Carnegie Mellon University
4 * All Rights Reserved.
5 *
6 * Permission to use, copy, modify and distribute this software and its
7 * documentation is hereby granted, provided that both the copyright
8 * notice and this permission notice appear in all copies of the
9 * software, derivative works or modified versions, and any portions
10 * thereof, and that both notices appear in supporting documentation.
11 *
12 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
13 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
15 *
16 * Carnegie Mellon requests users of this software to return to
17 *
18 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
19 * School of Computer Science
20 * Carnegie Mellon University
21 * Pittsburgh PA 15213-3890
22 *
23 * any improvements or extensions that they make and grant Carnegie Mellon
24 * the rights to redistribute these changes.
25 */
26 /*
27 * HISTORY
28 * $Log: timer.h,v $
29 * Revision 2.2 93/11/17 17:48:46 dbg
30 * Changed 'flags' to 'overruns'.
31 * [93/05/06 dbg]
32 *
33 * 64 bit cleanup.
34 * [93/02/19 dbg]
35 *
36 * Fixed to put in kernel. Based on kernel timer elements.
37 *
38 * Changed time_values_t to time_spec_t to account for timer hardware skew.
39 * [92/07/18 savage]
40 * Redefined timer structure for user exportation. Forced to define
41 * it as mach_timer_t instead of timer_t... I'd love to change timer_t
42 * into counter_t but I'm sure the political headache isn't worth it.
43 * [92/06/12 savage]
44 * changed locks to work on multiprocessor (one hopes...)
45 * [92/06/10] savage]
46 * Created
47 * [92/05/01 savage]
48 *
49 */
50
51 /*
52 * File: mach/timer.h
53 * Authors: Stefan Savage and David Golub, 1992
54 *
55 * Definitions of the exported timer interface and
56 * data structures.
57 */
58
59 #ifndef _MACH_TIMER_H_
60 #define _MACH_TIMER_H_
61
62 #include <mach/time_spec.h>
63 #include <mach/boolean.h>
64 #include <mach/message.h>
65
66 /*
67 * Timers are identified by ports externally.
68 */
69 #ifndef KERNEL
70 typedef mach_port_t mach_timer_t;
71 #endif
72
73 /*
74 * Flags to timer calls:
75 */
76 #define TIMER_ABSOLUTE 0x01 /* expiration time is absolute */
77 #define TIMER_PERIODIC 0x02 /* timer is periodic */
78 #define TIMER_THREAD_SUSPEND 0x04 /* suspend thread when timer expires */
79 #define TIMER_EVENT 0x08 /* signal event when timer expires */
80
81 /*
82 * A timer sends an expiration message when the time is up.
83 * This message can be interpreted directly, or received
84 * through the 'timer_expire' interface.
85 */
86
87 struct timer_expire_message {
88 mach_msg_header_t Head;
89 mach_msg_type_t timeType;
90 time_spec_t time;
91 };
92
93 typedef struct timer_expire_message *timer_expire_message_t;
94 typedef struct timer_expire_message timer_expire_message_data_t;
95
96 /*
97 * Information that can be requested about timers.
98 */
99 typedef natural_t *mach_timer_info_t;
100
101 /*
102 * Basic timer information:
103 */
104 #define MACH_TIMER_BASIC_INFO 1
105 struct mach_timer_basic_info {
106 natural_t type; /* message | event | suspend,
107 periodic */
108 time_spec_t expire_time; /* expiration time */
109 time_spec_t interval_time; /* period, for periodic timers */
110 natural_t event; /* event ID if assigned */
111 natural_t overruns; /* how many times a periodic
112 timer has expired and failed
113 to deliver a message to a
114 full port */
115 /* boolean_t */
116 natural_t enqueued; /* is timer on queue? */
117 };
118
119 typedef struct mach_timer_basic_info *mach_timer_basic_info_t;
120 typedef struct mach_timer_basic_info mach_timer_basic_info_data_t;
121
122 #define MACH_TIMER_BASIC_INFO_COUNT \
123 (sizeof(mach_timer_basic_info_data_t) / sizeof(natural_t))
124
125 #endif /* _MACH_TIMER_H_ */
126
Cache object: 9a76f8bb84d42fb9c270517e19a6afb3
|