On Sat, 12 May 2007, Pete Zaitcev wrote:

> On Fri, 11 May 2007 23:23:18 -0700, Greg KH <[EMAIL PROTECTED]> wrote:
> 
> > I thought that you needed to do something with this value pretty
> > quickly, and that by the time you were able to send something back into
> > the kernel, the value would be not correct anymore.  But if this is
> > really just like a timestamp, then ok, I have no objection other than it
> > needs to be correct for all host controllers.
> 
> Greg, I'm sorry if I'm wrong, but it looks you missed the funny part.
> Danny's device remembers the value that HC circulated in the SOF frame.
> It then supplies that value alongside some data it returns. By reading
> the "current" frame number from HC, Danny's application can tell
> how many frames back, approximately, these data were generated
> (this is not the time when it was transferred across USB).
> 
> The gettimeofday or other kernel-known timestamp is not good enough,
> because the device does not know it. Actually, I think that a clever
> design would set an interrupt-out transfer with software initiated
> timestamp, which would not depend on HC implementing SOF number
> as a monotonously increasing counter (I think, it's not guaranteed).
> Oh well.

In fact the USB spec does anticipate that people will want to use the SOF
values for timing and synchronization, and it goes to great length
explaining ways in which that can be done.  Timing of the SOF is more
reliable than interrupt URBs, because the SOF is guaranteed to be the
first transaction in each frame (and also because interrupt-out transfers
will be retried in another frame if they fail).

The frame numbers are guaranteed to be monotonically increasing until they
roll over from 2047 to 0 (see 8.3.3, 8.4.3, and 10.2.3 in the USB spec).

Alan Stern


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to