2
2
* powercom.h - defines for the newpowercom.c driver
4
* Read docs/powercom.txt for other models and manufactures
6
* $Id: - will be filled in on next CVS add/update $
4
* $Id: powercom.h,v 1.2 2005/02/28 09:14:07 aquette Exp $
9
7
* (C) 2002 Simon Rozman <simon@rozman.net>
10
* Added support for Egys
12
* (C) 2001 Peter Bieringer <pb@bieringer.de>
13
* Porting old style "powercom" to new style "newpowercom", cleanup header file
15
* (C) 2000 Shaul Karl <shaulk@israsrv.net.il>
16
* Creating old style "powercom"
18
* ups-trust425+625.c - model specific routines for Trust UPS 425/625
19
* Copyright (C) 1999 Peter Bieringer <pb@bieringer.de>
8
* (C) 1999 Peter Bieringer <pb@bieringer.de>
21
10
* This program is free software; you can redistribute it and/or modify
22
11
* it under the terms of the GNU General Public License as published by
32
21
* along with this program; if not, write to the Free Software
33
22
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
36
* 20011208/PB: add support for subtypes
37
* 20020629/SR: add support for calc. parameters
38
* 20020701/SK: subtypes as structures
39
* 20030506/SK: replaced the previous validation method with
40
* validation_byte[] and replaced subtype by type.
43
26
/* C-libary includes */
52
35
#include "timehead.h"
53
#include "shared-tables.h"
55
37
/* general constants */
57
SEC_FOR_POWERKILL = 10U,
58
MAX_NUM_OF_BYTES_FROM_UPS = 16U,
39
MAX_NUM_OF_BYTES_FROM_UPS = 16
61
42
/* values for sending to UPS */
63
44
SEND_DATA = '\x01',
64
45
BATTERY_TEST = '\x03',
68
49
/* location of data in received string */
92
73
/* supported types */
95
76
unsigned char num_of_bytes_from_ups;
96
void (*setup_flow_control)(void);
78
struct method_of_flow_control {
80
void (*setup_flow_control)(void);
98
83
struct validation_byte {
99
unsigned char index_of_byte, required_value;
84
unsigned int index_of_byte, required_value;
100
85
/* An example might explain the intention better then prose.
101
86
* Suppose we want to validate the data with:
102
87
* powercom_raw_data[5] == 0x80
103
* then we will set index_of_byte to 5 and required_value to
88
* then we will set index_of_byte to 5U and required_value to
89
* 0x80U: { 5U, 0x80U }.
107
92
/* The validation array is of length 3 because 3 is longest
108
93
* validation sequence for any type.
111
/* parameters to calculate input and output freq., one pair for each
96
/* Some UPSs must have a minutes and a seconds arguments for
97
* the SHUTDOWN commands while others are known to work with the
98
* seconds argument alone.
100
struct deley_for_power_kill {
101
unsigned int delay[2]; /* { minutes, seconds } */
102
unsigned char minutesShouldBeUsed;
103
/* 'n' in case the minutes value, which is deley[0], should
104
* be skipped and not sent to the UPS.
106
} shutdown_arguments;
108
/* parameters to calculate input and output freq., one pair for
113
110
* Each pair defines parameters for 1/(A*x+B) to calculate freq.