This topic has not yet been rated - Rate this topic

EvtDeviceArmWakeFromSxWithReason function

A driver's EvtDeviceArmWakeFromSxWithReason event callback function arms (that is, enables) a device so that it can trigger a wake signal while in a low-power device state. The wake signal causes the device to enter its working state (D0) and causes the system to enter its working state (S0).

Syntax


EVT_WDF_DEVICE_ARM_WAKE_FROM_SX_WITH_REASON EvtDeviceArmWakeFromSxWithReason;

NTSTATUS EvtDeviceArmWakeFromSxWithReason(
  _In_  WDFDEVICE Device,
  _In_  BOOLEAN DeviceWakeEnabled,
  _In_  BOOLEAN ChildrenArmedForWake
)
{ ... }

Parameters

Device [in]

A handle to a framework device object.

DeviceWakeEnabled [in]

A Boolean value that, if TRUE, indicates that the device's ability to wake the system is enabled.

ChildrenArmedForWake [in]

A Boolean value that, if TRUE, indicates that the ability of one or more child devices to wake the system is enabled.

Return value

If the EvtDeviceArmWakeFromSxWithReason callback function encounters no error, it must return STATUS_SUCCESS or another status value for which NT_SUCCESS(status) equals TRUE. Otherwise it must return a status value for which NT_SUCCESS(status) equals FALSE.

If NT_SUCCESS(status) equals FALSE, the framework calls the driver's EvtDeviceDisarmWakeFromSx callback function. (The framework does not report a device failure to the PnP manager.)

Remarks

Version 1.7 and later versions of KMDF support the EvtDeviceArmWakeFromSxWithReason callback function in addition to the EvtDeviceArmWakeFromSx callback function.

To register an EvtDeviceArmWakeFromSxWithReason callback function, a driver must call WdfDeviceInitSetPowerPolicyEventCallbacks. Drivers can register either an EvtDeviceArmWakeFromSx callback function or an EvtDeviceArmWakeFromSxWithReason callback function, but not both.

The EvtDeviceArmWakeFromSxWithReason callback function provides two parameters that enable the driver to determine why the framework has called it:

  • The framework sets the DeviceWakeEnabled parameter to TRUE if the Enabled member of the WDF_DEVICE_POWER_POLICY_WAKE_SETTINGS structure indicates that the device can wake the system.

  • The framework sets the ChildrenArmedForWake parameter to TRUE if one or more of the device's child devices can wake the system and the ArmForWakeIfChildrenAreArmedForWake member of WDF_DEVICE_POWER_POLICY_WAKE_SETTINGS is set to TRUE.

Either one or both of these parameters can be TRUE, because of the following scenarios:

  • The driver's device is enabled to wake the system.

  • One or more of the device's child devices are enabled to wake the system.

  • Both the device and one or more of its child devices are enabled to wake the system.

For more information about the EvtDeviceArmWakeFromSxWithReason callback function, see the Remarks section of EvtDeviceArmWakeFromSx.

Examples

The function type is declared in Wdfdevice.h, as follows.


typedef NTSTATUS
  (EVT_WDF_DEVICE_ARM_WAKE_FROM_SX_WITH_REASON)(
    IN WDFDEVICE  Device,
    IN BOOLEAN  DeviceWakeEnabled,
    IN BOOLEAN  ChildrenArmedForWake
    );

To define an EvtDeviceArmWakeFromSxWithReason callback function that is named MyDeviceArmWakeFromSxWithReason, you must first provide a function declaration that SDV and other verification tools require, as follows:


EVT_WDF_DEVICE_ARM_WAKE_FROM_SX_WITH_REASON  MyDeviceArmWakeFromSxWithReason;

Then, implement your callback function as follows:


 NTSTATUS
 MyDeviceArmWakeFromSxWithReason (
    IN WDFDEVICE  Device
    IN BOOLEAN  DeviceWakeEnabled,
    IN BOOLEAN  ChildrenArmedForWake
    )
  {...}

Requirements

Version

Supported by version 1.7 and later versions of KMDF (see KMDF Version History).

Header

Wdfdevice.h (include Wdf.h)

IRQL

PASSIVE_LEVEL

See also

EvtDeviceArmWakeFromS0
EvtDeviceArmWakeFromSx
EvtDeviceDisarmWakeFromSx

 

 

Send comments about this topic to Microsoft

Build date: 4/23/2013

© 2013 Microsoft. All rights reserved.