NTSTATUS
IoAllocateAdapterChannel(
IN PADAPTER_OBJECT AdapterObject,
IN PDEVICE_OBJECT DeviceObject,
IN ULONG NumberOfMapRegisters,
IN PDRIVER_CONTROL ExecutionRoutine,
IN PVOID Context
);
IoAllocateAdapterChannel allocates an adapter object for a DMA operation on the target device object and calls a driver-supplied routine to carry out an I/O operation through the system DMA controller or a busmaster adapter as soon as the appropriate DMA channel is available and/or any necessary map registers are available.
IO_ALLOCATION_ACTION (*PDRIVER_CONTROL)( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID MapRegisterBase, IN PVOID Context );
This routine can return one of the following NTSTATUS values:
Value |
Meaning |
STATUS_SUCCESS |
The adapter object has been allocated. |
STATUS_INSUFFICIENT_RESOURCES |
The NumberOfMapRegisters is larger than the value returned by HalGetAdapter. |
This routine reserves exclusive access to a DMA controller channel and/or map registers for the one or more DMA operations required to satisfy the current IRP’s transfer request for the specified device.
If the system DMA controller or busmaster adapter is already busy, the driver-supplied AdapterControl routine is queued. Otherwise, the driver supplied AdapterControl routine is called immediately.
IoAllocateAdapterChannel passes an Irp to the caller’s AdapterControl routine only if this routine is called from the StartIo routine to process the same IRP passed in to the StartIo routine. Otherwise, the Irp has no meaning, and a driver should consider the Irp a system-reserved parameter to its AdaperControl routine.
The return value of the AdapterControl routine depends on whether the device is a busmaster or uses system DMA. Drivers of busmaster devices return DeallocateObjectKeepRegisters; drivers of slave devices return KeepObject.
Callers of IoAllocateAdapterChannel must be running at IRQL DISPATCH_LEVEL.
HalGetAdapter, HalReadDmaCounter, IoFlushAdapterBuffers, IoFreeAdapterChannel, IoFreeMapRegisters, IoMapTransfer, KeFlushIoBuffers