1 .\" $NetBSD: pow.4,v 1.13 2008/12/20 17:25:20 wiz Exp $
3 .\" Copyright (c) 1995 MINOURA Makoto.
4 .\" All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
14 .\" 3. All advertising materials mentioning features or use of this software
15 .\" must display the following acknowledgement:
16 .\" This product includes software developed by Minoura Makoto.
17 .\" 4. The name of the author may not be used to endorse or promote products
18 .\" derived from this software without specific prior written permission
20 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 .Nd X68k power switch device
40 is a device used to access the x68k power switch / bootstrap information and
42 The following operations are allowed using the
46 .Bl -tag -width POWIOCGPOWERINFO -compact -offset indent
48 Get power switch status
50 Get RTC alarm timer status
55 Any power switch events are reported to
57 .Sh GETTING POWER SWITCH STATUS
58 .Bd -literal -offset indent
59 #include \*[Lt]sys/ioctl.h\*[Gt]
60 #include \*[Lt]machine/powioctl.h\*[Gt]
62 ioctl (fd, POWIOCGPOWERINFO, \*[Am]powerinfo);
63 struct x68k_powerinfo powerinfo;
66 Returns the power switch status etc. in the following structure.
67 .Bd -literal -offset indent
68 struct x68k_powerinfo {
69 int pow_switch_boottime;
70 int pow_switch_current;
72 unsigned int pow_bootcount;
77 The members of the structure mean:
79 .It pow_switch_boottime :
80 The power switch status at the system start time.
81 The status can be checked by testing for the following definitions
86 .Bl -tag -compact -width POW_EXTERNALSW
88 True if the system started by the RTC alarm timer
90 True if the EXPWON signal of the I/O slot is on
92 True if the front power switch is on
95 EXPWON-related information is not tested.
96 .It pow_switch_current :
97 Current power switch status.
103 .It pow_bootcount , pow_usedtotal :
104 Host's boot information from the system memory switch.
105 Total usage in count (pow_bootcount) and second (pow_usedtotal).
107 .Sh ACCESSING RTC ALARM TIMER
108 .Ss Getting the alarm timer
109 .Bd -literal -offset indent
110 #include \*[Lt]sys/ioctl.h\*[Gt]
111 #include \*[Lt]machine/powioctl.h\*[Gt]
113 ioctl (fd, POWIOCGALARMINFO, \*[Am]alarminfo);
114 struct x68k_alarminfo alarminfo;
117 Returns x68k's alarm timer information in the following structure.
118 .Bd -literal -offset indent
119 struct x68k_alarminfo {
121 unsigned int al_ontime;
130 True if the alarm timer is enable.
132 Internal expression of the alarm timer.
134 .Dq C Compiler PRO-68K Programmers' Manual
135 Chapter 3 Section ALARMSET.
137 What to do when started by the alarm timer.
139 .Dq Programmers' manual .
141 Display the time in seconds since the alarm is activated until
142 the power is turned off (though the resolution is resolved to minutes).
143 Be cautious when using IOCS and the like as these require minute
145 0 indicates an infinity.
147 .Ss Setting the alarm timer
148 .Bd -literal -offset indent
149 ioctl (fd, POWIOCSALARMINFO, \*[Am]alarminfo);
150 struct x68k_alarminfo alarminfo;
153 Sets the alarm timer according to the argument
161 .%T C Compiler PRO-68K Programmers' Manual', Chapter 3 IOCS Calls, Section ALARMSET
165 .An Minoura Makoto Aq minoura@flab.fujitsu.co.jp
168 .Aq hahne@sail.t.u-tokyo.ac.jp
172 can only be opened by one process at a time.