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
|
#ifndef OPENPSU_EXT_CONTROL_H_
#define OPENPSU_EXT_CONTROL_H_
#ifdef IN_FIRMWARE
#include "util.h"
void extctl_init(void);
#endif /* IN_FIRMWARE */
/* Public external control API. */
struct extctl_command {
/* The command ID number. */
uint8_t id;
/* The command payload data. */
le32_t data;
/* Checksum for this command packet. */
uint8_t checksum;
} __attribute__((__packed__));
struct extctl_reply {
/* The reply payload data. */
le32_t data;
/* Checksum for this reply packet. */
uint8_t checksum;
} __attribute__((__packed__));
enum {
EXTCTL_CMD_NOP = 0, /* No operation */
EXTCTL_CMD_SETVOLTAGE, /* Set the Voltage in a profile */
EXTCTL_CMD_GETVOLTAGE, /* Get the Voltage of a profile */
EXTCTL_CMD_SETMAXCUR, /* Set the Current limit in a profile */
EXTCTL_CMD_GETMAXCUR, /* Get the Current limit of a profile */
EXTCTL_CMD_SWITCHPROF, /* Switch the profile */
EXTCTL_CMD_GETPROF, /* Get the active profile */
};
enum {
EXTCTL_CMD_RESULT_OK = 0,
EXTCTL_CMD_RESULT_ENOTIMPL, /* Command not implemented */
EXTCTL_CMD_RESULT_ENOBUFS, /* No buffer space available */
EXTCTL_CMD_RESULT_EBUSY, /* Busy */
EXTCTL_CMD_RESULT_ENOTAVAIL, /* Service not available */
EXTCTL_CMD_RESULT_EINVAL, /* Invalid value */
EXTCTL_CMD_RESULT_ECSUM, /* Checksum error */
};
#endif /* OPENPSU_EXT_CONTROL_H_ */
|