1998-12-20 16:54:03 +00:00
|
|
|
/*
|
|
|
|
data.h - Part of libsensors, a Linux library for reading sensor data.
|
|
|
|
Copyright (c) 1998 Frodo Looijaard <frodol@dds.nl>
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef LIB_SENSORS_DATA_H
|
|
|
|
#define LIB_SENSORS_DATA_H
|
|
|
|
|
|
|
|
#include "sensors.h"
|
|
|
|
|
1998-12-20 21:57:39 +00:00
|
|
|
/* This header file contains all kinds of data structures which are used
|
1998-12-21 16:49:11 +00:00
|
|
|
for the representation of the config file data and the /proc/...
|
1998-12-20 21:57:39 +00:00
|
|
|
data. */
|
1998-12-20 16:54:03 +00:00
|
|
|
|
|
|
|
typedef enum sensors_operation {
|
|
|
|
sensors_add, sensors_sub, sensors_multiply, sensors_divide,
|
|
|
|
sensors_negate } sensors_operation;
|
|
|
|
|
|
|
|
typedef enum sensors_expr_kind {
|
1998-12-24 01:13:44 +00:00
|
|
|
sensors_kind_val, sensors_kind_source, sensors_kind_var,
|
|
|
|
sensors_kind_sub } sensors_expr_kind;
|
1998-12-20 16:54:03 +00:00
|
|
|
|
|
|
|
struct sensors_expr;
|
|
|
|
|
|
|
|
typedef struct sensors_subexpr {
|
|
|
|
sensors_operation op;
|
|
|
|
struct sensors_expr *sub1;
|
|
|
|
struct sensors_expr *sub2;
|
|
|
|
} sensors_subexpr;
|
|
|
|
|
|
|
|
typedef struct sensors_expr {
|
|
|
|
sensors_expr_kind kind;
|
|
|
|
union {
|
|
|
|
double val;
|
|
|
|
char *var;
|
|
|
|
sensors_subexpr subexpr;
|
|
|
|
} data;
|
|
|
|
} sensors_expr;
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct sensors_label {
|
|
|
|
char *name;
|
|
|
|
char *value;
|
1998-12-21 14:14:25 +00:00
|
|
|
int lineno;
|
1998-12-20 16:54:03 +00:00
|
|
|
} sensors_label;
|
|
|
|
|
|
|
|
typedef struct sensors_set {
|
|
|
|
char *name;
|
|
|
|
sensors_expr *value;
|
1998-12-21 14:14:25 +00:00
|
|
|
int lineno;
|
1998-12-20 16:54:03 +00:00
|
|
|
} sensors_set;
|
|
|
|
|
|
|
|
typedef struct sensors_compute {
|
|
|
|
char *name;
|
|
|
|
sensors_expr *from_proc;
|
|
|
|
sensors_expr *to_proc;
|
1998-12-21 14:14:25 +00:00
|
|
|
int lineno;
|
1998-12-20 16:54:03 +00:00
|
|
|
} sensors_compute;
|
|
|
|
|
|
|
|
typedef struct sensors_chip_name_list {
|
|
|
|
sensors_chip_name *fits;
|
|
|
|
int fits_count;
|
|
|
|
int fits_max;
|
|
|
|
} sensors_chip_name_list;
|
|
|
|
|
|
|
|
typedef struct sensors_chip {
|
|
|
|
sensors_chip_name_list chips;
|
|
|
|
sensors_label *labels;
|
|
|
|
int labels_count;
|
|
|
|
int labels_max;
|
|
|
|
sensors_set *sets;
|
|
|
|
int sets_count;
|
|
|
|
int sets_max;
|
|
|
|
sensors_compute *computes;
|
|
|
|
int computes_count;
|
|
|
|
int computes_max;
|
1998-12-21 14:14:25 +00:00
|
|
|
int lineno;
|
1998-12-20 16:54:03 +00:00
|
|
|
} sensors_chip;
|
|
|
|
|
|
|
|
typedef enum sensors_bus_type {sensors_i2c, sensors_isa,
|
|
|
|
sensors_smbus } sensors_bus_type;
|
|
|
|
|
|
|
|
typedef struct sensors_bus {
|
|
|
|
int number;
|
|
|
|
char *adapter;
|
|
|
|
char *algorithm;
|
1998-12-21 14:14:25 +00:00
|
|
|
int lineno;
|
1998-12-20 16:54:03 +00:00
|
|
|
} sensors_bus;
|
|
|
|
|
|
|
|
typedef struct sensors_proc_chips_entry {
|
|
|
|
int sysctl;
|
|
|
|
sensors_chip_name name;
|
|
|
|
} sensors_proc_chips_entry;
|
|
|
|
|
1998-12-21 14:14:25 +00:00
|
|
|
|
1998-12-20 16:54:03 +00:00
|
|
|
extern sensors_chip *sensors_config_chips;
|
|
|
|
extern int sensors_config_chips_count;
|
|
|
|
extern int sensors_config_chips_max;
|
|
|
|
|
|
|
|
extern sensors_bus *sensors_config_busses;
|
|
|
|
extern int sensors_config_busses_count;
|
|
|
|
extern int sensors_config_busses_max;
|
|
|
|
|
|
|
|
extern sensors_proc_chips_entry *sensors_proc_chips;
|
|
|
|
extern int sensors_proc_chips_count;
|
|
|
|
extern int sensors_proc_chips_max;
|
|
|
|
|
1998-12-21 14:14:25 +00:00
|
|
|
extern sensors_bus *sensors_proc_bus;
|
|
|
|
extern int sensors_proc_bus_count;
|
|
|
|
extern int sensors_proc_bus_max;
|
|
|
|
|
1998-12-20 16:54:03 +00:00
|
|
|
/* Parse an i2c bus name into its components. Returns 0 on succes, a value from
|
|
|
|
error.h on failure. */
|
|
|
|
extern int sensors_parse_i2cbus_name(const char *name, int *res);
|
|
|
|
|
1998-12-24 01:13:44 +00:00
|
|
|
extern int sensors_eval_expr(sensors_chip_name chipname, sensors_expr *expr,
|
|
|
|
double val, double *result);
|
1998-12-20 16:54:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
#endif /* def LIB_SENSORS_DATA_H */
|