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