source: Daodan/MinGW/include/ddk/ntpoapi.h@ 1131

Last change on this file since 1131 was 1046, checked in by alloc, 8 years ago

Daodan: Added Windows MinGW and build batch file

File size: 5.3 KB
RevLine 
[1046]1/*
2 * ntpoapi.h
3 *
4 * APIs for power management.
5 *
6 * This file is part of the w32api package.
7 *
8 * Contributors:
9 * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
10 *
11 * THIS SOFTWARE IS NOT COPYRIGHTED
12 *
13 * This source code is offered for use in the public domain. You may
14 * use, modify or distribute it freely.
15 *
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.
20 *
21 */
22
23#ifndef __NTPOAPI_H
24#define __NTPOAPI_H
25
26#if __GNUC__ >=3
27#pragma GCC system_header
28#endif
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include "ntddk.h"
35#include "batclass.h"
36
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)
40
41typedef struct _PROCESSOR_IDLE_TIMES {
42 ULONGLONG StartTime;
43 ULONGLONG EndTime;
44 ULONG IdleHandlerReserved[4];
45} PROCESSOR_IDLE_TIMES, *PPROCESSOR_IDLE_TIMES;
46
47typedef BOOLEAN DDKFASTAPI
48(*PPROCESSOR_IDLE_HANDLER)(
49 /*IN OUT*/ PPROCESSOR_IDLE_TIMES IdleTimes);
50
51typedef struct _PROCESSOR_IDLE_HANDLER_INFO {
52 ULONG HardwareLatency;
53 PPROCESSOR_IDLE_HANDLER Handler;
54} PROCESSOR_IDLE_HANDLER_INFO, *PPROCESSOR_IDLE_HANDLER_INFO;
55
56typedef VOID DDKFASTAPI
57(*PSET_PROCESSOR_THROTTLE)(
58 /*IN*/ UCHAR Throttle);
59
60typedef NTSTATUS DDKFASTAPI
61(*PSET_PROCESSOR_THROTTLE2)(
62 /*IN*/ UCHAR Throttle);
63
64#define MAX_IDLE_HANDLERS 3
65
66typedef 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;
73
74typedef 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;
84
85typedef NTSTATUS DDKAPI
86(*PENTER_STATE_SYSTEM_HANDLER)(
87 /*IN*/ PVOID SystemContext);
88
89typedef 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);
96
97typedef 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;
104
105typedef NTSTATUS STDCALL
106(*PENTER_STATE_NOTIFY_HANDLER)(
107 /*IN*/ POWER_STATE_HANDLER_TYPE State,
108 /*IN*/ PVOID Context,
109 /*IN*/ BOOLEAN Entering);
110
111typedef struct _POWER_STATE_NOTIFY_HANDLER {
112 PENTER_STATE_NOTIFY_HANDLER Handler;
113 PVOID Context;
114} POWER_STATE_NOTIFY_HANDLER, *PPOWER_STATE_NOTIFY_HANDLER;
115
116NTOSAPI
117NTSTATUS
118DDKAPI
119NtPowerInformation(
120 /*IN*/ POWER_INFORMATION_LEVEL InformationLevel,
121 /*IN*/ PVOID InputBuffer /*OPTIONAL*/,
122 /*IN*/ ULONG InputBufferLength,
123 /*OUT*/ PVOID OutputBuffer /*OPTIONAL*/,
124 /*IN*/ ULONG OutputBufferLength);
125
126#define PROCESSOR_STATE_TYPE_PERFORMANCE 1
127#define PROCESSOR_STATE_TYPE_THROTTLE 2
128
129typedef struct _PROCESSOR_PERF_LEVEL {
130 UCHAR PercentFrequency;
131 UCHAR Reserved;
132 USHORT Flags;
133} PROCESSOR_PERF_LEVEL, *PPROCESSOR_PERF_LEVEL;
134
135typedef 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;
148
149typedef 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;
157
158
159NTOSAPI
160NTSTATUS
161DDKAPI
162NtSetThreadExecutionState(
163 /*IN*/ EXECUTION_STATE esFlags,
164 /*OUT*/ EXECUTION_STATE *PreviousFlags);
165
166NTOSAPI
167NTSTATUS
168DDKAPI
169NtRequestWakeupLatency(
170 /*IN*/ LATENCY_TIME latency);
171
172NTOSAPI
173NTSTATUS
174DDKAPI
175NtInitiatePowerAction(
176 /*IN*/ POWER_ACTION SystemAction,
177 /*IN*/ SYSTEM_POWER_STATE MinSystemState,
178 /*IN*/ ULONG Flags,
179 /*IN*/ BOOLEAN Asynchronous);
180
181NTOSAPI
182NTSTATUS
183DDKAPI
184NtSetSystemPowerState(
185 /*IN*/ POWER_ACTION SystemAction,
186 /*IN*/ SYSTEM_POWER_STATE MinSystemState,
187 /*IN*/ ULONG Flags);
188
189NTOSAPI
190NTSTATUS
191DDKAPI
192NtGetDevicePowerState(
193 /*IN*/ HANDLE Device,
194 /*OUT*/ DEVICE_POWER_STATE *State);
195
196NTOSAPI
197NTSTATUS
198DDKAPI
199NtCancelDeviceWakeupRequest(
200 /*IN*/ HANDLE Device);
201
202NTOSAPI
203BOOLEAN
204DDKAPI
205NtIsSystemResumeAutomatic(
206 VOID);
207
208NTOSAPI
209NTSTATUS
210DDKAPI
211NtRequestDeviceWakeup(
212 /*IN*/ HANDLE Device);
213
214#define WINLOGON_LOCK_ON_SLEEP 0x00000001
215
216typedef 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;
224
225#ifdef __cplusplus
226}
227#endif
228
229#endif /* __NTPOAPI_H */
Note: See TracBrowser for help on using the repository browser.