From: uba on 1 Mar 2010 09:17 Hi All, I'm trying to create a MDL chain from a array of buffers each of size 64K. AFter the creating the mdl chain and then formatting an URB to send the request. AFter sending the request, the completion routine is never called. I think I'm missing out someting in creating a mdl chain. Do I need to set any of MDL sturcture members after creating the chain? Any help is much appreciated. NTSTATUS CreateChain(PVOID buffer1, PVOID buffer2, DEVICE_EXTENSION devExt) { PMDL mdl1,mdl2; PIRP Irp; PURB urb; mdl1 = IoAllocateMdl((PVOID) buffer1,Length,FALSE,FALSE,NULL); if (mdl1 == NULL) { status = STATUS_INSUFFICIENT_RESOURCES; return status; } mdl2 = IoAllocateMdl((PVOID) buffer2,Length,FALSE,FALSE,NULL); if (mdl2 == NULL) { status = STATUS_INSUFFICIENT_RESOURCES; return status; } mdl1->Next = mdl2; Irp = IoAllocateIrp(devExt->StackSize, FALSE); if (Irp == NULL) { return STATUS_INSUFFICIENT_RESOURCES; } MmBuildMdlForNonPagedPool(mdl1); urb = ExAllocatePool(NonPagedPool, sizeof(struct _URB_BULK_OR_INTERRUPT_TRANSFER)); if(urb == NULL) { return STATUS_INSUFFICIENT_RESOURCES; } UsbBuildInterruptOrBulkTransferRequest( urb, sizeof(struct _URB_BULK_OR_INTERRUPT_TRANSFER), pipeInformation->PipeHandle, NULL, mdl1, Length * 2, urbFlags, NULL); nextStack = IoGetNextIrpStackLocation(Irp); nextStack->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL; nextStack->Parameters.Others.Argument1 = (PVOID) urb; nextStack->Parameters.DeviceIoControl.IoControlCode = IOCTL_INTERNAL_USB_SUBMIT_URB; IoSetCompletionRoutine(Irp, CompletionRoutine, devExt, TRUE, TRUE, TRUE); IoMarkIrpPending(Irp); status = IoCallDriver(deviceExt->TopOfStackDeviceObject, Irp); if(!NT_SUCCESS(status)) { return status; } return STATUS_PENDING; }
From: uba on 1 Mar 2010 12:32 I'm stuck up and running out of ideas. Can some one look into above snippet and let me know if I'm missing anything.
From: Doron Holan [MSFT] on 1 Mar 2010 12:54 USB does not support MDL chains in URBs -- This posting is provided "AS IS" with no warranties, and confers no rights. "uba" <kid07.uba(a)gmail.com> wrote in message news:bf64b444-772e-4e6b-bdae-ed3e48b56a7d(a)t34g2000prm.googlegroups.com... > Hi All, > > I'm trying to create a MDL chain from a array of buffers each of size > 64K. AFter the creating the mdl chain and then formatting an URB to > send the request. > > AFter sending the request, the completion routine is never called. I > think I'm missing out someting in creating a mdl chain. Do I need to > set any of MDL sturcture members after creating the chain? > > Any help is much appreciated. > > NTSTATUS > CreateChain(PVOID buffer1, PVOID buffer2, DEVICE_EXTENSION devExt) > { > PMDL mdl1,mdl2; > PIRP Irp; > PURB urb; > > mdl1 = IoAllocateMdl((PVOID) buffer1,Length,FALSE,FALSE,NULL); > > if (mdl1 == NULL) { > status = STATUS_INSUFFICIENT_RESOURCES; > return status; > } > > mdl2 = IoAllocateMdl((PVOID) buffer2,Length,FALSE,FALSE,NULL); > > if (mdl2 == NULL) { > status = STATUS_INSUFFICIENT_RESOURCES; > return status; > } > > mdl1->Next = mdl2; > > Irp = IoAllocateIrp(devExt->StackSize, FALSE); > > if (Irp == NULL) { > return STATUS_INSUFFICIENT_RESOURCES; > } > MmBuildMdlForNonPagedPool(mdl1); > > urb = ExAllocatePool(NonPagedPool, > sizeof(struct > _URB_BULK_OR_INTERRUPT_TRANSFER)); > if(urb == NULL) { > return STATUS_INSUFFICIENT_RESOURCES; > } > UsbBuildInterruptOrBulkTransferRequest( > urb, > sizeof(struct > _URB_BULK_OR_INTERRUPT_TRANSFER), > pipeInformation->PipeHandle, > NULL, > mdl1, > Length * 2, > urbFlags, > NULL); > > nextStack = IoGetNextIrpStackLocation(Irp); > nextStack->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL; > nextStack->Parameters.Others.Argument1 = (PVOID) urb; > nextStack->Parameters.DeviceIoControl.IoControlCode = > IOCTL_INTERNAL_USB_SUBMIT_URB; > > IoSetCompletionRoutine(Irp, > CompletionRoutine, > devExt, > TRUE, > TRUE, > TRUE); > > IoMarkIrpPending(Irp); > > status = IoCallDriver(deviceExt->TopOfStackDeviceObject, > Irp); > if(!NT_SUCCESS(status)) { > return status; > } > > return STATUS_PENDING; > > }
From: uba on 1 Mar 2010 21:13 > USB does not support MDL chains in URBs > Thanks for the reply. Then how do I manage two DMA non continuous buffers in USB. How can I build a URB out of these two buffers. Is there any other alternative.
From: Scott Noone on 1 Mar 2010 21:49 Two IRPs with two URBs. You can create a context structure with a count in it to pass as your completion context and decrement the count in the completion routine (with an interlocked operation, of course). When the count goes to zero your transfer is done. Where are you getting these buffers from in the first place? -scott -- Scott Noone Consulting Associate OSR Open Systems Resources, Inc. http://www.osronline.com "uba" <kid07.uba(a)gmail.com> wrote in message news:4c5dbc31-df13-4d2b-bf9d-76b739b73b2d(a)c34g2000pri.googlegroups.com... > >> USB does not support MDL chains in URBs >> > > Thanks for the reply. > > Then how do I manage two DMA non continuous buffers in USB. How can I > build a URB out of these two buffers. Is there any other alternative.
|
Next
|
Last
Pages: 1 2 Prev: Scatter gather list in SCSI miniport driver Next: How to run MultiDigiMon.exe ? |