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 #ifdef __cplusplus 31ae115bc7Smrj extern "C" { 32ae115bc7Smrj #endif 33ae115bc7Smrj 34ae115bc7Smrj /* 35ae115bc7Smrj * tod module name and operations 36ae115bc7Smrj */ 37ae115bc7Smrj 38ae115bc7Smrj struct tod_ops; 39ae115bc7Smrj typedef struct tod_ops tod_ops_t; 40ae115bc7Smrj 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; 62ae115bc7Smrj 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)) 69ae115bc7Smrj 70ae115bc7Smrj #ifdef __cplusplus 71ae115bc7Smrj } 72ae115bc7Smrj #endif 73ae115bc7Smrj 74ae115bc7Smrj #endif /* _SYS_MACHCLOCK_H */ 75