I’ve run into a problem with Isoch transfers, I think it may be related to my lack of understanding of part of the WDF documentation.
In the “USB Isochronous Transfer Page” sample code is provided showing how to implement the transfer (below).
My question is what is the difference between the ULONG “UrbSize” and “size” and how is “size” calculated?
Chris
#define NUMBER_OF_PACKETS 10
#define PACKET_SIZE 16
ULONG UrbSize, size;
PURB pUrb;
UrbSize = GET_ISO_URB_SIZE(NUMBER_OF_PACKETS);
size = (assign the length in bytes of the entire URB structure)
pUrb = (PURB) ExAllocatePool(NonPagedPool, UrbSize);
pUrb->UrbIsochronousTransfer.Hdr.Length = size;
pUrb->UrbIsochronousTransfer.Hdr.Function = URB_FUNCTION_ISOCH_TRANSFER;
pUrb->PipeHandle = PipeHandle;
.
.
.
pUrb->UrbIsochronousTransfer.NumberOfPackets = NUMBER_OF_PACKETS;
ULONG i;
for (i = 0; i<number_of_packets i> pUrb->UrbIsochronousTransfer.IsoPacket[i].Offset = i*PACKET_SIZE;
pUrb->UrbIsochronousTransfer.IsoPacket[i].Length = PACKET_SIZE;
}</number_of_packets>