]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/kern/clock.h
xnu-2050.7.9.tar.gz
[apple/xnu.git] / osfmk / kern / clock.h
index 6766417636bf402caac8bda2b7cd2d8790b08225..ed8218d17d8a2196836ffd4182299aa37dbb0661 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2008 Apple Inc. All rights reserved.
  *
  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  * 
 
 #include <sys/cdefs.h>
 
+#ifdef __LP64__
+
+typedef unsigned long          clock_sec_t;
+typedef unsigned int           clock_usec_t, clock_nsec_t;
+
+#else  /* __LP64__ */
+
+typedef uint32_t                       clock_sec_t;
+typedef uint32_t                       clock_usec_t, clock_nsec_t;
+
+#endif /* __LP64__ */
+
 #ifdef MACH_KERNEL_PRIVATE
 
+#include <kern/queue.h>
+
 /*
  * Clock operations list structure. Contains vectors to machine
  * dependent clock routines.
@@ -96,47 +110,26 @@ extern void                clock_timebase_init(void);
  */
 extern void            clock_service_create(void);
 
-typedef void           (*clock_timer_func_t)(
-                                               uint64_t                        timestamp);
-
-extern void                    clock_set_timer_func(
-                                               clock_timer_func_t      func);
-
-extern void                    clock_set_timer_deadline(
-                                               uint64_t                        deadline);
-
 extern void                    clock_gettimeofday_set_commpage(
                                                uint64_t                                abstime,
                                                uint64_t                                epoch,
                                                uint64_t                                offset,
-                                               uint32_t                                *secs,
-                                               uint32_t                                *microsecs);
+                                               clock_sec_t                             *secs,
+                                               clock_usec_t                    *microsecs);
 
 extern void                    machine_delay_until(
                                                uint64_t                deadline);
 
-#include <stat_time.h>
-
-extern void            hertz_tick(
-#if    STAT_TIME
-                                       natural_t               ticks,
-#endif /* STAT_TIME */
-                                       boolean_t               usermode,       /* executing user code */
-                                       natural_t               pc);
-
-extern void            absolutetime_to_microtime(
-                                       uint64_t                abstime,
-                                       uint32_t                *secs,
-                                       uint32_t                *microsecs);
+extern uint32_t                hz_tick_interval;
 
 extern void            absolutetime_to_nanotime(
                                        uint64_t                abstime,
-                                       uint32_t                *secs,
-                                       uint32_t                *nanosecs);
+                                       clock_sec_t             *secs,
+                                       clock_nsec_t    *nanosecs);
 
 extern void            nanotime_to_absolutetime(
-                                   uint32_t            secs,
-                                       uint32_t                nanosecs,
+                                       clock_sec_t             secs,
+                                       clock_nsec_t    nanosecs,
                                        uint64_t                *result);
 
 #endif /* MACH_KERNEL_PRIVATE */
@@ -146,48 +139,60 @@ __BEGIN_DECLS
 #ifdef XNU_KERNEL_PRIVATE
 
 extern void                    clock_adjtime(
-                                               int32_t         *secs,
-                                               int32_t         *microsecs);
+                                               long            *secs,
+                                               int                     *microsecs);
 
 extern void                    clock_initialize_calendar(void);
 
 extern void                    clock_wakeup_calendar(void);
 
 extern void                    clock_gettimeofday(
-                        uint32_t                       *secs,
-                        uint32_t                       *microsecs);
+                                               clock_sec_t                     *secs,
+                                               clock_usec_t            *microsecs);
 
 extern void                    clock_set_calendar_microtime(
-                                               uint32_t                        secs,
-                                               uint32_t                        microsecs);
+                                               clock_sec_t                     secs,
+                                               clock_usec_t            microsecs);
 
 extern void                    clock_get_boottime_nanotime(
-                                               uint32_t                        *secs,
-                                               uint32_t                        *nanosecs);
+                                               clock_sec_t                     *secs,
+                                               clock_nsec_t            *nanosecs);
+
+extern void                    absolutetime_to_microtime(
+                                               uint64_t                        abstime,
+                                               clock_sec_t                     *secs,
+                                               clock_usec_t            *microsecs);
 
 extern void                    clock_deadline_for_periodic_event(
                                                uint64_t                        interval,
                                                uint64_t                        abstime,
                                                uint64_t                        *deadline);
 
-#endif /* XNU_KERNEL_PRIVATE */
+#if    CONFIG_DTRACE
 
+extern void                    clock_get_calendar_nanotime_nowait(
+                                               clock_sec_t                     *secs,
+                                               clock_nsec_t            *nanosecs);
+
+#endif /* CONFIG_DTRACE */
+
+#endif /* XNU_KERNEL_PRIVATE */
 
 extern void                    clock_get_calendar_microtime(
-                                               uint32_t                        *secs,
-                                               uint32_t                        *microsecs);
+                                               clock_sec_t                     *secs,
+                                               clock_usec_t            *microsecs);
 
 extern void                    clock_get_calendar_nanotime(
-                                               uint32_t                        *secs,
-                                               uint32_t                        *nanosecs);
+                                               clock_sec_t                     *secs,
+                                               clock_nsec_t            *nanosecs);
 
 extern void                    clock_get_system_microtime(
-                                               uint32_t                        *secs,
-                                               uint32_t                        *microsecs);
+                                               clock_sec_t                     *secs,
+                                               clock_usec_t            *microsecs);
 
 extern void                    clock_get_system_nanotime(
-                                               uint32_t                        *secs,
-                                               uint32_t                        *nanosecs);
+                                               clock_sec_t                     *secs,
+                                               clock_nsec_t            *nanosecs);
 
 extern void                            clock_timebase_info(
                                                        mach_timebase_info_t    info);
@@ -226,6 +231,8 @@ extern void             nanoseconds_to_absolutetime(
  * Obsolete interfaces.
  */
 
+#ifndef        __LP64__
+
 #define MACH_TIMESPEC_SEC_MAX          (0 - 1)
 #define MACH_TIMESPEC_NSEC_MAX         (NSEC_PER_SEC - 1)
 
@@ -249,16 +256,31 @@ extern void             nanoseconds_to_absolutetime(
        }                                                                                       \
   } while (0)
 
+#include <Availability.h>
 
-extern mach_timespec_t clock_get_system_value(void);
+/* Use mach_absolute_time() */
+extern mach_timespec_t clock_get_system_value(void) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_2_0, __IPHONE_NA);
 
-extern mach_timespec_t clock_get_calendar_value(void);
+extern mach_timespec_t clock_get_calendar_value(void) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_2_0, __IPHONE_NA);
+
+#else  /* __LP64__ */
+
+#ifdef XNU_KERNEL_PRIVATE
+
+#define MACH_TIMESPEC_ZERO     ((mach_timespec_t) { 0, 0 } )
+
+#endif /* XNU_KERNEL_PRIVATE */
+
+#endif /* __LP64__ */
 
 extern void                            delay_for_interval(
                                                        uint32_t                interval,
                                                        uint32_t                scale_factor);
+
 #ifndef        MACH_KERNEL_PRIVATE
 
+#ifndef        __LP64__
+
 #ifndef        ABSOLUTETIME_SCALAR_TYPE
 
 #define clock_get_uptime(a)            \
@@ -287,7 +309,9 @@ extern void                         delay_for_interval(
 
 #endif /* ABSOLUTETIME_SCALAR_TYPE */
 
-#endif /* !MACH_KERNEL_PRIVATE */
+#endif /* __LP64__ */
+
+#endif /* MACH_KERNEL_PRIVATE */
 
 #endif /* KERNEL_PRIVATE */