From: gti4ever on 16 Dec 2009 17:58 Hi there, I am working on a new driver based on DDK usbsamp sample. I created a read thread for reading the isochronous data from my USB device. In my read thread, I have created a new request and memory object, then I use WdfIoTargetFormatARequestForRead to format the request. After this, I called the usbsamp PerformHighSpeedIsochTransfer() function to read the iso data. Everything seems to be fine until the WdfRequestRetrieveOutputWdmMdl() is called. No matter what I do, it always return 0xc0000023 (STATUS_BUFFER_TOO_SMALL). Following is the code that I used to create the new request: WDF_OBJECT_ATTRIBUTES_INIT(&attributes); WDF_OBJECT_ATTRIBUTES_SET_CONTEXT_TYPE( &attributes, REQUEST_CONTEXT ); attributes.ParentObject = devExt->Device; status = WdfRequestCreate( &attributes, WdfUsbTargetDeviceGetIoTarget(devExt->WdfUsbTargetDevice), &newRequest); if(!NT_SUCCESS(status)) { UsbSamp_DbgPrint(1, ("WdfRequestreate failed to create a new request %x!\n", status)); return; } WDF_OBJECT_ATTRIBUTES_INIT(&attributes); attributes.ParentObject = newRequest; status = WdfMemoryCreate( &attributes, NonPagedPool, 'TSET', 614400, &memory, NULL); // buffer pointer if (!NT_SUCCESS(status)) { UsbSamp_DbgPrint(1,("WdfMemoryCreate failed 0x%x\n", status)); return; } status = WdfIoTargetFormatRequestForRead( WdfUsbTargetDeviceGetIoTarget(devExt->WdfUsbTargetDevice), newRequest, memory, NULL, // Buffer offset NULL); // OutputBufferOffset if (!NT_SUCCESS(status)) { UsbSamp_DbgPrint(1,("WdfIoTargetFormatRequestForRead failed 0x%x\n", status)); return; } PerformHighSpeedIsochTransfer(devExt->Device,newRequest,614400,WdfRequestTypeRead); Is the above code correct? What will be the cause of the 0xc0000023 error? Thanks a lot. G
From: Doron Holan [MSFT] on 16 Dec 2009 18:36 WdfRequestRetrieveOutputWdmMdl only works for requests presented to you via a WDFQUEUE. it does not work with requests you create yourself (because there is no current stack location which is formatted) -- This posting is provided "AS IS" with no warranties, and confers no rights. "gti4ever" <gti4ever(a)discussions.microsoft.com> wrote in message news:F09AD2C6-EC7C-4A3D-9249-0D3641EEAADD(a)microsoft.com... > Hi there, > > I am working on a new driver based on DDK usbsamp sample. I created a read > thread for reading the isochronous data from my USB device. > > In my read thread, I have created a new request and memory object, then I > use WdfIoTargetFormatARequestForRead to format the request. After this, I > called the usbsamp PerformHighSpeedIsochTransfer() function to read the > iso > data. > > Everything seems to be fine until the WdfRequestRetrieveOutputWdmMdl() is > called. No matter what I do, it always return 0xc0000023 > (STATUS_BUFFER_TOO_SMALL). > > Following is the code that I used to create the new request: > > WDF_OBJECT_ATTRIBUTES_INIT(&attributes); > WDF_OBJECT_ATTRIBUTES_SET_CONTEXT_TYPE( > &attributes, > REQUEST_CONTEXT > ); > attributes.ParentObject = devExt->Device; > > status = WdfRequestCreate( > &attributes, > WdfUsbTargetDeviceGetIoTarget(devExt->WdfUsbTargetDevice), > &newRequest); > > if(!NT_SUCCESS(status)) { > UsbSamp_DbgPrint(1, ("WdfRequestreate failed to create a new > request > %x!\n", status)); > return; > } > > WDF_OBJECT_ATTRIBUTES_INIT(&attributes); > attributes.ParentObject = newRequest; > status = WdfMemoryCreate( > &attributes, > NonPagedPool, > 'TSET', > 614400, > &memory, > NULL); // buffer pointer > > if (!NT_SUCCESS(status)) { > UsbSamp_DbgPrint(1,("WdfMemoryCreate failed 0x%x\n", status)); > return; > } > > status = WdfIoTargetFormatRequestForRead( > > WdfUsbTargetDeviceGetIoTarget(devExt->WdfUsbTargetDevice), > newRequest, > memory, > NULL, // Buffer offset > NULL); // OutputBufferOffset > if (!NT_SUCCESS(status)) { > UsbSamp_DbgPrint(1,("WdfIoTargetFormatRequestForRead failed > 0x%x\n", > status)); > return; > } > > PerformHighSpeedIsochTransfer(devExt->Device,newRequest,614400,WdfRequestTypeRead); > > Is the above code correct? What will be the cause of the 0xc0000023 error? > > Thanks a lot. > > G >
From: gti4ever on 16 Dec 2009 19:26 Thanks Doron, that make sense. My question now is: in this case, what should I do in order to read iso pipe from a read thread? I am just trying to implement something like the continuous reader for BULK and INT pipe. Frank. "Doron Holan [MSFT]" wrote: > WdfRequestRetrieveOutputWdmMdl only works for requests presented to you via > a WDFQUEUE. it does not work with requests you create yourself (because > there is no current stack location which is formatted) > >
From: Doron Holan [MSFT] on 17 Dec 2009 12:56 format the request, send it down and set the WDFMEMORY you are using in the read as the context for your io completion routine d -- This posting is provided "AS IS" with no warranties, and confers no rights. "gti4ever" <gti4ever(a)discussions.microsoft.com> wrote in message news:E2B28013-C677-4F2A-AF6D-979159CF1EBC(a)microsoft.com... > Thanks Doron, that make sense. > > My question now is: in this case, what should I do in order to read iso > pipe > from a read thread? I am just trying to implement something like the > continuous reader for BULK and INT pipe. > > Frank. > > > > > > "Doron Holan [MSFT]" wrote: > >> WdfRequestRetrieveOutputWdmMdl only works for requests presented to you >> via >> a WDFQUEUE. it does not work with requests you create yourself (because >> there is no current stack location which is formatted) >> >> >
From: gti4ever on 6 Jan 2010 10:43
Hi Doron, I have implemented the iso continuous reader by issueing multipe read requests and resending the request inside the completion routine. Now I have another question: In my completion routine, I copy all the data acquired to a buffer in my device context. When the read request comes, it will just read back the data in that buffer. What kind of synchronization technique should I use to make sure I don't read the data from the buffer when my completion routine is updating it? I checked both waitlock and spinlock and found waitlock is only for PASSIVE_LEVEL and spinlock is for DISPATCH_LEVEL or higher. Is there anything else that I can use to sync between the IoRead and DPC (completion routine)? Thanks. G. "Doron Holan [MSFT]" wrote: > format the request, send it down and set the WDFMEMORY you are using in the > read as the context for your io completion routine > > d > > -- > > This posting is provided "AS IS" with no warranties, and confers no rights. > > > "gti4ever" <gti4ever(a)discussions.microsoft.com> wrote in message > news:E2B28013-C677-4F2A-AF6D-979159CF1EBC(a)microsoft.com... > > Thanks Doron, that make sense. > > > > My question now is: in this case, what should I do in order to read iso > > pipe > > from a read thread? I am just trying to implement something like the > > continuous reader for BULK and INT pipe. > > > > Frank. > > > > > > > > > > > > "Doron Holan [MSFT]" wrote: > > > >> WdfRequestRetrieveOutputWdmMdl only works for requests presented to you > >> via > >> a WDFQUEUE. it does not work with requests you create yourself (because > >> there is no current stack location which is formatted) > >> > >> > > > . > |