1 #ifndef POWER_MANAGMENT_H 2 #define POWER_MANAGMENT_H 3 4 #include <Drivers.h> 5 6 // io controls 7 enum { 8 // ioctl response with kMagicFreqID 9 IDENTIFY_DEVICE = B_DEVICE_OP_CODES_END + 20001, 10 11 // CPU Frequence: 12 // get a list of freq_info, the list is terminated with a element with 13 // frequency = 0 14 GET_CPU_FREQ_STATES = B_DEVICE_OP_CODES_END + 20005, 15 // get and set a freq_info 16 GET_CURENT_CPU_FREQ_STATE, 17 SET_CPU_FREQ_STATE, 18 // start watching for frequency changes, ioctl blocks until the frequency 19 // has changed 20 WATCH_CPU_FREQ, 21 // stop all watching ioctl, ioctl return B_ERROR 22 STOP_WATCHING_CPU_FREQ, 23 24 GET_BATTERY_INFO, 25 GET_EXTENDED_BATTERY_INFO, 26 WATCH_BATTERY, 27 STOP_WATCHING_BATTERY 28 29 }; 30 31 // CPU Frequence: 32 // magic id returned by IDENTIFY_DEVICE 33 const uint32 kMagicFreqID = 48921; 34 35 36 #define MAX_CPU_FREQUENCY_STATES 10 37 38 typedef struct { 39 uint16 frequency; // [Mhz] 40 uint16 volts; 41 uint16 id; 42 int power; 43 } freq_info; 44 45 46 // ACPI Battery: 47 // magic id returned by IDENTIFY_DEVICE 48 const uint32 kMagicACPIBatteryID = 17822; 49 50 #define BATTERY_DISCHARGING 0x01 51 #define BATTERY_CHARGING 0x02 52 #define BATTERY_CRITICAL_STATE 0x04 53 54 55 typedef struct { 56 int state; 57 int current_rate; 58 int capacity; 59 int voltage; 60 } acpi_battery_info; 61 62 63 typedef struct { 64 int power_unit; 65 int design_capacity; 66 int last_full_charge; 67 int technology; 68 int design_voltage; 69 int design_capacity_warning; 70 int design_capacity_low; 71 int capacity_granularity_1; 72 int capacity_granularity_2; 73 char model_number[32]; 74 char serial_number[32]; 75 char type[32]; 76 char oem_info[32]; 77 } acpi_extended_battery_info; 78 79 80 #endif 81