diff options
author | Frodo Looijaard <frodol@dds.nl> | 1998-12-20 16:54:03 +0000 |
---|---|---|
committer | Frodo Looijaard <frodol@dds.nl> | 1998-12-20 16:54:03 +0000 |
commit | 730efd78ca9dd93911817ba4d5c0ef6f1c8412fb (patch) | |
tree | 71a5e6744d13062e65d51c535b8e97f29be35a34 /lib/data.h | |
parent | b47bfd40c2c5f9fe6f8e32a6c2dc8b25fe6bad30 (diff) | |
download | lm-sensors-git-730efd78ca9dd93911817ba4d5c0ef6f1c8412fb.tar.gz |
More library files
This brings the archive into synch with my harddisk...
Everything in the lib directory should compile without problems (yes, even
without warnings even if WARN=1). It is not well-tested, though, and there
are some minor functions which must still be added. It is now almost
usable.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@95 7894878c-1315-0410-8ee3-d5d059ff63e0
Diffstat (limited to 'lib/data.h')
-rw-r--r-- | lib/data.h | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/lib/data.h b/lib/data.h new file mode 100644 index 00000000..24ff9646 --- /dev/null +++ b/lib/data.h @@ -0,0 +1,121 @@ +/* + 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" + +/* This header file contains all kinds of data structures which are + internally used. */ + +typedef enum sensors_operation { + sensors_add, sensors_sub, sensors_multiply, sensors_divide, + sensors_negate } sensors_operation; + +typedef enum sensors_expr_kind { + sensors_kind_val, sensors_kind_var, sensors_kind_sub } sensors_expr_kind; + +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; +} sensors_label; + +typedef struct sensors_set { + char *name; + sensors_expr *value; +} sensors_set; + +typedef struct sensors_compute { + char *name; + sensors_expr *from_proc; + sensors_expr *to_proc; +} 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; +} 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; +} sensors_bus; + +typedef struct sensors_proc_chips_entry { + int sysctl; + sensors_chip_name name; +} sensors_proc_chips_entry; + +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; + +/* 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); + +extern int sensors_eval_expr(sensors_expr *expr, double val, double *result); + + +#endif /* def LIB_SENSORS_DATA_H */ |