forked from taxilof/ipmi-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ipmi-sensor.h
54 lines (45 loc) · 1.16 KB
/
ipmi-sensor.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include "ipmi-sdr.h"
#ifndef IPMI_SENSOR_H_
#define IPMI_SENSOR_H_
#ifdef TARGET_RPI
#define SENSOR_COUNT 4
#elif TARGET_ODROID
#define SENSOR_COUNT 14
#else
#define SENSOR_COUNT 3
#endif
struct sensor {
union {
uint16_t record_id;
struct {
uint8_t record_id_h;
uint8_t record_id_l;
};
};
uint8_t sdr_version;
uint8_t record_type;
uint8_t record_length;
struct sdr_record_full_sensor sdr; /* Full SDR Record */
int (*functionPtr)(char*); /* Function for reading out the physical sensor */
char* path; /* Path to sensor file (onl odroid) */
};
void sensors_init() ;
void sensors_cleanup();
struct sensor* get_sensor(uint8_t sensor_number);
void sensor_update(struct sensor *sensor);
int get_next_sensor(int sensor_number);
/* debug functions */
int read_current();
int read_voltage();
/* generic functions */
int generic_read_loadavg();
int generic_check_for_running_stress();
/* Raspberry pi functions */
int rpi_i2c_init();
int rpi_i2c_read_current(char*);
int rpi_i2c_read_bus_voltage(char*);
int rpi_i2c_read_power(char* );
/* Odroid functions */
int odroid_sensor_read(char*);
int odroid_fan_speed(char*);
#endif /* IPMI_SENSOR_H_ */