On Wed, 7 Mar 2007, Ajay Jain wrote:

> Hello,
> 
> We had the following questions for a peripheral controller driver. We
> do have an idea about some of the answers, evidently our understanding
> is not complete.
> 
> 1. The gadget can ask the peripheral controller to send/receive zero
> byte packets. Consider the following sub-cases:
>         a) req.zero : When set we have to send zero byte packet.

That's not quite true.  If req.zero is set, the peripheral needs to send a
zero-length packet only if req.length is > 0 and is a multiple of the
maxpacket size.

>         b) Similarly, when req.length = 0, zero length packets, have
> to be sent/rcvd.
> Why do have both of these, why a duplication ?

The duplication makes it easier for gadget drivers.  Sending a zero-length
packet when a message is an exact multiple of the maxpacket size is fairly
common.  With req.zero, the work has to be done in only one place (the
peripheral controller driver) instead of in many places (all the gadget
drivers).

>  Is it possible that we
> have a length set to some value and a req.zero also set ?

Yes.  How could you ever have a length not set to any value? :-)

> 2. During a bulk xaction, if the size of transfer is equal to the max
> packet size, then will the gadget queue a zero byte packet.

No.  That's what req.zero is for.

>  Or is it
> the peripheral's driver responsibility to send a zero byte packet.

If req.zero is set, then yes.  If req.zero isn't set, then no.

>  If
> the former is a yes, then how is it accomplished ? Is a req.zero set
> or length = 0 ?

req.zero will be set.

> 3. Do I have a request form the upper layer for a zero byte packet,
> for a control xfer when the data stage is an 'OUT' stage ?

By "upper layer", you must mean the gadget driver.  The answer is No.  
For OUT transfers with a non-empty data stage, the gadget driver will
submit a request for the data stage and will not submit a request for the
status stage.  The controller driver has to handle the status stage
automatically.

For OUT transfers with no data stage, the gadget driver will submit a 
request with req.length = 0.

>  If yes, why
> ?
> 
> 4. Why use alloc_buffer call? I am not interested in doing any DMA.
> This DMA is between what & what? Who uses these buffers ?

The DMA is between main memory and the peripheral controller.  Some
controllers use DMA to transfer data from memory to the USB bus (and vice 
versa).  Other controllers don't use DMA, but gadget drivers should always 
call alloc_buffer so that they will work correctly with all peripheral 
controllers.

Alan Stern


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to