Bewerken

Delen via


GPIO_CLIENT_RECONFIGURE_INTERRUPT callback function (gpioclx.h)

The CLIENT_ReconfigureInterrupt event callback function reconfigures a general-purpose I/O (GPIO) pin that is used as an interrupt input.

Syntax

GPIO_CLIENT_RECONFIGURE_INTERRUPT GpioClientReconfigureInterrupt;

NTSTATUS GpioClientReconfigureInterrupt(
  [in] PVOID Context,
  [in] PGPIO_RECONFIGURE_INTERRUPTS_PARAMETERS ReconfigureParameters
)
{...}

Parameters

[in] Context

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

[in] ReconfigureParameters

A pointer to a GPIO_RECONFIGURE_INTERRUPTS_PARAMETERS structure that specifies how to reconfigure the GPIO interrupt pin.

Return value

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

Remarks

The GPIO framework extension (GpioClx) might call the CLIENT_ReconfigureInterrupt function to change the interrupt mode or interrupt polarity of a GPIO pin that is used as an interrupt input.

For example, if the GPIO controller hardware does not directly support active-both interrupts, but can be configured to support active-high and active-low level-mode interrupts, GpioClx can emulate an active-both interrupt pin by calling the CLIENT_ReconfigureInterrupt function to alternately configure a GPIO pin for active-high and active-low level-mode interrupts. For more information about active-both interrupts, see the description of the EmulateActiveBoth flag in CONTROLLER_ATTRIBUTE_FLAGS.

GpioClx calls the CLIENT_ReconfigureInterrupt callback function either at PASSIVE_LEVEL or DIRQL, depending on the device information that the CLIENT_QueryControllerBasicInformation callback function supplies to GpioClx. The CLIENT_QueryControllerBasicInformation function provides device information in the form of a CLIENT_CONTROLLER_BASIC_INFORMATION structure. If the MemoryMappedController flag bit is set in the Flags member of this structure, GpioClx calls the CLIENT_ReconfigureInterrupt function at DIRQL, which is the IRQL at which the ISR in GpioClx runs. Otherwise, this function is called at PASSIVE_LEVEL. For more information about this flag bit, see Optional and Required GPIO Callback Functions.

Examples

To define a CLIENT_ReconfigureInterrupt 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_ReconfigureInterrupt callback function that is named MyEvtGpioReconfigureInterrupt, use the GPIO_CLIENT_RECONFIGURE_INTERRUPT function type, as shown in this code example:

GPIO_CLIENT_RECONFIGURE_INTERRUPT MyEvtGpioReconfigureInterrupt;

Then, implement your callback function as follows:

_Use_decl_annotations_
NTSTATUS
  MyEvtGpioReconfigureInterrupt(
    PVOID Context,
    PGPIO_RECONFIGURE_INTERRUPTS_PARAMETERS ReconfigureParameters
    )
{ ... }

The GPIO_CLIENT_RECONFIGURE_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_RECONFIGURE_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

Requirement Value
Minimum supported client Supported starting with Windows 8.
Target Platform Desktop
Header gpioclx.h
IRQL See Remarks.

See also

CLIENT_CONTROLLER_BASIC_INFORMATION

CLIENT_QueryControllerBasicInformation

CONTROLLER_ATTRIBUTE_FLAGS

GPIO_RECONFIGURE_INTERRUPTS_PARAMETERS