int ehci_poll_intr(struct usb_pipe *p, void *data) { ASSERT16(); if (! CONFIG_USB_EHCI) return -1; struct ehci_pipe *pipe = container_of(p, struct ehci_pipe, pipe); struct ehci_qtd *td = GET_LOWFLAT(pipe->next_td); u32 token = GET_LOWFLAT(td->token); if (token & QTD_STS_ACTIVE) // No intrs found. return -1; // XXX - check for errors. // Copy data. int maxpacket = GET_LOWFLAT(pipe->pipe.maxpacket); int pos = td - GET_LOWFLAT(pipe->tds); void *tddata = GET_LOWFLAT(pipe->data) + maxpacket * pos; memcpy_far(GET_SEG(SS), data, SEG_LOW, LOWFLAT2LOW(tddata), maxpacket); // Reenable this td. struct ehci_qtd *next = (void*)(GET_LOWFLAT(td->qtd_next) & ~EHCI_PTR_BITS); SET_LOWFLAT(pipe->next_td, next); SET_LOWFLAT(td->buf[0], (u32)tddata); barrier(); SET_LOWFLAT(td->token, (ehci_explen(maxpacket) | QTD_STS_ACTIVE | QTD_PID_IN | ehci_maxerr(3))); return 0; }
// Execute a "disk_op_s" request (using the extra 16bit stack). static int send_disk_op(struct disk_op_s *op) { ASSERT16(); if (! CONFIG_DRIVES) return -1; if (!CONFIG_ENTRY_EXTRASTACK) // Jump on to extra stack return stack_hop(__send_disk_op, op, GET_SEG(SS)); return process_op(op); }
int usb_poll_intr(struct usb_pipe *pipe_fl, void *data) { ASSERT16(); switch (GET_LOWFLAT(pipe_fl->type)) { default: case USB_TYPE_UHCI: return uhci_poll_intr(pipe_fl, data); case USB_TYPE_OHCI: return ohci_poll_intr(pipe_fl, data); case USB_TYPE_EHCI: return ehci_poll_intr(pipe_fl, data); case USB_TYPE_XHCI: ; return call32_params(xhci_poll_intr, pipe_fl , MAKE_FLATPTR(GET_SEG(SS), data), 0, -1); } }
int usb_poll_intr(struct usb_pipe *pipe_fl, void *data) { ASSERT16(); switch (GET_LOWFLAT(pipe_fl->type)) { default: case USB_TYPE_UHCI: return uhci_poll_intr(pipe_fl, data); case USB_TYPE_OHCI: return ohci_poll_intr(pipe_fl, data); case USB_TYPE_EHCI: return ehci_poll_intr(pipe_fl, data); case USB_TYPE_XHCI: ; extern void _cfunc32flat_xhci_poll_intr(void); return call32_params(_cfunc32flat_xhci_poll_intr, (u32)pipe_fl , (u32)MAKE_FLATPTR(GET_SEG(SS), (u32)data), 0, -1); } }
int ohci_poll_intr(struct usb_pipe *pipe, void *data) { ASSERT16(); if (! CONFIG_USB_OHCI) return -1; struct ohci_pipe *p = container_of(pipe, struct ohci_pipe, pipe); struct ohci_td *tds = GET_FLATPTR(p->tds); struct ohci_td *head = (void*)GET_FLATPTR(p->ed.hwHeadP); struct ohci_td *tail = (void*)GET_FLATPTR(p->ed.hwTailP); int count = GET_FLATPTR(p->count); int pos = (tail - tds + 1) % count; struct ohci_td *next = &tds[pos]; if (head == next) // No intrs found. return -1; // XXX - check for errors. // Copy data. u32 endp = GET_FLATPTR(p->pipe.endp); int maxpacket = endp2maxsize(endp); void *pipedata = GET_FLATPTR(p->data); void *intrdata = pipedata + maxpacket * pos; memcpy_far(GET_SEG(SS), data , FLATPTR_TO_SEG(intrdata), (void*)FLATPTR_TO_OFFSET(intrdata) , maxpacket); // Reenable this td. SET_FLATPTR(tail->hwINFO, TD_DP_IN | TD_T_TOGGLE | TD_CC); intrdata = pipedata + maxpacket * (tail-tds); SET_FLATPTR(tail->hwCBP, (u32)intrdata); SET_FLATPTR(tail->hwNextTD, (u32)next); SET_FLATPTR(tail->hwBE, (u32)intrdata + maxpacket - 1); SET_FLATPTR(p->ed.hwTailP, (u32)next); return 0; }