Previous Next

AdapterControl

The AdapterControl routine starts a DMA data-transfer operation.

IO_ALLOCATION_ACTION
  AdapterControl(
    IN PDEVICE_OBJECT  DeviceObject,
    IN PIRP  Irp,
    IN PVOID  MapRegisterBase,
    IN PVOID  Context 
    );

Parameters

DeviceObject
Caller-supplied pointer to a DEVICE_OBJECT structure. This is the device object for the target device, previously created by the driver's AddDevice routine.
Irp
Caller-supplied pointer to an IRP structure. Irp is equal to the value of the CurrentIrp member of DeviceObject when the AdapterControl routine was registered.
MapRegisterBase
Caller-supplied opaque value that represents the map registers that the system has assigned for this transfer operation. The driver passes this value to FlushAdapterBuffers, FreeMapRegisters, and MapTransfer.
Context
Caller-supplied pointer to driver-defined context information, specified in a previous call to AllocateAdapterChannel.

Return Value

The routine must return one of the enumerated values defined by IO_ALLOCATION_ACTION. Drivers of bus-master devices return either DeallocateObject or DeallocateObjectKeepRegisters; drivers that use system DMA return KeepObject.

Comments

A driver's AdapterControl routine executes in an arbitrary thread context at IRQL = DISPATCH_LEVEL.

To register an AdapterControl routine for a specific device object, a driver must call IoGetDmaAdapter to obtain an adapter object, then call AllocateAdapterChannel to request use of the adapter and to supply the AdapterControl routine's address. When the adapter is free, the system calls the AdapterControl routine.

If AdapterControl has been registered by a StartIo routine, then the Irp parameter is guaranteed to point to the IRP currently being processed by the StartIo routine. Otherwise, drivers must set the CurrentIrp member of the device object structure before calling AllocateAdapterChannel.

For detailed information about implementing an AdapterControl routine, see Writing AdapterControl Routines.

See Also

AllocateAdapterChannel