Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

356 lines
9.3 KiB

  1. /*++ BUILD Version: 0001 // Increment this if a change has global effects
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. poclass.h
  5. Abstract:
  6. Defines power policy device driver interfaces.
  7. Author:
  8. Ken Reneris (kenr) 02-Feb-1997
  9. Revision History:
  10. --*/
  11. //
  12. // Power management policy device GUIDs
  13. //
  14. DEFINE_GUID( GUID_DEVICE_BATTERY, 0x72631e54L, 0x78A4, 0x11d0, 0xbc, 0xf7, 0x00, 0xaa, 0x00, 0xb7, 0xb3, 0x2a );
  15. DEFINE_GUID( GUID_DEVICE_SYS_BUTTON, 0x4AFA3D53L, 0x74A7, 0x11d0, 0xbe, 0x5e, 0x00, 0xA0, 0xC9, 0x06, 0x28, 0x57 );
  16. DEFINE_GUID( GUID_DEVICE_LID, 0x4AFA3D52L, 0x74A7, 0x11d0, 0xbe, 0x5e, 0x00, 0xA0, 0xC9, 0x06, 0x28, 0x57 );
  17. DEFINE_GUID( GUID_DEVICE_THERMAL_ZONE, 0x4AFA3D51L, 0x74A7, 0x11d0, 0xbe, 0x5e, 0x00, 0xA0, 0xC9, 0x06, 0x28, 0x57 );
  18. DEFINE_GUID( GUID_DEVICE_PROCESSOR, 0x97fadb10L, 0x4e33, 0x40ae, 0x35, 0x9c, 0x8b, 0xef, 0x02, 0x9d, 0xbd, 0xd0 );
  19. DEFINE_GUID( GUID_DEVICE_MEMORY, 0x3fd0f03dL, 0x92e0, 0x45fb, 0xb7, 0x5c, 0x5e, 0xd8, 0xff, 0xb0, 0x10, 0x21 );
  20. DEFINE_GUID( GUID_DEVICE_MESSAGE_INDICATOR, 0XCD48A365L, 0xfa94, 0x4ce2, 0xa2, 0x32, 0xa1, 0xb7, 0x64, 0xe5, 0xd8, 0xb4 );
  21. // copied from hidclass.h
  22. DEFINE_GUID( GUID_CLASS_INPUT, 0x4D1E55B2L, 0xF16F, 0x11CF, 0x88, 0xCB, 0x00, 0x11, 0x11, 0x00, 0x00, 0x30 );
  23. #ifndef _POCLASS_
  24. #define _POCLASS_
  25. //
  26. // Battery driver interface (devices of registrying as GUID_DEVICE_BATTERY)
  27. //
  28. typedef enum {
  29. BatteryInformation,
  30. BatteryGranularityInformation,
  31. BatteryTemperature,
  32. BatteryEstimatedTime,
  33. BatteryDeviceName,
  34. BatteryManufactureDate,
  35. BatteryManufactureName,
  36. BatteryUniqueID
  37. } BATTERY_QUERY_INFORMATION_LEVEL;
  38. typedef struct _BATTERY_QUERY_INFORMATION {
  39. ULONG BatteryTag;
  40. BATTERY_QUERY_INFORMATION_LEVEL InformationLevel;
  41. ULONG AtRate;
  42. } BATTERY_QUERY_INFORMATION, *PBATTERY_QUERY_INFORMATION;
  43. typedef struct _BATTERY_INFORMATION {
  44. ULONG Capabilities;
  45. UCHAR Technology;
  46. UCHAR Reserved[3];
  47. UCHAR Chemistry[4];
  48. ULONG DesignedCapacity;
  49. ULONG FullChargedCapacity;
  50. ULONG DefaultAlert1;
  51. ULONG DefaultAlert2;
  52. ULONG CriticalBias;
  53. ULONG CycleCount;
  54. } BATTERY_INFORMATION, *PBATTERY_INFORMATION;
  55. // BATTERY_INFORMATION.*Capacity constants
  56. #define UNKNOWN_CAPACITY 0xFFFFFFFF
  57. // BATTERY_INFORMATION.Capabilities flags
  58. #define BATTERY_SYSTEM_BATTERY 0x80000000
  59. #define BATTERY_CAPACITY_RELATIVE 0x40000000
  60. #define BATTERY_IS_SHORT_TERM 0x20000000
  61. #define BATTERY_SET_CHARGE_SUPPORTED 0x00000001
  62. #define BATTERY_SET_DISCHARGE_SUPPORTED 0x00000002
  63. #define BATTERY_SET_RESUME_SUPPORTED 0x00000004
  64. typedef enum {
  65. BatteryCriticalBias,
  66. BatteryCharge,
  67. BatteryDischarge
  68. } BATTERY_SET_INFORMATION_LEVEL;
  69. typedef struct _BATTERY_SET_INFORMATION {
  70. ULONG BatteryTag;
  71. BATTERY_SET_INFORMATION_LEVEL InformationLevel;
  72. UCHAR Buffer[1];
  73. } BATTERY_SET_INFORMATION, *PBATTERY_SET_INFORMATION;
  74. typedef struct _BATTERY_WAIT_STATUS {
  75. ULONG BatteryTag;
  76. ULONG Timeout;
  77. ULONG PowerState;
  78. ULONG LowCapacity;
  79. ULONG HighCapacity;
  80. } BATTERY_WAIT_STATUS, *PBATTERY_WAIT_STATUS;
  81. typedef struct _BATTERY_STATUS {
  82. ULONG PowerState;
  83. ULONG Capacity;
  84. ULONG Voltage;
  85. LONG Current;
  86. } BATTERY_STATUS, *PBATTERY_STATUS;
  87. // Battery Status Constants
  88. #define UNKNOWN_RATE 0xFFFFFFFF
  89. #define UNKNOWN_VOLTAGE 0xFFFFFFFF
  90. // PowerState flags
  91. #define BATTERY_POWER_ON_LINE 0x00000001
  92. #define BATTERY_DISCHARGING 0x00000002
  93. #define BATTERY_CHARGING 0x00000004
  94. #define BATTERY_CRITICAL 0x00000008
  95. // Max battery driver BATTERY_QUERY_INFORMATION_LEVEL string storage
  96. // size in bytes.
  97. #define MAX_BATTERY_STRING_SIZE 128
  98. // Struct for accessing the packed date format in BatteryManufactureDate.
  99. typedef struct _BATTERY_MANUFACTURE_DATE
  100. {
  101. UCHAR Day;
  102. UCHAR Month;
  103. USHORT Year;
  104. } BATTERY_MANUFACTURE_DATE, *PBATTERY_MANUFACTURE_DATE;
  105. // battery
  106. #define IOCTL_BATTERY_QUERY_TAG \
  107. CTL_CODE(FILE_DEVICE_BATTERY, 0x10, METHOD_BUFFERED, FILE_READ_ACCESS)
  108. #define IOCTL_BATTERY_QUERY_INFORMATION \
  109. CTL_CODE(FILE_DEVICE_BATTERY, 0x11, METHOD_BUFFERED, FILE_READ_ACCESS)
  110. #define IOCTL_BATTERY_SET_INFORMATION \
  111. CTL_CODE(FILE_DEVICE_BATTERY, 0x12, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  112. #define IOCTL_BATTERY_QUERY_STATUS \
  113. CTL_CODE(FILE_DEVICE_BATTERY, 0x13, METHOD_BUFFERED, FILE_READ_ACCESS)
  114. #define BATTERY_TAG_INVALID 0
  115. #ifndef _WINDOWS_
  116. //
  117. // Battery Class-Miniport interfaces
  118. //
  119. typedef
  120. NTSTATUS
  121. (*BCLASS_QUERY_TAG)(
  122. IN PVOID Context,
  123. OUT PULONG BatteryTag
  124. );
  125. typedef
  126. NTSTATUS
  127. (*BCLASS_QUERY_INFORMATION)(
  128. IN PVOID Context,
  129. IN ULONG BatteryTag,
  130. IN BATTERY_QUERY_INFORMATION_LEVEL Level,
  131. IN ULONG AtRate OPTIONAL,
  132. OUT PVOID Buffer,
  133. IN ULONG BufferLength,
  134. OUT PULONG ReturnedLength
  135. );
  136. typedef
  137. NTSTATUS
  138. (*BCLASS_QUERY_STATUS)(
  139. IN PVOID Context,
  140. IN ULONG BatteryTag,
  141. OUT PBATTERY_STATUS BatteryStatus
  142. );
  143. typedef struct {
  144. ULONG PowerState;
  145. ULONG LowCapacity;
  146. ULONG HighCapacity;
  147. } BATTERY_NOTIFY, *PBATTERY_NOTIFY;
  148. typedef
  149. NTSTATUS
  150. (*BCLASS_SET_STATUS_NOTIFY)(
  151. IN PVOID Context,
  152. IN ULONG BatteryTag,
  153. IN PBATTERY_NOTIFY BatteryNotify
  154. );
  155. typedef
  156. NTSTATUS
  157. (*BCLASS_SET_INFORMATION)(
  158. IN PVOID Context,
  159. IN ULONG BatteryTag,
  160. IN BATTERY_SET_INFORMATION_LEVEL Level,
  161. IN PVOID Buffer OPTIONAL
  162. );
  163. typedef
  164. NTSTATUS
  165. (*BCLASS_DISABLE_STATUS_NOTIFY)(
  166. IN PVOID Context
  167. );
  168. typedef struct {
  169. USHORT MajorVersion;
  170. USHORT MinorVersion;
  171. PVOID Context; // Miniport context
  172. BCLASS_QUERY_TAG QueryTag;
  173. BCLASS_QUERY_INFORMATION QueryInformation;
  174. BCLASS_SET_INFORMATION SetInformation;
  175. BCLASS_QUERY_STATUS QueryStatus;
  176. BCLASS_SET_STATUS_NOTIFY SetStatusNotify;
  177. BCLASS_DISABLE_STATUS_NOTIFY DisableStatusNotify;
  178. PDEVICE_OBJECT Pdo;
  179. PUNICODE_STRING DeviceName;
  180. } BATTERY_MINIPORT_INFO, *PBATTERY_MINIPORT_INFO;
  181. #define BATTERY_CLASS_MAJOR_VERSION 0x0001
  182. #define BATTERY_CLASS_MINOR_VERSION 0x0000
  183. //
  184. // Battery class driver functions
  185. //
  186. #if !defined(BATTERYCLASS)
  187. #define BATTERYCLASSAPI DECLSPEC_IMPORT
  188. #else
  189. #define BATTERYCLASSAPI
  190. #endif
  191. NTSTATUS
  192. BATTERYCLASSAPI
  193. BatteryClassInitializeDevice (
  194. IN PBATTERY_MINIPORT_INFO MiniportInfo,
  195. IN PVOID *ClassData
  196. );
  197. NTSTATUS
  198. BATTERYCLASSAPI
  199. BatteryClassUnload (
  200. IN PVOID ClassData
  201. );
  202. NTSTATUS
  203. BATTERYCLASSAPI
  204. BatteryClassIoctl (
  205. IN PVOID ClassData,
  206. IN PIRP Irp
  207. );
  208. NTSTATUS
  209. BATTERYCLASSAPI
  210. BatteryClassStatusNotify (
  211. IN PVOID ClassData
  212. );
  213. #endif // _WINDOWS_
  214. //
  215. // Thermal Zone driver interface (devices of registrying as GUID_DEVICE_THERMAL_ZONE)
  216. //
  217. #define MAX_ACTIVE_COOLING_LEVELS 10
  218. typedef struct _THERMAL_INFORMATION {
  219. ULONG ThermalStamp;
  220. ULONG ThermalConstant1;
  221. ULONG ThermalConstant2;
  222. KAFFINITY Processors;
  223. ULONG SamplingPeriod;
  224. ULONG CurrentTemperature;
  225. ULONG PassiveTripPoint;
  226. ULONG CriticalTripPoint;
  227. UCHAR ActiveTripPointCount;
  228. ULONG ActiveTripPoint[MAX_ACTIVE_COOLING_LEVELS];
  229. } THERMAL_INFORMATION, *PTHERMAL_INFORMATION;
  230. #define ACTIVE_COOLING 0x0
  231. #define PASSIVE_COOLING 0x1
  232. // thermal
  233. #define IOCTL_THERMAL_QUERY_INFORMATION \
  234. CTL_CODE(FILE_DEVICE_BATTERY, 0x20, METHOD_BUFFERED, FILE_READ_ACCESS)
  235. #define IOCTL_THERMAL_SET_COOLING_POLICY\
  236. CTL_CODE(FILE_DEVICE_BATTERY, 0x21, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  237. #define IOCTL_RUN_ACTIVE_COOLING_METHOD\
  238. CTL_CODE(FILE_DEVICE_BATTERY, 0x22, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  239. //
  240. // Lid class driver functions
  241. //
  242. #define IOCTL_QUERY_LID\
  243. CTL_CODE(FILE_DEVICE_BATTERY, 0x30, METHOD_BUFFERED, FILE_READ_ACCESS)
  244. //
  245. // Switch class driver functions
  246. //
  247. #define IOCTL_NOTIFY_SWITCH_EVENT\
  248. CTL_CODE(FILE_DEVICE_BATTERY, 0x40, METHOD_BUFFERED, FILE_READ_ACCESS)
  249. //
  250. // System button class driver functions
  251. //
  252. #define IOCTL_GET_SYS_BUTTON_CAPS \
  253. CTL_CODE(FILE_DEVICE_BATTERY, 0x50, METHOD_BUFFERED, FILE_READ_ACCESS)
  254. #define IOCTL_GET_SYS_BUTTON_EVENT \
  255. CTL_CODE(FILE_DEVICE_BATTERY, 0x51, METHOD_BUFFERED, FILE_READ_ACCESS)
  256. #define SYS_BUTTON_POWER 0x00000001
  257. #define SYS_BUTTON_SLEEP 0x00000002
  258. #define SYS_BUTTON_LID 0x00000004
  259. #define SYS_BUTTON_WAKE 0x80000000
  260. //
  261. // Processor object class driver functions
  262. //
  263. typedef struct {
  264. ULONG PhysicalID;
  265. ULONG PBlkAddress;
  266. UCHAR PBlkLength;
  267. } PROCESSOR_OBJECT_INFO, *PPROCESSOR_OBJECT_INFO;
  268. #define IOCTL_GET_PROCESSOR_OBJ_INFO \
  269. CTL_CODE(FILE_DEVICE_BATTERY, 0x60, METHOD_BUFFERED, FILE_READ_ACCESS)
  270. //
  271. // Message indicator class driver functions
  272. //
  273. #define IOCTL_SET_SYS_MESSAGE_INDICATOR \
  274. CTL_CODE(FILE_DEVICE_BATTERY, 0x70, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  275. #endif // _POCLASS_