| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
#ifndef LIB_SENSORS_DATA_H |
|---|
| 22 |
#define LIB_SENSORS_DATA_H |
|---|
| 23 |
|
|---|
| 24 |
#include "sensors.h" |
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
typedef enum sensors_operation { |
|---|
| 32 |
sensors_add, sensors_sub, sensors_multiply, sensors_divide, |
|---|
| 33 |
sensors_negate, sensors_exp, sensors_log, |
|---|
| 34 |
} sensors_operation; |
|---|
| 35 |
|
|---|
| 36 |
|
|---|
| 37 |
typedef enum sensors_expr_kind { |
|---|
| 38 |
sensors_kind_val, sensors_kind_source, sensors_kind_var, |
|---|
| 39 |
sensors_kind_sub |
|---|
| 40 |
} sensors_expr_kind; |
|---|
| 41 |
|
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 |
struct sensors_expr; |
|---|
| 45 |
|
|---|
| 46 |
typedef struct sensors_subexpr { |
|---|
| 47 |
sensors_operation op; |
|---|
| 48 |
struct sensors_expr *sub1; |
|---|
| 49 |
struct sensors_expr *sub2; |
|---|
| 50 |
} sensors_subexpr; |
|---|
| 51 |
|
|---|
| 52 |
typedef struct sensors_expr { |
|---|
| 53 |
sensors_expr_kind kind; |
|---|
| 54 |
union { |
|---|
| 55 |
double val; |
|---|
| 56 |
char *var; |
|---|
| 57 |
sensors_subexpr subexpr; |
|---|
| 58 |
} data; |
|---|
| 59 |
} sensors_expr; |
|---|
| 60 |
|
|---|
| 61 |
|
|---|
| 62 |
|
|---|
| 63 |
typedef struct sensors_label { |
|---|
| 64 |
char *name; |
|---|
| 65 |
char *value; |
|---|
| 66 |
int lineno; |
|---|
| 67 |
} sensors_label; |
|---|
| 68 |
|
|---|
| 69 |
|
|---|
| 70 |
|
|---|
| 71 |
typedef struct sensors_set { |
|---|
| 72 |
char *name; |
|---|
| 73 |
sensors_expr *value; |
|---|
| 74 |
int lineno; |
|---|
| 75 |
} sensors_set; |
|---|
| 76 |
|
|---|
| 77 |
|
|---|
| 78 |
|
|---|
| 79 |
typedef struct sensors_compute { |
|---|
| 80 |
char *name; |
|---|
| 81 |
sensors_expr *from_proc; |
|---|
| 82 |
sensors_expr *to_proc; |
|---|
| 83 |
int lineno; |
|---|
| 84 |
} sensors_compute; |
|---|
| 85 |
|
|---|
| 86 |
|
|---|
| 87 |
typedef struct sensors_ignore { |
|---|
| 88 |
char *name; |
|---|
| 89 |
int lineno; |
|---|
| 90 |
} sensors_ignore; |
|---|
| 91 |
|
|---|
| 92 |
|
|---|
| 93 |
typedef struct sensors_chip_name_list { |
|---|
| 94 |
sensors_chip_name *fits; |
|---|
| 95 |
int fits_count; |
|---|
| 96 |
int fits_max; |
|---|
| 97 |
} sensors_chip_name_list; |
|---|
| 98 |
|
|---|
| 99 |
|
|---|
| 100 |
typedef struct sensors_chip { |
|---|
| 101 |
sensors_chip_name_list chips; |
|---|
| 102 |
sensors_label *labels; |
|---|
| 103 |
int labels_count; |
|---|
| 104 |
int labels_max; |
|---|
| 105 |
sensors_set *sets; |
|---|
| 106 |
int sets_count; |
|---|
| 107 |
int sets_max; |
|---|
| 108 |
sensors_compute *computes; |
|---|
| 109 |
int computes_count; |
|---|
| 110 |
int computes_max; |
|---|
| 111 |
sensors_ignore *ignores; |
|---|
| 112 |
int ignores_count; |
|---|
| 113 |
int ignores_max; |
|---|
| 114 |
int lineno; |
|---|
| 115 |
} sensors_chip; |
|---|
| 116 |
|
|---|
| 117 |
|
|---|
| 118 |
|
|---|
| 119 |
typedef struct sensors_bus { |
|---|
| 120 |
char *adapter; |
|---|
| 121 |
sensors_bus_id bus; |
|---|
| 122 |
int lineno; |
|---|
| 123 |
} sensors_bus; |
|---|
| 124 |
|
|---|
| 125 |
|
|---|
| 126 |
typedef struct sensors_chip_features { |
|---|
| 127 |
struct sensors_chip_name chip; |
|---|
| 128 |
struct sensors_feature *feature; |
|---|
| 129 |
struct sensors_subfeature *subfeature; |
|---|
| 130 |
int feature_count; |
|---|
| 131 |
int subfeature_count; |
|---|
| 132 |
} sensors_chip_features; |
|---|
| 133 |
|
|---|
| 134 |
extern sensors_chip *sensors_config_chips; |
|---|
| 135 |
extern int sensors_config_chips_count; |
|---|
| 136 |
extern int sensors_config_chips_max; |
|---|
| 137 |
|
|---|
| 138 |
extern sensors_bus *sensors_config_busses; |
|---|
| 139 |
extern int sensors_config_busses_count; |
|---|
| 140 |
extern int sensors_config_busses_max; |
|---|
| 141 |
|
|---|
| 142 |
extern sensors_chip_features *sensors_proc_chips; |
|---|
| 143 |
extern int sensors_proc_chips_count; |
|---|
| 144 |
extern int sensors_proc_chips_max; |
|---|
| 145 |
|
|---|
| 146 |
#define sensors_add_proc_chips(el) sensors_add_array_el( \ |
|---|
| 147 |
(el), &sensors_proc_chips, &sensors_proc_chips_count,\ |
|---|
| 148 |
&sensors_proc_chips_max, sizeof(struct sensors_chip_features)) |
|---|
| 149 |
|
|---|
| 150 |
extern sensors_bus *sensors_proc_bus; |
|---|
| 151 |
extern int sensors_proc_bus_count; |
|---|
| 152 |
extern int sensors_proc_bus_max; |
|---|
| 153 |
|
|---|
| 154 |
#define sensors_add_proc_bus(el) sensors_add_array_el( \ |
|---|
| 155 |
(el), &sensors_proc_bus, &sensors_proc_bus_count,\ |
|---|
| 156 |
&sensors_proc_bus_max, sizeof(struct sensors_bus)) |
|---|
| 157 |
|
|---|
| 158 |
|
|---|
| 159 |
|
|---|
| 160 |
int sensors_substitute_busses(void); |
|---|
| 161 |
|
|---|
| 162 |
|
|---|
| 163 |
|
|---|
| 164 |
|
|---|
| 165 |
int sensors_parse_bus_id(const char *name, sensors_bus_id *bus); |
|---|
| 166 |
|
|---|
| 167 |
#endif |
|---|