GPIO_CLIENT_ENABLE_INTERRUPT callback function

The CLIENT_EnableInterrupt event callback function enables interrupts on a general-purpose I/O (GPIO) pin that is configured as an interrupt input.

Syntax

GPIO_CLIENT_ENABLE_INTERRUPT GpioClientEnableInterrupt;

NTSTATUS GpioClientEnableInterrupt(
  PVOID Context,
  PGPIO_ENABLE_INTERRUPT_PARAMETERS EnableParameters
)
{...}

Parameters

Context

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

EnableParameters

Return Value

The CLIENT_EnableInterrupt 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 to enable interrupts on a GPIO pin that is configured as an interrupt request input.

To register your driver's CLIENT_EnableInterrupt 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_EnableInterrupt function pointer.

GpioClx always calls the CLIENT_EnableInterrupt and CLIENT_DisableInterrupt callback functions at IRQL = PASSIVE_LEVEL. However, if the GPIO registers are memory-mapped, GpioClx calls the other interrupt-related callback functions from its ISR at DIRQL. In this case, the CLIENT_EnableInterrupt and CLIENT_DisableInterrupt functions should use the GPIO interrupt lock to synchronize their interrupt-related operations to the ISR. For more information, see Interrupt Synchronization for GPIO Controller Drivers.

Examples

To define a CLIENT_EnableInterrupt 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_EnableInterrupt callback function that is named MyEvtGpioEnableInterrupt, use the GPIO_CLIENT_ENABLE_INTERRUPT function type, as shown in this code example:

GPIO_CLIENT_ENABLE_INTERRUPT MyEvtGpioEnableInterrupt;
Then, implement your callback function as follows:
_Use_decl_annotations_
NTSTATUS
  MyEvtGpioEnableInterrupt(
    PVOID Context,
    PGPIO_ENABLE_INTERRUPT_PARAMETERS InterruptParameters
    )
{ ... }
The GPIO_CLIENT_ENABLE_INTERRUPT 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_ENABLE_INTERRUPT 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

   
Windows version Supported starting with Windows 8.
Target Platform Desktop
Header gpioclx.h
IRQL Called at PASSIVE_LEVEL.

See Also

CLIENT_DisableInterrupt

GPIO_CLIENT_REGISTRATION_PACKET

GPIO_CLX_RegisterClient

GPIO_ENABLE_INTERRUPT_PARAMETERS