diff options
Diffstat (limited to 'kern')
-rw-r--r-- | kern/mach_clock.h | 63 | ||||
-rw-r--r-- | kern/time_out.h | 87 |
2 files changed, 50 insertions, 100 deletions
diff --git a/kern/mach_clock.h b/kern/mach_clock.h index e6f746b..93237aa 100644 --- a/kern/mach_clock.h +++ b/kern/mach_clock.h @@ -1,6 +1,5 @@ /* - * - * Copyright (C) 2006 Free Software Foundation, Inc. + * Copyright (C) 2006, 2007 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,34 +15,72 @@ * along with this program; if not, write to the Free Software * Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * - * Author: Barry deFreese. - */ -/* - * + * Author: Barry deFreese and others. */ #ifndef _KERN_MACH_CLOCK_H_ #define _KERN_MACH_CLOCK_H_ -#include <sys/types.h> -#include <kern/time_out.h> +/* + * Mach time-out and time-of-day facility. + */ + #include <mach/machine/kern_return.h> +#include <mach/time_value.h> +#include <kern/host.h> +#include <kern/queue.h> + + +/* Timers in kernel. */ +extern unsigned long elapsed_ticks; /* number of ticks elapsed since bootup */ +extern int hz; /* number of ticks per second */ +extern int tick; /* number of usec per tick */ + + +/* Time-out element. */ +struct timer_elt { + queue_chain_t chain; /* chain in order of expiration */ + int (*fcn)(); /* function to call */ + char * param; /* with this parameter */ + unsigned long ticks; /* expiration time, in ticks */ + int set; /* unset | set | allocated */ +}; +#define TELT_UNSET 0 /* timer not set */ +#define TELT_SET 1 /* timer set */ +#define TELT_ALLOC 2 /* timer allocated from pool */ + +typedef struct timer_elt timer_elt_data_t; +typedef struct timer_elt *timer_elt_t; + extern void clock_interrupt( int usec, boolean_t usermode, boolean_t basepri); -extern void softclock(); +extern void softclock (void); +/* For `private' timer elements. */ extern void set_timeout( timer_elt_t telt, unsigned int interval); - extern boolean_t reset_timeout(timer_elt_t telt); -extern void init_timeout(); +#define set_timeout_setup(telt,fcn,param,interval) \ + ((telt)->fcn = (fcn), \ + (telt)->param = (param), \ + (telt)->private = TRUE, \ + set_timeout((telt), (interval))) + +#define reset_timeout_check(t) \ + MACRO_BEGIN \ + if ((t)->set) \ + reset_timeout((t)); \ + MACRO_END +extern void init_timeout (void); + +/* Read the current time into STAMP. */ extern void record_time_stamp (time_value_t *stamp); extern kern_return_t host_get_time( @@ -59,10 +96,10 @@ extern kern_return_t host_adjust_time( time_value_t new_adjustment, time_value_t *old_adjustment); -extern void mapable_time_init(); +extern void mapable_time_init (void); +/* For public timer elements. */ extern void timeout(int (*fcn)(), char *param, int interval); - extern boolean_t untimeout(int (*fcn)(), char *param); #endif /* _KERN_MACH_CLOCK_H_ */ diff --git a/kern/time_out.h b/kern/time_out.h deleted file mode 100644 index 4907e5b..0000000 --- a/kern/time_out.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Mach Operating System - * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University - * All Rights Reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - */ - -#ifndef _KERN_TIME_OUT_H_ -#define _KERN_TIME_OUT_H_ - -/* - * Mach time-out and time-of-day facility. - */ - -#include <mach/boolean.h> -#include <mach/time_value.h> -#include <kern/lock.h> -#include <kern/queue.h> -#include <kern/zalloc.h> - -/* - * Timers in kernel: - */ -extern unsigned long elapsed_ticks; /* number of ticks elapsed since bootup */ -extern int hz; /* number of ticks per second */ -extern int tick; /* number of usec per tick */ - -/* Read the current time into STAMP */ -void record_time_stamp (time_value_t *stamp); - -/* - * Time-out element. - */ -struct timer_elt { - queue_chain_t chain; /* chain in order of expiration */ - int (*fcn)(); /* function to call */ - char * param; /* with this parameter */ - unsigned long ticks; /* expiration time, in ticks */ - int set; /* unset | set | allocated */ -}; -#define TELT_UNSET 0 /* timer not set */ -#define TELT_SET 1 /* timer set */ -#define TELT_ALLOC 2 /* timer allocated from pool */ - -typedef struct timer_elt timer_elt_data_t; -typedef struct timer_elt *timer_elt_t; - -/* for 'private' timer elements */ -extern void set_timeout(); -extern boolean_t reset_timeout(); - -/* for public timer elements */ -extern void timeout(); -extern boolean_t untimeout(); - -#define set_timeout_setup(telt,fcn,param,interval) \ - ((telt)->fcn = (fcn), \ - (telt)->param = (param), \ - (telt)->private = TRUE, \ - set_timeout((telt), (interval))) - -#define reset_timeout_check(t) \ - MACRO_BEGIN \ - if ((t)->set) \ - reset_timeout((t)); \ - MACRO_END - -#endif /* _KERN_TIME_OUT_H_ */ |