#ifndef OPENPSU_MAIN_H_ #define OPENPSU_MAIN_H_ #include /* The number of selectable profiles. */ #define NR_PROFILES 16 uint16_t get_voltage_from_prof(uint8_t profile); void set_voltage_in_prof(uint8_t profile, uint16_t voltage); uint16_t get_maxcur_from_prof(uint8_t profile); void set_maxcur_in_prof(uint8_t profile, uint16_t maxcur); uint8_t get_active_profile(void); void switch_to_profile(uint8_t profile); void emergency_shutdown(void); /* Jiffies timing helpers derived from the Linux Kernel sources. * These inlines deal with timer wrapping correctly. * * time_after(a, b) returns true if the time a is after time b. * * Do this with "<0" and ">=0" to only test the sign of the result. A * good compiler would generate better code (and a really good compiler * wouldn't care). Gcc is currently neither. */ #define time_after(a, b) ((int8_t)(b) - (int8_t)(a) < 0) #define time_before(a, b) time_after(b, a) #endif /* OPENPSU_MAIN_H_ */