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