Edit

wini3c.h header

The WinI3C API lets a user-mode client communicate with an I3C Target device (WinI3C-Target) through an MIPI I3C HCI-compliant I3C HostController-Device (utilizing the inbox I3C driver stack). A client uses this API to enumerate I3C Targets, read/write data (Private Reads and Private Writes), read/write Vendor Common Command Codes (CCCs), and receive In-Band-Interrupts (IBIs). Broadcast and bus-management CCCs (e.g. ENEC/DEFGRPA) are not permitted.

WinI3C is akin to WinUSB (which provides low-level access to USB devices), but for I3C Targets.

WinI3C is the preferred mechanism for vendor-specific I3C Targets when HID isn't suitable.

By default, WinI3C-Targets are NOT accessible (i.e. no device-interfaces are published). To make a WinI3C-Target accessible, the vendor shall publish/install a WinI3C Vendor Extension INF, triggering a device-interface to be published of the supplied device-interface-class. This is part of a layered mitigation strategy to prevent clients from 'opening all WinI3C devices', causing unintentional denial-of-service to the vendor-specific client. For more information about extension INFs, see Using an extension INF file.

Important

WinI3C ships as part of the Windows 11 General Enablement (GE) release family. The Minimum supported client value in each function's requirements table reflects the first GE-based release planned to expose WinI3C: Windows 11 25H2 October update (build 26200). Validate availability at runtime because specific GE-based systems can vary by servicing state.

The initial Windows releases that contain WinI3C don't include an import library (wini3c.lib). Don't link statically against it. Instead, load functions dynamically from wini3c.dll at runtime by using LoadLibrary and GetProcAddress, and treat a missing export as "WinI3C isn't available on this system" rather than relying on a specific build number. Use the import library only once a Windows release that provides it confirms availability.

The library-managed WinI3C APIs are built around a WinI3CTarget handle returned by WinI3CInitializeTarget. After initialization, the WinI3C library owns and manages the file handle to the device-interface, performs the I/O synchronously (blocking) on the client's behalf, and raises IBIs through a callback. These are the recommended APIs for most clients because they are simpler to use, managing device-discovery and overlapped I/O for you.

Library-managed and non-library-managed APIs cannot be used simultaneously by a client on a single WinI3C-Target.

Handles

Handle Description
WinI3CTarget An opaque handle to a connected WinI3C-Target.

Enumeration

API Description
WinI3CRegisterForTargetAdded Registers a callback to be invoked as WinI3C-Targets are discovered (of a given vendor device-interface-class).
WinI3CUnregisterForTargetAdded Unregisters a previously registered target-added callback.

Lifecycle

API Description
WinI3CInitializeTarget Readies a WinI3C-Target for use and returns a library-managed WinI3CTarget handle.
WinI3CResetTarget Performs a blocking reset of a WinI3C-Target.
WinI3CRelease Releases a WinI3C handle (for example, WinI3CTarget).

Configuration

API Description
WinI3CSetMaxWriteLength Sets the maximum write length (SETMWL/GETMWL).
WinI3CSetMaxReadAndIbiLength Sets the maximum read / IBI / auto-command-read length (SETMRL/GETMRL).
WinI3CEnableIbis Enables In-Band-Interrupts (IBIs) for a WinI3C-Target and registers an IBI callback.
WinI3CEnableIbisWithAutoCommandRead Enables In-Band-Interrupts (IBIs) for a WinI3C-Target with an automatic follow-on read triggered by the IBI Mandatory-Data-Byte.
WinI3CDisableIbis Disables IBIs for a WinI3C-Target.

Data Transfer

API Description
WinI3CGetStatus Retrieves WinI3C-Target status (GETSTATUS).
WinI3CWrite Performs a blocking I3C Private Write.
WinI3CRead Performs a blocking I3C Private Read.
WinI3CWriteRead Performs a blocking I3C Private Write immediately followed by a I3C Private read (repeated-start).
WinI3CWriteVendorCcc Sends a Vendor Direct CCC (I3C Direct Set CCC) with an optional payload.
WinI3CReadVendorCcc Reads a Vendor Direct CCC (I3C Direct Get CCC) payload.

Callbacks

Callback Description
WINI3CTARGETADDEDCALLBACK Invoked when a WinI3C-Target is added or enumerated.
WINI3CTARGETINITIALIZEDCALLBACK Invoked when a WinI3C-Target has been initialized.
WINI3CTARGETREMOVEDCALLBACK Invoked when a WinI3C-Target has been removed.
WINI3CIBIRECEIVEDCALLBACK Invoked when an IBI is received from a WinI3C-Target.

