hpcbatteryvar.h revision 1.1.4.2 1 1.1.4.2 nathanw /* $NetBSD: hpcbatteryvar.h,v 1.1.4.2 2001/08/24 00:09:07 nathanw Exp $ */
2 1.1.4.2 nathanw
3 1.1.4.2 nathanw /*
4 1.1.4.2 nathanw * Copyright (c) 2000-2001 SATO Kazumi
5 1.1.4.2 nathanw * All rights reserved.
6 1.1.4.2 nathanw *
7 1.1.4.2 nathanw * Redistribution and use in source and binary forms, with or without
8 1.1.4.2 nathanw * modification, are permitted provided that the following conditions
9 1.1.4.2 nathanw * are met:
10 1.1.4.2 nathanw * 1. Redistributions of source code must retain the above copyright
11 1.1.4.2 nathanw * notice, this list of conditions and the following disclaimer.
12 1.1.4.2 nathanw * 2. Redistributions in binary form must reproduce the above copyright
13 1.1.4.2 nathanw * notice, this list of conditions and the following disclaimer in the
14 1.1.4.2 nathanw * documentation and/or other materials provided with the distribution.
15 1.1.4.2 nathanw *
16 1.1.4.2 nathanw * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 1.1.4.2 nathanw * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 1.1.4.2 nathanw * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 1.1.4.2 nathanw * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 1.1.4.2 nathanw * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 1.1.4.2 nathanw * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 1.1.4.2 nathanw * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 1.1.4.2 nathanw * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 1.1.4.2 nathanw * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 1.1.4.2 nathanw * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 1.1.4.2 nathanw * SUCH DAMAGE.
27 1.1.4.2 nathanw *
28 1.1.4.2 nathanw */
29 1.1.4.2 nathanw
30 1.1.4.2 nathanw #ifndef _HPCBATTERY_VAR_H
31 1.1.4.2 nathanw #define _HPCBATTERY_VAR_H
32 1.1.4.2 nathanw
33 1.1.4.2 nathanw #define HPCPM_MAX_BATTERY_VALUES 3
34 1.1.4.2 nathanw struct hpcbattery_values {
35 1.1.4.2 nathanw int nextpoll;
36 1.1.4.2 nathanw int n_values;
37 1.1.4.2 nathanw int value[HPCPM_MAX_BATTERY_VALUES];
38 1.1.4.2 nathanw };
39 1.1.4.2 nathanw
40 1.1.4.2 nathanw #ifdef notdef
41 1.1.4.2 nathanw typedef enum {
42 1.1.4.2 nathanw hpcbattery_init0,
43 1.1.4.2 nathanw hpcbattery_init1,
44 1.1.4.2 nathanw hpcbattery_unknown,
45 1.1.4.2 nathanw hpcbattery_dc,
46 1.1.4.2 nathanw hpcbattery_ac_charging,
47 1.1.4.2 nathanw hpcbattery_ac_nocharging
48 1.1.4.2 nathanw } hpcbattery_ac_state;
49 1.1.4.2 nathanw
50 1.1.4.2 nathanw typedef enum {
51 1.1.4.2 nathanw hpcbattery_batt_no_system_battery,
52 1.1.4.2 nathanw hpcbattery_batt_unknown,
53 1.1.4.2 nathanw hpcbattery_batt_100p,
54 1.1.4.2 nathanw hpcbattery_batt_90p,
55 1.1.4.2 nathanw hpcbattery_batt_80p,
56 1.1.4.2 nathanw hpcbattery_batt_70p,
57 1.1.4.2 nathanw hpcbattery_batt_60p,
58 1.1.4.2 nathanw hpcbattery_batt_50p,
59 1.1.4.2 nathanw hpcbattery_batt_40p,
60 1.1.4.2 nathanw hpcbattery_batt_30p,
61 1.1.4.2 nathanw hpcbattery_batt_20p,
62 1.1.4.2 nathanw hpcbattery_batt_10p,
63 1.1.4.2 nathanw hpcbattery_batt_critical,
64 1.1.4.2 nathanw } hpcbattery_batt_state;
65 1.1.4.2 nathanw
66 1.1.4.2 nathanw struct hpcbattery_softc {
67 1.1.4.2 nathanw struct device sc_device;
68 1.1.4.2 nathanw /* current status */
69 1.1.4.2 nathanw hpcbattery_ac_state sc_ac_status;
70 1.1.4.2 nathanw hpcbattery_batt_state sc_batt_status;
71 1.1.4.2 nathanw int sc_rate;
72 1.1.4.2 nathanw int sc_minuits;
73 1.1.4.2 nathanw int sc_v;
74 1.1.4.2 nathanw int sc_v_h;
75 1.1.4.2 nathanw int sc_v_l;
76 1.1.4.2 nathanw /* last status change values */
77 1.1.4.2 nathanw hpcbattery_ac_state sc_ac_status0;
78 1.1.4.2 nathanw hpcbattery_batt_state sc_batt_status0;
79 1.1.4.2 nathanw int sc_rate0;
80 1.1.4.2 nathanw int sc_minuits0;
81 1.1.4.2 nathanw int sc_v0;
82 1.1.4.2 nathanw int sc_v0_h;
83 1.1.4.2 nathanw int sc_v0_l;
84 1.1.4.2 nathanw };
85 1.1.4.2 nathanw #endif /* notdef */
86 1.1.4.2 nathanw
87 1.1.4.2 nathanw struct hpcbattery_spec {
88 1.1.4.2 nathanw int guess_charge;
89 1.1.4.2 nathanw int guess_ac_dc;
90 1.1.4.2 nathanw int main_port; /* index of main battery port, -1 then ignore */
91 1.1.4.2 nathanw int drift; /* value drifts */
92 1.1.4.2 nathanw int ac_bias; /* DC->AC, AC->DC BIAS */
93 1.1.4.2 nathanw int dc_100p; /* DC: full value (100%) */
94 1.1.4.2 nathanw int dc_80p; /* DC: almost full value (80%) */
95 1.1.4.2 nathanw int dc_50p; /* DC: half value (50%) */
96 1.1.4.2 nathanw int dc_20p; /* DC: battery low value (20%) */
97 1.1.4.2 nathanw int dc_critical; /* DC: battery critical value (0%) */
98 1.1.4.2 nathanw int ac_charge_100p; /* AC: charge finished value */
99 1.1.4.2 nathanw int ac_100p; /* AC: full value (100%) */
100 1.1.4.2 nathanw int ac_80p; /* AC: almost full value (80%) */
101 1.1.4.2 nathanw int ac_50p; /* AC: half value (50%) */
102 1.1.4.2 nathanw int ac_20p; /* AC: battery low value (20%) */
103 1.1.4.2 nathanw int ac_critical; /* AC: battery critical value */
104 1.1.4.2 nathanw int main_flag; /* main battery value positive, negative flag. 1 or -1 */
105 1.1.4.2 nathanw int backup_port; /* index of backup battery port, -1 then ignore */
106 1.1.4.2 nathanw int b_full; /* backup battery full */
107 1.1.4.2 nathanw int b_low; /* backup battery low */
108 1.1.4.2 nathanw int b_critical; /* backup battery hight */
109 1.1.4.2 nathanw int b_flag; /* main battery value positive, negative flag. 1 or -1 */
110 1.1.4.2 nathanw int nocharge_port; /* nocharge/(charge or dc) z50, -1 then ignore*/
111 1.1.4.2 nathanw int n_low; /* if n_flag*value < n_flag*n_low, now nocharging... */
112 1.1.4.2 nathanw int n_flag; /* -1 or 1 */
113 1.1.4.2 nathanw int dc_ac_port; /* index of ac/dc port ,-1 then ignore */
114 1.1.4.2 nathanw int da_low; /* if da_flag*value < da_flag*da_low then dc else ac */
115 1.1.4.2 nathanw int da_flag; /* -1 or 1 */
116 1.1.4.2 nathanw int charge_port; /* charge/(no charge or dc) ,-1 then ignore */
117 1.1.4.2 nathanw int c_low; /* if da_flag*value < da_flag*da_low then dc else ac */
118 1.1.4.2 nathanw int c_flag; /* -1 or 1 */
119 1.1.4.2 nathanw };
120 1.1.4.2 nathanw #endif /* _HPCBATTERY_VAR_H */
121 1.1.4.2 nathanw /* end */
122