1 /*	$NetBSD: cyclic.h,v 1.4 2012/12/02 00:05:39 chs Exp $	*/
2 
3 /*
4  * CDDL HEADER START
5  *
6  * The contents of this file are subject to the terms of the
7  * Common Development and Distribution License, Version 1.0 only
8  * (the "License").  You may not use this file except in compliance
9  * with the License.
10  *
11  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
12  * or http://www.opensolaris.org/os/licensing.
13  * See the License for the specific language governing permissions
14  * and limitations under the License.
15  *
16  * When distributing Covered Code, include this CDDL HEADER in each
17  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
18  * If applicable, add the following below this CDDL HEADER, with the
19  * fields enclosed by brackets "[]" replaced with your own identifying
20  * information: Portions Copyright [yyyy] [name of copyright owner]
21  *
22  * CDDL HEADER END
23  *
24  * $FreeBSD$
25  *
26  */
27 /*
28  * Copyright (c) 1999-2001 by Sun Microsystems, Inc.
29  * All rights reserved.
30  */
31 
32 #ifndef _COMPAT_OPENSOLARIS_SYS_CYCLIC_H_
33 #define _COMPAT_OPENSOLARIS_SYS_CYCLIC_H_
34 
35 #ifndef _KERNEL
36 typedef	void	cpu_t;
37 #endif
38 
39 
40 #ifndef _ASM
41 #include <sys/time.h>
42 #include <sys/cpuvar.h>
43 #endif /* !_ASM */
44 
45 #ifndef _ASM
46 
47 typedef uintptr_t cyclic_id_t;
48 typedef int cyc_index_t;
49 typedef uint16_t cyc_level_t;
50 typedef void (*cyc_func_t)(void *);
51 typedef void *cyb_arg_t;
52 
53 #define	CYCLIC_NONE		((cyclic_id_t)0)
54 
55 typedef struct cyc_handler {
56 	cyc_func_t cyh_func;
57 	void *cyh_arg;
58 } cyc_handler_t;
59 
60 typedef struct cyc_time {
61 	hrtime_t cyt_when;
62 	hrtime_t cyt_interval;
63 } cyc_time_t;
64 
65 typedef struct cyc_omni_handler {
66 	void (*cyo_online)(void *, cpu_t *, cyc_handler_t *, cyc_time_t *);
67 	void (*cyo_offline)(void *, cpu_t *, void *);
68 	void *cyo_arg;
69 } cyc_omni_handler_t;
70 
71 #ifdef _KERNEL
72 
73 cyclic_id_t cyclic_add(cyc_handler_t *, cyc_time_t *);
74 cyclic_id_t cyclic_add_omni(cyc_omni_handler_t *);
75 void cyclic_remove(cyclic_id_t);
76 
77 #endif /* _KERNEL */
78 
79 #endif /* !_ASM */
80 
81 #endif
82