Edit

WinI3CReadVendorCcc function (wini3c.h)

Performs a blocking read of the supplied Vendor Common Command Code (CCC) payload from a WinI3C-Target. This corresponds to an I3C Direct Get CCC command.

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

Syntax

_Must_inspect_result_
HRESULT WINAPI WinI3CReadVendorCcc(
    _In_ WinI3CTarget target,
    _In_ UINT8 commandCode,
    _In_reads_opt_(1) const UINT8* definingByte,
    _In_ UINT32 requestedReadVendorCccPayloadSize,
    _Out_writes_bytes_to_(requestedReadVendorCccPayloadSize, *actualReadVendorCccPayloadSize) void* readVendorCccPayload,
    _Deref_out_range_(0, requestedReadVendorCccPayloadSize) UINT32* actualReadVendorCccPayloadSize);

Parameters

[in] target

The WinI3CTarget to read from.

The handle shall have been created by WinI3CInitializeTarget.

[in] commandCode

The Read CCC to be received.

Only Vendor Direct CCCs (0xE0–0xFE, inclusive) are permitted.

[in, optional] definingByte

An optional defining byte (secondary code) for the Vendor Direct CCC.

Specify NULL if none is supplied.

Not all WinI3C-Targets/HostController-Instances support defining bytes.

[in] requestedReadVendorCccPayloadSize

The number of bytes to read.

  • Shall be > 0.
  • Shall be <= bufferSize(readVendorCccPayload).
  • Shall be <= 65535 (the maximum I3C transfer size).

[out] readVendorCccPayload

A client-allocated buffer that receives the read payload.

Shall not be NULL.

Valid only when the function returns S_OK.

[out] actualReadVendorCccPayloadSize

Receives the actual number of bytes read.

This may be less than requestedReadVendorCccPayloadSize, because a WinI3C-Target may respond with less payload than requested (a short read).

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 read the payload.
E_INVALIDARG One or more parameters are invalid.
E_OUTOFMEMORY Available memory is insufficient to execute this function.
HRESULT_FROM_WIN32(ERROR_DEVICE_NACKED) The WinI3C-Target (passively) NACKed, because it is busy, does not support the CCC, or has experienced a fatal hardware error. Consider calling WinI3CGetStatus to understand the current WinI3C-Target state.
HRESULT_FROM_WIN32(ERROR_DEVICE_NOT_CONNECTED) The WinI3CTarget 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

The maximum read size expected by the WinI3CTarget is set with WinI3CSetMaxReadAndIbiLength.

Only Vendor Direct CCCs (0xE0–0xFE) are supported; broadcast and bus-management CCCs (e.g. ENEC/DEFGRPA) are not permitted.

CCCs are always sent at SDR, so a preferred mode cannot be specified.

This function is thread-safe.

Example

#include <wini3c.h>

void main()
{
    ...
    const uint8_t directCCC = ...;
    const uint32_t requestedReadPayloadSize = ...;
    uint8_t readPayload[requestedReadPayloadSize] = { 0 };
    uint32_t actualReadPayloadSize = 0;

    if (FAILED(WinI3CReadVendorCcc(
        target,
        directCCC,
        nullptr,
        requestedReadPayloadSize,
        readPayload,
        &actualReadPayloadSize)))
    {
        // 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

WinI3CReadVendorCccWithFileHandle

WinI3CWriteVendorCcc