My XP driver does a READ DMA. The sequence is follows.
- sends and IRP for READ with buffer
- calls the DMA routine
I had confusion with MmGetSystemAddressForMdlSafe()
and MmGetMdlVirtualAddress() which
one should use when.
once the call comes to disptachroutine, I use
MmGetSystemAddressForMdlSafe() as follows.
if (Irp->MdlAddress != NULL)
{
currentAddress =
MmGetSystemAddressForMdlSafe(Irp->MdlAddress,NormalPagePriority);
if (currentAddress == NULL)
error;
}
PVOID pvDirectBuffer = currentAddress;
ULONG ulInputBufferLength =
irpSp->Parameters.DeviceIoControl.InputBufferLength;
ULONG ulDirectBufferLength =
irpSp->Parameters.DeviceIoControl.OutputBufferLength;
PVOID pvInputBuffer =
Irp->AssociatedIrp.SystemBuffer;
In the dma routine I use MmGetMdlVirtualAddress() to
get virtual address inorder to pass it to
MapTransfer() routine. Is it the way to do? I guess I
am trying to get virtual address twice and
screwing up the DMA and the DMA IS NOT WORKING.
Do I need to call only once for getting virtual
address? Can any body shed some light?
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine’s Day
http://shopping.yahoo.com