Non-library-managed WinI3C APIs (advanced)

The non-library-managed WinI3C APIs use a client-supplied file handle ( ...WithFileHandle and ...FromOperation functions). These are meant only for advanced scenarios in which the client requires control of the device-interface file handle directly, and manage overlapped I/O itself (with e.g. GetOverlappedResult, CancelIo, or an I/O completion port). This is generally not recommended, because the library-managed WinI3C APIs above are easier to use and less error-prone. Use these functions only when direct control over the file handle and overlapped operations is required.

Library-managed and non-library-managed APIs cannot be used simultaneously by a client on a single WinI3C-Target.

Each function begins an overlapped operation and returns a library-created WinI3CAsyncOperation. After the overlapped operation completes, results that carry a payload are retrieved with a ...FromOperation function, and the WinI3CAsyncOperation is released with WinI3CRelease by the client (before the associated OVERLAPPED is destroyed).

Handles

Handle Description
WinI3CAsyncOperation An opaque handle representing the internal library resource associated with an asynchronous or overlapped operation.

Lifecycle

API Description
WinI3CResetTargetWithFileHandle Performs a reset of a WinI3C-Target.
WinI3CRelease Releases a WinI3C handle (for example, WinI3CAsyncOperation).

Configuration

API Description
WinI3CSetMaxWriteLengthWithFileHandle Sets the maximum write length (SETMWL/GETMWL).
WinI3CGetMaxWriteLengthFromOperation Extracts the actual set write length from the WinI3CSetMaxWriteLengthWithFileHandle WinI3CAsyncOperation.
WinI3CSetMaxReadAndIbiLengthWithFileHandle Sets the maximum read / IBI / auto-command-read length (SETMRL/GETMRL).
WinI3CGetMaxReadAndIbiLengthFromOperation Extracts the actual set read length from the WinI3CSetMaxReadAndIbiLengthWithFileHandle WinI3CAsyncOperation.
WinI3CEnableIbisWithFileHandle Overlapped enable of IBIs.
WinI3CEnableIbisWithAutoCommandReadWithFileHandle Overlapped enable of IBIs with auto-command-read.
WinI3CDisableIbisWithFileHandle Overlapped disable of IBIs.

Data Transfer

API Description
WinI3CGetStatusWithFileHandle Initiates retrieving the current status of a WinI3C-Target (GETSTATUS).
WinI3CGetStatusFromOperation Extracts the GETSTATUS result from the WinI3CGetStatusWithFileHandle WinI3CAsyncOperation.
WinI3CWriteWithFileHandle Overlapped I3C Private Write.
WinI3CReadWithFileHandle Overlapped I3C Private Read.
WinI3CGetReadPayloadFromOperation Retrieves the payload from a completed overlapped read.
WinI3CWriteReadWithFileHandle Overlapped write-then-read (repeated-start).
WinI3CWriteVendorCccWithFileHandle Overlapped Vendor Direct CCC write.
WinI3CReadVendorCccWithFileHandle Overlapped Vendor Direct CCC read.
WinI3CPendIbiReadWithFileHandle Pends an overlapped read to be completed by an incoming IBI.

Structures and enumerations

Type Description
WINI3C_TARGET_MODE The I3C transfer mode (SDR or HDR).
WINI3C_TARGET_STATUS The status of a WinI3C-Target (GETSTATUS).

See also

Using an extension INF file

wini3c.h contains the following programming interfaces:

Functions

 
WinI3CDisableIbis

Disables In-Band Interrupts (IBIs) for a WinI3C-Target.
WinI3CDisableIbisWithFileHandle

Initiates an overlapped disable of In-Band Interrupts (IBIs) for a WinI3C-Target using a caller-supplied file handle.
WinI3CEnableIbis

Enables In-Band Interrupts (IBIs) for a WinI3C-Target and registers a callback to receive them.
WinI3CEnableIbisWithAutoCommandRead

Enables In-Band Interrupts (IBIs) for a WinI3C-Target with an automatic follow-on read triggered by the IBI Mandatory-Data-Byte.
WinI3CEnableIbisWithAutoCommandReadWithFileHandle

Initiates an overlapped enable of In-Band Interrupts (IBIs) with Auto-Command-Read using a caller-supplied file handle.
WinI3CEnableIbisWithFileHandle

Initiates an overlapped enable of In-Band Interrupts (IBIs) for a WinI3C-Target using a caller-supplied file handle.
WinI3CGetMaxReadAndIbiLengthFromOperation

