170025d76Sjohnny /* 270025d76Sjohnny * CDDL HEADER START 370025d76Sjohnny * 470025d76Sjohnny * The contents of this file are subject to the terms of the 5337fc9e2Sanish * Common Development and Distribution License (the "License"). 6337fc9e2Sanish * You may not use this file except in compliance with the License. 770025d76Sjohnny * 870025d76Sjohnny * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 970025d76Sjohnny * or http://www.opensolaris.org/os/licensing. 1070025d76Sjohnny * See the License for the specific language governing permissions 1170025d76Sjohnny * and limitations under the License. 1270025d76Sjohnny * 1370025d76Sjohnny * When distributing Covered Code, include this CDDL HEADER in each 1470025d76Sjohnny * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 1570025d76Sjohnny * If applicable, add the following below this CDDL HEADER, with the 1670025d76Sjohnny * fields enclosed by brackets "[]" replaced with your own identifying 1770025d76Sjohnny * information: Portions Copyright [yyyy] [name of copyright owner] 1870025d76Sjohnny * 1970025d76Sjohnny * CDDL HEADER END 2070025d76Sjohnny */ 2170025d76Sjohnny 2270025d76Sjohnny /* 23ae115bc7Smrj * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 2470025d76Sjohnny * Use is subject to license terms. 2570025d76Sjohnny */ 2670025d76Sjohnny 27ae115bc7Smrj #ifndef _SYS_MACHCLOCK_H 28ae115bc7Smrj #define _SYS_MACHCLOCK_H 2970025d76Sjohnny 30ae115bc7Smrj #ifdef __cplusplus 3170025d76Sjohnny extern "C" { 3270025d76Sjohnny #endif 3370025d76Sjohnny 3470025d76Sjohnny /* 35ae115bc7Smrj * tod module name and operations 3670025d76Sjohnny */ 3770025d76Sjohnny 38ae115bc7Smrj struct tod_ops; 39ae115bc7Smrj typedef struct tod_ops tod_ops_t; 4070025d76Sjohnny 41*2df1fe9cSrandyf /* 42*2df1fe9cSrandyf * TOD Ops. 43*2df1fe9cSrandyf * The only functions that _must_ be defined are the tod_get() and 44*2df1fe9cSrandyf * tod_set() functions. All others may be unused, and need to be 45*2df1fe9cSrandyf * checked for NULL before using. 46*2df1fe9cSrandyf */ 47ae115bc7Smrj struct tod_ops { 48ae115bc7Smrj int tod_version; 49ae115bc7Smrj timestruc_t (*tod_get)(tod_ops_t *); 50ae115bc7Smrj void (*tod_set)(tod_ops_t *, timestruc_t); 51*2df1fe9cSrandyf uint_t (*tod_set_watchdog_timer)(tod_ops_t *, int); 52*2df1fe9cSrandyf uint_t (*tod_clear_watchdog_timer)(tod_ops_t *); 53*2df1fe9cSrandyf void (*tod_set_wake_alarm)(tod_ops_t *, int); 54*2df1fe9cSrandyf void (*tod_clear_wake_alarm)(tod_ops_t *); 55ae115bc7Smrj struct tod_ops *tod_next; 56ae115bc7Smrj }; 57ae115bc7Smrj 58ae115bc7Smrj #define TOD_OPS_VERSION 1 59ae115bc7Smrj 60ae115bc7Smrj extern tod_ops_t *tod_ops; 61ae115bc7Smrj extern char *tod_module_name; 6270025d76Sjohnny 63ae115bc7Smrj #define TODOP_GET(top) ((top)->tod_get(top)) 64ae115bc7Smrj #define TODOP_SET(top, ts) ((top)->tod_set(top, ts)) 65*2df1fe9cSrandyf #define TODOP_SETWD(top, nsec) ((top)->tod_set_watchdog_timer(top, nsec)) 66*2df1fe9cSrandyf #define TODOP_CLRWD(top) ((top)->tod_clear_watchdog_timer(top)) 67*2df1fe9cSrandyf #define TODOP_SETWAKE(top, nsec) ((top)->tod_set_wake_alarm(top, nsec)) 68*2df1fe9cSrandyf #define TODOP_CLRWAKE(top) ((top)->tod_clear_wake_alarm(top)) 6970025d76Sjohnny 7070025d76Sjohnny #ifdef __cplusplus 7170025d76Sjohnny } 7270025d76Sjohnny #endif 7370025d76Sjohnny 74ae115bc7Smrj #endif /* _SYS_MACHCLOCK_H */ 75