Hi Alan,
> > Hi,
> >
> > I'm currently coding a device driver for a high speed device.
> > Unfortunately,
> > the test have shown, that the transfer rate is real slow.
> >
> > The code is as follows:
> >
> > urb = usb_alloc_urb( 0, GFP_KERNEL );
> > .....
> > usb_fill_bulk_urb( urb, usb_dev, pipe, data, len,
> > wcam_usb_api_blocking_completion, context
);
> > init_completion( &sbuf->done );
> > .....
> > urb->actual_length = 0;
> > status = usb_submit_urb(urb, GFP_ATOMIC);
> > .....
> > if ( status == 0 )
> > {
> >
> > wait_for_completion( &sbuf->done );
> >
> > }
> >
> > The memory to transfer is 307200 Bytes, the enpoint transfers up to
320
> > Byte.
> > BTW, is it possible to increase the Bulk transfersize beyond the 512
Bytes
> > ?
> Your question isn't clear. No, it's not possible for bulk endpoints to
> transfer more than 512 bytes per packet. Yes, it is possible for
> urb->transfer_length to be larger than 512 (the host controller driver
> will divide the data up into packets).
> > Now, what I get is, that the completion handler is called 960 times in
120
> > ms, which means
> > that the driver uses a single microframe to transfer 320 Bytes.
> I don't understand. The code above calls usb_submit_urb only once, so
the
> completion handler should be called only once. Not 960 times.
The urb is submitted again in the completion handler. If I understood
correctly, the completion
handler should be called once, when the transfer is completed.
static void wcam_usb_api_blocking_completion( struct urb *urb, struct
pt_regs *regs )
{
int nLength = urb->actual_length;
int nBufferSize = urb->transfer_buffer_length;
struct wcam_sbuf* sbuf = ( struct wcam_sbuf* ) urb->context;
PDEBUG (1,"Transferred %d Bytes of %d Bytes",nLength,nBufferSize);
if ( urb->status &&
!( urb->status == -ENOENT || urb->status == -ECONNRESET ||
urb->status == -ESHUTDOWN ) )
{
err( "ERROR: nRetVal=%d: %s", urb->status,
symbolic( m_stUrbErrorTextList, urb->status ) );
complete( &sbuf->done );
return ;
}
nBufferSize -= nLength;
urb->transfer_buffer_length = nBufferSize;
// Transferred all the data
if ( nBufferSize <= 0 )
{
complete( &sbuf->done );
return ;
}
urb->transfer_buffer += nLength;
/* Resubmit urb for new data */
urb->status = 0;
if ( usb_submit_urb(urb, GFP_ATOMIC) )
PDEBUG ( 0, "urb burned down in video irq" );
return ;
}
In my case I did it this way, because the completion handler was called
after 125 us and filled only 320 of 307200Bytes.
So I had no other choice, than to resubmit the urb.
I don't know why, the device did the transfer this way.
> > So my question is: How do I have to configure the bulk transfer to get
the
> > maximum speed ?
> In your code above, store all 307200 bytes in data and set len to
307200.
That was my very first approach.
Franz
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-users