Returns the maximum read and IBI length values determined by a WinI3C-Target from a completed overlapped SETMRL/GETMRL operation.
WinI3CGetMaxWriteLengthFromOperation

Returns the maximum write length value determined by a WinI3C-Target from a completed overlapped SETMWL/GETMWL operation.
WinI3CGetReadPayloadFromOperation

Returns the payload from a completed overlapped read, write-read, Vendor CCC read, or pended IBI read.
WinI3CGetStatus

Retrieves the current status of a WinI3C-Target using the I3C GETSTATUS CCC.
WinI3CGetStatusFromOperation

Returns the target status from a completed overlapped GETSTATUS operation.
WinI3CGetStatusWithFileHandle

Initiates an overlapped GETSTATUS exchange with a WinI3C-Target using a caller-supplied file handle.
WinI3CInitializeTarget

Readies a WinI3C-Target for use by the WinI3C library and returns a library-managed WinI3CTarget handle.
WinI3CPendIbiReadWithFileHandle

Pends an overlapped read that is completed when the WinI3C-Target sends an In-Band Interrupt (IBI).
WinI3CRead

Performs a blocking I3C Private Read from a WinI3C-Target.
WinI3CReadVendorCcc

Performs a blocking read of a Vendor Common Command Code (CCC) payload from a WinI3C-Target.
WinI3CReadVendorCccWithFileHandle

Initiates an overlapped read of a Vendor Common Command Code (CCC) payload using a caller-supplied file handle.
WinI3CReadWithFileHandle

Initiates an overlapped I3C Private Read from a WinI3C-Target using a caller-supplied file handle.
WinI3CRegisterForTargetAdded

Registers a callback that is invoked as WinI3C-Targets of a vendor-defined device interface class are enumerated or added.
WinI3CRelease

Releases the resources associated with a WinI3C handle (a WinI3CTarget or a WinI3CAsyncOperation).
WinI3CResetTarget

Performs a blocking reset of a WinI3C-Target, clearing its volatile state.
WinI3CResetTargetWithFileHandle

Initiates an overlapped reset of a WinI3C-Target using a caller-supplied file handle.
WinI3CSetMaxReadAndIbiLength

Indicates to a WinI3C-Target the expected maximum size of an I3C Private Read, IBI payload, and IBI Auto-Command-Read (SETMRL/GETMRL).
WinI3CSetMaxReadAndIbiLengthWithFileHandle

Initiates an overlapped SETMRL/GETMRL exchange with a WinI3C-Target using a caller-supplied file handle.
WinI3CSetMaxWriteLength

Indicates to a WinI3C-Target the expected maximum size of an I3C Private Write (SETMWL/GETMWL).
WinI3CSetMaxWriteLengthWithFileHandle

Initiates an overlapped SETMWL/GETMWL exchange with a WinI3C-Target using a caller-supplied file handle.
WinI3CUnregisterForTargetAdded

Unregisters the enumeration callback previously associated with a vendor-defined device interface class.
WinI3CWrite

Performs a blocking I3C Private Write of the supplied payload to a WinI3C-Target.
WinI3CWriteRead

Performs a blocking I3C Private Write immediately followed by a blocking I3C Private Read (repeated-start).
WinI3CWriteReadWithFileHandle

Initiates an overlapped I3C Private Write followed by a read (repeated-start) using a caller-supplied file handle.
WinI3CWriteVendorCcc

Performs a blocking write of a Vendor Common Command Code (CCC) and optional payload to a WinI3C-Target.
WinI3CWriteVendorCccWithFileHandle

Initiates an overlapped write of a Vendor Common Command Code (CCC) and optional payload using a caller-supplied file handle.
WinI3CWriteWithFileHandle

Initiates an overlapped I3C Private Write to a WinI3C-Target using a caller-supplied file handle.

Callback functions

 
WINI3CIBIRECEIVEDCALLBACK

A callback that is invoked when an In-Band Interrupt (IBI) is received from a WinI3C-Target.
WINI3CTARGETADDEDCALLBACK

A callback that is invoked when a WinI3C-Target of a registered device interface class is added or enumerated.
WINI3CTARGETINITIALIZEDCALLBACK

A callback that is invoked when a WinI3C-Target has been successfully initialized.
WINI3CTARGETREMOVEDCALLBACK

A callback that is invoked when a WinI3C-Target has been removed.

Structures

 
WINI3C_TARGET_STATUS

Contains the status of a WinI3C-Target, as retrieved by the I3C GETSTATUS CCC.

Enumerations

 
WINI3C_TARGET_MODE

Specifies the transfer mode (speed) used when communicating with a WinI3C-Target.