Edit

WinI3CSetMaxReadAndIbiLength function (wini3c.h)

Indicates to a WinI3C-Target the expected maximum size of an I3C Private Read, In-Band-Interrupt (IBI) payload and IBI Auto-Command-Read. This corresponds to the I3C SETMRL and GETMRL Direct CCCs. While a WinI3C-Target is expected to respect this value, the I3C specification provides no enforcement mechanism, so it is not guaranteed.

WinI3CSetMaxReadAndIbiLength is a Library-managed WinI3C API (the recommended way to use WinI3C). For an overlapped equivalent, see WinI3CSetMaxReadAndIbiLengthWithFileHandle.

Syntax

_Must_inspect_result_
HRESULT WINAPI WinI3CSetMaxReadAndIbiLength(
    _In_ WinI3CTarget target,
    _In_ UINT16 requestedMaxReadAndAutoCommandReadLength,
    _Out_ UINT16* actualMaxReadAndAutoCommandReadLength,
    _In_ UINT8 requestedMaxIbiLength,
    _Out_ UINT8* actualMaxIbiLength);

Parameters

[in] target

The WinI3CTarget to configure.

The handle shall have been created by WinI3CInitializeTarget.

[in] requestedMaxReadAndAutoCommandReadLength

The requested maximum Private Read and IBI Auto-Command-Read payload size (bytes).

[out] actualMaxReadAndAutoCommandReadLength

Receives the actual maximum Private Read and IBI Auto-Command-Read payload size, as determined by the WinI3C-Target. This may differ from the requested length.

Valid only when the function returns S_OK.

[in] requestedMaxIbiLength

The requested maximum IBI payload size.

0 indicates an unlimited payload.

If IBIs are unsupported by the WinI3C-Target, this value is ignored.

[out] actualMaxIbiLength

Receives the actual maximum IBI payload size, as determined by the WinI3C-Target. This may differ from the requested length.

0 indicates an unlimited payload.

If IBIs are unsupported, this is shall be 0 and ignored by the client.

Valid only when the function returns S_OK.

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 set the maximum Private Read, IBI and IBI Auto-Command-Read length. This does not imply the requested values were set; see the actual parameters.
E_INVALIDARG One or more parameters are invalid.
E_OUTOFMEMORY Available memory is insufficient to execute this function.
HRESULT_FROM_WIN32(ERROR_ALREADY_RUNNING_LKG) IBIs are enabled for the WinI3C-Target, which prevents the maximum read length from changing. Call WinI3CDisableIbis first.
HRESULT_FROM_WIN32(ERROR_DEVICE_NACKED) The WinI3C-Target (passively) NACKed the SETMRL or GETMRL CCC. The client may retry later; consider first calling WinI3CGetStatus.
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

Vendors understand the capabilities of their devices, so there is no provided mechanism to determine if SETMRL/GETMRL Direct CCCs are supported by the WinI3C-Target.

This function shall be called before WinI3CEnableIbis or WinI3CEnableIbisWithAutoCommandRead, to configure the library's buffer-size allocation for incoming IBIs.

This function is thread-safe.

Example

#include <wini3c.h>

void main()
{
    ...

    const uint16_t requestedMaxReadAndAutoCommandReadLength = ...;
    uint16_t actualMaxReadAndAutoCommandReadLength;

    const uint8_t requestedMaxIbiLength = ...;
    uint8_t actualMaxIbiLength;

    if (FAILED(WinI3CSetMaxReadAndIbiLength(
        target,
        requestedMaxReadAndAutoCommandReadLength,
        &actualMaxReadAndAutoCommandReadLength,
        requestedMaxIbiLength,
        &actualMaxIbiLength)))
    {
        // Handle failure.
    }

    ...
}

Requirements

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

See also

WinI3CSetMaxReadAndIbiLengthWithFileHandle

WinI3CSetMaxWriteLength

WinI3CEnableIbis