/*
- * Copyright (c) 2003-2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2003-2007 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
#include <kern/kalloc.h>
#include <kern/thread.h>
+#include <libkern/OSAtomic.h>
+
#include <machine/machine_routines.h>
#include <machine/cpu_data.h>
#include <chud/chud_xnu.h>
#include <chud/chud_xnu_private.h>
+#if 0
#pragma mark **** timer ****
+#endif
+
__private_extern__ chud_timer_t
-chudxnu_timer_alloc(chudxnu_timer_callback_func_t func, uint32_t param0)
+chudxnu_timer_alloc(chudxnu_timer_callback_func_t func, thread_call_param_t param0)
{
- return (chud_timer_t)thread_call_allocate((thread_call_func_t)func, (thread_call_param_t)param0);
+ return (chud_timer_t)thread_call_allocate((thread_call_func_t)func, param0);
}
__private_extern__ kern_return_t
chudxnu_timer_callback_enter(
chud_timer_t timer,
- uint32_t param1,
+ thread_call_param_t param1,
uint32_t time,
uint32_t units)
{
uint64_t t_delay;
clock_interval_to_deadline(time, units, &t_delay);
- thread_call_enter1_delayed((thread_call_t)timer, (thread_call_param_t)param1, t_delay);
+ thread_call_enter1_delayed((thread_call_t)timer, param1, t_delay);
return KERN_SUCCESS;
}
return KERN_SUCCESS;
}
-#pragma mark **** thread timer - DEPRECATED ****
-
-static thread_call_t thread_timer_call = NULL;
-static chudxnu_thread_timer_callback_func_t thread_timer_callback_fn = NULL;
-
-static void chudxnu_private_thread_timer_callback(
- thread_call_param_t param0,
- thread_call_param_t param1)
-{
-#pragma unused (param1)
- chudxnu_thread_timer_callback_func_t fn = thread_timer_callback_fn;
-
- if(thread_timer_call) {
- thread_call_free(thread_timer_call);
- thread_timer_call = NULL;
-
- if(fn) {
- (fn)((uint32_t)param0);
- }
- }
-}
-
-// DEPRECATED
-__private_extern__
-kern_return_t chudxnu_thread_timer_callback_enter(
- chudxnu_thread_timer_callback_func_t func,
- uint32_t param,
- uint32_t time,
- uint32_t units)
-{
- if(!thread_timer_call) {
- uint64_t t_delay;
- thread_timer_callback_fn = func;
-
- thread_timer_call = thread_call_allocate(
- (thread_call_func_t)
- chudxnu_private_thread_timer_callback,
- (thread_call_param_t)
- param);
- clock_interval_to_deadline(time, units, &t_delay);
- thread_call_enter_delayed(thread_timer_call, t_delay);
- return KERN_SUCCESS;
- } else {
- return KERN_FAILURE; // thread timer call already pending
- }
-}
-// DEPRECATED
-__private_extern__
-kern_return_t chudxnu_thread_timer_callback_cancel(void)
-{
- if(thread_timer_call) {
- thread_call_cancel(thread_timer_call);
- thread_call_free(thread_timer_call);
- thread_timer_call = NULL;
- }
- thread_timer_callback_fn = NULL;
- return KERN_SUCCESS;
-}