// adjust start_frame according to scheduling constraints (ASAP etc)
_static int iso_find_start (urb_t *urb)
{
uhci_t *s = (uhci_t*) urb->dev->bus->hcpriv;
unsigned int now;
unsigned int start_limit = 0, stop_limit = 0, queued_size;
int limits;
now = UHCI_GET_CURRENT_FRAME (s) & 1023;
if ((unsigned) urb->number_of_packets > 900)
return -EFBIG;
limits = find_iso_limits (urb, &start_limit, &stop_limit);
queued_size = (stop_limit - start_limit) & 1023;
if (urb->transfer_flags & USB_ISO_ASAP) {
// first iso
if (limits) {
// 10ms setup should be enough //FIXME!
urb->start_frame = (now + 10) & 1023;
}
else {
urb->start_frame = stop_limit; //seamless linkage
if (((now - urb->start_frame) & 1023) <= (unsigned) urb->number_of_packets) {
info("iso_find_start: gap in seamless isochronous scheduling");
dbg("iso_find_start: now %u start_frame %u number_of_packets %u pipe 0x%08x",
now, urb->start_frame, urb->number_of_packets, urb->pipe);
urb->start_frame = (now + 5) & 1023; // 5ms setup should be enough //FIXME!
}
}
}
else {