[Applies to KMDF only]

A driver's EvtDmaTransactionConfigureDmaChannel event callback function configures the DMA adapter for a system-mode DMA enabler.



BOOLEAN EvtDmaTransactionConfigureDmaChannel(
  _In_     WDFDMATRANSACTION DmaTransaction,
  _In_     WDFDEVICE         Device,
  _In_     PVOID             Context,
  _In_opt_ PMDL              Mdl,
  _In_     size_t            Offset,
  _In_     size_t            Length
{ ... }


DmaTransaction [in]

A handle to a DMA transaction object representing the transaction that is being executed.

Device [in]

A handle to the framework device object that the driver specified when it called WdfDmaTransactionCreate.

Context [in]

The context pointer that the driver specified in a previous call to WdfDmaTransactionSetChannelConfigurationCallback.

Mdl [in, optional]

A pointer to a single memory descriptor list (MDL) or MDL chain that describes the buffer associated with the current transfer, or NULL if the last transfer has been completed and the adapter is being freed.

Offset [in]

A byte offset into the buffer specified in the Mdl parameter where the current transfer starts.

Length [in]

The number of bytes being transferred in the current transfer.

Return value

The EvtDmaTransactionConfigureDmaChannel callback function returns TRUE if it successfully configures the DMA channel. If this callback function returns FALSE, the framework stops the transaction and does not call EvtProgramDma.


Drivers register an EvtDmaTransactionConfigureDmaChannel event callback function by calling WdfDmaTransactionSetChannelConfigurationCallback.

The framework calls EvtDmaTransactionConfigureDmaChannel once for each system-profile DMA transfer in the transaction, after allocating the adapter channel but before mapping the transfer and calling EvtProgramDma.

The driver can use the EvtDmaTransactionConfigureDmaChannel callback to set any custom programming for the DMA adapter before mapping a transfer.

If the driver experiences an error while configuring the channel, it can stop the DMA transfer by calling WdfDmaTransactionDmaCompletedFinal and, if necessary, completing the request. The driver should then return FALSE from this callback function.


To define an EvtDmaTransactionConfigureDmaChannel callback function, you must first provide a function declaration that identifies the type of callback function you’re defining. Windows provides a set of callback function types for drivers. Declaring a function using the callback function types helps Code Analysis for Drivers, Static Driver Verifier (SDV), and other verification tools find errors, and it’s a requirement for writing drivers for the Windows operating system.

For example, to define an EvtDmaTransactionConfigureDmaChannel callback function that is named MyDmaTransactionConfigureDmaChannel, use the EVT_WDF_DMA_TRANSACTION_CONFIGURE_DMA_CHANNEL type as shown in this code example:


Then, implement your callback function as follows.

 MyDmaTransactionConfigureDmaChannel (
    WDFDEVICE Device,
    PVOID Context,
    PMDL Mdl,
    size_t Offset,
    size_t Length

The EVT_WDF_DMA_TRANSACTION_CONFIGURE_DMA_CHANNEL function type is defined in the WdfDmaTransaction.h header file. To more accurately identify errors when you run the code analysis tools, be sure to add the _Use_decl_annotations_ annotation to your function definition. The _Use_decl_annotations_ annotation ensures that the annotations that are applied to the EVT_WDF_DMA_TRANSACTION_CONFIGURE_DMA_CHANNEL function type in the header file are used. For more information about the requirements for function declarations, see Declaring Functions by Using Function Role Types for KMDF Drivers. For information about _Use_decl_annotations_, see Annotating Function Behavior.


Target platform


Minimum support

Windows 8

Minimum KMDF version



WdfDmaTransaction.h (include Wdf.h)



See also




Send comments about this topic to Microsoft