2 * Copyright (c) 2004 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@
25 * - timer source based on <kern/thread_call.h>
29 #ifndef _NET_DEVTIMER_H
30 #define _NET_DEVTIMER_H
32 #include <sys/types.h>
33 #include <sys/systm.h>
35 #define DEVTIMER_USECS_PER_SEC (1000 * 1000)
38 devtimer_process_func_event_lock
,
39 devtimer_process_func_event_unlock
,
41 typedef int devtimer_process_func_event
;
43 typedef struct devtimer_s
* devtimer_ref
;
44 typedef void (*devtimer_process_func
)(devtimer_ref timer
,
45 devtimer_process_func_event event
);
46 typedef void (*devtimer_timeout_func
)(void * arg0
, void * arg1
, void * arg2
);
49 devtimer_valid(devtimer_ref timer
);
52 devtimer_retain(devtimer_ref timer
);
55 devtimer_arg0(devtimer_ref timer
);
58 devtimer_create(devtimer_process_func process_func
, void * arg0
);
61 devtimer_invalidate(devtimer_ref timer
);
64 devtimer_release(devtimer_ref timer
);
67 devtimer_set_absolute(devtimer_ref t
,
68 struct timeval abs_time
,
69 devtimer_timeout_func func
,
70 void * arg1
, void * arg2
);
73 devtimer_set_relative(devtimer_ref t
,
74 struct timeval rel_time
,
75 devtimer_timeout_func func
,
76 void * arg1
, void * arg2
);
78 devtimer_cancel(devtimer_ref t
);
81 devtimer_enabled(devtimer_ref t
);
84 devtimer_current_time(void);
87 devtimer_current_secs(void);
89 #endif _NET_DEVTIMER_H