Home | History | Annotate | Line # | Download | only in hpc
hpcbatteryvar.h revision 1.2
      1 /*	$NetBSD: hpcbatteryvar.h,v 1.2 2005/02/27 00:26:59 perry 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 	struct device sc_device;
     68 	/* current status */
     69 	hpcbattery_ac_state sc_ac_status;
     70 	hpcbattery_batt_state sc_batt_status;
     71 	int sc_rate;
     72 	int sc_minuits;
     73 	int sc_v;
     74 	int sc_v_h;
     75 	int sc_v_l;
     76 	/* last status change values */
     77 	hpcbattery_ac_state sc_ac_status0;
     78 	hpcbattery_batt_state sc_batt_status0;
     79 	int sc_rate0;
     80 	int sc_minuits0;
     81 	int sc_v0;
     82 	int sc_v0_h;
     83 	int sc_v0_l;
     84 };
     85 #endif /* notdef */
     86 
     87 struct hpcbattery_spec {
     88 	int guess_charge;
     89 	int guess_ac_dc;
     90 	int main_port;		/* index of main battery port, -1 then ignore */
     91 	int drift;		/* value drifts */
     92 	int ac_bias;		/* DC->AC, AC->DC BIAS */
     93 	int dc_100p;		/* DC: full value (100%) */
     94 	int dc_80p;		/* DC: almost full value (80%) */
     95 	int dc_50p;		/* DC: half value (50%) */
     96 	int dc_20p;		/* DC: battery low value (20%) */
     97 	int dc_critical;	/* DC: battery critical value (0%) */
     98 	int ac_charge_100p;	/* AC: charge finished value */
     99 	int ac_100p;		/* AC: full value (100%) */
    100 	int ac_80p;		/* AC: almost full value (80%) */
    101 	int ac_50p;		/* AC: half value (50%) */
    102 	int ac_20p;		/* AC: battery low value (20%) */
    103 	int ac_critical;	/* AC: battery critical value */
    104 	int main_flag;		/* main battery value positive, negative flag. 1 or -1 */
    105 	int backup_port;	/* index of backup battery port, -1 then ignore */
    106 	int b_full;		/* backup battery full */
    107 	int b_low;		/* backup battery low */
    108 	int b_critical;		/* backup battery hight */
    109 	int b_flag;		/* main battery value positive, negative flag. 1 or -1 */
    110 	int nocharge_port;	/* nocharge/(charge or dc) z50, -1 then ignore*/
    111 	int n_low;		/* if n_flag*value < n_flag*n_low, now nocharging... */
    112 	int n_flag;		/* -1 or 1 */
    113 	int dc_ac_port;		/* index of ac/dc port ,-1 then ignore */
    114 	int da_low;		/* if da_flag*value < da_flag*da_low then dc else ac */
    115 	int da_flag;		/* -1 or 1 */
    116 	int charge_port;	/* charge/(no charge or dc)  ,-1 then ignore */
    117 	int c_low;		/* if da_flag*value < da_flag*da_low then dc else ac */
    118 	int c_flag;		/* -1 or 1 */
    119 };
    120 #endif /* _HPCBATTERY_VAR_H */
    121 /* end */
    122