WdfDmaTransactionInitializeUsingRequest function (wdfdmatransaction.h)

[Applies to KMDF only]

The WdfDmaTransactionInitializeUsingRequest method initializes a specified DMA transaction by using the parameters of a specified I/O request.

Syntax

NTSTATUS WdfDmaTransactionInitializeUsingRequest(
  [in] WDFDMATRANSACTION   DmaTransaction,
  [in] WDFREQUEST          Request,
  [in] PFN_WDF_PROGRAM_DMA EvtProgramDmaFunction,
  [in] WDF_DMA_DIRECTION   DmaDirection
);

Parameters

[in] DmaTransaction

A handle to a DMA transaction object that the driver obtained from a previous call to WdfDmaTransactionCreate.

[in] Request

A handle to a framework request object.

[in] EvtProgramDmaFunction

A pointer to the driver's EvtProgramDma event callback function.

[in] DmaDirection

A WDF_DMA_DIRECTION-typed value that specifies the direction of the DMA transfer.

Return value

WdfDmaTransactionInitializeUsingRequest returns STATUS_SUCCESS if the operation succeeds. Otherwise, the method might return one of the values described in the Return values section of WdfDmaTransactionInitialize.

This method also might return other NTSTATUS values.

A bug check occurs if the driver supplies an invalid object handle.

Remarks

The WdfDmaTransactionInitializeUsingRequest method prepares a DMA operation for execution, by performing initialization operations such as setting up a transaction's scatter/gather list. After your driver calls WdfDmaTransactionInitializeUsingRequest, the driver must call WdfDmaTransactionExecute.

The driver can call WdfRequestGetParameters to obtain a request's type. The value that the driver specifies for the DmaDirection parameter must be appropriate for the request type, as follows:

  • The DmaDirection value must be WdfDmaDirectionReadFromDevice if:
    • The request type is WdfRequestTypeRead
    • The request type is WdfRequestTypeDeviceControl or WdfRequestTypeDeviceControlInternal and the I/O control code specifies a transfer type of METHOD_OUT_DIRECT
  • The DmaDirection value must be WdfDmaDirectionWriteToDevice if:
    • The request type is WdfRequestTypeWrite
    • The request type is WdfRequestTypeDeviceControl or WdfRequestTypeDeviceControlInternal and the I/O control code specifies a transfer type of METHOD_IN_DIRECT
For more information about transfer types for I/O control codes, see Defining I/O Control Codes.

Framework-based drivers typically call WdfDmaTransactionInitializeUsingRequest from within an I/O queue event callback function.

Your driver should call WdfDmaTransactionInitializeUsingRequest if you are creating a DMA transaction that is based on information that a framework request object contains. Use WdfDmaTransactionInitialize if you are creating a DMA transaction that is not based on a request object.

If the buffer that the request object describes is larger than the maximum transfer length that your driver specified when it called WdfDmaEnablerCreate or WdfDmaTransactionSetMaximumLength, the framework breaks the transaction into multiple transfers.

For more information about DMA transactions, see Creating and Initializing a DMA Transaction.

Examples

For a code example that uses WdfDmaTransactionInitializeUsingRequest, see WdfDmaTransactionExecute.

Requirements

Requirement Value
Target Platform Universal
Minimum KMDF version 1.0
Header wdfdmatransaction.h (include Wdf.h)
Library Wdf01000.sys (see Framework Library Versioning.)
IRQL <=DISPATCH_LEVEL
DDI compliance rules DeferredRequestCompleted(kmdf), DriverCreate(kmdf), KmdfIrql(kmdf), KmdfIrql2(kmdf), KmdfIrqlExplicit(kmdf), RequestCompleted(kmdf), RequestCompletedLocal(kmdf)

See also

EvtProgramDma

WDF_DMA_DIRECTION

WdfDmaEnablerSetMaximumScatterGatherElements

WdfDmaTransactionCreate

WdfDmaTransactionExecute

WdfDmaTransactionInitialize