Edit

WinI3CEnableIbis function (wini3c.h)

Enables In-Band-Interrupts (IBIs) for a specific WinI3C-Target and registers a callback to receive them. The WinI3C-Target shall support IBIs for this to succeed.

WinI3CEnableIbis is a Library-managed WinI3C API (the recommended way to use WinI3C). For an overlapped equivalent that uses a client-supplied file handle, see WinI3CEnableIbisWithFileHandle.

Syntax

_Must_inspect_result_
HRESULT WINAPI WinI3CEnableIbis(
    _In_ WinI3CTarget target,
    _In_opt_ void* ibiReceivedCallbackContext,
    _In_ WINI3CIBIRECEIVEDCALLBACK ibiReceivedCallback);

Parameters

[in] target

The WinI3CTarget to enable IBIs for.

The handle shall have been created by WinI3CInitializeTarget.

[in, optional] ibiReceivedCallbackContext

Optional client context passed back on each WINI3CIBIRECEIVEDCALLBACK invocation.

Specify NULL to not supply a context.

May be destroyed by client at any time.

[in] ibiReceivedCallback

The client-defined WINI3CIBIRECEIVEDCALLBACK to invoke when an IBI is received.

There is no guarantee as to which thread the callback is invoked on, and it may be invoked before WinI3CEnableIbis returns.

There are NO serialization guarantees; the callback may be invoked by multiple threads simultaneously (in response to receiving multiple IBIs).

There are NO ordering guarantees; the callback may be invoked for an IBI that was received earlier/later than another IBI.

Return value

On success this function returns S_OK.

On failure this function returns an appropriate HRESULT error code, including the following.

Return code Description
S_OK Successfully enabled IBIs for the WinI3C-Target.
E_INVALIDARG One or more parameters are invalid.
E_OUTOFMEMORY Available memory is insufficient to execute this function.
HRESULT_FROM_WIN32(ERROR_INVALID_CONFIG_VALUE) The maximum IBI length was not configured. Call WinI3CSetMaxReadAndIbiLength first.
HRESULT_FROM_WIN32(ERROR_ALREADY_REGISTERED) The WinI3C-Target is already enabled for IBIs.
HRESULT_FROM_WIN32(ERROR_DEVICE_FEATURE_NOT_SUPPORTED) IBIs are not supported for this WinI3C-Target.
HRESULT_FROM_WIN32(ERROR_DEVICE_NOT_CONNECTED) The WinI3C-Target is not connected. Destroy the handle with WinI3CRelease.
HRESULT_FROM_WIN32(ERROR_DEVICE_HARDWARE_ERROR) A fatal hardware error occurred. Destroy the handle with WinI3CRelease.

Remarks

IBIs are disabled by default.

Vendors understand the capabilities of their devices, so there is no provided mechanism to determine if IBIs are supported.

WinI3CSetMaxReadAndIbiLength shall be called on the WinI3C-Target first, to configure the library's buffer-size allocation for incoming IBIs.

A specific WinI3C-Target may only be enabled once for IBIs. Call WinI3CDisableIbis before enabling again.

If the WinI3C-Target is destroyed with WinI3CRelease while IBIs are still enabled, IBIs are disabled automatically.

If the client unexpectedly terminates before disabling IBIs, IBIs are disabled automatically.

This function is thread-safe.

Example

Enables IBIs for target, EvtIbiCallback() is invoked for each IBI received.

#include <wini3c.h>

void main()
{
    ...

    if (FAILED(WinI3CEnableIbis(target, nullptr, EvtIbiCallback)))
    {
        // Handle failure.
    }

    ...
}

void CALLBACK EvtIbiCallback(
    _In_opt_ void* ibiReceivedCallbackContext,
    _In_ WinI3CTarget target,
    _When_(ibiPayload == NULL, _In_range_(0, 0)) UINT32 ibiPayloadSize,
    _In_reads_bytes_opt_(ibiPayloadSize) const void* ibiPayload)
{
    ...
}

Requirements

Requirement Value
Minimum supported client Windows 11 25H2 October update (build 26200)
Target Platform Windows
Header wini3c.h
DLL wini3c.dll

See also

WinI3CEnableIbisWithAutoCommandRead

WinI3CDisableIbis

WinI3CSetMaxReadAndIbiLength

WINI3CIBIRECEIVEDCALLBACK