Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

CLIENT_EnableInterrupt 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 CLIENT_EnableInterrupt;

NTSTATUS CLIENT_EnableInterrupt(
  _In_  PVOID Context,
  _In_  PGPIO_ENABLE_INTERRUPT_PARAMETERS InterruptParameters
)
{ ... }

Parameters

Context [in]

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

InterruptParameters [in]

A pointer to a GPIO_ENABLE_INTERRUPT_PARAMETERS structure that specifies a GPIO pin and describes the interrupt attributes of this pin.

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

Version

Supported starting with Windows 8.

Header

Gpioclx.h

IRQL

Called at PASSIVE_LEVEL.

See also

CLIENT_DisableInterrupt
GPIO_CLIENT_REGISTRATION_PACKET
GPIO_CLX_RegisterClient
GPIO_ENABLE_INTERRUPT_PARAMETERS

 

 

Send comments about this topic to Microsoft

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.