Work around MinGW mangling of "host:/path"
[msysgit/historical-msysgit.git] / mingw / include / ddk / ntpoapi.h
blob5173c6538c9bd5e1f07def19fe2b43829193fdb1
1 /*
2 * ntpoapi.h
4 * APIs for power management.
6 * This file is part of the w32api package.
8 * Contributors:
9 * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
11 * THIS SOFTWARE IS NOT COPYRIGHTED
13 * This source code is offered for use in the public domain. You may
14 * use, modify or distribute it freely.
16 * This code is distributed in the hope that it will be useful but
17 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
18 * DISCLAIMED. This includes but is not limited to warranties of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
23 #ifndef __NTPOAPI_H
24 #define __NTPOAPI_H
26 #if __GNUC__ >=3
27 #pragma GCC system_header
28 #endif
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
34 #include "ntddk.h"
35 #include "batclass.h"
37 #define POWER_PERF_SCALE 100
38 #define PERF_LEVEL_TO_PERCENT(x) (((x) * 1000) / (POWER_PERF_SCALE * 10))
39 #define PERCENT_TO_PERF_LEVEL(x) (((x) * POWER_PERF_SCALE * 10) / 1000)
41 typedef struct _PROCESSOR_IDLE_TIMES {
42 ULONGLONG StartTime;
43 ULONGLONG EndTime;
44 ULONG IdleHandlerReserved[4];
45 } PROCESSOR_IDLE_TIMES, *PPROCESSOR_IDLE_TIMES;
47 typedef BOOLEAN DDKFASTAPI
48 (*PPROCESSOR_IDLE_HANDLER)(
49 /*IN OUT*/ PPROCESSOR_IDLE_TIMES IdleTimes);
51 typedef struct _PROCESSOR_IDLE_HANDLER_INFO {
52 ULONG HardwareLatency;
53 PPROCESSOR_IDLE_HANDLER Handler;
54 } PROCESSOR_IDLE_HANDLER_INFO, *PPROCESSOR_IDLE_HANDLER_INFO;
56 typedef VOID DDKFASTAPI
57 (*PSET_PROCESSOR_THROTTLE)(
58 /*IN*/ UCHAR Throttle);
60 typedef NTSTATUS DDKFASTAPI
61 (*PSET_PROCESSOR_THROTTLE2)(
62 /*IN*/ UCHAR Throttle);
64 #define MAX_IDLE_HANDLERS 3
66 typedef struct _PROCESSOR_STATE_HANDLER {
67 UCHAR ThrottleScale;
68 BOOLEAN ThrottleOnIdle;
69 PSET_PROCESSOR_THROTTLE SetThrottle;
70 ULONG NumIdleHandlers;
71 PROCESSOR_IDLE_HANDLER_INFO IdleHandler[MAX_IDLE_HANDLERS];
72 } PROCESSOR_STATE_HANDLER, *PPROCESSOR_STATE_HANDLER;
74 typedef enum _POWER_STATE_HANDLER_TYPE {
75 PowerStateSleeping1,
76 PowerStateSleeping2,
77 PowerStateSleeping3,
78 PowerStateSleeping4,
79 PowerStateSleeping4Firmware,
80 PowerStateShutdownReset,
81 PowerStateShutdownOff,
82 PowerStateMaximum
83 } POWER_STATE_HANDLER_TYPE, *PPOWER_STATE_HANDLER_TYPE;
85 typedef NTSTATUS DDKAPI
86 (*PENTER_STATE_SYSTEM_HANDLER)(
87 /*IN*/ PVOID SystemContext);
89 typedef NTSTATUS DDKAPI
90 (*PENTER_STATE_HANDLER)(
91 /*IN*/ PVOID Context,
92 /*IN*/ PENTER_STATE_SYSTEM_HANDLER SystemHandler /*OPTIONAL*/,
93 /*IN*/ PVOID SystemContext,
94 /*IN*/ LONG NumberProcessors,
95 /*IN*/ VOLATILE PLONG Number);
97 typedef struct _POWER_STATE_HANDLER {
98 POWER_STATE_HANDLER_TYPE Type;
99 BOOLEAN RtcWake;
100 UCHAR Spare[3];
101 PENTER_STATE_HANDLER Handler;
102 PVOID Context;
103 } POWER_STATE_HANDLER, *PPOWER_STATE_HANDLER;
105 typedef NTSTATUS STDCALL
106 (*PENTER_STATE_NOTIFY_HANDLER)(
107 /*IN*/ POWER_STATE_HANDLER_TYPE State,
108 /*IN*/ PVOID Context,
109 /*IN*/ BOOLEAN Entering);
111 typedef struct _POWER_STATE_NOTIFY_HANDLER {
112 PENTER_STATE_NOTIFY_HANDLER Handler;
113 PVOID Context;
114 } POWER_STATE_NOTIFY_HANDLER, *PPOWER_STATE_NOTIFY_HANDLER;
116 NTOSAPI
117 NTSTATUS
118 DDKAPI
119 NtPowerInformation(
120 /*IN*/ POWER_INFORMATION_LEVEL InformationLevel,
121 /*IN*/ PVOID InputBuffer /*OPTIONAL*/,
122 /*IN*/ ULONG InputBufferLength,
123 /*OUT*/ PVOID OutputBuffer /*OPTIONAL*/,
124 /*IN*/ ULONG OutputBufferLength);
126 #define PROCESSOR_STATE_TYPE_PERFORMANCE 1
127 #define PROCESSOR_STATE_TYPE_THROTTLE 2
129 typedef struct _PROCESSOR_PERF_LEVEL {
130 UCHAR PercentFrequency;
131 UCHAR Reserved;
132 USHORT Flags;
133 } PROCESSOR_PERF_LEVEL, *PPROCESSOR_PERF_LEVEL;
135 typedef struct _PROCESSOR_PERF_STATE {
136 UCHAR PercentFrequency;
137 UCHAR MinCapacity;
138 USHORT Power;
139 UCHAR IncreaseLevel;
140 UCHAR DecreaseLevel;
141 USHORT Flags;
142 ULONG IncreaseTime;
143 ULONG DecreaseTime;
144 ULONG IncreaseCount;
145 ULONG DecreaseCount;
146 ULONGLONG PerformanceTime;
147 } PROCESSOR_PERF_STATE, *PPROCESSOR_PERF_STATE;
149 typedef struct _PROCESSOR_STATE_HANDLER2 {
150 ULONG NumIdleHandlers;
151 PROCESSOR_IDLE_HANDLER_INFO IdleHandler[MAX_IDLE_HANDLERS];
152 PSET_PROCESSOR_THROTTLE2 SetPerfLevel;
153 ULONG HardwareLatency;
154 UCHAR NumPerfStates;
155 PROCESSOR_PERF_LEVEL PerfLevel[1];
156 } PROCESSOR_STATE_HANDLER2, *PPROCESSOR_STATE_HANDLER2;
159 NTOSAPI
160 NTSTATUS
161 DDKAPI
162 NtSetThreadExecutionState(
163 /*IN*/ EXECUTION_STATE esFlags,
164 /*OUT*/ EXECUTION_STATE *PreviousFlags);
166 NTOSAPI
167 NTSTATUS
168 DDKAPI
169 NtRequestWakeupLatency(
170 /*IN*/ LATENCY_TIME latency);
172 NTOSAPI
173 NTSTATUS
174 DDKAPI
175 NtInitiatePowerAction(
176 /*IN*/ POWER_ACTION SystemAction,
177 /*IN*/ SYSTEM_POWER_STATE MinSystemState,
178 /*IN*/ ULONG Flags,
179 /*IN*/ BOOLEAN Asynchronous);
181 NTOSAPI
182 NTSTATUS
183 DDKAPI
184 NtSetSystemPowerState(
185 /*IN*/ POWER_ACTION SystemAction,
186 /*IN*/ SYSTEM_POWER_STATE MinSystemState,
187 /*IN*/ ULONG Flags);
189 NTOSAPI
190 NTSTATUS
191 DDKAPI
192 NtGetDevicePowerState(
193 /*IN*/ HANDLE Device,
194 /*OUT*/ DEVICE_POWER_STATE *State);
196 NTOSAPI
197 NTSTATUS
198 DDKAPI
199 NtCancelDeviceWakeupRequest(
200 /*IN*/ HANDLE Device);
202 NTOSAPI
203 BOOLEAN
204 DDKAPI
205 NtIsSystemResumeAutomatic(
206 VOID);
208 NTOSAPI
209 NTSTATUS
210 DDKAPI
211 NtRequestDeviceWakeup(
212 /*IN*/ HANDLE Device);
214 #define WINLOGON_LOCK_ON_SLEEP 0x00000001
216 typedef struct _PROCESSOR_POWER_INFORMATION {
217 ULONG Number;
218 ULONG MaxMhz;
219 ULONG CurrentMhz;
220 ULONG MhzLimit;
221 ULONG MaxIdleState;
222 ULONG CurrentIdleState;
223 } PROCESSOR_POWER_INFORMATION, *PPROCESSOR_POWER_INFORMATION;
225 #ifdef __cplusplus
227 #endif
229 #endif /* __NTPOAPI_H */