Annotation of sys/arch/sparc/include/apmvar.h, Revision 1.1
1.1 ! nbrk 1: /* $OpenBSD: apmvar.h,v 1.1 2005/03/29 16:26:44 miod Exp $ */
! 2:
! 3: /*
! 4: * Copyright (c) 1995 John T. Kohl
! 5: * All rights reserved.
! 6: *
! 7: * Redistribution and use in source and binary forms, with or without
! 8: * modification, are permitted provided that the following conditions
! 9: * are met:
! 10: * 1. Redistributions of source code must retain the above copyright
! 11: * notice, this list of conditions and the following disclaimer.
! 12: * 2. Redistributions in binary form must reproduce the above copyright
! 13: * notice, this list of conditions and the following disclaimer in the
! 14: * documentation and/or other materials provided with the distribution.
! 15: * 3. The name of the author may not be used to endorse or promote products
! 16: * derived from this software without specific prior written permission.
! 17: *
! 18: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR
! 19: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
! 20: * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
! 21: * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
! 22: * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
! 23: * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
! 24: * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
! 25: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
! 26: * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
! 27: * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! 28: * POSSIBILITY OF SUCH DAMAGE.
! 29: *
! 30: */
! 31: #ifndef _MACHINE_APMVAR_H_
! 32: #define _MACHINE_APMVAR_H_
! 33:
! 34: #include <sys/ioccom.h>
! 35:
! 36: /*
! 37: * This is a subset of the Advanced Power Management (v1.0 and v1.1
! 38: * specification) functions/defines/etc, covering the abilities of
! 39: * the tctrl driver.
! 40: */
! 41:
! 42: #define APM_POWER_STATUS 0x530a
! 43: #define APM_AC_OFF 0x00
! 44: #define APM_AC_ON 0x01
! 45: #define APM_AC_BACKUP 0x02
! 46: #define APM_AC_UNKNOWN 0xff
! 47: #define APM_BATT_HIGH 0x00
! 48: #define APM_BATT_LOW 0x01
! 49: #define APM_BATT_CRITICAL 0x02
! 50: #define APM_BATT_CHARGING 0x03
! 51: #define APM_BATT_UNKNOWN 0xff
! 52: #define APM_BATT_FLAG_HIGH 0x01
! 53: #define APM_BATT_FLAG_LOW 0x02
! 54: #define APM_BATT_FLAG_CRITICAL 0x04
! 55: #define APM_BATT_FLAG_CHARGING 0x08
! 56: #define APM_BATT_FLAG_NOBATTERY 0x10
! 57: #define APM_BATT_FLAG_NOSYSBATT 0x80
! 58: #define APM_BATT_LIFE_UNKNOWN 0xff
! 59:
! 60: #define APM_GET_PM_EVENT 0x530b
! 61: #define APM_NOEVENT 0x0000
! 62: #define APM_STANDBY_REQ 0x0001 /* %bx on return */
! 63: #define APM_SUSPEND_REQ 0x0002
! 64: #define APM_NORMAL_RESUME 0x0003
! 65: #define APM_CRIT_RESUME 0x0004 /* suspend/resume happened
! 66: without us */
! 67: #define APM_BATTERY_LOW 0x0005
! 68: #define APM_POWER_CHANGE 0x0006
! 69: #define APM_UPDATE_TIME 0x0007
! 70: #define APM_CRIT_SUSPEND_REQ 0x0008
! 71: #define APM_USER_STANDBY_REQ 0x0009
! 72: #define APM_USER_SUSPEND_REQ 0x000A
! 73: #define APM_SYS_STANDBY_RESUME 0x000B
! 74: #define APM_CAPABILITY_CHANGE 0x000C /* apm v1.2 */
! 75:
! 76: #define APM_EVENT_MASK 0xffff
! 77:
! 78: #define APM_EVENT_COMPOSE(t,i) ((((i) & 0x7fff) << 16)|((t) & APM_EVENT_MASK))
! 79: #define APM_EVENT_TYPE(e) ((e) & APM_EVENT_MASK)
! 80: #define APM_EVENT_INDEX(e) ((e) >> 16)
! 81:
! 82: #define APM_GET_POWER_STATE 0x530c
! 83:
! 84: /*
! 85: * LP (Laptop Package)
! 86: *
! 87: * Copyright (C) 1994 by HOSOKAWA Tatsumi <hosokawa@mt.cs.keio.ac.jp>
! 88: *
! 89: * This software may be used, modified, copied, and distributed, in
! 90: * both source and binary form provided that the above copyright and
! 91: * these terms are retained. Under no circumstances is the author
! 92: * responsible for the proper functioning of this software, nor does
! 93: * the author assume any responsibility for damages incurred with its
! 94: * use.
! 95: *
! 96: * Sep., 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD)
! 97: */
! 98:
! 99: #define APM_BATTERY_ABSENT 4
! 100:
! 101: struct apm_power_info {
! 102: u_char battery_state;
! 103: u_char ac_state;
! 104: u_char battery_life;
! 105: u_char spare1;
! 106: u_int minutes_left; /* estimate */
! 107: u_int spare2[6];
! 108: };
! 109:
! 110: struct apm_ctl {
! 111: u_int dev;
! 112: u_int mode;
! 113: };
! 114:
! 115: #define APM_IOC_STANDBY _IO('A', 1) /* put system into standby */
! 116: #define APM_IOC_SUSPEND _IO('A', 2) /* put system into suspend */
! 117: #define APM_IOC_GETPOWER _IOR('A', 3, struct apm_power_info) /* fetch battery state */
! 118: #define APM_IOC_PRN_CTL _IOW('A', 6, int) /* driver power status msg */
! 119: #define APM_PRINT_ON 0 /* driver power status displayed */
! 120: #define APM_PRINT_OFF 1 /* driver power status not displayed */
! 121: #define APM_PRINT_PCT 2 /* driver power status only displayed
! 122: if the percentage changes */
! 123:
! 124: #endif /* _MACHINE_APMVAR_H_ */
CVSweb