On Fri, 3 Jun 2011, Soho Soho123 wrote: > Dear Alan, > > > my question: > when uvc driver submit new urb, in iso_stream_schedule calculate > starting microframe for new urb, the location maybe in next round of > periodic list. then how to process this condition? That's why iso_stream_schedule uses "& (mod - 1)" so much. > in this condition, the location of "now" may after starting microframe > of new urb, right? Yes. Here's an example. Suppose the mod is 4096, now and next are both 4000, period is 1, and stream->next_uframe is 20. Then we calculate: excess = (stream->next_uframe - period - next) & (mod - 1); or excess = (20 - 1 - 4000) & (4095) = 115, which means that the last slot in use is 115 microframes in the future. Since 115 < mod - 2 * SCHEDULE_SLOP = 3936, the subroutine calculates: start = next + excess + period; or start = 4000 + 115 + 1 = 4116. Finally we do: stream->next_uframe = start & (mod - 1); /* report high speed start in uframes; full speed, in frames */ urb->start_frame = stream->next_uframe; which computes: urb->start_frame = stream->next_uframe = 4116 & 4095 = 20, which is the correct starting microframe for this URB. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html