On Fri, 8 Aug 2003, David Brownell wrote:

> Alan Stern wrote:
> > David:
> > 
> > This question is somewhat theoretical; I don't expect it to come up.  But
> > I'm curious.
> > 
> > Do the slave controller drivers maintain message boundaries for bulk-out 
> > endpoints, even if the gadget's request size doesn't match the host's 
> > packet size?  
> 
> Yes, modulo overflows and hardware mis-designs.

<snip>

> USB talks in terms of packets, and that's how both host and device
> side APIs talk.  If you want to accomodate the two sides disagreeing
> on how much data is sent, then each side needs to avoid issuing short
> reads ... and have some strategy for coping with that disagreement.

Like I said, the question was theoretical.  The reason for it has to do
with efficient buffering.  The host sends out messages composed of
sectors, each 512 bytes, starting at an arbitrary sector number.  But the
slave wants its buffer to contain sector numbers aligned at a page
boundary (multiple of 4K).  Since the USB bulk data transfer is just a
stream, the simplest way to get the desired alignment is make the first
request be for just enough sectors to reach a page boundary, then make
subsequent requests fill the entire buffer.

So long as the maxpacket size divides the sector size, this scheme ought 
to work okay.  Fortunately, the gadget driver is in charge of the 
maxpacket value.  I assume anything <= the controller's limit will be 
acceptable.

Alan Stern



-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to