EVT_SERCX2_SYSTEM_DMA_TRANSMIT_CONFIGURE_DMA_CHANNEL callback function (sercx.h)
The EvtSerCx2SystemDmaTransmitConfigureDmaChannel event callback function is called by version 2 of the serial framework extension (SerCx2) to let the serial controller driver do any custom configuration of the DMA adapter that might be required before the start of each DMA transfer in a system-DMA-transmit transaction.
Syntax
EVT_SERCX2_SYSTEM_DMA_TRANSMIT_CONFIGURE_DMA_CHANNEL EvtSercx2SystemDmaTransmitConfigureDmaChannel;
NTSTATUS EvtSercx2SystemDmaTransmitConfigureDmaChannel(
[in] SERCX2SYSTEMDMATRANSMIT SystemDmaTransmit,
[in] PMDL Mdl,
[in] ULONG Offset,
[in] ULONG Length
)
{...}
Parameters
[in] SystemDmaTransmit
A SERCX2SYSTEMDMATRANSMIT handle to a system-DMA-transmit object. The serial controller driver previously called the SerCx2SystemDmaTransmitCreate method to create this object.
[in] Mdl
A pointer to an MDL that describes the memory pages that are spanned by the write buffer for the system-DMA-transmit transaction. The scatter/gather list for the DMA transfer will use the region of this memory that is specified by the Offset and Length parameters.
[in] Offset
The starting offset for the data transfer. This parameter is a byte offset from the start of the buffer region described by the MDL. If the MDL specifies a total of N bytes of buffer space, possible values of Offset are in the range 0 to N–1.
[in] Length
The size, in bytes, of the data transfer. If the MDL specifies a total of N bytes of buffer space, possible values of Length are in the range 1 to N–Offset.
Return value
The EvtSerCx2SystemDmaTransmitConfigureDmaChannel function returns STATUS_SUCCESS if the call is successful. Otherwise, it returns an appropriate error status code.
Remarks
Your serial controller driver can, as an option, implement this function. If implemented, the driver registers the function in the SerCx2SystemDmaTransmitCreate call that creates the system-DMA-transmit object.
Before initiating a system-DMA-transmit transaction, SerCx2 calls the EvtSerCx2SystemDmaTransmitConfigureDmaChannel function, if it is implemented. This function performs any special configuration of the system DMA controller that might be required before SerCx2 starts the system-DMA-transmit transaction.
The serial controller driver can call a method such as SerCx2SystemDmaTransmitGetDmaEnabler to get the DMA enabler for the system DMA controller used for system-DMA-transmit transactions.
For more information, see SerCx2 System-DMA-Transmit Transactions.
Examples
To define an EvtSerCx2SystemDmaTransmitConfigureDmaChannel 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 EvtSerCx2SystemDmaTransmitConfigureDmaChannel callback function that is named MySystemDmaTransmitConfigureDmaChannel
, use the EVT_SERCX2_SYSTEM_DMA_TRANSMIT_CONFIGURE_DMA_CHANNEL function type, as shown in this code example:
EVT_SERCX2_SYSTEM_DMA_TRANSMIT_CONFIGURE_DMA_CHANNEL MySystemDmaTransmitConfigureDmaChannel;
Then, implement your callback function as follows:
_Use_decl_annotations_
NTSTATUS
MySystemDmaTransmitConfigureDmaChannel(
SERCX2SYSTEMDMATRANSMIT SystemDmaTransmit,
PMDL Mdl,
ULONG Offset,
ULONG Length
)
{...}
The EVT_SERCX2_SYSTEM_DMA_TRANSMIT_CONFIGURE_DMA_CHANNEL function type is defined in the Sercx.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_SERCX2_SYSTEM_DMA_TRANSMIT_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 more information about Use_decl_annotations, see Annotating Function Behavior.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Available starting with Windows 8.1. |
Target Platform | Desktop |
Header | sercx.h |
IRQL | Called at IRQL <= DISPATCH_LEVEL. |