EVT_UCX_USBDEVICE_DEFAULT_ENDPOINT_ADD callback function (ucxusbdevice.h)
The client driver's implementation that UCX calls to add a new default endpoint for a USB device.
Syntax
EVT_UCX_USBDEVICE_DEFAULT_ENDPOINT_ADD EvtUcxUsbdeviceDefaultEndpointAdd;
NTSTATUS EvtUcxUsbdeviceDefaultEndpointAdd(
[in] UCXCONTROLLER UcxController,
[in] UCXUSBDEVICE UcxUsbDevice,
[in] ULONG MaxPacketSize,
[in] PUCXENDPOINT_INIT UcxEndpointInit
)
{...}
Parameters
[in] UcxController
A handle to the UCX controller that the client driver received in a previous call to the UcxControllerCreate method.
[in] UcxUsbDevice
A handle to a UCX object that represents the USB device.
[in] MaxPacketSize
Maximum packet size for transfers on this endpoint.
[in] UcxEndpointInit
A pointer to an opaque structure containing initialization information. Callbacks for the endpoint object are associated with this structure. This structure is managed by UCX.
Return value
If the operation is successful, the callback function must return STATUS_SUCCESS, or another status value for which NT_SUCCESS(status) equals TRUE. Otherwise it must return a status value for which NT_SUCCESS(status) equals FALSE.
Remarks
The UCX client driver registers this callback function with the USB host controller extension (UCX) by calling the UcxUsbDeviceCreate method.
The callback function calls UcxEndpointCreate to create a new default endpoint object and register its default endpoint object callback functions.
Then, the callback function typically creates a WDF queue associated with the endpoint object. The queue does not receive any requests until the class extension starts it.
Examples
NTSTATUS
Endpoint_EvtUcxUsbDeviceDefaultEndpointAdd(
UCXCONTROLLER UcxController,
UCXUSBDEVICE UcxUsbDevice,
ULONG MaxPacketSize,
PUCXENDPOINT_INIT EndpointInit
)
{
NTSTATUS status = STATUS_SUCCESS;
UCX_DEFAULT_ENDPOINT_EVENT_CALLBACKS ucxDefaultEndpointEventCallbacks;
WDF_OBJECT_ATTRIBUTES objectAttributes;
PUCX_CONTROLLER_CONTEXT ucxControllerContext;
UCXENDPOINT ucxEndpoint;
PUCX_ENDPOINT_CONTEXT ucxEndpointContext;
WDF_IO_QUEUE_CONFIG queueConfig;
WDFQUEUE wdfQueue;
UCX_DEFAULT_ENDPOINT_EVENT_CALLBACKS_INIT(&ucxDefaultEndpointEventCallbacks,
Endpoint_EvtUcxEndpointPurge,
Endpoint_EvtUcxEndpointStart,
Endpoint_EvtUcxEndpointAbort,
Endpoint_EvtUcxEndpointOkToCancelTransfers,
Endpoint_EvtUcxDefaultEndpointUpdate);
UcxDefaultEndpointInitSetEventCallbacks(EndpointInit, &ucxDefaultEndpointEventCallbacks);
WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&objectAttributes, UCX_ENDPOINT_CONTEXT);
ucxControllerContext = GetUcxControllerContext(UcxController);
status = UcxEndpointCreate(UcxUsbDevice,
&EndpointInit,
&objectAttributes,
&ucxEndpoint);
if (!NT_SUCCESS(status)) {
DbgTrace(TL_ERROR, Endpoint, "UcxEndpoint Failed %!STATUS!", status);
goto EvtUsbDeviceDefaultEndpointAddEnd;
}
DbgTrace(TL_INFO, Endpoint, "UcxEndpoint created");
ucxEndpointContext = GetUcxEndpointContext(ucxEndpoint);
ucxEndpointContext->IsDefault = TRUE;
ucxEndpointContext->MaxPacketSize = MaxPacketSize;
WDF_IO_QUEUE_CONFIG_INIT(&queueConfig, WdfIoQueueDispatchManual);
status = WdfIoQueueCreate(ucxControllerContext->WdfDevice,
&queueConfig,
WDF_NO_OBJECT_ATTRIBUTES,
&wdfQueue);
if (!NT_SUCCESS(status)) {
DbgTrace(TL_ERROR, Endpoint, "WdfIoQueueCreate Failed %!STATUS!", status);
goto EvtUsbDeviceDefaultEndpointAddEnd;
}
UcxEndpointSetWdfIoQueue(ucxEndpoint, wdfQueue);
EvtUsbDeviceDefaultEndpointAddEnd:
return status;
}
Requirements
Requirement | Value |
---|---|
Target Platform | Windows |
Minimum KMDF version | 1.0 |
Minimum UMDF version | 2.0 |
Header | ucxusbdevice.h (include Ucxclass.h) |
IRQL | PASSIVE_LEVEL |