#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_ */