]> git.saurik.com Git - apple/xnu.git/blame - bsd/net/devtimer.h
xnu-792.6.56.tar.gz
[apple/xnu.git] / bsd / net / devtimer.h
CommitLineData
91447636
A
1/*
2 * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
ff6e181a
A
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
91447636 12 *
ff6e181a
A
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
91447636
A
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
ff6e181a
A
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
91447636
A
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24/*
25 * devtimer.h
26 * - timer source based on <kern/thread_call.h>
27 */
28
29
30#ifndef _NET_DEVTIMER_H
31#define _NET_DEVTIMER_H
32
33#include <sys/types.h>
34#include <sys/systm.h>
35
36#define DEVTIMER_USECS_PER_SEC (1000 * 1000)
37
38enum {
39 devtimer_process_func_event_lock,
40 devtimer_process_func_event_unlock,
41};
42typedef int devtimer_process_func_event;
43
44typedef struct devtimer_s * devtimer_ref;
45typedef void (*devtimer_process_func)(devtimer_ref timer,
46 devtimer_process_func_event event);
47typedef void (*devtimer_timeout_func)(void * arg0, void * arg1, void * arg2);
48
49int
50devtimer_valid(devtimer_ref timer);
51
52void
53devtimer_retain(devtimer_ref timer);
54
55void *
56devtimer_arg0(devtimer_ref timer);
57
58devtimer_ref
59devtimer_create(devtimer_process_func process_func, void * arg0);
60
61void
62devtimer_invalidate(devtimer_ref timer);
63
64void
65devtimer_release(devtimer_ref timer);
66
67void
68devtimer_set_absolute(devtimer_ref t,
69 struct timeval abs_time,
70 devtimer_timeout_func func,
71 void * arg1, void * arg2);
72
73void
74devtimer_set_relative(devtimer_ref t,
75 struct timeval rel_time,
76 devtimer_timeout_func func,
77 void * arg1, void * arg2);
78void
79devtimer_cancel(devtimer_ref t);
80
81int
82devtimer_enabled(devtimer_ref t);
83
84struct timeval
85devtimer_current_time(void);
86
87int32_t
88devtimer_current_secs(void);
89
90#endif _NET_DEVTIMER_H