EVT_UCX_USBDEVICE_ENDPOINT_ADD コールバック関数 (ucxusbdevice.h)

UCX が USB デバイスの新しいエンドポイントを追加するために呼び出すクライアント ドライバーの実装。

構文

EVT_UCX_USBDEVICE_ENDPOINT_ADD EvtUcxUsbdeviceEndpointAdd;

NTSTATUS EvtUcxUsbdeviceEndpointAdd(
  [in]           UCXCONTROLLER UcxController,
  [in]           UCXUSBDEVICE UcxUsbDevice,
  [in]           PUSB_ENDPOINT_DESCRIPTOR UsbEndpointDescriptor,
  [in]           ULONG UsbEndpointDescriptorBufferLength,
  [in, optional] PUSB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR SuperSpeedEndpointCompanionDescriptor,
  [in]           PUCXENDPOINT_INIT UcxEndpointInit
)
{...}

パラメーター

[in] UcxController

UcxControllerCreate メソッドの以前の呼び出しでクライアント ドライバーが受信した UCX コントローラーへのハンドル。

[in] UcxUsbDevice

USB デバイスを表す UCX オブジェクトへのハンドル。

[in] UsbEndpointDescriptor

作成されるエンドポイントの USB 記述子を含む場所へのポインター。

[in] UsbEndpointDescriptorBufferLength

記述子の長さ (バイト単位)。

[in, optional] SuperSpeedEndpointCompanionDescriptor

スーパースピード ポートの追加記述子。 このパラメーターは省略可能であり、 NULL にすることができます。

[in] UcxEndpointInit

初期化情報を含む不透明な構造体へのポインター。 エンドポイント オブジェクトのコールバックは、この構造体に関連付けられます。 この構造は UCX によって管理されます。

戻り値

操作が成功した場合、コールバック関数は STATUS_SUCCESS、またはNT_SUCCESS(status) が TRUE と等しい別の状態値を返す必要があります。 それ以外の場合は、NT_SUCCESS(status) が FALSE の状態値を返す必要があります。

注釈

UCX クライアント ドライバーは、 UcxUsbDeviceCreate メソッドを呼び出すことによって、USB ホスト コントローラー拡張機能 (UCX) にこのコールバック関数を登録します。

コールバック関数は UcxEndpointCreate を呼び出して新しいエンドポイント オブジェクトを作成し、エンドポイント オブジェクトコールバック関数を登録します。

その後、コールバック関数は通常、エンドポイント オブジェクトに関連付けられた WDF キューを作成します。 クラス拡張機能によって開始されるまで、キューは要求を受け取りません。

NTSTATUS
Endpoint_EvtUcxUsbDeviceEndpointAdd(
    UCXCONTROLLER                                   UcxController,
    UCXUSBDEVICE                                    UcxUsbDevice,
    PUSB_ENDPOINT_DESCRIPTOR                        UsbEndpointDescriptor,
    ULONG                                           UsbEndpointDescriptorBufferLength,
    PUSB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR   SuperSpeedEndpointCompanionDescriptor,
    PUCXENDPOINT_INIT                               UcxEndpointInit
)

{
    NTSTATUS                        status = STATUS_SUCCESS;

    UCX_ENDPOINT_EVENT_CALLBACKS    ucxEndpointEventCallbacks;
    WDF_OBJECT_ATTRIBUTES           objectAttributes;

    PUCX_CONTROLLER_CONTEXT         ucxControllerContext;

    UCXENDPOINT                     ucxEndpoint;
    PUCX_ENDPOINT_CONTEXT           ucxEndpointContext;

    WDF_IO_QUEUE_CONFIG             queueConfig;

    UNREFERENCED_PARAMETER(UsbEndpointDescriptor);
    UNREFERENCED_PARAMETER(UsbEndpointDescriptorBufferLength);
    UNREFERENCED_PARAMETER(SuperSpeedEndpointCompanionDescriptor);

    UCX_ENDPOINT_EVENT_CALLBACKS_INIT(&ucxEndpointEventCallbacks,
                                      Endpoint_EvtUcxEndpointPurge,
                                      Endpoint_EvtUcxEndpointStart,
                                      Endpoint_EvtUcxEndpointAbort,
                                      Endpoint_EvtUcxEndpointReset,
                                      Endpoint_EvtUcxEndpointOkToCancelTransfers,
                                      Endpoint_EvtUcxEndpointStaticStreamsAdd,
                                      Endpoint_EvtUcxEndpointStaticStreamsEnable,
                                      Endpoint_EvtUcxEndpointStaticStreamsDisable,
                                      Endpoint_EvtUcxEndpointEnableForwardProgress);

    UcxEndpointInitSetEventCallbacks(UcxEndpointInit, &ucxEndpointEventCallbacks);

    WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&objectAttributes, UCX_ENDPOINT_CONTEXT);

    ucxControllerContext = GetUcxControllerContext(UcxController);

    status = UcxEndpointCreate(UcxUsbDevice,
        &UcxEndpointInit,
        &objectAttributes,
        &ucxEndpoint);

    if (!NT_SUCCESS(status)) {
        DbgTrace(TL_ERROR, Endpoint, "UcxEndpoint Failed %!STATUS!", status);
        goto EvtUsbDeviceEndpointAddEnd;
    }

    DbgTrace(TL_INFO, Endpoint, "UcxEndpoint created");

    ucxEndpointContext = GetUcxEndpointContext(ucxEndpoint);

    ucxEndpointContext->IsDefault = FALSE;
    ucxEndpointContext->MaxPacketSize = MAX_PACKET_SIZE;

    WDF_IO_QUEUE_CONFIG_INIT(&queueConfig, WdfIoQueueDispatchManual);

    status = WdfIoQueueCreate(ucxControllerContext->WdfDevice,
        &queueConfig,
        WDF_NO_OBJECT_ATTRIBUTES,
        &ucxEndpointContext->IoQueue);

    if (!NT_SUCCESS(status)) {
        DbgTrace(TL_ERROR, Endpoint, "WdfIoQueueCreate Failed %!STATUS!", status);
        goto EvtUsbDeviceEndpointAddEnd;
    }

    UcxEndpointSetWdfIoQueue(ucxEndpoint, ucxEndpointContext->IoQueue);

EvtUsbDeviceEndpointAddEnd:

    return status;
}

要件

要件
対象プラットフォーム Windows
最小 KMDF バージョン 1.0
最小 UMDF バージョン 2.0
Header ucxusbdevice.h (Ucxclass.h を含む)
IRQL PASSIVE_LEVEL

こちらもご覧ください

UcxDefaultEndpointInitSetEventCallbacks

UcxEndpointCreate

UcxUsbDeviceCreate

WDF_IO_QUEUE_CONFIG_INIT

WdfIoQueueCreate