EVT_UFX_DEVICE_ENDPOINT_ADD Rückruffunktion (ufxclient.h)
Die Implementierung des Clienttreibers zum Erstellen eines Standardendpunktobjekts.
Syntax
EVT_UFX_DEVICE_ENDPOINT_ADD EvtUfxDeviceEndpointAdd;
NTSTATUS EvtUfxDeviceEndpointAdd(
[in] UFXDEVICE unnamedParam1,
[in] const PUSB_ENDPOINT_DESCRIPTOR unnamedParam2,
[in, out] PUFXENDPOINT_INIT unnamedParam3
)
{...}
Parameter
[in] unnamedParam1
Das Handle für ein USB-Geräteobjekt, das der Clienttreiber in einem vorherigen Aufruf des UfxDeviceCreateempfangen hat.
[in] unnamedParam2
Ein Zeiger auf eine USB_ENDPOINT_DESCRIPTOR Struktur, die Deskriptordaten enthält.
[in, out] unnamedParam3
Ein Zeiger auf eine UFXENDPOINT_INIT undurchsichtige Struktur, die den Endpunktdeskriptor enthält, der zum Erstellen eines Endpunktobjekts erforderlich ist.
Rückgabewert
Wenn der Vorgang erfolgreich ist, muss die Rückruffunktion STATUS_SUCCESS oder einen anderen Statuswert zurückgeben, für den NT_SUCCESS(Status) WAHR ist. Andernfalls muss ein Statuswert zurückgegeben werden, für den NT_SUCCESS(Status) FALSE entspricht.
Bemerkungen
Der Clienttreiber für den Funktionshostcontroller registriert seine EVT_UFX_DEVICE_ENDPOINT_ADD Implementierung mit der USB-Funktionsklassenerweiterung (UFX), indem die UfxDeviceCreate-Methode aufgerufen wird.
Zum Erstellen des Endpunkts wird erwartet, dass der Clienttreiber die Attribute der Übertragungs- und Befehlswarteschlangen des Endpunkts initialisieren und dann UfxEndpointCreate aufrufen, um den Endpunkt zu erstellen.
Der Clienttreiber gibt den Abschluss dieses Ereignisses an, indem die UfxDeviceEventComplete--Methode aufgerufen wird.
Beispiele
EVT_UFX_DEVICE_ENDPOINT_ADD UfxDevice_EvtDeviceEndpointAdd;
NTSTATUS
UfxDevice_EvtDeviceEndpointAdd (
_In_ UFXDEVICE UfxDevice,
_In_ const PUSB_ENDPOINT_DESCRIPTOR EndpointDescriptor,
_Inout_ PUFXENDPOINT_INIT EndpointInit
)
/*++
Routine Description:
EvtDeviceEndpointAdd handler for the UFXDEVICE object.
Creates UFXENDPOINT object corresponding to the newly reported endpoint.
Arguments:
UfxDevice - UFXDEVICE object representing the device.
EndpointDescriptor - Constant Pointer to Endpoint descriptor for the
newly reported endpoint.
EndpointInit - Pointer to the Opaque UFXENDPOINT_INIT object
Return Value:
STATUS_SUCCESS on success, or an appropriate NTSTATUS message on failure.
--*/
{
NTSTATUS Status;
WDF_OBJECT_ATTRIBUTES Attributes;
WDF_IO_QUEUE_CONFIG TransferQueueConfig;
WDF_OBJECT_ATTRIBUTES TransferQueueAttributes;
WDF_IO_QUEUE_CONFIG CommandQueueConfig;
WDF_OBJECT_ATTRIBUTES CommandQueueAttributes;
UFXENDPOINT Endpoint;
PUFXENDPOINT_CONTEXT EpContext;
PUFXDEVICE_CONTEXT DeviceContext;
UFX_ENDPOINT_CALLBACKS Callbacks;
PENDPOINT_QUEUE_CONTEXT QueueContext;
WDFQUEUE Queue;
TraceEntry();
WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&Attributes, UFXENDPOINT_CONTEXT);
Attributes.ExecutionLevel = WdfExecutionLevelPassive;
Attributes.EvtCleanupCallback = UfxEndpoint_Cleanup;
//
// Note: Execution level needs to be passive to avoid deadlocks with WdfRequestComplete.
//
WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&TransferQueueAttributes, ENDPOINT_QUEUE_CONTEXT);
TransferQueueAttributes.ExecutionLevel = WdfExecutionLevelPassive;
WDF_IO_QUEUE_CONFIG_INIT(&TransferQueueConfig, WdfIoQueueDispatchManual);
TransferQueueConfig.AllowZeroLengthRequests = TRUE;
TransferQueueConfig.EvtIoStop = EndpointQueue_EvtIoStop;
WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&CommandQueueAttributes, ENDPOINT_QUEUE_CONTEXT);
CommandQueueAttributes.ExecutionLevel = WdfExecutionLevelPassive;
WDF_IO_QUEUE_CONFIG_INIT(&CommandQueueConfig, WdfIoQueueDispatchSequential);
CommandQueueConfig.EvtIoInternalDeviceControl = EvtEndpointCommandQueue;
UFX_ENDPOINT_CALLBACKS_INIT(&Callbacks);
UfxEndpointInitSetEventCallbacks(EndpointInit, &Callbacks);
Status = UfxEndpointCreate(
Device,
EndpointInit,
&Attributes,
&TransferQueueConfig,
&TransferQueueAttributes,
&CommandQueueConfig,
&CommandQueueAttributes,
&Endpoint);
Status = WdfCollectionAdd(DeviceContext->Endpoints, Endpoint);
EpContext = UfxEndpointGetContext(Endpoint);
EpContext->UfxDevice = Device;
EpContext->WdfDevice = DeviceContext->FdoWdfDevice;
RtlCopyMemory(&EpContext->Descriptor, Descriptor, sizeof(*Descriptor));
Queue = UfxEndpointGetTransferQueue(Endpoint);
QueueContext = EndpointQueueGetContext(Queue);
QueueContext->Endpoint = Endpoint;
Queue = UfxEndpointGetCommandQueue(Endpoint);
QueueContext = EndpointQueueGetContext(Queue);
QueueContext->Endpoint = Endpoint;
//
// This can happen if we're handling a SetInterface command.
//
if (DeviceContext->UsbState == UsbfnDeviceStateConfigured) {
UfxEndpointConfigure(Endpoint);
}
Status = WdfIoQueueReadyNotify(
UfxEndpointGetTransferQueue(Endpoint),
TransferReadyNotify,
Endpoint);
End:
TraceExit();
return Status;
}
Anforderungen
Anforderung | Wert |
---|---|
Zielplattform- | Fenster |
Minimale KMDF-Version | 1.0 |
Mindest-UMDF-Version | 2.0 |
Header- | ufxclient.h |
IRQL- | PASSIVE_LEVEL |