EVT_UCX_USBDEVICE_ENDPOINT_ADD fonction de rappel (ucxusbdevice.h)

Implémentation du pilote client qu’UCX appelle pour ajouter un nouveau point de terminaison pour un périphérique USB.

Syntaxe

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
)
{...}

Paramètres

[in] UcxController

Handle du contrôleur UCX que le pilote client a reçu lors d’un appel précédent à la méthode UcxControllerCreate .

[in] UcxUsbDevice

Handle vers un objet UCX qui représente le périphérique USB.

[in] UsbEndpointDescriptor

Pointeur vers un emplacement contenant un descripteur USB pour le point de terminaison en cours de création.

[in] UsbEndpointDescriptorBufferLength

Longueur en octets du descripteur.

[in, optional] SuperSpeedEndpointCompanionDescriptor

Descripteur supplémentaire pour un port super-vitesse. Ce paramètre est facultatif et peut être NULL.

[in] UcxEndpointInit

Pointeur vers une structure opaque contenant des informations d’initialisation. Les rappels de l’objet de point de terminaison sont associés à cette structure. Cette structure est gérée par UCX.

Valeur retournée

Si l’opération réussit, la fonction de rappel doit retourner STATUS_SUCCESS, ou une autre valeur status pour laquelle NT_SUCCESS(status) est égal à TRUE. Sinon, elle doit retourner une valeur de status pour laquelle NT_SUCCESS(status) est false.

Remarques

Le pilote client UCX inscrit cette fonction de rappel avec l’extension de contrôleur hôte USB (UCX) en appelant la méthode UcxUsbDeviceCreate .

La fonction de rappel appelle UcxEndpointCreate pour créer un objet de point de terminaison et inscrire des fonctions de rappel d’objet de point de terminaison.

Ensuite, la fonction de rappel crée généralement une file d’attente WDF associée à l’objet de point de terminaison. La file d’attente ne reçoit aucune requête tant que l’extension de classe ne la démarre pas.

Exemples

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;
}

Configuration requise

Condition requise Valeur
Plateforme cible Windows
Version KMDF minimale 1.0
Version UMDF minimale 2.0
En-tête ucxusbdevice.h (inclure Ucxclass.h)
IRQL PASSIVE_LEVEL

Voir aussi

UcxDefaultEndpointInitSetEventCallbacks

UcxEndpointCreate

UcxUsbDeviceCreate

WDF_IO_QUEUE_CONFIG_INIT

WdfIoQueueCreate