xref: /illumos-gate/usr/src/uts/i86pc/sys/machclock.h (revision 2df1fe9ca32bb227b9158c67f5c00b54c20b10fd)
1ae115bc7Smrj /*
2ae115bc7Smrj  * CDDL HEADER START
3ae115bc7Smrj  *
4ae115bc7Smrj  * The contents of this file are subject to the terms of the
5ae115bc7Smrj  * Common Development and Distribution License (the "License").
6ae115bc7Smrj  * You may not use this file except in compliance with the License.
7ae115bc7Smrj  *
8ae115bc7Smrj  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9ae115bc7Smrj  * or http://www.opensolaris.org/os/licensing.
10ae115bc7Smrj  * See the License for the specific language governing permissions
11ae115bc7Smrj  * and limitations under the License.
12ae115bc7Smrj  *
13ae115bc7Smrj  * When distributing Covered Code, include this CDDL HEADER in each
14ae115bc7Smrj  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15ae115bc7Smrj  * If applicable, add the following below this CDDL HEADER, with the
16ae115bc7Smrj  * fields enclosed by brackets "[]" replaced with your own identifying
17ae115bc7Smrj  * information: Portions Copyright [yyyy] [name of copyright owner]
18ae115bc7Smrj  *
19ae115bc7Smrj  * CDDL HEADER END
20ae115bc7Smrj  */
21ae115bc7Smrj 
22ae115bc7Smrj /*
23ae115bc7Smrj  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
24ae115bc7Smrj  * Use is subject to license terms.
25ae115bc7Smrj  */
26ae115bc7Smrj 
27ae115bc7Smrj #ifndef	_SYS_MACHCLOCK_H
28ae115bc7Smrj #define	_SYS_MACHCLOCK_H
29ae115bc7Smrj 
30ae115bc7Smrj #pragma ident	"%Z%%M%	%I%	%E% SMI"
31ae115bc7Smrj 
32ae115bc7Smrj #ifdef __cplusplus
33ae115bc7Smrj extern "C" {
34ae115bc7Smrj #endif
35ae115bc7Smrj 
36ae115bc7Smrj /*
37ae115bc7Smrj  * tod module name and operations
38ae115bc7Smrj  */
39ae115bc7Smrj 
40ae115bc7Smrj struct tod_ops;
41ae115bc7Smrj typedef struct tod_ops tod_ops_t;
42ae115bc7Smrj 
43*2df1fe9cSrandyf /*
44*2df1fe9cSrandyf  * TOD Ops.
45*2df1fe9cSrandyf  * The only functions that _must_ be defined are the tod_get() and
46*2df1fe9cSrandyf  * tod_set() functions.  All others may be unused, and need to be
47*2df1fe9cSrandyf  * checked for NULL before using.
48*2df1fe9cSrandyf  */
49ae115bc7Smrj struct tod_ops {
50ae115bc7Smrj 	int		tod_version;
51ae115bc7Smrj 	timestruc_t	(*tod_get)(tod_ops_t *);
52ae115bc7Smrj 	void		(*tod_set)(tod_ops_t *, timestruc_t);
53*2df1fe9cSrandyf 	uint_t		(*tod_set_watchdog_timer)(tod_ops_t *, int);
54*2df1fe9cSrandyf 	uint_t		(*tod_clear_watchdog_timer)(tod_ops_t *);
55*2df1fe9cSrandyf 	void		(*tod_set_wake_alarm)(tod_ops_t *, int);
56*2df1fe9cSrandyf 	void		(*tod_clear_wake_alarm)(tod_ops_t *);
57ae115bc7Smrj 	struct tod_ops	*tod_next;
58ae115bc7Smrj };
59ae115bc7Smrj 
60ae115bc7Smrj #define	TOD_OPS_VERSION	1
61ae115bc7Smrj 
62ae115bc7Smrj extern tod_ops_t	*tod_ops;
63ae115bc7Smrj extern char		*tod_module_name;
64ae115bc7Smrj 
65ae115bc7Smrj #define	TODOP_GET(top)		((top)->tod_get(top))
66ae115bc7Smrj #define	TODOP_SET(top, ts)	((top)->tod_set(top, ts))
67*2df1fe9cSrandyf #define	TODOP_SETWD(top, nsec)	((top)->tod_set_watchdog_timer(top, nsec))
68*2df1fe9cSrandyf #define	TODOP_CLRWD(top)	((top)->tod_clear_watchdog_timer(top))
69*2df1fe9cSrandyf #define	TODOP_SETWAKE(top, nsec) ((top)->tod_set_wake_alarm(top, nsec))
70*2df1fe9cSrandyf #define	TODOP_CLRWAKE(top)	((top)->tod_clear_wake_alarm(top))
71ae115bc7Smrj 
72ae115bc7Smrj #ifdef	__cplusplus
73ae115bc7Smrj }
74ae115bc7Smrj #endif
75ae115bc7Smrj 
76ae115bc7Smrj #endif	/* _SYS_MACHCLOCK_H */
77