]>
git.saurik.com Git - apple/xnu.git/blob - osfmk/kern/timer.h
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
26 * Mach Operating System
27 * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
28 * All Rights Reserved.
30 * Permission to use, copy, modify and distribute this software and its
31 * documentation is hereby granted, provided that both the copyright
32 * notice and this permission notice appear in all copies of the
33 * software, derivative works or modified versions, and any portions
34 * thereof, and that both notices appear in supporting documentation.
36 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
37 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
38 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
40 * Carnegie Mellon requests users of this software to return to
42 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
43 * School of Computer Science
44 * Carnegie Mellon University
45 * Pittsburgh PA 15213-3890
47 * any improvements or extensions that they make and grant Carnegie Mellon
48 * the rights to redistribute these changes.
53 #ifndef _KERN_TIMER_H_
54 #define _KERN_TIMER_H_
56 #include <stat_time.h>
58 #include <kern/kern_types.h>
61 * Definitions for high resolution timers. A check
62 * word on the high portion allows atomic updates.
68 uint32_t high_bits_check
;
71 #endif /* STAT_TIME */
74 typedef struct timer timer_data_t
, *timer_t
;
77 * Exported kernel interface to timers
82 #include <kern/macro_help.h>
84 /* Advance a timer by the specified amount */
85 #define TIMER_BUMP(timer, ticks) \
87 uint32_t old_low, low; \
89 old_low = (timer)->low_bits; \
90 low = old_low + (ticks); \
92 timer_update((timer), (timer)->high_bits + 1, low); \
94 (timer)->low_bits = low; \
97 #define timer_switch(tstamp, new_timer)
98 #define timer_event(tstamp, new_timer)
100 #else /* STAT_TIME */
102 /* Update the current timer and start a new one */
103 extern void timer_switch(
107 #define TIMER_BUMP(timer, ticks)
109 #endif /* STAT_TIME */
111 /* Initialize a timer */
112 extern void timer_init(
115 /* Update a saved timer value and return delta to current value */
116 extern uint64_t timer_delta(
121 * Exported hardware interface to timers
124 /* Read timer value */
125 extern uint64_t timer_grab(
128 /* Update timer value */
129 extern void timer_update(
136 /* Update the current timer at an event */
137 extern void timer_event(
141 #endif /* STAT_TIME */
143 #endif /* _KERN_TIMER_H_ */