52964.fb2 Writing Windows WDM Device Drivers - читать онлайн бесплатно полную версию книги . Страница 27

Writing Windows WDM Device Drivers - читать онлайн бесплатно полную версию книги . Страница 27

Appendix CDirect Memory Access

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);

Table C.1 Old and new DMA routines

OldNewNew DmaOperations routineDescription
HalGetAdapterIoGetDmaAdapter
PutDmaAdapterRelease DmaAdapter
HalAllocateCommonBufferAllocateCommonBuffer
HalFreeCommonBufferFreeCommonBuffer
IoAllocateAdapterChannelAllocateAdapterChannel
IoFlushAdapterBuffersFlushAdapterBuffers
IoFreeAdapterChannelFreeAdapterChannel
IoFreeMapRegistersFreeMapRegisters
IoMapTransferMapTransfer
HalGetDmaAlignmentRequirementGetDmaAlignmentGet alignment requirements for DMA buffers
HalReadDmaCounterReadDmaCounterGet number of bytes remaining to be transferred
GetScatterGatherList
PutScatterGatherList