27 Queue Selection Queue Types I/O DispatcherQueue SelectionExecution Level& Sync ScopeDriver’s OnReadI/OPower ManagementQueue TypesSequential: Requests are delivered one at a timeParallel: Requests are delivered to the driver as they arriveManual: Driver retrieves requests from the WDQUEUE at its own paceParallelWDFREQUESTReadI/O DispatcherWriteIRPsSequentialWDFREQUESTIOCTLManualWDFREQUEST
28 Execution Level & Sync Scope I/O DispatcherQueue SelectionExecution Level& Sync ScopeDriver’s OnReadI/OPower ManagementIRQL: Interrupt Request Level (PASSIVE_LEVEL, DISPATCH_LEVEL)Execution Level: IRQL at which event callbacks are invokedSynchronization Scope: Mechanism for enforcing serialization of callback execution by managing locksDevice Scope: Synchronization of callbacks for a device’s queue and file objectsQueue Scope: Synchronization of callbacks for a queueNone: No synchronization
29 Power management Power Managed Queues Queue events I/O DispatcherQueue SelectionExecution Level& Sync ScopeDriver’s OnReadI/OPower ManagementPower Managed QueuesWDF Queues can be “Power Managed”Requests are delivered only if the device is poweredHelps driver avoid touching H/W when it is powered offQueue eventsEvtIoStop: Called for all requests already delivered to driver when power down happensEvtIoResume: Called for all inflight requests when a power up happens
30 Request Cancellation Queued request can be cancelled. “In-flight” requests must be made cancelableA request should be made cancelable if:The I/O is going to take long time to completeThe I/O operation on the hardware is abortableWdfRequestMarkCancelable ( Request, OnRequestCancel );
34 Sending requests to I/O target WHDC PowerPoint Template Notes & HandoutsThursday, April 13, 2017Sending requests to I/O targetSynchronously or asynchronously.Sync - WdfIoTargetSendReadSynchronouslyAsync - WdfIoTargetFormatRequestForRead followed by WdfRequestSendTimeoutsDrivers can configure requests to cancel after timeoutRecommended to avoid driver hangsWdfIoTargetSendIoctlSynchronously( ioTarget, NULL,IOCTL_ACPI_ASYNC_EVAL_METHOD,&inputBufDesc, &outputBufDesc,NULL, NULL);Microsoft Confidential - Windows Hardware & Driver Central
47 Further reading and documentation WDF Book/ MSDN DocumentationDeveloping Drivers with Windows Driver Foundation by Orwick and SmithKernel-Mode Driver Framework Design GuideUser-Mode Driver Framework Design GuideChoosing a driver modelDriver SamplesA basic “Toaster” sample (UMDF2)Echo driver sample, showing queues and IOCTLS (KMDF)USB FX2 Function Driver (UMDF2)
Your consent to our cookies if you continue to use this website.