Rename usb pipes to endpoints as it better represents what they are, and struct

usb_pipe may be used for a different purpose later on.
This commit is contained in:
Andrew Thompson 2009-06-07 19:41:11 +00:00
parent 0a2e596a93
commit ae60fdfba2
28 changed files with 628 additions and 627 deletions

View File

@ -520,7 +520,7 @@ usbd_func_selconf(ip)
int i, j;
struct ndis_softc *sc = device_get_softc(dev);
struct usb_device *udev = sc->ndisusb_dev;
struct usb_pipe *p = NULL;
struct usb_endpoint *ep = NULL;
struct usbd_interface_information *intf;
struct usbd_pipe_information *pipe;
struct usbd_urb_select_configuration *selconf;
@ -549,14 +549,14 @@ usbd_func_selconf(ip)
return usbd_usb2urb(ret);
}
for (j = 0; (p = usb2_pipe_foreach(udev, p)); j++) {
for (j = 0; (ep = usb2_endpoint_foreach(udev, ep)); j++) {
if (j >= intf->uii_numeps) {
device_printf(dev,
"endpoint %d and above are ignored",
intf->uii_numeps);
break;
}
edesc = p->edesc;
edesc = ep->edesc;
pipe = &intf->uii_pipes[j];
pipe->upi_handle = edesc;
pipe->upi_epaddr = edesc->bEndpointAddress;

View File

@ -687,7 +687,7 @@ at91dci_xfer_do_fifo(struct usb_xfer *xfer)
done:
sc = AT9100_DCI_BUS2SC(xfer->xroot->bus);
temp = (xfer->endpoint & UE_ADDR);
temp = (xfer->endpointno & UE_ADDR);
/* update FIFO bank flag and multi buffer */
if (td->fifo_bank) {
@ -864,7 +864,7 @@ at91dci_setup_standard_chain(struct usb_xfer *xfer)
uint8_t need_sync;
DPRINTFN(9, "addr=%d endpt=%d sumlen=%d speed=%d\n",
xfer->address, UE_GET_ADDR(xfer->endpoint),
xfer->address, UE_GET_ADDR(xfer->endpointno),
xfer->sumlen, usb2_get_speed(xfer->xroot->udev));
temp.max_frame_size = xfer->max_frame_size;
@ -882,7 +882,7 @@ at91dci_setup_standard_chain(struct usb_xfer *xfer)
temp.did_stall = !xfer->flags_int.control_stall;
sc = AT9100_DCI_BUS2SC(xfer->xroot->bus);
ep_no = (xfer->endpoint & UE_ADDR);
ep_no = (xfer->endpointno & UE_ADDR);
/* check if we should prepend a setup message */
@ -908,7 +908,7 @@ at91dci_setup_standard_chain(struct usb_xfer *xfer)
}
if (x != xfer->nframes) {
if (xfer->endpoint & UE_DIR_IN) {
if (xfer->endpointno & UE_DIR_IN) {
temp.func = &at91dci_data_tx;
need_sync = 1;
} else {
@ -984,7 +984,7 @@ at91dci_setup_standard_chain(struct usb_xfer *xfer)
* Send a DATA1 message and invert the current
* endpoint direction.
*/
if (xfer->endpoint & UE_DIR_IN) {
if (xfer->endpointno & UE_DIR_IN) {
temp.func = &at91dci_data_rx;
need_sync = 0;
} else {
@ -1034,7 +1034,7 @@ at91dci_start_standard_chain(struct usb_xfer *xfer)
if (at91dci_xfer_do_fifo(xfer)) {
struct at91dci_softc *sc = AT9100_DCI_BUS2SC(xfer->xroot->bus);
uint8_t ep_no = xfer->endpoint & UE_ADDR;
uint8_t ep_no = xfer->endpointno & UE_ADDR;
/*
* Only enable the endpoint interrupt when we are actually
@ -1139,8 +1139,8 @@ at91dci_standard_done(struct usb_xfer *xfer)
{
usb_error_t err = 0;
DPRINTFN(13, "xfer=%p pipe=%p transfer done\n",
xfer, xfer->pipe);
DPRINTFN(13, "xfer=%p endpoint=%p transfer done\n",
xfer, xfer->endpoint);
/* reset scanner */
@ -1191,11 +1191,11 @@ at91dci_device_done(struct usb_xfer *xfer, usb_error_t error)
USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED);
DPRINTFN(2, "xfer=%p, pipe=%p, error=%d\n",
xfer, xfer->pipe, error);
DPRINTFN(2, "xfer=%p, endpoint=%p, error=%d\n",
xfer, xfer->endpoint, error);
if (xfer->flags_int.usb_mode == USB_MODE_DEVICE) {
ep_no = (xfer->endpoint & UE_ADDR);
ep_no = (xfer->endpointno & UE_ADDR);
/* disable endpoint interrupt */
AT91_UDP_WRITE_4(sc, AT91_UDP_IDR, AT91_UDP_INT_EP(ep_no));
@ -1208,7 +1208,7 @@ at91dci_device_done(struct usb_xfer *xfer, usb_error_t error)
static void
at91dci_set_stall(struct usb_device *udev, struct usb_xfer *xfer,
struct usb_pipe *pipe)
struct usb_endpoint *ep)
{
struct at91dci_softc *sc;
uint32_t csr_val;
@ -1216,7 +1216,7 @@ at91dci_set_stall(struct usb_device *udev, struct usb_xfer *xfer,
USB_BUS_LOCK_ASSERT(udev->bus, MA_OWNED);
DPRINTFN(5, "pipe=%p\n", pipe);
DPRINTFN(5, "endpoint=%p\n", ep);
if (xfer) {
/* cancel any ongoing transfers */
@ -1224,7 +1224,7 @@ at91dci_set_stall(struct usb_device *udev, struct usb_xfer *xfer,
}
/* set FORCESTALL */
sc = AT9100_DCI_BUS2SC(udev->bus);
csr_reg = (pipe->edesc->bEndpointAddress & UE_ADDR);
csr_reg = (ep->edesc->bEndpointAddress & UE_ADDR);
csr_reg = AT91_UDP_CSR(csr_reg);
csr_val = AT91_UDP_READ_4(sc, csr_reg);
AT91_CSR_ACK(csr_val, AT91_UDP_CSR_FORCESTALL);
@ -1328,12 +1328,12 @@ at91dci_clear_stall_sub(struct at91dci_softc *sc, uint8_t ep_no,
}
static void
at91dci_clear_stall(struct usb_device *udev, struct usb_pipe *pipe)
at91dci_clear_stall(struct usb_device *udev, struct usb_endpoint *ep)
{
struct at91dci_softc *sc;
struct usb_endpoint_descriptor *ed;
DPRINTFN(5, "pipe=%p\n", pipe);
DPRINTFN(5, "endpoint=%p\n", ep);
USB_BUS_LOCK_ASSERT(udev->bus, MA_OWNED);
@ -1346,7 +1346,7 @@ at91dci_clear_stall(struct usb_device *udev, struct usb_pipe *pipe)
sc = AT9100_DCI_BUS2SC(udev->bus);
/* get endpoint descriptor */
ed = pipe->edesc;
ed = ep->edesc;
/* reset endpoint */
at91dci_clear_stall_sub(sc,
@ -1598,7 +1598,7 @@ at91dci_device_isoc_fs_enter(struct usb_xfer *xfer)
uint32_t nframes;
DPRINTFN(6, "xfer=%p next=%d nframes=%d\n",
xfer, xfer->pipe->isoc_next, xfer->nframes);
xfer, xfer->endpoint->isoc_next, xfer->nframes);
/* get the current frame index */
@ -1608,25 +1608,25 @@ at91dci_device_isoc_fs_enter(struct usb_xfer *xfer)
* check if the frame index is within the window where the frames
* will be inserted
*/
temp = (nframes - xfer->pipe->isoc_next) & AT91_UDP_FRM_MASK;
temp = (nframes - xfer->endpoint->isoc_next) & AT91_UDP_FRM_MASK;
if ((xfer->pipe->is_synced == 0) ||
if ((xfer->endpoint->is_synced == 0) ||
(temp < xfer->nframes)) {
/*
* If there is data underflow or the pipe queue is
* If there is data underflow or the endpoint queue is
* empty we schedule the transfer a few frames ahead
* of the current frame position. Else two isochronous
* transfers might overlap.
*/
xfer->pipe->isoc_next = (nframes + 3) & AT91_UDP_FRM_MASK;
xfer->pipe->is_synced = 1;
DPRINTFN(3, "start next=%d\n", xfer->pipe->isoc_next);
xfer->endpoint->isoc_next = (nframes + 3) & AT91_UDP_FRM_MASK;
xfer->endpoint->is_synced = 1;
DPRINTFN(3, "start next=%d\n", xfer->endpoint->isoc_next);
}
/*
* compute how many milliseconds the insertion is ahead of the
* current frame position:
*/
temp = (xfer->pipe->isoc_next - nframes) & AT91_UDP_FRM_MASK;
temp = (xfer->endpoint->isoc_next - nframes) & AT91_UDP_FRM_MASK;
/*
* pre-compute when the isochronous transfer will be finished:
@ -1636,7 +1636,7 @@ at91dci_device_isoc_fs_enter(struct usb_xfer *xfer)
xfer->nframes;
/* compute frame number for next insertion */
xfer->pipe->isoc_next += xfer->nframes;
xfer->endpoint->isoc_next += xfer->nframes;
/* setup TDs */
at91dci_setup_standard_chain(xfer);
@ -2208,7 +2208,7 @@ at91dci_xfer_setup(struct usb_setup_params *parm)
*/
if (ntd) {
ep_no = xfer->endpoint & UE_ADDR;
ep_no = xfer->endpointno & UE_ADDR;
at91dci_get_hw_ep_profile(parm->udev, &pf, ep_no);
if (pf == NULL) {
@ -2258,13 +2258,13 @@ at91dci_xfer_unsetup(struct usb_xfer *xfer)
}
static void
at91dci_pipe_init(struct usb_device *udev, struct usb_endpoint_descriptor *edesc,
struct usb_pipe *pipe)
at91dci_ep_init(struct usb_device *udev, struct usb_endpoint_descriptor *edesc,
struct usb_endpoint *ep)
{
struct at91dci_softc *sc = AT9100_DCI_BUS2SC(udev->bus);
DPRINTFN(2, "pipe=%p, addr=%d, endpt=%d, mode=%d (%d)\n",
pipe, udev->address,
DPRINTFN(2, "endpoint=%p, addr=%d, endpt=%d, mode=%d (%d)\n",
ep, udev->address,
edesc->bEndpointAddress, udev->flags.usb_mode,
sc->sc_rt_addr);
@ -2280,16 +2280,16 @@ at91dci_pipe_init(struct usb_device *udev, struct usb_endpoint_descriptor *edesc
}
switch (edesc->bmAttributes & UE_XFERTYPE) {
case UE_CONTROL:
pipe->methods = &at91dci_device_ctrl_methods;
ep->methods = &at91dci_device_ctrl_methods;
break;
case UE_INTERRUPT:
pipe->methods = &at91dci_device_intr_methods;
ep->methods = &at91dci_device_intr_methods;
break;
case UE_ISOCHRONOUS:
pipe->methods = &at91dci_device_isoc_fs_methods;
ep->methods = &at91dci_device_isoc_fs_methods;
break;
case UE_BULK:
pipe->methods = &at91dci_device_bulk_methods;
ep->methods = &at91dci_device_bulk_methods;
break;
default:
/* do nothing */
@ -2300,7 +2300,7 @@ at91dci_pipe_init(struct usb_device *udev, struct usb_endpoint_descriptor *edesc
struct usb_bus_methods at91dci_bus_methods =
{
.pipe_init = &at91dci_pipe_init,
.endpoint_init = &at91dci_ep_init,
.xfer_setup = &at91dci_xfer_setup,
.xfer_unsetup = &at91dci_xfer_unsetup,
.get_hw_ep_profile = &at91dci_get_hw_ep_profile,

View File

@ -767,7 +767,7 @@ atmegadci_setup_standard_chain(struct usb_xfer *xfer)
uint8_t need_sync;
DPRINTFN(9, "addr=%d endpt=%d sumlen=%d speed=%d\n",
xfer->address, UE_GET_ADDR(xfer->endpoint),
xfer->address, UE_GET_ADDR(xfer->endpointno),
xfer->sumlen, usb2_get_speed(xfer->xroot->udev));
temp.max_frame_size = xfer->max_frame_size;
@ -785,7 +785,7 @@ atmegadci_setup_standard_chain(struct usb_xfer *xfer)
temp.did_stall = !xfer->flags_int.control_stall;
sc = ATMEGA_BUS2SC(xfer->xroot->bus);
ep_no = (xfer->endpoint & UE_ADDR);
ep_no = (xfer->endpointno & UE_ADDR);
/* check if we should prepend a setup message */
@ -811,7 +811,7 @@ atmegadci_setup_standard_chain(struct usb_xfer *xfer)
}
if (x != xfer->nframes) {
if (xfer->endpoint & UE_DIR_IN) {
if (xfer->endpointno & UE_DIR_IN) {
temp.func = &atmegadci_data_tx;
need_sync = 1;
} else {
@ -886,7 +886,7 @@ atmegadci_setup_standard_chain(struct usb_xfer *xfer)
* Send a DATA1 message and invert the current
* endpoint direction.
*/
if (xfer->endpoint & UE_DIR_IN) {
if (xfer->endpointno & UE_DIR_IN) {
temp.func = &atmegadci_data_rx;
need_sync = 0;
} else {
@ -1022,8 +1022,8 @@ atmegadci_standard_done(struct usb_xfer *xfer)
{
usb_error_t err = 0;
DPRINTFN(13, "xfer=%p pipe=%p transfer done\n",
xfer, xfer->pipe);
DPRINTFN(13, "xfer=%p endpoint=%p transfer done\n",
xfer, xfer->endpoint);
/* reset scanner */
@ -1074,11 +1074,11 @@ atmegadci_device_done(struct usb_xfer *xfer, usb_error_t error)
USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED);
DPRINTFN(9, "xfer=%p, pipe=%p, error=%d\n",
xfer, xfer->pipe, error);
DPRINTFN(9, "xfer=%p, endpoint=%p, error=%d\n",
xfer, xfer->endpoint, error);
if (xfer->flags_int.usb_mode == USB_MODE_DEVICE) {
ep_no = (xfer->endpoint & UE_ADDR);
ep_no = (xfer->endpointno & UE_ADDR);
/* select endpoint number */
ATMEGA_WRITE_1(sc, ATMEGA_UENUM, ep_no);
@ -1094,14 +1094,14 @@ atmegadci_device_done(struct usb_xfer *xfer, usb_error_t error)
static void
atmegadci_set_stall(struct usb_device *udev, struct usb_xfer *xfer,
struct usb_pipe *pipe)
struct usb_endpoint *ep)
{
struct atmegadci_softc *sc;
uint8_t ep_no;
USB_BUS_LOCK_ASSERT(udev->bus, MA_OWNED);
DPRINTFN(5, "pipe=%p\n", pipe);
DPRINTFN(5, "endpoint=%p\n", ep);
if (xfer) {
/* cancel any ongoing transfers */
@ -1109,7 +1109,7 @@ atmegadci_set_stall(struct usb_device *udev, struct usb_xfer *xfer,
}
sc = ATMEGA_BUS2SC(udev->bus);
/* get endpoint number */
ep_no = (pipe->edesc->bEndpointAddress & UE_ADDR);
ep_no = (ep->edesc->bEndpointAddress & UE_ADDR);
/* select endpoint number */
ATMEGA_WRITE_1(sc, ATMEGA_UENUM, ep_no);
/* set stall */
@ -1178,12 +1178,12 @@ atmegadci_clear_stall_sub(struct atmegadci_softc *sc, uint8_t ep_no,
}
static void
atmegadci_clear_stall(struct usb_device *udev, struct usb_pipe *pipe)
atmegadci_clear_stall(struct usb_device *udev, struct usb_endpoint *ep)
{
struct atmegadci_softc *sc;
struct usb_endpoint_descriptor *ed;
DPRINTFN(5, "pipe=%p\n", pipe);
DPRINTFN(5, "endpoint=%p\n", ep);
USB_BUS_LOCK_ASSERT(udev->bus, MA_OWNED);
@ -1196,7 +1196,7 @@ atmegadci_clear_stall(struct usb_device *udev, struct usb_pipe *pipe)
sc = ATMEGA_BUS2SC(udev->bus);
/* get endpoint descriptor */
ed = pipe->edesc;
ed = ep->edesc;
/* reset endpoint */
atmegadci_clear_stall_sub(sc,
@ -1415,7 +1415,7 @@ atmegadci_device_isoc_fs_enter(struct usb_xfer *xfer)
uint32_t nframes;
DPRINTFN(6, "xfer=%p next=%d nframes=%d\n",
xfer, xfer->pipe->isoc_next, xfer->nframes);
xfer, xfer->endpoint->isoc_next, xfer->nframes);
/* get the current frame index */
@ -1429,9 +1429,9 @@ atmegadci_device_isoc_fs_enter(struct usb_xfer *xfer)
* check if the frame index is within the window where the frames
* will be inserted
*/
temp = (nframes - xfer->pipe->isoc_next) & ATMEGA_FRAME_MASK;
temp = (nframes - xfer->endpoint->isoc_next) & ATMEGA_FRAME_MASK;
if ((xfer->pipe->is_synced == 0) ||
if ((xfer->endpoint->is_synced == 0) ||
(temp < xfer->nframes)) {
/*
* If there is data underflow or the pipe queue is
@ -1439,15 +1439,15 @@ atmegadci_device_isoc_fs_enter(struct usb_xfer *xfer)
* of the current frame position. Else two isochronous
* transfers might overlap.
*/
xfer->pipe->isoc_next = (nframes + 3) & ATMEGA_FRAME_MASK;
xfer->pipe->is_synced = 1;
DPRINTFN(3, "start next=%d\n", xfer->pipe->isoc_next);
xfer->endpoint->isoc_next = (nframes + 3) & ATMEGA_FRAME_MASK;
xfer->endpoint->is_synced = 1;
DPRINTFN(3, "start next=%d\n", xfer->endpoint->isoc_next);
}
/*
* compute how many milliseconds the insertion is ahead of the
* current frame position:
*/
temp = (xfer->pipe->isoc_next - nframes) & ATMEGA_FRAME_MASK;
temp = (xfer->endpoint->isoc_next - nframes) & ATMEGA_FRAME_MASK;
/*
* pre-compute when the isochronous transfer will be finished:
@ -1457,7 +1457,7 @@ atmegadci_device_isoc_fs_enter(struct usb_xfer *xfer)
xfer->nframes;
/* compute frame number for next insertion */
xfer->pipe->isoc_next += xfer->nframes;
xfer->endpoint->isoc_next += xfer->nframes;
/* setup TDs */
atmegadci_setup_standard_chain(xfer);
@ -2022,7 +2022,7 @@ atmegadci_xfer_setup(struct usb_setup_params *parm)
/*
* compute maximum number of TDs
*/
if ((xfer->pipe->edesc->bmAttributes & UE_XFERTYPE) == UE_CONTROL) {
if ((xfer->endpoint->edesc->bmAttributes & UE_XFERTYPE) == UE_CONTROL) {
ntd = xfer->nframes + 1 /* STATUS */ + 1 /* SYNC 1 */
+ 1 /* SYNC 2 */ ;
@ -2045,7 +2045,7 @@ atmegadci_xfer_setup(struct usb_setup_params *parm)
/*
* get profile stuff
*/
ep_no = xfer->endpoint & UE_ADDR;
ep_no = xfer->endpointno & UE_ADDR;
atmegadci_get_hw_ep_profile(parm->udev, &pf, ep_no);
if (pf == NULL) {
@ -2088,13 +2088,13 @@ atmegadci_xfer_unsetup(struct usb_xfer *xfer)
}
static void
atmegadci_pipe_init(struct usb_device *udev, struct usb_endpoint_descriptor *edesc,
struct usb_pipe *pipe)
atmegadci_ep_init(struct usb_device *udev, struct usb_endpoint_descriptor *edesc,
struct usb_endpoint *ep)
{
struct atmegadci_softc *sc = ATMEGA_BUS2SC(udev->bus);
DPRINTFN(2, "pipe=%p, addr=%d, endpt=%d, mode=%d (%d,%d)\n",
pipe, udev->address,
DPRINTFN(2, "endpoint=%p, addr=%d, endpt=%d, mode=%d (%d,%d)\n",
ep, udev->address,
edesc->bEndpointAddress, udev->flags.usb_mode,
sc->sc_rt_addr, udev->device_index);
@ -2109,15 +2109,15 @@ atmegadci_pipe_init(struct usb_device *udev, struct usb_endpoint_descriptor *ede
return;
}
if ((edesc->bmAttributes & UE_XFERTYPE) == UE_ISOCHRONOUS)
pipe->methods = &atmegadci_device_isoc_fs_methods;
ep->methods = &atmegadci_device_isoc_fs_methods;
else
pipe->methods = &atmegadci_device_non_isoc_methods;
ep->methods = &atmegadci_device_non_isoc_methods;
}
}
struct usb_bus_methods atmegadci_bus_methods =
{
.pipe_init = &atmegadci_pipe_init,
.endpoint_init = &atmegadci_ep_init,
.xfer_setup = &atmegadci_xfer_setup,
.xfer_unsetup = &atmegadci_xfer_unsetup,
.get_hw_ep_profile = &atmegadci_get_hw_ep_profile,

View File

@ -1062,7 +1062,7 @@ avr32dci_device_done(struct usb_xfer *xfer, usb_error_t error)
static void
avr32dci_set_stall(struct usb_device *udev, struct usb_xfer *xfer,
struct usb_pipe *pipe)
struct usb_endpoint *ep)
{
struct avr32dci_softc *sc;
uint8_t ep_no;
@ -1148,7 +1148,7 @@ avr32dci_clear_stall_sub(struct avr32dci_softc *sc, uint8_t ep_no,
}
static void
avr32dci_clear_stall(struct usb_device *udev, struct usb_pipe *pipe)
avr32dci_clear_stall(struct usb_device *udev, struct usb_endpoint *ep)
{
struct avr32dci_softc *sc;
struct usb_endpoint_descriptor *ed;
@ -2025,8 +2025,8 @@ avr32dci_xfer_unsetup(struct usb_xfer *xfer)
}
static void
avr32dci_pipe_init(struct usb_device *udev, struct usb_endpoint_descriptor *edesc,
struct usb_pipe *pipe)
avr32dci_ep_init(struct usb_device *udev, struct usb_endpoint_descriptor *edesc,
struct usb_endpoint *ep)
{
struct avr32dci_softc *sc = AVR32_BUS2SC(udev->bus);
@ -2055,7 +2055,7 @@ avr32dci_pipe_init(struct usb_device *udev, struct usb_endpoint_descriptor *edes
struct usb_bus_methods avr32dci_bus_methods =
{
.pipe_init = &avr32dci_pipe_init,
.endpoint_init = &avr32dci_ep_init,
.xfer_setup = &avr32dci_xfer_setup,
.xfer_unsetup = &avr32dci_xfer_unsetup,
.get_hw_ep_profile = &avr32dci_get_hw_ep_profile,

View File

@ -1190,14 +1190,14 @@ ehci_non_isoc_done_sub(struct usb_xfer *xfer)
/* update data toggle */
xfer->pipe->toggle_next =
xfer->endpoint->toggle_next =
(status & EHCI_QTD_TOGGLE_MASK) ? 1 : 0;
#if USB_DEBUG
if (status & EHCI_QTD_STATERRS) {
DPRINTFN(11, "error, addr=%d, endpt=0x%02x, frame=0x%02x"
"status=%s%s%s%s%s%s%s%s\n",
xfer->address, xfer->endpoint, xfer->aframes,
xfer->address, xfer->endpointno, xfer->aframes,
(status & EHCI_QTD_ACTIVE) ? "[ACTIVE]" : "[NOT_ACTIVE]",
(status & EHCI_QTD_HALTED) ? "[HALTED]" : "",
(status & EHCI_QTD_BUFERR) ? "[BUFERR]" : "",
@ -1218,8 +1218,8 @@ ehci_non_isoc_done(struct usb_xfer *xfer)
{
usb_error_t err = 0;
DPRINTFN(13, "xfer=%p pipe=%p transfer done\n",
xfer, xfer->pipe);
DPRINTFN(13, "xfer=%p endpoint=%p transfer done\n",
xfer, xfer->endpoint);
#if USB_DEBUG
if (ehcidebug > 10) {
@ -1274,7 +1274,7 @@ ehci_non_isoc_done(struct usb_xfer *xfer)
static uint8_t
ehci_check_transfer(struct usb_xfer *xfer)
{
struct usb_pipe_methods *methods = xfer->pipe->methods;
struct usb_pipe_methods *methods = xfer->endpoint->methods;
ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus);
uint32_t status;
@ -1716,7 +1716,7 @@ ehci_setup_standard_chain(struct usb_xfer *xfer, ehci_qh_t **qh_last)
uint32_t x;
DPRINTFN(9, "addr=%d endpt=%d sumlen=%d speed=%d\n",
xfer->address, UE_GET_ADDR(xfer->endpoint),
xfer->address, UE_GET_ADDR(xfer->endpointno),
xfer->sumlen, usb2_get_speed(xfer->xroot->udev));
temp.average = xfer->max_hc_frame_size;
@ -1739,7 +1739,7 @@ ehci_setup_standard_chain(struct usb_xfer *xfer, ehci_qh_t **qh_last)
temp.setup_alt_next = xfer->flags_int.short_frames_ok;
if (xfer->flags_int.control_xfr) {
if (xfer->pipe->toggle_next) {
if (xfer->endpoint->toggle_next) {
/* DATA1 is next */
temp.qtd_status |=
htohc32(temp.sc, EHCI_QTD_SET_TOGGLE(1));
@ -1827,7 +1827,7 @@ ehci_setup_standard_chain(struct usb_xfer *xfer, ehci_qh_t **qh_last)
/* set endpoint direction */
temp.qtd_status |=
(UE_GET_DIR(xfer->endpoint) == UE_DIR_IN) ?
(UE_GET_DIR(xfer->endpointno) == UE_DIR_IN) ?
htohc32(temp.sc, EHCI_QTD_ACTIVE |
EHCI_QTD_SET_PID(EHCI_QTD_PID_IN)) :
htohc32(temp.sc, EHCI_QTD_ACTIVE |
@ -1849,7 +1849,7 @@ ehci_setup_standard_chain(struct usb_xfer *xfer, ehci_qh_t **qh_last)
temp.qtd_status &= htohc32(temp.sc, EHCI_QTD_SET_CERR(3) |
EHCI_QTD_SET_TOGGLE(1));
temp.qtd_status |=
(UE_GET_DIR(xfer->endpoint) == UE_DIR_OUT) ?
(UE_GET_DIR(xfer->endpointno) == UE_DIR_OUT) ?
htohc32(temp.sc, EHCI_QTD_ACTIVE |
EHCI_QTD_SET_PID(EHCI_QTD_PID_IN) |
EHCI_QTD_SET_TOGGLE(1)) :
@ -1881,13 +1881,13 @@ ehci_setup_standard_chain(struct usb_xfer *xfer, ehci_qh_t **qh_last)
#if USB_DEBUG
if (ehcidebug > 8) {
DPRINTF("nexttog=%d; data before transfer:\n",
xfer->pipe->toggle_next);
xfer->endpoint->toggle_next);
ehci_dump_sqtds(temp.sc,
xfer->td_transfer_first);
}
#endif
methods = xfer->pipe->methods;
methods = xfer->endpoint->methods;
qh = xfer->qh_start[xfer->flags_int.curr_dma_set];
@ -1895,7 +1895,7 @@ ehci_setup_standard_chain(struct usb_xfer *xfer, ehci_qh_t **qh_last)
qh_endp =
(EHCI_QH_SET_ADDR(xfer->address) |
EHCI_QH_SET_ENDPT(UE_GET_ADDR(xfer->endpoint)) |
EHCI_QH_SET_ENDPT(UE_GET_ADDR(xfer->endpointno)) |
EHCI_QH_SET_MPL(xfer->max_packet_size));
if (usb2_get_speed(xfer->xroot->udev) == USB_SPEED_HIGH) {
@ -1943,7 +1943,7 @@ ehci_setup_standard_chain(struct usb_xfer *xfer, ehci_qh_t **qh_last)
qh->qh_endp &= htohc32(temp.sc, ~EHCI_QH_DTC);
if (xfer->pipe->toggle_next) {
if (xfer->endpoint->toggle_next) {
/* DATA1 is next */
qh->qh_qtd.qtd_status |=
htohc32(temp.sc, EHCI_QTD_SET_TOGGLE(1));
@ -1999,8 +1999,8 @@ ehci_isoc_fs_done(ehci_softc_t *sc, struct usb_xfer *xfer)
ehci_sitd_t *td = xfer->td_transfer_first;
ehci_sitd_t **pp_last = &sc->sc_isoc_fs_p_last[xfer->qh_pos];
DPRINTFN(13, "xfer=%p pipe=%p transfer done\n",
xfer, xfer->pipe);
DPRINTFN(13, "xfer=%p endpoint=%p transfer done\n",
xfer, xfer->endpoint);
while (nframes--) {
if (td == NULL) {
@ -2053,8 +2053,8 @@ ehci_isoc_hs_done(ehci_softc_t *sc, struct usb_xfer *xfer)
ehci_itd_t *td = xfer->td_transfer_first;
ehci_itd_t **pp_last = &sc->sc_isoc_hs_p_last[xfer->qh_pos];
DPRINTFN(13, "xfer=%p pipe=%p transfer done\n",
xfer, xfer->pipe);
DPRINTFN(13, "xfer=%p endpoint=%p transfer done\n",
xfer, xfer->endpoint);
while (nframes--) {
if (td == NULL) {
@ -2113,20 +2113,20 @@ ehci_isoc_hs_done(ehci_softc_t *sc, struct usb_xfer *xfer)
static void
ehci_device_done(struct usb_xfer *xfer, usb_error_t error)
{
struct usb_pipe_methods *methods = xfer->pipe->methods;
struct usb_pipe_methods *methods = xfer->endpoint->methods;
ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus);
USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED);
DPRINTFN(2, "xfer=%p, pipe=%p, error=%d\n",
xfer, xfer->pipe, error);
DPRINTFN(2, "xfer=%p, endpoint=%p, error=%d\n",
xfer, xfer->endpoint, error);
if ((methods == &ehci_device_bulk_methods) ||
(methods == &ehci_device_ctrl_methods)) {
#if USB_DEBUG
if (ehcidebug > 8) {
DPRINTF("nexttog=%d; data after transfer:\n",
xfer->pipe->toggle_next);
xfer->endpoint->toggle_next);
ehci_dump_sqtds(sc,
xfer->td_transfer_first);
}
@ -2358,11 +2358,11 @@ ehci_device_isoc_fs_open(struct usb_xfer *xfer)
sitd_portaddr =
EHCI_SITD_SET_ADDR(xfer->address) |
EHCI_SITD_SET_ENDPT(UE_GET_ADDR(xfer->endpoint)) |
EHCI_SITD_SET_ENDPT(UE_GET_ADDR(xfer->endpointno)) |
EHCI_SITD_SET_HUBA(xfer->xroot->udev->hs_hub_addr) |
EHCI_SITD_SET_PORT(xfer->xroot->udev->hs_port_no);
if (UE_GET_DIR(xfer->endpoint) == UE_DIR_IN) {
if (UE_GET_DIR(xfer->endpointno) == UE_DIR_IN) {
sitd_portaddr |= EHCI_SITD_SET_DIR_IN;
}
sitd_portaddr = htohc32(sc, sitd_portaddr);
@ -2422,7 +2422,7 @@ ehci_device_isoc_fs_enter(struct usb_xfer *xfer)
#endif
DPRINTFN(6, "xfer=%p next=%d nframes=%d\n",
xfer, xfer->pipe->isoc_next, xfer->nframes);
xfer, xfer->endpoint->isoc_next, xfer->nframes);
/* get the current frame index */
@ -2432,10 +2432,10 @@ ehci_device_isoc_fs_enter(struct usb_xfer *xfer)
* check if the frame index is within the window where the frames
* will be inserted
*/
buf_offset = (nframes - xfer->pipe->isoc_next) &
buf_offset = (nframes - xfer->endpoint->isoc_next) &
(EHCI_VIRTUAL_FRAMELIST_COUNT - 1);
if ((xfer->pipe->is_synced == 0) ||
if ((xfer->endpoint->is_synced == 0) ||
(buf_offset < xfer->nframes)) {
/*
* If there is data underflow or the pipe queue is empty we
@ -2443,16 +2443,16 @@ ehci_device_isoc_fs_enter(struct usb_xfer *xfer)
* frame position. Else two isochronous transfers might
* overlap.
*/
xfer->pipe->isoc_next = (nframes + 3) &
xfer->endpoint->isoc_next = (nframes + 3) &
(EHCI_VIRTUAL_FRAMELIST_COUNT - 1);
xfer->pipe->is_synced = 1;
DPRINTFN(3, "start next=%d\n", xfer->pipe->isoc_next);
xfer->endpoint->is_synced = 1;
DPRINTFN(3, "start next=%d\n", xfer->endpoint->isoc_next);
}
/*
* compute how many milliseconds the insertion is ahead of the
* current frame position:
*/
buf_offset = (xfer->pipe->isoc_next - nframes) &
buf_offset = (xfer->endpoint->isoc_next - nframes) &
(EHCI_VIRTUAL_FRAMELIST_COUNT - 1);
/*
@ -2478,11 +2478,11 @@ ehci_device_isoc_fs_enter(struct usb_xfer *xfer)
td = xfer->td_start[xfer->flags_int.curr_dma_set];
xfer->td_transfer_first = td;
pp_last = &sc->sc_isoc_fs_p_last[xfer->pipe->isoc_next];
pp_last = &sc->sc_isoc_fs_p_last[xfer->endpoint->isoc_next];
/* store starting position */
xfer->qh_pos = xfer->pipe->isoc_next;
xfer->qh_pos = xfer->endpoint->isoc_next;
fss = fss_start + (xfer->qh_pos % USB_ISOC_TIME_MAX);
@ -2543,7 +2543,7 @@ ehci_device_isoc_fs_enter(struct usb_xfer *xfer)
temp = 0;
}
if (UE_GET_DIR(xfer->endpoint) == UE_DIR_OUT) {
if (UE_GET_DIR(xfer->endpointno) == UE_DIR_OUT) {
tlen = *plen;
if (tlen <= 188) {
temp |= 1; /* T-count = 1, TP = ALL */
@ -2609,7 +2609,7 @@ ehci_device_isoc_fs_enter(struct usb_xfer *xfer)
xfer->td_transfer_last = td_last;
/* update isoc_next */
xfer->pipe->isoc_next = (pp_last - &sc->sc_isoc_fs_p_last[0]) &
xfer->endpoint->isoc_next = (pp_last - &sc->sc_isoc_fs_p_last[0]) &
(EHCI_VIRTUAL_FRAMELIST_COUNT - 1);
}
@ -2658,13 +2658,13 @@ ehci_device_isoc_hs_open(struct usb_xfer *xfer)
/* set endpoint and address */
td->itd_bp[0] = htohc32(sc,
EHCI_ITD_SET_ADDR(xfer->address) |
EHCI_ITD_SET_ENDPT(UE_GET_ADDR(xfer->endpoint)));
EHCI_ITD_SET_ENDPT(UE_GET_ADDR(xfer->endpointno)));
temp =
EHCI_ITD_SET_MPL(xfer->max_packet_size & 0x7FF);
/* set direction */
if (UE_GET_DIR(xfer->endpoint) == UE_DIR_IN) {
if (UE_GET_DIR(xfer->endpointno) == UE_DIR_IN) {
temp |= EHCI_ITD_SET_DIR_IN;
}
/* set maximum packet size */
@ -2708,7 +2708,7 @@ ehci_device_isoc_hs_enter(struct usb_xfer *xfer)
#endif
DPRINTFN(6, "xfer=%p next=%d nframes=%d\n",
xfer, xfer->pipe->isoc_next, xfer->nframes);
xfer, xfer->endpoint->isoc_next, xfer->nframes);
/* get the current frame index */
@ -2718,10 +2718,10 @@ ehci_device_isoc_hs_enter(struct usb_xfer *xfer)
* check if the frame index is within the window where the frames
* will be inserted
*/
buf_offset = (nframes - xfer->pipe->isoc_next) &
buf_offset = (nframes - xfer->endpoint->isoc_next) &
(EHCI_VIRTUAL_FRAMELIST_COUNT - 1);
if ((xfer->pipe->is_synced == 0) ||
if ((xfer->endpoint->is_synced == 0) ||
(buf_offset < ((xfer->nframes + 7) / 8))) {
/*
* If there is data underflow or the pipe queue is empty we
@ -2729,16 +2729,16 @@ ehci_device_isoc_hs_enter(struct usb_xfer *xfer)
* frame position. Else two isochronous transfers might
* overlap.
*/
xfer->pipe->isoc_next = (nframes + 3) &
xfer->endpoint->isoc_next = (nframes + 3) &
(EHCI_VIRTUAL_FRAMELIST_COUNT - 1);
xfer->pipe->is_synced = 1;
DPRINTFN(3, "start next=%d\n", xfer->pipe->isoc_next);
xfer->endpoint->is_synced = 1;
DPRINTFN(3, "start next=%d\n", xfer->endpoint->isoc_next);
}
/*
* compute how many milliseconds the insertion is ahead of the
* current frame position:
*/
buf_offset = (xfer->pipe->isoc_next - nframes) &
buf_offset = (xfer->endpoint->isoc_next - nframes) &
(EHCI_VIRTUAL_FRAMELIST_COUNT - 1);
/*
@ -2764,11 +2764,11 @@ ehci_device_isoc_hs_enter(struct usb_xfer *xfer)
td = xfer->td_start[xfer->flags_int.curr_dma_set];
xfer->td_transfer_first = td;
pp_last = &sc->sc_isoc_hs_p_last[xfer->pipe->isoc_next];
pp_last = &sc->sc_isoc_hs_p_last[xfer->endpoint->isoc_next];
/* store starting position */
xfer->qh_pos = xfer->pipe->isoc_next;
xfer->qh_pos = xfer->endpoint->isoc_next;
while (nframes--) {
if (td == NULL) {
@ -2875,7 +2875,7 @@ ehci_device_isoc_hs_enter(struct usb_xfer *xfer)
xfer->td_transfer_last = td_last;
/* update isoc_next */
xfer->pipe->isoc_next = (pp_last - &sc->sc_isoc_hs_p_last[0]) &
xfer->endpoint->isoc_next = (pp_last - &sc->sc_isoc_hs_p_last[0]) &
(EHCI_VIRTUAL_FRAMELIST_COUNT - 1);
}
@ -3635,13 +3635,13 @@ ehci_xfer_unsetup(struct usb_xfer *xfer)
}
static void
ehci_pipe_init(struct usb_device *udev, struct usb_endpoint_descriptor *edesc,
struct usb_pipe *pipe)
ehci_ep_init(struct usb_device *udev, struct usb_endpoint_descriptor *edesc,
struct usb_endpoint *ep)
{
ehci_softc_t *sc = EHCI_BUS2SC(udev->bus);
DPRINTFN(2, "pipe=%p, addr=%d, endpt=%d, mode=%d (%d)\n",
pipe, udev->address,
DPRINTFN(2, "endpoint=%p, addr=%d, endpt=%d, mode=%d (%d)\n",
ep, udev->address,
edesc->bEndpointAddress, udev->flags.usb_mode,
sc->sc_addr);
@ -3661,21 +3661,21 @@ ehci_pipe_init(struct usb_device *udev, struct usb_endpoint_descriptor *edesc,
}
switch (edesc->bmAttributes & UE_XFERTYPE) {
case UE_CONTROL:
pipe->methods = &ehci_device_ctrl_methods;
ep->methods = &ehci_device_ctrl_methods;
break;
case UE_INTERRUPT:
pipe->methods = &ehci_device_intr_methods;
ep->methods = &ehci_device_intr_methods;
break;
case UE_ISOCHRONOUS:
if (udev->speed == USB_SPEED_HIGH) {
pipe->methods = &ehci_device_isoc_hs_methods;
ep->methods = &ehci_device_isoc_hs_methods;
} else if (udev->speed == USB_SPEED_FULL) {
pipe->methods = &ehci_device_isoc_fs_methods;
ep->methods = &ehci_device_isoc_fs_methods;
}
break;
case UE_BULK:
if (udev->speed != USB_SPEED_LOW) {
pipe->methods = &ehci_device_bulk_methods;
ep->methods = &ehci_device_bulk_methods;
}
break;
default:
@ -3712,7 +3712,7 @@ ehci_device_resume(struct usb_device *udev)
if (xfer->xroot->udev == udev) {
methods = xfer->pipe->methods;
methods = xfer->endpoint->methods;
if ((methods == &ehci_device_bulk_methods) ||
(methods == &ehci_device_ctrl_methods)) {
@ -3746,7 +3746,7 @@ ehci_device_suspend(struct usb_device *udev)
if (xfer->xroot->udev == udev) {
methods = xfer->pipe->methods;
methods = xfer->endpoint->methods;
if ((methods == &ehci_device_bulk_methods) ||
(methods == &ehci_device_ctrl_methods)) {
@ -3801,7 +3801,7 @@ ehci_set_hw_power(struct usb_bus *bus)
struct usb_bus_methods ehci_bus_methods =
{
.pipe_init = ehci_pipe_init,
.endpoint_init = ehci_ep_init,
.xfer_setup = ehci_xfer_setup,
.xfer_unsetup = ehci_xfer_unsetup,
.get_dma_delay = ehci_get_dma_delay,

View File

@ -1114,7 +1114,7 @@ musbotg_setup_standard_chain(struct usb_xfer *xfer)
uint8_t ep_no;
DPRINTFN(8, "addr=%d endpt=%d sumlen=%d speed=%d\n",
xfer->address, UE_GET_ADDR(xfer->endpoint),
xfer->address, UE_GET_ADDR(xfer->endpointno),
xfer->sumlen, usb2_get_speed(xfer->xroot->udev));
temp.max_frame_size = xfer->max_frame_size;
@ -1132,7 +1132,7 @@ musbotg_setup_standard_chain(struct usb_xfer *xfer)
temp.did_stall = !xfer->flags_int.control_stall;
sc = MUSBOTG_BUS2SC(xfer->xroot->bus);
ep_no = (xfer->endpoint & UE_ADDR);
ep_no = (xfer->endpointno & UE_ADDR);
/* check if we should prepend a setup message */
@ -1152,7 +1152,7 @@ musbotg_setup_standard_chain(struct usb_xfer *xfer)
}
if (x != xfer->nframes) {
if (xfer->endpoint & UE_DIR_IN) {
if (xfer->endpointno & UE_DIR_IN) {
if (xfer->flags_int.control_xfr)
temp.func = &musbotg_setup_data_tx;
else
@ -1249,7 +1249,7 @@ musbotg_ep_int_set(struct usb_xfer *xfer, uint8_t on)
{
struct musbotg_softc *sc = MUSBOTG_BUS2SC(xfer->xroot->bus);
uint16_t temp;
uint8_t ep_no = xfer->endpoint & UE_ADDR;
uint8_t ep_no = xfer->endpointno & UE_ADDR;
/*
* Only enable the endpoint interrupt when we are
@ -1390,8 +1390,8 @@ musbotg_standard_done(struct usb_xfer *xfer)
{
usb_error_t err = 0;
DPRINTFN(12, "xfer=%p pipe=%p transfer done\n",
xfer, xfer->pipe);
DPRINTFN(12, "xfer=%p endpoint=%p transfer done\n",
xfer, xfer->endpoint);
/* reset scanner */
@ -1439,8 +1439,8 @@ musbotg_device_done(struct usb_xfer *xfer, usb_error_t error)
{
USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_OWNED);
DPRINTFN(2, "xfer=%p, pipe=%p, error=%d\n",
xfer, xfer->pipe, error);
DPRINTFN(2, "xfer=%p, endpoint=%p, error=%d\n",
xfer, xfer->endpoint, error);
if (xfer->flags_int.usb_mode == USB_MODE_DEVICE) {
@ -1454,14 +1454,14 @@ musbotg_device_done(struct usb_xfer *xfer, usb_error_t error)
static void
musbotg_set_stall(struct usb_device *udev, struct usb_xfer *xfer,
struct usb_pipe *pipe)
struct usb_endpoint *ep)
{
struct musbotg_softc *sc;
uint8_t ep_no;
USB_BUS_LOCK_ASSERT(udev->bus, MA_OWNED);
DPRINTFN(4, "pipe=%p\n", pipe);
DPRINTFN(4, "endpoint=%p\n", ep);
if (xfer) {
/* cancel any ongoing transfers */
@ -1470,12 +1470,12 @@ musbotg_set_stall(struct usb_device *udev, struct usb_xfer *xfer,
/* set FORCESTALL */
sc = MUSBOTG_BUS2SC(udev->bus);
ep_no = (pipe->edesc->bEndpointAddress & UE_ADDR);
ep_no = (ep->edesc->bEndpointAddress & UE_ADDR);
/* select endpoint */
MUSB2_WRITE_1(sc, MUSB2_REG_EPINDEX, ep_no);
if (pipe->edesc->bEndpointAddress & UE_DIR_IN) {
if (ep->edesc->bEndpointAddress & UE_DIR_IN) {
MUSB2_WRITE_1(sc, MUSB2_REG_TXCSRL,
MUSB2_MASK_CSRL_TXSENDSTALL);
} else {
@ -1636,12 +1636,12 @@ musbotg_clear_stall_sub(struct musbotg_softc *sc, uint16_t wMaxPacket,
}
static void
musbotg_clear_stall(struct usb_device *udev, struct usb_pipe *pipe)
musbotg_clear_stall(struct usb_device *udev, struct usb_endpoint *ep)
{
struct musbotg_softc *sc;
struct usb_endpoint_descriptor *ed;
DPRINTFN(4, "pipe=%p\n", pipe);
DPRINTFN(4, "endpoint=%p\n", ep);
USB_BUS_LOCK_ASSERT(udev->bus, MA_OWNED);
@ -1654,7 +1654,7 @@ musbotg_clear_stall(struct usb_device *udev, struct usb_pipe *pipe)
sc = MUSBOTG_BUS2SC(udev->bus);
/* get endpoint descriptor */
ed = pipe->edesc;
ed = ep->edesc;
/* reset endpoint */
musbotg_clear_stall_sub(sc,
@ -1999,7 +1999,7 @@ musbotg_device_isoc_enter(struct usb_xfer *xfer)
uint32_t fs_frames;
DPRINTFN(5, "xfer=%p next=%d nframes=%d\n",
xfer, xfer->pipe->isoc_next, xfer->nframes);
xfer, xfer->endpoint->isoc_next, xfer->nframes);
/* get the current frame index */
@ -2009,7 +2009,7 @@ musbotg_device_isoc_enter(struct usb_xfer *xfer)
* check if the frame index is within the window where the frames
* will be inserted
*/
temp = (nframes - xfer->pipe->isoc_next) & MUSB2_MASK_FRAME;
temp = (nframes - xfer->endpoint->isoc_next) & MUSB2_MASK_FRAME;
if (usb2_get_speed(xfer->xroot->udev) == USB_SPEED_HIGH) {
fs_frames = (xfer->nframes + 7) / 8;
@ -2017,7 +2017,7 @@ musbotg_device_isoc_enter(struct usb_xfer *xfer)
fs_frames = xfer->nframes;
}
if ((xfer->pipe->is_synced == 0) ||
if ((xfer->endpoint->is_synced == 0) ||
(temp < fs_frames)) {
/*
* If there is data underflow or the pipe queue is
@ -2025,15 +2025,15 @@ musbotg_device_isoc_enter(struct usb_xfer *xfer)
* of the current frame position. Else two isochronous
* transfers might overlap.
*/
xfer->pipe->isoc_next = (nframes + 3) & MUSB2_MASK_FRAME;
xfer->pipe->is_synced = 1;
DPRINTFN(2, "start next=%d\n", xfer->pipe->isoc_next);
xfer->endpoint->isoc_next = (nframes + 3) & MUSB2_MASK_FRAME;
xfer->endpoint->is_synced = 1;
DPRINTFN(2, "start next=%d\n", xfer->endpoint->isoc_next);
}
/*
* compute how many milliseconds the insertion is ahead of the
* current frame position:
*/
temp = (xfer->pipe->isoc_next - nframes) & MUSB2_MASK_FRAME;
temp = (xfer->endpoint->isoc_next - nframes) & MUSB2_MASK_FRAME;
/*
* pre-compute when the isochronous transfer will be finished:
@ -2043,7 +2043,7 @@ musbotg_device_isoc_enter(struct usb_xfer *xfer)
fs_frames;
/* compute frame number for next insertion */
xfer->pipe->isoc_next += fs_frames;
xfer->endpoint->isoc_next += fs_frames;
/* setup TDs */
musbotg_setup_standard_chain(xfer);
@ -2623,7 +2623,7 @@ musbotg_xfer_setup(struct usb_setup_params *parm)
*/
if (ntd) {
ep_no = xfer->endpoint & UE_ADDR;
ep_no = xfer->endpointno & UE_ADDR;
musbotg_get_hw_ep_profile(parm->udev, &pf, ep_no);
if (pf == NULL) {
@ -2667,13 +2667,13 @@ musbotg_xfer_unsetup(struct usb_xfer *xfer)
}
static void
musbotg_pipe_init(struct usb_device *udev, struct usb_endpoint_descriptor *edesc,
struct usb_pipe *pipe)
musbotg_ep_init(struct usb_device *udev, struct usb_endpoint_descriptor *edesc,
struct usb_endpoint *ep)
{
struct musbotg_softc *sc = MUSBOTG_BUS2SC(udev->bus);
DPRINTFN(2, "pipe=%p, addr=%d, endpt=%d, mode=%d (%d)\n",
pipe, udev->address,
DPRINTFN(2, "endpoint=%p, addr=%d, endpt=%d, mode=%d (%d)\n",
ep, udev->address,
edesc->bEndpointAddress, udev->flags.usb_mode,
sc->sc_rt_addr);
@ -2690,16 +2690,16 @@ musbotg_pipe_init(struct usb_device *udev, struct usb_endpoint_descriptor *edesc
}
switch (edesc->bmAttributes & UE_XFERTYPE) {
case UE_CONTROL:
pipe->methods = &musbotg_device_ctrl_methods;
ep->methods = &musbotg_device_ctrl_methods;
break;
case UE_INTERRUPT:
pipe->methods = &musbotg_device_intr_methods;
ep->methods = &musbotg_device_intr_methods;
break;
case UE_ISOCHRONOUS:
pipe->methods = &musbotg_device_isoc_methods;
ep->methods = &musbotg_device_isoc_methods;
break;
case UE_BULK:
pipe->methods = &musbotg_device_bulk_methods;
ep->methods = &musbotg_device_bulk_methods;
break;
default:
/* do nothing */
@ -2710,7 +2710,7 @@ musbotg_pipe_init(struct usb_device *udev, struct usb_endpoint_descriptor *edesc
struct usb_bus_methods musbotg_bus_methods =
{
.pipe_init = &musbotg_pipe_init,
.endpoint_init = &musbotg_ep_init,
.xfer_setup = &musbotg_xfer_setup,
.xfer_unsetup = &musbotg_xfer_unsetup,
.get_hw_ep_profile = &musbotg_get_hw_ep_profile,

View File

@ -910,8 +910,8 @@ ohci_non_isoc_done(struct usb_xfer *xfer)
{
usb_error_t err = 0;
DPRINTFN(13, "xfer=%p pipe=%p transfer done\n",
xfer, xfer->pipe);
DPRINTFN(13, "xfer=%p endpoint=%p transfer done\n",
xfer, xfer->endpoint);
#if USB_DEBUG
if (ohcidebug > 10) {
@ -1022,11 +1022,11 @@ ohci_check_transfer_sub(struct usb_xfer *xfer)
if (xfer->xroot->udev->flags.self_suspended) {
/* nothing to do */
} else if (xfer->pipe->methods == &ohci_device_bulk_methods) {
} else if (xfer->endpoint->methods == &ohci_device_bulk_methods) {
ohci_softc_t *sc = OHCI_BUS2SC(xfer->xroot->bus);
OWRITE4(sc, OHCI_COMMAND_STATUS, OHCI_BLF);
} else if (xfer->pipe->methods == &ohci_device_ctrl_methods) {
} else if (xfer->endpoint->methods == &ohci_device_ctrl_methods) {
ohci_softc_t *sc = OHCI_BUS2SC(xfer->xroot->bus);
OWRITE4(sc, OHCI_COMMAND_STATUS, OHCI_CLF);
@ -1058,7 +1058,7 @@ ohci_check_transfer(struct usb_xfer *xfer)
if ((ed_headp & OHCI_HALTED) ||
(((ed_headp ^ ed_tailp) & (~0xF)) == 0)) {
if (xfer->pipe->methods == &ohci_device_isoc_methods) {
if (xfer->endpoint->methods == &ohci_device_isoc_methods) {
/* isochronous transfer */
ohci_isoc_done(xfer);
} else {
@ -1071,9 +1071,9 @@ ohci_check_transfer(struct usb_xfer *xfer)
}
/* store data-toggle */
if (ed_headp & OHCI_TOGGLECARRY) {
xfer->pipe->toggle_next = 1;
xfer->endpoint->toggle_next = 1;
} else {
xfer->pipe->toggle_next = 0;
xfer->endpoint->toggle_next = 0;
}
/* non-isochronous transfer */
@ -1415,7 +1415,7 @@ ohci_setup_standard_chain(struct usb_xfer *xfer, ohci_ed_t **ed_last)
uint32_t x;
DPRINTFN(9, "addr=%d endpt=%d sumlen=%d speed=%d\n",
xfer->address, UE_GET_ADDR(xfer->endpoint),
xfer->address, UE_GET_ADDR(xfer->endpointno),
xfer->sumlen, usb2_get_speed(xfer->xroot->udev));
temp.average = xfer->max_hc_frame_size;
@ -1435,7 +1435,7 @@ ohci_setup_standard_chain(struct usb_xfer *xfer, ohci_ed_t **ed_last)
temp.last_frame = 0;
temp.setup_alt_next = xfer->flags_int.short_frames_ok;
methods = xfer->pipe->methods;
methods = xfer->endpoint->methods;
/* check if we should prepend a setup message */
@ -1462,7 +1462,7 @@ ohci_setup_standard_chain(struct usb_xfer *xfer, ohci_ed_t **ed_last)
* XXX assume that the setup message is
* contained within one USB packet:
*/
xfer->pipe->toggle_next = 1;
xfer->endpoint->toggle_next = 1;
}
x = 1;
} else {
@ -1472,7 +1472,7 @@ ohci_setup_standard_chain(struct usb_xfer *xfer, ohci_ed_t **ed_last)
/* set data toggle */
if (xfer->pipe->toggle_next) {
if (xfer->endpoint->toggle_next) {
temp.td_flags |= htole32(OHCI_TD_TOGGLE_1);
} else {
temp.td_flags |= htole32(OHCI_TD_TOGGLE_0);
@ -1480,7 +1480,7 @@ ohci_setup_standard_chain(struct usb_xfer *xfer, ohci_ed_t **ed_last)
/* set endpoint direction */
if (UE_GET_DIR(xfer->endpoint) == UE_DIR_IN) {
if (UE_GET_DIR(xfer->endpointno) == UE_DIR_IN) {
temp.td_flags |= htole32(OHCI_TD_IN);
} else {
temp.td_flags |= htole32(OHCI_TD_OUT);
@ -1535,7 +1535,7 @@ ohci_setup_standard_chain(struct usb_xfer *xfer, ohci_ed_t **ed_last)
/* set endpoint direction and data toggle */
if (UE_GET_DIR(xfer->endpoint) == UE_DIR_IN) {
if (UE_GET_DIR(xfer->endpointno) == UE_DIR_IN) {
temp.td_flags = htole32(OHCI_TD_OUT |
OHCI_TD_NOCC | OHCI_TD_TOGGLE_1 | OHCI_TD_SET_DI(1));
} else {
@ -1567,7 +1567,7 @@ ohci_setup_standard_chain(struct usb_xfer *xfer, ohci_ed_t **ed_last)
#if USB_DEBUG
if (ohcidebug > 8) {
DPRINTF("nexttog=%d; data before transfer:\n",
xfer->pipe->toggle_next);
xfer->endpoint->toggle_next);
ohci_dump_tds(xfer->td_transfer_first);
}
#endif
@ -1575,7 +1575,7 @@ ohci_setup_standard_chain(struct usb_xfer *xfer, ohci_ed_t **ed_last)
ed = xfer->qh_start[xfer->flags_int.curr_dma_set];
ed_flags = (OHCI_ED_SET_FA(xfer->address) |
OHCI_ED_SET_EN(UE_GET_ADDR(xfer->endpoint)) |
OHCI_ED_SET_EN(UE_GET_ADDR(xfer->endpointno)) |
OHCI_ED_SET_MAXP(xfer->max_frame_size));
ed_flags |= (OHCI_ED_FORMAT_GEN | OHCI_ED_DIR_TD);
@ -1647,15 +1647,15 @@ ohci_root_intr(ohci_softc_t *sc)
static void
ohci_device_done(struct usb_xfer *xfer, usb_error_t error)
{
struct usb_pipe_methods *methods = xfer->pipe->methods;
struct usb_pipe_methods *methods = xfer->endpoint->methods;
ohci_softc_t *sc = OHCI_BUS2SC(xfer->xroot->bus);
ohci_ed_t *ed;
USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED);
DPRINTFN(2, "xfer=%p, pipe=%p, error=%d\n",
xfer, xfer->pipe, error);
DPRINTFN(2, "xfer=%p, endpoint=%p, error=%d\n",
xfer, xfer->endpoint, error);
ed = xfer->qh_start[xfer->flags_int.curr_dma_set];
if (ed) {
@ -1872,26 +1872,26 @@ ohci_device_isoc_enter(struct usb_xfer *xfer)
nframes = le32toh(hcca->hcca_frame_number);
DPRINTFN(6, "xfer=%p isoc_next=%u nframes=%u hcca_fn=%u\n",
xfer, xfer->pipe->isoc_next, xfer->nframes, nframes);
xfer, xfer->endpoint->isoc_next, xfer->nframes, nframes);
if ((xfer->pipe->is_synced == 0) ||
(((nframes - xfer->pipe->isoc_next) & 0xFFFF) < xfer->nframes) ||
(((xfer->pipe->isoc_next - nframes) & 0xFFFF) >= 128)) {
if ((xfer->endpoint->is_synced == 0) ||
(((nframes - xfer->endpoint->isoc_next) & 0xFFFF) < xfer->nframes) ||
(((xfer->endpoint->isoc_next - nframes) & 0xFFFF) >= 128)) {
/*
* If there is data underflow or the pipe queue is empty we
* schedule the transfer a few frames ahead of the current
* frame position. Else two isochronous transfers might
* overlap.
*/
xfer->pipe->isoc_next = (nframes + 3) & 0xFFFF;
xfer->pipe->is_synced = 1;
DPRINTFN(3, "start next=%d\n", xfer->pipe->isoc_next);
xfer->endpoint->isoc_next = (nframes + 3) & 0xFFFF;
xfer->endpoint->is_synced = 1;
DPRINTFN(3, "start next=%d\n", xfer->endpoint->isoc_next);
}
/*
* compute how many milliseconds the insertion is ahead of the
* current frame position:
*/
buf_offset = ((xfer->pipe->isoc_next - nframes) & 0xFFFF);
buf_offset = ((xfer->endpoint->isoc_next - nframes) & 0xFFFF);
/*
* pre-compute when the isochronous transfer will be finished:
@ -1940,12 +1940,12 @@ ohci_device_isoc_enter(struct usb_xfer *xfer)
/* fill current ITD */
td->itd_flags = htole32(
OHCI_ITD_NOCC |
OHCI_ITD_SET_SF(xfer->pipe->isoc_next) |
OHCI_ITD_SET_SF(xfer->endpoint->isoc_next) |
OHCI_ITD_NOINTR |
OHCI_ITD_SET_FC(ncur));
td->frames = ncur;
xfer->pipe->isoc_next += ncur;
xfer->endpoint->isoc_next += ncur;
if (length == 0) {
/* all zero */
@ -2003,13 +2003,13 @@ ohci_device_isoc_enter(struct usb_xfer *xfer)
#endif
ed = xfer->qh_start[xfer->flags_int.curr_dma_set];
if (UE_GET_DIR(xfer->endpoint) == UE_DIR_IN)
if (UE_GET_DIR(xfer->endpointno) == UE_DIR_IN)
ed_flags = (OHCI_ED_DIR_IN | OHCI_ED_FORMAT_ISO);
else
ed_flags = (OHCI_ED_DIR_OUT | OHCI_ED_FORMAT_ISO);
ed_flags |= (OHCI_ED_SET_FA(xfer->address) |
OHCI_ED_SET_EN(UE_GET_ADDR(xfer->endpoint)) |
OHCI_ED_SET_EN(UE_GET_ADDR(xfer->endpointno)) |
OHCI_ED_SET_MAXP(xfer->max_frame_size));
if (xfer->xroot->udev->speed == USB_SPEED_LOW) {
@ -2563,13 +2563,13 @@ ohci_xfer_setup(struct usb_setup_params *parm)
}
static void
ohci_pipe_init(struct usb_device *udev, struct usb_endpoint_descriptor *edesc,
struct usb_pipe *pipe)
ohci_ep_init(struct usb_device *udev, struct usb_endpoint_descriptor *edesc,
struct usb_endpoint *ep)
{
ohci_softc_t *sc = OHCI_BUS2SC(udev->bus);
DPRINTFN(2, "pipe=%p, addr=%d, endpt=%d, mode=%d (%d)\n",
pipe, udev->address,
DPRINTFN(2, "endpoint=%p, addr=%d, endpt=%d, mode=%d (%d)\n",
ep, udev->address,
edesc->bEndpointAddress, udev->flags.usb_mode,
sc->sc_addr);
@ -2580,19 +2580,19 @@ ohci_pipe_init(struct usb_device *udev, struct usb_endpoint_descriptor *edesc,
if (udev->device_index != sc->sc_addr) {
switch (edesc->bmAttributes & UE_XFERTYPE) {
case UE_CONTROL:
pipe->methods = &ohci_device_ctrl_methods;
ep->methods = &ohci_device_ctrl_methods;
break;
case UE_INTERRUPT:
pipe->methods = &ohci_device_intr_methods;
ep->methods = &ohci_device_intr_methods;
break;
case UE_ISOCHRONOUS:
if (udev->speed == USB_SPEED_FULL) {
pipe->methods = &ohci_device_isoc_methods;
ep->methods = &ohci_device_isoc_methods;
}
break;
case UE_BULK:
if (udev->speed != USB_SPEED_LOW) {
pipe->methods = &ohci_device_bulk_methods;
ep->methods = &ohci_device_bulk_methods;
}
break;
default:
@ -2634,7 +2634,7 @@ ohci_device_resume(struct usb_device *udev)
if (xfer->xroot->udev == udev) {
methods = xfer->pipe->methods;
methods = xfer->endpoint->methods;
ed = xfer->qh_start[xfer->flags_int.curr_dma_set];
if (methods == &ohci_device_bulk_methods) {
@ -2672,7 +2672,7 @@ ohci_device_suspend(struct usb_device *udev)
if (xfer->xroot->udev == udev) {
methods = xfer->pipe->methods;
methods = xfer->endpoint->methods;
ed = xfer->qh_start[xfer->flags_int.curr_dma_set];
if (methods == &ohci_device_bulk_methods) {
@ -2729,7 +2729,7 @@ ohci_set_hw_power(struct usb_bus *bus)
struct usb_bus_methods ohci_bus_methods =
{
.pipe_init = ohci_pipe_init,
.endpoint_init = ohci_ep_init,
.xfer_setup = ohci_xfer_setup,
.xfer_unsetup = ohci_xfer_unsetup,
.get_dma_delay = ohci_get_dma_delay,

View File

@ -1034,8 +1034,8 @@ uhci_isoc_done(uhci_softc_t *sc, struct usb_xfer *xfer)
uhci_td_t *td = xfer->td_transfer_first;
uhci_td_t **pp_last = &sc->sc_isoc_p_last[xfer->qh_pos];
DPRINTFN(13, "xfer=%p pipe=%p transfer done\n",
xfer, xfer->pipe);
DPRINTFN(13, "xfer=%p endpoint=%p transfer done\n",
xfer, xfer->endpoint);
/* sync any DMA memory before doing fixups */
@ -1178,13 +1178,13 @@ uhci_non_isoc_done_sub(struct usb_xfer *xfer)
/* update data toggle */
xfer->pipe->toggle_next = (token & UHCI_TD_SET_DT(1)) ? 0 : 1;
xfer->endpoint->toggle_next = (token & UHCI_TD_SET_DT(1)) ? 0 : 1;
#if USB_DEBUG
if (status & UHCI_TD_ERROR) {
DPRINTFN(11, "error, addr=%d, endpt=0x%02x, frame=0x%02x "
"status=%s%s%s%s%s%s%s%s%s%s%s\n",
xfer->address, xfer->endpoint, xfer->aframes,
xfer->address, xfer->endpointno, xfer->aframes,
(status & UHCI_TD_BITSTUFF) ? "[BITSTUFF]" : "",
(status & UHCI_TD_CRCTO) ? "[CRCTO]" : "",
(status & UHCI_TD_NAK) ? "[NAK]" : "",
@ -1207,8 +1207,8 @@ uhci_non_isoc_done(struct usb_xfer *xfer)
{
usb_error_t err = 0;
DPRINTFN(13, "xfer=%p pipe=%p transfer done\n",
xfer, xfer->pipe);
DPRINTFN(13, "xfer=%p endpoint=%p transfer done\n",
xfer, xfer->endpoint);
#if USB_DEBUG
if (uhcidebug > 10) {
@ -1329,7 +1329,7 @@ uhci_check_transfer(struct usb_xfer *xfer)
DPRINTFN(16, "xfer=%p checking transfer\n", xfer);
if (xfer->pipe->methods == &uhci_device_isoc_methods) {
if (xfer->endpoint->methods == &uhci_device_isoc_methods) {
/* isochronous transfer */
td = xfer->td_transfer_last;
@ -1683,7 +1683,7 @@ uhci_setup_standard_chain(struct usb_xfer *xfer)
uint32_t x;
DPRINTFN(9, "addr=%d endpt=%d sumlen=%d speed=%d\n",
xfer->address, UE_GET_ADDR(xfer->endpoint),
xfer->address, UE_GET_ADDR(xfer->endpointno),
xfer->sumlen, usb2_get_speed(xfer->xroot->udev));
temp.average = xfer->max_frame_size;
@ -1712,10 +1712,10 @@ uhci_setup_standard_chain(struct usb_xfer *xfer)
temp.td_status |= htole32(UHCI_TD_LS);
}
temp.td_token =
htole32(UHCI_TD_SET_ENDPT(xfer->endpoint) |
htole32(UHCI_TD_SET_ENDPT(xfer->endpointno) |
UHCI_TD_SET_DEVADDR(xfer->address));
if (xfer->pipe->toggle_next) {
if (xfer->endpoint->toggle_next) {
/* DATA1 is next */
temp.td_token |= htole32(UHCI_TD_SET_DT(1));
}
@ -1794,7 +1794,7 @@ uhci_setup_standard_chain(struct usb_xfer *xfer)
/* set endpoint direction */
temp.td_token |=
(UE_GET_DIR(xfer->endpoint) == UE_DIR_IN) ?
(UE_GET_DIR(xfer->endpointno) == UE_DIR_IN) ?
htole32(UHCI_TD_PID_IN) :
htole32(UHCI_TD_PID_OUT);
@ -1815,7 +1815,7 @@ uhci_setup_standard_chain(struct usb_xfer *xfer)
UHCI_TD_SET_ENDPT(0xF) |
UHCI_TD_SET_DT(1));
temp.td_token |=
(UE_GET_DIR(xfer->endpoint) == UE_DIR_OUT) ?
(UE_GET_DIR(xfer->endpointno) == UE_DIR_OUT) ?
htole32(UHCI_TD_PID_IN | UHCI_TD_SET_DT(1)) :
htole32(UHCI_TD_PID_OUT | UHCI_TD_SET_DT(1));
@ -1845,7 +1845,7 @@ uhci_setup_standard_chain(struct usb_xfer *xfer)
#if USB_DEBUG
if (uhcidebug > 8) {
DPRINTF("nexttog=%d; data before transfer:\n",
xfer->pipe->toggle_next);
xfer->endpoint->toggle_next);
uhci_dump_tds(xfer->td_transfer_first);
}
#endif
@ -1859,14 +1859,14 @@ uhci_setup_standard_chain(struct usb_xfer *xfer)
static void
uhci_device_done(struct usb_xfer *xfer, usb_error_t error)
{
struct usb_pipe_methods *methods = xfer->pipe->methods;
struct usb_pipe_methods *methods = xfer->endpoint->methods;
uhci_softc_t *sc = UHCI_BUS2SC(xfer->xroot->bus);
uhci_qh_t *qh;
USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED);
DPRINTFN(2, "xfer=%p, pipe=%p, error=%d\n",
xfer, xfer->pipe, error);
DPRINTFN(2, "xfer=%p, endpoint=%p, error=%d\n",
xfer, xfer->endpoint, error);
qh = xfer->qh_start[xfer->flags_int.curr_dma_set];
if (qh) {
@ -2122,9 +2122,9 @@ uhci_device_isoc_open(struct usb_xfer *xfer)
uint8_t ds;
td_token =
(UE_GET_DIR(xfer->endpoint) == UE_DIR_IN) ?
UHCI_TD_IN(0, xfer->endpoint, xfer->address, 0) :
UHCI_TD_OUT(0, xfer->endpoint, xfer->address, 0);
(UE_GET_DIR(xfer->endpointno) == UE_DIR_IN) ?
UHCI_TD_IN(0, xfer->endpointno, xfer->address, 0) :
UHCI_TD_OUT(0, xfer->endpointno, xfer->address, 0);
td_token = htole32(td_token);
@ -2167,14 +2167,14 @@ uhci_device_isoc_enter(struct usb_xfer *xfer)
uhci_td_t **pp_last;
DPRINTFN(6, "xfer=%p next=%d nframes=%d\n",
xfer, xfer->pipe->isoc_next, xfer->nframes);
xfer, xfer->endpoint->isoc_next, xfer->nframes);
nframes = UREAD2(sc, UHCI_FRNUM);
temp = (nframes - xfer->pipe->isoc_next) &
temp = (nframes - xfer->endpoint->isoc_next) &
(UHCI_VFRAMELIST_COUNT - 1);
if ((xfer->pipe->is_synced == 0) ||
if ((xfer->endpoint->is_synced == 0) ||
(temp < xfer->nframes)) {
/*
* If there is data underflow or the pipe queue is empty we
@ -2182,15 +2182,15 @@ uhci_device_isoc_enter(struct usb_xfer *xfer)
* frame position. Else two isochronous transfers might
* overlap.
*/
xfer->pipe->isoc_next = (nframes + 3) & (UHCI_VFRAMELIST_COUNT - 1);
xfer->pipe->is_synced = 1;
DPRINTFN(3, "start next=%d\n", xfer->pipe->isoc_next);
xfer->endpoint->isoc_next = (nframes + 3) & (UHCI_VFRAMELIST_COUNT - 1);
xfer->endpoint->is_synced = 1;
DPRINTFN(3, "start next=%d\n", xfer->endpoint->isoc_next);
}
/*
* compute how many milliseconds the insertion is ahead of the
* current frame position:
*/
temp = (xfer->pipe->isoc_next - nframes) &
temp = (xfer->endpoint->isoc_next - nframes) &
(UHCI_VFRAMELIST_COUNT - 1);
/*
@ -2215,11 +2215,11 @@ uhci_device_isoc_enter(struct usb_xfer *xfer)
td = xfer->td_start[xfer->flags_int.curr_dma_set];
xfer->td_transfer_first = td;
pp_last = &sc->sc_isoc_p_last[xfer->pipe->isoc_next];
pp_last = &sc->sc_isoc_p_last[xfer->endpoint->isoc_next];
/* store starting position */
xfer->qh_pos = xfer->pipe->isoc_next;
xfer->qh_pos = xfer->endpoint->isoc_next;
while (nframes--) {
if (td == NULL) {
@ -2300,7 +2300,7 @@ uhci_device_isoc_enter(struct usb_xfer *xfer)
xfer->td_transfer_last = td_last;
/* update isoc_next */
xfer->pipe->isoc_next = (pp_last - &sc->sc_isoc_p_last[0]) &
xfer->endpoint->isoc_next = (pp_last - &sc->sc_isoc_p_last[0]) &
(UHCI_VFRAMELIST_COUNT - 1);
}
@ -3043,13 +3043,13 @@ uhci_xfer_setup(struct usb_setup_params *parm)
}
static void
uhci_pipe_init(struct usb_device *udev, struct usb_endpoint_descriptor *edesc,
struct usb_pipe *pipe)
uhci_ep_init(struct usb_device *udev, struct usb_endpoint_descriptor *edesc,
struct usb_endpoint *ep)
{
uhci_softc_t *sc = UHCI_BUS2SC(udev->bus);
DPRINTFN(2, "pipe=%p, addr=%d, endpt=%d, mode=%d (%d)\n",
pipe, udev->address,
DPRINTFN(2, "endpoint=%p, addr=%d, endpt=%d, mode=%d (%d)\n",
ep, udev->address,
edesc->bEndpointAddress, udev->flags.usb_mode,
sc->sc_addr);
@ -3060,19 +3060,19 @@ uhci_pipe_init(struct usb_device *udev, struct usb_endpoint_descriptor *edesc,
if (udev->device_index != sc->sc_addr) {
switch (edesc->bmAttributes & UE_XFERTYPE) {
case UE_CONTROL:
pipe->methods = &uhci_device_ctrl_methods;
ep->methods = &uhci_device_ctrl_methods;
break;
case UE_INTERRUPT:
pipe->methods = &uhci_device_intr_methods;
ep->methods = &uhci_device_intr_methods;
break;
case UE_ISOCHRONOUS:
if (udev->speed == USB_SPEED_FULL) {
pipe->methods = &uhci_device_isoc_methods;
ep->methods = &uhci_device_isoc_methods;
}
break;
case UE_BULK:
if (udev->speed != USB_SPEED_LOW) {
pipe->methods = &uhci_device_bulk_methods;
ep->methods = &uhci_device_bulk_methods;
}
break;
default:
@ -3114,7 +3114,7 @@ uhci_device_resume(struct usb_device *udev)
if (xfer->xroot->udev == udev) {
methods = xfer->pipe->methods;
methods = xfer->endpoint->methods;
qh = xfer->qh_start[xfer->flags_int.curr_dma_set];
if (methods == &uhci_device_bulk_methods) {
@ -3156,7 +3156,7 @@ uhci_device_suspend(struct usb_device *udev)
if (xfer->xroot->udev == udev) {
methods = xfer->pipe->methods;
methods = xfer->endpoint->methods;
qh = xfer->qh_start[xfer->flags_int.curr_dma_set];
if (xfer->flags_int.bandwidth_reclaimed) {
@ -3224,7 +3224,7 @@ uhci_set_hw_power(struct usb_bus *bus)
struct usb_bus_methods uhci_bus_methods =
{
.pipe_init = uhci_pipe_init,
.endpoint_init = uhci_ep_init,
.xfer_setup = uhci_xfer_setup,
.xfer_unsetup = uhci_xfer_unsetup,
.get_dma_delay = uhci_get_dma_delay,

View File

@ -829,7 +829,7 @@ uss820dci_setup_standard_chain(struct usb_xfer *xfer)
uint8_t ep_no;
DPRINTFN(9, "addr=%d endpt=%d sumlen=%d speed=%d\n",
xfer->address, UE_GET_ADDR(xfer->endpoint),
xfer->address, UE_GET_ADDR(xfer->endpointno),
xfer->sumlen, usb2_get_speed(xfer->xroot->udev));
temp.max_frame_size = xfer->max_frame_size;
@ -847,7 +847,7 @@ uss820dci_setup_standard_chain(struct usb_xfer *xfer)
temp.did_stall = !xfer->flags_int.control_stall;
sc = USS820_DCI_BUS2SC(xfer->xroot->bus);
ep_no = (xfer->endpoint & UE_ADDR);
ep_no = (xfer->endpointno & UE_ADDR);
/* check if we should prepend a setup message */
@ -873,7 +873,7 @@ uss820dci_setup_standard_chain(struct usb_xfer *xfer)
}
if (x != xfer->nframes) {
if (xfer->endpoint & UE_DIR_IN) {
if (xfer->endpointno & UE_DIR_IN) {
temp.func = &uss820dci_data_tx;
} else {
temp.func = &uss820dci_data_rx;
@ -939,7 +939,7 @@ uss820dci_setup_standard_chain(struct usb_xfer *xfer)
* Send a DATA1 message and invert the current
* endpoint direction.
*/
if (xfer->endpoint & UE_DIR_IN) {
if (xfer->endpointno & UE_DIR_IN) {
temp.func = &uss820dci_data_rx;
need_sync = 0;
} else {
@ -979,11 +979,11 @@ static void
uss820dci_intr_set(struct usb_xfer *xfer, uint8_t set)
{
struct uss820dci_softc *sc = USS820_DCI_BUS2SC(xfer->xroot->bus);
uint8_t ep_no = (xfer->endpoint & UE_ADDR);
uint8_t ep_no = (xfer->endpointno & UE_ADDR);
uint8_t ep_reg;
uint8_t temp;
DPRINTFN(15, "endpoint 0x%02x\n", xfer->endpoint);
DPRINTFN(15, "endpoint 0x%02x\n", xfer->endpointno);
if (ep_no > 3) {
ep_reg = USS820_SBIE1;
@ -1001,7 +1001,7 @@ uss820dci_intr_set(struct usb_xfer *xfer, uint8_t set)
ep_no |= (ep_no << 1); /* RX and TX interrupt */
}
} else {
if (!(xfer->endpoint & UE_DIR_IN)) {
if (!(xfer->endpointno & UE_DIR_IN)) {
ep_no <<= 1;
}
}
@ -1123,8 +1123,8 @@ uss820dci_standard_done(struct usb_xfer *xfer)
{
usb_error_t err = 0;
DPRINTFN(13, "xfer=%p pipe=%p transfer done\n",
xfer, xfer->pipe);
DPRINTFN(13, "xfer=%p endpoint=%p transfer done\n",
xfer, xfer->endpoint);
/* reset scanner */
@ -1172,8 +1172,8 @@ uss820dci_device_done(struct usb_xfer *xfer, usb_error_t error)
{
USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_OWNED);
DPRINTFN(2, "xfer=%p, pipe=%p, error=%d\n",
xfer, xfer->pipe, error);
DPRINTFN(2, "xfer=%p, endpoint=%p, error=%d\n",
xfer, xfer->endpoint, error);
if (xfer->flags_int.usb_mode == USB_MODE_DEVICE) {
uss820dci_intr_set(xfer, 0);
@ -1184,7 +1184,7 @@ uss820dci_device_done(struct usb_xfer *xfer, usb_error_t error)
static void
uss820dci_set_stall(struct usb_device *udev, struct usb_xfer *xfer,
struct usb_pipe *pipe)
struct usb_endpoint *ep)
{
struct uss820dci_softc *sc;
uint8_t ep_no;
@ -1194,7 +1194,7 @@ uss820dci_set_stall(struct usb_device *udev, struct usb_xfer *xfer,
USB_BUS_LOCK_ASSERT(udev->bus, MA_OWNED);
DPRINTFN(5, "pipe=%p\n", pipe);
DPRINTFN(5, "endpoint=%p\n", ep);
if (xfer) {
/* cancel any ongoing transfers */
@ -1202,9 +1202,9 @@ uss820dci_set_stall(struct usb_device *udev, struct usb_xfer *xfer,
}
/* set FORCESTALL */
sc = USS820_DCI_BUS2SC(udev->bus);
ep_no = (pipe->edesc->bEndpointAddress & UE_ADDR);
ep_dir = (pipe->edesc->bEndpointAddress & (UE_DIR_IN | UE_DIR_OUT));
ep_type = (pipe->edesc->bmAttributes & UE_XFERTYPE);
ep_no = (ep->edesc->bEndpointAddress & UE_ADDR);
ep_dir = (ep->edesc->bEndpointAddress & (UE_DIR_IN | UE_DIR_OUT));
ep_type = (ep->edesc->bmAttributes & UE_XFERTYPE);
if (ep_type == UE_CONTROL) {
/* should not happen */
@ -1271,14 +1271,14 @@ uss820dci_clear_stall_sub(struct uss820dci_softc *sc,
}
static void
uss820dci_clear_stall(struct usb_device *udev, struct usb_pipe *pipe)
uss820dci_clear_stall(struct usb_device *udev, struct usb_endpoint *ep)
{
struct uss820dci_softc *sc;
struct usb_endpoint_descriptor *ed;
USB_BUS_LOCK_ASSERT(udev->bus, MA_OWNED);
DPRINTFN(5, "pipe=%p\n", pipe);
DPRINTFN(5, "endpoint=%p\n", ep);
/* check mode */
if (udev->flags.usb_mode != USB_MODE_DEVICE) {
@ -1289,7 +1289,7 @@ uss820dci_clear_stall(struct usb_device *udev, struct usb_pipe *pipe)
sc = USS820_DCI_BUS2SC(udev->bus);
/* get endpoint descriptor */
ed = pipe->edesc;
ed = ep->edesc;
/* reset endpoint */
uss820dci_clear_stall_sub(sc,
@ -1642,7 +1642,7 @@ uss820dci_device_isoc_fs_enter(struct usb_xfer *xfer)
uint32_t nframes;
DPRINTFN(6, "xfer=%p next=%d nframes=%d\n",
xfer, xfer->pipe->isoc_next, xfer->nframes);
xfer, xfer->endpoint->isoc_next, xfer->nframes);
/* get the current frame index - we don't need the high bits */
@ -1652,9 +1652,9 @@ uss820dci_device_isoc_fs_enter(struct usb_xfer *xfer)
* check if the frame index is within the window where the
* frames will be inserted
*/
temp = (nframes - xfer->pipe->isoc_next) & USS820_SOFL_MASK;
temp = (nframes - xfer->endpoint->isoc_next) & USS820_SOFL_MASK;
if ((xfer->pipe->is_synced == 0) ||
if ((xfer->endpoint->is_synced == 0) ||
(temp < xfer->nframes)) {
/*
* If there is data underflow or the pipe queue is
@ -1662,15 +1662,15 @@ uss820dci_device_isoc_fs_enter(struct usb_xfer *xfer)
* of the current frame position. Else two isochronous
* transfers might overlap.
*/
xfer->pipe->isoc_next = (nframes + 3) & USS820_SOFL_MASK;
xfer->pipe->is_synced = 1;
DPRINTFN(3, "start next=%d\n", xfer->pipe->isoc_next);
xfer->endpoint->isoc_next = (nframes + 3) & USS820_SOFL_MASK;
xfer->endpoint->is_synced = 1;
DPRINTFN(3, "start next=%d\n", xfer->endpoint->isoc_next);
}
/*
* compute how many milliseconds the insertion is ahead of the
* current frame position:
*/
temp = (xfer->pipe->isoc_next - nframes) & USS820_SOFL_MASK;
temp = (xfer->endpoint->isoc_next - nframes) & USS820_SOFL_MASK;
/*
* pre-compute when the isochronous transfer will be finished:
@ -1680,7 +1680,7 @@ uss820dci_device_isoc_fs_enter(struct usb_xfer *xfer)
xfer->nframes;
/* compute frame number for next insertion */
xfer->pipe->isoc_next += xfer->nframes;
xfer->endpoint->isoc_next += xfer->nframes;
/* setup TDs */
uss820dci_setup_standard_chain(xfer);
@ -2243,7 +2243,7 @@ uss820dci_xfer_setup(struct usb_setup_params *parm)
*/
if (ntd) {
ep_no = xfer->endpoint & UE_ADDR;
ep_no = xfer->endpointno & UE_ADDR;
uss820dci_get_hw_ep_profile(parm->udev, &pf, ep_no);
if (pf == NULL) {
@ -2293,13 +2293,13 @@ uss820dci_xfer_unsetup(struct usb_xfer *xfer)
}
static void
uss820dci_pipe_init(struct usb_device *udev, struct usb_endpoint_descriptor *edesc,
struct usb_pipe *pipe)
uss820dci_ep_init(struct usb_device *udev, struct usb_endpoint_descriptor *edesc,
struct usb_endpoint *ep)
{
struct uss820dci_softc *sc = USS820_DCI_BUS2SC(udev->bus);
DPRINTFN(2, "pipe=%p, addr=%d, endpt=%d, mode=%d (%d)\n",
pipe, udev->address,
DPRINTFN(2, "endpoint=%p, addr=%d, endpt=%d, mode=%d (%d)\n",
ep, udev->address,
edesc->bEndpointAddress, udev->flags.usb_mode,
sc->sc_rt_addr);
@ -2315,16 +2315,16 @@ uss820dci_pipe_init(struct usb_device *udev, struct usb_endpoint_descriptor *ede
}
switch (edesc->bmAttributes & UE_XFERTYPE) {
case UE_CONTROL:
pipe->methods = &uss820dci_device_ctrl_methods;
ep->methods = &uss820dci_device_ctrl_methods;
break;
case UE_INTERRUPT:
pipe->methods = &uss820dci_device_intr_methods;
ep->methods = &uss820dci_device_intr_methods;
break;
case UE_ISOCHRONOUS:
pipe->methods = &uss820dci_device_isoc_fs_methods;
ep->methods = &uss820dci_device_isoc_fs_methods;
break;
case UE_BULK:
pipe->methods = &uss820dci_device_bulk_methods;
ep->methods = &uss820dci_device_bulk_methods;
break;
default:
/* do nothing */
@ -2335,7 +2335,7 @@ uss820dci_pipe_init(struct usb_device *udev, struct usb_endpoint_descriptor *ede
struct usb_bus_methods uss820dci_bus_methods =
{
.pipe_init = &uss820dci_pipe_init,
.endpoint_init = &uss820dci_ep_init,
.xfer_setup = &uss820dci_xfer_setup,
.xfer_unsetup = &uss820dci_xfer_unsetup,
.get_hw_ep_profile = &uss820dci_get_hw_ep_profile,

View File

@ -189,8 +189,8 @@ ugensa_attach(device_t dev)
/* Figure out how many interfaces this device has got */
for (cnt = 0; cnt < UGENSA_IFACE_MAX; cnt++) {
if ((usb2_get_pipe(uaa->device, cnt, ugensa_xfer_config + 0) == NULL) ||
(usb2_get_pipe(uaa->device, cnt, ugensa_xfer_config + 1) == NULL)) {
if ((usb2_get_endpoint(uaa->device, cnt, ugensa_xfer_config + 0) == NULL) ||
(usb2_get_endpoint(uaa->device, cnt, ugensa_xfer_config + 1) == NULL)) {
/* we have reached the end */
break;
}

View File

@ -254,7 +254,7 @@ umct_attach(device_t dev)
* The only way to differentiate it from the real interrupt
* endpoint is to look at the wMaxPacketSize field.
*/
maxp = UGETW(sc->sc_xfer[UMCT_BULK_DT_RD]->pipe->edesc->wMaxPacketSize);
maxp = UGETW(sc->sc_xfer[UMCT_BULK_DT_RD]->endpoint->edesc->wMaxPacketSize);
if (maxp == 0x2) {
/* guessed wrong - switch around endpoints */

View File

@ -595,7 +595,7 @@ ustorage_fs_t_bbb_command_callback(struct usb_xfer *xfer)
break;
}
/* If the pipe is already stalled, don't do another stall */
if (!xfer->pipe->is_stalled) {
if (!xfer->endpoint->is_stalled) {
sc->sc_transfer.data_error = 1;
}
/* try again */
@ -664,7 +664,7 @@ ustorage_fs_t_bbb_data_dump_callback(struct usb_xfer *xfer)
/*
* If the pipe is already stalled, don't do another stall:
*/
if (!xfer->pipe->is_stalled) {
if (!xfer->endpoint->is_stalled) {
sc->sc_transfer.data_error = 1;
}
/* try again */
@ -717,7 +717,7 @@ ustorage_fs_t_bbb_data_read_callback(struct usb_xfer *xfer)
break;
}
/* If the pipe is already stalled, don't do another stall */
if (!xfer->pipe->is_stalled) {
if (!xfer->endpoint->is_stalled) {
sc->sc_transfer.data_error = 1;
}
/* try again */
@ -779,7 +779,7 @@ ustorage_fs_t_bbb_data_write_callback(struct usb_xfer *xfer)
* If the pipe is already stalled, don't do another
* stall
*/
if (!xfer->pipe->is_stalled) {
if (!xfer->endpoint->is_stalled) {
sc->sc_transfer.data_error = 1;
}
/* try again */
@ -821,7 +821,7 @@ ustorage_fs_t_bbb_status_callback(struct usb_xfer *xfer)
break;
}
/* If the pipe is already stalled, don't do another stall */
if (!xfer->pipe->is_stalled) {
if (!xfer->endpoint->is_stalled) {
sc->sc_transfer.data_error = 1;
}
/* try again */

View File

@ -92,12 +92,12 @@
* - USB config 0
* - USB interfaces
* - USB alternative interfaces
* - USB pipes
* - USB endpoints
*
* - USB config 1
* - USB interfaces
* - USB alternative interfaces
* - USB pipes
* - USB endpoints
*/
/* Declaration of USB records */

View File

@ -385,10 +385,10 @@ usb_submit_urb(struct urb *urb, uint16_t mem_flags)
}
mtx_assert(&Giant, MA_OWNED);
if (urb->pipe == NULL) {
if (urb->endpoint == NULL) {
return (-EINVAL);
}
uhe = urb->pipe;
uhe = urb->endpoint;
/*
* Check that we have got a FreeBSD USB transfer that will dequeue
@ -454,10 +454,10 @@ usb_unlink_urb_sub(struct urb *urb, uint8_t drain)
}
mtx_assert(&Giant, MA_OWNED);
if (urb->pipe == NULL) {
if (urb->endpoint == NULL) {
return (-EINVAL);
}
uhe = urb->pipe;
uhe = urb->endpoint;
if (urb->bsd_urb_list.tqe_prev) {
@ -499,7 +499,7 @@ int
usb_clear_halt(struct usb_device *dev, struct usb_host_endpoint *uhe)
{
struct usb_config cfg[1];
struct usb_pipe *pipe;
struct usb_endpoint *ep;
uint8_t type;
uint8_t addr;
@ -515,11 +515,11 @@ usb_clear_halt(struct usb_device *dev, struct usb_host_endpoint *uhe)
cfg[0].endpoint = addr & UE_ADDR;
cfg[0].direction = addr & (UE_DIR_OUT | UE_DIR_IN);
pipe = usb2_get_pipe(dev, uhe->bsd_iface_index, cfg);
if (pipe == NULL)
ep = usb2_get_endpoint(dev, uhe->bsd_iface_index, cfg);
if (ep == NULL)
return (-EINVAL);
usb2_clear_data_toggle(dev, pipe);
usb2_clear_data_toggle(dev, ep);
return (usb_control_msg(dev, &dev->ep0,
UR_CLEAR_FEATURE, UT_WRITE_ENDPOINT,
@ -645,7 +645,7 @@ usb_control_msg(struct usb_device *dev, struct usb_host_endpoint *uhe,
return (-ENOMEM);
urb->dev = dev;
urb->pipe = uhe;
urb->endpoint = uhe;
bcopy(&req, urb->setup_packet, sizeof(req));
@ -908,7 +908,7 @@ usb_linux_create_usb_device(struct usb_device *udev, device_t dev)
udev->devnum = device_get_unit(dev);
bcopy(&udev->ddesc, &udev->descriptor,
sizeof(udev->descriptor));
bcopy(udev->default_pipe.edesc, &udev->ep0.desc,
bcopy(udev->default_ep.edesc, &udev->ep0.desc,
sizeof(udev->ep0.desc));
}
}

View File

@ -214,7 +214,7 @@ struct usb_driver {
#define PIPE_BULK 0x02 /* UE_BULK */
/* Whenever Linux references an USB endpoint:
* a) to initialize "urb->pipe"
* a) to initialize "urb->endpoint"
* b) second argument passed to "usb_control_msg()"
*
* Then it uses one of the following macros. The "endpoint" argument
@ -271,7 +271,7 @@ struct urb {
struct cv cv_wait;
struct usb_device *dev; /* (in) pointer to associated device */
struct usb_host_endpoint *pipe; /* (in) pipe pointer */
struct usb_host_endpoint *endpoint; /* (in) pipe pointer */
uint8_t *setup_packet; /* (in) setup packet (control only) */
uint8_t *bsd_data_ptr;
void *transfer_buffer; /* (in) associated data buffer */
@ -311,7 +311,7 @@ struct urb {
int usb_submit_urb(struct urb *urb, uint16_t mem_flags);
int usb_unlink_urb(struct urb *urb);
int usb_clear_halt(struct usb_device *dev, struct usb_host_endpoint *uhe);
int usb_control_msg(struct usb_device *dev, struct usb_host_endpoint *pipe,
int usb_control_msg(struct usb_device *dev, struct usb_host_endpoint *ep,
uint8_t request, uint8_t requesttype, uint16_t value,
uint16_t index, void *data, uint16_t size, usb_timeout_t timeout);
int usb_set_interface(struct usb_device *dev, uint8_t ifnum,

View File

@ -35,7 +35,7 @@
struct usb_bus;
struct usb_page;
struct usb_pipe;
struct usb_endpoint;
struct usb_page_cache;
struct usb_setup_params;
struct usb_hw_ep_profile;
@ -58,7 +58,8 @@ struct usb_bus_methods {
usb_handle_req_t *roothub_exec;
void (*pipe_init) (struct usb_device *, struct usb_endpoint_descriptor *, struct usb_pipe *);
void (*endpoint_init) (struct usb_device *,
struct usb_endpoint_descriptor *, struct usb_endpoint *);
void (*xfer_setup) (struct usb_setup_params *);
void (*xfer_unsetup) (struct usb_xfer *);
void (*get_dma_delay) (struct usb_bus *, uint32_t *);
@ -95,8 +96,8 @@ struct usb_bus_methods {
/* USB Device mode only - Mandatory */
void (*get_hw_ep_profile) (struct usb_device *udev, const struct usb_hw_ep_profile **ppf, uint8_t ep_addr);
void (*set_stall) (struct usb_device *udev, struct usb_xfer *xfer, struct usb_pipe *pipe);
void (*clear_stall) (struct usb_device *udev, struct usb_pipe *pipe);
void (*set_stall) (struct usb_device *udev, struct usb_xfer *xfer, struct usb_endpoint *ep);
void (*clear_stall) (struct usb_device *udev, struct usb_endpoint *ep);
};

View File

@ -226,8 +226,8 @@
* receiving or transferring data.
*/
#define USB_GET_DATA_ISREAD(xfer) ((xfer)->flags_int.usb_mode == \
USB_MODE_DEVICE ? (((xfer)->endpoint & UE_DIR_IN) ? 0 : 1) : \
(((xfer)->endpoint & UE_DIR_IN) ? 1 : 0))
USB_MODE_DEVICE ? (((xfer)->endpointno & UE_DIR_IN) ? 0 : 1) : \
(((xfer)->endpointno & UE_DIR_IN) ? 1 : 0))
/*
* The following macros are used used to convert milliseconds into
@ -412,7 +412,7 @@ struct usb_xfer {
struct usb_xfer_queue *wait_queue; /* pointer to queue that we
* are waiting on */
struct usb_page *dma_page_ptr;
struct usb_pipe *pipe; /* our USB pipe */
struct usb_endpoint *endpoint; /* our USB endpoint */
struct usb_xfer_root *xroot; /* used by HC driver */
void *qh_start[2]; /* used by HC driver */
void *td_start[2]; /* used by HC driver */
@ -447,7 +447,7 @@ struct usb_xfer {
usb_timeout_t interval; /* milliseconds */
uint8_t address; /* physical USB address */
uint8_t endpoint; /* physical USB endpoint */
uint8_t endpointno; /* physical USB endpoint */
uint8_t max_packet_count;
uint8_t usb2_smask;
uint8_t usb2_cmask;

View File

@ -82,42 +82,42 @@ usb2_dump_device(struct usb_device *udev)
/*------------------------------------------------------------------------*
* usb2_dump_queue
*
* This function dumps the USB transfer that are queued up on an USB pipe.
* This function dumps the USB transfer that are queued up on an USB endpoint.
*------------------------------------------------------------------------*/
void
usb2_dump_queue(struct usb_pipe *pipe)
usb2_dump_queue(struct usb_endpoint *ep)
{
struct usb_xfer *xfer;
printf("usb2_dump_queue: pipe=%p xfer: ", pipe);
TAILQ_FOREACH(xfer, &pipe->pipe_q.head, wait_entry) {
printf("usb2_dump_queue: endpoint=%p xfer: ", ep);
TAILQ_FOREACH(xfer, &ep->endpoint_q.head, wait_entry) {
printf(" %p", xfer);
}
printf("\n");
}
/*------------------------------------------------------------------------*
* usb2_dump_pipe
* usb2_dump_endpoint
*
* This function dumps information about an USB pipe.
* This function dumps information about an USB endpoint.
*------------------------------------------------------------------------*/
void
usb2_dump_pipe(struct usb_pipe *pipe)
usb2_dump_endpoint(struct usb_endpoint *ep)
{
if (pipe) {
printf("usb2_dump_pipe: pipe=%p", pipe);
if (ep) {
printf("usb2_dump_endpoint: endpoint=%p", ep);
printf(" edesc=%p isoc_next=%d toggle_next=%d",
pipe->edesc, pipe->isoc_next, pipe->toggle_next);
ep->edesc, ep->isoc_next, ep->toggle_next);
if (pipe->edesc) {
if (ep->edesc) {
printf(" bEndpointAddress=0x%02x",
pipe->edesc->bEndpointAddress);
ep->edesc->bEndpointAddress);
}
printf("\n");
usb2_dump_queue(pipe);
usb2_dump_queue(ep);
} else {
printf("usb2_dump_pipe: pipe=NULL\n");
printf("usb2_dump_endpoint: endpoint=NULL\n");
}
}
@ -134,18 +134,18 @@ usb2_dump_xfer(struct usb_xfer *xfer)
if (xfer == NULL) {
return;
}
if (xfer->pipe == NULL) {
printf("xfer %p: pipe=NULL\n",
if (xfer->endpoint == NULL) {
printf("xfer %p: endpoint=NULL\n",
xfer);
return;
}
udev = xfer->xroot->udev;
printf("xfer %p: udev=%p vid=0x%04x pid=0x%04x addr=%d "
"pipe=%p ep=0x%02x attr=0x%02x\n",
"endpoint=%p ep=0x%02x attr=0x%02x\n",
xfer, udev,
UGETW(udev->ddesc.idVendor),
UGETW(udev->ddesc.idProduct),
udev->address, xfer->pipe,
xfer->pipe->edesc->bEndpointAddress,
xfer->pipe->edesc->bmAttributes);
udev->address, xfer->endpoint,
xfer->endpoint->edesc->bEndpointAddress,
xfer->endpoint->edesc->bmAttributes);
}

View File

@ -53,13 +53,13 @@ extern int usb2_debug;
struct usb_interface;
struct usb_device;
struct usb_pipe;
struct usb_endpoint;
struct usb_xfer;
void usb2_dump_iface(struct usb_interface *iface);
void usb2_dump_device(struct usb_device *udev);
void usb2_dump_queue(struct usb_pipe *pipe);
void usb2_dump_pipe(struct usb_pipe *pipe);
void usb2_dump_queue(struct usb_endpoint *ep);
void usb2_dump_endpoint(struct usb_endpoint *ep);
void usb2_dump_xfer(struct usb_xfer *xfer);
#endif /* _USB2_DEBUG_H_ */

View File

@ -83,7 +83,7 @@ static int usb2_fifo_uiomove(struct usb_fifo *, void *, int,
struct uio *);
static void usb2_fifo_check_methods(struct usb_fifo_methods *);
static struct usb_fifo *usb2_fifo_alloc(void);
static struct usb_pipe *usb2_dev_get_pipe(struct usb_device *, uint8_t,
static struct usb_endpoint *usb2_dev_get_ep(struct usb_device *, uint8_t,
uint8_t);
static void usb2_loc_fill(struct usb_fs_privdata *,
struct usb_cdev_privdata *);
@ -360,13 +360,13 @@ usb2_fifo_create(struct usb_cdev_privdata *cpd,
{
struct usb_device *udev = cpd->udev;
struct usb_fifo *f;
struct usb_pipe *pipe;
struct usb_endpoint *ep;
uint8_t n;
uint8_t is_tx;
uint8_t is_rx;
uint8_t no_null;
uint8_t is_busy;
int ep = cpd->ep_addr;
int e = cpd->ep_addr;
is_tx = (cpd->fflags & FWRITE) ? 1 : 0;
is_rx = (cpd->fflags & FREAD) ? 1 : 0;
@ -374,7 +374,7 @@ usb2_fifo_create(struct usb_cdev_privdata *cpd,
is_busy = 0;
/* Preallocated FIFO */
if (ep < 0) {
if (e < 0) {
DPRINTFN(5, "Preallocated FIFO\n");
if (is_tx) {
f = udev->fifo[cpd->fifo_index + USB_FIFO_TX];
@ -391,10 +391,10 @@ usb2_fifo_create(struct usb_cdev_privdata *cpd,
return (0);
}
KASSERT(ep >= 0 && ep <= 15, ("endpoint %d out of range", ep));
KASSERT(e >= 0 && e <= 15, ("endpoint %d out of range", e));
/* search for a free FIFO slot */
DPRINTFN(5, "Endpoint device, searching for 0x%02x\n", ep);
DPRINTFN(5, "Endpoint device, searching for 0x%02x\n", e);
for (n = 0;; n += 2) {
if (n == USB_FIFO_MAX) {
@ -411,7 +411,7 @@ usb2_fifo_create(struct usb_cdev_privdata *cpd,
if (is_tx) {
f = udev->fifo[n + USB_FIFO_TX];
if (f != NULL) {
if (f->dev_ep_index != ep) {
if (f->dev_ep_index != e) {
/* wrong endpoint index */
continue;
}
@ -428,7 +428,7 @@ usb2_fifo_create(struct usb_cdev_privdata *cpd,
if (is_rx) {
f = udev->fifo[n + USB_FIFO_RX];
if (f != NULL) {
if (f->dev_ep_index != ep) {
if (f->dev_ep_index != e) {
/* wrong endpoint index */
continue;
}
@ -445,14 +445,14 @@ usb2_fifo_create(struct usb_cdev_privdata *cpd,
}
if (no_null == 0) {
if (ep >= (USB_EP_MAX / 2)) {
if (e >= (USB_EP_MAX / 2)) {
/* we don't create any endpoints in this range */
DPRINTFN(5, "ep out of range\n");
return (is_busy ? EBUSY : EINVAL);
}
}
if ((ep != 0) && is_busy) {
if ((e != 0) && is_busy) {
/*
* Only the default control endpoint is allowed to be
* opened multiple times!
@ -464,10 +464,10 @@ usb2_fifo_create(struct usb_cdev_privdata *cpd,
/* Check TX FIFO */
if (is_tx &&
(udev->fifo[n + USB_FIFO_TX] == NULL)) {
pipe = usb2_dev_get_pipe(udev, ep, USB_FIFO_TX);
DPRINTFN(5, "dev_get_pipe(%d, 0x%x)\n", ep, USB_FIFO_TX);
if (pipe == NULL) {
DPRINTFN(5, "dev_get_pipe returned NULL\n");
ep = usb2_dev_get_ep(udev, e, USB_FIFO_TX);
DPRINTFN(5, "dev_get_endpoint(%d, 0x%x)\n", e, USB_FIFO_TX);
if (ep == NULL) {
DPRINTFN(5, "dev_get_endpoint returned NULL\n");
return (EINVAL);
}
f = usb2_fifo_alloc();
@ -477,11 +477,11 @@ usb2_fifo_create(struct usb_cdev_privdata *cpd,
}
/* update some fields */
f->fifo_index = n + USB_FIFO_TX;
f->dev_ep_index = ep;
f->dev_ep_index = e;
f->priv_mtx = udev->default_mtx;
f->priv_sc0 = pipe;
f->priv_sc0 = ep;
f->methods = &usb2_ugen_methods;
f->iface_index = pipe->iface_index;
f->iface_index = ep->iface_index;
f->udev = udev;
mtx_lock(&usb2_ref_lock);
udev->fifo[n + USB_FIFO_TX] = f;
@ -491,10 +491,10 @@ usb2_fifo_create(struct usb_cdev_privdata *cpd,
if (is_rx &&
(udev->fifo[n + USB_FIFO_RX] == NULL)) {
pipe = usb2_dev_get_pipe(udev, ep, USB_FIFO_RX);
DPRINTFN(5, "dev_get_pipe(%d, 0x%x)\n", ep, USB_FIFO_RX);
if (pipe == NULL) {
DPRINTFN(5, "dev_get_pipe returned NULL\n");
ep = usb2_dev_get_ep(udev, e, USB_FIFO_RX);
DPRINTFN(5, "dev_get_endpoint(%d, 0x%x)\n", e, USB_FIFO_RX);
if (ep == NULL) {
DPRINTFN(5, "dev_get_endpoint returned NULL\n");
return (EINVAL);
}
f = usb2_fifo_alloc();
@ -504,11 +504,11 @@ usb2_fifo_create(struct usb_cdev_privdata *cpd,
}
/* update some fields */
f->fifo_index = n + USB_FIFO_RX;
f->dev_ep_index = ep;
f->dev_ep_index = e;
f->priv_mtx = udev->default_mtx;
f->priv_sc0 = pipe;
f->priv_sc0 = ep;
f->methods = &usb2_ugen_methods;
f->iface_index = pipe->iface_index;
f->iface_index = ep->iface_index;
f->udev = udev;
mtx_lock(&usb2_ref_lock);
udev->fifo[n + USB_FIFO_RX] = f;
@ -586,14 +586,14 @@ usb2_fifo_free(struct usb_fifo *f)
free(f, M_USBDEV);
}
static struct usb_pipe *
usb2_dev_get_pipe(struct usb_device *udev, uint8_t ep_index, uint8_t dir)
static struct usb_endpoint *
usb2_dev_get_ep(struct usb_device *udev, uint8_t ep_index, uint8_t dir)
{
struct usb_pipe *pipe;
struct usb_endpoint *ep;
uint8_t ep_dir;
if (ep_index == 0) {
pipe = &udev->default_pipe;
ep = &udev->default_ep;
} else {
if (dir == USB_FIFO_RX) {
if (udev->flags.usb_mode == USB_MODE_HOST) {
@ -608,18 +608,18 @@ usb2_dev_get_pipe(struct usb_device *udev, uint8_t ep_index, uint8_t dir)
ep_dir = UE_DIR_IN;
}
}
pipe = usb2_get_pipe_by_addr(udev, ep_index | ep_dir);
ep = usb2_get_ep_by_addr(udev, ep_index | ep_dir);
}
if (pipe == NULL) {
/* if the pipe does not exist then return */
if (ep == NULL) {
/* if the endpoint does not exist then return */
return (NULL);
}
if (pipe->edesc == NULL) {
/* invalid pipe */
if (ep->edesc == NULL) {
/* invalid endpoint */
return (NULL);
}
return (pipe); /* success */
return (ep); /* success */
}
/*------------------------------------------------------------------------*

View File

@ -57,8 +57,8 @@
/* function prototypes */
static void usb2_init_pipe(struct usb_device *, uint8_t,
struct usb_endpoint_descriptor *, struct usb_pipe *);
static void usb2_init_endpoint(struct usb_device *, uint8_t,
struct usb_endpoint_descriptor *, struct usb_endpoint *);
static void usb2_unconfigure(struct usb_device *, uint8_t);
static void usb2_detach_device(struct usb_device *, uint8_t, uint8_t);
static void usb2_detach_device_sub(struct usb_device *, device_t *,
@ -103,20 +103,20 @@ usb2_statestr(enum usb_dev_state state)
}
/*------------------------------------------------------------------------*
* usb2_get_pipe_by_addr
* usb2_get_ep_by_addr
*
* This function searches for an USB pipe by endpoint address and
* This function searches for an USB ep by endpoint address and
* direction.
*
* Returns:
* NULL: Failure
* Else: Success
*------------------------------------------------------------------------*/
struct usb_pipe *
usb2_get_pipe_by_addr(struct usb_device *udev, uint8_t ea_val)
struct usb_endpoint *
usb2_get_ep_by_addr(struct usb_device *udev, uint8_t ea_val)
{
struct usb_pipe *pipe = udev->pipes;
struct usb_pipe *pipe_end = udev->pipes + udev->pipes_max;
struct usb_endpoint *ep = udev->endpoints;
struct usb_endpoint *ep_end = udev->endpoints + udev->endpoints_max;
enum {
EA_MASK = (UE_DIR_IN | UE_DIR_OUT | UE_ADDR),
};
@ -128,50 +128,50 @@ usb2_get_pipe_by_addr(struct usb_device *udev, uint8_t ea_val)
ea_val &= EA_MASK;
/*
* Iterate accross all the USB pipes searching for a match
* Iterate accross all the USB endpoints searching for a match
* based on the endpoint address:
*/
for (; pipe != pipe_end; pipe++) {
for (; ep != ep_end; ep++) {
if (pipe->edesc == NULL) {
if (ep->edesc == NULL) {
continue;
}
/* do the mask and check the value */
if ((pipe->edesc->bEndpointAddress & EA_MASK) == ea_val) {
if ((ep->edesc->bEndpointAddress & EA_MASK) == ea_val) {
goto found;
}
}
/*
* The default pipe is always present and is checked separately:
* The default endpoint is always present and is checked separately:
*/
if ((udev->default_pipe.edesc) &&
((udev->default_pipe.edesc->bEndpointAddress & EA_MASK) == ea_val)) {
pipe = &udev->default_pipe;
if ((udev->default_ep.edesc) &&
((udev->default_ep.edesc->bEndpointAddress & EA_MASK) == ea_val)) {
ep = &udev->default_ep;
goto found;
}
return (NULL);
found:
return (pipe);
return (ep);
}
/*------------------------------------------------------------------------*
* usb2_get_pipe
* usb2_get_endpoint
*
* This function searches for an USB pipe based on the information
* This function searches for an USB endpoint based on the information
* given by the passed "struct usb_config" pointer.
*
* Return values:
* NULL: No match.
* Else: Pointer to "struct usb_pipe".
* Else: Pointer to "struct usb_endpoint".
*------------------------------------------------------------------------*/
struct usb_pipe *
usb2_get_pipe(struct usb_device *udev, uint8_t iface_index,
struct usb_endpoint *
usb2_get_endpoint(struct usb_device *udev, uint8_t iface_index,
const struct usb_config *setup)
{
struct usb_pipe *pipe = udev->pipes;
struct usb_pipe *pipe_end = udev->pipes + udev->pipes_max;
struct usb_endpoint *ep = udev->endpoints;
struct usb_endpoint *ep_end = udev->endpoints + udev->endpoints_max;
uint8_t index = setup->ep_index;
uint8_t ea_mask;
uint8_t ea_val;
@ -187,7 +187,7 @@ usb2_get_pipe(struct usb_device *udev, uint8_t iface_index,
if (setup->usb_mode != USB_MODE_DUAL &&
udev->flags.usb_mode != setup->usb_mode) {
/* wrong mode - no pipe */
/* wrong mode - no endpoint */
return (NULL);
}
@ -238,20 +238,20 @@ usb2_get_pipe(struct usb_device *udev, uint8_t iface_index,
}
/*
* Iterate accross all the USB pipes searching for a match
* Iterate accross all the USB endpoints searching for a match
* based on the endpoint address. Note that we are searching
* the pipes from the beginning of the "udev->pipes" array.
* the endpoints from the beginning of the "udev->endpoints" array.
*/
for (; pipe != pipe_end; pipe++) {
for (; ep != ep_end; ep++) {
if ((pipe->edesc == NULL) ||
(pipe->iface_index != iface_index)) {
if ((ep->edesc == NULL) ||
(ep->iface_index != iface_index)) {
continue;
}
/* do the masks and check the values */
if (((pipe->edesc->bEndpointAddress & ea_mask) == ea_val) &&
((pipe->edesc->bmAttributes & type_mask) == type_val)) {
if (((ep->edesc->bEndpointAddress & ea_mask) == ea_val) &&
((ep->edesc->bmAttributes & type_mask) == type_val)) {
if (!index--) {
goto found;
}
@ -259,21 +259,21 @@ usb2_get_pipe(struct usb_device *udev, uint8_t iface_index,
}
/*
* Match against default pipe last, so that "any pipe", "any
* address" and "any direction" returns the first pipe of the
* Match against default endpoint last, so that "any endpoint", "any
* address" and "any direction" returns the first endpoint of the
* interface. "iface_index" and "direction" is ignored:
*/
if ((udev->default_pipe.edesc) &&
((udev->default_pipe.edesc->bEndpointAddress & ea_mask) == ea_val) &&
((udev->default_pipe.edesc->bmAttributes & type_mask) == type_val) &&
if ((udev->default_ep.edesc) &&
((udev->default_ep.edesc->bEndpointAddress & ea_mask) == ea_val) &&
((udev->default_ep.edesc->bmAttributes & type_mask) == type_val) &&
(!index)) {
pipe = &udev->default_pipe;
ep = &udev->default_ep;
goto found;
}
return (NULL);
found:
return (pipe);
return (ep);
}
/*------------------------------------------------------------------------*
@ -300,70 +300,70 @@ usb2_interface_count(struct usb_device *udev, uint8_t *count)
/*------------------------------------------------------------------------*
* usb2_init_pipe
* usb2_init_endpoint
*
* This function will initialise the USB pipe structure pointed to by
* the "pipe" argument. The structure pointed to by "pipe" must be
* This function will initialise the USB endpoint structure pointed to by
* the "endpoint" argument. The structure pointed to by "endpoint" must be
* zeroed before calling this function.
*------------------------------------------------------------------------*/
static void
usb2_init_pipe(struct usb_device *udev, uint8_t iface_index,
struct usb_endpoint_descriptor *edesc, struct usb_pipe *pipe)
usb2_init_endpoint(struct usb_device *udev, uint8_t iface_index,
struct usb_endpoint_descriptor *edesc, struct usb_endpoint *ep)
{
struct usb_bus_methods *methods;
methods = udev->bus->methods;
(methods->pipe_init) (udev, edesc, pipe);
(methods->endpoint_init) (udev, edesc, ep);
/* initialise USB pipe structure */
pipe->edesc = edesc;
pipe->iface_index = iface_index;
TAILQ_INIT(&pipe->pipe_q.head);
pipe->pipe_q.command = &usb2_pipe_start;
/* initialise USB endpoint structure */
ep->edesc = edesc;
ep->iface_index = iface_index;
TAILQ_INIT(&ep->endpoint_q.head);
ep->endpoint_q.command = &usb2_pipe_start;
/* the pipe is not supported by the hardware */
if (pipe->methods == NULL)
if (ep->methods == NULL)
return;
/* clear stall, if any */
if (methods->clear_stall != NULL) {
USB_BUS_LOCK(udev->bus);
(methods->clear_stall) (udev, pipe);
(methods->clear_stall) (udev, ep);
USB_BUS_UNLOCK(udev->bus);
}
}
/*-----------------------------------------------------------------------*
* usb2_pipe_foreach
* usb2_endpoint_foreach
*
* This function will iterate all the USB endpoints except the control
* endpoint. This function is NULL safe.
*
* Return values:
* NULL: End of USB pipes
* Else: Pointer to next USB pipe
* NULL: End of USB endpoints
* Else: Pointer to next USB endpoint
*------------------------------------------------------------------------*/
struct usb_pipe *
usb2_pipe_foreach(struct usb_device *udev, struct usb_pipe *pipe)
struct usb_endpoint *
usb2_endpoint_foreach(struct usb_device *udev, struct usb_endpoint *ep)
{
struct usb_pipe *pipe_end = udev->pipes + udev->pipes_max;
struct usb_endpoint *ep_end = udev->endpoints + udev->endpoints_max;
/* be NULL safe */
if (udev == NULL)
return (NULL);
/* get next pipe */
if (pipe == NULL)
pipe = udev->pipes;
/* get next endpoint */
if (ep == NULL)
ep = udev->endpoints;
else
pipe++;
ep++;
/* find next allocated pipe */
while (pipe != pipe_end) {
if (pipe->edesc != NULL)
return (pipe);
pipe++;
/* find next allocated ep */
while (ep != ep_end) {
if (ep->edesc != NULL)
return (ep);
ep++;
}
return (NULL);
}
@ -371,7 +371,7 @@ usb2_pipe_foreach(struct usb_device *udev, struct usb_pipe *pipe)
/*------------------------------------------------------------------------*
* usb2_unconfigure
*
* This function will free all USB interfaces and USB pipes belonging
* This function will free all USB interfaces and USB endpoints belonging
* to an USB device.
*
* Flag values, see "USB_UNCFG_FLAG_XXX".
@ -412,7 +412,7 @@ usb2_unconfigure(struct usb_device *udev, uint8_t flag)
usb2_config_parse(udev, USB_IFACE_INDEX_ANY, USB_CFG_FREE);
/* free "cdesc" after "ifaces" and "pipes", if any */
/* free "cdesc" after "ifaces" and "endpoints", if any */
if (udev->cdesc != NULL) {
if (udev->flags.usb_mode != USB_MODE_DEVICE)
free(udev->cdesc, M_USB);
@ -574,8 +574,8 @@ usb2_set_config_index(struct usb_device *udev, uint8_t index)
/*------------------------------------------------------------------------*
* usb2_config_parse
*
* This function will allocate and free USB interfaces and USB pipes,
* parse the USB configuration structure and initialise the USB pipes
* This function will allocate and free USB interfaces and USB endpoints,
* parse the USB configuration structure and initialise the USB endpoints
* and interfaces. If "iface_index" is not equal to
* "USB_IFACE_INDEX_ANY" then the "cmd" parameter is the
* alternate_setting to be selected for the given interface. Else the
@ -595,7 +595,7 @@ usb2_config_parse(struct usb_device *udev, uint8_t iface_index, uint8_t cmd)
struct usb_interface_descriptor *id;
struct usb_endpoint_descriptor *ed;
struct usb_interface *iface;
struct usb_pipe *pipe;
struct usb_endpoint *ep;
usb_error_t err;
uint8_t ep_curr;
uint8_t ep_max;
@ -623,28 +623,28 @@ usb2_config_parse(struct usb_device *udev, uint8_t iface_index, uint8_t cmd)
if (cmd == USB_CFG_INIT) {
sx_assert(udev->default_sx + 1, SA_LOCKED);
/* check for in-use pipes */
/* check for in-use endpoints */
pipe = udev->pipes;
ep_max = udev->pipes_max;
ep = udev->endpoints;
ep_max = udev->endpoints_max;
while (ep_max--) {
/* look for matching pipes */
/* look for matching endpoints */
if ((iface_index == USB_IFACE_INDEX_ANY) ||
(iface_index == pipe->iface_index)) {
if (pipe->refcount != 0) {
(iface_index == ep->iface_index)) {
if (ep->refcount != 0) {
/*
* This typically indicates a
* more serious error.
*/
err = USB_ERR_IN_USE;
} else {
/* reset pipe */
memset(pipe, 0, sizeof(*pipe));
/* make sure we don't zero the pipe again */
pipe->iface_index = USB_IFACE_INDEX_ANY;
/* reset endpoint */
memset(ep, 0, sizeof(*ep));
/* make sure we don't zero the endpoint again */
ep->iface_index = USB_IFACE_INDEX_ANY;
}
}
pipe++;
ep++;
}
if (err)
@ -708,11 +708,11 @@ usb2_config_parse(struct usb_device *udev, uint8_t iface_index, uint8_t cmd)
if (temp == USB_EP_MAX)
break; /* crazy */
pipe = udev->pipes + temp;
ep = udev->endpoints + temp;
if (do_init) {
usb2_init_pipe(udev,
ips.iface_index, ed, pipe);
usb2_init_endpoint(udev,
ips.iface_index, ed, ep);
}
temp ++;
@ -740,19 +740,19 @@ usb2_config_parse(struct usb_device *udev, uint8_t iface_index, uint8_t cmd)
}
}
if (ep_max != 0) {
udev->pipes = malloc(sizeof(*pipe) * ep_max,
udev->endpoints = malloc(sizeof(*ep) * ep_max,
M_USB, M_WAITOK | M_ZERO);
if (udev->pipes == NULL) {
if (udev->endpoints == NULL) {
err = USB_ERR_NOMEM;
goto done;
}
} else {
udev->pipes = NULL;
udev->endpoints = NULL;
}
USB_BUS_LOCK(udev->bus);
udev->pipes_max = ep_max;
udev->endpoints_max = ep_max;
/* reset any ongoing clear-stall */
udev->pipe_curr = NULL;
udev->ep_curr = NULL;
USB_BUS_UNLOCK(udev->bus);
}
@ -761,19 +761,19 @@ usb2_config_parse(struct usb_device *udev, uint8_t iface_index, uint8_t cmd)
if (cmd == USB_CFG_ALLOC) {
cleanup:
USB_BUS_LOCK(udev->bus);
udev->pipes_max = 0;
udev->endpoints_max = 0;
/* reset any ongoing clear-stall */
udev->pipe_curr = NULL;
udev->ep_curr = NULL;
USB_BUS_UNLOCK(udev->bus);
/* cleanup */
if (udev->ifaces != NULL)
free(udev->ifaces, M_USB);
if (udev->pipes != NULL)
free(udev->pipes, M_USB);
if (udev->endpoints != NULL)
free(udev->endpoints, M_USB);
udev->ifaces = NULL;
udev->pipes = NULL;
udev->endpoints = NULL;
udev->ifaces_max = 0;
}
}
@ -859,14 +859,14 @@ usb2_set_alt_interface_index(struct usb_device *udev,
* Else: Failure
*------------------------------------------------------------------------*/
usb_error_t
usb2_set_endpoint_stall(struct usb_device *udev, struct usb_pipe *pipe,
usb2_set_endpoint_stall(struct usb_device *udev, struct usb_endpoint *ep,
uint8_t do_stall)
{
struct usb_xfer *xfer;
uint8_t et;
uint8_t was_stalled;
if (pipe == NULL) {
if (ep == NULL) {
/* nothing to do */
DPRINTF("Cannot find endpoint\n");
/*
@ -877,7 +877,7 @@ usb2_set_endpoint_stall(struct usb_device *udev, struct usb_pipe *pipe,
*/
return (0);
}
et = (pipe->edesc->bmAttributes & UE_XFERTYPE);
et = (ep->edesc->bmAttributes & UE_XFERTYPE);
if ((et != UE_BULK) &&
(et != UE_INTERRUPT)) {
@ -891,22 +891,22 @@ usb2_set_endpoint_stall(struct usb_device *udev, struct usb_pipe *pipe,
USB_BUS_LOCK(udev->bus);
/* store current stall state */
was_stalled = pipe->is_stalled;
was_stalled = ep->is_stalled;
/* check for no change */
if (was_stalled && do_stall) {
/* if the pipe is already stalled do nothing */
/* if the endpoint is already stalled do nothing */
USB_BUS_UNLOCK(udev->bus);
DPRINTF("No change\n");
return (0);
}
/* set stalled state */
pipe->is_stalled = 1;
ep->is_stalled = 1;
if (do_stall || (!was_stalled)) {
if (!was_stalled) {
/* lookup the current USB transfer, if any */
xfer = pipe->pipe_q.curr;
xfer = ep->endpoint_q.curr;
} else {
xfer = NULL;
}
@ -916,16 +916,16 @@ usb2_set_endpoint_stall(struct usb_device *udev, struct usb_pipe *pipe,
* complete the USB transfer like in case of a timeout
* setting the error code "USB_ERR_STALLED".
*/
(udev->bus->methods->set_stall) (udev, xfer, pipe);
(udev->bus->methods->set_stall) (udev, xfer, ep);
}
if (!do_stall) {
pipe->toggle_next = 0; /* reset data toggle */
pipe->is_stalled = 0; /* clear stalled state */
ep->toggle_next = 0; /* reset data toggle */
ep->is_stalled = 0; /* clear stalled state */
(udev->bus->methods->clear_stall) (udev, pipe);
(udev->bus->methods->clear_stall) (udev, ep);
/* start up the current or next transfer, if any */
usb2_command_wrapper(&pipe->pipe_q, pipe->pipe_q.curr);
usb2_command_wrapper(&ep->endpoint_q, ep->endpoint_q.curr);
}
USB_BUS_UNLOCK(udev->bus);
return (0);
@ -937,21 +937,21 @@ usb2_set_endpoint_stall(struct usb_device *udev, struct usb_pipe *pipe,
usb_error_t
usb2_reset_iface_endpoints(struct usb_device *udev, uint8_t iface_index)
{
struct usb_pipe *pipe;
struct usb_pipe *pipe_end;
struct usb_endpoint *ep;
struct usb_endpoint *ep_end;
usb_error_t err;
pipe = udev->pipes;
pipe_end = udev->pipes + udev->pipes_max;
ep = udev->endpoints;
ep_end = udev->endpoints + udev->endpoints_max;
for (; pipe != pipe_end; pipe++) {
for (; ep != ep_end; ep++) {
if ((pipe->edesc == NULL) ||
(pipe->iface_index != iface_index)) {
if ((ep->edesc == NULL) ||
(ep->iface_index != iface_index)) {
continue;
}
/* simulate a clear stall from the peer */
err = usb2_set_endpoint_stall(udev, pipe, 0);
err = usb2_set_endpoint_stall(udev, ep, 0);
if (err) {
/* just ignore */
}
@ -1525,10 +1525,10 @@ usb2_alloc_device(device_t parent_dev, struct usb_bus *bus,
hub = hub->parent_hub;
}
/* init the default pipe */
usb2_init_pipe(udev, 0,
/* init the default endpoint */
usb2_init_endpoint(udev, 0,
&udev->default_ep_desc,
&udev->default_pipe);
&udev->default_ep);
/* set device index */
udev->device_index = device_index;

View File

@ -77,11 +77,11 @@ struct usb_host_interface {
} __aligned(USB_HOST_ALIGN);
/*
* The following structure defines an USB pipe which is equal to an
* The following structure defines an USB endpoint
* USB endpoint.
*/
struct usb_pipe {
struct usb_xfer_queue pipe_q; /* queue of USB transfers */
struct usb_endpoint {
struct usb_xfer_queue endpoint_q; /* queue of USB transfers */
struct usb_endpoint_descriptor *edesc;
struct usb_pipe_methods *methods; /* set by HC driver */
@ -90,10 +90,10 @@ struct usb_pipe {
uint16_t refcount;
uint8_t toggle_next:1; /* next data toggle value */
uint8_t is_stalled:1; /* set if pipe is stalled */
uint8_t is_stalled:1; /* set if endpoint is stalled */
uint8_t is_synced:1; /* set if we a synchronised */
uint8_t unused:5;
uint8_t iface_index; /* not used by "default pipe" */
uint8_t iface_index; /* not used by "default endpoint" */
};
/*
@ -156,8 +156,8 @@ struct usb_device {
struct mtx default_mtx[1];
struct cv default_cv[2];
struct usb_interface *ifaces;
struct usb_pipe default_pipe; /* Control Endpoint 0 */
struct usb_pipe *pipes;
struct usb_endpoint default_ep; /* Control Endpoint 0 */
struct usb_endpoint *endpoints;
struct usb_power_save pwr_save;/* power save data */
struct usb_bus *bus; /* our USB BUS */
device_t parent_dev; /* parent device */
@ -167,7 +167,7 @@ struct usb_device {
struct usb_hub *hub; /* only if this is a hub */
struct usb_xfer *default_xfer[USB_DEFAULT_XFER_MAX];
struct usb_temp_data *usb2_template_ptr;
struct usb_pipe *pipe_curr; /* current clear stall pipe */
struct usb_endpoint *ep_curr; /* current clear stall endpoint */
#if USB_HAVE_UGEN
struct usb_fifo *fifo[USB_FIFO_MAX];
struct usb_symlink *ugen_symlink; /* our generic symlink */
@ -197,13 +197,13 @@ struct usb_device {
uint8_t driver_added_refcount; /* our driver added generation count */
uint8_t power_mode; /* see USB_POWER_XXX */
uint8_t ifaces_max; /* number of interfaces present */
uint8_t pipes_max; /* number of pipes present */
uint8_t endpoints_max; /* number of endpoints present */
/* the "flags" field is write-protected by "bus->mtx" */
struct usb_device_flags flags;
struct usb_endpoint_descriptor default_ep_desc; /* for pipe 0 */
struct usb_endpoint_descriptor default_ep_desc; /* for endpoint 0 */
struct usb_device_descriptor ddesc; /* device descriptor */
char *serial; /* serial number */
@ -232,9 +232,9 @@ struct usb_device *usb2_alloc_device(device_t parent_dev, struct usb_bus *bus,
struct usb_device *parent_hub, uint8_t depth,
uint8_t port_index, uint8_t port_no,
enum usb_dev_speed speed, enum usb_hc_mode mode);
struct usb_pipe *usb2_get_pipe(struct usb_device *udev, uint8_t iface_index,
struct usb_endpoint *usb2_get_endpoint(struct usb_device *udev, uint8_t iface_index,
const struct usb_config *setup);
struct usb_pipe *usb2_get_pipe_by_addr(struct usb_device *udev, uint8_t ea_val);
struct usb_endpoint *usb2_get_ep_by_addr(struct usb_device *udev, uint8_t ea_val);
usb_error_t usb2_interface_count(struct usb_device *udev, uint8_t *count);
usb_error_t usb2_probe_and_attach(struct usb_device *udev,
uint8_t iface_index);
@ -242,7 +242,7 @@ usb_error_t usb2_reset_iface_endpoints(struct usb_device *udev,
uint8_t iface_index);
usb_error_t usb2_set_config_index(struct usb_device *udev, uint8_t index);
usb_error_t usb2_set_endpoint_stall(struct usb_device *udev,
struct usb_pipe *pipe, uint8_t do_stall);
struct usb_endpoint *ep, uint8_t do_stall);
usb_error_t usb2_suspend_resume(struct usb_device *udev,
uint8_t do_suspend);
void usb2_devinfo(struct usb_device *udev, char *dst_ptr, uint16_t dst_len);
@ -252,7 +252,7 @@ void *usb2_find_descriptor(struct usb_device *udev, void *id,
uint8_t subtype, uint8_t subtype_mask);
void usb_linux_free_device(struct usb_device *dev);
uint8_t usb2_peer_can_wakeup(struct usb_device *udev);
struct usb_pipe *usb2_pipe_foreach(struct usb_device *udev, struct usb_pipe *pipe);
struct usb_endpoint *usb2_endpoint_foreach(struct usb_device *udev, struct usb_endpoint *ep);
void usb2_set_device_state(struct usb_device *udev,
enum usb_dev_state state);

View File

@ -117,9 +117,9 @@ static int
ugen_transfer_setup(struct usb_fifo *f,
const struct usb_config *setup, uint8_t n_setup)
{
struct usb_pipe *pipe = f->priv_sc0;
struct usb_endpoint *ep = f->priv_sc0;
struct usb_device *udev = f->udev;
uint8_t iface_index = pipe->iface_index;
uint8_t iface_index = ep->iface_index;
int error;
mtx_unlock(f->priv_mtx);
@ -152,8 +152,8 @@ ugen_transfer_setup(struct usb_fifo *f,
static int
ugen_open(struct usb_fifo *f, int fflags)
{
struct usb_pipe *pipe = f->priv_sc0;
struct usb_endpoint_descriptor *ed = pipe->edesc;
struct usb_endpoint *ep = f->priv_sc0;
struct usb_endpoint_descriptor *ed = ep->edesc;
uint8_t type;
DPRINTFN(6, "flag=0x%x\n", fflags);
@ -208,8 +208,8 @@ static int
ugen_open_pipe_write(struct usb_fifo *f)
{
struct usb_config usb_config[2];
struct usb_pipe *pipe = f->priv_sc0;
struct usb_endpoint_descriptor *ed = pipe->edesc;
struct usb_endpoint *ep = f->priv_sc0;
struct usb_endpoint_descriptor *ed = ep->edesc;
mtx_assert(f->priv_mtx, MA_OWNED);
@ -276,8 +276,8 @@ static int
ugen_open_pipe_read(struct usb_fifo *f)
{
struct usb_config usb_config[2];
struct usb_pipe *pipe = f->priv_sc0;
struct usb_endpoint_descriptor *ed = pipe->edesc;
struct usb_endpoint *ep = f->priv_sc0;
struct usb_endpoint_descriptor *ed = ep->edesc;
mtx_assert(f->priv_mtx, MA_OWNED);
@ -839,7 +839,7 @@ usb2_gen_fill_deviceinfo(struct usb_fifo *f, struct usb_device_info *di)
static int
ugen_check_request(struct usb_device *udev, struct usb_device_request *req)
{
struct usb_pipe *pipe;
struct usb_endpoint *ep;
int error;
/*
@ -864,13 +864,13 @@ ugen_check_request(struct usb_device *udev, struct usb_device_request *req)
*/
if (req->bmRequestType == UT_WRITE_ENDPOINT) {
pipe = usb2_get_pipe_by_addr(udev, req->wIndex[0]);
if (pipe == NULL) {
ep = usb2_get_ep_by_addr(udev, req->wIndex[0]);
if (ep == NULL) {
return (EINVAL);
}
if ((req->bRequest == UR_CLEAR_FEATURE) &&
(UGETW(req->wValue) == UF_ENDPOINT_HALT)) {
usb2_clear_data_toggle(udev, pipe);
usb2_clear_data_toggle(udev, ep);
}
}
/* TODO: add more checks to verify the interface index */
@ -1372,7 +1372,7 @@ ugen_ioctl(struct usb_fifo *f, u_long cmd, void *addr, int fflags)
struct usb_fs_clear_stall_sync *pstall;
void *addr;
} u;
struct usb_pipe *pipe;
struct usb_endpoint *ep;
struct usb_endpoint_descriptor *ed;
int error = 0;
uint8_t iface_index;
@ -1437,17 +1437,17 @@ ugen_ioctl(struct usb_fifo *f, u_long cmd, void *addr, int fflags)
error = EINVAL;
break;
}
pipe = usb2_get_pipe_by_addr(f->udev, u.popen->ep_no);
if (pipe == NULL) {
ep = usb2_get_ep_by_addr(f->udev, u.popen->ep_no);
if (ep == NULL) {
error = EINVAL;
break;
}
ed = pipe->edesc;
ed = ep->edesc;
if (ed == NULL) {
error = ENXIO;
break;
}
iface_index = pipe->iface_index;
iface_index = ep->iface_index;
bzero(usb_config, sizeof(usb_config));
@ -1536,19 +1536,19 @@ ugen_ioctl(struct usb_fifo *f, u_long cmd, void *addr, int fflags)
if (error) {
return (EBUSY);
}
pipe = f->fs_xfer[u.pstall->ep_index]->pipe;
ep = f->fs_xfer[u.pstall->ep_index]->endpoint;
/* setup a clear-stall packet */
req.bmRequestType = UT_WRITE_ENDPOINT;
req.bRequest = UR_CLEAR_FEATURE;
USETW(req.wValue, UF_ENDPOINT_HALT);
req.wIndex[0] = pipe->edesc->bEndpointAddress;
req.wIndex[0] = ep->edesc->bEndpointAddress;
req.wIndex[1] = 0;
USETW(req.wLength, 0);
error = usb2_do_request(f->udev, NULL, &req, NULL);
if (error == 0) {
usb2_clear_data_toggle(f->udev, pipe);
usb2_clear_data_toggle(f->udev, ep);
} else {
error = ENXIO;
}
@ -1658,12 +1658,12 @@ static int
ugen_get_endpoint_desc(struct usb_fifo *f,
struct usb_endpoint_descriptor *ed)
{
struct usb_pipe *pipe;
struct usb_endpoint *ep;
pipe = f->priv_sc0;
ep = f->priv_sc0;
if (pipe && pipe->edesc) {
*ed = *pipe->edesc;
if (ep && ep->edesc) {
*ed = *ep->edesc;
} else {
return (EINVAL);
}

View File

@ -341,7 +341,7 @@ usb2_handle_set_stall(struct usb_xfer *xfer, uint8_t ep, uint8_t do_stall)
USB_XFER_UNLOCK(xfer);
err = usb2_set_endpoint_stall(udev,
usb2_get_pipe_by_addr(udev, ep), do_stall);
usb2_get_ep_by_addr(udev, ep), do_stall);
USB_XFER_LOCK(xfer);
return (err);
}
@ -356,16 +356,16 @@ usb2_handle_set_stall(struct usb_xfer *xfer, uint8_t ep, uint8_t do_stall)
static uint8_t
usb2_handle_get_stall(struct usb_device *udev, uint8_t ea_val)
{
struct usb_pipe *pipe;
struct usb_endpoint *ep;
uint8_t halted;
pipe = usb2_get_pipe_by_addr(udev, ea_val);
if (pipe == NULL) {
ep = usb2_get_ep_by_addr(udev, ea_val);
if (ep == NULL) {
/* nothing to do */
return (0);
}
USB_BUS_LOCK(udev->bus);
halted = pipe->is_stalled;
halted = ep->is_stalled;
USB_BUS_UNLOCK(udev->bus);
return (halted);

View File

@ -1494,7 +1494,7 @@ usb2_transfer_power_ref(struct usb_xfer *xfer, int val)
}
USB_BUS_LOCK(udev->bus);
xfer_type = xfer->pipe->edesc->bmAttributes & UE_XFERTYPE;
xfer_type = xfer->endpoint->edesc->bmAttributes & UE_XFERTYPE;
udev->pwr_save.last_xfer_time = ticks;
udev->pwr_save.type_refs[xfer_type] += val;

View File

@ -94,51 +94,51 @@ usb2_do_clear_stall_callback(struct usb_xfer *xfer)
{
struct usb_device_request req;
struct usb_device *udev;
struct usb_pipe *pipe;
struct usb_pipe *pipe_end;
struct usb_pipe *pipe_first;
struct usb_endpoint *ep;
struct usb_endpoint *ep_end;
struct usb_endpoint *ep_first;
uint8_t to;
udev = xfer->xroot->udev;
USB_BUS_LOCK(udev->bus);
/* round robin pipe clear stall */
/* round robin endpoint clear stall */
pipe = udev->pipe_curr;
pipe_end = udev->pipes + udev->pipes_max;
pipe_first = udev->pipes;
to = udev->pipes_max;
ep = udev->ep_curr;
ep_end = udev->endpoints + udev->endpoints_max;
ep_first = udev->endpoints;
to = udev->endpoints_max;
switch (USB_GET_STATE(xfer)) {
case USB_ST_TRANSFERRED:
if (pipe == NULL)
if (ep == NULL)
goto tr_setup; /* device was unconfigured */
if (pipe->edesc &&
pipe->is_stalled) {
pipe->toggle_next = 0;
pipe->is_stalled = 0;
if (ep->edesc &&
ep->is_stalled) {
ep->toggle_next = 0;
ep->is_stalled = 0;
/* start up the current or next transfer, if any */
usb2_command_wrapper(&pipe->pipe_q,
pipe->pipe_q.curr);
usb2_command_wrapper(&ep->endpoint_q,
ep->endpoint_q.curr);
}
pipe++;
ep++;
case USB_ST_SETUP:
tr_setup:
if (to == 0)
break; /* no pipes - nothing to do */
if ((pipe < pipe_first) || (pipe >= pipe_end))
pipe = pipe_first; /* pipe wrapped around */
if (pipe->edesc &&
pipe->is_stalled) {
break; /* no endpoints - nothing to do */
if ((ep < ep_first) || (ep >= ep_end))
ep = ep_first; /* endpoint wrapped around */
if (ep->edesc &&
ep->is_stalled) {
/* setup a clear-stall packet */
req.bmRequestType = UT_WRITE_ENDPOINT;
req.bRequest = UR_CLEAR_FEATURE;
USETW(req.wValue, UF_ENDPOINT_HALT);
req.wIndex[0] = pipe->edesc->bEndpointAddress;
req.wIndex[0] = ep->edesc->bEndpointAddress;
req.wIndex[1] = 0;
USETW(req.wLength, 0);
@ -156,7 +156,7 @@ usb2_do_clear_stall_callback(struct usb_xfer *xfer)
USB_BUS_LOCK(udev->bus);
break;
}
pipe++;
ep++;
to--;
goto tr_setup;
@ -167,8 +167,8 @@ usb2_do_clear_stall_callback(struct usb_xfer *xfer)
goto tr_setup;
}
/* store current pipe */
udev->pipe_curr = pipe;
/* store current endpoint */
udev->ep_curr = ep;
USB_BUS_UNLOCK(udev->bus);
}

View File

@ -314,7 +314,7 @@ usb2_transfer_setup_sub(struct usb_setup_params *parm)
parm->err = USB_ERR_INVAL;
goto done;
}
edesc = xfer->pipe->edesc;
edesc = xfer->endpoint->edesc;
type = (edesc->bmAttributes & UE_XFERTYPE);
@ -323,7 +323,7 @@ usb2_transfer_setup_sub(struct usb_setup_params *parm)
xfer->timeout = setup->timeout;
xfer->callback = setup->callback;
xfer->interval = setup->interval;
xfer->endpoint = edesc->bEndpointAddress;
xfer->endpointno = edesc->bEndpointAddress;
xfer->max_packet_size = UGETW(edesc->wMaxPacketSize);
xfer->max_packet_count = 1;
/* make a shadow copy: */
@ -723,7 +723,7 @@ usb2_transfer_setup(struct usb_device *udev,
struct usb_setup_params parm;
const struct usb_config *setup_end = setup_start + n_setup;
const struct usb_config *setup;
struct usb_pipe *pipe;
struct usb_endpoint *ep;
struct usb_xfer_root *info;
struct usb_xfer *xfer;
void *buf = NULL;
@ -852,10 +852,10 @@ usb2_transfer_setup(struct usb_device *udev,
continue;
}
/* see if there is a matching endpoint */
pipe = usb2_get_pipe(udev,
ep = usb2_get_endpoint(udev,
ifaces[setup->if_index], setup);
if ((pipe == NULL) || (pipe->methods == NULL)) {
if ((ep == NULL) || (ep->methods == NULL)) {
if (setup->flags.no_pipe_ok)
continue;
if ((setup->usb_mode != USB_MODE_DUAL) &&
@ -896,11 +896,11 @@ usb2_transfer_setup(struct usb_device *udev,
refcount++;
}
/* set transfer pipe pointer */
xfer->pipe = pipe;
/* set transfer endpoint pointer */
xfer->endpoint = ep;
parm.size[0] += sizeof(xfer[0]);
parm.methods = xfer->pipe->methods;
parm.methods = xfer->endpoint->methods;
parm.curr_xfer = xfer;
/*
@ -915,15 +915,15 @@ usb2_transfer_setup(struct usb_device *udev,
if (buf) {
/*
* Increment the pipe refcount. This
* Increment the endpoint refcount. This
* basically prevents setting a new
* configuration and alternate setting
* when USB transfers are in use on
* the given interface. Search the USB
* code for "pipe->refcount" if you
* code for "endpoint->refcount" if you
* want more information.
*/
xfer->pipe->refcount++;
xfer->endpoint->refcount++;
/*
* Whenever we set ppxfer[] then we
@ -1154,10 +1154,10 @@ usb2_transfer_unsetup(struct usb_xfer **pxfer, uint16_t n_setup)
needs_delay = 1;
#endif
/*
* NOTE: default pipe does not have an
* interface, even if pipe->iface_index == 0
* NOTE: default endpoint does not have an
* interface, even if endpoint->iface_index == 0
*/
xfer->pipe->refcount--;
xfer->endpoint->refcount--;
usb2_callout_drain(&xfer->timeout_handle);
@ -1203,8 +1203,8 @@ usb2_control_transfer_init(struct usb_xfer *xfer)
/* copy direction to endpoint variable */
xfer->endpoint &= ~(UE_DIR_IN | UE_DIR_OUT);
xfer->endpoint |=
xfer->endpointno &= ~(UE_DIR_IN | UE_DIR_OUT);
xfer->endpointno |=
(req.bmRequestType & UT_READ) ? UE_DIR_IN : UE_DIR_OUT;
}
@ -1376,15 +1376,15 @@ usb2_start_hardware(struct usb_xfer *xfer)
info = xfer->xroot;
bus = info->bus;
DPRINTF("xfer=%p, pipe=%p, nframes=%d, dir=%s\n",
xfer, xfer->pipe, xfer->nframes, USB_GET_DATA_ISREAD(xfer) ?
DPRINTF("xfer=%p, endpoint=%p, nframes=%d, dir=%s\n",
xfer, xfer->endpoint, xfer->nframes, USB_GET_DATA_ISREAD(xfer) ?
"read" : "write");
#if USB_DEBUG
if (USB_DEBUG_VAR > 0) {
USB_BUS_LOCK(bus);
usb2_dump_pipe(xfer->pipe);
usb2_dump_endpoint(xfer->endpoint);
USB_BUS_UNLOCK(bus);
}
@ -1400,7 +1400,7 @@ usb2_start_hardware(struct usb_xfer *xfer)
DPRINTF("open\n");
USB_BUS_LOCK(bus);
(xfer->pipe->methods->open) (xfer);
(xfer->endpoint->methods->open) (xfer);
USB_BUS_UNLOCK(bus);
}
/* set "transferring" flag */
@ -1464,7 +1464,7 @@ usb2_start_hardware(struct usb_xfer *xfer)
USB_BUS_LOCK(bus);
xfer->flags_int.can_cancel_immed = 1;
/* start the transfer */
usb2_command_wrapper(&xfer->pipe->pipe_q, xfer);
usb2_command_wrapper(&xfer->endpoint->endpoint_q, xfer);
USB_BUS_UNLOCK(bus);
return;
}
@ -1557,18 +1557,18 @@ usb2_start_hardware(struct usb_xfer *xfer)
void
usb2_pipe_enter(struct usb_xfer *xfer)
{
struct usb_pipe *pipe;
struct usb_endpoint *ep;
USB_XFER_LOCK_ASSERT(xfer, MA_OWNED);
USB_BUS_LOCK(xfer->xroot->bus);
pipe = xfer->pipe;
ep = xfer->endpoint;
DPRINTF("enter\n");
/* enter the transfer */
(pipe->methods->enter) (xfer);
(ep->methods->enter) (xfer);
xfer->flags_int.can_cancel_immed = 1;
@ -1581,7 +1581,7 @@ usb2_pipe_enter(struct usb_xfer *xfer)
}
/* start the transfer */
usb2_command_wrapper(&pipe->pipe_q, xfer);
usb2_command_wrapper(&ep->endpoint_q, xfer);
USB_BUS_UNLOCK(xfer->xroot->bus);
}
@ -1628,7 +1628,7 @@ usb2_transfer_start(struct usb_xfer *xfer)
void
usb2_transfer_stop(struct usb_xfer *xfer)
{
struct usb_pipe *pipe;
struct usb_endpoint *ep;
if (xfer == NULL) {
/* transfer is gone */
@ -1665,7 +1665,7 @@ usb2_transfer_stop(struct usb_xfer *xfer)
* The following will lead to an USB_ERR_CANCELLED
* error code being passed to the USB callback.
*/
(xfer->pipe->methods->close) (xfer);
(xfer->endpoint->methods->close) (xfer);
/* only close once */
xfer->flags_int.did_close = 1;
} else {
@ -1675,7 +1675,7 @@ usb2_transfer_stop(struct usb_xfer *xfer)
DPRINTF("close\n");
/* close here and now */
(xfer->pipe->methods->close) (xfer);
(xfer->endpoint->methods->close) (xfer);
/*
* Any additional DMA delay is done by
@ -1684,16 +1684,16 @@ usb2_transfer_stop(struct usb_xfer *xfer)
/*
* Special case. Check if we need to restart a blocked
* pipe.
* endpoint.
*/
pipe = xfer->pipe;
ep = xfer->endpoint;
/*
* If the current USB transfer is completing we need
* to start the next one:
*/
if (pipe->pipe_q.curr == xfer) {
usb2_command_wrapper(&pipe->pipe_q, NULL);
if (ep->endpoint_q.curr == xfer) {
usb2_command_wrapper(&ep->endpoint_q, NULL);
}
}
@ -2117,10 +2117,10 @@ usb2_transfer_done(struct usb_xfer *xfer, usb_error_t error)
/* keep some statistics */
if (xfer->error) {
xfer->xroot->bus->stats_err.uds_requests
[xfer->pipe->edesc->bmAttributes & UE_XFERTYPE]++;
[xfer->endpoint->edesc->bmAttributes & UE_XFERTYPE]++;
} else {
xfer->xroot->bus->stats_ok.uds_requests
[xfer->pipe->edesc->bmAttributes & UE_XFERTYPE]++;
[xfer->endpoint->edesc->bmAttributes & UE_XFERTYPE]++;
}
/* call the USB transfer callback */
@ -2138,14 +2138,14 @@ static void
usb2_transfer_start_cb(void *arg)
{
struct usb_xfer *xfer = arg;
struct usb_pipe *pipe = xfer->pipe;
struct usb_endpoint *ep = xfer->endpoint;
USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_OWNED);
DPRINTF("start\n");
/* start the transfer */
(pipe->methods->start) (xfer);
(ep->methods->start) (xfer);
xfer->flags_int.can_cancel_immed = 1;
@ -2210,23 +2210,23 @@ usb2_transfer_clear_stall(struct usb_xfer *xfer)
void
usb2_pipe_start(struct usb_xfer_queue *pq)
{
struct usb_pipe *pipe;
struct usb_endpoint *ep;
struct usb_xfer *xfer;
uint8_t type;
xfer = pq->curr;
pipe = xfer->pipe;
ep = xfer->endpoint;
USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_OWNED);
/*
* If the pipe is already stalled we do nothing !
* If the endpoint is already stalled we do nothing !
*/
if (pipe->is_stalled) {
if (ep->is_stalled) {
return;
}
/*
* Check if we are supposed to stall the pipe:
* Check if we are supposed to stall the endpoint:
*/
if (xfer->flags.stall_pipe) {
/* clear stall command */
@ -2235,7 +2235,7 @@ usb2_pipe_start(struct usb_xfer_queue *pq)
/*
* Only stall BULK and INTERRUPT endpoints.
*/
type = (pipe->edesc->bmAttributes & UE_XFERTYPE);
type = (ep->edesc->bmAttributes & UE_XFERTYPE);
if ((type == UE_BULK) ||
(type == UE_INTERRUPT)) {
struct usb_device *udev;
@ -2243,11 +2243,11 @@ usb2_pipe_start(struct usb_xfer_queue *pq)
info = xfer->xroot;
udev = info->udev;
pipe->is_stalled = 1;
ep->is_stalled = 1;
if (udev->flags.usb_mode == USB_MODE_DEVICE) {
(udev->bus->methods->set_stall) (
udev, NULL, pipe);
udev, NULL, ep);
} else if (udev->default_xfer[1]) {
info = udev->default_xfer[1]->xroot;
if (usb2_proc_msignal(
@ -2284,7 +2284,7 @@ usb2_pipe_start(struct usb_xfer_queue *pq)
* pre transfer start delay:
*/
if (xfer->interval > 0) {
type = (pipe->edesc->bmAttributes & UE_XFERTYPE);
type = (ep->edesc->bmAttributes & UE_XFERTYPE);
if ((type == UE_BULK) ||
(type == UE_CONTROL)) {
usb2_transfer_timeout_ms(xfer,
@ -2296,7 +2296,7 @@ usb2_pipe_start(struct usb_xfer_queue *pq)
DPRINTF("start\n");
/* start USB transfer */
(pipe->methods->start) (xfer);
(ep->methods->start) (xfer);
xfer->flags_int.can_cancel_immed = 1;
@ -2332,7 +2332,7 @@ usb2_transfer_timeout_ms(struct usb_xfer *xfer,
* that the USB transfer is complete.
*
* - This function is used to start the next USB transfer on the
* pipe transfer queue, if any.
* ep transfer queue, if any.
*
* NOTE: In some special cases the USB transfer will not be removed from
* the pipe queue, but remain first. To enforce USB transfer removal call
@ -2345,14 +2345,14 @@ usb2_transfer_timeout_ms(struct usb_xfer *xfer,
static uint8_t
usb2_callback_wrapper_sub(struct usb_xfer *xfer)
{
struct usb_pipe *pipe;
struct usb_endpoint *ep;
usb_frcount_t x;
if ((!xfer->flags_int.open) &&
(!xfer->flags_int.did_close)) {
DPRINTF("close\n");
USB_BUS_LOCK(xfer->xroot->bus);
(xfer->pipe->methods->close) (xfer);
(xfer->endpoint->methods->close) (xfer);
USB_BUS_UNLOCK(xfer->xroot->bus);
/* only close once */
xfer->flags_int.did_close = 1;
@ -2425,8 +2425,8 @@ usb2_callback_wrapper_sub(struct usb_xfer *xfer)
xfer->actlen = xfer->sumlen;
}
}
DPRINTFN(6, "xfer=%p pipe=%p sts=%d alen=%d, slen=%d, afrm=%d, nfrm=%d\n",
xfer, xfer->pipe, xfer->error, xfer->actlen, xfer->sumlen,
DPRINTFN(6, "xfer=%p endpoint=%p sts=%d alen=%d, slen=%d, afrm=%d, nfrm=%d\n",
xfer, xfer->endpoint, xfer->error, xfer->actlen, xfer->sumlen,
xfer->aframes, xfer->nframes);
if (xfer->error) {
@ -2437,7 +2437,7 @@ usb2_callback_wrapper_sub(struct usb_xfer *xfer)
if ((xfer->error != USB_ERR_CANCELLED) &&
(xfer->flags.pipe_bof)) {
DPRINTFN(2, "xfer=%p: Block On Failure "
"on pipe=%p\n", xfer, xfer->pipe);
"on endpoint=%p\n", xfer, xfer->endpoint);
goto done;
}
} else {
@ -2451,8 +2451,8 @@ usb2_callback_wrapper_sub(struct usb_xfer *xfer)
xfer->error = USB_ERR_SHORT_XFER;
if (xfer->flags.pipe_bof) {
DPRINTFN(2, "xfer=%p: Block On Failure on "
"Short Transfer on pipe %p.\n",
xfer, xfer->pipe);
"Short Transfer on endpoint %p.\n",
xfer, xfer->endpoint);
goto done;
}
}
@ -2463,28 +2463,28 @@ usb2_callback_wrapper_sub(struct usb_xfer *xfer)
*/
if (xfer->flags_int.control_act) {
DPRINTFN(5, "xfer=%p: Control transfer "
"active on pipe=%p\n", xfer, xfer->pipe);
"active on endpoint=%p\n", xfer, xfer->endpoint);
goto done;
}
}
}
pipe = xfer->pipe;
ep = xfer->endpoint;
/*
* If the current USB transfer is completing we need to start the
* next one:
*/
USB_BUS_LOCK(xfer->xroot->bus);
if (pipe->pipe_q.curr == xfer) {
usb2_command_wrapper(&pipe->pipe_q, NULL);
if (ep->endpoint_q.curr == xfer) {
usb2_command_wrapper(&ep->endpoint_q, NULL);
if (pipe->pipe_q.curr || TAILQ_FIRST(&pipe->pipe_q.head)) {
if (ep->endpoint_q.curr || TAILQ_FIRST(&ep->endpoint_q.head)) {
/* there is another USB transfer waiting */
} else {
/* this is the last USB transfer */
/* clear isochronous sync flag */
xfer->pipe->is_synced = 0;
xfer->endpoint->is_synced = 0;
}
}
USB_BUS_UNLOCK(xfer->xroot->bus);
@ -2633,12 +2633,12 @@ usb2_default_transfer_setup(struct usb_device *udev)
* data toggle.
*------------------------------------------------------------------------*/
void
usb2_clear_data_toggle(struct usb_device *udev, struct usb_pipe *pipe)
usb2_clear_data_toggle(struct usb_device *udev, struct usb_endpoint *ep)
{
DPRINTFN(5, "udev=%p pipe=%p\n", udev, pipe);
DPRINTFN(5, "udev=%p endpoint=%p\n", udev, ep);
USB_BUS_LOCK(udev->bus);
pipe->toggle_next = 0;
ep->toggle_next = 0;
USB_BUS_UNLOCK(udev->bus);
}
@ -2693,14 +2693,14 @@ usb2_clear_stall_callback(struct usb_xfer *xfer1,
* "ata-usb.c" depends on this)
*/
usb2_clear_data_toggle(xfer2->xroot->udev, xfer2->pipe);
usb2_clear_data_toggle(xfer2->xroot->udev, xfer2->endpoint);
/* setup a clear-stall packet */
req.bmRequestType = UT_WRITE_ENDPOINT;
req.bRequest = UR_CLEAR_FEATURE;
USETW(req.wValue, UF_ENDPOINT_HALT);
req.wIndex[0] = xfer2->pipe->edesc->bEndpointAddress;
req.wIndex[0] = xfer2->endpoint->edesc->bEndpointAddress;
req.wIndex[1] = 0;
USETW(req.wLength, 0);

View File

@ -125,7 +125,7 @@ void usb2_transfer_enqueue(struct usb_xfer_queue *pq,
void usb2_transfer_setup_sub(struct usb_setup_params *parm);
void usb2_default_transfer_setup(struct usb_device *udev);
void usb2_clear_data_toggle(struct usb_device *udev,
struct usb_pipe *pipe);
struct usb_endpoint *ep);
void usb2_do_poll(struct usb_xfer **ppxfer, uint16_t max);
usb_callback_t usb2_do_request_callback;
usb_callback_t usb2_handle_request_callback;