ReactOS  0.4.13-dev-479-gec9c8fd
power.cpp File Reference
#include "private.hpp"
#include <debug.h>
Include dependency graph for power.cpp:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

NTSTATUS NTAPI PcRegisterAdapterPowerManagement (IN PUNKNOWN pUnknown, IN PVOID pvContext)
 
NTSTATUS NTAPI PcUnregisterAdapterPowerManagement (IN PDEVICE_OBJECT DeviceObject)
 
static VOID NTAPI PwrCompletionCallback (IN PDEVICE_OBJECT DeviceObject, IN UCHAR MinorFunction, IN POWER_STATE PowerState, IN PVOID Context, IN PIO_STATUS_BLOCK IoStatus)
 
NTSTATUS NTAPI PcRequestNewPowerState (IN PDEVICE_OBJECT DeviceObject, IN DEVICE_POWER_STATE RequestedNewState)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 12 of file power.cpp.

Function Documentation

◆ PcRegisterAdapterPowerManagement()

NTSTATUS NTAPI PcRegisterAdapterPowerManagement ( IN PUNKNOWN  pUnknown,
IN PVOID  pvContext 
)

Definition at line 19 of file power.cpp.

22 {
25  PPCLASS_DEVICE_EXTENSION DeviceExt;
26  IAdapterPowerManagement * pPower;
27 
28  DPRINT("PcRegisterAdapterPowerManagement pUnknown %p pvContext %p\n", pUnknown, pvContext);
30 
31  if (!pUnknown || !pvContext)
33 
34 
35  pDeviceObject = (PDEVICE_OBJECT)pvContext;
36  DeviceExt = (PPCLASS_DEVICE_EXTENSION)pDeviceObject->DeviceExtension;
37 
38  Status = pUnknown->QueryInterface(IID_IAdapterPowerManagement, (PVOID*)&pPower);
39  if (!NT_SUCCESS(Status))
40  {
41  DPRINT1("PcRegisterAdapterPowerManagement no IAdapterPowerManagement interface %x\n", Status);
42  DeviceExt->AdapterPowerManagement = NULL;
43  return STATUS_SUCCESS;
44  }
45 
46  DeviceExt->AdapterPowerManagement = pPower;
47  DPRINT("PcRegisterAdapterPowerManagement success %x\n", Status);
48  return STATUS_SUCCESS;
49 }
_In_ PNDIS_STRING _In_ PNDIS_STRING _Out_ PDEVICE_OBJECT * pDeviceObject
Definition: ndis.h:4679
struct PCLASS_DEVICE_EXTENSION * PPCLASS_DEVICE_EXTENSION
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
struct _DEVICE_OBJECT * PDEVICE_OBJECT
LONG NTSTATUS
Definition: precomp.h:26
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
_In_ PUNKNOWN pUnknown
Definition: drmk.h:76
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define PC_ASSERT_IRQL_EQUAL(x)
Definition: private.hpp:31
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
Status
Definition: gdiplustypes.h:24
IAdapterPowerManagement * AdapterPowerManagement
Definition: private.hpp:399
#define DPRINT1
Definition: precomp.h:8
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
return STATUS_SUCCESS
Definition: btrfs.c:2777

Referenced by StartDevice().

◆ PcRequestNewPowerState()

NTSTATUS NTAPI PcRequestNewPowerState ( IN PDEVICE_OBJECT  DeviceObject,
IN DEVICE_POWER_STATE  RequestedNewState 
)

Definition at line 91 of file power.cpp.

94 {
95  KEVENT Event;
98  PPCLASS_DEVICE_EXTENSION DeviceExt;
99 
101 
102  if (!DeviceObject || !RequestedNewState)
104 
107 
108  PowerState.DeviceState = RequestedNewState;
110 
112  if (NT_SUCCESS(Status))
113  {
115  }
116 
117 
118  return Status;
119 }
_In_ UCHAR _In_ POWER_STATE PowerState
Definition: pofuncs.h:42
struct PCLASS_DEVICE_EXTENSION * PPCLASS_DEVICE_EXTENSION
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI KeWaitForSingleObject(IN PVOID Object, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL)
Definition: wait.c:416
static VOID NTAPI PwrCompletionCallback(IN PDEVICE_OBJECT DeviceObject, IN UCHAR MinorFunction, IN POWER_STATE PowerState, IN PVOID Context, IN PIO_STATUS_BLOCK IoStatus)
Definition: power.cpp:79
SYSTEM_POWER_STATE SystemState
Definition: ntpoapi.h:57
_In_ PVOID _In_ ULONG Event
Definition: iotypes.h:434
PVOID DeviceExtension
Definition: env_spec_w32.h:418
smooth NULL
Definition: ftsmooth.c:416
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
PDEVICE_OBJECT PhysicalDeviceObject
Definition: private.hpp:395
DEVICE_POWER_STATE DeviceState
Definition: ntpoapi.h:58
#define PC_ASSERT_IRQL_EQUAL(x)
Definition: private.hpp:31
#define IRP_MN_SET_POWER
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
NTSTATUS NTAPI PoRequestPowerIrp(IN PDEVICE_OBJECT DeviceObject, IN UCHAR MinorFunction, IN POWER_STATE PowerState, IN PREQUEST_POWER_COMPLETE CompletionFunction, IN PVOID Context, OUT PIRP *pIrp OPTIONAL)
Definition: power.c:528

◆ PcUnregisterAdapterPowerManagement()

NTSTATUS NTAPI PcUnregisterAdapterPowerManagement ( IN PDEVICE_OBJECT  DeviceObject)

Definition at line 53 of file power.cpp.

55 {
56  PPCLASS_DEVICE_EXTENSION DeviceExt;
57 
58  DPRINT("PcUnregisterAdapterPowerManagement pUnknown %p pvContext %p\n", DeviceObject);
60 
61  if (!DeviceObject)
63 
65 
66  if (DeviceExt->AdapterPowerManagement)
67  {
68  DeviceExt->AdapterPowerManagement->Release();
69  }
70  DeviceExt->AdapterPowerManagement = NULL;
71  return STATUS_SUCCESS;
72 }
struct PCLASS_DEVICE_EXTENSION * PPCLASS_DEVICE_EXTENSION
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
PVOID DeviceExtension
Definition: env_spec_w32.h:418
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
if(!(yy_init))
Definition: macro.lex.yy.c:714
#define PC_ASSERT_IRQL_EQUAL(x)
Definition: private.hpp:31
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
IAdapterPowerManagement * AdapterPowerManagement
Definition: private.hpp:399
return STATUS_SUCCESS
Definition: btrfs.c:2777

◆ PwrCompletionCallback()

static VOID NTAPI PwrCompletionCallback ( IN PDEVICE_OBJECT  DeviceObject,
IN UCHAR  MinorFunction,
IN POWER_STATE  PowerState,
IN PVOID  Context,
IN PIO_STATUS_BLOCK  IoStatus 
)
static

Definition at line 79 of file power.cpp.

85 {
87 }
LONG NTAPI KeSetEvent(IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
Definition: eventobj.c:159
#define IO_NO_INCREMENT
Definition: iotypes.h:565

Referenced by PcRequestNewPowerState().