Export (0) Print
Expand All

CLIENT_ReleaseController function

The CLIENT_ReleaseController event callback function performs operations that are needed when the general-purpose I/O (GPIO) controller device is no longer accessible.

Syntax


GPIO_CLIENT_RELEASE_CONTROLLER CLIENT_ReleaseController;

NTSTATUS CLIENT_ReleaseController(
  _In_  WDFDEVICE Device,
  _In_  PVOID Context
)
{ ... }

Parameters

Device [in]

A WDFDEVICE handle to the framework device object that represents the GPIO controller.

Context [in]

A pointer to the GPIO controller driver's device context.

Return value

The CLIENT_ReleaseController function returns STATUS_SUCCESS if the call is successful. Otherwise, it returns an appropriate error code.

Remarks

This callback function is implemented by the GPIO controller driver. The GPIO framework extension (GpioClx) calls this function after the GPIO controller device is no longer accessible.

During the CLIENT_ReleaseController callback, the GPIO controller driver should release any hardware resources that it acquired as a result of the preceding call to the CLIENT_PrepareController callback function. In the case of a memory-mapped GPIO controller device, the driver should unmap the memory address range or ranges that are assigned to the hardware registers. For a controller that is not memory-mapped, the driver should close the previously opened logical connection to the controller.

To register your driver's CLIENT_ReleaseController callback function, call the GPIO_CLX_RegisterClient method. This method accepts, as an input parameter, a pointer to a GPIO_CLIENT_REGISTRATION_PACKET structure that contains a CLIENT_ReleaseController function pointer.

Although the CLIENT_ReleaseController callback function is called at IRQL = PASSIVE_LEVEL, you should not make this function pageable. The CLIENT_ReleaseController callback is in the critical timing path for restoring power to the devices in the hardware platform and, for performance reasons, it should not be delayed by page faults.

Examples

To define a CLIENT_ReleaseController callback function, you must first provide a function declaration that identifies the type of callback function you're defining. Windows provides a set of callback function types for drivers. Declaring a function using the callback function types helps Code Analysis for Drivers, Static Driver Verifier (SDV), and other verification tools find errors, and it's a requirement for writing drivers for the Windows operating system.

For example, to define a CLIENT_ReleaseController callback function that is named MyEvtGpioReleaseController, use the GPIO_CLIENT_RELEASE_CONTROLLER function type, as shown in this code example:


GPIO_CLIENT_RELEASE_CONTROLLER  MyEvtGpioReleaseController;

Then, implement your callback function as follows:


_Use_decl_annotations_
NTSTATUS
  MyEvtGpioReleaseController(
    WDFDEVICE Device,
    PVOID Context
)
{ ... }

The GPIO_CLIENT_RELEASE_CONTROLLER function type is defined in the Gpioclx.h header file. To more accurately identify errors when you run the code analysis tools, be sure to add the _Use_decl_annotations_ annotation to your function definition. The _Use_decl_annotations_ annotation ensures that the annotations that are applied to the GPIO_CLIENT_RELEASE_CONTROLLER function type in the header file are used. For more information about the requirements for function declarations, see Declaring Functions by Using Function Role Types for KMDF Drivers. For more information about _Use_decl_annotations_, see Annotating Function Behavior.

Requirements

Version

Supported starting with Windows 8.

Header

Gpioclx.h

IRQL

Called at PASSIVE_LEVEL.

See also

GPIO_CLIENT_REGISTRATION_PACKET
GPIO_CLX_RegisterClient

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft