1 /* 2 * PROJECT: ReactOS Composite Battery Driver 3 * LICENSE: BSD - See COPYING.ARM in the top level directory 4 * FILE: boot/drivers/bus/acpi/compbatt/compbatt.h 5 * PURPOSE: Main Header File 6 * PROGRAMMERS: ReactOS Portable Systems Group 7 */ 8 9 #ifndef _COMPBATT_PCH_ 10 #define _COMPBATT_PCH_ 11 12 #include <wdm.h> 13 #include <batclass.h> 14 15 #define COMPBATT_BATTERY_INFORMATION_PRESENT 0x04 16 #define COMPBATT_TAG_ASSIGNED 0x80 17 18 typedef struct _COMPBATT_BATTERY_DATA 19 { 20 LIST_ENTRY BatteryLink; 21 IO_REMOVE_LOCK RemoveLock; 22 PDEVICE_OBJECT DeviceObject; 23 PIRP Irp; 24 WORK_QUEUE_ITEM WorkItem; 25 BOOLEAN WaitFlag; 26 BATTERY_WAIT_STATUS WaitStatus; 27 union 28 { 29 BATTERY_WAIT_STATUS WorkerWaitStatus; 30 BATTERY_STATUS WorkerStatus; 31 }; 32 ULONG Tag; 33 ULONG Flags; 34 BATTERY_INFORMATION BatteryInformation; 35 BATTERY_STATUS BatteryStatus; 36 ULONGLONG InterruptTime; 37 UNICODE_STRING BatteryName; 38 } COMPBATT_BATTERY_DATA, *PCOMPBATT_BATTERY_DATA; 39 40 typedef struct _COMPBATT_DEVICE_EXTENSION 41 { 42 PVOID ClassData; 43 ULONG NextTag; 44 LIST_ENTRY BatteryList; 45 FAST_MUTEX Lock; 46 ULONG Tag; 47 ULONG Flags; 48 BATTERY_INFORMATION BatteryInformation; 49 BATTERY_STATUS BatteryStatus; 50 ULONGLONG InterruptTime; 51 POWER_STATE PowerState; 52 ULONG LowCapacity; 53 ULONG HighCapacity; 54 PDEVICE_OBJECT AttachedDevice; 55 PDEVICE_OBJECT DeviceObject; 56 PVOID NotificationEntry; 57 } COMPBATT_DEVICE_EXTENSION, *PCOMPBATT_DEVICE_EXTENSION; 58 59 NTSTATUS 60 NTAPI 61 CompBattAddDevice( 62 IN PDRIVER_OBJECT DriverObject, 63 IN PDEVICE_OBJECT PdoDeviceObject 64 ); 65 66 NTSTATUS 67 NTAPI 68 CompBattPowerDispatch( 69 IN PDEVICE_OBJECT DeviceObject, 70 IN PIRP Irp 71 ); 72 73 NTSTATUS 74 NTAPI 75 CompBattPnpDispatch( 76 IN PDEVICE_OBJECT DeviceObject, 77 IN PIRP Irp 78 ); 79 80 NTSTATUS 81 NTAPI 82 CompBattQueryInformation( 83 IN PCOMPBATT_DEVICE_EXTENSION FdoExtension, 84 IN ULONG Tag, 85 IN BATTERY_QUERY_INFORMATION_LEVEL InfoLevel, 86 IN OPTIONAL LONG AtRate, 87 IN PVOID Buffer, 88 IN ULONG BufferLength, 89 OUT PULONG ReturnedLength 90 ); 91 92 NTSTATUS 93 NTAPI 94 CompBattQueryStatus( 95 IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension, 96 IN ULONG Tag, 97 IN PBATTERY_STATUS BatteryStatus 98 ); 99 100 NTSTATUS 101 NTAPI 102 CompBattSetStatusNotify( 103 IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension, 104 IN ULONG BatteryTag, 105 IN PBATTERY_NOTIFY BatteryNotify 106 ); 107 108 NTSTATUS 109 NTAPI 110 CompBattDisableStatusNotify( 111 IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension 112 ); 113 114 NTSTATUS 115 NTAPI 116 CompBattQueryTag( 117 IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension, 118 OUT PULONG Tag 119 ); 120 121 NTSTATUS 122 NTAPI 123 CompBattMonitorIrpComplete( 124 IN PDEVICE_OBJECT DeviceObject, 125 IN PIRP Irp, 126 IN PKEVENT Event 127 ); 128 129 NTSTATUS 130 NTAPI 131 CompBattMonitorIrpCompleteWorker( 132 IN PCOMPBATT_BATTERY_DATA BatteryData 133 ); 134 135 NTSTATUS 136 NTAPI 137 CompBattGetDeviceObjectPointer( 138 IN PUNICODE_STRING DeviceName, 139 IN ACCESS_MASK DesiredAccess, 140 OUT PFILE_OBJECT *FileObject, 141 OUT PDEVICE_OBJECT *DeviceObject 142 ); 143 144 NTSTATUS 145 NTAPI 146 BatteryIoctl( 147 IN ULONG IoControlCode, 148 IN PDEVICE_OBJECT DeviceObject, 149 IN PVOID InputBuffer, 150 IN ULONG InputBufferLength, 151 IN PVOID OutputBuffer, 152 IN ULONG OutputBufferLength, 153 IN BOOLEAN InternalDeviceIoControl 154 ); 155 156 extern ULONG CompBattDebug; 157 158 #endif /* _COMPBATT_PCH_ */ 159