On Tue, 20 Apr 2004, Johannes Erdfelt wrote:

> On Tue, Apr 20, 2004, David Brownell <[EMAIL PROTECTED]> wrote:
> > Johannes Erdfelt wrote:
> > >
> > >Be careful. You can't modify certain values of the QH while it's on the
> > >schedule safely. ...
> > 
> > But it's possible to use the "dummy TD" approach even with UHCI;
> > just leave the last TD disabled until you need to fill it out as
> > the first TD for a new URB.  No need to write the QH, just TDs.
> 
> It's dangerous to do so. The status/control fields of the TD are R/W by
> the HC and if it's in the schedule, you have to assume that the HC is
> writing to those fields, even if the TD is not active.
> 
> Atleast, that is the behaviour I saw when I tried doing something
> similar a long time and it agrees with the specs AFAICT.
> 
> However, using a QH per URB does work and isn't that much more
> complicated.

Actually a recent patch does safely modify QHs while they're on the 
schedule.  In fact, it was the patch that introduced the two errors -- I 
was so concerned about the hardware interaction that I didn't spend enough 
time checking for ordinary software bugs!

The reason it's safe is simple enough.  The controller _only_ updates the 
QH element pointer when the advance criterion is satisfied; the 
documentation is very clear on this point.  When a TD is inactive, for any 
reason, it can't advance.  Hence an element pointer that points to an 
inactive TD can safely be modified.  In the case of that earlier patch, 
the TD was inactive because it had SPD set and it got a short packet in a 
control-in transfer.  The element pointer is updated to the final status 
TD directly, finishing the transfer with no need to allocate an extra QH.

You're right, though, that I wouldn't want to write to a TD while it's on 
the schedule.

Alan Stern



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to