Writing Windows WDM Device Drivers

This book does not cover Direct Memory Access (DMA) in detail. However, NT 3.51 and NT 4 driver writers will find that they must access the DMA system routines in a new way. All the same routines are there, you just have to call IoGetDmaAdapter first. This returns a pointer to a DMA_ADAPTER object. The DmaOperations field in there contains pointers to all the familiar routines. Call the DmaOperations PutDmaAdapter callback when you have finished with the DMA_ADAPTER object.
Table C.1 shows the corresponding old and new routines. Just to reiterate, there is no kernel routine directly called PutDmaAdapter. This routine is only available through the DMA_ADAPTER structure, e.g.,
(*DmaAdapter->DmaOperations->PutDmaAdapter)(DmaAdapter);
| Old | New | New DmaOperations routine | Description |
|---|---|---|---|
| HalGetAdapter | IoGetDmaAdapter | ||
| PutDmaAdapter | Release | ||
| DmaAdapter | |||
| HalAllocateCommonBuffer | AllocateCommonBuffer | ||
| HalFreeCommonBuffer | FreeCommonBuffer | ||
| IoAllocateAdapterChannel | AllocateAdapterChannel | ||
| IoFlushAdapterBuffers | FlushAdapterBuffers | ||
| IoFreeAdapterChannel | FreeAdapterChannel | ||
| IoFreeMapRegisters | FreeMapRegisters | ||
| IoMapTransfer | MapTransfer | ||
| HalGetDmaAlignmentRequirement | GetDmaAlignment | Get alignment requirements for DMA buffers | |
| HalReadDmaCounter | ReadDmaCounter | Get number of bytes remaining to be transferred | |
| GetScatterGatherList | |||
| PutScatterGatherList |