ReactOS  0.4.14-dev-49-gfb4591c
cmbatt.h
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS ACPI-Compliant Control Method Battery
3  * LICENSE: BSD - See COPYING.ARM in the top level directory
4  * FILE: boot/drivers/bus/acpi/cmbatt/cmbatt.h
5  * PURPOSE: Main Header File
6  * PROGRAMMERS: ReactOS Portable Systems Group
7  */
8 
9 #ifndef _CMBATT_PCH_
10 #define _CMBATT_PCH_
11 
12 #include <wdm.h>
13 #include <batclass.h>
14 #include <wmilib.h>
15 #include <wdmguid.h>
16 
17 #define IOCTL_BATTERY_QUERY_UNIQUE_ID \
18  CTL_CODE(FILE_DEVICE_BATTERY, 0x101, METHOD_BUFFERED, FILE_READ_ACCESS) // 0x294404
19 
20 #define IOCTL_BATTERY_QUERY_STA \
21  CTL_CODE(FILE_DEVICE_BATTERY, 0x102, METHOD_BUFFERED, FILE_READ_ACCESS) // 0x294408
22 
23 #define IOCTL_BATTERY_QUERY_PSR \
24  CTL_CODE(FILE_DEVICE_BATTERY, 0x103, METHOD_BUFFERED, FILE_READ_ACCESS) // 0x29440C
25 
26 #define IOCTL_BATTERY_SET_TRIP_POINT \
27  CTL_CODE(FILE_DEVICE_BATTERY, 0x104, METHOD_BUFFERED, FILE_READ_ACCESS) // 0x294410
28 
29 #define IOCTL_BATTERY_QUERY_BIF \
30  CTL_CODE(FILE_DEVICE_BATTERY, 0x105, METHOD_BUFFERED, FILE_READ_ACCESS) // 0x294414
31 
32 #define IOCTL_BATTERY_QUERY_BST \
33  CTL_CODE(FILE_DEVICE_BATTERY, 0x106, METHOD_BUFFERED, FILE_READ_ACCESS) // 0x294418
34 
35 #define CMBATT_GENERIC_STATUS 0x01
36 #define CMBATT_GENERIC_INFO 0x02
37 #define CMBATT_GENERIC_WARNING 0x04
38 #define CMBATT_ACPI_WARNING 0x08
39 #define CMBATT_POWER_INFO 0x10
40 #define CMBATT_PNP_INFO 0x20
41 #define CMBATT_ACPI_ENTRY_EXIT 0x40
42 #define CMBATT_PNP_ENTRY_EXIT 0x200
43 #define CMBATT_ACPI_ASSERT 0x400
44 
46 {
50 
51 #define ACPI_BUS_CHECK 0x00
52 #define ACPI_DEVICE_CHECK 0x01
53 
54 #define ACPI_STA_PRESENT 0x01
55 #define ACPI_STA_ENABLED 0x02
56 #define ACPI_STA_SHOW_UI 0x04
57 #define ACPI_STA_FUNCTIONAL 0x08
58 #define ACPI_STA_BATTERY_PRESENT 0x10
59 
60 #define ACPI_BATT_NOTIFY_STATUS 0x80
61 #define ACPI_BATT_NOTIFY_INFO 0x81
62 
63 #define ACPI_BATT_STAT_DISCHARG 0x0001
64 #define ACPI_BATT_STAT_CHARGING 0x0002
65 #define ACPI_BATT_STAT_CRITICAL 0x0004
66 
67 #define CM_MAX_VALUE 0x7FFFFFFF
68 #define CM_UNKNOWN_VALUE 0xFFFFFFFF
69 
70 typedef struct _ACPI_BST_DATA
71 {
77 
78 #define ACPI_BATT_POWER_UNIT_WATTS 0x0
79 #define ACPI_BATT_POWER_UNIT_AMPS 0x1
80 
81 typedef struct _ACPI_BIF_DATA
82 {
95  CHAR OemInfo[256];
97 
98 #define CMBATT_AR_NOTIFY 0x01
99 #define CMBATT_AR_INSERT 0x02
100 #define CMBATT_AR_REMOVE 0x04
101 
103 {
148 
149 NTSTATUS
150 NTAPI
153  PIRP Irp
154 );
155 
156 NTSTATUS
157 NTAPI
160  PIRP Irp
161 );
162 
163 NTSTATUS
164 NTAPI
168 );
169 
170 NTSTATUS
171 NTAPI
174  PIRP Irp
175 );
176 
177 NTSTATUS
178 NTAPI
180  PCMBATT_DEVICE_EXTENSION DeviceExtension,
181  PACPI_BST_DATA BstData
182 );
183 
184 NTSTATUS
185 NTAPI
188  PULONG PsrData
189 );
190 
191 NTSTATUS
192 NTAPI
195  PULONG StaData
196 );
197 
198 NTSTATUS
199 NTAPI
201  PCMBATT_DEVICE_EXTENSION DeviceExtension,
202  PACPI_BIF_DATA BifData
203 );
204 
205 NTSTATUS
206 NTAPI
208  PCMBATT_DEVICE_EXTENSION DeviceExtension,
209  ULONG AlarmValue
210 );
211 
212 VOID
213 NTAPI
215  IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
216  IN ULONG NotifyValue
217 );
218 
219 NTSTATUS
220 NTAPI
222  PCMBATT_DEVICE_EXTENSION DeviceExtension
223 );
224 
225 NTSTATUS
226 NTAPI
228  PCMBATT_DEVICE_EXTENSION DeviceExtension
229 );
230 
231 NTSTATUS
232 NTAPI
235  PULONG UniqueId
236 );
237 
238 NTSTATUS
239 NTAPI
242  IN ULONG Tag,
245  IN PVOID Buffer,
248 );
249 
250 NTSTATUS
251 NTAPI
253  IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
254  IN ULONG Tag,
256 );
257 
258 NTSTATUS
259 NTAPI
261  IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
264 );
265 
266 NTSTATUS
267 NTAPI
269  IN PCMBATT_DEVICE_EXTENSION DeviceExtension
270 );
271 
272 NTSTATUS
273 NTAPI
275  IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
276  OUT PULONG Tag
277 );
278 
280 extern ULONG CmBattDebug;
281 
282 #endif /* _CMBATT_PCH_ */
signed char * PCHAR
Definition: retypes.h:7
IO_REMOVE_LOCK RemoveLock
Definition: cmbatt.h:115
ULONG RemainingCapacity
Definition: cmbatt.h:74
#define IN
Definition: typedefs.h:38
ACPI_BST_DATA BstData
Definition: cmbatt.h:133
ULONG BatteryCapacityGranularity2
Definition: cmbatt.h:142
NTSTATUS NTAPI CmBattGetBstData(PCMBATT_DEVICE_EXTENSION DeviceExtension, PACPI_BST_DATA BstData)
Definition: cmexec.c:334
_In_ ULONG _Out_ PBATTERY_STATUS BatteryStatus
Definition: batclass.h:198
BOOLEAN DelayNotification
Definition: cmbatt.h:119
_In_ PIRP Irp
Definition: csq.h:116
WMILIB_CONTEXT WmiLibInfo
Definition: cmbatt.h:113
PDEVICE_OBJECT DeviceObject
Definition: cmbatt.h:105
enum _BATTERY_QUERY_INFORMATION_LEVEL BATTERY_QUERY_INFORMATION_LEVEL
char CHAR
Definition: xmlstorage.h:175
LONG NTSTATUS
Definition: precomp.h:26
_In_ ULONG _In_ PBATTERY_NOTIFY BatteryNotify
Definition: batclass.h:215
ULONG DesignCapacityLow
Definition: cmbatt.h:89
NTSTATUS NTAPI CmBattSystemControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
_CMBATT_EXTENSION_TYPE
Definition: cmbatt.h:45
ULONG PresentRate
Definition: cmbatt.h:73
_Out_ PULONG BatteryTag
Definition: batclass.h:173
NTSTATUS NTAPI CmBattSetStatusNotify(IN PCMBATT_DEVICE_EXTENSION DeviceExtension, IN ULONG BatteryTag, IN PBATTERY_NOTIFY BatteryNotify)
Definition: cmbatt.c:636
CHAR OemInfo[256]
Definition: cmbatt.h:95
NTSTATUS NTAPI CmBattQueryStatus(IN PCMBATT_DEVICE_EXTENSION DeviceExtension, IN ULONG Tag, IN PBATTERY_STATUS BatteryStatus)
Definition: cmbatt.c:1213
NTSTATUS NTAPI CmBattPnpDispatch(PDEVICE_OBJECT DeviceObject, PIRP Irp)
NTSTATUS NTAPI CmBattPowerDispatch(PDEVICE_OBJECT DeviceObject, PIRP Irp)
BATTERY_INFORMATION BatteryInformation
Definition: cmbatt.h:140
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
CHAR ModelNumber[256]
Definition: cmbatt.h:92
long LONG
Definition: pedump.c:60
_In_ ULONG BufferLength
Definition: usbdlib.h:225
struct _ACPI_BIF_DATA ACPI_BIF_DATA
struct _ACPI_BIF_DATA * PACPI_BIF_DATA
FAST_MUTEX FastMutex
Definition: cmbatt.h:109
ULONG CmBattDebug
Definition: cmbatt.c:17
unsigned char BOOLEAN
NTSTATUS NTAPI CmBattDisableStatusNotify(IN PCMBATT_DEVICE_EXTENSION DeviceExtension)
Definition: cmbatt.c:595
ULONG State
Definition: cmbatt.h:72
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
NTSTATUS NTAPI CmBattWmiDeRegistration(PCMBATT_DEVICE_EXTENSION DeviceExtension)
Definition: bufpool.h:45
struct _CMBATT_DEVICE_EXTENSION CMBATT_DEVICE_EXTENSION
CHAR BatteryType[256]
Definition: cmbatt.h:94
NTSTATUS NTAPI CmBattWmiRegistration(PCMBATT_DEVICE_EXTENSION DeviceExtension)
FAST_MUTEX
Definition: extypes.h:17
ULONG BatteryCapacityGranularity2
Definition: cmbatt.h:91
NTSTATUS NTAPI CmBattGetStaData(PDEVICE_OBJECT DeviceObject, PULONG StaData)
ULONG PresentVoltage
Definition: cmbatt.h:75
uint64_t ULONGLONG
Definition: typedefs.h:65
NTSTATUS NTAPI CmBattGetPsrData(PDEVICE_OBJECT DeviceObject, PULONG PsrData)
ULONG DesignCapacity
Definition: cmbatt.h:84
PDEVICE_OBJECT AcAdapterPdo
Definition: cmbatt.c:23
_In_ ULONG _In_ BATTERY_QUERY_INFORMATION_LEVEL _In_ LONG AtRate
Definition: batclass.h:183
struct _ACPI_BST_DATA * PACPI_BST_DATA
NTSTATUS NTAPI CmBattSetTripPpoint(PCMBATT_DEVICE_EXTENSION DeviceExtension, ULONG AlarmValue)
ACPI_BIF_DATA BifData
Definition: cmbatt.h:134
struct _CMBATT_DEVICE_EXTENSION * PCMBATT_DEVICE_EXTENSION
NTSTATUS NTAPI CmBattAddDevice(PDRIVER_OBJECT DriverObject, PDEVICE_OBJECT DeviceObject)
NTSTATUS NTAPI CmBattGetUniqueId(PDEVICE_OBJECT DeviceObject, PULONG UniqueId)
_In_ ULONG _In_ BATTERY_QUERY_INFORMATION_LEVEL _In_ LONG _In_ ULONG _Out_ PULONG ReturnedLength
Definition: batclass.h:187
ACPI_INTERFACE_STANDARD AcpiInterface
Definition: cmbatt.h:118
PDEVICE_OBJECT PdoDeviceObject
Definition: cmbatt.h:107
POWER_STATE PowerState
Definition: cmbatt.h:112
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
NTSTATUS NTAPI CmBattGetBifData(PCMBATT_DEVICE_EXTENSION DeviceExtension, PACPI_BIF_DATA BifData)
Definition: cmexec.c:325
CHAR SerialNumber[256]
Definition: cmbatt.h:93
ULONG BatteryCapacityGranularity1
Definition: cmbatt.h:90
VOID NTAPI CmBattNotifyHandler(IN PCMBATT_DEVICE_EXTENSION DeviceExtension, IN ULONG NotifyValue)
Definition: cmbatt.c:142
CMBATT_EXTENSION_TYPE FdoType
Definition: cmbatt.h:104
ULONG DesignCapacityWarning
Definition: cmbatt.h:88
PUNICODE_STRING DeviceName
Definition: cmbatt.h:117
struct _ACPI_BST_DATA ACPI_BST_DATA
PDEVICE_OBJECT AttachedDevice
Definition: cmbatt.h:108
unsigned int * PULONG
Definition: retypes.h:1
NTSTATUS NTAPI CmBattQueryTag(IN PCMBATT_DEVICE_EXTENSION DeviceExtension, OUT PULONG Tag)
Definition: cmbatt.c:536
ULONG BatteryCapacityGranularity1
Definition: cmbatt.h:141
NTSTATUS NTAPI CmBattQueryInformation(IN PCMBATT_DEVICE_EXTENSION FdoExtension, IN ULONG Tag, IN BATTERY_QUERY_INFORMATION_LEVEL InfoLevel, IN OPTIONAL LONG AtRate, IN PVOID Buffer, IN ULONG BufferLength, OUT PULONG ReturnedLength)
Definition: cmbatt.c:1000
IN ULONG IN ULONG Tag
Definition: evtlib.h:159
ULONG LastFullCapacity
Definition: cmbatt.h:85
#define OUT
Definition: typedefs.h:39
unsigned int ULONG
Definition: retypes.h:1
ULONGLONG InterruptTime
Definition: cmbatt.h:146
PDEVICE_OBJECT FdoDeviceObject
Definition: cmbatt.h:106
ULONG PowerUnit
Definition: cmbatt.h:83
enum _CMBATT_EXTENSION_TYPE CMBATT_EXTENSION_TYPE
ULONG DesignVoltage
Definition: cmbatt.h:87
ULONG BatteryTechnology
Definition: cmbatt.h:86
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68