blob: b572ad369162154a44e76059f20f24a4d59d94b5 (
plain)
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
|
#ifndef OPENPSU_MAIN_H_
#define OPENPSU_MAIN_H_
#include <stdint.h>
/* 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_ */
|