Writing AdapterControl Routines
Most drivers of DMA devices have an AdapterControl routine, which is responsible for initiating DMA operations. (Drivers that do not require AdapterControl routines include those that use scatter/gather DMA and those that use common-buffer, bus-master DMA.)
When a driver calls AllocateAdapterChannel, its AdapterControl routine is run immediately if the system DMA controller or bus-master adapter is available for a DMA operation, and if enough map registers are available. Otherwise, the AdapterControl routine is queued until these resources are available.
If the driver's AdapterControl routine returns KeepObject or DeallocateObjectKeepRegisters (thereby retaining the system DMA controller channel or bus-master adapter for additional transfer operations), the driver's DpcForIsr or CustomDpc routine is responsible for releasing the adapter object or map registers by calling FreeAdapterChannel or FreeMapRegisters before the DPC routine completes the current IRP and returns control.