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