s/usb2_/usb_|usbd_/ on all function names for the USB stack.
This commit is contained in:
parent
8437751d86
commit
a593f6b8de
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=194228
@ -472,7 +472,7 @@ usbd_func_getdesc(ip)
|
||||
* The NDIS driver is not allowed to change the
|
||||
* config! There is only one choice!
|
||||
*/
|
||||
cdp = usb2_get_config_descriptor(sc->ndisusb_dev);
|
||||
cdp = usbd_get_config_descriptor(sc->ndisusb_dev);
|
||||
if (cdp == NULL) {
|
||||
status = USB_ERR_INVAL;
|
||||
goto exit;
|
||||
@ -492,7 +492,7 @@ usbd_func_getdesc(ip)
|
||||
status = USB_ERR_NORMAL_COMPLETION;
|
||||
} else {
|
||||
NDISUSB_LOCK(sc);
|
||||
status = usb2_req_get_desc(sc->ndisusb_dev, &sc->ndisusb_mtx,
|
||||
status = usbd_req_get_desc(sc->ndisusb_dev, &sc->ndisusb_mtx,
|
||||
&actlen, ctldesc->ucd_trans_buf, 2,
|
||||
ctldesc->ucd_trans_buflen, ctldesc->ucd_langid,
|
||||
ctldesc->ucd_desctype, ctldesc->ucd_idx,
|
||||
@ -540,16 +540,16 @@ usbd_func_selconf(ip)
|
||||
|
||||
intf = &selconf->usc_intf;
|
||||
for (i = 0; i < conf->bNumInterface && intf->uii_len > 0; i++) {
|
||||
ret = usb2_set_alt_interface_index(udev,
|
||||
ret = usbd_set_alt_interface_index(udev,
|
||||
intf->uii_intfnum, intf->uii_altset);
|
||||
if (ret != USB_ERR_NORMAL_COMPLETION && ret != USB_ERR_IN_USE) {
|
||||
device_printf(dev,
|
||||
"setting alternate interface failed: %s\n",
|
||||
usb2_errstr(ret));
|
||||
usbd_errstr(ret));
|
||||
return usbd_usb2urb(ret);
|
||||
}
|
||||
|
||||
for (j = 0; (ep = usb2_endpoint_foreach(udev, ep)); j++) {
|
||||
for (j = 0; (ep = usb_endpoint_foreach(udev, ep)); j++) {
|
||||
if (j >= intf->uii_numeps) {
|
||||
device_printf(dev,
|
||||
"endpoint %d and above are ignored",
|
||||
@ -608,11 +608,11 @@ usbd_setup_endpoint_one(ip, ifidx, ne, epconf)
|
||||
InitializeListHead(&ne->ne_pending);
|
||||
KeInitializeSpinLock(&ne->ne_lock);
|
||||
|
||||
status = usb2_transfer_setup(sc->ndisusb_dev, &ifidx, ne->ne_xfer,
|
||||
status = usbd_transfer_setup(sc->ndisusb_dev, &ifidx, ne->ne_xfer,
|
||||
epconf, 1, sc, &sc->ndisusb_mtx);
|
||||
if (status != USB_ERR_NORMAL_COMPLETION) {
|
||||
device_printf(dev, "couldn't setup xfer: %s\n",
|
||||
usb2_errstr(status));
|
||||
usbd_errstr(status));
|
||||
return (status);
|
||||
}
|
||||
xfer = ne->ne_xfer[0];
|
||||
@ -680,11 +680,11 @@ usbd_setup_endpoint(ip, ifidx, ep)
|
||||
if (UE_GET_DIR(ep->bEndpointAddress) == UE_DIR_IN)
|
||||
cfg.flags.short_xfer_ok = 1;
|
||||
|
||||
status = usb2_transfer_setup(sc->ndisusb_dev, &ifidx, ne->ne_xfer,
|
||||
status = usbd_transfer_setup(sc->ndisusb_dev, &ifidx, ne->ne_xfer,
|
||||
&cfg, 1, sc, &sc->ndisusb_mtx);
|
||||
if (status != USB_ERR_NORMAL_COMPLETION) {
|
||||
device_printf(dev, "couldn't setup xfer: %s\n",
|
||||
usb2_errstr(status));
|
||||
usbd_errstr(status));
|
||||
return (status);
|
||||
}
|
||||
xfer = ne->ne_xfer[0];
|
||||
@ -718,8 +718,8 @@ usbd_func_abort_pipe(ip)
|
||||
}
|
||||
|
||||
NDISUSB_LOCK(sc);
|
||||
usb2_transfer_stop(ne->ne_xfer[0]);
|
||||
usb2_transfer_start(ne->ne_xfer[0]);
|
||||
usbd_transfer_stop(ne->ne_xfer[0]);
|
||||
usbd_transfer_start(ne->ne_xfer[0]);
|
||||
NDISUSB_UNLOCK(sc);
|
||||
|
||||
return (USBD_STATUS_SUCCESS);
|
||||
@ -800,8 +800,8 @@ usbd_irpcancel(dobj, ip)
|
||||
* cancelled and then restarted.
|
||||
*/
|
||||
NDISUSB_LOCK(sc);
|
||||
usb2_transfer_stop(ne->ne_xfer[0]);
|
||||
usb2_transfer_start(ne->ne_xfer[0]);
|
||||
usbd_transfer_stop(ne->ne_xfer[0]);
|
||||
usbd_transfer_start(ne->ne_xfer[0]);
|
||||
NDISUSB_UNLOCK(sc);
|
||||
|
||||
ip->irp_cancel = TRUE;
|
||||
@ -873,7 +873,7 @@ usbd_non_isoc_callback(struct usb_xfer *xfer)
|
||||
|
||||
/* copy in data with regard to the URB */
|
||||
if (ne->ne_dirin != 0)
|
||||
usb2_copy_out(xfer->frbuffers, 0, nx->nx_urbbuf,
|
||||
usbd_copy_out(xfer->frbuffers, 0, nx->nx_urbbuf,
|
||||
xfer->frlengths[0]);
|
||||
nx->nx_urbbuf += xfer->frlengths[0];
|
||||
nx->nx_urbactlen += xfer->frlengths[0];
|
||||
@ -929,10 +929,10 @@ usbd_non_isoc_callback(struct usb_xfer *xfer)
|
||||
extra:
|
||||
len = MIN(xfer->max_data_length, nx->nx_urblen);
|
||||
if (UE_GET_DIR(ep->bEndpointAddress) == UE_DIR_OUT)
|
||||
usb2_copy_in(xfer->frbuffers, 0, nx->nx_urbbuf, len);
|
||||
usbd_copy_in(xfer->frbuffers, 0, nx->nx_urbbuf, len);
|
||||
xfer->frlengths[0] = len;
|
||||
xfer->nframes = 1;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
break;
|
||||
default:
|
||||
nx = usbd_aq_getfirst(sc, ne);
|
||||
@ -941,7 +941,7 @@ usbd_non_isoc_callback(struct usb_xfer *xfer)
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
xfer->flags.stall_pipe = 1;
|
||||
device_printf(sc->ndis_dev, "usb xfer warning (%s)\n",
|
||||
usb2_errstr(xfer->error));
|
||||
usbd_errstr(xfer->error));
|
||||
}
|
||||
usbd_xfer_complete(sc, ne, nx, xfer->error);
|
||||
if (xfer->error != USB_ERR_CANCELLED)
|
||||
@ -974,7 +974,7 @@ usbd_ctrl_callback(struct usb_xfer *xfer)
|
||||
vcreq = &urb->uu_vcreq;
|
||||
|
||||
if (vcreq->uvc_trans_flags & USBD_TRANSFER_DIRECTION_IN) {
|
||||
usb2_copy_out(xfer->frbuffers + 1, 0,
|
||||
usbd_copy_out(xfer->frbuffers + 1, 0,
|
||||
vcreq->uvc_trans_buf, xfer->frlengths[1]);
|
||||
nx->nx_urbactlen += xfer->frlengths[1];
|
||||
}
|
||||
@ -1044,7 +1044,7 @@ usbd_ctrl_callback(struct usb_xfer *xfer)
|
||||
nx->nx_urblen = vcreq->uvc_trans_buflen;
|
||||
nx->nx_urbactlen = 0;
|
||||
|
||||
usb2_copy_in(xfer->frbuffers, 0, &req, sizeof(req));
|
||||
usbd_copy_in(xfer->frbuffers, 0, &req, sizeof(req));
|
||||
xfer->frlengths[0] = sizeof(req);
|
||||
xfer->nframes = 1;
|
||||
if (vcreq->uvc_trans_flags & USBD_TRANSFER_DIRECTION_IN) {
|
||||
@ -1066,13 +1066,13 @@ usbd_ctrl_callback(struct usb_xfer *xfer)
|
||||
* the future if it needs to be.
|
||||
*/
|
||||
if (nx->nx_urblen > 0) {
|
||||
usb2_copy_in(xfer->frbuffers + 1 , 0,
|
||||
usbd_copy_in(xfer->frbuffers + 1 , 0,
|
||||
nx->nx_urbbuf, nx->nx_urblen);
|
||||
xfer->frlengths[1] = nx->nx_urblen;
|
||||
xfer->nframes = 2;
|
||||
}
|
||||
}
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
break;
|
||||
default:
|
||||
nx = usbd_aq_getfirst(sc, ne);
|
||||
@ -1081,7 +1081,7 @@ usbd_ctrl_callback(struct usb_xfer *xfer)
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
xfer->flags.stall_pipe = 1;
|
||||
device_printf(sc->ndis_dev, "usb xfer warning (%s)\n",
|
||||
usb2_errstr(xfer->error));
|
||||
usbd_errstr(xfer->error));
|
||||
}
|
||||
usbd_xfer_complete(sc, ne, nx, xfer->error);
|
||||
if (xfer->error != USB_ERR_CANCELLED)
|
||||
@ -1244,7 +1244,7 @@ usbd_task(dobj, arg)
|
||||
ne = usbd_get_ndisep(ip, urb->uu_bulkintr.ubi_epdesc);
|
||||
if (ne == NULL)
|
||||
goto exit;
|
||||
usb2_transfer_start(ne->ne_xfer[0]);
|
||||
usbd_transfer_start(ne->ne_xfer[0]);
|
||||
break;
|
||||
case NDISUSB_TASK_IRPCANCEL:
|
||||
ne = usbd_get_ndisep(ip,
|
||||
@ -1254,14 +1254,14 @@ usbd_task(dobj, arg)
|
||||
if (ne == NULL)
|
||||
goto exit;
|
||||
|
||||
usb2_transfer_stop(ne->ne_xfer[0]);
|
||||
usb2_transfer_start(ne->ne_xfer[0]);
|
||||
usbd_transfer_stop(ne->ne_xfer[0]);
|
||||
usbd_transfer_start(ne->ne_xfer[0]);
|
||||
break;
|
||||
case NDISUSB_TASK_VENDOR:
|
||||
ne = (urb->uu_vcreq.uvc_trans_flags &
|
||||
USBD_TRANSFER_DIRECTION_IN) ?
|
||||
&sc->ndisusb_dread_ep : &sc->ndisusb_dwrite_ep;
|
||||
usb2_transfer_start(ne->ne_xfer[0]);
|
||||
usbd_transfer_start(ne->ne_xfer[0]);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -1437,7 +1437,7 @@ USBD_ParseConfigurationDescriptorEx(conf, start, intfnum,
|
||||
struct usb_descriptor *next = NULL;
|
||||
usb_interface_descriptor_t *desc;
|
||||
|
||||
while ((next = usb2_desc_foreach(conf, next)) != NULL) {
|
||||
while ((next = usb_desc_foreach(conf, next)) != NULL) {
|
||||
desc = (usb_interface_descriptor_t *)next;
|
||||
if (desc->bDescriptorType != UDESC_INTERFACE)
|
||||
continue;
|
||||
|
@ -288,7 +288,7 @@ atausb2_probe(device_t dev)
|
||||
/* give other drivers a try first */
|
||||
return (ENXIO);
|
||||
}
|
||||
id = usb2_get_interface_descriptor(uaa->iface);
|
||||
id = usbd_get_interface_descriptor(uaa->iface);
|
||||
if ((!id) || (id->bInterfaceClass != UICLASS_MASS)) {
|
||||
return (ENXIO);
|
||||
}
|
||||
@ -328,16 +328,16 @@ atausb2_attach(device_t dev)
|
||||
uint8_t has_intr;
|
||||
int err;
|
||||
|
||||
device_set_usb2_desc(dev);
|
||||
device_set_usb_desc(dev);
|
||||
|
||||
sc->dev = dev;
|
||||
sc->maxlun = 0;
|
||||
sc->locked_ch = NULL;
|
||||
sc->restart_ch = NULL;
|
||||
sc->usb2_speed = usb2_get_speed(uaa->device);
|
||||
sc->usb2_speed = usbd_get_speed(uaa->device);
|
||||
mtx_init(&sc->locked_mtx, "ATAUSB lock", NULL, (MTX_DEF | MTX_RECURSE));
|
||||
|
||||
id = usb2_get_interface_descriptor(uaa->iface);
|
||||
id = usbd_get_interface_descriptor(uaa->iface);
|
||||
switch (id->bInterfaceProtocol) {
|
||||
case UIPROTO_MASS_BBB:
|
||||
case UIPROTO_MASS_BBB_OLD:
|
||||
@ -380,7 +380,7 @@ atausb2_attach(device_t dev)
|
||||
(strcmp(subclass, "ATAPI") && strcmp(subclass, "SCSI"))) {
|
||||
goto detach;
|
||||
}
|
||||
err = usb2_transfer_setup(uaa->device, &uaa->info.bIfaceIndex,
|
||||
err = usbd_transfer_setup(uaa->device, &uaa->info.bIfaceIndex,
|
||||
sc->xfer, atausb2_config, ATAUSB_T_BBB_MAX, sc,
|
||||
&sc->locked_mtx);
|
||||
|
||||
@ -389,7 +389,7 @@ atausb2_attach(device_t dev)
|
||||
|
||||
if (err) {
|
||||
device_printf(sc->dev, "could not setup required "
|
||||
"transfers, %s\n", usb2_errstr(err));
|
||||
"transfers, %s\n", usbd_errstr(err));
|
||||
goto detach;
|
||||
}
|
||||
/* get number of devices so we can add matching channels */
|
||||
@ -398,12 +398,12 @@ atausb2_attach(device_t dev)
|
||||
USETW(request.wValue, 0);
|
||||
USETW(request.wIndex, sc->iface_no);
|
||||
USETW(request.wLength, sizeof(maxlun));
|
||||
err = usb2_do_request(uaa->device, &Giant, &request, &maxlun);
|
||||
err = usbd_do_request(uaa->device, &Giant, &request, &maxlun);
|
||||
|
||||
if (err) {
|
||||
if (bootverbose) {
|
||||
device_printf(sc->dev, "get maxlun not supported %s\n",
|
||||
usb2_errstr(err));
|
||||
usbd_errstr(err));
|
||||
}
|
||||
} else {
|
||||
sc->maxlun = maxlun;
|
||||
@ -438,7 +438,7 @@ atausb2_detach(device_t dev)
|
||||
|
||||
/* teardown our statemachine */
|
||||
|
||||
usb2_transfer_unsetup(sc->xfer, ATAUSB_T_MAX);
|
||||
usbd_transfer_unsetup(sc->xfer, ATAUSB_T_MAX);
|
||||
|
||||
/* detach & delete all children, if any */
|
||||
|
||||
@ -460,7 +460,7 @@ atausb2_transfer_start(struct atausb2_softc *sc, uint8_t xfer_no)
|
||||
}
|
||||
if (sc->xfer[xfer_no]) {
|
||||
sc->last_xfer_no = xfer_no;
|
||||
usb2_transfer_start(sc->xfer[xfer_no]);
|
||||
usbd_transfer_start(sc->xfer[xfer_no]);
|
||||
} else {
|
||||
atausb2_cancel_request(sc);
|
||||
}
|
||||
@ -485,11 +485,11 @@ atausb2_t_bbb_reset1_callback(struct usb_xfer *xfer)
|
||||
req.wIndex[1] = 0;
|
||||
USETW(req.wLength, 0);
|
||||
|
||||
usb2_copy_in(xfer->frbuffers, 0, &req, sizeof(req));
|
||||
usbd_copy_in(xfer->frbuffers, 0, &req, sizeof(req));
|
||||
|
||||
xfer->frlengths[0] = sizeof(req);
|
||||
xfer->nframes = 1;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
@ -527,7 +527,7 @@ atausb2_t_bbb_data_clear_stall_callback(struct usb_xfer *xfer,
|
||||
return;
|
||||
|
||||
case USB_ST_SETUP:
|
||||
if (usb2_clear_stall_callback(xfer, sc->xfer[stall_xfer])) {
|
||||
if (usbd_clear_stall_callback(xfer, sc->xfer[stall_xfer])) {
|
||||
goto tr_transferred;
|
||||
}
|
||||
return;
|
||||
@ -575,10 +575,10 @@ atausb2_t_bbb_command_callback(struct usb_xfer *xfer)
|
||||
bzero(sc->cbw.cdb, 16);
|
||||
bcopy(request->u.atapi.ccb, sc->cbw.cdb, 12); /* XXX SOS */
|
||||
|
||||
usb2_copy_in(xfer->frbuffers, 0, &sc->cbw, sizeof(sc->cbw));
|
||||
usbd_copy_in(xfer->frbuffers, 0, &sc->cbw, sizeof(sc->cbw));
|
||||
|
||||
xfer->frlengths[0] = sizeof(sc->cbw);
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -598,7 +598,7 @@ atausb2_t_bbb_data_read_callback(struct usb_xfer *xfer)
|
||||
switch (USB_GET_STATE(xfer)) {
|
||||
case USB_ST_TRANSFERRED:
|
||||
|
||||
usb2_copy_out(xfer->frbuffers, 0,
|
||||
usbd_copy_out(xfer->frbuffers, 0,
|
||||
sc->ata_data, xfer->actlen);
|
||||
|
||||
sc->ata_bytecount -= xfer->actlen;
|
||||
@ -625,7 +625,7 @@ atausb2_t_bbb_data_read_callback(struct usb_xfer *xfer)
|
||||
xfer->timeout = sc->timeout;
|
||||
xfer->frlengths[0] = max_bulk;
|
||||
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
@ -675,10 +675,10 @@ atausb2_t_bbb_data_write_callback(struct usb_xfer *xfer)
|
||||
xfer->timeout = sc->timeout;
|
||||
xfer->frlengths[0] = max_bulk;
|
||||
|
||||
usb2_copy_in(xfer->frbuffers, 0,
|
||||
usbd_copy_in(xfer->frbuffers, 0,
|
||||
sc->ata_data, max_bulk);
|
||||
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
@ -712,7 +712,7 @@ atausb2_t_bbb_status_callback(struct usb_xfer *xfer)
|
||||
if (xfer->actlen < sizeof(sc->csw)) {
|
||||
bzero(&sc->csw, sizeof(sc->csw));
|
||||
}
|
||||
usb2_copy_out(xfer->frbuffers, 0, &sc->csw, xfer->actlen);
|
||||
usbd_copy_out(xfer->frbuffers, 0, &sc->csw, xfer->actlen);
|
||||
|
||||
if (request->flags & (ATA_R_READ | ATA_R_WRITE)) {
|
||||
request->donecount = sc->ata_donecount;
|
||||
@ -780,7 +780,7 @@ atausb2_t_bbb_status_callback(struct usb_xfer *xfer)
|
||||
|
||||
case USB_ST_SETUP:
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
|
||||
default:
|
||||
@ -828,7 +828,7 @@ atausb2_tr_error(struct usb_xfer *xfer)
|
||||
|
||||
if (atausbdebug) {
|
||||
device_printf(sc->dev, "transfer failed, %s, in state %d "
|
||||
"-> BULK reset\n", usb2_errstr(xfer->error),
|
||||
"-> BULK reset\n", usbd_errstr(xfer->error),
|
||||
sc->last_xfer_no);
|
||||
}
|
||||
}
|
||||
@ -903,7 +903,7 @@ ata_usbchannel_begin_transaction(struct ata_request *request)
|
||||
sc->ata_data = request->data;
|
||||
sc->ata_donecount = 0;
|
||||
|
||||
usb2_transfer_start(sc->xfer[sc->last_xfer_no]);
|
||||
usbd_transfer_start(sc->xfer[sc->last_xfer_no]);
|
||||
error = ATA_OP_CONTINUES;
|
||||
} else {
|
||||
request->result = EIO;
|
||||
|
@ -211,12 +211,12 @@ ndisusb_detach(device_t self)
|
||||
ndis_pnpevent_nic(self, NDIS_PNP_EVENT_SURPRISE_REMOVED);
|
||||
|
||||
if (sc->ndisusb_status & NDISUSB_STATUS_SETUP_EP) {
|
||||
usb2_transfer_unsetup(sc->ndisusb_dread_ep.ne_xfer, 1);
|
||||
usb2_transfer_unsetup(sc->ndisusb_dwrite_ep.ne_xfer, 1);
|
||||
usbd_transfer_unsetup(sc->ndisusb_dread_ep.ne_xfer, 1);
|
||||
usbd_transfer_unsetup(sc->ndisusb_dwrite_ep.ne_xfer, 1);
|
||||
}
|
||||
for (i = 0; i < NDISUSB_ENDPT_MAX; i++) {
|
||||
ne = &sc->ndisusb_ep[i];
|
||||
usb2_transfer_unsetup(ne->ne_xfer, 1);
|
||||
usbd_transfer_unsetup(ne->ne_xfer, 1);
|
||||
}
|
||||
|
||||
(void)ndis_detach(self);
|
||||
|
@ -547,7 +547,7 @@ uaudio_probe(device_t dev)
|
||||
|
||||
if ((uaa->info.bInterfaceClass == UICLASS_AUDIO) &&
|
||||
(uaa->info.bInterfaceSubClass == UISUBCLASS_AUDIOCONTROL)) {
|
||||
if (usb2_test_quirk(uaa, UQ_BAD_AUDIO))
|
||||
if (usb_test_quirk(uaa, UQ_BAD_AUDIO))
|
||||
return (ENXIO);
|
||||
else
|
||||
return (0);
|
||||
@ -567,23 +567,23 @@ uaudio_attach(device_t dev)
|
||||
sc->sc_rec_chan.priv_sc = sc;
|
||||
sc->sc_udev = uaa->device;
|
||||
|
||||
if (usb2_test_quirk(uaa, UQ_AUDIO_SWAP_LR))
|
||||
if (usb_test_quirk(uaa, UQ_AUDIO_SWAP_LR))
|
||||
sc->sc_uq_audio_swap_lr = 1;
|
||||
|
||||
if (usb2_test_quirk(uaa, UQ_AU_INP_ASYNC))
|
||||
if (usb_test_quirk(uaa, UQ_AU_INP_ASYNC))
|
||||
sc->sc_uq_au_inp_async = 1;
|
||||
|
||||
if (usb2_test_quirk(uaa, UQ_AU_NO_XU))
|
||||
if (usb_test_quirk(uaa, UQ_AU_NO_XU))
|
||||
sc->sc_uq_au_no_xu = 1;
|
||||
|
||||
if (usb2_test_quirk(uaa, UQ_BAD_ADC))
|
||||
if (usb_test_quirk(uaa, UQ_BAD_ADC))
|
||||
sc->sc_uq_bad_adc = 1;
|
||||
|
||||
umidi_init(dev);
|
||||
|
||||
device_set_usb2_desc(dev);
|
||||
device_set_usb_desc(dev);
|
||||
|
||||
id = usb2_get_interface_descriptor(uaa->iface);
|
||||
id = usbd_get_interface_descriptor(uaa->iface);
|
||||
|
||||
uaudio_chan_fill_info(sc, uaa->device);
|
||||
|
||||
@ -728,7 +728,7 @@ uaudio_detach_sub(device_t dev)
|
||||
|
||||
if (error) {
|
||||
device_printf(dev, "Waiting for sound application to exit!\n");
|
||||
usb2_pause_mtx(NULL, 2 * hz);
|
||||
usb_pause_mtx(NULL, 2 * hz);
|
||||
goto repeat; /* try again */
|
||||
}
|
||||
return (0); /* success */
|
||||
@ -783,7 +783,7 @@ uaudio_chan_fill_info_sub(struct uaudio_softc *sc, struct usb_device *udev,
|
||||
const struct usb2_audio_streaming_endpoint_descriptor *sed = NULL;
|
||||
const usb2_endpoint_descriptor_audio_t *ed1 = NULL;
|
||||
const usb2_endpoint_descriptor_audio_t *ed2 = NULL;
|
||||
struct usb_config_descriptor *cd = usb2_get_config_descriptor(udev);
|
||||
struct usb_config_descriptor *cd = usbd_get_config_descriptor(udev);
|
||||
struct usb_interface_descriptor *id;
|
||||
const struct uaudio_format *p_fmt;
|
||||
struct uaudio_chan *chan;
|
||||
@ -800,7 +800,7 @@ uaudio_chan_fill_info_sub(struct uaudio_softc *sc, struct usb_device *udev,
|
||||
uint8_t audio_if = 0;
|
||||
uint8_t sample_size;
|
||||
|
||||
while ((desc = usb2_desc_foreach(cd, desc))) {
|
||||
while ((desc = usb_desc_foreach(cd, desc))) {
|
||||
|
||||
if ((desc->bDescriptorType == UDESC_INTERFACE) &&
|
||||
(desc->bLength >= sizeof(*id))) {
|
||||
@ -832,7 +832,7 @@ uaudio_chan_fill_info_sub(struct uaudio_softc *sc, struct usb_device *udev,
|
||||
*/
|
||||
|
||||
if ((sc->sc_midi_chan.valid == 0) &&
|
||||
usb2_get_iface(udev, curidx)) {
|
||||
usbd_get_iface(udev, curidx)) {
|
||||
sc->sc_midi_chan.iface_index = curidx;
|
||||
sc->sc_midi_chan.iface_alt_index = alt_index;
|
||||
sc->sc_midi_chan.valid = 1;
|
||||
@ -994,7 +994,7 @@ uaudio_chan_fill_info_sub(struct uaudio_softc *sc, struct usb_device *udev,
|
||||
&sc->sc_rec_chan :
|
||||
&sc->sc_play_chan;
|
||||
|
||||
if ((chan->valid == 0) && usb2_get_iface(udev, curidx)) {
|
||||
if ((chan->valid == 0) && usbd_get_iface(udev, curidx)) {
|
||||
|
||||
chan->valid = 1;
|
||||
#if USB_DEBUG
|
||||
@ -1061,7 +1061,7 @@ uaudio_chan_fill_info(struct uaudio_softc *sc, struct usb_device *udev)
|
||||
{
|
||||
uint32_t rate = uaudio_default_rate;
|
||||
uint32_t z;
|
||||
uint16_t fps = usb2_get_isoc_fps(udev);
|
||||
uint16_t fps = usbd_get_isoc_fps(udev);
|
||||
uint8_t bits = uaudio_default_bits;
|
||||
uint8_t y;
|
||||
uint8_t channels = uaudio_default_channels;
|
||||
@ -1172,7 +1172,7 @@ uaudio_chan_play_callback(struct usb_xfer *xfer)
|
||||
if (n > total) {
|
||||
n = total;
|
||||
}
|
||||
usb2_copy_in(xfer->frbuffers, offset, ch->cur, n);
|
||||
usbd_copy_in(xfer->frbuffers, offset, ch->cur, n);
|
||||
|
||||
total -= n;
|
||||
ch->cur += n;
|
||||
@ -1183,7 +1183,7 @@ uaudio_chan_play_callback(struct usb_xfer *xfer)
|
||||
}
|
||||
}
|
||||
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
break;
|
||||
|
||||
default: /* Error */
|
||||
@ -1249,7 +1249,7 @@ uaudio_chan_record_callback(struct usb_xfer *xfer)
|
||||
if (m > p_len[n]) {
|
||||
m = p_len[n];
|
||||
}
|
||||
usb2_copy_out(xfer->frbuffers, offset1, ch->cur, m);
|
||||
usbd_copy_out(xfer->frbuffers, offset1, ch->cur, m);
|
||||
|
||||
p_len[n] -= m;
|
||||
offset1 += m;
|
||||
@ -1282,7 +1282,7 @@ uaudio_chan_record_callback(struct usb_xfer *xfer)
|
||||
DPRINTF("no buffer!\n");
|
||||
return;
|
||||
}
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
@ -1361,13 +1361,13 @@ uaudio_chan_init(struct uaudio_softc *sc, struct snd_dbuf *b,
|
||||
DPRINTF("endpoint=0x%02x, speed=%d, iface=%d alt=%d\n",
|
||||
endpoint, ch->sample_rate, iface_index, alt_index);
|
||||
|
||||
err = usb2_set_alt_interface_index(sc->sc_udev, iface_index, alt_index);
|
||||
err = usbd_set_alt_interface_index(sc->sc_udev, iface_index, alt_index);
|
||||
if (err) {
|
||||
DPRINTF("setting of alternate index failed: %s!\n",
|
||||
usb2_errstr(err));
|
||||
usbd_errstr(err));
|
||||
goto error;
|
||||
}
|
||||
usb2_set_parent_iface(sc->sc_udev, iface_index, sc->sc_mixer_iface_index);
|
||||
usbd_set_parent_iface(sc->sc_udev, iface_index, sc->sc_mixer_iface_index);
|
||||
|
||||
/*
|
||||
* If just one sampling rate is supported,
|
||||
@ -1383,7 +1383,7 @@ uaudio_chan_init(struct uaudio_softc *sc, struct snd_dbuf *b,
|
||||
DPRINTF("setting of sample rate failed! (continuing anyway)\n");
|
||||
}
|
||||
}
|
||||
if (usb2_transfer_setup(sc->sc_udev, &iface_index, ch->xfer,
|
||||
if (usbd_transfer_setup(sc->sc_udev, &iface_index, ch->xfer,
|
||||
ch->usb2_cfg, UAUDIO_NCHANBUFS, ch, ch->pcm_mtx)) {
|
||||
DPRINTF("could not allocate USB transfers!\n");
|
||||
goto error;
|
||||
@ -1402,7 +1402,7 @@ uaudio_chan_free(struct uaudio_chan *ch)
|
||||
free(ch->buf, M_DEVBUF);
|
||||
ch->buf = NULL;
|
||||
}
|
||||
usb2_transfer_unsetup(ch->xfer, UAUDIO_NCHANBUFS);
|
||||
usbd_transfer_unsetup(ch->xfer, UAUDIO_NCHANBUFS);
|
||||
|
||||
ch->valid = 0;
|
||||
|
||||
@ -1521,10 +1521,10 @@ uaudio_chan_start(struct uaudio_chan *ch)
|
||||
#error "please update code"
|
||||
#endif
|
||||
if (ch->xfer[0]) {
|
||||
usb2_transfer_start(ch->xfer[0]);
|
||||
usbd_transfer_start(ch->xfer[0]);
|
||||
}
|
||||
if (ch->xfer[1]) {
|
||||
usb2_transfer_start(ch->xfer[1]);
|
||||
usbd_transfer_start(ch->xfer[1]);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
@ -1535,8 +1535,8 @@ uaudio_chan_stop(struct uaudio_chan *ch)
|
||||
#if (UAUDIO_NCHANBUFS != 2)
|
||||
#error "please update code"
|
||||
#endif
|
||||
usb2_transfer_stop(ch->xfer[0]);
|
||||
usb2_transfer_stop(ch->xfer[1]);
|
||||
usbd_transfer_stop(ch->xfer[0]);
|
||||
usbd_transfer_stop(ch->xfer[1]);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -2677,7 +2677,7 @@ uaudio_mixer_fill_info(struct uaudio_softc *sc, struct usb_device *udev,
|
||||
void *desc)
|
||||
{
|
||||
const struct usb2_audio_control_descriptor *acdp;
|
||||
struct usb_config_descriptor *cd = usb2_get_config_descriptor(udev);
|
||||
struct usb_config_descriptor *cd = usbd_get_config_descriptor(udev);
|
||||
const struct usb_descriptor *dp;
|
||||
const struct usb2_audio_unit *au;
|
||||
struct uaudio_terminal_node *iot = NULL;
|
||||
@ -2685,7 +2685,7 @@ uaudio_mixer_fill_info(struct uaudio_softc *sc, struct usb_device *udev,
|
||||
uint8_t ID_max = 0; /* inclusive */
|
||||
uint8_t i;
|
||||
|
||||
desc = usb2_desc_foreach(cd, desc);
|
||||
desc = usb_desc_foreach(cd, desc);
|
||||
|
||||
if (desc == NULL) {
|
||||
DPRINTF("no Audio Control header\n");
|
||||
@ -2724,7 +2724,7 @@ uaudio_mixer_fill_info(struct uaudio_softc *sc, struct usb_device *udev,
|
||||
DPRINTF("no memory!\n");
|
||||
goto done;
|
||||
}
|
||||
while ((desc = usb2_desc_foreach(cd, desc))) {
|
||||
while ((desc = usb_desc_foreach(cd, desc))) {
|
||||
|
||||
dp = desc;
|
||||
|
||||
@ -2939,9 +2939,9 @@ uaudio_mixer_get(struct usb_device *udev, uint8_t what,
|
||||
USETW(req.wIndex, mc->wIndex);
|
||||
USETW(req.wLength, len);
|
||||
|
||||
err = usb2_do_request(udev, &Giant, &req, data);
|
||||
err = usbd_do_request(udev, &Giant, &req, data);
|
||||
if (err) {
|
||||
DPRINTF("err=%s\n", usb2_errstr(err));
|
||||
DPRINTF("err=%s\n", usbd_errstr(err));
|
||||
return (0);
|
||||
}
|
||||
if (len < 1) {
|
||||
@ -3011,13 +3011,13 @@ uaudio_mixer_write_cfg_callback(struct usb_xfer *xfer)
|
||||
if (len > 1) {
|
||||
buf[1] = (mc->wData[chan] >> 8) & 0xFF;
|
||||
}
|
||||
usb2_copy_in(xfer->frbuffers, 0, &req, sizeof(req));
|
||||
usb2_copy_in(xfer->frbuffers + 1, 0, buf, len);
|
||||
usbd_copy_in(xfer->frbuffers, 0, &req, sizeof(req));
|
||||
usbd_copy_in(xfer->frbuffers + 1, 0, buf, len);
|
||||
|
||||
xfer->frlengths[0] = sizeof(req);
|
||||
xfer->frlengths[1] = len;
|
||||
xfer->nframes = xfer->frlengths[1] ? 2 : 1;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -3033,7 +3033,7 @@ uaudio_mixer_write_cfg_callback(struct usb_xfer *xfer)
|
||||
break;
|
||||
|
||||
default: /* Error */
|
||||
DPRINTF("error=%s\n", usb2_errstr(xfer->error));
|
||||
DPRINTF("error=%s\n", usbd_errstr(xfer->error));
|
||||
if (xfer->error == USB_ERR_CANCELLED) {
|
||||
/* do nothing - we are detaching */
|
||||
break;
|
||||
@ -3059,7 +3059,7 @@ uaudio_set_speed(struct usb_device *udev, uint8_t endpt, uint32_t speed)
|
||||
data[1] = speed >> 8;
|
||||
data[2] = speed >> 16;
|
||||
|
||||
return (usb2_do_request(udev, &Giant, &req, data));
|
||||
return (usbd_do_request(udev, &Giant, &req, data));
|
||||
}
|
||||
|
||||
static int
|
||||
@ -3105,7 +3105,7 @@ uaudio_mixer_ctl_set(struct uaudio_softc *sc, struct uaudio_mixer_node *mc,
|
||||
|
||||
/* start the transfer, if not already started */
|
||||
|
||||
usb2_transfer_start(sc->sc_mixer_xfer[0]);
|
||||
usbd_transfer_start(sc->sc_mixer_xfer[0]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -3142,7 +3142,7 @@ uaudio_mixer_init_sub(struct uaudio_softc *sc, struct snd_mixer *m)
|
||||
{
|
||||
DPRINTF("\n");
|
||||
|
||||
if (usb2_transfer_setup(sc->sc_udev, &sc->sc_mixer_iface_index,
|
||||
if (usbd_transfer_setup(sc->sc_udev, &sc->sc_mixer_iface_index,
|
||||
sc->sc_mixer_xfer, uaudio_mixer_config, 1, sc,
|
||||
mixer_get_lock(m))) {
|
||||
DPRINTFN(0, "could not allocate USB "
|
||||
@ -3163,7 +3163,7 @@ uaudio_mixer_uninit_sub(struct uaudio_softc *sc)
|
||||
{
|
||||
DPRINTF("\n");
|
||||
|
||||
usb2_transfer_unsetup(sc->sc_mixer_xfer, 1);
|
||||
usbd_transfer_unsetup(sc->sc_mixer_xfer, 1);
|
||||
|
||||
return (0);
|
||||
}
|
||||
@ -3242,10 +3242,10 @@ umidi_read_clear_stall_callback(struct usb_xfer *xfer)
|
||||
struct umidi_chan *chan = xfer->priv_sc;
|
||||
struct usb_xfer *xfer_other = chan->xfer[1];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
if (usbd_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
chan->flags &= ~UMIDI_FLAG_READ_STALL;
|
||||
usb2_transfer_start(xfer_other);
|
||||
usbd_transfer_start(xfer_other);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3272,14 +3272,14 @@ umidi_bulk_read_callback(struct usb_xfer *xfer)
|
||||
|
||||
while (xfer->actlen >= 4) {
|
||||
|
||||
usb2_copy_out(xfer->frbuffers, pos, buf, 1);
|
||||
usbd_copy_out(xfer->frbuffers, pos, buf, 1);
|
||||
|
||||
cmd_len = umidi_cmd_to_len[buf[0] & 0xF]; /* command length */
|
||||
cn = buf[0] >> 4; /* cable number */
|
||||
sub = &chan->sub[cn];
|
||||
|
||||
if (cmd_len && (cn < chan->max_cable) && sub->read_open) {
|
||||
usb2_fifo_put_data(sub->fifo.fp[USB_FIFO_RX], xfer->frbuffers,
|
||||
usb_fifo_put_data(sub->fifo.fp[USB_FIFO_RX], xfer->frbuffers,
|
||||
pos + 1, cmd_len, 1);
|
||||
} else {
|
||||
/* ignore the command */
|
||||
@ -3293,22 +3293,22 @@ umidi_bulk_read_callback(struct usb_xfer *xfer)
|
||||
DPRINTF("start\n");
|
||||
|
||||
if (chan->flags & UMIDI_FLAG_READ_STALL) {
|
||||
usb2_transfer_start(chan->xfer[3]);
|
||||
usbd_transfer_start(chan->xfer[3]);
|
||||
return;
|
||||
}
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
|
||||
default:
|
||||
tr_error:
|
||||
|
||||
DPRINTF("error=%s\n", usb2_errstr(xfer->error));
|
||||
DPRINTF("error=%s\n", usbd_errstr(xfer->error));
|
||||
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
/* try to clear stall first */
|
||||
chan->flags |= UMIDI_FLAG_READ_STALL;
|
||||
usb2_transfer_start(chan->xfer[3]);
|
||||
usbd_transfer_start(chan->xfer[3]);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -3321,10 +3321,10 @@ umidi_write_clear_stall_callback(struct usb_xfer *xfer)
|
||||
struct umidi_chan *chan = xfer->priv_sc;
|
||||
struct usb_xfer *xfer_other = chan->xfer[0];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
if (usbd_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
chan->flags &= ~UMIDI_FLAG_WRITE_STALL;
|
||||
usb2_transfer_start(xfer_other);
|
||||
usbd_transfer_start(xfer_other);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3481,7 +3481,7 @@ umidi_bulk_write_callback(struct usb_xfer *xfer)
|
||||
DPRINTF("start\n");
|
||||
|
||||
if (chan->flags & UMIDI_FLAG_WRITE_STALL) {
|
||||
usb2_transfer_start(chan->xfer[2]);
|
||||
usbd_transfer_start(chan->xfer[2]);
|
||||
return;
|
||||
}
|
||||
total_length = 0; /* reset */
|
||||
@ -3497,7 +3497,7 @@ umidi_bulk_write_callback(struct usb_xfer *xfer)
|
||||
sub = &chan->sub[chan->curr_cable];
|
||||
|
||||
if (sub->write_open) {
|
||||
usb2_fifo_get_data(sub->fifo.fp[USB_FIFO_TX],
|
||||
usb_fifo_get_data(sub->fifo.fp[USB_FIFO_TX],
|
||||
xfer->frbuffers, total_length,
|
||||
1, &actlen, 0);
|
||||
} else {
|
||||
@ -3505,7 +3505,7 @@ umidi_bulk_write_callback(struct usb_xfer *xfer)
|
||||
}
|
||||
|
||||
if (actlen) {
|
||||
usb2_copy_out(xfer->frbuffers, total_length, &buf, 1);
|
||||
usbd_copy_out(xfer->frbuffers, total_length, &buf, 1);
|
||||
|
||||
tr_any = 1;
|
||||
|
||||
@ -3517,7 +3517,7 @@ umidi_bulk_write_callback(struct usb_xfer *xfer)
|
||||
sub->temp_cmd[0], sub->temp_cmd[1],
|
||||
sub->temp_cmd[2], sub->temp_cmd[3]);
|
||||
|
||||
usb2_copy_in(xfer->frbuffers, total_length,
|
||||
usbd_copy_in(xfer->frbuffers, total_length,
|
||||
sub->temp_cmd, 4);
|
||||
|
||||
total_length += 4;
|
||||
@ -3543,18 +3543,18 @@ umidi_bulk_write_callback(struct usb_xfer *xfer)
|
||||
|
||||
if (total_length) {
|
||||
xfer->frlengths[0] = total_length;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
}
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
|
||||
DPRINTF("error=%s\n", usb2_errstr(xfer->error));
|
||||
DPRINTF("error=%s\n", usbd_errstr(xfer->error));
|
||||
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
/* try to clear stall first */
|
||||
chan->flags |= UMIDI_FLAG_WRITE_STALL;
|
||||
usb2_transfer_start(chan->xfer[2]);
|
||||
usbd_transfer_start(chan->xfer[2]);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -3587,7 +3587,7 @@ umidi_start_read(struct usb_fifo *fifo)
|
||||
{
|
||||
struct umidi_chan *chan = fifo->priv_sc0;
|
||||
|
||||
usb2_transfer_start(chan->xfer[1]);
|
||||
usbd_transfer_start(chan->xfer[1]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -3614,7 +3614,7 @@ umidi_start_write(struct usb_fifo *fifo)
|
||||
{
|
||||
struct umidi_chan *chan = fifo->priv_sc0;
|
||||
|
||||
usb2_transfer_start(chan->xfer[0]);
|
||||
usbd_transfer_start(chan->xfer[0]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -3629,8 +3629,8 @@ umidi_stop_write(struct usb_fifo *fifo)
|
||||
|
||||
if (--(chan->write_open_refcount) == 0) {
|
||||
DPRINTF("(stopping write transfer)\n");
|
||||
usb2_transfer_stop(chan->xfer[2]);
|
||||
usb2_transfer_stop(chan->xfer[0]);
|
||||
usbd_transfer_stop(chan->xfer[2]);
|
||||
usbd_transfer_stop(chan->xfer[0]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3641,7 +3641,7 @@ umidi_open(struct usb_fifo *fifo, int fflags)
|
||||
struct umidi_sub_chan *sub = umidi_sub_by_fifo(fifo);
|
||||
|
||||
if (fflags & FREAD) {
|
||||
if (usb2_fifo_alloc_buffer(fifo, 4, (1024 / 4))) {
|
||||
if (usb_fifo_alloc_buffer(fifo, 4, (1024 / 4))) {
|
||||
return (ENOMEM);
|
||||
}
|
||||
mtx_lock(fifo->priv_mtx);
|
||||
@ -3650,7 +3650,7 @@ umidi_open(struct usb_fifo *fifo, int fflags)
|
||||
mtx_unlock(fifo->priv_mtx);
|
||||
}
|
||||
if (fflags & FWRITE) {
|
||||
if (usb2_fifo_alloc_buffer(fifo, 32, (1024 / 32))) {
|
||||
if (usb_fifo_alloc_buffer(fifo, 32, (1024 / 32))) {
|
||||
return (ENOMEM);
|
||||
}
|
||||
/* clear stall first */
|
||||
@ -3670,10 +3670,10 @@ static void
|
||||
umidi_close(struct usb_fifo *fifo, int fflags)
|
||||
{
|
||||
if (fflags & FREAD) {
|
||||
usb2_fifo_free_buffer(fifo);
|
||||
usb_fifo_free_buffer(fifo);
|
||||
}
|
||||
if (fflags & FWRITE) {
|
||||
usb2_fifo_free_buffer(fifo);
|
||||
usb_fifo_free_buffer(fifo);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3716,18 +3716,18 @@ umidi_probe(device_t dev)
|
||||
int error;
|
||||
uint32_t n;
|
||||
|
||||
if (usb2_set_alt_interface_index(sc->sc_udev, chan->iface_index,
|
||||
if (usbd_set_alt_interface_index(sc->sc_udev, chan->iface_index,
|
||||
chan->iface_alt_index)) {
|
||||
DPRINTF("setting of alternate index failed!\n");
|
||||
goto detach;
|
||||
}
|
||||
usb2_set_parent_iface(sc->sc_udev, chan->iface_index, sc->sc_mixer_iface_index);
|
||||
usbd_set_parent_iface(sc->sc_udev, chan->iface_index, sc->sc_mixer_iface_index);
|
||||
|
||||
error = usb2_transfer_setup(uaa->device, &chan->iface_index,
|
||||
error = usbd_transfer_setup(uaa->device, &chan->iface_index,
|
||||
chan->xfer, umidi_config, UMIDI_N_TRANSFER,
|
||||
chan, &chan->mtx);
|
||||
if (error) {
|
||||
DPRINTF("error=%s\n", usb2_errstr(error));
|
||||
DPRINTF("error=%s\n", usbd_errstr(error));
|
||||
goto detach;
|
||||
}
|
||||
if ((chan->max_cable > UMIDI_CABLES_MAX) ||
|
||||
@ -3739,7 +3739,7 @@ umidi_probe(device_t dev)
|
||||
|
||||
sub = &chan->sub[n];
|
||||
|
||||
error = usb2_fifo_attach(sc->sc_udev, chan, &chan->mtx,
|
||||
error = usb_fifo_attach(sc->sc_udev, chan, &chan->mtx,
|
||||
&umidi_fifo_methods, &sub->fifo, unit, n,
|
||||
chan->iface_index,
|
||||
UID_ROOT, GID_OPERATOR, 0644);
|
||||
@ -3757,7 +3757,7 @@ umidi_probe(device_t dev)
|
||||
* NOTE: at least one device will not work properly unless
|
||||
* the BULK pipe is open all the time.
|
||||
*/
|
||||
usb2_transfer_start(chan->xfer[1]);
|
||||
usbd_transfer_start(chan->xfer[1]);
|
||||
|
||||
mtx_unlock(&chan->mtx);
|
||||
|
||||
@ -3775,17 +3775,17 @@ umidi_detach(device_t dev)
|
||||
uint32_t n;
|
||||
|
||||
for (n = 0; n < UMIDI_CABLES_MAX; n++) {
|
||||
usb2_fifo_detach(&chan->sub[n].fifo);
|
||||
usb_fifo_detach(&chan->sub[n].fifo);
|
||||
}
|
||||
|
||||
mtx_lock(&chan->mtx);
|
||||
|
||||
usb2_transfer_stop(chan->xfer[3]);
|
||||
usb2_transfer_stop(chan->xfer[1]);
|
||||
usbd_transfer_stop(chan->xfer[3]);
|
||||
usbd_transfer_stop(chan->xfer[1]);
|
||||
|
||||
mtx_unlock(&chan->mtx);
|
||||
|
||||
usb2_transfer_unsetup(chan->xfer, UMIDI_N_TRANSFER);
|
||||
usbd_transfer_unsetup(chan->xfer, UMIDI_N_TRANSFER);
|
||||
|
||||
mtx_destroy(&chan->mtx);
|
||||
|
||||
|
@ -260,7 +260,7 @@ at91dci_wakeup_peer(struct at91dci_softc *sc)
|
||||
|
||||
/* wait 8 milliseconds */
|
||||
/* Wait for reset to complete. */
|
||||
usb2_pause_mtx(&sc->sc_bus.bus_mtx, hz / 125);
|
||||
usb_pause_mtx(&sc->sc_bus.bus_mtx, hz / 125);
|
||||
|
||||
AT91_UDP_WRITE_4(sc, AT91_UDP_GSTATE, 0);
|
||||
}
|
||||
@ -321,7 +321,7 @@ at91dci_setup_rx(struct at91dci_td *td)
|
||||
td->fifo_reg, (void *)&req, sizeof(req));
|
||||
|
||||
/* copy data into real buffer */
|
||||
usb2_copy_in(td->pc, 0, &req, sizeof(req));
|
||||
usbd_copy_in(td->pc, 0, &req, sizeof(req));
|
||||
|
||||
td->offset = sizeof(req);
|
||||
td->remainder = 0;
|
||||
@ -442,7 +442,7 @@ at91dci_data_rx(struct at91dci_td *td)
|
||||
return (0); /* we are complete */
|
||||
}
|
||||
while (count > 0) {
|
||||
usb2_get_page(td->pc, td->offset, &buf_res);
|
||||
usbd_get_page(td->pc, td->offset, &buf_res);
|
||||
|
||||
/* get correct length */
|
||||
if (buf_res.length > count) {
|
||||
@ -549,7 +549,7 @@ at91dci_data_tx(struct at91dci_td *td)
|
||||
}
|
||||
while (count > 0) {
|
||||
|
||||
usb2_get_page(td->pc, td->offset, &buf_res);
|
||||
usbd_get_page(td->pc, td->offset, &buf_res);
|
||||
|
||||
/* get correct length */
|
||||
if (buf_res.length > count) {
|
||||
@ -865,7 +865,7 @@ at91dci_setup_standard_chain(struct usb_xfer *xfer)
|
||||
|
||||
DPRINTFN(9, "addr=%d endpt=%d sumlen=%d speed=%d\n",
|
||||
xfer->address, UE_GET_ADDR(xfer->endpointno),
|
||||
xfer->sumlen, usb2_get_speed(xfer->xroot->udev));
|
||||
xfer->sumlen, usbd_get_speed(xfer->xroot->udev));
|
||||
|
||||
temp.max_frame_size = xfer->max_frame_size;
|
||||
|
||||
@ -1046,11 +1046,11 @@ at91dci_start_standard_chain(struct usb_xfer *xfer)
|
||||
DPRINTFN(15, "enable interrupts on endpoint %d\n", ep_no);
|
||||
|
||||
/* put transfer on interrupt queue */
|
||||
usb2_transfer_enqueue(&xfer->xroot->bus->intr_q, xfer);
|
||||
usbd_transfer_enqueue(&xfer->xroot->bus->intr_q, xfer);
|
||||
|
||||
/* start timeout, if any */
|
||||
if (xfer->timeout != 0) {
|
||||
usb2_transfer_timeout_ms(xfer,
|
||||
usbd_transfer_timeout_ms(xfer,
|
||||
&at91dci_timeout, xfer->timeout);
|
||||
}
|
||||
}
|
||||
@ -1203,7 +1203,7 @@ at91dci_device_done(struct usb_xfer *xfer, usb_error_t error)
|
||||
DPRINTFN(15, "disable interrupts on endpoint %d\n", ep_no);
|
||||
}
|
||||
/* dequeue transfer and start next transfer */
|
||||
usb2_transfer_done(xfer, error);
|
||||
usbd_transfer_done(xfer, error);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1375,7 +1375,7 @@ at91dci_init(struct at91dci_softc *sc)
|
||||
(sc->sc_clocks_on) (sc->sc_clocks_arg);
|
||||
}
|
||||
/* wait a little for things to stabilise */
|
||||
usb2_pause_mtx(&sc->sc_bus.bus_mtx, hz / 1000);
|
||||
usb_pause_mtx(&sc->sc_bus.bus_mtx, hz / 1000);
|
||||
|
||||
/* disable and clear all interrupts */
|
||||
|
||||
@ -1632,7 +1632,7 @@ at91dci_device_isoc_fs_enter(struct usb_xfer *xfer)
|
||||
* pre-compute when the isochronous transfer will be finished:
|
||||
*/
|
||||
xfer->isoc_time_complete =
|
||||
usb2_isoc_time_expand(&sc->sc_bus, nframes) + temp +
|
||||
usb_isoc_time_expand(&sc->sc_bus, nframes) + temp +
|
||||
xfer->nframes;
|
||||
|
||||
/* compute frame number for next insertion */
|
||||
@ -2165,7 +2165,7 @@ at91dci_xfer_setup(struct usb_setup_params *parm)
|
||||
parm->hc_max_packet_count = 1;
|
||||
parm->hc_max_frame_size = 0x500;
|
||||
|
||||
usb2_transfer_setup_sub(parm);
|
||||
usbd_transfer_setup_sub(parm);
|
||||
|
||||
/*
|
||||
* compute maximum number of TDs
|
||||
@ -2193,7 +2193,7 @@ at91dci_xfer_setup(struct usb_setup_params *parm)
|
||||
}
|
||||
|
||||
/*
|
||||
* check if "usb2_transfer_setup_sub" set an error
|
||||
* check if "usbd_transfer_setup_sub" set an error
|
||||
*/
|
||||
if (parm->err) {
|
||||
return;
|
||||
|
@ -144,7 +144,7 @@ at91_udp_attach(device_t dev)
|
||||
sc->sc_dci.sc_bus.devices_max = AT91_MAX_DEVICES;
|
||||
|
||||
/* get all DMA memory */
|
||||
if (usb2_bus_mem_alloc_all(&sc->sc_dci.sc_bus,
|
||||
if (usb_bus_mem_alloc_all(&sc->sc_dci.sc_bus,
|
||||
USB_GET_DMA_TAG(dev), NULL)) {
|
||||
return (ENOMEM);
|
||||
}
|
||||
@ -166,7 +166,7 @@ at91_udp_attach(device_t dev)
|
||||
at91_udp_pull_down(sc);
|
||||
|
||||
/* wait 10ms for pulldown to stabilise */
|
||||
usb2_pause_mtx(NULL, hz / 100);
|
||||
usb_pause_mtx(NULL, hz / 100);
|
||||
|
||||
sc->sc_iclk = at91_pmc_clock_ref("udc_clk");
|
||||
sc->sc_fclk = at91_pmc_clock_ref("udpck");
|
||||
@ -295,7 +295,7 @@ at91_udp_detach(device_t dev)
|
||||
sc->sc_dci.sc_io_res);
|
||||
sc->sc_dci.sc_io_res = NULL;
|
||||
}
|
||||
usb2_bus_mem_free_all(&sc->sc_dci.sc_bus, NULL);
|
||||
usb_bus_mem_free_all(&sc->sc_dci.sc_bus, NULL);
|
||||
|
||||
/* disable clocks */
|
||||
at91_pmc_clock_disable(sc->sc_iclk);
|
||||
|
@ -204,7 +204,7 @@ atmegadci_wakeup_peer(struct atmegadci_softc *sc)
|
||||
|
||||
/* wait 8 milliseconds */
|
||||
/* Wait for reset to complete. */
|
||||
usb2_pause_mtx(&sc->sc_bus.bus_mtx, hz / 125);
|
||||
usb_pause_mtx(&sc->sc_bus.bus_mtx, hz / 125);
|
||||
|
||||
/* hardware should have cleared RMWKUP bit */
|
||||
}
|
||||
@ -267,7 +267,7 @@ atmegadci_setup_rx(struct atmegadci_td *td)
|
||||
(void *)&req, sizeof(req));
|
||||
|
||||
/* copy data into real buffer */
|
||||
usb2_copy_in(td->pc, 0, &req, sizeof(req));
|
||||
usbd_copy_in(td->pc, 0, &req, sizeof(req));
|
||||
|
||||
td->offset = sizeof(req);
|
||||
td->remainder = 0;
|
||||
@ -378,7 +378,7 @@ atmegadci_data_rx(struct atmegadci_td *td)
|
||||
return (0); /* we are complete */
|
||||
}
|
||||
while (count > 0) {
|
||||
usb2_get_page(td->pc, td->offset, &buf_res);
|
||||
usbd_get_page(td->pc, td->offset, &buf_res);
|
||||
|
||||
/* get correct length */
|
||||
if (buf_res.length > count) {
|
||||
@ -465,7 +465,7 @@ atmegadci_data_tx(struct atmegadci_td *td)
|
||||
}
|
||||
while (count > 0) {
|
||||
|
||||
usb2_get_page(td->pc, td->offset, &buf_res);
|
||||
usbd_get_page(td->pc, td->offset, &buf_res);
|
||||
|
||||
/* get correct length */
|
||||
if (buf_res.length > count) {
|
||||
@ -768,7 +768,7 @@ atmegadci_setup_standard_chain(struct usb_xfer *xfer)
|
||||
|
||||
DPRINTFN(9, "addr=%d endpt=%d sumlen=%d speed=%d\n",
|
||||
xfer->address, UE_GET_ADDR(xfer->endpointno),
|
||||
xfer->sumlen, usb2_get_speed(xfer->xroot->udev));
|
||||
xfer->sumlen, usbd_get_speed(xfer->xroot->udev));
|
||||
|
||||
temp.max_frame_size = xfer->max_frame_size;
|
||||
|
||||
@ -929,11 +929,11 @@ atmegadci_start_standard_chain(struct usb_xfer *xfer)
|
||||
if (atmegadci_xfer_do_fifo(xfer)) {
|
||||
|
||||
/* put transfer on interrupt queue */
|
||||
usb2_transfer_enqueue(&xfer->xroot->bus->intr_q, xfer);
|
||||
usbd_transfer_enqueue(&xfer->xroot->bus->intr_q, xfer);
|
||||
|
||||
/* start timeout, if any */
|
||||
if (xfer->timeout != 0) {
|
||||
usb2_transfer_timeout_ms(xfer,
|
||||
usbd_transfer_timeout_ms(xfer,
|
||||
&atmegadci_timeout, xfer->timeout);
|
||||
}
|
||||
}
|
||||
@ -1089,7 +1089,7 @@ atmegadci_device_done(struct usb_xfer *xfer, usb_error_t error)
|
||||
DPRINTFN(15, "disabled interrupts!\n");
|
||||
}
|
||||
/* dequeue transfer and start next transfer */
|
||||
usb2_transfer_done(xfer, error);
|
||||
usbd_transfer_done(xfer, error);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1236,7 +1236,7 @@ atmegadci_init(struct atmegadci_softc *sc)
|
||||
if (ATMEGA_READ_1(sc, 0x49) & 0x01)
|
||||
break;
|
||||
/* wait a little bit for PLL to start */
|
||||
usb2_pause_mtx(&sc->sc_bus.bus_mtx, hz / 100);
|
||||
usb_pause_mtx(&sc->sc_bus.bus_mtx, hz / 100);
|
||||
}
|
||||
|
||||
/* make sure USB is enabled */
|
||||
@ -1252,7 +1252,7 @@ atmegadci_init(struct atmegadci_softc *sc)
|
||||
ATMEGA_WRITE_1(sc, ATMEGA_UDCON, ATMEGA_UDCON_DETACH);
|
||||
|
||||
/* wait a little for things to stabilise */
|
||||
usb2_pause_mtx(&sc->sc_bus.bus_mtx, hz / 20);
|
||||
usb_pause_mtx(&sc->sc_bus.bus_mtx, hz / 20);
|
||||
|
||||
/* enable interrupts */
|
||||
ATMEGA_WRITE_1(sc, ATMEGA_UDIEN,
|
||||
@ -1453,7 +1453,7 @@ atmegadci_device_isoc_fs_enter(struct usb_xfer *xfer)
|
||||
* pre-compute when the isochronous transfer will be finished:
|
||||
*/
|
||||
xfer->isoc_time_complete =
|
||||
usb2_isoc_time_expand(&sc->sc_bus, nframes) + temp +
|
||||
usb_isoc_time_expand(&sc->sc_bus, nframes) + temp +
|
||||
xfer->nframes;
|
||||
|
||||
/* compute frame number for next insertion */
|
||||
@ -2017,7 +2017,7 @@ atmegadci_xfer_setup(struct usb_setup_params *parm)
|
||||
parm->hc_max_packet_count = 1;
|
||||
parm->hc_max_frame_size = 0x500;
|
||||
|
||||
usb2_transfer_setup_sub(parm);
|
||||
usbd_transfer_setup_sub(parm);
|
||||
|
||||
/*
|
||||
* compute maximum number of TDs
|
||||
@ -2032,7 +2032,7 @@ atmegadci_xfer_setup(struct usb_setup_params *parm)
|
||||
}
|
||||
|
||||
/*
|
||||
* check if "usb2_transfer_setup_sub" set an error
|
||||
* check if "usbd_transfer_setup_sub" set an error
|
||||
*/
|
||||
if (parm->err)
|
||||
return;
|
||||
|
@ -84,7 +84,7 @@ atmegadci_attach(device_t dev)
|
||||
sc->sc_otg.sc_bus.devices_max = ATMEGA_MAX_DEVICES;
|
||||
|
||||
/* get all DMA memory */
|
||||
if (usb2_bus_mem_alloc_all(&sc->sc_otg.sc_bus,
|
||||
if (usb_bus_mem_alloc_all(&sc->sc_otg.sc_bus,
|
||||
USB_GET_DMA_TAG(dev), NULL)) {
|
||||
return (ENOMEM);
|
||||
}
|
||||
@ -168,7 +168,7 @@ atmegadci_detach(device_t dev)
|
||||
sc->sc_otg.sc_io_res);
|
||||
sc->sc_otg.sc_io_res = NULL;
|
||||
}
|
||||
usb2_bus_mem_free_all(&sc->sc_otg.sc_bus, NULL);
|
||||
usb_bus_mem_free_all(&sc->sc_otg.sc_bus, NULL);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
@ -237,7 +237,7 @@ avr32dci_wakeup_peer(struct avr32dci_softc *sc)
|
||||
|
||||
/* wait 8 milliseconds */
|
||||
/* Wait for reset to complete. */
|
||||
usb2_pause_mtx(&sc->sc_bus.bus_mtx, hz / 125);
|
||||
usb_pause_mtx(&sc->sc_bus.bus_mtx, hz / 125);
|
||||
|
||||
/* hardware should have cleared RMWKUP bit */
|
||||
}
|
||||
@ -289,7 +289,7 @@ avr32dci_setup_rx(struct avr32dci_td *td)
|
||||
memcpy(&req, sc->physdata, sizeof(req));
|
||||
|
||||
/* copy data into real buffer */
|
||||
usb2_copy_in(td->pc, 0, &req, sizeof(req));
|
||||
usbd_copy_in(td->pc, 0, &req, sizeof(req));
|
||||
|
||||
td->offset = sizeof(req);
|
||||
td->remainder = 0;
|
||||
@ -390,7 +390,7 @@ avr32dci_data_rx(struct avr32dci_td *td)
|
||||
return (0); /* we are complete */
|
||||
}
|
||||
while (count > 0) {
|
||||
usb2_get_page(td->pc, td->offset, &buf_res);
|
||||
usbd_get_page(td->pc, td->offset, &buf_res);
|
||||
|
||||
/* get correct length */
|
||||
if (buf_res.length > count) {
|
||||
@ -466,7 +466,7 @@ avr32dci_data_tx(struct avr32dci_td *td)
|
||||
}
|
||||
while (count > 0) {
|
||||
|
||||
usb2_get_page(td->pc, td->offset, &buf_res);
|
||||
usbd_get_page(td->pc, td->offset, &buf_res);
|
||||
|
||||
/* get correct length */
|
||||
if (buf_res.length > count) {
|
||||
@ -738,7 +738,7 @@ avr32dci_setup_standard_chain(struct usb_xfer *xfer)
|
||||
|
||||
DPRINTFN(9, "addr=%d endpt=%d sumlen=%d speed=%d\n",
|
||||
xfer->address, UE_GET_ADDR(xfer->endpoint),
|
||||
xfer->sumlen, usb2_get_speed(xfer->xroot->udev));
|
||||
xfer->sumlen, usbd_get_speed(xfer->xroot->udev));
|
||||
|
||||
temp.max_frame_size = xfer->max_frame_size;
|
||||
|
||||
@ -900,11 +900,11 @@ avr32dci_start_standard_chain(struct usb_xfer *xfer)
|
||||
avr32dci_mod_ien(sc, AVR32_INT_EPT_INT(ep_no), 0);
|
||||
|
||||
/* put transfer on interrupt queue */
|
||||
usb2_transfer_enqueue(&xfer->xroot->bus->intr_q, xfer);
|
||||
usbd_transfer_enqueue(&xfer->xroot->bus->intr_q, xfer);
|
||||
|
||||
/* start timeout, if any */
|
||||
if (xfer->timeout != 0) {
|
||||
usb2_transfer_timeout_ms(xfer,
|
||||
usbd_transfer_timeout_ms(xfer,
|
||||
&avr32dci_timeout, xfer->timeout);
|
||||
}
|
||||
}
|
||||
@ -1057,7 +1057,7 @@ avr32dci_device_done(struct usb_xfer *xfer, usb_error_t error)
|
||||
DPRINTFN(15, "disabled interrupts!\n");
|
||||
}
|
||||
/* dequeue transfer and start next transfer */
|
||||
usb2_transfer_done(xfer, error);
|
||||
usbd_transfer_done(xfer, error);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1198,7 +1198,7 @@ avr32dci_init(struct avr32dci_softc *sc)
|
||||
avr32dci_mod_ctrl(sc, AVR32_CTRL_DEV_DETACH, 0);
|
||||
|
||||
/* wait a little for things to stabilise */
|
||||
usb2_pause_mtx(&sc->sc_bus.bus_mtx, hz / 20);
|
||||
usb_pause_mtx(&sc->sc_bus.bus_mtx, hz / 20);
|
||||
|
||||
/* disable interrupts */
|
||||
avr32dci_mod_ien(sc, 0, 0xFFFFFFFF);
|
||||
@ -1387,7 +1387,7 @@ avr32dci_device_isoc_fs_enter(struct usb_xfer *xfer)
|
||||
* pre-compute when the isochronous transfer will be finished:
|
||||
*/
|
||||
xfer->isoc_time_complete =
|
||||
usb2_isoc_time_expand(&sc->sc_bus, nframes) + temp +
|
||||
usb_isoc_time_expand(&sc->sc_bus, nframes) + temp +
|
||||
xfer->nframes;
|
||||
|
||||
/* compute frame number for next insertion */
|
||||
@ -1950,7 +1950,7 @@ avr32dci_xfer_setup(struct usb_setup_params *parm)
|
||||
parm->hc_max_packet_count = 1;
|
||||
parm->hc_max_frame_size = 0x400;
|
||||
|
||||
usb2_transfer_setup_sub(parm);
|
||||
usbd_transfer_setup_sub(parm);
|
||||
|
||||
/*
|
||||
* compute maximum number of TDs
|
||||
@ -1965,7 +1965,7 @@ avr32dci_xfer_setup(struct usb_setup_params *parm)
|
||||
}
|
||||
|
||||
/*
|
||||
* check if "usb2_transfer_setup_sub" set an error
|
||||
* check if "usbd_transfer_setup_sub" set an error
|
||||
*/
|
||||
if (parm->err)
|
||||
return;
|
||||
|
@ -153,7 +153,7 @@ ehci_reset(ehci_softc_t *sc)
|
||||
|
||||
EOWRITE4(sc, EHCI_USBCMD, EHCI_CMD_HCRESET);
|
||||
for (i = 0; i < 100; i++) {
|
||||
usb2_pause_mtx(NULL, hz / 1000);
|
||||
usb_pause_mtx(NULL, hz / 1000);
|
||||
hcr = EOREAD4(sc, EHCI_USBCMD) & EHCI_CMD_HCRESET;
|
||||
if (!hcr) {
|
||||
if (sc->sc_flags & (EHCI_SCFLG_SETMODE | EHCI_SCFLG_BIGEMMIO)) {
|
||||
@ -189,7 +189,7 @@ ehci_hcreset(ehci_softc_t *sc)
|
||||
|
||||
EOWRITE4(sc, EHCI_USBCMD, 0); /* Halt controller */
|
||||
for (i = 0; i < 100; i++) {
|
||||
usb2_pause_mtx(NULL, hz / 1000);
|
||||
usb_pause_mtx(NULL, hz / 1000);
|
||||
hcr = EOREAD4(sc, EHCI_USBSTS) & EHCI_STS_HCH;
|
||||
if (hcr)
|
||||
break;
|
||||
@ -221,7 +221,7 @@ ehci_init(ehci_softc_t *sc)
|
||||
|
||||
DPRINTF("start\n");
|
||||
|
||||
usb2_callout_init_mtx(&sc->sc_tmo_pcd, &sc->sc_bus.bus_mtx, 0);
|
||||
usb_callout_init_mtx(&sc->sc_tmo_pcd, &sc->sc_bus.bus_mtx, 0);
|
||||
|
||||
#if USB_DEBUG
|
||||
if (ehcidebug > 2) {
|
||||
@ -274,7 +274,7 @@ ehci_init(ehci_softc_t *sc)
|
||||
for (i = 0; i < EHCI_VIRTUAL_FRAMELIST_COUNT; i++) {
|
||||
ehci_qh_t *qh;
|
||||
|
||||
usb2_get_page(sc->sc_hw.intr_start_pc + i, 0, &buf_res);
|
||||
usbd_get_page(sc->sc_hw.intr_start_pc + i, 0, &buf_res);
|
||||
|
||||
qh = buf_res.buffer;
|
||||
|
||||
@ -342,7 +342,7 @@ ehci_init(ehci_softc_t *sc)
|
||||
ehci_sitd_t *sitd;
|
||||
ehci_itd_t *itd;
|
||||
|
||||
usb2_get_page(sc->sc_hw.isoc_fs_start_pc + i, 0, &buf_res);
|
||||
usbd_get_page(sc->sc_hw.isoc_fs_start_pc + i, 0, &buf_res);
|
||||
|
||||
sitd = buf_res.buffer;
|
||||
|
||||
@ -367,7 +367,7 @@ ehci_init(ehci_softc_t *sc)
|
||||
sc->sc_intr_p_last[i | (EHCI_VIRTUAL_FRAMELIST_COUNT / 2)]->qh_self;
|
||||
|
||||
|
||||
usb2_get_page(sc->sc_hw.isoc_hs_start_pc + i, 0, &buf_res);
|
||||
usbd_get_page(sc->sc_hw.isoc_hs_start_pc + i, 0, &buf_res);
|
||||
|
||||
itd = buf_res.buffer;
|
||||
|
||||
@ -389,7 +389,7 @@ ehci_init(ehci_softc_t *sc)
|
||||
sitd->sitd_self;
|
||||
}
|
||||
|
||||
usb2_get_page(&sc->sc_hw.pframes_pc, 0, &buf_res);
|
||||
usbd_get_page(&sc->sc_hw.pframes_pc, 0, &buf_res);
|
||||
|
||||
if (1) {
|
||||
uint32_t *pframes;
|
||||
@ -409,7 +409,7 @@ ehci_init(ehci_softc_t *sc)
|
||||
/* setup sync list pointer */
|
||||
EOWRITE4(sc, EHCI_PERIODICLISTBASE, buf_res.physaddr);
|
||||
|
||||
usb2_get_page(&sc->sc_hw.async_start_pc, 0, &buf_res);
|
||||
usbd_get_page(&sc->sc_hw.async_start_pc, 0, &buf_res);
|
||||
|
||||
if (1) {
|
||||
|
||||
@ -445,7 +445,7 @@ ehci_init(ehci_softc_t *sc)
|
||||
}
|
||||
/* flush all cache into memory */
|
||||
|
||||
usb2_bus_mem_flush_all(&sc->sc_bus, &ehci_iterate_hw_softc);
|
||||
usb_bus_mem_flush_all(&sc->sc_bus, &ehci_iterate_hw_softc);
|
||||
|
||||
#if USB_DEBUG
|
||||
if (ehcidebug) {
|
||||
@ -472,7 +472,7 @@ ehci_init(ehci_softc_t *sc)
|
||||
EOWRITE4(sc, EHCI_CONFIGFLAG, EHCI_CONF_CF);
|
||||
|
||||
for (i = 0; i < 100; i++) {
|
||||
usb2_pause_mtx(NULL, hz / 1000);
|
||||
usb_pause_mtx(NULL, hz / 1000);
|
||||
hcr = EOREAD4(sc, EHCI_USBSTS) & EHCI_STS_HCH;
|
||||
if (!hcr) {
|
||||
break;
|
||||
@ -498,7 +498,7 @@ ehci_detach(ehci_softc_t *sc)
|
||||
{
|
||||
USB_BUS_LOCK(&sc->sc_bus);
|
||||
|
||||
usb2_callout_stop(&sc->sc_tmo_pcd);
|
||||
usb_callout_stop(&sc->sc_tmo_pcd);
|
||||
|
||||
EOWRITE4(sc, EHCI_USBINTR, sc->sc_eintrs);
|
||||
USB_BUS_UNLOCK(&sc->sc_bus);
|
||||
@ -508,9 +508,9 @@ ehci_detach(ehci_softc_t *sc)
|
||||
}
|
||||
|
||||
/* XXX let stray task complete */
|
||||
usb2_pause_mtx(NULL, hz / 20);
|
||||
usb_pause_mtx(NULL, hz / 20);
|
||||
|
||||
usb2_callout_drain(&sc->sc_tmo_pcd);
|
||||
usb_callout_drain(&sc->sc_tmo_pcd);
|
||||
}
|
||||
|
||||
void
|
||||
@ -543,7 +543,7 @@ ehci_suspend(ehci_softc_t *sc)
|
||||
if (hcr == 0) {
|
||||
break;
|
||||
}
|
||||
usb2_pause_mtx(&sc->sc_bus.bus_mtx, hz / 1000);
|
||||
usb_pause_mtx(&sc->sc_bus.bus_mtx, hz / 1000);
|
||||
}
|
||||
|
||||
if (hcr != 0) {
|
||||
@ -557,7 +557,7 @@ ehci_suspend(ehci_softc_t *sc)
|
||||
if (hcr == EHCI_STS_HCH) {
|
||||
break;
|
||||
}
|
||||
usb2_pause_mtx(&sc->sc_bus.bus_mtx, hz / 1000);
|
||||
usb_pause_mtx(&sc->sc_bus.bus_mtx, hz / 1000);
|
||||
}
|
||||
|
||||
if (hcr != EHCI_STS_HCH) {
|
||||
@ -580,10 +580,10 @@ ehci_resume(ehci_softc_t *sc)
|
||||
/* restore things in case the bios doesn't */
|
||||
EOWRITE4(sc, EHCI_CTRLDSSEGMENT, 0);
|
||||
|
||||
usb2_get_page(&sc->sc_hw.pframes_pc, 0, &buf_res);
|
||||
usbd_get_page(&sc->sc_hw.pframes_pc, 0, &buf_res);
|
||||
EOWRITE4(sc, EHCI_PERIODICLISTBASE, buf_res.physaddr);
|
||||
|
||||
usb2_get_page(&sc->sc_hw.async_start_pc, 0, &buf_res);
|
||||
usbd_get_page(&sc->sc_hw.async_start_pc, 0, &buf_res);
|
||||
EOWRITE4(sc, EHCI_ASYNCLISTADDR, buf_res.physaddr | EHCI_LINK_QH);
|
||||
|
||||
EOWRITE4(sc, EHCI_USBINTR, sc->sc_eintrs);
|
||||
@ -600,7 +600,7 @@ ehci_resume(ehci_softc_t *sc)
|
||||
}
|
||||
|
||||
if (hcr) {
|
||||
usb2_pause_mtx(&sc->sc_bus.bus_mtx,
|
||||
usb_pause_mtx(&sc->sc_bus.bus_mtx,
|
||||
USB_MS_TO_TICKS(USB_RESUME_WAIT));
|
||||
|
||||
for (i = 1; i <= sc->sc_noport; i++) {
|
||||
@ -619,7 +619,7 @@ ehci_resume(ehci_softc_t *sc)
|
||||
if (hcr != EHCI_STS_HCH) {
|
||||
break;
|
||||
}
|
||||
usb2_pause_mtx(&sc->sc_bus.bus_mtx, hz / 1000);
|
||||
usb_pause_mtx(&sc->sc_bus.bus_mtx, hz / 1000);
|
||||
}
|
||||
if (hcr == EHCI_STS_HCH) {
|
||||
device_printf(sc->sc_bus.bdev, "config timeout\n");
|
||||
@ -627,7 +627,7 @@ ehci_resume(ehci_softc_t *sc)
|
||||
|
||||
USB_BUS_UNLOCK(&sc->sc_bus);
|
||||
|
||||
usb2_pause_mtx(NULL,
|
||||
usb_pause_mtx(NULL,
|
||||
USB_MS_TO_TICKS(USB_RESUME_WAIT));
|
||||
|
||||
/* catch any lost interrupts */
|
||||
@ -793,7 +793,7 @@ ehci_dump_sqtd(ehci_softc_t *sc, ehci_qtd_t *sqtd)
|
||||
{
|
||||
uint8_t temp;
|
||||
|
||||
usb2_pc_cpu_invalidate(sqtd->page_cache);
|
||||
usb_pc_cpu_invalidate(sqtd->page_cache);
|
||||
printf("QTD(%p) at 0x%08x:\n", sqtd, hc32toh(sc, sqtd->qtd_self));
|
||||
ehci_dump_qtd(sc, sqtd);
|
||||
temp = (sqtd->qtd_next & htohc32(sc, EHCI_LINK_TERMINATE)) ? 1 : 0;
|
||||
@ -821,7 +821,7 @@ ehci_dump_sqh(ehci_softc_t *sc, ehci_qh_t *qh)
|
||||
uint32_t endp;
|
||||
uint32_t endphub;
|
||||
|
||||
usb2_pc_cpu_invalidate(qh->page_cache);
|
||||
usb_pc_cpu_invalidate(qh->page_cache);
|
||||
printf("QH(%p) at 0x%08x:\n", qh, hc32toh(sc, qh->qh_self) & ~0x1F);
|
||||
printf(" link=");
|
||||
ehci_dump_link(sc, qh->qh_link, 1);
|
||||
@ -851,7 +851,7 @@ ehci_dump_sqh(ehci_softc_t *sc, ehci_qh_t *qh)
|
||||
static void
|
||||
ehci_dump_sitd(ehci_softc_t *sc, ehci_sitd_t *sitd)
|
||||
{
|
||||
usb2_pc_cpu_invalidate(sitd->page_cache);
|
||||
usb_pc_cpu_invalidate(sitd->page_cache);
|
||||
printf("SITD(%p) at 0x%08x\n", sitd, hc32toh(sc, sitd->sitd_self) & ~0x1F);
|
||||
printf(" next=0x%08x\n", hc32toh(sc, sitd->sitd_next));
|
||||
printf(" portaddr=0x%08x dir=%s addr=%d endpt=0x%x port=0x%x huba=0x%x\n",
|
||||
@ -877,7 +877,7 @@ ehci_dump_sitd(ehci_softc_t *sc, ehci_sitd_t *sitd)
|
||||
static void
|
||||
ehci_dump_itd(ehci_softc_t *sc, ehci_itd_t *itd)
|
||||
{
|
||||
usb2_pc_cpu_invalidate(itd->page_cache);
|
||||
usb_pc_cpu_invalidate(itd->page_cache);
|
||||
printf("ITD(%p) at 0x%08x\n", itd, hc32toh(sc, itd->itd_self) & ~0x1F);
|
||||
printf(" next=0x%08x\n", hc32toh(sc, itd->itd_next));
|
||||
printf(" status[0]=0x%08x; <%s>\n", hc32toh(sc, itd->itd_status[0]),
|
||||
@ -959,11 +959,11 @@ ehci_transfer_intr_enqueue(struct usb_xfer *xfer)
|
||||
return;
|
||||
}
|
||||
/* put transfer on interrupt queue */
|
||||
usb2_transfer_enqueue(&xfer->xroot->bus->intr_q, xfer);
|
||||
usbd_transfer_enqueue(&xfer->xroot->bus->intr_q, xfer);
|
||||
|
||||
/* start timeout, if any */
|
||||
if (xfer->timeout != 0) {
|
||||
usb2_transfer_timeout_ms(xfer, &ehci_timeout, xfer->timeout);
|
||||
usbd_transfer_timeout_ms(xfer, &ehci_timeout, xfer->timeout);
|
||||
}
|
||||
}
|
||||
|
||||
@ -980,7 +980,7 @@ _ehci_append_fs_td(ehci_sitd_t *std, ehci_sitd_t *last)
|
||||
|
||||
std->prev = last;
|
||||
|
||||
usb2_pc_cpu_flush(std->page_cache);
|
||||
usb_pc_cpu_flush(std->page_cache);
|
||||
|
||||
/*
|
||||
* the last->next->prev is never followed: std->next->prev = std;
|
||||
@ -988,7 +988,7 @@ _ehci_append_fs_td(ehci_sitd_t *std, ehci_sitd_t *last)
|
||||
last->next = std;
|
||||
last->sitd_next = std->sitd_self;
|
||||
|
||||
usb2_pc_cpu_flush(last->page_cache);
|
||||
usb_pc_cpu_flush(last->page_cache);
|
||||
|
||||
return (std);
|
||||
}
|
||||
@ -1006,7 +1006,7 @@ _ehci_append_hs_td(ehci_itd_t *std, ehci_itd_t *last)
|
||||
|
||||
std->prev = last;
|
||||
|
||||
usb2_pc_cpu_flush(std->page_cache);
|
||||
usb_pc_cpu_flush(std->page_cache);
|
||||
|
||||
/*
|
||||
* the last->next->prev is never followed: std->next->prev = std;
|
||||
@ -1014,7 +1014,7 @@ _ehci_append_hs_td(ehci_itd_t *std, ehci_itd_t *last)
|
||||
last->next = std;
|
||||
last->itd_next = std->itd_self;
|
||||
|
||||
usb2_pc_cpu_flush(last->page_cache);
|
||||
usb_pc_cpu_flush(last->page_cache);
|
||||
|
||||
return (std);
|
||||
}
|
||||
@ -1037,7 +1037,7 @@ _ehci_append_qh(ehci_qh_t *sqh, ehci_qh_t *last)
|
||||
|
||||
sqh->prev = last;
|
||||
|
||||
usb2_pc_cpu_flush(sqh->page_cache);
|
||||
usb_pc_cpu_flush(sqh->page_cache);
|
||||
|
||||
/*
|
||||
* the last->next->prev is never followed: sqh->next->prev = sqh;
|
||||
@ -1046,7 +1046,7 @@ _ehci_append_qh(ehci_qh_t *sqh, ehci_qh_t *last)
|
||||
last->next = sqh;
|
||||
last->qh_link = sqh->qh_self;
|
||||
|
||||
usb2_pc_cpu_flush(last->page_cache);
|
||||
usb_pc_cpu_flush(last->page_cache);
|
||||
|
||||
return (sqh);
|
||||
}
|
||||
@ -1062,11 +1062,11 @@ _ehci_remove_fs_td(ehci_sitd_t *std, ehci_sitd_t *last)
|
||||
std->prev->next = std->next;
|
||||
std->prev->sitd_next = std->sitd_next;
|
||||
|
||||
usb2_pc_cpu_flush(std->prev->page_cache);
|
||||
usb_pc_cpu_flush(std->prev->page_cache);
|
||||
|
||||
if (std->next) {
|
||||
std->next->prev = std->prev;
|
||||
usb2_pc_cpu_flush(std->next->page_cache);
|
||||
usb_pc_cpu_flush(std->next->page_cache);
|
||||
}
|
||||
return ((last == std) ? std->prev : last);
|
||||
}
|
||||
@ -1082,11 +1082,11 @@ _ehci_remove_hs_td(ehci_itd_t *std, ehci_itd_t *last)
|
||||
std->prev->next = std->next;
|
||||
std->prev->itd_next = std->itd_next;
|
||||
|
||||
usb2_pc_cpu_flush(std->prev->page_cache);
|
||||
usb_pc_cpu_flush(std->prev->page_cache);
|
||||
|
||||
if (std->next) {
|
||||
std->next->prev = std->prev;
|
||||
usb2_pc_cpu_flush(std->next->page_cache);
|
||||
usb_pc_cpu_flush(std->next->page_cache);
|
||||
}
|
||||
return ((last == std) ? std->prev : last);
|
||||
}
|
||||
@ -1105,17 +1105,17 @@ _ehci_remove_qh(ehci_qh_t *sqh, ehci_qh_t *last)
|
||||
sqh->prev->next = sqh->next;
|
||||
sqh->prev->qh_link = sqh->qh_link;
|
||||
|
||||
usb2_pc_cpu_flush(sqh->prev->page_cache);
|
||||
usb_pc_cpu_flush(sqh->prev->page_cache);
|
||||
|
||||
if (sqh->next) {
|
||||
sqh->next->prev = sqh->prev;
|
||||
usb2_pc_cpu_flush(sqh->next->page_cache);
|
||||
usb_pc_cpu_flush(sqh->next->page_cache);
|
||||
}
|
||||
last = ((last == sqh) ? sqh->prev : last);
|
||||
|
||||
sqh->prev = 0;
|
||||
|
||||
usb2_pc_cpu_flush(sqh->page_cache);
|
||||
usb_pc_cpu_flush(sqh->page_cache);
|
||||
}
|
||||
return (last);
|
||||
}
|
||||
@ -1137,7 +1137,7 @@ ehci_non_isoc_done_sub(struct usb_xfer *xfer)
|
||||
}
|
||||
while (1) {
|
||||
|
||||
usb2_pc_cpu_invalidate(td->page_cache);
|
||||
usb_pc_cpu_invalidate(td->page_cache);
|
||||
status = hc32toh(sc, td->qtd_status);
|
||||
|
||||
len = EHCI_QTD_GET_BYTES(status);
|
||||
@ -1287,13 +1287,13 @@ ehci_check_transfer(struct usb_xfer *xfer)
|
||||
/* isochronous full speed transfer */
|
||||
|
||||
td = xfer->td_transfer_last;
|
||||
usb2_pc_cpu_invalidate(td->page_cache);
|
||||
usb_pc_cpu_invalidate(td->page_cache);
|
||||
status = hc32toh(sc, td->sitd_status);
|
||||
|
||||
/* also check if first is complete */
|
||||
|
||||
td = xfer->td_transfer_first;
|
||||
usb2_pc_cpu_invalidate(td->page_cache);
|
||||
usb_pc_cpu_invalidate(td->page_cache);
|
||||
status |= hc32toh(sc, td->sitd_status);
|
||||
|
||||
if (!(status & EHCI_SITD_ACTIVE)) {
|
||||
@ -1306,7 +1306,7 @@ ehci_check_transfer(struct usb_xfer *xfer)
|
||||
/* isochronous high speed transfer */
|
||||
|
||||
td = xfer->td_transfer_last;
|
||||
usb2_pc_cpu_invalidate(td->page_cache);
|
||||
usb_pc_cpu_invalidate(td->page_cache);
|
||||
status =
|
||||
td->itd_status[0] | td->itd_status[1] |
|
||||
td->itd_status[2] | td->itd_status[3] |
|
||||
@ -1315,7 +1315,7 @@ ehci_check_transfer(struct usb_xfer *xfer)
|
||||
|
||||
/* also check first transfer */
|
||||
td = xfer->td_transfer_first;
|
||||
usb2_pc_cpu_invalidate(td->page_cache);
|
||||
usb_pc_cpu_invalidate(td->page_cache);
|
||||
status |=
|
||||
td->itd_status[0] | td->itd_status[1] |
|
||||
td->itd_status[2] | td->itd_status[3] |
|
||||
@ -1339,7 +1339,7 @@ ehci_check_transfer(struct usb_xfer *xfer)
|
||||
td = xfer->td_transfer_cache;
|
||||
|
||||
while (1) {
|
||||
usb2_pc_cpu_invalidate(td->page_cache);
|
||||
usb_pc_cpu_invalidate(td->page_cache);
|
||||
status = hc32toh(sc, td->qtd_status);
|
||||
|
||||
/*
|
||||
@ -1475,7 +1475,7 @@ ehci_interrupt(ehci_softc_t *sc)
|
||||
ehci_root_intr(sc);
|
||||
|
||||
/* do not allow RHSC interrupts > 1 per second */
|
||||
usb2_callout_reset(&sc->sc_tmo_pcd, hz,
|
||||
usb_callout_reset(&sc->sc_tmo_pcd, hz,
|
||||
(void *)&ehci_pcd_enable, sc);
|
||||
}
|
||||
status &= ~(EHCI_STS_INT | EHCI_STS_ERRINT | EHCI_STS_PCD | EHCI_STS_IAA);
|
||||
@ -1634,7 +1634,7 @@ ehci_setup_standard_chain_sub(struct ehci_std_temp *temp)
|
||||
|
||||
/* fill out buffer pointers */
|
||||
|
||||
usb2_get_page(temp->pc, buf_offset, &buf_res);
|
||||
usbd_get_page(temp->pc, buf_offset, &buf_res);
|
||||
td->qtd_buffer[0] =
|
||||
htohc32(temp->sc, buf_res.physaddr);
|
||||
td->qtd_buffer_hi[0] = 0;
|
||||
@ -1644,7 +1644,7 @@ ehci_setup_standard_chain_sub(struct ehci_std_temp *temp)
|
||||
while (average > EHCI_PAGE_SIZE) {
|
||||
average -= EHCI_PAGE_SIZE;
|
||||
buf_offset += EHCI_PAGE_SIZE;
|
||||
usb2_get_page(temp->pc, buf_offset, &buf_res);
|
||||
usbd_get_page(temp->pc, buf_offset, &buf_res);
|
||||
td->qtd_buffer[x] =
|
||||
htohc32(temp->sc,
|
||||
buf_res.physaddr & (~0xFFF));
|
||||
@ -1661,7 +1661,7 @@ ehci_setup_standard_chain_sub(struct ehci_std_temp *temp)
|
||||
* of a valid page !
|
||||
*/
|
||||
buf_offset += average;
|
||||
usb2_get_page(temp->pc, buf_offset - 1, &buf_res);
|
||||
usbd_get_page(temp->pc, buf_offset - 1, &buf_res);
|
||||
td->qtd_buffer[x] =
|
||||
htohc32(temp->sc,
|
||||
buf_res.physaddr & (~0xFFF));
|
||||
@ -1675,7 +1675,7 @@ ehci_setup_standard_chain_sub(struct ehci_std_temp *temp)
|
||||
td->qtd_altnext = qtd_altnext;
|
||||
td->alt_next = td_alt_next;
|
||||
|
||||
usb2_pc_cpu_flush(td->page_cache);
|
||||
usb_pc_cpu_flush(td->page_cache);
|
||||
}
|
||||
|
||||
if (precompute) {
|
||||
@ -1717,7 +1717,7 @@ ehci_setup_standard_chain(struct usb_xfer *xfer, ehci_qh_t **qh_last)
|
||||
|
||||
DPRINTFN(9, "addr=%d endpt=%d sumlen=%d speed=%d\n",
|
||||
xfer->address, UE_GET_ADDR(xfer->endpointno),
|
||||
xfer->sumlen, usb2_get_speed(xfer->xroot->udev));
|
||||
xfer->sumlen, usbd_get_speed(xfer->xroot->udev));
|
||||
|
||||
temp.average = xfer->max_hc_frame_size;
|
||||
temp.max_frame_size = xfer->max_frame_size;
|
||||
@ -1749,7 +1749,7 @@ ehci_setup_standard_chain(struct usb_xfer *xfer, ehci_qh_t **qh_last)
|
||||
temp.auto_data_toggle = 1;
|
||||
}
|
||||
|
||||
if (usb2_get_speed(xfer->xroot->udev) != USB_SPEED_HIGH) {
|
||||
if (usbd_get_speed(xfer->xroot->udev) != USB_SPEED_HIGH) {
|
||||
/* max 3 retries */
|
||||
temp.qtd_status |=
|
||||
htohc32(temp.sc, EHCI_QTD_SET_CERR(3));
|
||||
@ -1872,7 +1872,7 @@ ehci_setup_standard_chain(struct usb_xfer *xfer, ehci_qh_t **qh_last)
|
||||
td->qtd_altnext = htohc32(temp.sc, EHCI_LINK_TERMINATE);
|
||||
td->qtd_status |= htohc32(temp.sc, EHCI_QTD_IOC);
|
||||
|
||||
usb2_pc_cpu_flush(td->page_cache);
|
||||
usb_pc_cpu_flush(td->page_cache);
|
||||
|
||||
/* must have at least one frame! */
|
||||
|
||||
@ -1898,14 +1898,14 @@ ehci_setup_standard_chain(struct usb_xfer *xfer, ehci_qh_t **qh_last)
|
||||
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) {
|
||||
if (usbd_get_speed(xfer->xroot->udev) == USB_SPEED_HIGH) {
|
||||
qh_endp |= (EHCI_QH_SET_EPS(EHCI_QH_SPEED_HIGH) |
|
||||
EHCI_QH_DTC);
|
||||
if (methods != &ehci_device_intr_methods)
|
||||
qh_endp |= EHCI_QH_SET_NRL(8);
|
||||
} else {
|
||||
|
||||
if (usb2_get_speed(xfer->xroot->udev) == USB_SPEED_FULL) {
|
||||
if (usbd_get_speed(xfer->xroot->udev) == USB_SPEED_FULL) {
|
||||
qh_endp |= (EHCI_QH_SET_EPS(EHCI_QH_SPEED_FULL) |
|
||||
EHCI_QH_DTC);
|
||||
} else {
|
||||
@ -1926,8 +1926,8 @@ ehci_setup_standard_chain(struct usb_xfer *xfer, ehci_qh_t **qh_last)
|
||||
|
||||
qh_endphub =
|
||||
(EHCI_QH_SET_MULT(xfer->max_packet_count & 3) |
|
||||
EHCI_QH_SET_CMASK(xfer->usb2_cmask) |
|
||||
EHCI_QH_SET_SMASK(xfer->usb2_smask) |
|
||||
EHCI_QH_SET_CMASK(xfer->usb_cmask) |
|
||||
EHCI_QH_SET_SMASK(xfer->usb_smask) |
|
||||
EHCI_QH_SET_HUBA(xfer->xroot->udev->hs_hub_addr) |
|
||||
EHCI_QH_SET_PORT(xfer->xroot->udev->hs_port_no));
|
||||
|
||||
@ -1955,7 +1955,7 @@ ehci_setup_standard_chain(struct usb_xfer *xfer, ehci_qh_t **qh_last)
|
||||
qh->qh_qtd.qtd_altnext =
|
||||
htohc32(temp.sc, EHCI_LINK_TERMINATE);
|
||||
|
||||
usb2_pc_cpu_flush(qh->page_cache);
|
||||
usb_pc_cpu_flush(qh->page_cache);
|
||||
|
||||
if (xfer->xroot->udev->flags.self_suspended == 0) {
|
||||
EHCI_APPEND_QH(qh, *qh_last);
|
||||
@ -2016,7 +2016,7 @@ ehci_isoc_fs_done(ehci_softc_t *sc, struct usb_xfer *xfer)
|
||||
ehci_dump_sitd(sc, td);
|
||||
}
|
||||
#endif
|
||||
usb2_pc_cpu_invalidate(td->page_cache);
|
||||
usb_pc_cpu_invalidate(td->page_cache);
|
||||
status = hc32toh(sc, td->sitd_status);
|
||||
|
||||
len = EHCI_SITD_GET_LEN(status);
|
||||
@ -2071,7 +2071,7 @@ ehci_isoc_hs_done(ehci_softc_t *sc, struct usb_xfer *xfer)
|
||||
}
|
||||
#endif
|
||||
|
||||
usb2_pc_cpu_invalidate(td->page_cache);
|
||||
usb_pc_cpu_invalidate(td->page_cache);
|
||||
status = hc32toh(sc, td->itd_status[td_no]);
|
||||
|
||||
len = EHCI_ITD_GET_LEN(status);
|
||||
@ -2155,7 +2155,7 @@ ehci_device_done(struct usb_xfer *xfer, usb_error_t error)
|
||||
xfer->td_transfer_last = NULL;
|
||||
}
|
||||
/* dequeue transfer and start next transfer */
|
||||
usb2_transfer_done(xfer, error);
|
||||
usbd_transfer_done(xfer, error);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
@ -2263,17 +2263,17 @@ ehci_device_intr_open(struct usb_xfer *xfer)
|
||||
|
||||
/* Allocate a microframe slot first: */
|
||||
|
||||
slot = usb2_intr_schedule_adjust
|
||||
slot = usb_intr_schedule_adjust
|
||||
(xfer->xroot->udev, xfer->max_frame_size, USB_HS_MICRO_FRAMES_MAX);
|
||||
|
||||
if (usb2_get_speed(xfer->xroot->udev) == USB_SPEED_HIGH) {
|
||||
xfer->usb2_uframe = slot;
|
||||
xfer->usb2_smask = (1 << slot) & 0xFF;
|
||||
xfer->usb2_cmask = 0;
|
||||
if (usbd_get_speed(xfer->xroot->udev) == USB_SPEED_HIGH) {
|
||||
xfer->usb_uframe = slot;
|
||||
xfer->usb_smask = (1 << slot) & 0xFF;
|
||||
xfer->usb_cmask = 0;
|
||||
} else {
|
||||
xfer->usb2_uframe = slot;
|
||||
xfer->usb2_smask = (1 << slot) & 0x3F;
|
||||
xfer->usb2_cmask = (-(4 << slot)) & 0xFE;
|
||||
xfer->usb_uframe = slot;
|
||||
xfer->usb_smask = (1 << slot) & 0x3F;
|
||||
xfer->usb_cmask = (-(4 << slot)) & 0xFE;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2311,8 +2311,8 @@ ehci_device_intr_close(struct usb_xfer *xfer)
|
||||
ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus);
|
||||
uint8_t slot;
|
||||
|
||||
slot = usb2_intr_schedule_adjust
|
||||
(xfer->xroot->udev, -(xfer->max_frame_size), xfer->usb2_uframe);
|
||||
slot = usb_intr_schedule_adjust
|
||||
(xfer->xroot->udev, -(xfer->max_frame_size), xfer->usb_uframe);
|
||||
|
||||
sc->sc_intr_stat[xfer->qh_pos]--;
|
||||
|
||||
@ -2384,7 +2384,7 @@ ehci_device_isoc_fs_open(struct usb_xfer *xfer)
|
||||
*/
|
||||
td->sitd_back = htohc32(sc, EHCI_LINK_TERMINATE);
|
||||
|
||||
usb2_pc_cpu_flush(td->page_cache);
|
||||
usb_pc_cpu_flush(td->page_cache);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2459,7 +2459,7 @@ ehci_device_isoc_fs_enter(struct usb_xfer *xfer)
|
||||
* pre-compute when the isochronous transfer will be finished:
|
||||
*/
|
||||
xfer->isoc_time_complete =
|
||||
usb2_fs_isoc_schedule_isoc_time_expand
|
||||
usbd_fs_isoc_schedule_isoc_time_expand
|
||||
(xfer->xroot->udev, &fss_start, &fss_end, nframes) + buf_offset +
|
||||
xfer->nframes;
|
||||
|
||||
@ -2515,7 +2515,7 @@ ehci_device_isoc_fs_enter(struct usb_xfer *xfer)
|
||||
* We currently don't care if the ISOCHRONOUS schedule is
|
||||
* full!
|
||||
*/
|
||||
error = usb2_fs_isoc_schedule_alloc(fss, &sa, *plen);
|
||||
error = usbd_fs_isoc_schedule_alloc(fss, &sa, *plen);
|
||||
if (error) {
|
||||
/*
|
||||
* The FULL speed schedule is FULL! Set length
|
||||
@ -2525,17 +2525,17 @@ ehci_device_isoc_fs_enter(struct usb_xfer *xfer)
|
||||
}
|
||||
if (*plen) {
|
||||
/*
|
||||
* only call "usb2_get_page()" when we have a
|
||||
* only call "usbd_get_page()" when we have a
|
||||
* non-zero length
|
||||
*/
|
||||
usb2_get_page(xfer->frbuffers, buf_offset, &buf_res);
|
||||
usbd_get_page(xfer->frbuffers, buf_offset, &buf_res);
|
||||
td->sitd_bp[0] = htohc32(sc, buf_res.physaddr);
|
||||
buf_offset += *plen;
|
||||
/*
|
||||
* NOTE: We need to subtract one from the offset so
|
||||
* that we are on a valid page!
|
||||
*/
|
||||
usb2_get_page(xfer->frbuffers, buf_offset - 1,
|
||||
usbd_get_page(xfer->frbuffers, buf_offset - 1,
|
||||
&buf_res);
|
||||
temp = buf_res.physaddr & ~0xFFF;
|
||||
} else {
|
||||
@ -2588,7 +2588,7 @@ ehci_device_isoc_fs_enter(struct usb_xfer *xfer)
|
||||
EHCI_SITD_ACTIVE |
|
||||
EHCI_SITD_SET_LEN(*plen));
|
||||
}
|
||||
usb2_pc_cpu_flush(td->page_cache);
|
||||
usb_pc_cpu_flush(td->page_cache);
|
||||
|
||||
#if USB_DEBUG
|
||||
if (ehcidebug > 15) {
|
||||
@ -2673,7 +2673,7 @@ ehci_device_isoc_hs_open(struct usb_xfer *xfer)
|
||||
/* set transfer multiplier */
|
||||
td->itd_bp[2] = htohc32(sc, xfer->max_packet_count & 3);
|
||||
|
||||
usb2_pc_cpu_flush(td->page_cache);
|
||||
usb_pc_cpu_flush(td->page_cache);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2745,7 +2745,7 @@ ehci_device_isoc_hs_enter(struct usb_xfer *xfer)
|
||||
* pre-compute when the isochronous transfer will be finished:
|
||||
*/
|
||||
xfer->isoc_time_complete =
|
||||
usb2_isoc_time_expand(&sc->sc_bus, nframes) + buf_offset +
|
||||
usb_isoc_time_expand(&sc->sc_bus, nframes) + buf_offset +
|
||||
((xfer->nframes + 7) / 8);
|
||||
|
||||
/* get the real number of frames */
|
||||
@ -2812,7 +2812,7 @@ ehci_device_isoc_hs_enter(struct usb_xfer *xfer)
|
||||
itd_offset[td_no] = buf_offset;
|
||||
|
||||
/* get first page offset */
|
||||
usb2_get_page(xfer->frbuffers, itd_offset[0], &buf_res);
|
||||
usbd_get_page(xfer->frbuffers, itd_offset[0], &buf_res);
|
||||
/* get page address */
|
||||
page_addr = buf_res.physaddr & ~0xFFF;
|
||||
/* update page address */
|
||||
@ -2832,9 +2832,9 @@ ehci_device_isoc_hs_enter(struct usb_xfer *xfer)
|
||||
* we don't go off the last
|
||||
* page!
|
||||
*/
|
||||
usb2_get_page(xfer->frbuffers, buf_offset - 1, &buf_res);
|
||||
usbd_get_page(xfer->frbuffers, buf_offset - 1, &buf_res);
|
||||
} else {
|
||||
usb2_get_page(xfer->frbuffers, itd_offset[x + 1], &buf_res);
|
||||
usbd_get_page(xfer->frbuffers, itd_offset[x + 1], &buf_res);
|
||||
}
|
||||
|
||||
/* check if we need a new page */
|
||||
@ -2855,7 +2855,7 @@ ehci_device_isoc_hs_enter(struct usb_xfer *xfer)
|
||||
if (nframes == 0) {
|
||||
td->itd_status[7] |= htohc32(sc, EHCI_ITD_IOC);
|
||||
}
|
||||
usb2_pc_cpu_flush(td->page_cache);
|
||||
usb_pc_cpu_flush(td->page_cache);
|
||||
#if USB_DEBUG
|
||||
if (ehcidebug > 15) {
|
||||
DPRINTF("HS-TD %d\n", nframes);
|
||||
@ -3081,7 +3081,7 @@ ehci_roothub_exec(struct usb_device *udev,
|
||||
break;
|
||||
}
|
||||
|
||||
len = usb2_make_str_desc(
|
||||
len = usb_make_str_desc(
|
||||
sc->sc_hub_desc.temp,
|
||||
sizeof(sc->sc_hub_desc.temp),
|
||||
str_ptr);
|
||||
@ -3156,13 +3156,13 @@ ehci_roothub_exec(struct usb_device *udev,
|
||||
EOWRITE4(sc, port, v | EHCI_PS_FPR);
|
||||
}
|
||||
/* wait 20ms for resume sequence to complete */
|
||||
usb2_pause_mtx(&sc->sc_bus.bus_mtx, hz / 50);
|
||||
usb_pause_mtx(&sc->sc_bus.bus_mtx, hz / 50);
|
||||
|
||||
EOWRITE4(sc, port, v & ~(EHCI_PS_SUSP |
|
||||
EHCI_PS_FPR | (3 << 10) /* High Speed */ ));
|
||||
|
||||
/* 4ms settle time */
|
||||
usb2_pause_mtx(&sc->sc_bus.bus_mtx, hz / 250);
|
||||
usb_pause_mtx(&sc->sc_bus.bus_mtx, hz / 250);
|
||||
break;
|
||||
case UHF_PORT_POWER:
|
||||
EOWRITE4(sc, port, v & ~EHCI_PS_PP);
|
||||
@ -3313,7 +3313,7 @@ ehci_roothub_exec(struct usb_device *udev,
|
||||
EOWRITE4(sc, port, v | EHCI_PS_PR);
|
||||
|
||||
/* Wait for reset to complete. */
|
||||
usb2_pause_mtx(&sc->sc_bus.bus_mtx,
|
||||
usb_pause_mtx(&sc->sc_bus.bus_mtx,
|
||||
USB_MS_TO_TICKS(USB_PORT_ROOT_RESET_DELAY));
|
||||
|
||||
/* Terminate reset sequence. */
|
||||
@ -3321,7 +3321,7 @@ ehci_roothub_exec(struct usb_device *udev,
|
||||
EOWRITE4(sc, port, v);
|
||||
|
||||
/* Wait for HC to complete reset. */
|
||||
usb2_pause_mtx(&sc->sc_bus.bus_mtx,
|
||||
usb_pause_mtx(&sc->sc_bus.bus_mtx,
|
||||
USB_MS_TO_TICKS(EHCI_PORT_RESET_COMPLETE));
|
||||
|
||||
v = EOREAD4(sc, port);
|
||||
@ -3438,7 +3438,7 @@ ehci_xfer_setup(struct usb_setup_params *parm)
|
||||
parm->hc_max_frame_size = EHCI_QTD_PAYLOAD_MAX;
|
||||
xfer->flags_int.bdma_enable = 1;
|
||||
|
||||
usb2_transfer_setup_sub(parm);
|
||||
usbd_transfer_setup_sub(parm);
|
||||
|
||||
nqh = 1;
|
||||
nqtd = ((2 * xfer->nframes) + 1 /* STATUS */
|
||||
@ -3451,7 +3451,7 @@ ehci_xfer_setup(struct usb_setup_params *parm)
|
||||
parm->hc_max_frame_size = EHCI_QTD_PAYLOAD_MAX;
|
||||
xfer->flags_int.bdma_enable = 1;
|
||||
|
||||
usb2_transfer_setup_sub(parm);
|
||||
usbd_transfer_setup_sub(parm);
|
||||
|
||||
nqh = 1;
|
||||
nqtd = ((2 * xfer->nframes)
|
||||
@ -3473,7 +3473,7 @@ ehci_xfer_setup(struct usb_setup_params *parm)
|
||||
parm->hc_max_frame_size = EHCI_QTD_PAYLOAD_MAX;
|
||||
xfer->flags_int.bdma_enable = 1;
|
||||
|
||||
usb2_transfer_setup_sub(parm);
|
||||
usbd_transfer_setup_sub(parm);
|
||||
|
||||
nqh = 1;
|
||||
nqtd = ((2 * xfer->nframes)
|
||||
@ -3486,7 +3486,7 @@ ehci_xfer_setup(struct usb_setup_params *parm)
|
||||
parm->hc_max_frame_size = 0x3FF;
|
||||
xfer->flags_int.bdma_enable = 1;
|
||||
|
||||
usb2_transfer_setup_sub(parm);
|
||||
usbd_transfer_setup_sub(parm);
|
||||
|
||||
nsitd = xfer->nframes;
|
||||
|
||||
@ -3497,7 +3497,7 @@ ehci_xfer_setup(struct usb_setup_params *parm)
|
||||
parm->hc_max_frame_size = 0xC00;
|
||||
xfer->flags_int.bdma_enable = 1;
|
||||
|
||||
usb2_transfer_setup_sub(parm);
|
||||
usbd_transfer_setup_sub(parm);
|
||||
|
||||
nitd = (xfer->nframes + 7) / 8;
|
||||
|
||||
@ -3507,7 +3507,7 @@ ehci_xfer_setup(struct usb_setup_params *parm)
|
||||
parm->hc_max_packet_count = 1;
|
||||
parm->hc_max_frame_size = 0x400;
|
||||
|
||||
usb2_transfer_setup_sub(parm);
|
||||
usbd_transfer_setup_sub(parm);
|
||||
}
|
||||
|
||||
alloc_dma_set:
|
||||
@ -3520,7 +3520,7 @@ ehci_xfer_setup(struct usb_setup_params *parm)
|
||||
*/
|
||||
last_obj = NULL;
|
||||
|
||||
if (usb2_transfer_setup_sub_malloc(
|
||||
if (usbd_transfer_setup_sub_malloc(
|
||||
parm, &pc, sizeof(ehci_itd_t),
|
||||
EHCI_ITD_ALIGN, nitd)) {
|
||||
parm->err = USB_ERR_NOMEM;
|
||||
@ -3530,7 +3530,7 @@ ehci_xfer_setup(struct usb_setup_params *parm)
|
||||
for (n = 0; n != nitd; n++) {
|
||||
ehci_itd_t *td;
|
||||
|
||||
usb2_get_page(pc + n, 0, &page_info);
|
||||
usbd_get_page(pc + n, 0, &page_info);
|
||||
|
||||
td = page_info.buffer;
|
||||
|
||||
@ -3541,10 +3541,10 @@ ehci_xfer_setup(struct usb_setup_params *parm)
|
||||
|
||||
last_obj = td;
|
||||
|
||||
usb2_pc_cpu_flush(pc + n);
|
||||
usb_pc_cpu_flush(pc + n);
|
||||
}
|
||||
}
|
||||
if (usb2_transfer_setup_sub_malloc(
|
||||
if (usbd_transfer_setup_sub_malloc(
|
||||
parm, &pc, sizeof(ehci_sitd_t),
|
||||
EHCI_SITD_ALIGN, nsitd)) {
|
||||
parm->err = USB_ERR_NOMEM;
|
||||
@ -3554,7 +3554,7 @@ ehci_xfer_setup(struct usb_setup_params *parm)
|
||||
for (n = 0; n != nsitd; n++) {
|
||||
ehci_sitd_t *td;
|
||||
|
||||
usb2_get_page(pc + n, 0, &page_info);
|
||||
usbd_get_page(pc + n, 0, &page_info);
|
||||
|
||||
td = page_info.buffer;
|
||||
|
||||
@ -3565,10 +3565,10 @@ ehci_xfer_setup(struct usb_setup_params *parm)
|
||||
|
||||
last_obj = td;
|
||||
|
||||
usb2_pc_cpu_flush(pc + n);
|
||||
usb_pc_cpu_flush(pc + n);
|
||||
}
|
||||
}
|
||||
if (usb2_transfer_setup_sub_malloc(
|
||||
if (usbd_transfer_setup_sub_malloc(
|
||||
parm, &pc, sizeof(ehci_qtd_t),
|
||||
EHCI_QTD_ALIGN, nqtd)) {
|
||||
parm->err = USB_ERR_NOMEM;
|
||||
@ -3578,7 +3578,7 @@ ehci_xfer_setup(struct usb_setup_params *parm)
|
||||
for (n = 0; n != nqtd; n++) {
|
||||
ehci_qtd_t *qtd;
|
||||
|
||||
usb2_get_page(pc + n, 0, &page_info);
|
||||
usbd_get_page(pc + n, 0, &page_info);
|
||||
|
||||
qtd = page_info.buffer;
|
||||
|
||||
@ -3589,14 +3589,14 @@ ehci_xfer_setup(struct usb_setup_params *parm)
|
||||
|
||||
last_obj = qtd;
|
||||
|
||||
usb2_pc_cpu_flush(pc + n);
|
||||
usb_pc_cpu_flush(pc + n);
|
||||
}
|
||||
}
|
||||
xfer->td_start[xfer->flags_int.curr_dma_set] = last_obj;
|
||||
|
||||
last_obj = NULL;
|
||||
|
||||
if (usb2_transfer_setup_sub_malloc(
|
||||
if (usbd_transfer_setup_sub_malloc(
|
||||
parm, &pc, sizeof(ehci_qh_t),
|
||||
EHCI_QH_ALIGN, nqh)) {
|
||||
parm->err = USB_ERR_NOMEM;
|
||||
@ -3606,7 +3606,7 @@ ehci_xfer_setup(struct usb_setup_params *parm)
|
||||
for (n = 0; n != nqh; n++) {
|
||||
ehci_qh_t *qh;
|
||||
|
||||
usb2_get_page(pc + n, 0, &page_info);
|
||||
usbd_get_page(pc + n, 0, &page_info);
|
||||
|
||||
qh = page_info.buffer;
|
||||
|
||||
@ -3617,7 +3617,7 @@ ehci_xfer_setup(struct usb_setup_params *parm)
|
||||
|
||||
last_obj = qh;
|
||||
|
||||
usb2_pc_cpu_flush(pc + n);
|
||||
usb_pc_cpu_flush(pc + n);
|
||||
}
|
||||
}
|
||||
xfer->qh_start[xfer->flags_int.curr_dma_set] = last_obj;
|
||||
|
@ -131,7 +131,7 @@ ehci_ixp_attach(device_t self)
|
||||
sc->sc_bus.devices_max = EHCI_MAX_DEVICES;
|
||||
|
||||
/* get all DMA memory */
|
||||
if (usb2_bus_mem_alloc_all(&sc->sc_bus,
|
||||
if (usb_bus_mem_alloc_all(&sc->sc_bus,
|
||||
USB_GET_DMA_TAG(self), &ehci_iterate_hw_softc)) {
|
||||
return (ENOMEM);
|
||||
}
|
||||
@ -273,7 +273,7 @@ ehci_ixp_detach(device_t self)
|
||||
sc->sc_io_res);
|
||||
sc->sc_io_res = NULL;
|
||||
}
|
||||
usb2_bus_mem_free_all(&sc->sc_bus, &ehci_iterate_hw_softc);
|
||||
usb_bus_mem_free_all(&sc->sc_bus, &ehci_iterate_hw_softc);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ ehci_mbus_attach(device_t self)
|
||||
sc->sc_bus.devices_max = EHCI_MAX_DEVICES;
|
||||
|
||||
/* get all DMA memory */
|
||||
if (usb2_bus_mem_alloc_all(&sc->sc_bus,
|
||||
if (usb_bus_mem_alloc_all(&sc->sc_bus,
|
||||
USB_GET_DMA_TAG(self), &ehci_iterate_hw_softc)) {
|
||||
return (ENOMEM);
|
||||
}
|
||||
@ -307,7 +307,7 @@ ehci_mbus_detach(device_t self)
|
||||
sc->sc_io_res);
|
||||
sc->sc_io_res = NULL;
|
||||
}
|
||||
usb2_bus_mem_free_all(&sc->sc_bus, &ehci_iterate_hw_softc);
|
||||
usb_bus_mem_free_all(&sc->sc_bus, &ehci_iterate_hw_softc);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ ehci_pci_attach(device_t self)
|
||||
sc->sc_bus.devices_max = EHCI_MAX_DEVICES;
|
||||
|
||||
/* get all DMA memory */
|
||||
if (usb2_bus_mem_alloc_all(&sc->sc_bus,
|
||||
if (usb_bus_mem_alloc_all(&sc->sc_bus,
|
||||
USB_GET_DMA_TAG(self), &ehci_iterate_hw_softc)) {
|
||||
return (ENOMEM);
|
||||
}
|
||||
@ -408,7 +408,7 @@ ehci_pci_detach(device_t self)
|
||||
sc->sc_io_res);
|
||||
sc->sc_io_res = NULL;
|
||||
}
|
||||
usb2_bus_mem_free_all(&sc->sc_bus, &ehci_iterate_hw_softc);
|
||||
usb_bus_mem_free_all(&sc->sc_bus, &ehci_iterate_hw_softc);
|
||||
|
||||
return (0);
|
||||
}
|
||||
@ -453,7 +453,7 @@ ehci_pci_takecontroller(device_t self)
|
||||
"timed out waiting for BIOS\n");
|
||||
break;
|
||||
}
|
||||
usb2_pause_mtx(NULL, hz / 100); /* wait 10ms */
|
||||
usb_pause_mtx(NULL, hz / 100); /* wait 10ms */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -209,7 +209,7 @@ musbotg_wakeup_peer(struct musbotg_softc *sc)
|
||||
|
||||
/* wait 8 milliseconds */
|
||||
/* Wait for reset to complete. */
|
||||
usb2_pause_mtx(&sc->sc_bus.bus_mtx, hz / 125);
|
||||
usb_pause_mtx(&sc->sc_bus.bus_mtx, hz / 125);
|
||||
|
||||
temp = MUSB2_READ_1(sc, MUSB2_REG_POWER);
|
||||
temp &= ~MUSB2_MASK_RESUME;
|
||||
@ -301,7 +301,7 @@ musbotg_setup_rx(struct musbotg_td *td)
|
||||
MUSB2_REG_EPFIFO(0), (void *)&req, sizeof(req));
|
||||
|
||||
/* copy data into real buffer */
|
||||
usb2_copy_in(td->pc, 0, &req, sizeof(req));
|
||||
usbd_copy_in(td->pc, 0, &req, sizeof(req));
|
||||
|
||||
td->offset = sizeof(req);
|
||||
td->remainder = 0;
|
||||
@ -404,7 +404,7 @@ musbotg_setup_data_rx(struct musbotg_td *td)
|
||||
while (count > 0) {
|
||||
uint32_t temp;
|
||||
|
||||
usb2_get_page(td->pc, td->offset, &buf_res);
|
||||
usbd_get_page(td->pc, td->offset, &buf_res);
|
||||
|
||||
/* get correct length */
|
||||
if (buf_res.length > count) {
|
||||
@ -428,7 +428,7 @@ musbotg_setup_data_rx(struct musbotg_td *td)
|
||||
MUSB2_REG_EPFIFO(0),
|
||||
(void *)(&sc->sc_bounce_buf[count / 4]), temp);
|
||||
}
|
||||
usb2_copy_in(td->pc, td->offset,
|
||||
usbd_copy_in(td->pc, td->offset,
|
||||
sc->sc_bounce_buf, count);
|
||||
|
||||
/* update offset and remainder */
|
||||
@ -522,7 +522,7 @@ musbotg_setup_data_tx(struct musbotg_td *td)
|
||||
while (count > 0) {
|
||||
uint32_t temp;
|
||||
|
||||
usb2_get_page(td->pc, td->offset, &buf_res);
|
||||
usbd_get_page(td->pc, td->offset, &buf_res);
|
||||
|
||||
/* get correct length */
|
||||
if (buf_res.length > count) {
|
||||
@ -531,7 +531,7 @@ musbotg_setup_data_tx(struct musbotg_td *td)
|
||||
/* check for unaligned memory address */
|
||||
if (USB_P2U(buf_res.buffer) & 3) {
|
||||
|
||||
usb2_copy_out(td->pc, td->offset,
|
||||
usbd_copy_out(td->pc, td->offset,
|
||||
sc->sc_bounce_buf, count);
|
||||
|
||||
temp = count & ~3;
|
||||
@ -692,7 +692,7 @@ musbotg_data_rx(struct musbotg_td *td)
|
||||
while (count > 0) {
|
||||
uint32_t temp;
|
||||
|
||||
usb2_get_page(td->pc, td->offset, &buf_res);
|
||||
usbd_get_page(td->pc, td->offset, &buf_res);
|
||||
|
||||
/* get correct length */
|
||||
if (buf_res.length > count) {
|
||||
@ -716,7 +716,7 @@ musbotg_data_rx(struct musbotg_td *td)
|
||||
sc->sc_io_hdl, MUSB2_REG_EPFIFO(td->ep_no),
|
||||
((void *)&sc->sc_bounce_buf[count / 4]), temp);
|
||||
}
|
||||
usb2_copy_in(td->pc, td->offset,
|
||||
usbd_copy_in(td->pc, td->offset,
|
||||
sc->sc_bounce_buf, count);
|
||||
|
||||
/* update offset and remainder */
|
||||
@ -810,7 +810,7 @@ musbotg_data_tx(struct musbotg_td *td)
|
||||
while (count > 0) {
|
||||
uint32_t temp;
|
||||
|
||||
usb2_get_page(td->pc, td->offset, &buf_res);
|
||||
usbd_get_page(td->pc, td->offset, &buf_res);
|
||||
|
||||
/* get correct length */
|
||||
if (buf_res.length > count) {
|
||||
@ -819,7 +819,7 @@ musbotg_data_tx(struct musbotg_td *td)
|
||||
/* check for unaligned memory address */
|
||||
if (USB_P2U(buf_res.buffer) & 3) {
|
||||
|
||||
usb2_copy_out(td->pc, td->offset,
|
||||
usbd_copy_out(td->pc, td->offset,
|
||||
sc->sc_bounce_buf, count);
|
||||
|
||||
temp = count & ~3;
|
||||
@ -1115,7 +1115,7 @@ musbotg_setup_standard_chain(struct usb_xfer *xfer)
|
||||
|
||||
DPRINTFN(8, "addr=%d endpt=%d sumlen=%d speed=%d\n",
|
||||
xfer->address, UE_GET_ADDR(xfer->endpointno),
|
||||
xfer->sumlen, usb2_get_speed(xfer->xroot->udev));
|
||||
xfer->sumlen, usbd_get_speed(xfer->xroot->udev));
|
||||
|
||||
temp.max_frame_size = xfer->max_frame_size;
|
||||
|
||||
@ -1297,11 +1297,11 @@ musbotg_start_standard_chain(struct usb_xfer *xfer)
|
||||
DPRINTFN(14, "enabled interrupts on endpoint\n");
|
||||
|
||||
/* put transfer on interrupt queue */
|
||||
usb2_transfer_enqueue(&xfer->xroot->bus->intr_q, xfer);
|
||||
usbd_transfer_enqueue(&xfer->xroot->bus->intr_q, xfer);
|
||||
|
||||
/* start timeout, if any */
|
||||
if (xfer->timeout != 0) {
|
||||
usb2_transfer_timeout_ms(xfer,
|
||||
usbd_transfer_timeout_ms(xfer,
|
||||
&musbotg_timeout, xfer->timeout);
|
||||
}
|
||||
}
|
||||
@ -1449,7 +1449,7 @@ musbotg_device_done(struct usb_xfer *xfer, usb_error_t error)
|
||||
DPRINTFN(14, "disabled interrupts on endpoint\n");
|
||||
}
|
||||
/* dequeue transfer and start next transfer */
|
||||
usb2_transfer_done(xfer, error);
|
||||
usbd_transfer_done(xfer, error);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1689,7 +1689,7 @@ musbotg_init(struct musbotg_softc *sc)
|
||||
(sc->sc_clocks_on) (sc->sc_clocks_arg);
|
||||
}
|
||||
/* wait a little for things to stabilise */
|
||||
usb2_pause_mtx(&sc->sc_bus.bus_mtx, hz / 1000);
|
||||
usb_pause_mtx(&sc->sc_bus.bus_mtx, hz / 1000);
|
||||
|
||||
/* disable all interrupts */
|
||||
|
||||
@ -1702,7 +1702,7 @@ musbotg_init(struct musbotg_softc *sc)
|
||||
musbotg_pull_common(sc, 0);
|
||||
|
||||
/* wait a little bit (10ms) */
|
||||
usb2_pause_mtx(&sc->sc_bus.bus_mtx, hz / 100);
|
||||
usb_pause_mtx(&sc->sc_bus.bus_mtx, hz / 100);
|
||||
|
||||
/* disable double packet buffering */
|
||||
MUSB2_WRITE_2(sc, MUSB2_REG_RXDBDIS, 0xFFFF);
|
||||
@ -2011,7 +2011,7 @@ musbotg_device_isoc_enter(struct usb_xfer *xfer)
|
||||
*/
|
||||
temp = (nframes - xfer->endpoint->isoc_next) & MUSB2_MASK_FRAME;
|
||||
|
||||
if (usb2_get_speed(xfer->xroot->udev) == USB_SPEED_HIGH) {
|
||||
if (usbd_get_speed(xfer->xroot->udev) == USB_SPEED_HIGH) {
|
||||
fs_frames = (xfer->nframes + 7) / 8;
|
||||
} else {
|
||||
fs_frames = xfer->nframes;
|
||||
@ -2039,7 +2039,7 @@ musbotg_device_isoc_enter(struct usb_xfer *xfer)
|
||||
* pre-compute when the isochronous transfer will be finished:
|
||||
*/
|
||||
xfer->isoc_time_complete =
|
||||
usb2_isoc_time_expand(&sc->sc_bus, nframes) + temp +
|
||||
usb_isoc_time_expand(&sc->sc_bus, nframes) + temp +
|
||||
fs_frames;
|
||||
|
||||
/* compute frame number for next insertion */
|
||||
@ -2581,7 +2581,7 @@ musbotg_xfer_setup(struct usb_setup_params *parm)
|
||||
else
|
||||
parm->hc_max_packet_count = 1;
|
||||
|
||||
usb2_transfer_setup_sub(parm);
|
||||
usbd_transfer_setup_sub(parm);
|
||||
|
||||
/*
|
||||
* compute maximum number of TDs
|
||||
@ -2608,7 +2608,7 @@ musbotg_xfer_setup(struct usb_setup_params *parm)
|
||||
}
|
||||
|
||||
/*
|
||||
* check if "usb2_transfer_setup_sub" set an error
|
||||
* check if "usbd_transfer_setup_sub" set an error
|
||||
*/
|
||||
if (parm->err) {
|
||||
return;
|
||||
|
@ -99,7 +99,7 @@ musbotg_attach(device_t dev)
|
||||
sc->sc_otg.sc_bus.devices_max = MUSB2_MAX_DEVICES;
|
||||
|
||||
/* get all DMA memory */
|
||||
if (usb2_bus_mem_alloc_all(&sc->sc_otg.sc_bus,
|
||||
if (usb_bus_mem_alloc_all(&sc->sc_otg.sc_bus,
|
||||
USB_GET_DMA_TAG(dev), NULL)) {
|
||||
return (ENOMEM);
|
||||
}
|
||||
@ -192,7 +192,7 @@ musbotg_detach(device_t dev)
|
||||
sc->sc_otg.sc_io_res);
|
||||
sc->sc_otg.sc_io_res = NULL;
|
||||
}
|
||||
usb2_bus_mem_free_all(&sc->sc_otg.sc_bus, NULL);
|
||||
usb_bus_mem_free_all(&sc->sc_otg.sc_bus, NULL);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ struct ohci_std_temp {
|
||||
static struct ohci_hcca *
|
||||
ohci_get_hcca(ohci_softc_t *sc)
|
||||
{
|
||||
usb2_pc_cpu_invalidate(&sc->sc_hw.hcca_pc);
|
||||
usb_pc_cpu_invalidate(&sc->sc_hw.hcca_pc);
|
||||
return (sc->sc_hcca_p);
|
||||
}
|
||||
|
||||
@ -162,7 +162,7 @@ ohci_controller_init(ohci_softc_t *sc)
|
||||
DPRINTF("SMM active, request owner change\n");
|
||||
OWRITE4(sc, OHCI_COMMAND_STATUS, OHCI_OCR);
|
||||
for (i = 0; (i < 100) && (ctl & OHCI_IR); i++) {
|
||||
usb2_pause_mtx(NULL, hz / 1000);
|
||||
usb_pause_mtx(NULL, hz / 1000);
|
||||
ctl = OREAD4(sc, OHCI_CONTROL);
|
||||
}
|
||||
if (ctl & OHCI_IR) {
|
||||
@ -175,7 +175,7 @@ ohci_controller_init(ohci_softc_t *sc)
|
||||
DPRINTF("cold started\n");
|
||||
reset:
|
||||
/* controller was cold started */
|
||||
usb2_pause_mtx(NULL,
|
||||
usb_pause_mtx(NULL,
|
||||
USB_MS_TO_TICKS(USB_BUS_RESET_DELAY));
|
||||
}
|
||||
|
||||
@ -186,7 +186,7 @@ ohci_controller_init(ohci_softc_t *sc)
|
||||
DPRINTF("%s: resetting\n", device_get_nameunit(sc->sc_bus.bdev));
|
||||
OWRITE4(sc, OHCI_CONTROL, OHCI_HCFS_RESET);
|
||||
|
||||
usb2_pause_mtx(NULL,
|
||||
usb_pause_mtx(NULL,
|
||||
USB_MS_TO_TICKS(USB_BUS_RESET_DELAY));
|
||||
|
||||
/* we now own the host controller and the bus has been reset */
|
||||
@ -214,13 +214,13 @@ ohci_controller_init(ohci_softc_t *sc)
|
||||
/* The controller is now in SUSPEND state, we have 2ms to finish. */
|
||||
|
||||
/* set up HC registers */
|
||||
usb2_get_page(&sc->sc_hw.hcca_pc, 0, &buf_res);
|
||||
usbd_get_page(&sc->sc_hw.hcca_pc, 0, &buf_res);
|
||||
OWRITE4(sc, OHCI_HCCA, buf_res.physaddr);
|
||||
|
||||
usb2_get_page(&sc->sc_hw.ctrl_start_pc, 0, &buf_res);
|
||||
usbd_get_page(&sc->sc_hw.ctrl_start_pc, 0, &buf_res);
|
||||
OWRITE4(sc, OHCI_CONTROL_HEAD_ED, buf_res.physaddr);
|
||||
|
||||
usb2_get_page(&sc->sc_hw.bulk_start_pc, 0, &buf_res);
|
||||
usbd_get_page(&sc->sc_hw.bulk_start_pc, 0, &buf_res);
|
||||
OWRITE4(sc, OHCI_BULK_HEAD_ED, buf_res.physaddr);
|
||||
|
||||
/* disable all interrupts and then switch on all desired interrupts */
|
||||
@ -249,7 +249,7 @@ ohci_controller_init(ohci_softc_t *sc)
|
||||
desca = OREAD4(sc, OHCI_RH_DESCRIPTOR_A);
|
||||
OWRITE4(sc, OHCI_RH_DESCRIPTOR_A, desca | OHCI_NOCP);
|
||||
OWRITE4(sc, OHCI_RH_STATUS, OHCI_LPSC); /* Enable port power */
|
||||
usb2_pause_mtx(NULL,
|
||||
usb_pause_mtx(NULL,
|
||||
USB_MS_TO_TICKS(OHCI_ENABLE_POWER_DELAY));
|
||||
OWRITE4(sc, OHCI_RH_DESCRIPTOR_A, desca);
|
||||
|
||||
@ -259,7 +259,7 @@ ohci_controller_init(ohci_softc_t *sc)
|
||||
*/
|
||||
sc->sc_noport = 0;
|
||||
for (i = 0; (i < 10) && (sc->sc_noport == 0); i++) {
|
||||
usb2_pause_mtx(NULL,
|
||||
usb_pause_mtx(NULL,
|
||||
USB_MS_TO_TICKS(OHCI_READ_DESC_DELAY));
|
||||
sc->sc_noport = OHCI_GET_NDP(OREAD4(sc, OHCI_RH_DESCRIPTOR_A));
|
||||
}
|
||||
@ -278,7 +278,7 @@ ohci_init_ed(struct usb_page_cache *pc)
|
||||
struct usb_page_search buf_res;
|
||||
struct ohci_ed *ed;
|
||||
|
||||
usb2_get_page(pc, 0, &buf_res);
|
||||
usbd_get_page(pc, 0, &buf_res);
|
||||
|
||||
ed = buf_res.buffer;
|
||||
|
||||
@ -359,7 +359,7 @@ ohci_init(ohci_softc_t *sc)
|
||||
ed_int->next = ed_isc;
|
||||
ed_int->ed_next = ed_isc->ed_self;
|
||||
}
|
||||
usb2_get_page(&sc->sc_hw.hcca_pc, 0, &buf_res);
|
||||
usbd_get_page(&sc->sc_hw.hcca_pc, 0, &buf_res);
|
||||
|
||||
sc->sc_hcca_p = buf_res.buffer;
|
||||
|
||||
@ -373,12 +373,12 @@ ohci_init(ohci_softc_t *sc)
|
||||
}
|
||||
/* flush all cache into memory */
|
||||
|
||||
usb2_bus_mem_flush_all(&sc->sc_bus, &ohci_iterate_hw_softc);
|
||||
usb_bus_mem_flush_all(&sc->sc_bus, &ohci_iterate_hw_softc);
|
||||
|
||||
/* set up the bus struct */
|
||||
sc->sc_bus.methods = &ohci_bus_methods;
|
||||
|
||||
usb2_callout_init_mtx(&sc->sc_tmo_rhsc, &sc->sc_bus.bus_mtx, 0);
|
||||
usb_callout_init_mtx(&sc->sc_tmo_rhsc, &sc->sc_bus.bus_mtx, 0);
|
||||
|
||||
#if USB_DEBUG
|
||||
if (ohcidebug > 15) {
|
||||
@ -410,7 +410,7 @@ ohci_detach(struct ohci_softc *sc)
|
||||
{
|
||||
USB_BUS_LOCK(&sc->sc_bus);
|
||||
|
||||
usb2_callout_stop(&sc->sc_tmo_rhsc);
|
||||
usb_callout_stop(&sc->sc_tmo_rhsc);
|
||||
|
||||
OWRITE4(sc, OHCI_INTERRUPT_DISABLE, OHCI_ALL_INTRS);
|
||||
OWRITE4(sc, OHCI_CONTROL, OHCI_HCFS_RESET);
|
||||
@ -418,9 +418,9 @@ ohci_detach(struct ohci_softc *sc)
|
||||
USB_BUS_UNLOCK(&sc->sc_bus);
|
||||
|
||||
/* XXX let stray task complete */
|
||||
usb2_pause_mtx(NULL, hz / 20);
|
||||
usb_pause_mtx(NULL, hz / 20);
|
||||
|
||||
usb2_callout_drain(&sc->sc_tmo_rhsc);
|
||||
usb_callout_drain(&sc->sc_tmo_rhsc);
|
||||
}
|
||||
|
||||
/* NOTE: suspend/resume is called from
|
||||
@ -452,7 +452,7 @@ ohci_suspend(ohci_softc_t *sc)
|
||||
ctl |= OHCI_HCFS_SUSPEND;
|
||||
OWRITE4(sc, OHCI_CONTROL, ctl);
|
||||
|
||||
usb2_pause_mtx(&sc->sc_bus.bus_mtx,
|
||||
usb_pause_mtx(&sc->sc_bus.bus_mtx,
|
||||
USB_MS_TO_TICKS(USB_RESUME_WAIT));
|
||||
|
||||
USB_BUS_UNLOCK(&sc->sc_bus);
|
||||
@ -483,11 +483,11 @@ ohci_resume(ohci_softc_t *sc)
|
||||
ctl = OREAD4(sc, OHCI_CONTROL);
|
||||
ctl |= OHCI_HCFS_RESUME;
|
||||
OWRITE4(sc, OHCI_CONTROL, ctl);
|
||||
usb2_pause_mtx(&sc->sc_bus.bus_mtx,
|
||||
usb_pause_mtx(&sc->sc_bus.bus_mtx,
|
||||
USB_MS_TO_TICKS(USB_RESUME_DELAY));
|
||||
ctl = (ctl & ~OHCI_HCFS_MASK) | OHCI_HCFS_OPERATIONAL;
|
||||
OWRITE4(sc, OHCI_CONTROL, ctl);
|
||||
usb2_pause_mtx(&sc->sc_bus.bus_mtx,
|
||||
usb_pause_mtx(&sc->sc_bus.bus_mtx,
|
||||
USB_MS_TO_TICKS(USB_RESUME_RECOVERY));
|
||||
sc->sc_control = sc->sc_intre = 0;
|
||||
|
||||
@ -557,7 +557,7 @@ ohci_dump_td(ohci_td_t *std)
|
||||
uint32_t td_flags;
|
||||
uint8_t temp;
|
||||
|
||||
usb2_pc_cpu_invalidate(std->page_cache);
|
||||
usb_pc_cpu_invalidate(std->page_cache);
|
||||
|
||||
td_flags = le32toh(std->td_flags);
|
||||
temp = (std->td_next == 0);
|
||||
@ -587,7 +587,7 @@ ohci_dump_itd(ohci_itd_t *sitd)
|
||||
uint16_t i;
|
||||
uint8_t temp;
|
||||
|
||||
usb2_pc_cpu_invalidate(sitd->page_cache);
|
||||
usb_pc_cpu_invalidate(sitd->page_cache);
|
||||
|
||||
itd_flags = le32toh(sitd->itd_flags);
|
||||
temp = (sitd->itd_next == 0);
|
||||
@ -627,7 +627,7 @@ ohci_dump_ed(ohci_ed_t *sed)
|
||||
uint32_t ed_flags;
|
||||
uint32_t ed_headp;
|
||||
|
||||
usb2_pc_cpu_invalidate(sed->page_cache);
|
||||
usb_pc_cpu_invalidate(sed->page_cache);
|
||||
|
||||
ed_flags = le32toh(sed->ed_flags);
|
||||
ed_headp = le32toh(sed->ed_headp);
|
||||
@ -660,11 +660,11 @@ ohci_transfer_intr_enqueue(struct usb_xfer *xfer)
|
||||
return;
|
||||
}
|
||||
/* put transfer on interrupt queue */
|
||||
usb2_transfer_enqueue(&xfer->xroot->bus->intr_q, xfer);
|
||||
usbd_transfer_enqueue(&xfer->xroot->bus->intr_q, xfer);
|
||||
|
||||
/* start timeout, if any */
|
||||
if (xfer->timeout != 0) {
|
||||
usb2_transfer_timeout_ms(xfer, &ohci_timeout, xfer->timeout);
|
||||
usbd_transfer_timeout_ms(xfer, &ohci_timeout, xfer->timeout);
|
||||
}
|
||||
}
|
||||
|
||||
@ -687,7 +687,7 @@ _ohci_append_qh(ohci_ed_t *sed, ohci_ed_t *last)
|
||||
|
||||
sed->prev = last;
|
||||
|
||||
usb2_pc_cpu_flush(sed->page_cache);
|
||||
usb_pc_cpu_flush(sed->page_cache);
|
||||
|
||||
/*
|
||||
* the last->next->prev is never followed: sed->next->prev = sed;
|
||||
@ -696,7 +696,7 @@ _ohci_append_qh(ohci_ed_t *sed, ohci_ed_t *last)
|
||||
last->next = sed;
|
||||
last->ed_next = sed->ed_self;
|
||||
|
||||
usb2_pc_cpu_flush(last->page_cache);
|
||||
usb_pc_cpu_flush(last->page_cache);
|
||||
|
||||
return (sed);
|
||||
}
|
||||
@ -715,17 +715,17 @@ _ohci_remove_qh(ohci_ed_t *sed, ohci_ed_t *last)
|
||||
sed->prev->next = sed->next;
|
||||
sed->prev->ed_next = sed->ed_next;
|
||||
|
||||
usb2_pc_cpu_flush(sed->prev->page_cache);
|
||||
usb_pc_cpu_flush(sed->prev->page_cache);
|
||||
|
||||
if (sed->next) {
|
||||
sed->next->prev = sed->prev;
|
||||
usb2_pc_cpu_flush(sed->next->page_cache);
|
||||
usb_pc_cpu_flush(sed->next->page_cache);
|
||||
}
|
||||
last = ((last == sed) ? sed->prev : last);
|
||||
|
||||
sed->prev = 0;
|
||||
|
||||
usb2_pc_cpu_flush(sed->page_cache);
|
||||
usb_pc_cpu_flush(sed->page_cache);
|
||||
}
|
||||
return (last);
|
||||
}
|
||||
@ -750,7 +750,7 @@ ohci_isoc_done(struct usb_xfer *xfer)
|
||||
ohci_dump_itd(td);
|
||||
}
|
||||
#endif
|
||||
usb2_pc_cpu_invalidate(td->page_cache);
|
||||
usb_pc_cpu_invalidate(td->page_cache);
|
||||
|
||||
nframes = td->frames;
|
||||
olen = &td->itd_offset[0];
|
||||
@ -832,7 +832,7 @@ ohci_non_isoc_done_sub(struct usb_xfer *xfer)
|
||||
}
|
||||
while (1) {
|
||||
|
||||
usb2_pc_cpu_invalidate(td->page_cache);
|
||||
usb_pc_cpu_invalidate(td->page_cache);
|
||||
phy_start = le32toh(td->td_cbp);
|
||||
td_flags = le32toh(td->td_flags);
|
||||
cc = OHCI_TD_GET_CC(td_flags);
|
||||
@ -971,7 +971,7 @@ ohci_check_transfer_sub(struct usb_xfer *xfer)
|
||||
|
||||
while (1) {
|
||||
|
||||
usb2_pc_cpu_invalidate(td->page_cache);
|
||||
usb_pc_cpu_invalidate(td->page_cache);
|
||||
phy_start = le32toh(td->td_cbp);
|
||||
td_flags = le32toh(td->td_flags);
|
||||
td_next = le32toh(td->td_next);
|
||||
@ -1011,7 +1011,7 @@ ohci_check_transfer_sub(struct usb_xfer *xfer)
|
||||
ed = xfer->qh_start[xfer->flags_int.curr_dma_set];
|
||||
|
||||
ed->ed_headp = td->td_self;
|
||||
usb2_pc_cpu_flush(ed->page_cache);
|
||||
usb_pc_cpu_flush(ed->page_cache);
|
||||
|
||||
DPRINTFN(13, "xfer=%p following alt next\n", xfer);
|
||||
|
||||
@ -1052,7 +1052,7 @@ ohci_check_transfer(struct usb_xfer *xfer)
|
||||
|
||||
ed = xfer->qh_start[xfer->flags_int.curr_dma_set];
|
||||
|
||||
usb2_pc_cpu_invalidate(ed->page_cache);
|
||||
usb_pc_cpu_invalidate(ed->page_cache);
|
||||
ed_headp = le32toh(ed->ed_headp);
|
||||
ed_tailp = le32toh(ed->ed_tailp);
|
||||
|
||||
@ -1169,7 +1169,7 @@ ohci_interrupt(ohci_softc_t *sc)
|
||||
}
|
||||
hcca->hcca_done_head = 0;
|
||||
|
||||
usb2_pc_cpu_flush(&sc->sc_hw.hcca_pc);
|
||||
usb_pc_cpu_flush(&sc->sc_hw.hcca_pc);
|
||||
} else {
|
||||
status = OREAD4(sc, OHCI_INTERRUPT_STATUS) & ~OHCI_WDH;
|
||||
}
|
||||
@ -1215,7 +1215,7 @@ ohci_interrupt(ohci_softc_t *sc)
|
||||
ohci_root_intr(sc);
|
||||
|
||||
/* do not allow RHSC interrupts > 1 per second */
|
||||
usb2_callout_reset(&sc->sc_tmo_rhsc, hz,
|
||||
usb_callout_reset(&sc->sc_tmo_rhsc, hz,
|
||||
(void *)&ohci_rhsc_enable, sc);
|
||||
}
|
||||
}
|
||||
@ -1351,11 +1351,11 @@ ohci_setup_standard_chain_sub(struct ohci_std_temp *temp)
|
||||
|
||||
} else {
|
||||
|
||||
usb2_get_page(temp->pc, buf_offset, &buf_res);
|
||||
usbd_get_page(temp->pc, buf_offset, &buf_res);
|
||||
td->td_cbp = htole32(buf_res.physaddr);
|
||||
buf_offset += (average - 1);
|
||||
|
||||
usb2_get_page(temp->pc, buf_offset, &buf_res);
|
||||
usbd_get_page(temp->pc, buf_offset, &buf_res);
|
||||
td->td_be = htole32(buf_res.physaddr);
|
||||
buf_offset++;
|
||||
|
||||
@ -1380,7 +1380,7 @@ ohci_setup_standard_chain_sub(struct ohci_std_temp *temp)
|
||||
|
||||
td->alt_next = td_alt_next;
|
||||
|
||||
usb2_pc_cpu_flush(td->page_cache);
|
||||
usb_pc_cpu_flush(td->page_cache);
|
||||
}
|
||||
|
||||
if (precompute) {
|
||||
@ -1416,7 +1416,7 @@ ohci_setup_standard_chain(struct usb_xfer *xfer, ohci_ed_t **ed_last)
|
||||
|
||||
DPRINTFN(9, "addr=%d endpt=%d sumlen=%d speed=%d\n",
|
||||
xfer->address, UE_GET_ADDR(xfer->endpointno),
|
||||
xfer->sumlen, usb2_get_speed(xfer->xroot->udev));
|
||||
xfer->sumlen, usbd_get_speed(xfer->xroot->udev));
|
||||
|
||||
temp.average = xfer->max_hc_frame_size;
|
||||
temp.max_frame_size = xfer->max_frame_size;
|
||||
@ -1558,7 +1558,7 @@ ohci_setup_standard_chain(struct usb_xfer *xfer, ohci_ed_t **ed_last)
|
||||
td->td_flags &= ~htole32(OHCI_TD_INTR_MASK);
|
||||
td->td_flags |= htole32(OHCI_TD_SET_DI(1));
|
||||
|
||||
usb2_pc_cpu_flush(td->page_cache);
|
||||
usb_pc_cpu_flush(td->page_cache);
|
||||
|
||||
/* must have at least one frame! */
|
||||
|
||||
@ -1604,7 +1604,7 @@ ohci_setup_standard_chain(struct usb_xfer *xfer, ohci_ed_t **ed_last)
|
||||
OWRITE4(sc, OHCI_COMMAND_STATUS, OHCI_CLF);
|
||||
}
|
||||
} else {
|
||||
usb2_pc_cpu_flush(ed->page_cache);
|
||||
usb_pc_cpu_flush(ed->page_cache);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1659,7 +1659,7 @@ ohci_device_done(struct usb_xfer *xfer, usb_error_t error)
|
||||
|
||||
ed = xfer->qh_start[xfer->flags_int.curr_dma_set];
|
||||
if (ed) {
|
||||
usb2_pc_cpu_invalidate(ed->page_cache);
|
||||
usb_pc_cpu_invalidate(ed->page_cache);
|
||||
}
|
||||
if (methods == &ohci_device_bulk_methods) {
|
||||
OHCI_REMOVE_QH(ed, sc->sc_bulk_p_last);
|
||||
@ -1677,7 +1677,7 @@ ohci_device_done(struct usb_xfer *xfer, usb_error_t error)
|
||||
xfer->td_transfer_last = NULL;
|
||||
|
||||
/* dequeue transfer and start next transfer */
|
||||
usb2_transfer_done(xfer, error);
|
||||
usbd_transfer_done(xfer, error);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
@ -1897,7 +1897,7 @@ ohci_device_isoc_enter(struct usb_xfer *xfer)
|
||||
* pre-compute when the isochronous transfer will be finished:
|
||||
*/
|
||||
xfer->isoc_time_complete =
|
||||
(usb2_isoc_time_expand(&sc->sc_bus, nframes) + buf_offset +
|
||||
(usb_isoc_time_expand(&sc->sc_bus, nframes) + buf_offset +
|
||||
xfer->nframes);
|
||||
|
||||
/* get the real number of frames */
|
||||
@ -1957,12 +1957,12 @@ ohci_device_isoc_enter(struct usb_xfer *xfer)
|
||||
htole16(OHCI_ITD_MK_OFFS(0));
|
||||
}
|
||||
} else {
|
||||
usb2_get_page(xfer->frbuffers, buf_offset - length, &buf_res);
|
||||
usbd_get_page(xfer->frbuffers, buf_offset - length, &buf_res);
|
||||
length = OHCI_PAGE_MASK(buf_res.physaddr);
|
||||
buf_res.physaddr =
|
||||
OHCI_PAGE(buf_res.physaddr);
|
||||
td->itd_bp0 = htole32(buf_res.physaddr);
|
||||
usb2_get_page(xfer->frbuffers, buf_offset - 1, &buf_res);
|
||||
usbd_get_page(xfer->frbuffers, buf_offset - 1, &buf_res);
|
||||
td->itd_be = htole32(buf_res.physaddr);
|
||||
|
||||
while (ncur--) {
|
||||
@ -1982,7 +1982,7 @@ ohci_device_isoc_enter(struct usb_xfer *xfer)
|
||||
/* link the last TD with the next one */
|
||||
td_last->itd_next = td->itd_self;
|
||||
}
|
||||
usb2_pc_cpu_flush(td_last->page_cache);
|
||||
usb_pc_cpu_flush(td_last->page_cache);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1991,7 +1991,7 @@ ohci_device_isoc_enter(struct usb_xfer *xfer)
|
||||
td_last->itd_flags |= htole32(OHCI_ITD_SET_DI(0));
|
||||
td_last->itd_next = 0;
|
||||
|
||||
usb2_pc_cpu_flush(td_last->page_cache);
|
||||
usb_pc_cpu_flush(td_last->page_cache);
|
||||
|
||||
xfer->td_transfer_last = td_last;
|
||||
|
||||
@ -2189,7 +2189,7 @@ ohci_roothub_exec(struct usb_device *udev,
|
||||
break;
|
||||
}
|
||||
|
||||
len = usb2_make_str_desc(
|
||||
len = usb_make_str_desc(
|
||||
sc->sc_hub_desc.temp,
|
||||
sizeof(sc->sc_hub_desc.temp),
|
||||
str_ptr);
|
||||
@ -2365,7 +2365,7 @@ ohci_roothub_exec(struct usb_device *udev,
|
||||
OWRITE4(sc, port, UPS_RESET);
|
||||
for (v = 0;; v++) {
|
||||
if (v < 12) {
|
||||
usb2_pause_mtx(&sc->sc_bus.bus_mtx,
|
||||
usb_pause_mtx(&sc->sc_bus.bus_mtx,
|
||||
USB_MS_TO_TICKS(USB_PORT_ROOT_RESET_DELAY));
|
||||
|
||||
if ((OREAD4(sc, port) & UPS_RESET) == 0) {
|
||||
@ -2424,7 +2424,7 @@ ohci_xfer_setup(struct usb_setup_params *parm)
|
||||
if (parm->methods == &ohci_device_ctrl_methods) {
|
||||
xfer->flags_int.bdma_enable = 1;
|
||||
|
||||
usb2_transfer_setup_sub(parm);
|
||||
usbd_transfer_setup_sub(parm);
|
||||
|
||||
nitd = 0;
|
||||
ntd = ((2 * xfer->nframes) + 1 /* STATUS */
|
||||
@ -2434,7 +2434,7 @@ ohci_xfer_setup(struct usb_setup_params *parm)
|
||||
} else if (parm->methods == &ohci_device_bulk_methods) {
|
||||
xfer->flags_int.bdma_enable = 1;
|
||||
|
||||
usb2_transfer_setup_sub(parm);
|
||||
usbd_transfer_setup_sub(parm);
|
||||
|
||||
nitd = 0;
|
||||
ntd = ((2 * xfer->nframes)
|
||||
@ -2444,7 +2444,7 @@ ohci_xfer_setup(struct usb_setup_params *parm)
|
||||
} else if (parm->methods == &ohci_device_intr_methods) {
|
||||
xfer->flags_int.bdma_enable = 1;
|
||||
|
||||
usb2_transfer_setup_sub(parm);
|
||||
usbd_transfer_setup_sub(parm);
|
||||
|
||||
nitd = 0;
|
||||
ntd = ((2 * xfer->nframes)
|
||||
@ -2454,7 +2454,7 @@ ohci_xfer_setup(struct usb_setup_params *parm)
|
||||
} else if (parm->methods == &ohci_device_isoc_methods) {
|
||||
xfer->flags_int.bdma_enable = 1;
|
||||
|
||||
usb2_transfer_setup_sub(parm);
|
||||
usbd_transfer_setup_sub(parm);
|
||||
|
||||
nitd = ((xfer->max_data_length / OHCI_PAGE_SIZE) +
|
||||
((xfer->nframes + OHCI_ITD_NOFFSET - 1) / OHCI_ITD_NOFFSET) +
|
||||
@ -2464,7 +2464,7 @@ ohci_xfer_setup(struct usb_setup_params *parm)
|
||||
|
||||
} else {
|
||||
|
||||
usb2_transfer_setup_sub(parm);
|
||||
usbd_transfer_setup_sub(parm);
|
||||
|
||||
nitd = 0;
|
||||
ntd = 0;
|
||||
@ -2478,7 +2478,7 @@ ohci_xfer_setup(struct usb_setup_params *parm)
|
||||
}
|
||||
last_obj = NULL;
|
||||
|
||||
if (usb2_transfer_setup_sub_malloc(
|
||||
if (usbd_transfer_setup_sub_malloc(
|
||||
parm, &pc, sizeof(ohci_td_t),
|
||||
OHCI_TD_ALIGN, ntd)) {
|
||||
parm->err = USB_ERR_NOMEM;
|
||||
@ -2488,7 +2488,7 @@ ohci_xfer_setup(struct usb_setup_params *parm)
|
||||
for (n = 0; n != ntd; n++) {
|
||||
ohci_td_t *td;
|
||||
|
||||
usb2_get_page(pc + n, 0, &page_info);
|
||||
usbd_get_page(pc + n, 0, &page_info);
|
||||
|
||||
td = page_info.buffer;
|
||||
|
||||
@ -2499,10 +2499,10 @@ ohci_xfer_setup(struct usb_setup_params *parm)
|
||||
|
||||
last_obj = td;
|
||||
|
||||
usb2_pc_cpu_flush(pc + n);
|
||||
usb_pc_cpu_flush(pc + n);
|
||||
}
|
||||
}
|
||||
if (usb2_transfer_setup_sub_malloc(
|
||||
if (usbd_transfer_setup_sub_malloc(
|
||||
parm, &pc, sizeof(ohci_itd_t),
|
||||
OHCI_ITD_ALIGN, nitd)) {
|
||||
parm->err = USB_ERR_NOMEM;
|
||||
@ -2512,7 +2512,7 @@ ohci_xfer_setup(struct usb_setup_params *parm)
|
||||
for (n = 0; n != nitd; n++) {
|
||||
ohci_itd_t *itd;
|
||||
|
||||
usb2_get_page(pc + n, 0, &page_info);
|
||||
usbd_get_page(pc + n, 0, &page_info);
|
||||
|
||||
itd = page_info.buffer;
|
||||
|
||||
@ -2523,14 +2523,14 @@ ohci_xfer_setup(struct usb_setup_params *parm)
|
||||
|
||||
last_obj = itd;
|
||||
|
||||
usb2_pc_cpu_flush(pc + n);
|
||||
usb_pc_cpu_flush(pc + n);
|
||||
}
|
||||
}
|
||||
xfer->td_start[xfer->flags_int.curr_dma_set] = last_obj;
|
||||
|
||||
last_obj = NULL;
|
||||
|
||||
if (usb2_transfer_setup_sub_malloc(
|
||||
if (usbd_transfer_setup_sub_malloc(
|
||||
parm, &pc, sizeof(ohci_ed_t),
|
||||
OHCI_ED_ALIGN, nqh)) {
|
||||
parm->err = USB_ERR_NOMEM;
|
||||
@ -2540,7 +2540,7 @@ ohci_xfer_setup(struct usb_setup_params *parm)
|
||||
for (n = 0; n != nqh; n++) {
|
||||
ohci_ed_t *ed;
|
||||
|
||||
usb2_get_page(pc + n, 0, &page_info);
|
||||
usbd_get_page(pc + n, 0, &page_info);
|
||||
|
||||
ed = page_info.buffer;
|
||||
|
||||
@ -2551,7 +2551,7 @@ ohci_xfer_setup(struct usb_setup_params *parm)
|
||||
|
||||
last_obj = ed;
|
||||
|
||||
usb2_pc_cpu_flush(pc + n);
|
||||
usb_pc_cpu_flush(pc + n);
|
||||
}
|
||||
}
|
||||
xfer->qh_start[xfer->flags_int.curr_dma_set] = last_obj;
|
||||
|
@ -73,7 +73,7 @@ ohci_atmelarm_attach(device_t dev)
|
||||
sc->sc_ohci.sc_bus.devices_max = OHCI_MAX_DEVICES;
|
||||
|
||||
/* get all DMA memory */
|
||||
if (usb2_bus_mem_alloc_all(&sc->sc_ohci.sc_bus,
|
||||
if (usb_bus_mem_alloc_all(&sc->sc_ohci.sc_bus,
|
||||
USB_GET_DMA_TAG(dev), &ohci_iterate_hw_softc)) {
|
||||
return (ENOMEM);
|
||||
}
|
||||
@ -191,7 +191,7 @@ ohci_atmelarm_detach(device_t dev)
|
||||
sc->sc_ohci.sc_io_res);
|
||||
sc->sc_ohci.sc_io_res = NULL;
|
||||
}
|
||||
usb2_bus_mem_free_all(&sc->sc_ohci.sc_bus, &ohci_iterate_hw_softc);
|
||||
usb_bus_mem_free_all(&sc->sc_ohci.sc_bus, &ohci_iterate_hw_softc);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
@ -199,7 +199,7 @@ ohci_pci_attach(device_t self)
|
||||
sc->sc_bus.devices_max = OHCI_MAX_DEVICES;
|
||||
|
||||
/* get all DMA memory */
|
||||
if (usb2_bus_mem_alloc_all(&sc->sc_bus, USB_GET_DMA_TAG(self),
|
||||
if (usb_bus_mem_alloc_all(&sc->sc_bus, USB_GET_DMA_TAG(self),
|
||||
&ohci_iterate_hw_softc)) {
|
||||
return (ENOMEM);
|
||||
}
|
||||
@ -353,7 +353,7 @@ ohci_pci_detach(device_t self)
|
||||
sc->sc_io_res);
|
||||
sc->sc_io_res = NULL;
|
||||
}
|
||||
usb2_bus_mem_free_all(&sc->sc_bus, &ohci_iterate_hw_softc);
|
||||
usb_bus_mem_free_all(&sc->sc_bus, &ohci_iterate_hw_softc);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
@ -191,13 +191,13 @@ uhci_mem_layout_init(struct uhci_mem_layout *ml, struct usb_xfer *xfer)
|
||||
static void
|
||||
uhci_mem_layout_fixup(struct uhci_mem_layout *ml, struct uhci_td *td)
|
||||
{
|
||||
usb2_get_page(ml->buf_pc, ml->buf_offset, &ml->buf_res);
|
||||
usbd_get_page(ml->buf_pc, ml->buf_offset, &ml->buf_res);
|
||||
|
||||
if (ml->buf_res.length < td->len) {
|
||||
|
||||
/* need to do a fixup */
|
||||
|
||||
usb2_get_page(ml->fix_pc, 0, &ml->fix_res);
|
||||
usbd_get_page(ml->fix_pc, 0, &ml->fix_res);
|
||||
|
||||
td->td_buffer = htole32(ml->fix_res.physaddr);
|
||||
|
||||
@ -219,17 +219,17 @@ uhci_mem_layout_fixup(struct uhci_mem_layout *ml, struct uhci_td *td)
|
||||
if ((td->td_token & htole32(UHCI_TD_PID)) ==
|
||||
htole32(UHCI_TD_PID_IN)) {
|
||||
td->fix_pc = ml->fix_pc;
|
||||
usb2_pc_cpu_invalidate(ml->fix_pc);
|
||||
usb_pc_cpu_invalidate(ml->fix_pc);
|
||||
|
||||
} else {
|
||||
td->fix_pc = NULL;
|
||||
|
||||
/* copy data to fixup location */
|
||||
|
||||
usb2_copy_out(ml->buf_pc, ml->buf_offset,
|
||||
usbd_copy_out(ml->buf_pc, ml->buf_offset,
|
||||
ml->fix_res.buffer, td->len);
|
||||
|
||||
usb2_pc_cpu_flush(ml->fix_pc);
|
||||
usb_pc_cpu_flush(ml->fix_pc);
|
||||
}
|
||||
|
||||
/* prepare next fixup */
|
||||
@ -266,7 +266,7 @@ uhci_restart(uhci_softc_t *sc)
|
||||
|
||||
DPRINTFN(2, "Restarting\n");
|
||||
|
||||
usb2_get_page(&sc->sc_hw.pframes_pc, 0, &buf_res);
|
||||
usbd_get_page(&sc->sc_hw.pframes_pc, 0, &buf_res);
|
||||
|
||||
/* Reload fresh base address */
|
||||
UWRITE4(sc, UHCI_FLBASEADDR, buf_res.physaddr);
|
||||
@ -278,7 +278,7 @@ uhci_restart(uhci_softc_t *sc)
|
||||
|
||||
/* wait 10 milliseconds */
|
||||
|
||||
usb2_pause_mtx(&sc->sc_bus.bus_mtx, hz / 100);
|
||||
usb_pause_mtx(&sc->sc_bus.bus_mtx, hz / 100);
|
||||
|
||||
/* check that controller has started */
|
||||
|
||||
@ -308,7 +308,7 @@ uhci_reset(uhci_softc_t *sc)
|
||||
|
||||
/* wait */
|
||||
|
||||
usb2_pause_mtx(&sc->sc_bus.bus_mtx,
|
||||
usb_pause_mtx(&sc->sc_bus.bus_mtx,
|
||||
USB_MS_TO_TICKS(USB_BUS_RESET_DELAY));
|
||||
|
||||
/* terminate all transfers */
|
||||
@ -321,7 +321,7 @@ uhci_reset(uhci_softc_t *sc)
|
||||
while (n--) {
|
||||
/* wait one millisecond */
|
||||
|
||||
usb2_pause_mtx(&sc->sc_bus.bus_mtx, hz / 1000);
|
||||
usb_pause_mtx(&sc->sc_bus.bus_mtx, hz / 1000);
|
||||
|
||||
if (!(UREAD2(sc, UHCI_CMD) & UHCI_CMD_HCRESET)) {
|
||||
goto done_1;
|
||||
@ -337,7 +337,7 @@ uhci_reset(uhci_softc_t *sc)
|
||||
while (n--) {
|
||||
/* wait one millisecond */
|
||||
|
||||
usb2_pause_mtx(&sc->sc_bus.bus_mtx, hz / 1000);
|
||||
usb_pause_mtx(&sc->sc_bus.bus_mtx, hz / 1000);
|
||||
|
||||
/* check if HC is stopped */
|
||||
if (UREAD2(sc, UHCI_STS) & UHCI_STS_HCH) {
|
||||
@ -357,7 +357,7 @@ uhci_reset(uhci_softc_t *sc)
|
||||
USB_BUS_UNLOCK(&sc->sc_bus);
|
||||
|
||||
/* stop root interrupt */
|
||||
usb2_callout_drain(&sc->sc_root_intr);
|
||||
usb_callout_drain(&sc->sc_root_intr);
|
||||
|
||||
USB_BUS_LOCK(&sc->sc_bus);
|
||||
}
|
||||
@ -392,7 +392,7 @@ uhci_init_qh(struct usb_page_cache *pc)
|
||||
struct usb_page_search buf_res;
|
||||
struct uhci_qh *qh;
|
||||
|
||||
usb2_get_page(pc, 0, &buf_res);
|
||||
usbd_get_page(pc, 0, &buf_res);
|
||||
|
||||
qh = buf_res.buffer;
|
||||
|
||||
@ -411,7 +411,7 @@ uhci_init_td(struct usb_page_cache *pc)
|
||||
struct usb_page_search buf_res;
|
||||
struct uhci_td *td;
|
||||
|
||||
usb2_get_page(pc, 0, &buf_res);
|
||||
usbd_get_page(pc, 0, &buf_res);
|
||||
|
||||
td = buf_res.buffer;
|
||||
|
||||
@ -433,7 +433,7 @@ uhci_init(uhci_softc_t *sc)
|
||||
|
||||
DPRINTF("start\n");
|
||||
|
||||
usb2_callout_init_mtx(&sc->sc_root_intr, &sc->sc_bus.bus_mtx, 0);
|
||||
usb_callout_init_mtx(&sc->sc_root_intr, &sc->sc_bus.bus_mtx, 0);
|
||||
|
||||
#if USB_DEBUG
|
||||
if (uhcidebug > 2) {
|
||||
@ -594,7 +594,7 @@ uhci_init(uhci_softc_t *sc)
|
||||
struct usb_page_search buf_res;
|
||||
uint32_t *pframes;
|
||||
|
||||
usb2_get_page(&sc->sc_hw.pframes_pc, 0, &buf_res);
|
||||
usbd_get_page(&sc->sc_hw.pframes_pc, 0, &buf_res);
|
||||
|
||||
pframes = buf_res.buffer;
|
||||
|
||||
@ -616,7 +616,7 @@ uhci_init(uhci_softc_t *sc)
|
||||
}
|
||||
/* flush all cache into memory */
|
||||
|
||||
usb2_bus_mem_flush_all(&sc->sc_bus, &uhci_iterate_hw_softc);
|
||||
usb_bus_mem_flush_all(&sc->sc_bus, &uhci_iterate_hw_softc);
|
||||
|
||||
/* set up the bus struct */
|
||||
sc->sc_bus.methods = &uhci_bus_methods;
|
||||
@ -662,7 +662,7 @@ uhci_suspend(uhci_softc_t *sc)
|
||||
|
||||
UHCICMD(sc, UHCI_CMD_EGSM);
|
||||
|
||||
usb2_pause_mtx(&sc->sc_bus.bus_mtx,
|
||||
usb_pause_mtx(&sc->sc_bus.bus_mtx,
|
||||
USB_MS_TO_TICKS(USB_RESUME_WAIT));
|
||||
|
||||
USB_BUS_UNLOCK(&sc->sc_bus);
|
||||
@ -681,7 +681,7 @@ uhci_resume(uhci_softc_t *sc)
|
||||
|
||||
UHCICMD(sc, UHCI_CMD_FGR);
|
||||
|
||||
usb2_pause_mtx(&sc->sc_bus.bus_mtx,
|
||||
usb_pause_mtx(&sc->sc_bus.bus_mtx,
|
||||
USB_MS_TO_TICKS(USB_RESUME_DELAY));
|
||||
|
||||
/* and start traffic again */
|
||||
@ -725,7 +725,7 @@ uhci_dump_td(uhci_td_t *p)
|
||||
uint32_t td_token;
|
||||
uint8_t temp;
|
||||
|
||||
usb2_pc_cpu_invalidate(p->page_cache);
|
||||
usb_pc_cpu_invalidate(p->page_cache);
|
||||
|
||||
td_next = le32toh(p->td_next);
|
||||
td_status = le32toh(p->td_status);
|
||||
@ -781,7 +781,7 @@ uhci_dump_qh(uhci_qh_t *sqh)
|
||||
uint32_t qh_h_next;
|
||||
uint32_t qh_e_next;
|
||||
|
||||
usb2_pc_cpu_invalidate(sqh->page_cache);
|
||||
usb_pc_cpu_invalidate(sqh->page_cache);
|
||||
|
||||
qh_h_next = le32toh(sqh->qh_h_next);
|
||||
qh_e_next = le32toh(sqh->qh_e_next);
|
||||
@ -872,7 +872,7 @@ uhci_add_loop(uhci_softc_t *sc)
|
||||
/* NOTE: we don't loop back the soft pointer */
|
||||
|
||||
qh_lst->qh_h_next = qh_rec->qh_self;
|
||||
usb2_pc_cpu_flush(qh_lst->page_cache);
|
||||
usb_pc_cpu_flush(qh_lst->page_cache);
|
||||
}
|
||||
}
|
||||
|
||||
@ -891,7 +891,7 @@ uhci_rem_loop(uhci_softc_t *sc)
|
||||
|
||||
qh_lst = sc->sc_last_qh_p;
|
||||
qh_lst->qh_h_next = htole32(UHCI_PTR_T);
|
||||
usb2_pc_cpu_flush(qh_lst->page_cache);
|
||||
usb_pc_cpu_flush(qh_lst->page_cache);
|
||||
}
|
||||
}
|
||||
|
||||
@ -903,11 +903,11 @@ uhci_transfer_intr_enqueue(struct usb_xfer *xfer)
|
||||
return;
|
||||
}
|
||||
/* put transfer on interrupt queue */
|
||||
usb2_transfer_enqueue(&xfer->xroot->bus->intr_q, xfer);
|
||||
usbd_transfer_enqueue(&xfer->xroot->bus->intr_q, xfer);
|
||||
|
||||
/* start timeout, if any */
|
||||
if (xfer->timeout != 0) {
|
||||
usb2_transfer_timeout_ms(xfer, &uhci_timeout, xfer->timeout);
|
||||
usbd_transfer_timeout_ms(xfer, &uhci_timeout, xfer->timeout);
|
||||
}
|
||||
}
|
||||
|
||||
@ -924,7 +924,7 @@ _uhci_append_td(uhci_td_t *std, uhci_td_t *last)
|
||||
|
||||
std->prev = last;
|
||||
|
||||
usb2_pc_cpu_flush(std->page_cache);
|
||||
usb_pc_cpu_flush(std->page_cache);
|
||||
|
||||
/*
|
||||
* the last->next->prev is never followed: std->next->prev = std;
|
||||
@ -932,7 +932,7 @@ _uhci_append_td(uhci_td_t *std, uhci_td_t *last)
|
||||
last->next = std;
|
||||
last->td_next = std->td_self;
|
||||
|
||||
usb2_pc_cpu_flush(last->page_cache);
|
||||
usb_pc_cpu_flush(last->page_cache);
|
||||
|
||||
return (std);
|
||||
}
|
||||
@ -955,7 +955,7 @@ _uhci_append_qh(uhci_qh_t *sqh, uhci_qh_t *last)
|
||||
|
||||
sqh->h_prev = last;
|
||||
|
||||
usb2_pc_cpu_flush(sqh->page_cache);
|
||||
usb_pc_cpu_flush(sqh->page_cache);
|
||||
|
||||
/*
|
||||
* The "last->h_next->h_prev" is never followed:
|
||||
@ -966,7 +966,7 @@ _uhci_append_qh(uhci_qh_t *sqh, uhci_qh_t *last)
|
||||
last->h_next = sqh;
|
||||
last->qh_h_next = sqh->qh_self;
|
||||
|
||||
usb2_pc_cpu_flush(last->page_cache);
|
||||
usb_pc_cpu_flush(last->page_cache);
|
||||
|
||||
return (sqh);
|
||||
}
|
||||
@ -984,11 +984,11 @@ _uhci_remove_td(uhci_td_t *std, uhci_td_t *last)
|
||||
std->prev->next = std->next;
|
||||
std->prev->td_next = std->td_next;
|
||||
|
||||
usb2_pc_cpu_flush(std->prev->page_cache);
|
||||
usb_pc_cpu_flush(std->prev->page_cache);
|
||||
|
||||
if (std->next) {
|
||||
std->next->prev = std->prev;
|
||||
usb2_pc_cpu_flush(std->next->page_cache);
|
||||
usb_pc_cpu_flush(std->next->page_cache);
|
||||
}
|
||||
return ((last == std) ? std->prev : last);
|
||||
}
|
||||
@ -1007,17 +1007,17 @@ _uhci_remove_qh(uhci_qh_t *sqh, uhci_qh_t *last)
|
||||
sqh->h_prev->h_next = sqh->h_next;
|
||||
sqh->h_prev->qh_h_next = sqh->qh_h_next;
|
||||
|
||||
usb2_pc_cpu_flush(sqh->h_prev->page_cache);
|
||||
usb_pc_cpu_flush(sqh->h_prev->page_cache);
|
||||
|
||||
if (sqh->h_next) {
|
||||
sqh->h_next->h_prev = sqh->h_prev;
|
||||
usb2_pc_cpu_flush(sqh->h_next->page_cache);
|
||||
usb_pc_cpu_flush(sqh->h_next->page_cache);
|
||||
}
|
||||
last = ((last == sqh) ? sqh->h_prev : last);
|
||||
|
||||
sqh->h_prev = 0;
|
||||
|
||||
usb2_pc_cpu_flush(sqh->page_cache);
|
||||
usb_pc_cpu_flush(sqh->page_cache);
|
||||
}
|
||||
return (last);
|
||||
}
|
||||
@ -1039,7 +1039,7 @@ uhci_isoc_done(uhci_softc_t *sc, struct usb_xfer *xfer)
|
||||
|
||||
/* sync any DMA memory before doing fixups */
|
||||
|
||||
usb2_bdma_post_sync(xfer);
|
||||
usb_bdma_post_sync(xfer);
|
||||
|
||||
while (nframes--) {
|
||||
if (td == NULL) {
|
||||
@ -1055,7 +1055,7 @@ uhci_isoc_done(uhci_softc_t *sc, struct usb_xfer *xfer)
|
||||
uhci_dump_td(td);
|
||||
}
|
||||
#endif
|
||||
usb2_pc_cpu_invalidate(td->page_cache);
|
||||
usb_pc_cpu_invalidate(td->page_cache);
|
||||
status = le32toh(td->td_status);
|
||||
|
||||
len = UHCI_TD_GET_ACTLEN(status);
|
||||
@ -1065,13 +1065,13 @@ uhci_isoc_done(uhci_softc_t *sc, struct usb_xfer *xfer)
|
||||
}
|
||||
if (td->fix_pc) {
|
||||
|
||||
usb2_get_page(td->fix_pc, 0, &res);
|
||||
usbd_get_page(td->fix_pc, 0, &res);
|
||||
|
||||
/* copy data from fixup location to real location */
|
||||
|
||||
usb2_pc_cpu_invalidate(td->fix_pc);
|
||||
usb_pc_cpu_invalidate(td->fix_pc);
|
||||
|
||||
usb2_copy_in(xfer->frbuffers, offset,
|
||||
usbd_copy_in(xfer->frbuffers, offset,
|
||||
res.buffer, len);
|
||||
}
|
||||
offset += *plen;
|
||||
@ -1107,7 +1107,7 @@ uhci_non_isoc_done_sub(struct usb_xfer *xfer)
|
||||
}
|
||||
while (1) {
|
||||
|
||||
usb2_pc_cpu_invalidate(td->page_cache);
|
||||
usb_pc_cpu_invalidate(td->page_cache);
|
||||
status = le32toh(td->td_status);
|
||||
token = le32toh(td->td_token);
|
||||
|
||||
@ -1127,16 +1127,16 @@ uhci_non_isoc_done_sub(struct usb_xfer *xfer)
|
||||
|
||||
if (td->fix_pc) {
|
||||
|
||||
usb2_get_page(td->fix_pc, 0, &res);
|
||||
usbd_get_page(td->fix_pc, 0, &res);
|
||||
|
||||
/*
|
||||
* copy data from fixup location to real
|
||||
* location
|
||||
*/
|
||||
|
||||
usb2_pc_cpu_invalidate(td->fix_pc);
|
||||
usb_pc_cpu_invalidate(td->fix_pc);
|
||||
|
||||
usb2_copy_in(xfer->frbuffers + xfer->aframes,
|
||||
usbd_copy_in(xfer->frbuffers + xfer->aframes,
|
||||
xfer->frlengths[xfer->aframes], res.buffer, len);
|
||||
}
|
||||
/* update actual length */
|
||||
@ -1218,7 +1218,7 @@ uhci_non_isoc_done(struct usb_xfer *xfer)
|
||||
|
||||
/* sync any DMA memory before doing fixups */
|
||||
|
||||
usb2_bdma_post_sync(xfer);
|
||||
usb_bdma_post_sync(xfer);
|
||||
|
||||
/* reset scanner */
|
||||
|
||||
@ -1291,7 +1291,7 @@ uhci_check_transfer_sub(struct usb_xfer *xfer)
|
||||
while (1) {
|
||||
|
||||
td->td_token ^= htole32(UHCI_TD_SET_DT(1));
|
||||
usb2_pc_cpu_flush(td->page_cache);
|
||||
usb_pc_cpu_flush(td->page_cache);
|
||||
|
||||
if (td == xfer->td_transfer_last) {
|
||||
/* last transfer */
|
||||
@ -1308,7 +1308,7 @@ uhci_check_transfer_sub(struct usb_xfer *xfer)
|
||||
|
||||
/* update the QH */
|
||||
qh->qh_e_next = td_self;
|
||||
usb2_pc_cpu_flush(qh->page_cache);
|
||||
usb_pc_cpu_flush(qh->page_cache);
|
||||
|
||||
DPRINTFN(13, "xfer=%p following alt next\n", xfer);
|
||||
}
|
||||
@ -1334,14 +1334,14 @@ uhci_check_transfer(struct usb_xfer *xfer)
|
||||
|
||||
td = xfer->td_transfer_last;
|
||||
|
||||
usb2_pc_cpu_invalidate(td->page_cache);
|
||||
usb_pc_cpu_invalidate(td->page_cache);
|
||||
status = le32toh(td->td_status);
|
||||
|
||||
/* check also if the first is complete */
|
||||
|
||||
td = xfer->td_transfer_first;
|
||||
|
||||
usb2_pc_cpu_invalidate(td->page_cache);
|
||||
usb_pc_cpu_invalidate(td->page_cache);
|
||||
status |= le32toh(td->td_status);
|
||||
|
||||
if (!(status & UHCI_TD_ACTIVE)) {
|
||||
@ -1359,7 +1359,7 @@ uhci_check_transfer(struct usb_xfer *xfer)
|
||||
td = xfer->td_transfer_cache;
|
||||
|
||||
while (1) {
|
||||
usb2_pc_cpu_invalidate(td->page_cache);
|
||||
usb_pc_cpu_invalidate(td->page_cache);
|
||||
status = le32toh(td->td_status);
|
||||
token = le32toh(td->td_token);
|
||||
|
||||
@ -1652,7 +1652,7 @@ uhci_setup_standard_chain_sub(struct uhci_std_temp *temp)
|
||||
}
|
||||
}
|
||||
|
||||
usb2_pc_cpu_flush(td->page_cache);
|
||||
usb_pc_cpu_flush(td->page_cache);
|
||||
}
|
||||
|
||||
if (precompute) {
|
||||
@ -1684,7 +1684,7 @@ uhci_setup_standard_chain(struct usb_xfer *xfer)
|
||||
|
||||
DPRINTFN(9, "addr=%d endpt=%d sumlen=%d speed=%d\n",
|
||||
xfer->address, UE_GET_ADDR(xfer->endpointno),
|
||||
xfer->sumlen, usb2_get_speed(xfer->xroot->udev));
|
||||
xfer->sumlen, usbd_get_speed(xfer->xroot->udev));
|
||||
|
||||
temp.average = xfer->max_frame_size;
|
||||
temp.max_frame_size = xfer->max_frame_size;
|
||||
@ -1836,7 +1836,7 @@ uhci_setup_standard_chain(struct usb_xfer *xfer)
|
||||
|
||||
td->td_status |= htole32(UHCI_TD_IOC);
|
||||
|
||||
usb2_pc_cpu_flush(td->page_cache);
|
||||
usb_pc_cpu_flush(td->page_cache);
|
||||
|
||||
/* must have at least one frame! */
|
||||
|
||||
@ -1870,7 +1870,7 @@ uhci_device_done(struct usb_xfer *xfer, usb_error_t error)
|
||||
|
||||
qh = xfer->qh_start[xfer->flags_int.curr_dma_set];
|
||||
if (qh) {
|
||||
usb2_pc_cpu_invalidate(qh->page_cache);
|
||||
usb_pc_cpu_invalidate(qh->page_cache);
|
||||
}
|
||||
if (xfer->flags_int.bandwidth_reclaimed) {
|
||||
xfer->flags_int.bandwidth_reclaimed = 0;
|
||||
@ -1902,7 +1902,7 @@ uhci_device_done(struct usb_xfer *xfer, usb_error_t error)
|
||||
xfer->td_transfer_last = NULL;
|
||||
}
|
||||
/* dequeue transfer and start next transfer */
|
||||
usb2_transfer_done(xfer, error);
|
||||
usbd_transfer_done(xfer, error);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
@ -1947,7 +1947,7 @@ uhci_device_bulk_start(struct usb_xfer *xfer)
|
||||
uhci_add_loop(sc);
|
||||
xfer->flags_int.bandwidth_reclaimed = 1;
|
||||
} else {
|
||||
usb2_pc_cpu_flush(qh->page_cache);
|
||||
usb_pc_cpu_flush(qh->page_cache);
|
||||
}
|
||||
|
||||
/* put transfer on interrupt queue */
|
||||
@ -2010,7 +2010,7 @@ uhci_device_ctrl_start(struct usb_xfer *xfer)
|
||||
UHCI_APPEND_QH(qh, sc->sc_fs_ctl_p_last);
|
||||
}
|
||||
} else {
|
||||
usb2_pc_cpu_flush(qh->page_cache);
|
||||
usb_pc_cpu_flush(qh->page_cache);
|
||||
}
|
||||
/* put transfer on interrupt queue */
|
||||
uhci_transfer_intr_enqueue(xfer);
|
||||
@ -2096,7 +2096,7 @@ uhci_device_intr_start(struct usb_xfer *xfer)
|
||||
/* enter QHs into the controller data structures */
|
||||
UHCI_APPEND_QH(qh, sc->sc_intr_p_last[xfer->qh_pos]);
|
||||
} else {
|
||||
usb2_pc_cpu_flush(qh->page_cache);
|
||||
usb_pc_cpu_flush(qh->page_cache);
|
||||
}
|
||||
|
||||
/* put transfer on interrupt queue */
|
||||
@ -2138,7 +2138,7 @@ uhci_device_isoc_open(struct usb_xfer *xfer)
|
||||
td->td_status = htole32(UHCI_TD_IOS);
|
||||
td->td_token = td_token;
|
||||
|
||||
usb2_pc_cpu_flush(td->page_cache);
|
||||
usb_pc_cpu_flush(td->page_cache);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2197,7 +2197,7 @@ uhci_device_isoc_enter(struct usb_xfer *xfer)
|
||||
* pre-compute when the isochronous transfer will be finished:
|
||||
*/
|
||||
xfer->isoc_time_complete =
|
||||
usb2_isoc_time_expand(&sc->sc_bus, nframes) + temp +
|
||||
usb_isoc_time_expand(&sc->sc_bus, nframes) + temp +
|
||||
xfer->nframes;
|
||||
|
||||
/* get the real number of frames */
|
||||
@ -2280,7 +2280,7 @@ uhci_device_isoc_enter(struct usb_xfer *xfer)
|
||||
UHCI_TD_IOS));
|
||||
}
|
||||
|
||||
usb2_pc_cpu_flush(td->page_cache);
|
||||
usb_pc_cpu_flush(td->page_cache);
|
||||
|
||||
#if USB_DEBUG
|
||||
if (uhcidebug > 5) {
|
||||
@ -2415,7 +2415,7 @@ uhci_portreset(uhci_softc_t *sc, uint16_t index)
|
||||
x = URWMASK(UREAD2(sc, port));
|
||||
UWRITE2(sc, port, x | UHCI_PORTSC_PR);
|
||||
|
||||
usb2_pause_mtx(&sc->sc_bus.bus_mtx,
|
||||
usb_pause_mtx(&sc->sc_bus.bus_mtx,
|
||||
USB_MS_TO_TICKS(USB_PORT_ROOT_RESET_DELAY));
|
||||
|
||||
DPRINTFN(4, "uhci port %d reset, status0 = 0x%04x\n",
|
||||
@ -2443,7 +2443,7 @@ uhci_portreset(uhci_softc_t *sc, uint16_t index)
|
||||
|
||||
for (lim = 0; lim < 12; lim++) {
|
||||
|
||||
usb2_pause_mtx(&sc->sc_bus.bus_mtx,
|
||||
usb_pause_mtx(&sc->sc_bus.bus_mtx,
|
||||
USB_MS_TO_TICKS(USB_PORT_RESET_DELAY));
|
||||
|
||||
x = UREAD2(sc, port);
|
||||
@ -2577,7 +2577,7 @@ uhci_roothub_exec(struct usb_device *udev,
|
||||
break;
|
||||
}
|
||||
|
||||
len = usb2_make_str_desc
|
||||
len = usb_make_str_desc
|
||||
(sc->sc_hub_desc.temp,
|
||||
sizeof(sc->sc_hub_desc.temp),
|
||||
str_ptr);
|
||||
@ -2738,14 +2738,14 @@ uhci_roothub_exec(struct usb_device *udev,
|
||||
UWRITE2(sc, port, URWMASK(x));
|
||||
|
||||
/* wait 20ms for resume sequence to complete */
|
||||
usb2_pause_mtx(&sc->sc_bus.bus_mtx, hz / 50);
|
||||
usb_pause_mtx(&sc->sc_bus.bus_mtx, hz / 50);
|
||||
|
||||
/* clear suspend and resume detect */
|
||||
UWRITE2(sc, port, URWMASK(x) & ~(UHCI_PORTSC_RD |
|
||||
UHCI_PORTSC_SUSP));
|
||||
|
||||
/* wait a little bit */
|
||||
usb2_pause_mtx(&sc->sc_bus.bus_mtx, hz / 500);
|
||||
usb_pause_mtx(&sc->sc_bus.bus_mtx, hz / 500);
|
||||
|
||||
sc->sc_isresumed |= (1 << index);
|
||||
|
||||
@ -2837,7 +2837,7 @@ uhci_root_intr(uhci_softc_t *sc)
|
||||
}
|
||||
|
||||
/* restart timer */
|
||||
usb2_callout_reset(&sc->sc_root_intr, hz,
|
||||
usb_callout_reset(&sc->sc_root_intr, hz,
|
||||
(void *)&uhci_root_intr, sc);
|
||||
|
||||
if (sc->sc_hub_idata[0] != 0) {
|
||||
@ -2874,7 +2874,7 @@ uhci_xfer_setup(struct usb_setup_params *parm)
|
||||
xfer->flags_int.bdma_enable = 1;
|
||||
xfer->flags_int.bdma_no_post_sync = 1;
|
||||
|
||||
usb2_transfer_setup_sub(parm);
|
||||
usbd_transfer_setup_sub(parm);
|
||||
|
||||
/* see EHCI HC driver for proof of "ntd" formula */
|
||||
|
||||
@ -2886,7 +2886,7 @@ uhci_xfer_setup(struct usb_setup_params *parm)
|
||||
xfer->flags_int.bdma_enable = 1;
|
||||
xfer->flags_int.bdma_no_post_sync = 1;
|
||||
|
||||
usb2_transfer_setup_sub(parm);
|
||||
usbd_transfer_setup_sub(parm);
|
||||
|
||||
nqh = 1;
|
||||
ntd = ((2 * xfer->nframes)
|
||||
@ -2896,7 +2896,7 @@ uhci_xfer_setup(struct usb_setup_params *parm)
|
||||
xfer->flags_int.bdma_enable = 1;
|
||||
xfer->flags_int.bdma_no_post_sync = 1;
|
||||
|
||||
usb2_transfer_setup_sub(parm);
|
||||
usbd_transfer_setup_sub(parm);
|
||||
|
||||
nqh = 1;
|
||||
ntd = ((2 * xfer->nframes)
|
||||
@ -2906,14 +2906,14 @@ uhci_xfer_setup(struct usb_setup_params *parm)
|
||||
xfer->flags_int.bdma_enable = 1;
|
||||
xfer->flags_int.bdma_no_post_sync = 1;
|
||||
|
||||
usb2_transfer_setup_sub(parm);
|
||||
usbd_transfer_setup_sub(parm);
|
||||
|
||||
nqh = 0;
|
||||
ntd = xfer->nframes;
|
||||
|
||||
} else {
|
||||
|
||||
usb2_transfer_setup_sub(parm);
|
||||
usbd_transfer_setup_sub(parm);
|
||||
|
||||
nqh = 0;
|
||||
ntd = 0;
|
||||
@ -2957,7 +2957,7 @@ uhci_xfer_setup(struct usb_setup_params *parm)
|
||||
}
|
||||
align = (1 << n);
|
||||
|
||||
if (usb2_transfer_setup_sub_malloc(
|
||||
if (usbd_transfer_setup_sub_malloc(
|
||||
parm, &pc, xfer->max_frame_size,
|
||||
align, nfixup)) {
|
||||
parm->err = USB_ERR_NOMEM;
|
||||
@ -2972,7 +2972,7 @@ uhci_xfer_setup(struct usb_setup_params *parm)
|
||||
}
|
||||
last_obj = NULL;
|
||||
|
||||
if (usb2_transfer_setup_sub_malloc(
|
||||
if (usbd_transfer_setup_sub_malloc(
|
||||
parm, &pc, sizeof(uhci_td_t),
|
||||
UHCI_TD_ALIGN, ntd)) {
|
||||
parm->err = USB_ERR_NOMEM;
|
||||
@ -2982,7 +2982,7 @@ uhci_xfer_setup(struct usb_setup_params *parm)
|
||||
for (n = 0; n != ntd; n++) {
|
||||
uhci_td_t *td;
|
||||
|
||||
usb2_get_page(pc + n, 0, &page_info);
|
||||
usbd_get_page(pc + n, 0, &page_info);
|
||||
|
||||
td = page_info.buffer;
|
||||
|
||||
@ -3003,14 +3003,14 @@ uhci_xfer_setup(struct usb_setup_params *parm)
|
||||
|
||||
last_obj = td;
|
||||
|
||||
usb2_pc_cpu_flush(pc + n);
|
||||
usb_pc_cpu_flush(pc + n);
|
||||
}
|
||||
}
|
||||
xfer->td_start[xfer->flags_int.curr_dma_set] = last_obj;
|
||||
|
||||
last_obj = NULL;
|
||||
|
||||
if (usb2_transfer_setup_sub_malloc(
|
||||
if (usbd_transfer_setup_sub_malloc(
|
||||
parm, &pc, sizeof(uhci_qh_t),
|
||||
UHCI_QH_ALIGN, nqh)) {
|
||||
parm->err = USB_ERR_NOMEM;
|
||||
@ -3020,7 +3020,7 @@ uhci_xfer_setup(struct usb_setup_params *parm)
|
||||
for (n = 0; n != nqh; n++) {
|
||||
uhci_qh_t *qh;
|
||||
|
||||
usb2_get_page(pc + n, 0, &page_info);
|
||||
usbd_get_page(pc + n, 0, &page_info);
|
||||
|
||||
qh = page_info.buffer;
|
||||
|
||||
@ -3031,7 +3031,7 @@ uhci_xfer_setup(struct usb_setup_params *parm)
|
||||
|
||||
last_obj = qh;
|
||||
|
||||
usb2_pc_cpu_flush(pc + n);
|
||||
usb_pc_cpu_flush(pc + n);
|
||||
}
|
||||
}
|
||||
xfer->qh_start[xfer->flags_int.curr_dma_set] = last_obj;
|
||||
|
@ -250,7 +250,7 @@ uhci_pci_attach(device_t self)
|
||||
sc->sc_bus.devices_max = UHCI_MAX_DEVICES;
|
||||
|
||||
/* get all DMA memory */
|
||||
if (usb2_bus_mem_alloc_all(&sc->sc_bus, USB_GET_DMA_TAG(self),
|
||||
if (usb_bus_mem_alloc_all(&sc->sc_bus, USB_GET_DMA_TAG(self),
|
||||
&uhci_iterate_hw_softc)) {
|
||||
return ENOMEM;
|
||||
}
|
||||
@ -409,7 +409,7 @@ uhci_pci_detach(device_t self)
|
||||
sc->sc_io_res);
|
||||
sc->sc_io_res = NULL;
|
||||
}
|
||||
usb2_bus_mem_free_all(&sc->sc_bus, &uhci_iterate_hw_softc);
|
||||
usb_bus_mem_free_all(&sc->sc_bus, &uhci_iterate_hw_softc);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include <dev/usb/usb_error.h>
|
||||
#include <dev/usb/usb.h>
|
||||
|
||||
#define USB_DEBUG_VAR usb2_ctrl_debug
|
||||
#define USB_DEBUG_VAR usb_ctrl_debug
|
||||
|
||||
#include <dev/usb/usb_core.h>
|
||||
#include <dev/usb/usb_debug.h>
|
||||
@ -43,66 +43,66 @@
|
||||
|
||||
/* function prototypes */
|
||||
|
||||
static device_probe_t usb2_probe;
|
||||
static device_attach_t usb2_attach;
|
||||
static device_detach_t usb2_detach;
|
||||
static device_probe_t usb_probe;
|
||||
static device_attach_t usb_attach;
|
||||
static device_detach_t usb_detach;
|
||||
|
||||
static void usb2_attach_sub(device_t, struct usb_bus *);
|
||||
static void usb2_post_init(void *);
|
||||
static void usb_attach_sub(device_t, struct usb_bus *);
|
||||
static void usb_post_init(void *);
|
||||
|
||||
/* static variables */
|
||||
|
||||
#if USB_DEBUG
|
||||
static int usb2_ctrl_debug = 0;
|
||||
static int usb_ctrl_debug = 0;
|
||||
|
||||
SYSCTL_NODE(_hw_usb, OID_AUTO, ctrl, CTLFLAG_RW, 0, "USB controller");
|
||||
SYSCTL_INT(_hw_usb_ctrl, OID_AUTO, debug, CTLFLAG_RW, &usb2_ctrl_debug, 0,
|
||||
SYSCTL_INT(_hw_usb_ctrl, OID_AUTO, debug, CTLFLAG_RW, &usb_ctrl_debug, 0,
|
||||
"Debug level");
|
||||
#endif
|
||||
|
||||
static uint8_t usb2_post_init_called = 0;
|
||||
static uint8_t usb_post_init_called = 0;
|
||||
|
||||
static devclass_t usb2_devclass;
|
||||
static devclass_t usb_devclass;
|
||||
|
||||
static device_method_t usb2_methods[] = {
|
||||
DEVMETHOD(device_probe, usb2_probe),
|
||||
DEVMETHOD(device_attach, usb2_attach),
|
||||
DEVMETHOD(device_detach, usb2_detach),
|
||||
static device_method_t usb_methods[] = {
|
||||
DEVMETHOD(device_probe, usb_probe),
|
||||
DEVMETHOD(device_attach, usb_attach),
|
||||
DEVMETHOD(device_detach, usb_detach),
|
||||
DEVMETHOD(device_suspend, bus_generic_suspend),
|
||||
DEVMETHOD(device_resume, bus_generic_resume),
|
||||
DEVMETHOD(device_shutdown, bus_generic_shutdown),
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
static driver_t usb2_driver = {
|
||||
static driver_t usb_driver = {
|
||||
.name = "usbus",
|
||||
.methods = usb2_methods,
|
||||
.methods = usb_methods,
|
||||
.size = 0,
|
||||
};
|
||||
|
||||
DRIVER_MODULE(usbus, ohci, usb2_driver, usb2_devclass, 0, 0);
|
||||
DRIVER_MODULE(usbus, uhci, usb2_driver, usb2_devclass, 0, 0);
|
||||
DRIVER_MODULE(usbus, ehci, usb2_driver, usb2_devclass, 0, 0);
|
||||
DRIVER_MODULE(usbus, at91_udp, usb2_driver, usb2_devclass, 0, 0);
|
||||
DRIVER_MODULE(usbus, uss820, usb2_driver, usb2_devclass, 0, 0);
|
||||
DRIVER_MODULE(usbus, ohci, usb_driver, usb_devclass, 0, 0);
|
||||
DRIVER_MODULE(usbus, uhci, usb_driver, usb_devclass, 0, 0);
|
||||
DRIVER_MODULE(usbus, ehci, usb_driver, usb_devclass, 0, 0);
|
||||
DRIVER_MODULE(usbus, at91_udp, usb_driver, usb_devclass, 0, 0);
|
||||
DRIVER_MODULE(usbus, uss820, usb_driver, usb_devclass, 0, 0);
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_probe
|
||||
* usb_probe
|
||||
*
|
||||
* This function is called from "{ehci,ohci,uhci}_pci_attach()".
|
||||
*------------------------------------------------------------------------*/
|
||||
static int
|
||||
usb2_probe(device_t dev)
|
||||
usb_probe(device_t dev)
|
||||
{
|
||||
DPRINTF("\n");
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_attach
|
||||
* usb_attach
|
||||
*------------------------------------------------------------------------*/
|
||||
static int
|
||||
usb2_attach(device_t dev)
|
||||
usb_attach(device_t dev)
|
||||
{
|
||||
struct usb_bus *bus = device_get_ivars(dev);
|
||||
|
||||
@ -116,20 +116,20 @@ usb2_attach(device_t dev)
|
||||
/* delay vfs_mountroot until the bus is explored */
|
||||
bus->bus_roothold = root_mount_hold(device_get_nameunit(dev));
|
||||
|
||||
if (usb2_post_init_called) {
|
||||
if (usb_post_init_called) {
|
||||
mtx_lock(&Giant);
|
||||
usb2_attach_sub(dev, bus);
|
||||
usb_attach_sub(dev, bus);
|
||||
mtx_unlock(&Giant);
|
||||
usb2_needs_explore(bus, 1);
|
||||
usb_needs_explore(bus, 1);
|
||||
}
|
||||
return (0); /* return success */
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_detach
|
||||
* usb_detach
|
||||
*------------------------------------------------------------------------*/
|
||||
static int
|
||||
usb2_detach(device_t dev)
|
||||
usb_detach(device_t dev)
|
||||
{
|
||||
struct usb_bus *bus = device_get_softc(dev);
|
||||
|
||||
@ -140,7 +140,7 @@ usb2_detach(device_t dev)
|
||||
return (0);
|
||||
}
|
||||
/* Stop power watchdog */
|
||||
usb2_callout_drain(&bus->power_wdog);
|
||||
usb_callout_drain(&bus->power_wdog);
|
||||
|
||||
/* Let the USB explore process detach all devices. */
|
||||
if (bus->bus_roothold != NULL) {
|
||||
@ -149,40 +149,40 @@ usb2_detach(device_t dev)
|
||||
}
|
||||
|
||||
USB_BUS_LOCK(bus);
|
||||
if (usb2_proc_msignal(&bus->explore_proc,
|
||||
if (usb_proc_msignal(&bus->explore_proc,
|
||||
&bus->detach_msg[0], &bus->detach_msg[1])) {
|
||||
/* ignore */
|
||||
}
|
||||
/* Wait for detach to complete */
|
||||
|
||||
usb2_proc_mwait(&bus->explore_proc,
|
||||
usb_proc_mwait(&bus->explore_proc,
|
||||
&bus->detach_msg[0], &bus->detach_msg[1]);
|
||||
|
||||
USB_BUS_UNLOCK(bus);
|
||||
|
||||
/* Get rid of USB callback processes */
|
||||
|
||||
usb2_proc_free(&bus->giant_callback_proc);
|
||||
usb2_proc_free(&bus->non_giant_callback_proc);
|
||||
usb_proc_free(&bus->giant_callback_proc);
|
||||
usb_proc_free(&bus->non_giant_callback_proc);
|
||||
|
||||
/* Get rid of USB explore process */
|
||||
|
||||
usb2_proc_free(&bus->explore_proc);
|
||||
usb_proc_free(&bus->explore_proc);
|
||||
|
||||
/* Get rid of control transfer process */
|
||||
|
||||
usb2_proc_free(&bus->control_xfer_proc);
|
||||
usb_proc_free(&bus->control_xfer_proc);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_bus_explore
|
||||
* usb_bus_explore
|
||||
*
|
||||
* This function is used to explore the device tree from the root.
|
||||
*------------------------------------------------------------------------*/
|
||||
static void
|
||||
usb2_bus_explore(struct usb_proc_msg *pm)
|
||||
usb_bus_explore(struct usb_proc_msg *pm)
|
||||
{
|
||||
struct usb_bus *bus;
|
||||
struct usb_device *udev;
|
||||
@ -207,7 +207,7 @@ usb2_bus_explore(struct usb_proc_msg *pm)
|
||||
/*
|
||||
* First update the USB power state!
|
||||
*/
|
||||
usb2_bus_powerd(bus);
|
||||
usb_bus_powerd(bus);
|
||||
/*
|
||||
* Explore the Root USB HUB. This call can sleep,
|
||||
* exiting Giant, which is actually Giant.
|
||||
@ -225,12 +225,12 @@ usb2_bus_explore(struct usb_proc_msg *pm)
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_bus_detach
|
||||
* usb_bus_detach
|
||||
*
|
||||
* This function is used to detach the device tree from the root.
|
||||
*------------------------------------------------------------------------*/
|
||||
static void
|
||||
usb2_bus_detach(struct usb_proc_msg *pm)
|
||||
usb_bus_detach(struct usb_proc_msg *pm)
|
||||
{
|
||||
struct usb_bus *bus;
|
||||
struct usb_device *udev;
|
||||
@ -252,7 +252,7 @@ usb2_bus_detach(struct usb_proc_msg *pm)
|
||||
* Free USB Root device, but not any sub-devices, hence they
|
||||
* are freed by the caller of this function:
|
||||
*/
|
||||
usb2_free_device(udev,
|
||||
usb_free_device(udev,
|
||||
USB_UNCFG_FLAG_FREE_EP0);
|
||||
|
||||
mtx_unlock(&Giant);
|
||||
@ -262,29 +262,29 @@ usb2_bus_detach(struct usb_proc_msg *pm)
|
||||
}
|
||||
|
||||
static void
|
||||
usb2_power_wdog(void *arg)
|
||||
usb_power_wdog(void *arg)
|
||||
{
|
||||
struct usb_bus *bus = arg;
|
||||
|
||||
USB_BUS_LOCK_ASSERT(bus, MA_OWNED);
|
||||
|
||||
usb2_callout_reset(&bus->power_wdog,
|
||||
4 * hz, usb2_power_wdog, arg);
|
||||
usb_callout_reset(&bus->power_wdog,
|
||||
4 * hz, usb_power_wdog, arg);
|
||||
|
||||
USB_BUS_UNLOCK(bus);
|
||||
|
||||
usb2_bus_power_update(bus);
|
||||
usb_bus_power_update(bus);
|
||||
|
||||
USB_BUS_LOCK(bus);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_bus_attach
|
||||
* usb_bus_attach
|
||||
*
|
||||
* This function attaches USB in context of the explore thread.
|
||||
*------------------------------------------------------------------------*/
|
||||
static void
|
||||
usb2_bus_attach(struct usb_proc_msg *pm)
|
||||
usb_bus_attach(struct usb_proc_msg *pm)
|
||||
{
|
||||
struct usb_bus *bus;
|
||||
struct usb_device *child;
|
||||
@ -342,10 +342,10 @@ usb2_bus_attach(struct usb_proc_msg *pm)
|
||||
|
||||
/* Allocate the Root USB device */
|
||||
|
||||
child = usb2_alloc_device(bus->bdev, bus, NULL, 0, 0, 1,
|
||||
child = usb_alloc_device(bus->bdev, bus, NULL, 0, 0, 1,
|
||||
speed, USB_MODE_HOST);
|
||||
if (child) {
|
||||
err = usb2_probe_and_attach(child,
|
||||
err = usb_probe_and_attach(child,
|
||||
USB_IFACE_INDEX_ANY);
|
||||
if (!err) {
|
||||
if ((bus->devices[USB_ROOT_HUB_ADDR] == NULL) ||
|
||||
@ -362,68 +362,68 @@ usb2_bus_attach(struct usb_proc_msg *pm)
|
||||
|
||||
if (err) {
|
||||
device_printf(bus->bdev, "Root HUB problem, error=%s\n",
|
||||
usb2_errstr(err));
|
||||
usbd_errstr(err));
|
||||
}
|
||||
|
||||
/* set softc - we are ready */
|
||||
device_set_softc(dev, bus);
|
||||
|
||||
/* start watchdog */
|
||||
usb2_power_wdog(bus);
|
||||
usb_power_wdog(bus);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_attach_sub
|
||||
* usb_attach_sub
|
||||
*
|
||||
* This function creates a thread which runs the USB attach code. It
|
||||
* is factored out, hence it can be called at two different places in
|
||||
* time. During bootup this function is called from
|
||||
* "usb2_post_init". During hot-plug it is called directly from the
|
||||
* "usb2_attach()" method.
|
||||
* "usb_post_init". During hot-plug it is called directly from the
|
||||
* "usb_attach()" method.
|
||||
*------------------------------------------------------------------------*/
|
||||
static void
|
||||
usb2_attach_sub(device_t dev, struct usb_bus *bus)
|
||||
usb_attach_sub(device_t dev, struct usb_bus *bus)
|
||||
{
|
||||
const char *pname = device_get_nameunit(dev);
|
||||
|
||||
/* Initialise USB process messages */
|
||||
bus->explore_msg[0].hdr.pm_callback = &usb2_bus_explore;
|
||||
bus->explore_msg[0].hdr.pm_callback = &usb_bus_explore;
|
||||
bus->explore_msg[0].bus = bus;
|
||||
bus->explore_msg[1].hdr.pm_callback = &usb2_bus_explore;
|
||||
bus->explore_msg[1].hdr.pm_callback = &usb_bus_explore;
|
||||
bus->explore_msg[1].bus = bus;
|
||||
|
||||
bus->detach_msg[0].hdr.pm_callback = &usb2_bus_detach;
|
||||
bus->detach_msg[0].hdr.pm_callback = &usb_bus_detach;
|
||||
bus->detach_msg[0].bus = bus;
|
||||
bus->detach_msg[1].hdr.pm_callback = &usb2_bus_detach;
|
||||
bus->detach_msg[1].hdr.pm_callback = &usb_bus_detach;
|
||||
bus->detach_msg[1].bus = bus;
|
||||
|
||||
bus->attach_msg[0].hdr.pm_callback = &usb2_bus_attach;
|
||||
bus->attach_msg[0].hdr.pm_callback = &usb_bus_attach;
|
||||
bus->attach_msg[0].bus = bus;
|
||||
bus->attach_msg[1].hdr.pm_callback = &usb2_bus_attach;
|
||||
bus->attach_msg[1].hdr.pm_callback = &usb_bus_attach;
|
||||
bus->attach_msg[1].bus = bus;
|
||||
|
||||
/* Create USB explore and callback processes */
|
||||
|
||||
if (usb2_proc_create(&bus->giant_callback_proc,
|
||||
if (usb_proc_create(&bus->giant_callback_proc,
|
||||
&bus->bus_mtx, pname, USB_PRI_MED)) {
|
||||
printf("WARNING: Creation of USB Giant "
|
||||
"callback process failed.\n");
|
||||
} else if (usb2_proc_create(&bus->non_giant_callback_proc,
|
||||
} else if (usb_proc_create(&bus->non_giant_callback_proc,
|
||||
&bus->bus_mtx, pname, USB_PRI_HIGH)) {
|
||||
printf("WARNING: Creation of USB non-Giant "
|
||||
"callback process failed.\n");
|
||||
} else if (usb2_proc_create(&bus->explore_proc,
|
||||
} else if (usb_proc_create(&bus->explore_proc,
|
||||
&bus->bus_mtx, pname, USB_PRI_MED)) {
|
||||
printf("WARNING: Creation of USB explore "
|
||||
"process failed.\n");
|
||||
} else if (usb2_proc_create(&bus->control_xfer_proc,
|
||||
} else if (usb_proc_create(&bus->control_xfer_proc,
|
||||
&bus->bus_mtx, pname, USB_PRI_MED)) {
|
||||
printf("WARNING: Creation of USB control transfer "
|
||||
"process failed.\n");
|
||||
} else {
|
||||
/* Get final attach going */
|
||||
USB_BUS_LOCK(bus);
|
||||
if (usb2_proc_msignal(&bus->explore_proc,
|
||||
if (usb_proc_msignal(&bus->explore_proc,
|
||||
&bus->attach_msg[0], &bus->attach_msg[1])) {
|
||||
/* ignore */
|
||||
}
|
||||
@ -432,13 +432,13 @@ usb2_attach_sub(device_t dev, struct usb_bus *bus)
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_post_init
|
||||
* usb_post_init
|
||||
*
|
||||
* This function is called to attach all USB busses that were found
|
||||
* during bootup.
|
||||
*------------------------------------------------------------------------*/
|
||||
static void
|
||||
usb2_post_init(void *arg)
|
||||
usb_post_init(void *arg)
|
||||
{
|
||||
struct usb_bus *bus;
|
||||
devclass_t dc;
|
||||
@ -448,9 +448,9 @@ usb2_post_init(void *arg)
|
||||
|
||||
mtx_lock(&Giant);
|
||||
|
||||
usb2_devclass_ptr = devclass_find("usbus");
|
||||
usb_devclass_ptr = devclass_find("usbus");
|
||||
|
||||
dc = usb2_devclass_ptr;
|
||||
dc = usb_devclass_ptr;
|
||||
if (dc) {
|
||||
max = devclass_get_maxunit(dc) + 1;
|
||||
for (n = 0; n != max; n++) {
|
||||
@ -459,7 +459,7 @@ usb2_post_init(void *arg)
|
||||
bus = device_get_ivars(dev);
|
||||
if (bus) {
|
||||
mtx_lock(&Giant);
|
||||
usb2_attach_sub(dev, bus);
|
||||
usb_attach_sub(dev, bus);
|
||||
mtx_unlock(&Giant);
|
||||
}
|
||||
}
|
||||
@ -467,69 +467,69 @@ usb2_post_init(void *arg)
|
||||
} else {
|
||||
DPRINTFN(0, "no devclass\n");
|
||||
}
|
||||
usb2_post_init_called = 1;
|
||||
usb_post_init_called = 1;
|
||||
|
||||
/* explore all USB busses in parallell */
|
||||
|
||||
usb2_needs_explore_all();
|
||||
usb_needs_explore_all();
|
||||
|
||||
mtx_unlock(&Giant);
|
||||
}
|
||||
|
||||
SYSINIT(usb2_post_init, SI_SUB_KICK_SCHEDULER, SI_ORDER_ANY, usb2_post_init, NULL);
|
||||
SYSUNINIT(usb2_bus_unload, SI_SUB_KLD, SI_ORDER_ANY, usb2_bus_unload, NULL);
|
||||
SYSINIT(usb_post_init, SI_SUB_KICK_SCHEDULER, SI_ORDER_ANY, usb_post_init, NULL);
|
||||
SYSUNINIT(usb_bus_unload, SI_SUB_KLD, SI_ORDER_ANY, usb_bus_unload, NULL);
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_bus_mem_flush_all_cb
|
||||
* usb_bus_mem_flush_all_cb
|
||||
*------------------------------------------------------------------------*/
|
||||
#if USB_HAVE_BUSDMA
|
||||
static void
|
||||
usb2_bus_mem_flush_all_cb(struct usb_bus *bus, struct usb_page_cache *pc,
|
||||
usb_bus_mem_flush_all_cb(struct usb_bus *bus, struct usb_page_cache *pc,
|
||||
struct usb_page *pg, usb_size_t size, usb_size_t align)
|
||||
{
|
||||
usb2_pc_cpu_flush(pc);
|
||||
usb_pc_cpu_flush(pc);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_bus_mem_flush_all - factored out code
|
||||
* usb_bus_mem_flush_all - factored out code
|
||||
*------------------------------------------------------------------------*/
|
||||
#if USB_HAVE_BUSDMA
|
||||
void
|
||||
usb2_bus_mem_flush_all(struct usb_bus *bus, usb_bus_mem_cb_t *cb)
|
||||
usb_bus_mem_flush_all(struct usb_bus *bus, usb_bus_mem_cb_t *cb)
|
||||
{
|
||||
if (cb) {
|
||||
cb(bus, &usb2_bus_mem_flush_all_cb);
|
||||
cb(bus, &usb_bus_mem_flush_all_cb);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_bus_mem_alloc_all_cb
|
||||
* usb_bus_mem_alloc_all_cb
|
||||
*------------------------------------------------------------------------*/
|
||||
#if USB_HAVE_BUSDMA
|
||||
static void
|
||||
usb2_bus_mem_alloc_all_cb(struct usb_bus *bus, struct usb_page_cache *pc,
|
||||
usb_bus_mem_alloc_all_cb(struct usb_bus *bus, struct usb_page_cache *pc,
|
||||
struct usb_page *pg, usb_size_t size, usb_size_t align)
|
||||
{
|
||||
/* need to initialize the page cache */
|
||||
pc->tag_parent = bus->dma_parent_tag;
|
||||
|
||||
if (usb2_pc_alloc_mem(pc, pg, size, align)) {
|
||||
if (usb_pc_alloc_mem(pc, pg, size, align)) {
|
||||
bus->alloc_failed = 1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_bus_mem_alloc_all - factored out code
|
||||
* usb_bus_mem_alloc_all - factored out code
|
||||
*
|
||||
* Returns:
|
||||
* 0: Success
|
||||
* Else: Failure
|
||||
*------------------------------------------------------------------------*/
|
||||
uint8_t
|
||||
usb2_bus_mem_alloc_all(struct usb_bus *bus, bus_dma_tag_t dmat,
|
||||
usb_bus_mem_alloc_all(struct usb_bus *bus, bus_dma_tag_t dmat,
|
||||
usb_bus_mem_cb_t *cb)
|
||||
{
|
||||
bus->alloc_failed = 0;
|
||||
@ -537,13 +537,13 @@ usb2_bus_mem_alloc_all(struct usb_bus *bus, bus_dma_tag_t dmat,
|
||||
mtx_init(&bus->bus_mtx, device_get_nameunit(bus->parent),
|
||||
NULL, MTX_DEF | MTX_RECURSE);
|
||||
|
||||
usb2_callout_init_mtx(&bus->power_wdog,
|
||||
usb_callout_init_mtx(&bus->power_wdog,
|
||||
&bus->bus_mtx, 0);
|
||||
|
||||
TAILQ_INIT(&bus->intr_q.head);
|
||||
|
||||
#if USB_HAVE_BUSDMA
|
||||
usb2_dma_tag_setup(bus->dma_parent_tag, bus->dma_tags,
|
||||
usb_dma_tag_setup(bus->dma_parent_tag, bus->dma_tags,
|
||||
dmat, &bus->bus_mtx, NULL, 32, USB_BUS_DMA_TAG_MAX);
|
||||
#endif
|
||||
if ((bus->devices_max > USB_MAX_DEVICES) ||
|
||||
@ -555,38 +555,38 @@ usb2_bus_mem_alloc_all(struct usb_bus *bus, bus_dma_tag_t dmat,
|
||||
}
|
||||
#if USB_HAVE_BUSDMA
|
||||
if (cb) {
|
||||
cb(bus, &usb2_bus_mem_alloc_all_cb);
|
||||
cb(bus, &usb_bus_mem_alloc_all_cb);
|
||||
}
|
||||
#endif
|
||||
if (bus->alloc_failed) {
|
||||
usb2_bus_mem_free_all(bus, cb);
|
||||
usb_bus_mem_free_all(bus, cb);
|
||||
}
|
||||
return (bus->alloc_failed);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_bus_mem_free_all_cb
|
||||
* usb_bus_mem_free_all_cb
|
||||
*------------------------------------------------------------------------*/
|
||||
#if USB_HAVE_BUSDMA
|
||||
static void
|
||||
usb2_bus_mem_free_all_cb(struct usb_bus *bus, struct usb_page_cache *pc,
|
||||
usb_bus_mem_free_all_cb(struct usb_bus *bus, struct usb_page_cache *pc,
|
||||
struct usb_page *pg, usb_size_t size, usb_size_t align)
|
||||
{
|
||||
usb2_pc_free_mem(pc);
|
||||
usb_pc_free_mem(pc);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_bus_mem_free_all - factored out code
|
||||
* usb_bus_mem_free_all - factored out code
|
||||
*------------------------------------------------------------------------*/
|
||||
void
|
||||
usb2_bus_mem_free_all(struct usb_bus *bus, usb_bus_mem_cb_t *cb)
|
||||
usb_bus_mem_free_all(struct usb_bus *bus, usb_bus_mem_cb_t *cb)
|
||||
{
|
||||
#if USB_HAVE_BUSDMA
|
||||
if (cb) {
|
||||
cb(bus, &usb2_bus_mem_free_all_cb);
|
||||
cb(bus, &usb_bus_mem_free_all_cb);
|
||||
}
|
||||
usb2_dma_tag_unsetup(bus->dma_parent_tag);
|
||||
usb_dma_tag_unsetup(bus->dma_parent_tag);
|
||||
#endif
|
||||
|
||||
mtx_destroy(&bus->bus_mtx);
|
||||
|
@ -303,7 +303,7 @@ uss820dci_setup_rx(struct uss820dci_td *td)
|
||||
USS820_RXCON, temp);
|
||||
|
||||
/* copy data into real buffer */
|
||||
usb2_copy_in(td->pc, 0, &req, sizeof(req));
|
||||
usbd_copy_in(td->pc, 0, &req, sizeof(req));
|
||||
|
||||
td->offset = sizeof(req);
|
||||
td->remainder = 0;
|
||||
@ -446,7 +446,7 @@ uss820dci_data_rx(struct uss820dci_td *td)
|
||||
return (0); /* we are complete */
|
||||
}
|
||||
while (count > 0) {
|
||||
usb2_get_page(td->pc, td->offset, &buf_res);
|
||||
usbd_get_page(td->pc, td->offset, &buf_res);
|
||||
|
||||
/* get correct length */
|
||||
if (buf_res.length > count) {
|
||||
@ -545,7 +545,7 @@ uss820dci_data_tx(struct uss820dci_td *td)
|
||||
count_copy = count;
|
||||
while (count > 0) {
|
||||
|
||||
usb2_get_page(td->pc, td->offset, &buf_res);
|
||||
usbd_get_page(td->pc, td->offset, &buf_res);
|
||||
|
||||
/* get correct length */
|
||||
if (buf_res.length > count) {
|
||||
@ -830,7 +830,7 @@ uss820dci_setup_standard_chain(struct usb_xfer *xfer)
|
||||
|
||||
DPRINTFN(9, "addr=%d endpt=%d sumlen=%d speed=%d\n",
|
||||
xfer->address, UE_GET_ADDR(xfer->endpointno),
|
||||
xfer->sumlen, usb2_get_speed(xfer->xroot->udev));
|
||||
xfer->sumlen, usbd_get_speed(xfer->xroot->udev));
|
||||
|
||||
temp.max_frame_size = xfer->max_frame_size;
|
||||
|
||||
@ -1030,11 +1030,11 @@ uss820dci_start_standard_chain(struct usb_xfer *xfer)
|
||||
uss820dci_intr_set(xfer, 1);
|
||||
|
||||
/* put transfer on interrupt queue */
|
||||
usb2_transfer_enqueue(&xfer->xroot->bus->intr_q, xfer);
|
||||
usbd_transfer_enqueue(&xfer->xroot->bus->intr_q, xfer);
|
||||
|
||||
/* start timeout, if any */
|
||||
if (xfer->timeout != 0) {
|
||||
usb2_transfer_timeout_ms(xfer,
|
||||
usbd_transfer_timeout_ms(xfer,
|
||||
&uss820dci_timeout, xfer->timeout);
|
||||
}
|
||||
}
|
||||
@ -1179,7 +1179,7 @@ uss820dci_device_done(struct usb_xfer *xfer, usb_error_t error)
|
||||
uss820dci_intr_set(xfer, 0);
|
||||
}
|
||||
/* dequeue transfer and start next transfer */
|
||||
usb2_transfer_done(xfer, error);
|
||||
usbd_transfer_done(xfer, error);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1341,7 +1341,7 @@ uss820dci_init(struct uss820dci_softc *sc)
|
||||
uss820dci_pull_down(sc);
|
||||
|
||||
/* wait 10ms for pulldown to stabilise */
|
||||
usb2_pause_mtx(&sc->sc_bus.bus_mtx, hz / 100);
|
||||
usb_pause_mtx(&sc->sc_bus.bus_mtx, hz / 100);
|
||||
|
||||
/* check hardware revision */
|
||||
temp = USS820_READ_1(sc, USS820_REV);
|
||||
@ -1676,7 +1676,7 @@ uss820dci_device_isoc_fs_enter(struct usb_xfer *xfer)
|
||||
* pre-compute when the isochronous transfer will be finished:
|
||||
*/
|
||||
xfer->isoc_time_complete =
|
||||
usb2_isoc_time_expand(&sc->sc_bus, nframes) + temp +
|
||||
usb_isoc_time_expand(&sc->sc_bus, nframes) + temp +
|
||||
xfer->nframes;
|
||||
|
||||
/* compute frame number for next insertion */
|
||||
@ -2201,7 +2201,7 @@ uss820dci_xfer_setup(struct usb_setup_params *parm)
|
||||
parm->hc_max_packet_count = 1;
|
||||
parm->hc_max_frame_size = 0x500;
|
||||
|
||||
usb2_transfer_setup_sub(parm);
|
||||
usbd_transfer_setup_sub(parm);
|
||||
|
||||
/*
|
||||
* compute maximum number of TDs
|
||||
@ -2228,7 +2228,7 @@ uss820dci_xfer_setup(struct usb_setup_params *parm)
|
||||
}
|
||||
|
||||
/*
|
||||
* check if "usb2_transfer_setup_sub" set an error
|
||||
* check if "usbd_transfer_setup_sub" set an error
|
||||
*/
|
||||
if (parm->err) {
|
||||
return;
|
||||
|
@ -137,7 +137,7 @@ uss820_atmelarm_attach(device_t dev)
|
||||
sc->sc_bus.devices_max = USS820_MAX_DEVICES;
|
||||
|
||||
/* get all DMA memory */
|
||||
if (usb2_bus_mem_alloc_all(&sc->sc_bus,
|
||||
if (usb_bus_mem_alloc_all(&sc->sc_bus,
|
||||
USB_GET_DMA_TAG(dev), NULL)) {
|
||||
return (ENOMEM);
|
||||
}
|
||||
@ -227,7 +227,7 @@ uss820_atmelarm_detach(device_t dev)
|
||||
sc->sc_io_res);
|
||||
sc->sc_io_res = NULL;
|
||||
}
|
||||
usb2_bus_mem_free_all(&sc->sc_bus, NULL);
|
||||
usb_bus_mem_free_all(&sc->sc_bus, NULL);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ uhid_intr_callback(struct usb_xfer *xfer)
|
||||
DPRINTF("transferred!\n");
|
||||
|
||||
if (xfer->actlen >= sc->sc_isize) {
|
||||
usb2_fifo_put_data(
|
||||
usb_fifo_put_data(
|
||||
sc->sc_fifo.fp[USB_FIFO_RX],
|
||||
xfer->frbuffers,
|
||||
0, sc->sc_isize, 1);
|
||||
@ -171,10 +171,10 @@ uhid_intr_callback(struct usb_xfer *xfer)
|
||||
|
||||
case USB_ST_SETUP:
|
||||
re_submit:
|
||||
if (usb2_fifo_put_bytes_max(
|
||||
if (usb_fifo_put_bytes_max(
|
||||
sc->sc_fifo.fp[USB_FIFO_RX]) != 0) {
|
||||
xfer->frlengths[0] = sc->sc_isize;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -227,14 +227,14 @@ uhid_write_callback(struct usb_xfer *xfer)
|
||||
/* try to extract the ID byte */
|
||||
if (sc->sc_oid) {
|
||||
|
||||
if (usb2_fifo_get_data(
|
||||
if (usb_fifo_get_data(
|
||||
sc->sc_fifo.fp[USB_FIFO_TX],
|
||||
xfer->frbuffers,
|
||||
0, 1, &actlen, 0)) {
|
||||
if (actlen != 1) {
|
||||
goto tr_error;
|
||||
}
|
||||
usb2_copy_out(xfer->frbuffers, 0, &id, 1);
|
||||
usbd_copy_out(xfer->frbuffers, 0, &id, 1);
|
||||
|
||||
} else {
|
||||
return;
|
||||
@ -246,7 +246,7 @@ uhid_write_callback(struct usb_xfer *xfer)
|
||||
id = 0;
|
||||
}
|
||||
|
||||
if (usb2_fifo_get_data(
|
||||
if (usb_fifo_get_data(
|
||||
sc->sc_fifo.fp[USB_FIFO_TX],
|
||||
xfer->frbuffers + 1,
|
||||
0, UHID_BSIZE, &actlen, 1)) {
|
||||
@ -257,19 +257,19 @@ uhid_write_callback(struct usb_xfer *xfer)
|
||||
(&req, sc->sc_iface_no,
|
||||
UHID_OUTPUT_REPORT, id, size);
|
||||
|
||||
usb2_copy_in(xfer->frbuffers, 0, &req, sizeof(req));
|
||||
usbd_copy_in(xfer->frbuffers, 0, &req, sizeof(req));
|
||||
|
||||
xfer->frlengths[0] = sizeof(req);
|
||||
xfer->frlengths[1] = size;
|
||||
xfer->nframes = xfer->frlengths[1] ? 2 : 1;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
}
|
||||
return;
|
||||
|
||||
default:
|
||||
tr_error:
|
||||
/* bomb out */
|
||||
usb2_fifo_get_data_error(sc->sc_fifo.fp[USB_FIFO_TX]);
|
||||
usb_fifo_get_data_error(sc->sc_fifo.fp[USB_FIFO_TX]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -282,30 +282,30 @@ uhid_read_callback(struct usb_xfer *xfer)
|
||||
|
||||
switch (USB_GET_STATE(xfer)) {
|
||||
case USB_ST_TRANSFERRED:
|
||||
usb2_fifo_put_data(sc->sc_fifo.fp[USB_FIFO_RX], xfer->frbuffers,
|
||||
usb_fifo_put_data(sc->sc_fifo.fp[USB_FIFO_RX], xfer->frbuffers,
|
||||
sizeof(req), sc->sc_isize, 1);
|
||||
return;
|
||||
|
||||
case USB_ST_SETUP:
|
||||
|
||||
if (usb2_fifo_put_bytes_max(sc->sc_fifo.fp[USB_FIFO_RX]) > 0) {
|
||||
if (usb_fifo_put_bytes_max(sc->sc_fifo.fp[USB_FIFO_RX]) > 0) {
|
||||
|
||||
uhid_fill_get_report
|
||||
(&req, sc->sc_iface_no, UHID_INPUT_REPORT,
|
||||
sc->sc_iid, sc->sc_isize);
|
||||
|
||||
usb2_copy_in(xfer->frbuffers, 0, &req, sizeof(req));
|
||||
usbd_copy_in(xfer->frbuffers, 0, &req, sizeof(req));
|
||||
|
||||
xfer->frlengths[0] = sizeof(req);
|
||||
xfer->frlengths[1] = sc->sc_isize;
|
||||
xfer->nframes = xfer->frlengths[1] ? 2 : 1;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
}
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
/* bomb out */
|
||||
usb2_fifo_put_data_error(sc->sc_fifo.fp[USB_FIFO_RX]);
|
||||
usb_fifo_put_data_error(sc->sc_fifo.fp[USB_FIFO_RX]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -346,9 +346,9 @@ uhid_start_read(struct usb_fifo *fifo)
|
||||
struct uhid_softc *sc = fifo->priv_sc0;
|
||||
|
||||
if (sc->sc_flags & UHID_FLAG_IMMED) {
|
||||
usb2_transfer_start(sc->sc_xfer[UHID_CTRL_DT_RD]);
|
||||
usbd_transfer_start(sc->sc_xfer[UHID_CTRL_DT_RD]);
|
||||
} else {
|
||||
usb2_transfer_start(sc->sc_xfer[UHID_INTR_DT_RD]);
|
||||
usbd_transfer_start(sc->sc_xfer[UHID_INTR_DT_RD]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -357,8 +357,8 @@ uhid_stop_read(struct usb_fifo *fifo)
|
||||
{
|
||||
struct uhid_softc *sc = fifo->priv_sc0;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[UHID_CTRL_DT_RD]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UHID_INTR_DT_RD]);
|
||||
usbd_transfer_stop(sc->sc_xfer[UHID_CTRL_DT_RD]);
|
||||
usbd_transfer_stop(sc->sc_xfer[UHID_INTR_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -366,7 +366,7 @@ uhid_start_write(struct usb_fifo *fifo)
|
||||
{
|
||||
struct uhid_softc *sc = fifo->priv_sc0;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[UHID_CTRL_DT_WR]);
|
||||
usbd_transfer_start(sc->sc_xfer[UHID_CTRL_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -374,7 +374,7 @@ uhid_stop_write(struct usb_fifo *fifo)
|
||||
{
|
||||
struct uhid_softc *sc = fifo->priv_sc0;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[UHID_CTRL_DT_WR]);
|
||||
usbd_transfer_stop(sc->sc_xfer[UHID_CTRL_DT_WR]);
|
||||
}
|
||||
|
||||
static int
|
||||
@ -393,7 +393,7 @@ uhid_get_report(struct uhid_softc *sc, uint8_t type,
|
||||
}
|
||||
free_data = 1;
|
||||
}
|
||||
err = usb2_req_get_report(sc->sc_udev, NULL, kern_data,
|
||||
err = usbd_req_get_report(sc->sc_udev, NULL, kern_data,
|
||||
len, sc->sc_iface_index, type, id);
|
||||
if (err) {
|
||||
err = ENXIO;
|
||||
@ -433,7 +433,7 @@ uhid_set_report(struct uhid_softc *sc, uint8_t type,
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
err = usb2_req_set_report(sc->sc_udev, NULL, kern_data,
|
||||
err = usbd_req_set_report(sc->sc_udev, NULL, kern_data,
|
||||
len, sc->sc_iface_index, type, id);
|
||||
if (err) {
|
||||
err = ENXIO;
|
||||
@ -459,13 +459,13 @@ uhid_open(struct usb_fifo *fifo, int fflags)
|
||||
/* reset flags */
|
||||
sc->sc_flags &= ~UHID_FLAG_IMMED;
|
||||
|
||||
if (usb2_fifo_alloc_buffer(fifo,
|
||||
if (usb_fifo_alloc_buffer(fifo,
|
||||
sc->sc_isize + 1, UHID_FRAME_NUM)) {
|
||||
return (ENOMEM);
|
||||
}
|
||||
}
|
||||
if (fflags & FWRITE) {
|
||||
if (usb2_fifo_alloc_buffer(fifo,
|
||||
if (usb_fifo_alloc_buffer(fifo,
|
||||
sc->sc_osize + 1, UHID_FRAME_NUM)) {
|
||||
return (ENOMEM);
|
||||
}
|
||||
@ -477,7 +477,7 @@ static void
|
||||
uhid_close(struct usb_fifo *fifo, int fflags)
|
||||
{
|
||||
if (fflags & (FREAD | FWRITE)) {
|
||||
usb2_fifo_free_buffer(fifo);
|
||||
usb_fifo_free_buffer(fifo);
|
||||
}
|
||||
}
|
||||
|
||||
@ -616,7 +616,7 @@ uhid_probe(device_t dev)
|
||||
return (ENXIO);
|
||||
}
|
||||
}
|
||||
if (usb2_test_quirk(uaa, UQ_HID_IGNORE)) {
|
||||
if (usb_test_quirk(uaa, UQ_HID_IGNORE)) {
|
||||
return (ENXIO);
|
||||
}
|
||||
return (0);
|
||||
@ -632,7 +632,7 @@ uhid_attach(device_t dev)
|
||||
|
||||
DPRINTFN(10, "sc=%p\n", sc);
|
||||
|
||||
device_set_usb2_desc(dev);
|
||||
device_set_usb_desc(dev);
|
||||
|
||||
mtx_init(&sc->sc_mtx, "uhid lock", NULL, MTX_DEF | MTX_RECURSE);
|
||||
|
||||
@ -641,12 +641,12 @@ uhid_attach(device_t dev)
|
||||
sc->sc_iface_no = uaa->info.bIfaceNum;
|
||||
sc->sc_iface_index = uaa->info.bIfaceIndex;
|
||||
|
||||
error = usb2_transfer_setup(uaa->device,
|
||||
error = usbd_transfer_setup(uaa->device,
|
||||
&uaa->info.bIfaceIndex, sc->sc_xfer, uhid_config,
|
||||
UHID_N_TRANSFER, sc, &sc->sc_mtx);
|
||||
|
||||
if (error) {
|
||||
DPRINTF("error=%s\n", usb2_errstr(error));
|
||||
DPRINTF("error=%s\n", usbd_errstr(error));
|
||||
goto detach;
|
||||
}
|
||||
if (uaa->info.idVendor == USB_VENDOR_WACOM) {
|
||||
@ -668,13 +668,13 @@ uhid_attach(device_t dev)
|
||||
* feature report ID 2 before it'll start
|
||||
* returning digitizer data.
|
||||
*/
|
||||
error = usb2_req_set_report(uaa->device, NULL,
|
||||
error = usbd_req_set_report(uaa->device, NULL,
|
||||
reportbuf, sizeof(reportbuf),
|
||||
uaa->info.bIfaceIndex, UHID_FEATURE_REPORT, 2);
|
||||
|
||||
if (error) {
|
||||
DPRINTF("set report failed, error=%s (ignored)\n",
|
||||
usb2_errstr(error));
|
||||
usbd_errstr(error));
|
||||
}
|
||||
sc->sc_repdesc_size = sizeof(uhid_graphire3_4x5_report_descr);
|
||||
sc->sc_repdesc_ptr = USB_ADD_BYTES(uhid_graphire3_4x5_report_descr, 0);
|
||||
@ -691,7 +691,7 @@ uhid_attach(device_t dev)
|
||||
}
|
||||
if (sc->sc_repdesc_ptr == NULL) {
|
||||
|
||||
error = usb2_req_get_hid_desc(uaa->device, NULL,
|
||||
error = usbd_req_get_hid_desc(uaa->device, NULL,
|
||||
&sc->sc_repdesc_ptr, &sc->sc_repdesc_size,
|
||||
M_USBDEV, uaa->info.bIfaceIndex);
|
||||
|
||||
@ -700,12 +700,12 @@ uhid_attach(device_t dev)
|
||||
goto detach;
|
||||
}
|
||||
}
|
||||
error = usb2_req_set_idle(uaa->device, NULL,
|
||||
error = usbd_req_set_idle(uaa->device, NULL,
|
||||
uaa->info.bIfaceIndex, 0, 0);
|
||||
|
||||
if (error) {
|
||||
DPRINTF("set idle failed, error=%s (ignored)\n",
|
||||
usb2_errstr(error));
|
||||
usbd_errstr(error));
|
||||
}
|
||||
sc->sc_isize = hid_report_size
|
||||
(sc->sc_repdesc_ptr, sc->sc_repdesc_size, hid_input, &sc->sc_iid);
|
||||
@ -735,7 +735,7 @@ uhid_attach(device_t dev)
|
||||
sc->sc_fsize = UHID_BSIZE;
|
||||
}
|
||||
|
||||
error = usb2_fifo_attach(uaa->device, sc, &sc->sc_mtx,
|
||||
error = usb_fifo_attach(uaa->device, sc, &sc->sc_mtx,
|
||||
&uhid_fifo_methods, &sc->sc_fifo,
|
||||
unit, 0 - 1, uaa->info.bIfaceIndex,
|
||||
UID_ROOT, GID_OPERATOR, 0644);
|
||||
@ -754,9 +754,9 @@ uhid_detach(device_t dev)
|
||||
{
|
||||
struct uhid_softc *sc = device_get_softc(dev);
|
||||
|
||||
usb2_fifo_detach(&sc->sc_fifo);
|
||||
usb_fifo_detach(&sc->sc_fifo);
|
||||
|
||||
usb2_transfer_unsetup(sc->sc_xfer, UHID_N_TRANSFER);
|
||||
usbd_transfer_unsetup(sc->sc_xfer, UHID_N_TRANSFER);
|
||||
|
||||
if (sc->sc_repdesc_ptr) {
|
||||
if (!(sc->sc_flags & UHID_FLAG_STATIC_DESC)) {
|
||||
|
@ -297,14 +297,14 @@ ukbd_get_key(struct ukbd_softc *sc, uint8_t wait)
|
||||
|
||||
if (sc->sc_inputs == 0) {
|
||||
/* start transfer, if not already started */
|
||||
usb2_transfer_start(sc->sc_xfer[UKBD_INTR_DT]);
|
||||
usbd_transfer_start(sc->sc_xfer[UKBD_INTR_DT]);
|
||||
}
|
||||
if (sc->sc_flags & UKBD_FLAG_POLLING) {
|
||||
DPRINTFN(2, "polling\n");
|
||||
|
||||
while (sc->sc_inputs == 0) {
|
||||
|
||||
usb2_do_poll(sc->sc_xfer, UKBD_N_TRANSFER);
|
||||
usbd_do_poll(sc->sc_xfer, UKBD_N_TRANSFER);
|
||||
|
||||
DELAY(1000); /* delay 1 ms */
|
||||
|
||||
@ -454,7 +454,7 @@ ukbd_timeout(void *arg)
|
||||
}
|
||||
ukbd_interrupt(sc);
|
||||
|
||||
usb2_callout_reset(&sc->sc_callout, hz / 40, &ukbd_timeout, sc);
|
||||
usb_callout_reset(&sc->sc_callout, hz / 40, &ukbd_timeout, sc);
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
@ -501,7 +501,7 @@ ukbd_intr_callback(struct usb_xfer *xfer)
|
||||
|
||||
if (sc->sc_kbd_id != 0) {
|
||||
/* check and remove HID ID byte */
|
||||
usb2_copy_out(xfer->frbuffers, 0, &id, 1);
|
||||
usbd_copy_out(xfer->frbuffers, 0, &id, 1);
|
||||
if (id != sc->sc_kbd_id) {
|
||||
DPRINTF("wrong HID ID\n");
|
||||
goto tr_setup;
|
||||
@ -518,7 +518,7 @@ ukbd_intr_callback(struct usb_xfer *xfer)
|
||||
|
||||
if (len) {
|
||||
memset(&sc->sc_ndata, 0, sizeof(sc->sc_ndata));
|
||||
usb2_copy_out(xfer->frbuffers, offset,
|
||||
usbd_copy_out(xfer->frbuffers, offset,
|
||||
&sc->sc_ndata, len);
|
||||
|
||||
if ((sc->sc_flags & UKBD_FLAG_APPLE_EJECT) &&
|
||||
@ -568,14 +568,14 @@ ukbd_intr_callback(struct usb_xfer *xfer)
|
||||
tr_setup:
|
||||
if (sc->sc_inputs < UKBD_IN_BUF_FULL) {
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
} else {
|
||||
DPRINTF("input queue is full!\n");
|
||||
}
|
||||
break;
|
||||
|
||||
default: /* Error */
|
||||
DPRINTF("error=%s\n", usb2_errstr(xfer->error));
|
||||
DPRINTF("error=%s\n", usbd_errstr(xfer->error));
|
||||
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
/* try to clear stall first */
|
||||
@ -617,18 +617,18 @@ ukbd_set_leds_callback(struct usb_xfer *xfer)
|
||||
buf[1] = 0;
|
||||
}
|
||||
|
||||
usb2_copy_in(xfer->frbuffers, 0, &req, sizeof(req));
|
||||
usb2_copy_in(xfer->frbuffers + 1, 0, buf, sizeof(buf));
|
||||
usbd_copy_in(xfer->frbuffers, 0, &req, sizeof(req));
|
||||
usbd_copy_in(xfer->frbuffers + 1, 0, buf, sizeof(buf));
|
||||
|
||||
xfer->frlengths[0] = sizeof(req);
|
||||
xfer->frlengths[1] = req.wLength[0];
|
||||
xfer->nframes = 2;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
}
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
DPRINTFN(0, "error=%s\n", usb2_errstr(xfer->error));
|
||||
DPRINTFN(0, "error=%s\n", usbd_errstr(xfer->error));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -677,13 +677,13 @@ ukbd_probe(device_t dev)
|
||||
|
||||
if ((uaa->info.bInterfaceSubClass == UISUBCLASS_BOOT) &&
|
||||
(uaa->info.bInterfaceProtocol == UPROTO_BOOT_KEYBOARD)) {
|
||||
if (usb2_test_quirk(uaa, UQ_KBD_IGNORE))
|
||||
if (usb_test_quirk(uaa, UQ_KBD_IGNORE))
|
||||
return (ENXIO);
|
||||
else
|
||||
return (0);
|
||||
}
|
||||
|
||||
error = usb2_req_get_hid_desc(uaa->device, NULL,
|
||||
error = usbd_req_get_hid_desc(uaa->device, NULL,
|
||||
&d_ptr, &d_len, M_TEMP, uaa->info.bIfaceIndex);
|
||||
|
||||
if (error)
|
||||
@ -691,7 +691,7 @@ ukbd_probe(device_t dev)
|
||||
|
||||
if (hid_is_collection(d_ptr, d_len,
|
||||
HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_KEYBOARD))) {
|
||||
if (usb2_test_quirk(uaa, UQ_KBD_IGNORE))
|
||||
if (usb_test_quirk(uaa, UQ_KBD_IGNORE))
|
||||
error = ENXIO;
|
||||
else
|
||||
error = 0;
|
||||
@ -721,7 +721,7 @@ ukbd_attach(device_t dev)
|
||||
|
||||
kbd->kb_data = (void *)sc;
|
||||
|
||||
device_set_usb2_desc(dev);
|
||||
device_set_usb_desc(dev);
|
||||
|
||||
sc->sc_udev = uaa->device;
|
||||
sc->sc_iface = uaa->iface;
|
||||
@ -729,14 +729,14 @@ ukbd_attach(device_t dev)
|
||||
sc->sc_iface_no = uaa->info.bIfaceNum;
|
||||
sc->sc_mode = K_XLATE;
|
||||
|
||||
usb2_callout_init_mtx(&sc->sc_callout, &Giant, 0);
|
||||
usb_callout_init_mtx(&sc->sc_callout, &Giant, 0);
|
||||
|
||||
err = usb2_transfer_setup(uaa->device,
|
||||
err = usbd_transfer_setup(uaa->device,
|
||||
&uaa->info.bIfaceIndex, sc->sc_xfer, ukbd_config,
|
||||
UKBD_N_TRANSFER, sc, &Giant);
|
||||
|
||||
if (err) {
|
||||
DPRINTF("error=%s\n", usb2_errstr(err));
|
||||
DPRINTF("error=%s\n", usbd_errstr(err));
|
||||
goto detach;
|
||||
}
|
||||
/* setup default keyboard maps */
|
||||
@ -761,7 +761,7 @@ ukbd_attach(device_t dev)
|
||||
KBD_PROBE_DONE(kbd);
|
||||
|
||||
/* figure out if there is an ID byte in the data */
|
||||
err = usb2_req_get_hid_desc(uaa->device, NULL, &hid_ptr,
|
||||
err = usbd_req_get_hid_desc(uaa->device, NULL, &hid_ptr,
|
||||
&hid_len, M_TEMP, uaa->info.bIfaceIndex);
|
||||
if (err == 0) {
|
||||
uint8_t temp_id;
|
||||
@ -801,7 +801,7 @@ ukbd_attach(device_t dev)
|
||||
}
|
||||
|
||||
/* ignore if SETIDLE fails, hence it is not crucial */
|
||||
err = usb2_req_set_idle(sc->sc_udev, &Giant, sc->sc_iface_index, 0, 0);
|
||||
err = usbd_req_set_idle(sc->sc_udev, &Giant, sc->sc_iface_index, 0, 0);
|
||||
|
||||
ukbd_ioctl(kbd, KDSETLED, (caddr_t)&sc->sc_state);
|
||||
|
||||
@ -830,7 +830,7 @@ ukbd_attach(device_t dev)
|
||||
|
||||
/* start the keyboard */
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[UKBD_INTR_DT]);
|
||||
usbd_transfer_start(sc->sc_xfer[UKBD_INTR_DT]);
|
||||
|
||||
/* start the timer */
|
||||
|
||||
@ -858,7 +858,7 @@ ukbd_detach(device_t dev)
|
||||
}
|
||||
sc->sc_flags |= UKBD_FLAG_GONE;
|
||||
|
||||
usb2_callout_stop(&sc->sc_callout);
|
||||
usb_callout_stop(&sc->sc_callout);
|
||||
|
||||
ukbd_disable(&sc->sc_kbd);
|
||||
|
||||
@ -882,9 +882,9 @@ ukbd_detach(device_t dev)
|
||||
}
|
||||
sc->sc_kbd.kb_flags = 0;
|
||||
|
||||
usb2_transfer_unsetup(sc->sc_xfer, UKBD_N_TRANSFER);
|
||||
usbd_transfer_unsetup(sc->sc_xfer, UKBD_N_TRANSFER);
|
||||
|
||||
usb2_callout_drain(&sc->sc_callout);
|
||||
usb_callout_drain(&sc->sc_callout);
|
||||
|
||||
DPRINTF("%s: disconnected\n",
|
||||
device_get_nameunit(dev));
|
||||
@ -1492,7 +1492,7 @@ ukbd_set_leds(struct ukbd_softc *sc, uint8_t leds)
|
||||
|
||||
/* start transfer, if not already started */
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[UKBD_CTRL_LED]);
|
||||
usbd_transfer_start(sc->sc_xfer[UKBD_CTRL_LED]);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -197,7 +197,7 @@ ums_intr_callback(struct usb_xfer *xfer)
|
||||
if (len == 0)
|
||||
goto tr_setup;
|
||||
|
||||
usb2_copy_out(xfer->frbuffers, 0, buf, len);
|
||||
usbd_copy_out(xfer->frbuffers, 0, buf, len);
|
||||
|
||||
DPRINTFN(6, "data = %02x %02x %02x %02x "
|
||||
"%02x %02x %02x %02x\n",
|
||||
@ -287,11 +287,11 @@ ums_intr_callback(struct usb_xfer *xfer)
|
||||
(dx == 0) && (dy == 0) && (dz == 0) && (dt == 0) &&
|
||||
(dw == 0) && (buttons == 0)) {
|
||||
|
||||
usb2_callout_reset(&sc->sc_callout, hz / 20,
|
||||
usb_callout_reset(&sc->sc_callout, hz / 20,
|
||||
&ums_put_queue_timeout, sc);
|
||||
} else {
|
||||
|
||||
usb2_callout_stop(&sc->sc_callout);
|
||||
usb_callout_stop(&sc->sc_callout);
|
||||
|
||||
ums_put_queue(sc, dx, dy, dz, dt, buttons);
|
||||
}
|
||||
@ -299,10 +299,10 @@ ums_intr_callback(struct usb_xfer *xfer)
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
/* check if we can put more data into the FIFO */
|
||||
if (usb2_fifo_put_bytes_max(
|
||||
if (usb_fifo_put_bytes_max(
|
||||
sc->sc_fifo.fp[USB_FIFO_RX]) != 0) {
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -348,7 +348,7 @@ ums_probe(device_t dev)
|
||||
(uaa->info.bInterfaceProtocol == UIPROTO_MOUSE))
|
||||
return (0);
|
||||
|
||||
error = usb2_req_get_hid_desc(uaa->device, NULL,
|
||||
error = usbd_req_get_hid_desc(uaa->device, NULL,
|
||||
&d_ptr, &d_len, M_TEMP, uaa->info.bIfaceIndex);
|
||||
|
||||
if (error)
|
||||
@ -476,11 +476,11 @@ ums_attach(device_t dev)
|
||||
|
||||
DPRINTFN(11, "sc=%p\n", sc);
|
||||
|
||||
device_set_usb2_desc(dev);
|
||||
device_set_usb_desc(dev);
|
||||
|
||||
mtx_init(&sc->sc_mtx, "ums lock", NULL, MTX_DEF | MTX_RECURSE);
|
||||
|
||||
usb2_callout_init_mtx(&sc->sc_callout, &sc->sc_mtx, 0);
|
||||
usb_callout_init_mtx(&sc->sc_callout, &sc->sc_mtx, 0);
|
||||
|
||||
/*
|
||||
* Force the report (non-boot) protocol.
|
||||
@ -488,18 +488,18 @@ ums_attach(device_t dev)
|
||||
* Mice without boot protocol support may choose not to implement
|
||||
* Set_Protocol at all; Ignore any error.
|
||||
*/
|
||||
err = usb2_req_set_protocol(uaa->device, NULL,
|
||||
err = usbd_req_set_protocol(uaa->device, NULL,
|
||||
uaa->info.bIfaceIndex, 1);
|
||||
|
||||
err = usb2_transfer_setup(uaa->device,
|
||||
err = usbd_transfer_setup(uaa->device,
|
||||
&uaa->info.bIfaceIndex, sc->sc_xfer, ums_config,
|
||||
UMS_N_TRANSFER, sc, &sc->sc_mtx);
|
||||
|
||||
if (err) {
|
||||
DPRINTF("error=%s\n", usb2_errstr(err));
|
||||
DPRINTF("error=%s\n", usbd_errstr(err));
|
||||
goto detach;
|
||||
}
|
||||
err = usb2_req_get_hid_desc(uaa->device, NULL, &d_ptr,
|
||||
err = usbd_req_get_hid_desc(uaa->device, NULL, &d_ptr,
|
||||
&d_len, M_TEMP, uaa->info.bIfaceIndex);
|
||||
|
||||
if (err) {
|
||||
@ -515,7 +515,7 @@ ums_attach(device_t dev)
|
||||
* all of its other button positions are all off. It also reports that
|
||||
* it has two addional buttons and a tilt wheel.
|
||||
*/
|
||||
if (usb2_test_quirk(uaa, UQ_MS_BAD_CLASS)) {
|
||||
if (usb_test_quirk(uaa, UQ_MS_BAD_CLASS)) {
|
||||
info = &sc->sc_info[0];
|
||||
info->sc_flags = (UMS_FLAG_X_AXIS |
|
||||
UMS_FLAG_Y_AXIS |
|
||||
@ -542,7 +542,7 @@ ums_attach(device_t dev)
|
||||
}
|
||||
}
|
||||
|
||||
if (usb2_test_quirk(uaa, UQ_MS_REVZ)) {
|
||||
if (usb_test_quirk(uaa, UQ_MS_REVZ)) {
|
||||
info = &sc->sc_info[0];
|
||||
/* Some wheels need the Z axis reversed. */
|
||||
info->sc_flags |= UMS_FLAG_REVZ;
|
||||
@ -599,7 +599,7 @@ ums_attach(device_t dev)
|
||||
sc->sc_mode.syncmask[0] = MOUSE_MSC_SYNCMASK;
|
||||
sc->sc_mode.syncmask[1] = MOUSE_MSC_SYNC;
|
||||
|
||||
err = usb2_fifo_attach(uaa->device, sc, &sc->sc_mtx,
|
||||
err = usb_fifo_attach(uaa->device, sc, &sc->sc_mtx,
|
||||
&ums_fifo_methods, &sc->sc_fifo,
|
||||
device_get_unit(dev), 0 - 1, uaa->info.bIfaceIndex,
|
||||
UID_ROOT, GID_OPERATOR, 0644);
|
||||
@ -623,11 +623,11 @@ ums_detach(device_t self)
|
||||
|
||||
DPRINTF("sc=%p\n", sc);
|
||||
|
||||
usb2_fifo_detach(&sc->sc_fifo);
|
||||
usb_fifo_detach(&sc->sc_fifo);
|
||||
|
||||
usb2_transfer_unsetup(sc->sc_xfer, UMS_N_TRANSFER);
|
||||
usbd_transfer_unsetup(sc->sc_xfer, UMS_N_TRANSFER);
|
||||
|
||||
usb2_callout_drain(&sc->sc_callout);
|
||||
usb_callout_drain(&sc->sc_callout);
|
||||
|
||||
mtx_destroy(&sc->sc_mtx);
|
||||
|
||||
@ -639,7 +639,7 @@ ums_start_read(struct usb_fifo *fifo)
|
||||
{
|
||||
struct ums_softc *sc = fifo->priv_sc0;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[UMS_INTR_DT]);
|
||||
usbd_transfer_start(sc->sc_xfer[UMS_INTR_DT]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -647,8 +647,8 @@ ums_stop_read(struct usb_fifo *fifo)
|
||||
{
|
||||
struct ums_softc *sc = fifo->priv_sc0;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[UMS_INTR_DT]);
|
||||
usb2_callout_stop(&sc->sc_callout);
|
||||
usbd_transfer_stop(sc->sc_xfer[UMS_INTR_DT]);
|
||||
usb_callout_stop(&sc->sc_callout);
|
||||
}
|
||||
|
||||
|
||||
@ -694,7 +694,7 @@ ums_put_queue(struct ums_softc *sc, int32_t dx, int32_t dy,
|
||||
buf[6] = dz - (dz >> 1);
|
||||
buf[7] = (((~buttons) >> 3) & MOUSE_SYS_EXTBUTTONS);
|
||||
}
|
||||
usb2_fifo_put_data_linear(sc->sc_fifo.fp[USB_FIFO_RX], buf,
|
||||
usb_fifo_put_data_linear(sc->sc_fifo.fp[USB_FIFO_RX], buf,
|
||||
sc->sc_mode.packetsize, 1);
|
||||
|
||||
} else {
|
||||
@ -706,7 +706,7 @@ static void
|
||||
ums_reset_buf(struct ums_softc *sc)
|
||||
{
|
||||
/* reset read queue */
|
||||
usb2_fifo_reset(sc->sc_fifo.fp[USB_FIFO_RX]);
|
||||
usb_fifo_reset(sc->sc_fifo.fp[USB_FIFO_RX]);
|
||||
}
|
||||
|
||||
static int
|
||||
@ -728,7 +728,7 @@ ums_open(struct usb_fifo *fifo, int fflags)
|
||||
sc->sc_status.dz = 0;
|
||||
/* sc->sc_status.dt = 0; */
|
||||
|
||||
if (usb2_fifo_alloc_buffer(fifo,
|
||||
if (usb_fifo_alloc_buffer(fifo,
|
||||
UMS_BUF_SIZE, UMS_IFQ_MAXLEN)) {
|
||||
return (ENOMEM);
|
||||
}
|
||||
@ -740,7 +740,7 @@ static void
|
||||
ums_close(struct usb_fifo *fifo, int fflags)
|
||||
{
|
||||
if (fflags & FREAD) {
|
||||
usb2_fifo_free_buffer(fifo);
|
||||
usb_fifo_free_buffer(fifo);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -317,17 +317,17 @@ udbp_attach(device_t dev)
|
||||
struct udbp_softc *sc = device_get_softc(dev);
|
||||
int error;
|
||||
|
||||
device_set_usb2_desc(dev);
|
||||
device_set_usb_desc(dev);
|
||||
|
||||
snprintf(sc->sc_name, sizeof(sc->sc_name),
|
||||
"%s", device_get_nameunit(dev));
|
||||
|
||||
mtx_init(&sc->sc_mtx, "udbp lock", NULL, MTX_DEF | MTX_RECURSE);
|
||||
|
||||
error = usb2_transfer_setup(uaa->device, &uaa->info.bIfaceIndex,
|
||||
error = usbd_transfer_setup(uaa->device, &uaa->info.bIfaceIndex,
|
||||
sc->sc_xfer, udbp_config, UDBP_T_MAX, sc, &sc->sc_mtx);
|
||||
if (error) {
|
||||
DPRINTF("error=%s\n", usb2_errstr(error));
|
||||
DPRINTF("error=%s\n", usbd_errstr(error));
|
||||
goto detach;
|
||||
}
|
||||
NG_BT_MBUFQ_INIT(&sc->sc_xmitq, UDBP_Q_MAXLEN);
|
||||
@ -376,7 +376,7 @@ udbp_detach(device_t dev)
|
||||
}
|
||||
/* free USB transfers, if any */
|
||||
|
||||
usb2_transfer_unsetup(sc->sc_xfer, UDBP_T_MAX);
|
||||
usbd_transfer_unsetup(sc->sc_xfer, UDBP_T_MAX);
|
||||
|
||||
mtx_destroy(&sc->sc_mtx);
|
||||
|
||||
@ -418,7 +418,7 @@ udbp_bulk_read_callback(struct usb_xfer *xfer)
|
||||
}
|
||||
m->m_pkthdr.len = m->m_len = xfer->actlen;
|
||||
|
||||
usb2_copy_out(xfer->frbuffers, 0, m->m_data, xfer->actlen);
|
||||
usbd_copy_out(xfer->frbuffers, 0, m->m_data, xfer->actlen);
|
||||
|
||||
sc->sc_bulk_in_buffer = m;
|
||||
|
||||
@ -432,18 +432,18 @@ udbp_bulk_read_callback(struct usb_xfer *xfer)
|
||||
return;
|
||||
}
|
||||
if (sc->sc_flags & UDBP_FLAG_READ_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer[UDBP_T_RD_CS]);
|
||||
usbd_transfer_start(sc->sc_xfer[UDBP_T_RD_CS]);
|
||||
return;
|
||||
}
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
/* try to clear stall first */
|
||||
sc->sc_flags |= UDBP_FLAG_READ_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer[UDBP_T_RD_CS]);
|
||||
usbd_transfer_start(sc->sc_xfer[UDBP_T_RD_CS]);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -456,10 +456,10 @@ udbp_bulk_read_clear_stall_callback(struct usb_xfer *xfer)
|
||||
struct udbp_softc *sc = xfer->priv_sc;
|
||||
struct usb_xfer *xfer_other = sc->sc_xfer[UDBP_T_RD];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
if (usbd_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
sc->sc_flags &= ~UDBP_FLAG_READ_STALL;
|
||||
usb2_transfer_start(xfer_other);
|
||||
usbd_transfer_start(xfer_other);
|
||||
}
|
||||
}
|
||||
|
||||
@ -498,7 +498,7 @@ udbp_bulk_read_complete(node_p node, hook_p hook, void *arg1, int arg2)
|
||||
}
|
||||
/* start USB bulk-in transfer, if not already started */
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[UDBP_T_RD]);
|
||||
usbd_transfer_start(sc->sc_xfer[UDBP_T_RD]);
|
||||
|
||||
mtx_unlock(&sc->sc_mtx);
|
||||
}
|
||||
@ -516,7 +516,7 @@ udbp_bulk_write_callback(struct usb_xfer *xfer)
|
||||
|
||||
case USB_ST_SETUP:
|
||||
if (sc->sc_flags & UDBP_FLAG_WRITE_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer[UDBP_T_WR_CS]);
|
||||
usbd_transfer_start(sc->sc_xfer[UDBP_T_WR_CS]);
|
||||
return;
|
||||
}
|
||||
/* get next mbuf, if any */
|
||||
@ -535,7 +535,7 @@ udbp_bulk_write_callback(struct usb_xfer *xfer)
|
||||
MCLBYTES);
|
||||
m->m_pkthdr.len = MCLBYTES;
|
||||
}
|
||||
usb2_m_copy_in(xfer->frbuffers, 0, m, 0, m->m_pkthdr.len);
|
||||
usbd_m_copy_in(xfer->frbuffers, 0, m, 0, m->m_pkthdr.len);
|
||||
|
||||
xfer->frlengths[0] = m->m_pkthdr.len;
|
||||
|
||||
@ -544,14 +544,14 @@ udbp_bulk_write_callback(struct usb_xfer *xfer)
|
||||
DPRINTF("packet out: %d bytes\n",
|
||||
xfer->frlengths[0]);
|
||||
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
/* try to clear stall first */
|
||||
sc->sc_flags |= UDBP_FLAG_WRITE_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer[UDBP_T_WR_CS]);
|
||||
usbd_transfer_start(sc->sc_xfer[UDBP_T_WR_CS]);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -564,10 +564,10 @@ udbp_bulk_write_clear_stall_callback(struct usb_xfer *xfer)
|
||||
struct udbp_softc *sc = xfer->priv_sc;
|
||||
struct usb_xfer *xfer_other = sc->sc_xfer[UDBP_T_WR];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
if (usbd_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
sc->sc_flags &= ~UDBP_FLAG_WRITE_STALL;
|
||||
usb2_transfer_start(xfer_other);
|
||||
usbd_transfer_start(xfer_other);
|
||||
}
|
||||
}
|
||||
|
||||
@ -725,7 +725,7 @@ ng_udbp_rcvdata(hook_p hook, item_p item)
|
||||
/*
|
||||
* start bulk-out transfer, if not already started:
|
||||
*/
|
||||
usb2_transfer_start(sc->sc_xfer[UDBP_T_WR]);
|
||||
usbd_transfer_start(sc->sc_xfer[UDBP_T_WR]);
|
||||
error = 0;
|
||||
}
|
||||
|
||||
@ -793,10 +793,10 @@ ng_udbp_connect(hook_p hook)
|
||||
UDBP_FLAG_WRITE_STALL);
|
||||
|
||||
/* start bulk-in transfer */
|
||||
usb2_transfer_start(sc->sc_xfer[UDBP_T_RD]);
|
||||
usbd_transfer_start(sc->sc_xfer[UDBP_T_RD]);
|
||||
|
||||
/* start bulk-out transfer */
|
||||
usb2_transfer_start(sc->sc_xfer[UDBP_T_WR]);
|
||||
usbd_transfer_start(sc->sc_xfer[UDBP_T_WR]);
|
||||
|
||||
mtx_unlock(&sc->sc_mtx);
|
||||
|
||||
@ -823,12 +823,12 @@ ng_udbp_disconnect(hook_p hook)
|
||||
} else {
|
||||
|
||||
/* stop bulk-in transfer */
|
||||
usb2_transfer_stop(sc->sc_xfer[UDBP_T_RD_CS]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UDBP_T_RD]);
|
||||
usbd_transfer_stop(sc->sc_xfer[UDBP_T_RD_CS]);
|
||||
usbd_transfer_stop(sc->sc_xfer[UDBP_T_RD]);
|
||||
|
||||
/* stop bulk-out transfer */
|
||||
usb2_transfer_stop(sc->sc_xfer[UDBP_T_WR_CS]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UDBP_T_WR]);
|
||||
usbd_transfer_stop(sc->sc_xfer[UDBP_T_WR_CS]);
|
||||
usbd_transfer_stop(sc->sc_xfer[UDBP_T_WR]);
|
||||
|
||||
/* cleanup queues */
|
||||
NG_BT_MBUFQ_DRAIN(&sc->sc_xmitq);
|
||||
|
@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <dev/usb/usb_error.h>
|
||||
#include <dev/usb/ufm_ioctl.h>
|
||||
|
||||
#define USB_DEBUG_VAR usb2_debug
|
||||
#define USB_DEBUG_VAR usb_debug
|
||||
|
||||
#include <dev/usb/usb_core.h>
|
||||
#include <dev/usb/usb_debug.h>
|
||||
@ -137,9 +137,9 @@ ufm_attach(device_t dev)
|
||||
|
||||
mtx_init(&sc->sc_mtx, "ufm lock", NULL, MTX_DEF | MTX_RECURSE);
|
||||
|
||||
device_set_usb2_desc(dev);
|
||||
device_set_usb_desc(dev);
|
||||
|
||||
error = usb2_fifo_attach(uaa->device, sc, &sc->sc_mtx,
|
||||
error = usb_fifo_attach(uaa->device, sc, &sc->sc_mtx,
|
||||
&ufm_fifo_methods, &sc->sc_fifo,
|
||||
device_get_unit(dev), 0 - 1, uaa->info.bIfaceIndex,
|
||||
UID_ROOT, GID_OPERATOR, 0644);
|
||||
@ -158,7 +158,7 @@ ufm_detach(device_t dev)
|
||||
{
|
||||
struct ufm_softc *sc = device_get_softc(dev);
|
||||
|
||||
usb2_fifo_detach(&sc->sc_fifo);
|
||||
usb_fifo_detach(&sc->sc_fifo);
|
||||
|
||||
mtx_destroy(&sc->sc_mtx);
|
||||
|
||||
@ -189,7 +189,7 @@ ufm_do_req(struct ufm_softc *sc, uint8_t request,
|
||||
USETW(req.wIndex, index);
|
||||
USETW(req.wLength, 1);
|
||||
|
||||
error = usb2_do_request(sc->sc_udev, NULL, &req, buf);
|
||||
error = usbd_do_request(sc->sc_udev, NULL, &req, buf);
|
||||
|
||||
if (retbuf) {
|
||||
*retbuf = buf[0];
|
||||
@ -284,7 +284,7 @@ ufm_get_stat(struct ufm_softc *sc, void *addr)
|
||||
* Note, there's a 240ms settle time before the status
|
||||
* will be valid, so sleep that amount.
|
||||
*/
|
||||
usb2_pause_mtx(NULL, hz / 4);
|
||||
usb_pause_mtx(NULL, hz / 4);
|
||||
|
||||
if (ufm_do_req(sc, UFM_CMD0,
|
||||
0x00, 0x24, &ret)) {
|
||||
|
@ -64,8 +64,8 @@ __FBSDID("$FreeBSD$");
|
||||
* the controller uses an external PHY chip, it's possible that board
|
||||
* designers might simply choose a 10Mbps PHY.
|
||||
*
|
||||
* Registers are accessed using usb2_ether_do_request(). Packet
|
||||
* transfers are done using usb2_transfer() and friends.
|
||||
* Registers are accessed using uether_do_request(). Packet
|
||||
* transfers are done using usbd_transfer() and friends.
|
||||
*/
|
||||
|
||||
#include "usbdevs.h"
|
||||
@ -297,7 +297,7 @@ aue_csr_read_1(struct aue_softc *sc, uint16_t reg)
|
||||
USETW(req.wIndex, reg);
|
||||
USETW(req.wLength, 1);
|
||||
|
||||
err = usb2_ether_do_request(&sc->sc_ue, &req, &val, 1000);
|
||||
err = uether_do_request(&sc->sc_ue, &req, &val, 1000);
|
||||
if (err)
|
||||
return (0);
|
||||
return (val);
|
||||
@ -316,7 +316,7 @@ aue_csr_read_2(struct aue_softc *sc, uint16_t reg)
|
||||
USETW(req.wIndex, reg);
|
||||
USETW(req.wLength, 2);
|
||||
|
||||
err = usb2_ether_do_request(&sc->sc_ue, &req, &val, 1000);
|
||||
err = uether_do_request(&sc->sc_ue, &req, &val, 1000);
|
||||
if (err)
|
||||
return (0);
|
||||
return (le16toh(val));
|
||||
@ -334,7 +334,7 @@ aue_csr_write_1(struct aue_softc *sc, uint16_t reg, uint8_t val)
|
||||
USETW(req.wIndex, reg);
|
||||
USETW(req.wLength, 1);
|
||||
|
||||
if (usb2_ether_do_request(&sc->sc_ue, &req, &val, 1000)) {
|
||||
if (uether_do_request(&sc->sc_ue, &req, &val, 1000)) {
|
||||
/* error ignored */
|
||||
}
|
||||
}
|
||||
@ -352,7 +352,7 @@ aue_csr_write_2(struct aue_softc *sc, uint16_t reg, uint16_t val)
|
||||
|
||||
val = htole16(val);
|
||||
|
||||
if (usb2_ether_do_request(&sc->sc_ue, &req, &val, 1000)) {
|
||||
if (uether_do_request(&sc->sc_ue, &req, &val, 1000)) {
|
||||
/* error ignored */
|
||||
}
|
||||
}
|
||||
@ -372,7 +372,7 @@ aue_eeprom_getword(struct aue_softc *sc, int addr, uint16_t *dest)
|
||||
for (i = 0; i != AUE_TIMEOUT; i++) {
|
||||
if (aue_csr_read_1(sc, AUE_EE_CTL) & AUE_EECTL_DONE)
|
||||
break;
|
||||
if (usb2_ether_pause(&sc->sc_ue, hz / 100))
|
||||
if (uether_pause(&sc->sc_ue, hz / 100))
|
||||
break;
|
||||
}
|
||||
|
||||
@ -429,7 +429,7 @@ aue_miibus_readreg(device_t dev, int phy, int reg)
|
||||
for (i = 0; i != AUE_TIMEOUT; i++) {
|
||||
if (aue_csr_read_1(sc, AUE_PHY_CTL) & AUE_PHYCTL_DONE)
|
||||
break;
|
||||
if (usb2_ether_pause(&sc->sc_ue, hz / 100))
|
||||
if (uether_pause(&sc->sc_ue, hz / 100))
|
||||
break;
|
||||
}
|
||||
|
||||
@ -465,7 +465,7 @@ aue_miibus_writereg(device_t dev, int phy, int reg, int data)
|
||||
for (i = 0; i != AUE_TIMEOUT; i++) {
|
||||
if (aue_csr_read_1(sc, AUE_PHY_CTL) & AUE_PHYCTL_DONE)
|
||||
break;
|
||||
if (usb2_ether_pause(&sc->sc_ue, hz / 100))
|
||||
if (uether_pause(&sc->sc_ue, hz / 100))
|
||||
break;
|
||||
}
|
||||
|
||||
@ -520,8 +520,8 @@ aue_miibus_statchg(device_t dev)
|
||||
static void
|
||||
aue_setmulti(struct usb_ether *ue)
|
||||
{
|
||||
struct aue_softc *sc = usb2_ether_getsc(ue);
|
||||
struct ifnet *ifp = usb2_ether_getifp(ue);
|
||||
struct aue_softc *sc = uether_getsc(ue);
|
||||
struct ifnet *ifp = uether_getifp(ue);
|
||||
struct ifmultiaddr *ifma;
|
||||
uint32_t h = 0;
|
||||
uint32_t i;
|
||||
@ -576,7 +576,7 @@ aue_reset(struct aue_softc *sc)
|
||||
for (i = 0; i != AUE_TIMEOUT; i++) {
|
||||
if (!(aue_csr_read_1(sc, AUE_CTL1) & AUE_CTL1_RESETMAC))
|
||||
break;
|
||||
if (usb2_ether_pause(&sc->sc_ue, hz / 100))
|
||||
if (uether_pause(&sc->sc_ue, hz / 100))
|
||||
break;
|
||||
}
|
||||
|
||||
@ -605,13 +605,13 @@ aue_reset(struct aue_softc *sc)
|
||||
aue_reset_pegasus_II(sc);
|
||||
|
||||
/* Wait a little while for the chip to get its brains in order: */
|
||||
usb2_ether_pause(&sc->sc_ue, hz / 100);
|
||||
uether_pause(&sc->sc_ue, hz / 100);
|
||||
}
|
||||
|
||||
static void
|
||||
aue_attach_post(struct usb_ether *ue)
|
||||
{
|
||||
struct aue_softc *sc = usb2_ether_getsc(ue);
|
||||
struct aue_softc *sc = uether_getsc(ue);
|
||||
|
||||
/* reset the adapter */
|
||||
aue_reset(sc);
|
||||
@ -644,7 +644,7 @@ aue_probe(device_t dev)
|
||||
uaa->info.bcdDevice == 0x0413)
|
||||
return (ENXIO);
|
||||
|
||||
return (usb2_lookup_id_by_uaa(aue_devs, sizeof(aue_devs), uaa));
|
||||
return (usbd_lookup_id_by_uaa(aue_devs, sizeof(aue_devs), uaa));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -667,11 +667,11 @@ aue_attach(device_t dev)
|
||||
sc->sc_flags |= AUE_FLAG_VER_2;
|
||||
}
|
||||
|
||||
device_set_usb2_desc(dev);
|
||||
device_set_usb_desc(dev);
|
||||
mtx_init(&sc->sc_mtx, device_get_nameunit(dev), NULL, MTX_DEF);
|
||||
|
||||
iface_index = AUE_IFACE_IDX;
|
||||
error = usb2_transfer_setup(uaa->device, &iface_index,
|
||||
error = usbd_transfer_setup(uaa->device, &iface_index,
|
||||
sc->sc_xfer, aue_config, AUE_N_TRANSFER,
|
||||
sc, &sc->sc_mtx);
|
||||
if (error) {
|
||||
@ -685,7 +685,7 @@ aue_attach(device_t dev)
|
||||
ue->ue_mtx = &sc->sc_mtx;
|
||||
ue->ue_methods = &aue_ue_methods;
|
||||
|
||||
error = usb2_ether_ifattach(ue);
|
||||
error = uether_ifattach(ue);
|
||||
if (error) {
|
||||
device_printf(dev, "could not attach interface\n");
|
||||
goto detach;
|
||||
@ -703,8 +703,8 @@ aue_detach(device_t dev)
|
||||
struct aue_softc *sc = device_get_softc(dev);
|
||||
struct usb_ether *ue = &sc->sc_ue;
|
||||
|
||||
usb2_transfer_unsetup(sc->sc_xfer, AUE_N_TRANSFER);
|
||||
usb2_ether_ifdetach(ue);
|
||||
usbd_transfer_unsetup(sc->sc_xfer, AUE_N_TRANSFER);
|
||||
uether_ifdetach(ue);
|
||||
mtx_destroy(&sc->sc_mtx);
|
||||
|
||||
return (0);
|
||||
@ -714,7 +714,7 @@ static void
|
||||
aue_intr_callback(struct usb_xfer *xfer)
|
||||
{
|
||||
struct aue_softc *sc = xfer->priv_sc;
|
||||
struct ifnet *ifp = usb2_ether_getifp(&sc->sc_ue);
|
||||
struct ifnet *ifp = uether_getifp(&sc->sc_ue);
|
||||
struct aue_intrpkt pkt;
|
||||
|
||||
switch (USB_GET_STATE(xfer)) {
|
||||
@ -723,7 +723,7 @@ aue_intr_callback(struct usb_xfer *xfer)
|
||||
if ((ifp->if_drv_flags & IFF_DRV_RUNNING) &&
|
||||
xfer->actlen >= sizeof(pkt)) {
|
||||
|
||||
usb2_copy_out(xfer->frbuffers, 0, &pkt, sizeof(pkt));
|
||||
usbd_copy_out(xfer->frbuffers, 0, &pkt, sizeof(pkt));
|
||||
|
||||
if (pkt.aue_txstat0)
|
||||
ifp->if_oerrors++;
|
||||
@ -735,7 +735,7 @@ aue_intr_callback(struct usb_xfer *xfer)
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
@ -753,7 +753,7 @@ aue_bulk_read_callback(struct usb_xfer *xfer)
|
||||
{
|
||||
struct aue_softc *sc = xfer->priv_sc;
|
||||
struct usb_ether *ue = &sc->sc_ue;
|
||||
struct ifnet *ifp = usb2_ether_getifp(ue);
|
||||
struct ifnet *ifp = uether_getifp(ue);
|
||||
struct aue_rxpkt stat;
|
||||
|
||||
switch (USB_GET_STATE(xfer)) {
|
||||
@ -772,7 +772,7 @@ aue_bulk_read_callback(struct usb_xfer *xfer)
|
||||
ifp->if_ierrors++;
|
||||
goto tr_setup;
|
||||
}
|
||||
usb2_copy_out(xfer->frbuffers,
|
||||
usbd_copy_out(xfer->frbuffers,
|
||||
xfer->actlen - sizeof(stat), &stat, sizeof(stat));
|
||||
|
||||
/*
|
||||
@ -787,19 +787,19 @@ aue_bulk_read_callback(struct usb_xfer *xfer)
|
||||
/* No errors; receive the packet. */
|
||||
xfer->actlen -= (sizeof(stat) + ETHER_CRC_LEN);
|
||||
}
|
||||
usb2_ether_rxbuf(ue, xfer->frbuffers, 0, xfer->actlen);
|
||||
uether_rxbuf(ue, xfer->frbuffers, 0, xfer->actlen);
|
||||
|
||||
/* FALLTHROUGH */
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
usb2_ether_rxflush(ue);
|
||||
usbd_transfer_submit(xfer);
|
||||
uether_rxflush(ue);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
DPRINTF("bulk read error, %s\n",
|
||||
usb2_errstr(xfer->error));
|
||||
usbd_errstr(xfer->error));
|
||||
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
/* try to clear stall first */
|
||||
@ -814,7 +814,7 @@ static void
|
||||
aue_bulk_write_callback(struct usb_xfer *xfer)
|
||||
{
|
||||
struct aue_softc *sc = xfer->priv_sc;
|
||||
struct ifnet *ifp = usb2_ether_getifp(&sc->sc_ue);
|
||||
struct ifnet *ifp = uether_getifp(&sc->sc_ue);
|
||||
struct mbuf *m;
|
||||
uint8_t buf[2];
|
||||
|
||||
@ -842,7 +842,7 @@ aue_bulk_write_callback(struct usb_xfer *xfer)
|
||||
|
||||
xfer->frlengths[0] = m->m_pkthdr.len;
|
||||
|
||||
usb2_m_copy_in(xfer->frbuffers, 0,
|
||||
usbd_m_copy_in(xfer->frbuffers, 0,
|
||||
m, 0, m->m_pkthdr.len);
|
||||
|
||||
} else {
|
||||
@ -860,9 +860,9 @@ aue_bulk_write_callback(struct usb_xfer *xfer)
|
||||
buf[0] = (uint8_t)(m->m_pkthdr.len);
|
||||
buf[1] = (uint8_t)(m->m_pkthdr.len >> 8);
|
||||
|
||||
usb2_copy_in(xfer->frbuffers, 0, buf, 2);
|
||||
usbd_copy_in(xfer->frbuffers, 0, buf, 2);
|
||||
|
||||
usb2_m_copy_in(xfer->frbuffers, 2,
|
||||
usbd_m_copy_in(xfer->frbuffers, 2,
|
||||
m, 0, m->m_pkthdr.len);
|
||||
}
|
||||
|
||||
@ -874,12 +874,12 @@ aue_bulk_write_callback(struct usb_xfer *xfer)
|
||||
|
||||
m_freem(m);
|
||||
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
DPRINTFN(11, "transfer error, %s\n",
|
||||
usb2_errstr(xfer->error));
|
||||
usbd_errstr(xfer->error));
|
||||
|
||||
ifp->if_oerrors++;
|
||||
|
||||
@ -895,7 +895,7 @@ aue_bulk_write_callback(struct usb_xfer *xfer)
|
||||
static void
|
||||
aue_tick(struct usb_ether *ue)
|
||||
{
|
||||
struct aue_softc *sc = usb2_ether_getsc(ue);
|
||||
struct aue_softc *sc = uether_getsc(ue);
|
||||
struct mii_data *mii = GET_MII(sc);
|
||||
|
||||
AUE_LOCK_ASSERT(sc, MA_OWNED);
|
||||
@ -912,21 +912,21 @@ aue_tick(struct usb_ether *ue)
|
||||
static void
|
||||
aue_start(struct usb_ether *ue)
|
||||
{
|
||||
struct aue_softc *sc = usb2_ether_getsc(ue);
|
||||
struct aue_softc *sc = uether_getsc(ue);
|
||||
|
||||
/*
|
||||
* start the USB transfers, if not already started:
|
||||
*/
|
||||
usb2_transfer_start(sc->sc_xfer[AUE_INTR_DT_RD]);
|
||||
usb2_transfer_start(sc->sc_xfer[AUE_BULK_DT_RD]);
|
||||
usb2_transfer_start(sc->sc_xfer[AUE_BULK_DT_WR]);
|
||||
usbd_transfer_start(sc->sc_xfer[AUE_INTR_DT_RD]);
|
||||
usbd_transfer_start(sc->sc_xfer[AUE_BULK_DT_RD]);
|
||||
usbd_transfer_start(sc->sc_xfer[AUE_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
aue_init(struct usb_ether *ue)
|
||||
{
|
||||
struct aue_softc *sc = usb2_ether_getsc(ue);
|
||||
struct ifnet *ifp = usb2_ether_getifp(ue);
|
||||
struct aue_softc *sc = uether_getsc(ue);
|
||||
struct ifnet *ifp = uether_getifp(ue);
|
||||
int i;
|
||||
|
||||
AUE_LOCK_ASSERT(sc, MA_OWNED);
|
||||
@ -951,7 +951,7 @@ aue_init(struct usb_ether *ue)
|
||||
AUE_SETBIT(sc, AUE_CTL0, AUE_CTL0_TX_ENB);
|
||||
AUE_SETBIT(sc, AUE_CTL2, AUE_CTL2_EP3_CLR);
|
||||
|
||||
usb2_transfer_set_stall(sc->sc_xfer[AUE_BULK_DT_WR]);
|
||||
usbd_transfer_set_stall(sc->sc_xfer[AUE_BULK_DT_WR]);
|
||||
|
||||
ifp->if_drv_flags |= IFF_DRV_RUNNING;
|
||||
aue_start(ue);
|
||||
@ -960,8 +960,8 @@ aue_init(struct usb_ether *ue)
|
||||
static void
|
||||
aue_setpromisc(struct usb_ether *ue)
|
||||
{
|
||||
struct aue_softc *sc = usb2_ether_getsc(ue);
|
||||
struct ifnet *ifp = usb2_ether_getifp(ue);
|
||||
struct aue_softc *sc = uether_getsc(ue);
|
||||
struct ifnet *ifp = uether_getifp(ue);
|
||||
|
||||
AUE_LOCK_ASSERT(sc, MA_OWNED);
|
||||
|
||||
@ -1017,8 +1017,8 @@ aue_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
|
||||
static void
|
||||
aue_stop(struct usb_ether *ue)
|
||||
{
|
||||
struct aue_softc *sc = usb2_ether_getsc(ue);
|
||||
struct ifnet *ifp = usb2_ether_getifp(ue);
|
||||
struct aue_softc *sc = uether_getsc(ue);
|
||||
struct ifnet *ifp = uether_getifp(ue);
|
||||
|
||||
AUE_LOCK_ASSERT(sc, MA_OWNED);
|
||||
|
||||
@ -1028,9 +1028,9 @@ aue_stop(struct usb_ether *ue)
|
||||
/*
|
||||
* stop all the transfers, if not already stopped:
|
||||
*/
|
||||
usb2_transfer_stop(sc->sc_xfer[AUE_BULK_DT_WR]);
|
||||
usb2_transfer_stop(sc->sc_xfer[AUE_BULK_DT_RD]);
|
||||
usb2_transfer_stop(sc->sc_xfer[AUE_INTR_DT_RD]);
|
||||
usbd_transfer_stop(sc->sc_xfer[AUE_BULK_DT_WR]);
|
||||
usbd_transfer_stop(sc->sc_xfer[AUE_BULK_DT_RD]);
|
||||
usbd_transfer_stop(sc->sc_xfer[AUE_INTR_DT_RD]);
|
||||
|
||||
aue_csr_write_1(sc, AUE_CTL0, 0);
|
||||
aue_csr_write_1(sc, AUE_CTL1, 0);
|
||||
|
@ -55,7 +55,7 @@
|
||||
/*
|
||||
* Note that while the ADMtek technically has four endpoints, the control
|
||||
* endpoint (endpoint 0) is regarded as special by the USB code and drivers
|
||||
* don't have direct access to it (we access it using usb2_do_request()
|
||||
* don't have direct access to it (we access it using usbd_do_request()
|
||||
* when reading/writing registers. Consequently, our endpoint indexes
|
||||
* don't match those in the ADMtek Pegasus manual: we consider the RX data
|
||||
* endpoint to be index 0 and work up from there.
|
||||
@ -183,7 +183,7 @@ enum {
|
||||
#define AUE_RXSTAT_DRIBBLE 0x10
|
||||
#define AUE_RXSTAT_MASK 0x1E
|
||||
|
||||
#define GET_MII(sc) usb2_ether_getmii(&(sc)->sc_ue)
|
||||
#define GET_MII(sc) uether_getmii(&(sc)->sc_ue)
|
||||
|
||||
struct aue_intrpkt {
|
||||
uint8_t aue_txstat0;
|
||||
|
@ -271,7 +271,7 @@ axe_cmd(struct axe_softc *sc, int cmd, int index, int val, void *buf)
|
||||
USETW(req.wIndex, index);
|
||||
USETW(req.wLength, AXE_CMD_LEN(cmd));
|
||||
|
||||
err = usb2_ether_do_request(&sc->sc_ue, &req, buf, 1000);
|
||||
err = uether_do_request(&sc->sc_ue, &req, buf, 1000);
|
||||
|
||||
return (err);
|
||||
}
|
||||
@ -347,7 +347,7 @@ axe_miibus_statchg(device_t dev)
|
||||
if (!locked)
|
||||
AXE_LOCK(sc);
|
||||
|
||||
ifp = usb2_ether_getifp(&sc->sc_ue);
|
||||
ifp = uether_getifp(&sc->sc_ue);
|
||||
if (mii == NULL || ifp == NULL ||
|
||||
(ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
|
||||
goto done;
|
||||
@ -442,8 +442,8 @@ axe_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
|
||||
static void
|
||||
axe_setmulti(struct usb_ether *ue)
|
||||
{
|
||||
struct axe_softc *sc = usb2_ether_getsc(ue);
|
||||
struct ifnet *ifp = usb2_ether_getifp(ue);
|
||||
struct axe_softc *sc = uether_getsc(ue);
|
||||
struct ifnet *ifp = uether_getifp(ue);
|
||||
struct ifmultiaddr *ifma;
|
||||
uint32_t h = 0;
|
||||
uint16_t rxmode;
|
||||
@ -522,35 +522,35 @@ axe_ax88178_init(struct axe_softc *sc)
|
||||
}
|
||||
|
||||
axe_cmd(sc, AXE_CMD_WRITE_GPIO, 0, 0x008c, NULL);
|
||||
usb2_ether_pause(&sc->sc_ue, hz / 16);
|
||||
uether_pause(&sc->sc_ue, hz / 16);
|
||||
|
||||
if ((eeprom >> 8) != 0x01) {
|
||||
axe_cmd(sc, AXE_CMD_WRITE_GPIO, 0, 0x003c, NULL);
|
||||
usb2_ether_pause(&sc->sc_ue, hz / 32);
|
||||
uether_pause(&sc->sc_ue, hz / 32);
|
||||
|
||||
axe_cmd(sc, AXE_CMD_WRITE_GPIO, 0, 0x001c, NULL);
|
||||
usb2_ether_pause(&sc->sc_ue, hz / 3);
|
||||
uether_pause(&sc->sc_ue, hz / 3);
|
||||
|
||||
axe_cmd(sc, AXE_CMD_WRITE_GPIO, 0, 0x003c, NULL);
|
||||
usb2_ether_pause(&sc->sc_ue, hz / 32);
|
||||
uether_pause(&sc->sc_ue, hz / 32);
|
||||
} else {
|
||||
axe_cmd(sc, AXE_CMD_WRITE_GPIO, 0, 0x0004, NULL);
|
||||
usb2_ether_pause(&sc->sc_ue, hz / 32);
|
||||
uether_pause(&sc->sc_ue, hz / 32);
|
||||
|
||||
axe_cmd(sc, AXE_CMD_WRITE_GPIO, 0, 0x000c, NULL);
|
||||
usb2_ether_pause(&sc->sc_ue, hz / 32);
|
||||
uether_pause(&sc->sc_ue, hz / 32);
|
||||
}
|
||||
|
||||
/* soft reset */
|
||||
axe_cmd(sc, AXE_CMD_SW_RESET_REG, 0, AXE_SW_RESET_CLEAR, NULL);
|
||||
usb2_ether_pause(&sc->sc_ue, hz / 4);
|
||||
uether_pause(&sc->sc_ue, hz / 4);
|
||||
|
||||
axe_cmd(sc, AXE_CMD_SW_RESET_REG, 0,
|
||||
AXE_SW_RESET_PRL | AXE_178_RESET_MAGIC, NULL);
|
||||
usb2_ether_pause(&sc->sc_ue, hz / 4);
|
||||
uether_pause(&sc->sc_ue, hz / 4);
|
||||
/* Enable MII/GMII/RGMII interface to work with external PHY. */
|
||||
axe_cmd(sc, AXE_CMD_SW_PHY_SELECT, 0, 0, NULL);
|
||||
usb2_ether_pause(&sc->sc_ue, hz / 4);
|
||||
uether_pause(&sc->sc_ue, hz / 4);
|
||||
|
||||
axe_cmd(sc, AXE_CMD_RXCTL_WRITE, 0, 0, NULL);
|
||||
}
|
||||
@ -559,22 +559,22 @@ static void
|
||||
axe_ax88772_init(struct axe_softc *sc)
|
||||
{
|
||||
axe_cmd(sc, AXE_CMD_WRITE_GPIO, 0, 0x00b0, NULL);
|
||||
usb2_ether_pause(&sc->sc_ue, hz / 16);
|
||||
uether_pause(&sc->sc_ue, hz / 16);
|
||||
|
||||
if (sc->sc_phyno == AXE_772_PHY_NO_EPHY) {
|
||||
/* ask for the embedded PHY */
|
||||
axe_cmd(sc, AXE_CMD_SW_PHY_SELECT, 0, 0x01, NULL);
|
||||
usb2_ether_pause(&sc->sc_ue, hz / 64);
|
||||
uether_pause(&sc->sc_ue, hz / 64);
|
||||
|
||||
/* power down and reset state, pin reset state */
|
||||
axe_cmd(sc, AXE_CMD_SW_RESET_REG, 0,
|
||||
AXE_SW_RESET_CLEAR, NULL);
|
||||
usb2_ether_pause(&sc->sc_ue, hz / 16);
|
||||
uether_pause(&sc->sc_ue, hz / 16);
|
||||
|
||||
/* power down/reset state, pin operating state */
|
||||
axe_cmd(sc, AXE_CMD_SW_RESET_REG, 0,
|
||||
AXE_SW_RESET_IPPD | AXE_SW_RESET_PRL, NULL);
|
||||
usb2_ether_pause(&sc->sc_ue, hz / 4);
|
||||
uether_pause(&sc->sc_ue, hz / 4);
|
||||
|
||||
/* power up, reset */
|
||||
axe_cmd(sc, AXE_CMD_SW_RESET_REG, 0, AXE_SW_RESET_PRL, NULL);
|
||||
@ -585,14 +585,14 @@ axe_ax88772_init(struct axe_softc *sc)
|
||||
} else {
|
||||
/* ask for external PHY */
|
||||
axe_cmd(sc, AXE_CMD_SW_PHY_SELECT, 0, 0x00, NULL);
|
||||
usb2_ether_pause(&sc->sc_ue, hz / 64);
|
||||
uether_pause(&sc->sc_ue, hz / 64);
|
||||
|
||||
/* power down internal PHY */
|
||||
axe_cmd(sc, AXE_CMD_SW_RESET_REG, 0,
|
||||
AXE_SW_RESET_IPPD | AXE_SW_RESET_PRL, NULL);
|
||||
}
|
||||
|
||||
usb2_ether_pause(&sc->sc_ue, hz / 4);
|
||||
uether_pause(&sc->sc_ue, hz / 4);
|
||||
axe_cmd(sc, AXE_CMD_RXCTL_WRITE, 0, 0, NULL);
|
||||
}
|
||||
|
||||
@ -602,21 +602,21 @@ axe_reset(struct axe_softc *sc)
|
||||
struct usb_config_descriptor *cd;
|
||||
usb_error_t err;
|
||||
|
||||
cd = usb2_get_config_descriptor(sc->sc_ue.ue_udev);
|
||||
cd = usbd_get_config_descriptor(sc->sc_ue.ue_udev);
|
||||
|
||||
err = usb2_req_set_config(sc->sc_ue.ue_udev, &sc->sc_mtx,
|
||||
err = usbd_req_set_config(sc->sc_ue.ue_udev, &sc->sc_mtx,
|
||||
cd->bConfigurationValue);
|
||||
if (err)
|
||||
DPRINTF("reset failed (ignored)\n");
|
||||
|
||||
/* Wait a little while for the chip to get its brains in order. */
|
||||
usb2_ether_pause(&sc->sc_ue, hz / 100);
|
||||
uether_pause(&sc->sc_ue, hz / 100);
|
||||
}
|
||||
|
||||
static void
|
||||
axe_attach_post(struct usb_ether *ue)
|
||||
{
|
||||
struct axe_softc *sc = usb2_ether_getsc(ue);
|
||||
struct axe_softc *sc = uether_getsc(ue);
|
||||
|
||||
/*
|
||||
* Load PHY indexes first. Needed by axe_xxx_init().
|
||||
@ -669,7 +669,7 @@ axe_probe(device_t dev)
|
||||
if (uaa->info.bIfaceIndex != AXE_IFACE_IDX)
|
||||
return (ENXIO);
|
||||
|
||||
return (usb2_lookup_id_by_uaa(axe_devs, sizeof(axe_devs), uaa));
|
||||
return (usbd_lookup_id_by_uaa(axe_devs, sizeof(axe_devs), uaa));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -687,12 +687,12 @@ axe_attach(device_t dev)
|
||||
|
||||
sc->sc_flags = USB_GET_DRIVER_INFO(uaa);
|
||||
|
||||
device_set_usb2_desc(dev);
|
||||
device_set_usb_desc(dev);
|
||||
|
||||
mtx_init(&sc->sc_mtx, device_get_nameunit(dev), NULL, MTX_DEF);
|
||||
|
||||
iface_index = AXE_IFACE_IDX;
|
||||
error = usb2_transfer_setup(uaa->device, &iface_index, sc->sc_xfer,
|
||||
error = usbd_transfer_setup(uaa->device, &iface_index, sc->sc_xfer,
|
||||
axe_config, AXE_N_TRANSFER, sc, &sc->sc_mtx);
|
||||
if (error) {
|
||||
device_printf(dev, "allocating USB transfers failed!\n");
|
||||
@ -705,7 +705,7 @@ axe_attach(device_t dev)
|
||||
ue->ue_mtx = &sc->sc_mtx;
|
||||
ue->ue_methods = &axe_ue_methods;
|
||||
|
||||
error = usb2_ether_ifattach(ue);
|
||||
error = uether_ifattach(ue);
|
||||
if (error) {
|
||||
device_printf(dev, "could not attach interface\n");
|
||||
goto detach;
|
||||
@ -723,8 +723,8 @@ axe_detach(device_t dev)
|
||||
struct axe_softc *sc = device_get_softc(dev);
|
||||
struct usb_ether *ue = &sc->sc_ue;
|
||||
|
||||
usb2_transfer_unsetup(sc->sc_xfer, AXE_N_TRANSFER);
|
||||
usb2_ether_ifdetach(ue);
|
||||
usbd_transfer_unsetup(sc->sc_xfer, AXE_N_TRANSFER);
|
||||
uether_ifdetach(ue);
|
||||
mtx_destroy(&sc->sc_mtx);
|
||||
|
||||
return (0);
|
||||
@ -738,7 +738,7 @@ axe_intr_callback(struct usb_xfer *xfer)
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
@ -760,7 +760,7 @@ axe_bulk_read_callback(struct usb_xfer *xfer)
|
||||
{
|
||||
struct axe_softc *sc = xfer->priv_sc;
|
||||
struct usb_ether *ue = &sc->sc_ue;
|
||||
struct ifnet *ifp = usb2_ether_getifp(ue);
|
||||
struct ifnet *ifp = uether_getifp(ue);
|
||||
struct axe_sframe_hdr hdr;
|
||||
int error, pos, len, adjust;
|
||||
|
||||
@ -773,7 +773,7 @@ axe_bulk_read_callback(struct usb_xfer *xfer)
|
||||
/* too little data */
|
||||
break;
|
||||
}
|
||||
usb2_copy_out(xfer->frbuffers, pos, &hdr, sizeof(hdr));
|
||||
usbd_copy_out(xfer->frbuffers, pos, &hdr, sizeof(hdr));
|
||||
|
||||
if ((hdr.len ^ hdr.ilen) != 0xFFFF) {
|
||||
/* we lost sync */
|
||||
@ -793,7 +793,7 @@ axe_bulk_read_callback(struct usb_xfer *xfer)
|
||||
len = xfer->actlen;
|
||||
adjust = 0;
|
||||
}
|
||||
error = usb2_ether_rxbuf(ue, xfer->frbuffers, pos, len);
|
||||
error = uether_rxbuf(ue, xfer->frbuffers, pos, len);
|
||||
if (error)
|
||||
break;
|
||||
|
||||
@ -815,13 +815,13 @@ axe_bulk_read_callback(struct usb_xfer *xfer)
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
usb2_ether_rxflush(ue);
|
||||
usbd_transfer_submit(xfer);
|
||||
uether_rxflush(ue);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
DPRINTF("bulk read error, %s\n",
|
||||
usb2_errstr(xfer->error));
|
||||
usbd_errstr(xfer->error));
|
||||
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
/* try to clear stall first */
|
||||
@ -842,7 +842,7 @@ axe_bulk_write_callback(struct usb_xfer *xfer)
|
||||
{
|
||||
struct axe_softc *sc = xfer->priv_sc;
|
||||
struct axe_sframe_hdr hdr;
|
||||
struct ifnet *ifp = usb2_ether_getifp(&sc->sc_ue);
|
||||
struct ifnet *ifp = uether_getifp(&sc->sc_ue);
|
||||
struct mbuf *m;
|
||||
int pos;
|
||||
|
||||
@ -878,7 +878,7 @@ axe_bulk_write_callback(struct usb_xfer *xfer)
|
||||
hdr.len = htole16(m->m_pkthdr.len);
|
||||
hdr.ilen = ~hdr.len;
|
||||
|
||||
usb2_copy_in(xfer->frbuffers, pos, &hdr, sizeof(hdr));
|
||||
usbd_copy_in(xfer->frbuffers, pos, &hdr, sizeof(hdr));
|
||||
|
||||
pos += sizeof(hdr);
|
||||
|
||||
@ -890,7 +890,7 @@ axe_bulk_write_callback(struct usb_xfer *xfer)
|
||||
* USB_FORCE_SHORT_XFER flag instead.
|
||||
*/
|
||||
}
|
||||
usb2_m_copy_in(xfer->frbuffers, pos,
|
||||
usbd_m_copy_in(xfer->frbuffers, pos,
|
||||
m, 0, m->m_pkthdr.len);
|
||||
|
||||
pos += m->m_pkthdr.len;
|
||||
@ -915,12 +915,12 @@ axe_bulk_write_callback(struct usb_xfer *xfer)
|
||||
}
|
||||
|
||||
xfer->frlengths[0] = pos;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
DPRINTFN(11, "transfer error, %s\n",
|
||||
usb2_errstr(xfer->error));
|
||||
usbd_errstr(xfer->error));
|
||||
|
||||
ifp->if_oerrors++;
|
||||
|
||||
@ -937,7 +937,7 @@ axe_bulk_write_callback(struct usb_xfer *xfer)
|
||||
static void
|
||||
axe_tick(struct usb_ether *ue)
|
||||
{
|
||||
struct axe_softc *sc = usb2_ether_getsc(ue);
|
||||
struct axe_softc *sc = uether_getsc(ue);
|
||||
struct mii_data *mii = GET_MII(sc);
|
||||
|
||||
AXE_LOCK_ASSERT(sc, MA_OWNED);
|
||||
@ -953,21 +953,21 @@ axe_tick(struct usb_ether *ue)
|
||||
static void
|
||||
axe_start(struct usb_ether *ue)
|
||||
{
|
||||
struct axe_softc *sc = usb2_ether_getsc(ue);
|
||||
struct axe_softc *sc = uether_getsc(ue);
|
||||
|
||||
/*
|
||||
* start the USB transfers, if not already started:
|
||||
*/
|
||||
usb2_transfer_start(sc->sc_xfer[AXE_INTR_DT_RD]);
|
||||
usb2_transfer_start(sc->sc_xfer[AXE_BULK_DT_RD]);
|
||||
usb2_transfer_start(sc->sc_xfer[AXE_BULK_DT_WR]);
|
||||
usbd_transfer_start(sc->sc_xfer[AXE_INTR_DT_RD]);
|
||||
usbd_transfer_start(sc->sc_xfer[AXE_BULK_DT_RD]);
|
||||
usbd_transfer_start(sc->sc_xfer[AXE_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
axe_init(struct usb_ether *ue)
|
||||
{
|
||||
struct axe_softc *sc = usb2_ether_getsc(ue);
|
||||
struct ifnet *ifp = usb2_ether_getifp(ue);
|
||||
struct axe_softc *sc = uether_getsc(ue);
|
||||
struct ifnet *ifp = uether_getifp(ue);
|
||||
uint16_t rxmode;
|
||||
|
||||
AXE_LOCK_ASSERT(sc, MA_OWNED);
|
||||
@ -1010,7 +1010,7 @@ axe_init(struct usb_ether *ue)
|
||||
/* Load the multicast filter. */
|
||||
axe_setmulti(ue);
|
||||
|
||||
usb2_transfer_set_stall(sc->sc_xfer[AXE_BULK_DT_WR]);
|
||||
usbd_transfer_set_stall(sc->sc_xfer[AXE_BULK_DT_WR]);
|
||||
|
||||
ifp->if_drv_flags |= IFF_DRV_RUNNING;
|
||||
axe_start(ue);
|
||||
@ -1019,8 +1019,8 @@ axe_init(struct usb_ether *ue)
|
||||
static void
|
||||
axe_setpromisc(struct usb_ether *ue)
|
||||
{
|
||||
struct axe_softc *sc = usb2_ether_getsc(ue);
|
||||
struct ifnet *ifp = usb2_ether_getifp(ue);
|
||||
struct axe_softc *sc = uether_getsc(ue);
|
||||
struct ifnet *ifp = uether_getifp(ue);
|
||||
uint16_t rxmode;
|
||||
|
||||
axe_cmd(sc, AXE_CMD_RXCTL_READ, 0, 0, &rxmode);
|
||||
@ -1041,8 +1041,8 @@ axe_setpromisc(struct usb_ether *ue)
|
||||
static void
|
||||
axe_stop(struct usb_ether *ue)
|
||||
{
|
||||
struct axe_softc *sc = usb2_ether_getsc(ue);
|
||||
struct ifnet *ifp = usb2_ether_getifp(ue);
|
||||
struct axe_softc *sc = uether_getsc(ue);
|
||||
struct ifnet *ifp = uether_getifp(ue);
|
||||
|
||||
AXE_LOCK_ASSERT(sc, MA_OWNED);
|
||||
|
||||
@ -1052,9 +1052,9 @@ axe_stop(struct usb_ether *ue)
|
||||
/*
|
||||
* stop all the transfers, if not already stopped:
|
||||
*/
|
||||
usb2_transfer_stop(sc->sc_xfer[AXE_BULK_DT_WR]);
|
||||
usb2_transfer_stop(sc->sc_xfer[AXE_BULK_DT_RD]);
|
||||
usb2_transfer_stop(sc->sc_xfer[AXE_INTR_DT_RD]);
|
||||
usbd_transfer_stop(sc->sc_xfer[AXE_BULK_DT_WR]);
|
||||
usbd_transfer_stop(sc->sc_xfer[AXE_BULK_DT_RD]);
|
||||
usbd_transfer_stop(sc->sc_xfer[AXE_INTR_DT_RD]);
|
||||
|
||||
axe_reset(sc);
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ struct axe_sframe_hdr {
|
||||
uint16_t ilen;
|
||||
} __packed;
|
||||
|
||||
#define GET_MII(sc) usb2_ether_getmii(&(sc)->sc_ue)
|
||||
#define GET_MII(sc) uether_getmii(&(sc)->sc_ue)
|
||||
|
||||
/* The interrupt endpoint is currently unused by the ASIX part. */
|
||||
enum {
|
||||
|
@ -207,7 +207,7 @@ cdce_probe(device_t dev)
|
||||
{
|
||||
struct usb_attach_arg *uaa = device_get_ivars(dev);
|
||||
|
||||
return (usb2_lookup_id_by_uaa(cdce_devs, sizeof(cdce_devs), uaa));
|
||||
return (usbd_lookup_id_by_uaa(cdce_devs, sizeof(cdce_devs), uaa));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -233,7 +233,7 @@ cdce_attach(device_t dev)
|
||||
|
||||
sc->sc_flags = USB_GET_DRIVER_INFO(uaa);
|
||||
|
||||
device_set_usb2_desc(dev);
|
||||
device_set_usb_desc(dev);
|
||||
|
||||
mtx_init(&sc->sc_mtx, device_get_nameunit(dev), NULL, MTX_DEF);
|
||||
|
||||
@ -255,17 +255,17 @@ cdce_attach(device_t dev)
|
||||
|
||||
for (i = 0;; i++) {
|
||||
|
||||
iface = usb2_get_iface(uaa->device, i);
|
||||
iface = usbd_get_iface(uaa->device, i);
|
||||
|
||||
if (iface) {
|
||||
|
||||
id = usb2_get_interface_descriptor(iface);
|
||||
id = usbd_get_interface_descriptor(iface);
|
||||
|
||||
if (id && (id->bInterfaceNumber ==
|
||||
sc->sc_data_iface_no)) {
|
||||
sc->sc_ifaces_index[0] = i;
|
||||
sc->sc_ifaces_index[1] = uaa->info.bIfaceIndex;
|
||||
usb2_set_parent_iface(uaa->device, i, uaa->info.bIfaceIndex);
|
||||
usbd_set_parent_iface(uaa->device, i, uaa->info.bIfaceIndex);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
@ -301,7 +301,7 @@ cdce_attach(device_t dev)
|
||||
|
||||
for (i = 0; i != 32; i++) {
|
||||
|
||||
error = usb2_set_alt_interface_index
|
||||
error = usbd_set_alt_interface_index
|
||||
(uaa->device, sc->sc_ifaces_index[0], i);
|
||||
|
||||
if (error) {
|
||||
@ -309,7 +309,7 @@ cdce_attach(device_t dev)
|
||||
"setting found!\n");
|
||||
goto detach;
|
||||
}
|
||||
error = usb2_transfer_setup
|
||||
error = usbd_transfer_setup
|
||||
(uaa->device, sc->sc_ifaces_index,
|
||||
sc->sc_xfer, cdce_config, CDCE_N_TRANSFER,
|
||||
sc, &sc->sc_mtx);
|
||||
@ -326,7 +326,7 @@ cdce_attach(device_t dev)
|
||||
if ((ued == NULL) || (ued->bLength < sizeof(*ued))) {
|
||||
error = USB_ERR_INVAL;
|
||||
} else {
|
||||
error = usb2_req_get_string_any(uaa->device, NULL,
|
||||
error = usbd_req_get_string_any(uaa->device, NULL,
|
||||
eaddr_str, sizeof(eaddr_str), ued->iMacAddress);
|
||||
}
|
||||
|
||||
@ -375,7 +375,7 @@ cdce_attach(device_t dev)
|
||||
ue->ue_mtx = &sc->sc_mtx;
|
||||
ue->ue_methods = &cdce_ue_methods;
|
||||
|
||||
error = usb2_ether_ifattach(ue);
|
||||
error = uether_ifattach(ue);
|
||||
if (error) {
|
||||
device_printf(dev, "could not attach interface\n");
|
||||
goto detach;
|
||||
@ -394,8 +394,8 @@ cdce_detach(device_t dev)
|
||||
struct usb_ether *ue = &sc->sc_ue;
|
||||
|
||||
/* stop all USB transfers first */
|
||||
usb2_transfer_unsetup(sc->sc_xfer, CDCE_N_TRANSFER);
|
||||
usb2_ether_ifdetach(ue);
|
||||
usbd_transfer_unsetup(sc->sc_xfer, CDCE_N_TRANSFER);
|
||||
uether_ifdetach(ue);
|
||||
mtx_destroy(&sc->sc_mtx);
|
||||
|
||||
return (0);
|
||||
@ -404,13 +404,13 @@ cdce_detach(device_t dev)
|
||||
static void
|
||||
cdce_start(struct usb_ether *ue)
|
||||
{
|
||||
struct cdce_softc *sc = usb2_ether_getsc(ue);
|
||||
struct cdce_softc *sc = uether_getsc(ue);
|
||||
|
||||
/*
|
||||
* Start the USB transfers, if not already started:
|
||||
*/
|
||||
usb2_transfer_start(sc->sc_xfer[CDCE_BULK_TX]);
|
||||
usb2_transfer_start(sc->sc_xfer[CDCE_BULK_RX]);
|
||||
usbd_transfer_start(sc->sc_xfer[CDCE_BULK_TX]);
|
||||
usbd_transfer_start(sc->sc_xfer[CDCE_BULK_RX]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -429,7 +429,7 @@ static void
|
||||
cdce_bulk_write_callback(struct usb_xfer *xfer)
|
||||
{
|
||||
struct cdce_softc *sc = xfer->priv_sc;
|
||||
struct ifnet *ifp = usb2_ether_getifp(&sc->sc_ue);
|
||||
struct ifnet *ifp = uether_getifp(&sc->sc_ue);
|
||||
struct mbuf *m;
|
||||
struct mbuf *mt;
|
||||
uint32_t crc;
|
||||
@ -487,7 +487,7 @@ cdce_bulk_write_callback(struct usb_xfer *xfer)
|
||||
}
|
||||
sc->sc_tx_buf[x] = m;
|
||||
xfer->frlengths[x] = m->m_len;
|
||||
usb2_set_frame_data(xfer, m->m_data, x);
|
||||
usbd_set_frame_data(xfer, m->m_data, x);
|
||||
|
||||
/*
|
||||
* If there's a BPF listener, bounce a copy of
|
||||
@ -497,13 +497,13 @@ cdce_bulk_write_callback(struct usb_xfer *xfer)
|
||||
}
|
||||
if (x != 0) {
|
||||
xfer->nframes = x;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
}
|
||||
break;
|
||||
|
||||
default: /* Error */
|
||||
DPRINTFN(11, "transfer error, %s\n",
|
||||
usb2_errstr(xfer->error));
|
||||
usbd_errstr(xfer->error));
|
||||
|
||||
/* free all previous TX buffers */
|
||||
cdce_free_queue(sc->sc_tx_buf, CDCE_FRAMES_MAX);
|
||||
@ -542,19 +542,19 @@ cdce_m_crc32(struct mbuf *m, uint32_t src_offset, uint32_t src_len)
|
||||
static void
|
||||
cdce_init(struct usb_ether *ue)
|
||||
{
|
||||
struct cdce_softc *sc = usb2_ether_getsc(ue);
|
||||
struct ifnet *ifp = usb2_ether_getifp(ue);
|
||||
struct cdce_softc *sc = uether_getsc(ue);
|
||||
struct ifnet *ifp = uether_getifp(ue);
|
||||
|
||||
CDCE_LOCK_ASSERT(sc, MA_OWNED);
|
||||
|
||||
ifp->if_drv_flags |= IFF_DRV_RUNNING;
|
||||
|
||||
/* start interrupt transfer */
|
||||
usb2_transfer_start(sc->sc_xfer[CDCE_INTR_RX]);
|
||||
usb2_transfer_start(sc->sc_xfer[CDCE_INTR_TX]);
|
||||
usbd_transfer_start(sc->sc_xfer[CDCE_INTR_RX]);
|
||||
usbd_transfer_start(sc->sc_xfer[CDCE_INTR_TX]);
|
||||
|
||||
/* stall data write direction, which depends on USB mode */
|
||||
usb2_transfer_set_stall(sc->sc_xfer[CDCE_BULK_TX]);
|
||||
usbd_transfer_set_stall(sc->sc_xfer[CDCE_BULK_TX]);
|
||||
|
||||
/* start data transfers */
|
||||
cdce_start(ue);
|
||||
@ -563,8 +563,8 @@ cdce_init(struct usb_ether *ue)
|
||||
static void
|
||||
cdce_stop(struct usb_ether *ue)
|
||||
{
|
||||
struct cdce_softc *sc = usb2_ether_getsc(ue);
|
||||
struct ifnet *ifp = usb2_ether_getifp(ue);
|
||||
struct cdce_softc *sc = uether_getsc(ue);
|
||||
struct ifnet *ifp = uether_getifp(ue);
|
||||
|
||||
CDCE_LOCK_ASSERT(sc, MA_OWNED);
|
||||
|
||||
@ -573,10 +573,10 @@ cdce_stop(struct usb_ether *ue)
|
||||
/*
|
||||
* stop all the transfers, if not already stopped:
|
||||
*/
|
||||
usb2_transfer_stop(sc->sc_xfer[CDCE_BULK_RX]);
|
||||
usb2_transfer_stop(sc->sc_xfer[CDCE_BULK_TX]);
|
||||
usb2_transfer_stop(sc->sc_xfer[CDCE_INTR_RX]);
|
||||
usb2_transfer_stop(sc->sc_xfer[CDCE_INTR_TX]);
|
||||
usbd_transfer_stop(sc->sc_xfer[CDCE_BULK_RX]);
|
||||
usbd_transfer_stop(sc->sc_xfer[CDCE_BULK_TX]);
|
||||
usbd_transfer_stop(sc->sc_xfer[CDCE_INTR_RX]);
|
||||
usbd_transfer_stop(sc->sc_xfer[CDCE_INTR_TX]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -635,7 +635,7 @@ cdce_bulk_read_callback(struct usb_xfer *xfer)
|
||||
continue;
|
||||
}
|
||||
/* queue up mbuf */
|
||||
usb2_ether_rxmbuf(&sc->sc_ue, m, xfer->frlengths[x]);
|
||||
uether_rxmbuf(&sc->sc_ue, m, xfer->frlengths[x]);
|
||||
}
|
||||
|
||||
/* FALLTHROUGH */
|
||||
@ -646,7 +646,7 @@ cdce_bulk_read_callback(struct usb_xfer *xfer)
|
||||
*/
|
||||
for (x = 0; x != 1; x++) {
|
||||
if (sc->sc_rx_buf[x] == NULL) {
|
||||
m = usb2_ether_newbuf();
|
||||
m = uether_newbuf();
|
||||
if (m == NULL)
|
||||
goto tr_stall;
|
||||
sc->sc_rx_buf[x] = m;
|
||||
@ -654,26 +654,26 @@ cdce_bulk_read_callback(struct usb_xfer *xfer)
|
||||
m = sc->sc_rx_buf[x];
|
||||
}
|
||||
|
||||
usb2_set_frame_data(xfer, m->m_data, x);
|
||||
usbd_set_frame_data(xfer, m->m_data, x);
|
||||
xfer->frlengths[x] = m->m_len;
|
||||
}
|
||||
/* set number of frames and start hardware */
|
||||
xfer->nframes = x;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
/* flush any received frames */
|
||||
usb2_ether_rxflush(&sc->sc_ue);
|
||||
uether_rxflush(&sc->sc_ue);
|
||||
break;
|
||||
|
||||
default: /* Error */
|
||||
DPRINTF("error = %s\n",
|
||||
usb2_errstr(xfer->error));
|
||||
usbd_errstr(xfer->error));
|
||||
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
tr_stall:
|
||||
/* try to clear stall first */
|
||||
xfer->flags.stall_pipe = 1;
|
||||
xfer->nframes = 0;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -699,7 +699,7 @@ cdce_intr_read_callback(struct usb_xfer *xfer)
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
break;
|
||||
|
||||
default: /* Error */
|
||||
@ -726,7 +726,7 @@ cdce_intr_write_callback(struct usb_xfer *xfer)
|
||||
tr_setup:
|
||||
#if 0
|
||||
xfer->frlengths[0] = XXX;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
#endif
|
||||
break;
|
||||
|
||||
|
@ -186,7 +186,7 @@ cue_csr_read_1(struct cue_softc *sc, uint16_t reg)
|
||||
USETW(req.wIndex, reg);
|
||||
USETW(req.wLength, 1);
|
||||
|
||||
if (usb2_ether_do_request(&sc->sc_ue, &req, &val, 1000)) {
|
||||
if (uether_do_request(&sc->sc_ue, &req, &val, 1000)) {
|
||||
/* ignore any errors */
|
||||
}
|
||||
return (val);
|
||||
@ -204,7 +204,7 @@ cue_csr_read_2(struct cue_softc *sc, uint8_t reg)
|
||||
USETW(req.wIndex, reg);
|
||||
USETW(req.wLength, 2);
|
||||
|
||||
(void)usb2_ether_do_request(&sc->sc_ue, &req, &val, 1000);
|
||||
(void)uether_do_request(&sc->sc_ue, &req, &val, 1000);
|
||||
return (le16toh(val));
|
||||
}
|
||||
|
||||
@ -219,7 +219,7 @@ cue_csr_write_1(struct cue_softc *sc, uint16_t reg, uint16_t val)
|
||||
USETW(req.wIndex, reg);
|
||||
USETW(req.wLength, 0);
|
||||
|
||||
return (usb2_ether_do_request(&sc->sc_ue, &req, NULL, 1000));
|
||||
return (uether_do_request(&sc->sc_ue, &req, NULL, 1000));
|
||||
}
|
||||
|
||||
static int
|
||||
@ -236,7 +236,7 @@ cue_mem(struct cue_softc *sc, uint8_t cmd, uint16_t addr, void *buf, int len)
|
||||
USETW(req.wIndex, addr);
|
||||
USETW(req.wLength, len);
|
||||
|
||||
return (usb2_ether_do_request(&sc->sc_ue, &req, buf, 1000));
|
||||
return (uether_do_request(&sc->sc_ue, &req, buf, 1000));
|
||||
}
|
||||
|
||||
static int
|
||||
@ -250,7 +250,7 @@ cue_getmac(struct cue_softc *sc, void *buf)
|
||||
USETW(req.wIndex, 0);
|
||||
USETW(req.wLength, ETHER_ADDR_LEN);
|
||||
|
||||
return (usb2_ether_do_request(&sc->sc_ue, &req, buf, 1000));
|
||||
return (uether_do_request(&sc->sc_ue, &req, buf, 1000));
|
||||
}
|
||||
|
||||
#define CUE_BITS 9
|
||||
@ -269,8 +269,8 @@ cue_mchash(const uint8_t *addr)
|
||||
static void
|
||||
cue_setpromisc(struct usb_ether *ue)
|
||||
{
|
||||
struct cue_softc *sc = usb2_ether_getsc(ue);
|
||||
struct ifnet *ifp = usb2_ether_getifp(ue);
|
||||
struct cue_softc *sc = uether_getsc(ue);
|
||||
struct ifnet *ifp = uether_getifp(ue);
|
||||
|
||||
CUE_LOCK_ASSERT(sc, MA_OWNED);
|
||||
|
||||
@ -287,8 +287,8 @@ cue_setpromisc(struct usb_ether *ue)
|
||||
static void
|
||||
cue_setmulti(struct usb_ether *ue)
|
||||
{
|
||||
struct cue_softc *sc = usb2_ether_getsc(ue);
|
||||
struct ifnet *ifp = usb2_ether_getifp(ue);
|
||||
struct cue_softc *sc = uether_getsc(ue);
|
||||
struct ifnet *ifp = uether_getifp(ue);
|
||||
struct ifmultiaddr *ifma;
|
||||
uint32_t h = 0, i;
|
||||
uint8_t hashtbl[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
@ -337,20 +337,20 @@ cue_reset(struct cue_softc *sc)
|
||||
USETW(req.wIndex, 0);
|
||||
USETW(req.wLength, 0);
|
||||
|
||||
if (usb2_ether_do_request(&sc->sc_ue, &req, NULL, 1000)) {
|
||||
if (uether_do_request(&sc->sc_ue, &req, NULL, 1000)) {
|
||||
/* ignore any errors */
|
||||
}
|
||||
|
||||
/*
|
||||
* wait a little while for the chip to get its brains in order:
|
||||
*/
|
||||
usb2_ether_pause(&sc->sc_ue, hz / 100);
|
||||
uether_pause(&sc->sc_ue, hz / 100);
|
||||
}
|
||||
|
||||
static void
|
||||
cue_attach_post(struct usb_ether *ue)
|
||||
{
|
||||
struct cue_softc *sc = usb2_ether_getsc(ue);
|
||||
struct cue_softc *sc = uether_getsc(ue);
|
||||
|
||||
cue_getmac(sc, ue->ue_eaddr);
|
||||
}
|
||||
@ -367,7 +367,7 @@ cue_probe(device_t dev)
|
||||
if (uaa->info.bIfaceIndex != CUE_IFACE_IDX)
|
||||
return (ENXIO);
|
||||
|
||||
return (usb2_lookup_id_by_uaa(cue_devs, sizeof(cue_devs), uaa));
|
||||
return (usbd_lookup_id_by_uaa(cue_devs, sizeof(cue_devs), uaa));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -383,11 +383,11 @@ cue_attach(device_t dev)
|
||||
uint8_t iface_index;
|
||||
int error;
|
||||
|
||||
device_set_usb2_desc(dev);
|
||||
device_set_usb_desc(dev);
|
||||
mtx_init(&sc->sc_mtx, device_get_nameunit(dev), NULL, MTX_DEF);
|
||||
|
||||
iface_index = CUE_IFACE_IDX;
|
||||
error = usb2_transfer_setup(uaa->device, &iface_index,
|
||||
error = usbd_transfer_setup(uaa->device, &iface_index,
|
||||
sc->sc_xfer, cue_config, CUE_N_TRANSFER, sc, &sc->sc_mtx);
|
||||
if (error) {
|
||||
device_printf(dev, "allocating USB transfers failed!\n");
|
||||
@ -400,7 +400,7 @@ cue_attach(device_t dev)
|
||||
ue->ue_mtx = &sc->sc_mtx;
|
||||
ue->ue_methods = &cue_ue_methods;
|
||||
|
||||
error = usb2_ether_ifattach(ue);
|
||||
error = uether_ifattach(ue);
|
||||
if (error) {
|
||||
device_printf(dev, "could not attach interface\n");
|
||||
goto detach;
|
||||
@ -418,8 +418,8 @@ cue_detach(device_t dev)
|
||||
struct cue_softc *sc = device_get_softc(dev);
|
||||
struct usb_ether *ue = &sc->sc_ue;
|
||||
|
||||
usb2_transfer_unsetup(sc->sc_xfer, CUE_N_TRANSFER);
|
||||
usb2_ether_ifdetach(ue);
|
||||
usbd_transfer_unsetup(sc->sc_xfer, CUE_N_TRANSFER);
|
||||
uether_ifdetach(ue);
|
||||
mtx_destroy(&sc->sc_mtx);
|
||||
|
||||
return (0);
|
||||
@ -430,7 +430,7 @@ cue_bulk_read_callback(struct usb_xfer *xfer)
|
||||
{
|
||||
struct cue_softc *sc = xfer->priv_sc;
|
||||
struct usb_ether *ue = &sc->sc_ue;
|
||||
struct ifnet *ifp = usb2_ether_getifp(ue);
|
||||
struct ifnet *ifp = uether_getifp(ue);
|
||||
uint8_t buf[2];
|
||||
int len;
|
||||
|
||||
@ -441,23 +441,23 @@ cue_bulk_read_callback(struct usb_xfer *xfer)
|
||||
ifp->if_ierrors++;
|
||||
goto tr_setup;
|
||||
}
|
||||
usb2_copy_out(xfer->frbuffers, 0, buf, 2);
|
||||
usbd_copy_out(xfer->frbuffers, 0, buf, 2);
|
||||
xfer->actlen -= 2;
|
||||
len = buf[0] | (buf[1] << 8);
|
||||
len = min(xfer->actlen, len);
|
||||
|
||||
usb2_ether_rxbuf(ue, xfer->frbuffers, 2, len);
|
||||
uether_rxbuf(ue, xfer->frbuffers, 2, len);
|
||||
/* FALLTHROUGH */
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
usb2_ether_rxflush(ue);
|
||||
usbd_transfer_submit(xfer);
|
||||
uether_rxflush(ue);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
DPRINTF("bulk read error, %s\n",
|
||||
usb2_errstr(xfer->error));
|
||||
usbd_errstr(xfer->error));
|
||||
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
/* try to clear stall first */
|
||||
@ -473,7 +473,7 @@ static void
|
||||
cue_bulk_write_callback(struct usb_xfer *xfer)
|
||||
{
|
||||
struct cue_softc *sc = xfer->priv_sc;
|
||||
struct ifnet *ifp = usb2_ether_getifp(&sc->sc_ue);
|
||||
struct ifnet *ifp = uether_getifp(&sc->sc_ue);
|
||||
struct mbuf *m;
|
||||
uint8_t buf[2];
|
||||
|
||||
@ -498,9 +498,9 @@ cue_bulk_write_callback(struct usb_xfer *xfer)
|
||||
buf[0] = (uint8_t)(m->m_pkthdr.len);
|
||||
buf[1] = (uint8_t)(m->m_pkthdr.len >> 8);
|
||||
|
||||
usb2_copy_in(xfer->frbuffers, 0, buf, 2);
|
||||
usbd_copy_in(xfer->frbuffers, 0, buf, 2);
|
||||
|
||||
usb2_m_copy_in(xfer->frbuffers, 2,
|
||||
usbd_m_copy_in(xfer->frbuffers, 2,
|
||||
m, 0, m->m_pkthdr.len);
|
||||
|
||||
/*
|
||||
@ -511,13 +511,13 @@ cue_bulk_write_callback(struct usb_xfer *xfer)
|
||||
|
||||
m_freem(m);
|
||||
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
DPRINTFN(11, "transfer error, %s\n",
|
||||
usb2_errstr(xfer->error));
|
||||
usbd_errstr(xfer->error));
|
||||
|
||||
ifp->if_oerrors++;
|
||||
|
||||
@ -533,8 +533,8 @@ cue_bulk_write_callback(struct usb_xfer *xfer)
|
||||
static void
|
||||
cue_tick(struct usb_ether *ue)
|
||||
{
|
||||
struct cue_softc *sc = usb2_ether_getsc(ue);
|
||||
struct ifnet *ifp = usb2_ether_getifp(ue);
|
||||
struct cue_softc *sc = uether_getsc(ue);
|
||||
struct ifnet *ifp = uether_getifp(ue);
|
||||
|
||||
CUE_LOCK_ASSERT(sc, MA_OWNED);
|
||||
|
||||
@ -549,20 +549,20 @@ cue_tick(struct usb_ether *ue)
|
||||
static void
|
||||
cue_start(struct usb_ether *ue)
|
||||
{
|
||||
struct cue_softc *sc = usb2_ether_getsc(ue);
|
||||
struct cue_softc *sc = uether_getsc(ue);
|
||||
|
||||
/*
|
||||
* start the USB transfers, if not already started:
|
||||
*/
|
||||
usb2_transfer_start(sc->sc_xfer[CUE_BULK_DT_RD]);
|
||||
usb2_transfer_start(sc->sc_xfer[CUE_BULK_DT_WR]);
|
||||
usbd_transfer_start(sc->sc_xfer[CUE_BULK_DT_RD]);
|
||||
usbd_transfer_start(sc->sc_xfer[CUE_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
cue_init(struct usb_ether *ue)
|
||||
{
|
||||
struct cue_softc *sc = usb2_ether_getsc(ue);
|
||||
struct ifnet *ifp = usb2_ether_getifp(ue);
|
||||
struct cue_softc *sc = uether_getsc(ue);
|
||||
struct ifnet *ifp = uether_getifp(ue);
|
||||
int i;
|
||||
|
||||
CUE_LOCK_ASSERT(sc, MA_OWNED);
|
||||
@ -598,7 +598,7 @@ cue_init(struct usb_ether *ue)
|
||||
/* Program the LED operation. */
|
||||
cue_csr_write_1(sc, CUE_LEDCTL, CUE_LEDCTL_FOLLOW_LINK);
|
||||
|
||||
usb2_transfer_set_stall(sc->sc_xfer[CUE_BULK_DT_WR]);
|
||||
usbd_transfer_set_stall(sc->sc_xfer[CUE_BULK_DT_WR]);
|
||||
|
||||
ifp->if_drv_flags |= IFF_DRV_RUNNING;
|
||||
cue_start(ue);
|
||||
@ -611,8 +611,8 @@ cue_init(struct usb_ether *ue)
|
||||
static void
|
||||
cue_stop(struct usb_ether *ue)
|
||||
{
|
||||
struct cue_softc *sc = usb2_ether_getsc(ue);
|
||||
struct ifnet *ifp = usb2_ether_getifp(ue);
|
||||
struct cue_softc *sc = uether_getsc(ue);
|
||||
struct ifnet *ifp = uether_getifp(ue);
|
||||
|
||||
CUE_LOCK_ASSERT(sc, MA_OWNED);
|
||||
|
||||
@ -621,8 +621,8 @@ cue_stop(struct usb_ether *ue)
|
||||
/*
|
||||
* stop all the transfers, if not already stopped:
|
||||
*/
|
||||
usb2_transfer_stop(sc->sc_xfer[CUE_BULK_DT_WR]);
|
||||
usb2_transfer_stop(sc->sc_xfer[CUE_BULK_DT_RD]);
|
||||
usbd_transfer_stop(sc->sc_xfer[CUE_BULK_DT_WR]);
|
||||
usbd_transfer_stop(sc->sc_xfer[CUE_BULK_DT_RD]);
|
||||
|
||||
cue_csr_write_1(sc, CUE_ETHCTL, 0);
|
||||
cue_reset(sc);
|
||||
|
@ -223,7 +223,7 @@ kue_do_request(struct kue_softc *sc, struct usb_device_request *req,
|
||||
{
|
||||
usb_error_t err;
|
||||
|
||||
err = usb2_ether_do_request(&sc->sc_ue, req, data, 60000);
|
||||
err = uether_do_request(&sc->sc_ue, req, data, 60000);
|
||||
|
||||
return (err);
|
||||
}
|
||||
@ -269,7 +269,7 @@ kue_load_fw(struct kue_softc *sc)
|
||||
uint16_t hwrev;
|
||||
usb_error_t err;
|
||||
|
||||
dd = usb2_get_device_descriptor(sc->sc_ue.ue_udev);
|
||||
dd = usbd_get_device_descriptor(sc->sc_ue.ue_udev);
|
||||
hwrev = UGETW(dd->bcdDevice);
|
||||
|
||||
/*
|
||||
@ -294,7 +294,7 @@ kue_load_fw(struct kue_softc *sc)
|
||||
0, kue_code_seg, sizeof(kue_code_seg));
|
||||
if (err) {
|
||||
device_printf(sc->sc_ue.ue_dev, "failed to load code segment: %s\n",
|
||||
usb2_errstr(err));
|
||||
usbd_errstr(err));
|
||||
return(ENXIO);
|
||||
}
|
||||
|
||||
@ -303,7 +303,7 @@ kue_load_fw(struct kue_softc *sc)
|
||||
0, kue_fix_seg, sizeof(kue_fix_seg));
|
||||
if (err) {
|
||||
device_printf(sc->sc_ue.ue_dev, "failed to load fixup segment: %s\n",
|
||||
usb2_errstr(err));
|
||||
usbd_errstr(err));
|
||||
return(ENXIO);
|
||||
}
|
||||
|
||||
@ -312,7 +312,7 @@ kue_load_fw(struct kue_softc *sc)
|
||||
0, kue_trig_seg, sizeof(kue_trig_seg));
|
||||
if (err) {
|
||||
device_printf(sc->sc_ue.ue_dev, "failed to load trigger segment: %s\n",
|
||||
usb2_errstr(err));
|
||||
usbd_errstr(err));
|
||||
return(ENXIO);
|
||||
}
|
||||
|
||||
@ -322,8 +322,8 @@ kue_load_fw(struct kue_softc *sc)
|
||||
static void
|
||||
kue_setpromisc(struct usb_ether *ue)
|
||||
{
|
||||
struct kue_softc *sc = usb2_ether_getsc(ue);
|
||||
struct ifnet *ifp = usb2_ether_getifp(ue);
|
||||
struct kue_softc *sc = uether_getsc(ue);
|
||||
struct ifnet *ifp = uether_getifp(ue);
|
||||
|
||||
KUE_LOCK_ASSERT(sc, MA_OWNED);
|
||||
|
||||
@ -338,8 +338,8 @@ kue_setpromisc(struct usb_ether *ue)
|
||||
static void
|
||||
kue_setmulti(struct usb_ether *ue)
|
||||
{
|
||||
struct kue_softc *sc = usb2_ether_getsc(ue);
|
||||
struct ifnet *ifp = usb2_ether_getifp(ue);
|
||||
struct kue_softc *sc = uether_getsc(ue);
|
||||
struct ifnet *ifp = uether_getifp(ue);
|
||||
struct ifmultiaddr *ifma;
|
||||
int i = 0;
|
||||
|
||||
@ -393,21 +393,21 @@ kue_reset(struct kue_softc *sc)
|
||||
struct usb_config_descriptor *cd;
|
||||
usb_error_t err;
|
||||
|
||||
cd = usb2_get_config_descriptor(sc->sc_ue.ue_udev);
|
||||
cd = usbd_get_config_descriptor(sc->sc_ue.ue_udev);
|
||||
|
||||
err = usb2_req_set_config(sc->sc_ue.ue_udev, &sc->sc_mtx,
|
||||
err = usbd_req_set_config(sc->sc_ue.ue_udev, &sc->sc_mtx,
|
||||
cd->bConfigurationValue);
|
||||
if (err)
|
||||
DPRINTF("reset failed (ignored)\n");
|
||||
|
||||
/* wait a little while for the chip to get its brains in order */
|
||||
usb2_ether_pause(&sc->sc_ue, hz / 100);
|
||||
uether_pause(&sc->sc_ue, hz / 100);
|
||||
}
|
||||
|
||||
static void
|
||||
kue_attach_post(struct usb_ether *ue)
|
||||
{
|
||||
struct kue_softc *sc = usb2_ether_getsc(ue);
|
||||
struct kue_softc *sc = uether_getsc(ue);
|
||||
int error;
|
||||
|
||||
/* load the firmware into the NIC */
|
||||
@ -443,7 +443,7 @@ kue_probe(device_t dev)
|
||||
if (uaa->info.bIfaceIndex != KUE_IFACE_IDX)
|
||||
return (ENXIO);
|
||||
|
||||
return (usb2_lookup_id_by_uaa(kue_devs, sizeof(kue_devs), uaa));
|
||||
return (usbd_lookup_id_by_uaa(kue_devs, sizeof(kue_devs), uaa));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -459,11 +459,11 @@ kue_attach(device_t dev)
|
||||
uint8_t iface_index;
|
||||
int error;
|
||||
|
||||
device_set_usb2_desc(dev);
|
||||
device_set_usb_desc(dev);
|
||||
mtx_init(&sc->sc_mtx, device_get_nameunit(dev), NULL, MTX_DEF);
|
||||
|
||||
iface_index = KUE_IFACE_IDX;
|
||||
error = usb2_transfer_setup(uaa->device, &iface_index,
|
||||
error = usbd_transfer_setup(uaa->device, &iface_index,
|
||||
sc->sc_xfer, kue_config, KUE_N_TRANSFER, sc, &sc->sc_mtx);
|
||||
if (error) {
|
||||
device_printf(dev, "allocating USB transfers failed!\n");
|
||||
@ -483,7 +483,7 @@ kue_attach(device_t dev)
|
||||
ue->ue_mtx = &sc->sc_mtx;
|
||||
ue->ue_methods = &kue_ue_methods;
|
||||
|
||||
error = usb2_ether_ifattach(ue);
|
||||
error = uether_ifattach(ue);
|
||||
if (error) {
|
||||
device_printf(dev, "could not attach interface\n");
|
||||
goto detach;
|
||||
@ -501,8 +501,8 @@ kue_detach(device_t dev)
|
||||
struct kue_softc *sc = device_get_softc(dev);
|
||||
struct usb_ether *ue = &sc->sc_ue;
|
||||
|
||||
usb2_transfer_unsetup(sc->sc_xfer, KUE_N_TRANSFER);
|
||||
usb2_ether_ifdetach(ue);
|
||||
usbd_transfer_unsetup(sc->sc_xfer, KUE_N_TRANSFER);
|
||||
uether_ifdetach(ue);
|
||||
mtx_destroy(&sc->sc_mtx);
|
||||
free(sc->sc_mcfilters, M_USBDEV);
|
||||
|
||||
@ -518,7 +518,7 @@ kue_bulk_read_callback(struct usb_xfer *xfer)
|
||||
{
|
||||
struct kue_softc *sc = xfer->priv_sc;
|
||||
struct usb_ether *ue = &sc->sc_ue;
|
||||
struct ifnet *ifp = usb2_ether_getifp(ue);
|
||||
struct ifnet *ifp = uether_getifp(ue);
|
||||
uint8_t buf[2];
|
||||
int len;
|
||||
|
||||
@ -529,23 +529,23 @@ kue_bulk_read_callback(struct usb_xfer *xfer)
|
||||
ifp->if_ierrors++;
|
||||
goto tr_setup;
|
||||
}
|
||||
usb2_copy_out(xfer->frbuffers, 0, buf, 2);
|
||||
usbd_copy_out(xfer->frbuffers, 0, buf, 2);
|
||||
xfer->actlen -= 2;
|
||||
len = buf[0] | (buf[1] << 8);
|
||||
len = min(xfer->actlen, len);
|
||||
|
||||
usb2_ether_rxbuf(ue, xfer->frbuffers, 2, len);
|
||||
uether_rxbuf(ue, xfer->frbuffers, 2, len);
|
||||
/* FALLTHROUGH */
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
usb2_ether_rxflush(ue);
|
||||
usbd_transfer_submit(xfer);
|
||||
uether_rxflush(ue);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
DPRINTF("bulk read error, %s\n",
|
||||
usb2_errstr(xfer->error));
|
||||
usbd_errstr(xfer->error));
|
||||
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
/* try to clear stall first */
|
||||
@ -561,7 +561,7 @@ static void
|
||||
kue_bulk_write_callback(struct usb_xfer *xfer)
|
||||
{
|
||||
struct kue_softc *sc = xfer->priv_sc;
|
||||
struct ifnet *ifp = usb2_ether_getifp(&sc->sc_ue);
|
||||
struct ifnet *ifp = uether_getifp(&sc->sc_ue);
|
||||
struct mbuf *m;
|
||||
int total_len;
|
||||
int temp_len;
|
||||
@ -589,12 +589,12 @@ kue_bulk_write_callback(struct usb_xfer *xfer)
|
||||
buf[0] = (uint8_t)(m->m_pkthdr.len);
|
||||
buf[1] = (uint8_t)(m->m_pkthdr.len >> 8);
|
||||
|
||||
usb2_copy_in(xfer->frbuffers, 0, buf, 2);
|
||||
usbd_copy_in(xfer->frbuffers, 0, buf, 2);
|
||||
|
||||
usb2_m_copy_in(xfer->frbuffers, 2,
|
||||
usbd_m_copy_in(xfer->frbuffers, 2,
|
||||
m, 0, m->m_pkthdr.len);
|
||||
|
||||
usb2_bzero(xfer->frbuffers, temp_len,
|
||||
usbd_frame_zero(xfer->frbuffers, temp_len,
|
||||
total_len - temp_len);
|
||||
|
||||
xfer->frlengths[0] = total_len;
|
||||
@ -607,13 +607,13 @@ kue_bulk_write_callback(struct usb_xfer *xfer)
|
||||
|
||||
m_freem(m);
|
||||
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
DPRINTFN(11, "transfer error, %s\n",
|
||||
usb2_errstr(xfer->error));
|
||||
usbd_errstr(xfer->error));
|
||||
|
||||
ifp->if_oerrors++;
|
||||
|
||||
@ -630,20 +630,20 @@ kue_bulk_write_callback(struct usb_xfer *xfer)
|
||||
static void
|
||||
kue_start(struct usb_ether *ue)
|
||||
{
|
||||
struct kue_softc *sc = usb2_ether_getsc(ue);
|
||||
struct kue_softc *sc = uether_getsc(ue);
|
||||
|
||||
/*
|
||||
* start the USB transfers, if not already started:
|
||||
*/
|
||||
usb2_transfer_start(sc->sc_xfer[KUE_BULK_DT_RD]);
|
||||
usb2_transfer_start(sc->sc_xfer[KUE_BULK_DT_WR]);
|
||||
usbd_transfer_start(sc->sc_xfer[KUE_BULK_DT_RD]);
|
||||
usbd_transfer_start(sc->sc_xfer[KUE_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
kue_init(struct usb_ether *ue)
|
||||
{
|
||||
struct kue_softc *sc = usb2_ether_getsc(ue);
|
||||
struct ifnet *ifp = usb2_ether_getifp(ue);
|
||||
struct kue_softc *sc = uether_getsc(ue);
|
||||
struct ifnet *ifp = uether_getifp(ue);
|
||||
|
||||
KUE_LOCK_ASSERT(sc, MA_OWNED);
|
||||
|
||||
@ -664,7 +664,7 @@ kue_init(struct usb_ether *ue)
|
||||
/* load the multicast filter */
|
||||
kue_setpromisc(ue);
|
||||
|
||||
usb2_transfer_set_stall(sc->sc_xfer[KUE_BULK_DT_WR]);
|
||||
usbd_transfer_set_stall(sc->sc_xfer[KUE_BULK_DT_WR]);
|
||||
|
||||
ifp->if_drv_flags |= IFF_DRV_RUNNING;
|
||||
kue_start(ue);
|
||||
@ -673,8 +673,8 @@ kue_init(struct usb_ether *ue)
|
||||
static void
|
||||
kue_stop(struct usb_ether *ue)
|
||||
{
|
||||
struct kue_softc *sc = usb2_ether_getsc(ue);
|
||||
struct ifnet *ifp = usb2_ether_getifp(ue);
|
||||
struct kue_softc *sc = uether_getsc(ue);
|
||||
struct ifnet *ifp = uether_getifp(ue);
|
||||
|
||||
KUE_LOCK_ASSERT(sc, MA_OWNED);
|
||||
|
||||
@ -683,6 +683,6 @@ kue_stop(struct usb_ether *ue)
|
||||
/*
|
||||
* stop all the transfers, if not already stopped:
|
||||
*/
|
||||
usb2_transfer_stop(sc->sc_xfer[KUE_BULK_DT_WR]);
|
||||
usb2_transfer_stop(sc->sc_xfer[KUE_BULK_DT_RD]);
|
||||
usbd_transfer_stop(sc->sc_xfer[KUE_BULK_DT_WR]);
|
||||
usbd_transfer_stop(sc->sc_xfer[KUE_BULK_DT_RD]);
|
||||
}
|
||||
|
@ -228,7 +228,7 @@ rue_read_mem(struct rue_softc *sc, uint16_t addr, void *buf, int len)
|
||||
USETW(req.wIndex, 0);
|
||||
USETW(req.wLength, len);
|
||||
|
||||
return (usb2_ether_do_request(&sc->sc_ue, &req, buf, 1000));
|
||||
return (uether_do_request(&sc->sc_ue, &req, buf, 1000));
|
||||
}
|
||||
|
||||
static int
|
||||
@ -242,7 +242,7 @@ rue_write_mem(struct rue_softc *sc, uint16_t addr, void *buf, int len)
|
||||
USETW(req.wIndex, 0);
|
||||
USETW(req.wLength, len);
|
||||
|
||||
return (usb2_ether_do_request(&sc->sc_ue, &req, buf, 1000));
|
||||
return (uether_do_request(&sc->sc_ue, &req, buf, 1000));
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
@ -436,8 +436,8 @@ rue_miibus_statchg(device_t dev)
|
||||
static void
|
||||
rue_setpromisc(struct usb_ether *ue)
|
||||
{
|
||||
struct rue_softc *sc = usb2_ether_getsc(ue);
|
||||
struct ifnet *ifp = usb2_ether_getifp(ue);
|
||||
struct rue_softc *sc = uether_getsc(ue);
|
||||
struct ifnet *ifp = uether_getifp(ue);
|
||||
|
||||
RUE_LOCK_ASSERT(sc, MA_OWNED);
|
||||
|
||||
@ -454,8 +454,8 @@ rue_setpromisc(struct usb_ether *ue)
|
||||
static void
|
||||
rue_setmulti(struct usb_ether *ue)
|
||||
{
|
||||
struct rue_softc *sc = usb2_ether_getsc(ue);
|
||||
struct ifnet *ifp = usb2_ether_getifp(ue);
|
||||
struct rue_softc *sc = uether_getsc(ue);
|
||||
struct ifnet *ifp = uether_getifp(ue);
|
||||
uint16_t rxcfg;
|
||||
int h = 0;
|
||||
uint32_t hashes[2] = { 0, 0 };
|
||||
@ -515,7 +515,7 @@ rue_reset(struct rue_softc *sc)
|
||||
rue_csr_write_1(sc, RUE_CR, RUE_CR_SOFT_RST);
|
||||
|
||||
for (i = 0; i != RUE_TIMEOUT; i++) {
|
||||
if (usb2_ether_pause(&sc->sc_ue, hz / 1000))
|
||||
if (uether_pause(&sc->sc_ue, hz / 1000))
|
||||
break;
|
||||
if (!(rue_csr_read_1(sc, RUE_CR) & RUE_CR_SOFT_RST))
|
||||
break;
|
||||
@ -523,13 +523,13 @@ rue_reset(struct rue_softc *sc)
|
||||
if (i == RUE_TIMEOUT)
|
||||
device_printf(sc->sc_ue.ue_dev, "reset never completed!\n");
|
||||
|
||||
usb2_ether_pause(&sc->sc_ue, hz / 100);
|
||||
uether_pause(&sc->sc_ue, hz / 100);
|
||||
}
|
||||
|
||||
static void
|
||||
rue_attach_post(struct usb_ether *ue)
|
||||
{
|
||||
struct rue_softc *sc = usb2_ether_getsc(ue);
|
||||
struct rue_softc *sc = uether_getsc(ue);
|
||||
|
||||
/* reset the adapter */
|
||||
rue_reset(sc);
|
||||
@ -553,7 +553,7 @@ rue_probe(device_t dev)
|
||||
if (uaa->info.bIfaceIndex != RUE_IFACE_IDX)
|
||||
return (ENXIO);
|
||||
|
||||
return (usb2_lookup_id_by_uaa(rue_devs, sizeof(rue_devs), uaa));
|
||||
return (usbd_lookup_id_by_uaa(rue_devs, sizeof(rue_devs), uaa));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -569,11 +569,11 @@ rue_attach(device_t dev)
|
||||
uint8_t iface_index;
|
||||
int error;
|
||||
|
||||
device_set_usb2_desc(dev);
|
||||
device_set_usb_desc(dev);
|
||||
mtx_init(&sc->sc_mtx, device_get_nameunit(dev), NULL, MTX_DEF);
|
||||
|
||||
iface_index = RUE_IFACE_IDX;
|
||||
error = usb2_transfer_setup(uaa->device, &iface_index,
|
||||
error = usbd_transfer_setup(uaa->device, &iface_index,
|
||||
sc->sc_xfer, rue_config, RUE_N_TRANSFER,
|
||||
sc, &sc->sc_mtx);
|
||||
if (error) {
|
||||
@ -587,7 +587,7 @@ rue_attach(device_t dev)
|
||||
ue->ue_mtx = &sc->sc_mtx;
|
||||
ue->ue_methods = &rue_ue_methods;
|
||||
|
||||
error = usb2_ether_ifattach(ue);
|
||||
error = uether_ifattach(ue);
|
||||
if (error) {
|
||||
device_printf(dev, "could not attach interface\n");
|
||||
goto detach;
|
||||
@ -605,8 +605,8 @@ rue_detach(device_t dev)
|
||||
struct rue_softc *sc = device_get_softc(dev);
|
||||
struct usb_ether *ue = &sc->sc_ue;
|
||||
|
||||
usb2_transfer_unsetup(sc->sc_xfer, RUE_N_TRANSFER);
|
||||
usb2_ether_ifdetach(ue);
|
||||
usbd_transfer_unsetup(sc->sc_xfer, RUE_N_TRANSFER);
|
||||
uether_ifdetach(ue);
|
||||
mtx_destroy(&sc->sc_mtx);
|
||||
|
||||
return (0);
|
||||
@ -616,7 +616,7 @@ static void
|
||||
rue_intr_callback(struct usb_xfer *xfer)
|
||||
{
|
||||
struct rue_softc *sc = xfer->priv_sc;
|
||||
struct ifnet *ifp = usb2_ether_getifp(&sc->sc_ue);
|
||||
struct ifnet *ifp = uether_getifp(&sc->sc_ue);
|
||||
struct rue_intrpkt pkt;
|
||||
|
||||
switch (USB_GET_STATE(xfer)) {
|
||||
@ -625,7 +625,7 @@ rue_intr_callback(struct usb_xfer *xfer)
|
||||
if (ifp && (ifp->if_drv_flags & IFF_DRV_RUNNING) &&
|
||||
(xfer->actlen >= sizeof(pkt))) {
|
||||
|
||||
usb2_copy_out(xfer->frbuffers, 0, &pkt, sizeof(pkt));
|
||||
usbd_copy_out(xfer->frbuffers, 0, &pkt, sizeof(pkt));
|
||||
|
||||
ifp->if_ierrors += pkt.rue_rxlost_cnt;
|
||||
ifp->if_ierrors += pkt.rue_crcerr_cnt;
|
||||
@ -635,7 +635,7 @@ rue_intr_callback(struct usb_xfer *xfer)
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
@ -653,7 +653,7 @@ rue_bulk_read_callback(struct usb_xfer *xfer)
|
||||
{
|
||||
struct rue_softc *sc = xfer->priv_sc;
|
||||
struct usb_ether *ue = &sc->sc_ue;
|
||||
struct ifnet *ifp = usb2_ether_getifp(ue);
|
||||
struct ifnet *ifp = uether_getifp(ue);
|
||||
uint16_t status;
|
||||
|
||||
switch (USB_GET_STATE(xfer)) {
|
||||
@ -663,7 +663,7 @@ rue_bulk_read_callback(struct usb_xfer *xfer)
|
||||
ifp->if_ierrors++;
|
||||
goto tr_setup;
|
||||
}
|
||||
usb2_copy_out(xfer->frbuffers, xfer->actlen - 4,
|
||||
usbd_copy_out(xfer->frbuffers, xfer->actlen - 4,
|
||||
&status, sizeof(status));
|
||||
xfer->actlen -= 4;
|
||||
|
||||
@ -673,18 +673,18 @@ rue_bulk_read_callback(struct usb_xfer *xfer)
|
||||
ifp->if_ierrors++;
|
||||
goto tr_setup;
|
||||
}
|
||||
usb2_ether_rxbuf(ue, xfer->frbuffers, 0, xfer->actlen);
|
||||
uether_rxbuf(ue, xfer->frbuffers, 0, xfer->actlen);
|
||||
/* FALLTHROUGH */
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
usb2_ether_rxflush(ue);
|
||||
usbd_transfer_submit(xfer);
|
||||
uether_rxflush(ue);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
DPRINTF("bulk read error, %s\n",
|
||||
usb2_errstr(xfer->error));
|
||||
usbd_errstr(xfer->error));
|
||||
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
/* try to clear stall first */
|
||||
@ -699,7 +699,7 @@ static void
|
||||
rue_bulk_write_callback(struct usb_xfer *xfer)
|
||||
{
|
||||
struct rue_softc *sc = xfer->priv_sc;
|
||||
struct ifnet *ifp = usb2_ether_getifp(&sc->sc_ue);
|
||||
struct ifnet *ifp = uether_getifp(&sc->sc_ue);
|
||||
struct mbuf *m;
|
||||
int temp_len;
|
||||
|
||||
@ -725,7 +725,7 @@ rue_bulk_write_callback(struct usb_xfer *xfer)
|
||||
m->m_pkthdr.len = MCLBYTES;
|
||||
temp_len = m->m_pkthdr.len;
|
||||
|
||||
usb2_m_copy_in(xfer->frbuffers, 0,
|
||||
usbd_m_copy_in(xfer->frbuffers, 0,
|
||||
m, 0, m->m_pkthdr.len);
|
||||
|
||||
/*
|
||||
@ -734,7 +734,7 @@ rue_bulk_write_callback(struct usb_xfer *xfer)
|
||||
* RUE_MIN_FRAMELEN (60) byte packet.
|
||||
*/
|
||||
if (temp_len < RUE_MIN_FRAMELEN) {
|
||||
usb2_bzero(xfer->frbuffers, temp_len,
|
||||
usbd_frame_zero(xfer->frbuffers, temp_len,
|
||||
RUE_MIN_FRAMELEN - temp_len);
|
||||
temp_len = RUE_MIN_FRAMELEN;
|
||||
}
|
||||
@ -748,13 +748,13 @@ rue_bulk_write_callback(struct usb_xfer *xfer)
|
||||
|
||||
m_freem(m);
|
||||
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
DPRINTFN(11, "transfer error, %s\n",
|
||||
usb2_errstr(xfer->error));
|
||||
usbd_errstr(xfer->error));
|
||||
|
||||
ifp->if_oerrors++;
|
||||
|
||||
@ -770,7 +770,7 @@ rue_bulk_write_callback(struct usb_xfer *xfer)
|
||||
static void
|
||||
rue_tick(struct usb_ether *ue)
|
||||
{
|
||||
struct rue_softc *sc = usb2_ether_getsc(ue);
|
||||
struct rue_softc *sc = uether_getsc(ue);
|
||||
struct mii_data *mii = GET_MII(sc);
|
||||
|
||||
RUE_LOCK_ASSERT(sc, MA_OWNED);
|
||||
@ -787,21 +787,21 @@ rue_tick(struct usb_ether *ue)
|
||||
static void
|
||||
rue_start(struct usb_ether *ue)
|
||||
{
|
||||
struct rue_softc *sc = usb2_ether_getsc(ue);
|
||||
struct rue_softc *sc = uether_getsc(ue);
|
||||
|
||||
/*
|
||||
* start the USB transfers, if not already started:
|
||||
*/
|
||||
usb2_transfer_start(sc->sc_xfer[RUE_INTR_DT_RD]);
|
||||
usb2_transfer_start(sc->sc_xfer[RUE_BULK_DT_RD]);
|
||||
usb2_transfer_start(sc->sc_xfer[RUE_BULK_DT_WR]);
|
||||
usbd_transfer_start(sc->sc_xfer[RUE_INTR_DT_RD]);
|
||||
usbd_transfer_start(sc->sc_xfer[RUE_BULK_DT_RD]);
|
||||
usbd_transfer_start(sc->sc_xfer[RUE_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
rue_init(struct usb_ether *ue)
|
||||
{
|
||||
struct rue_softc *sc = usb2_ether_getsc(ue);
|
||||
struct ifnet *ifp = usb2_ether_getifp(ue);
|
||||
struct rue_softc *sc = uether_getsc(ue);
|
||||
struct ifnet *ifp = uether_getifp(ue);
|
||||
|
||||
RUE_LOCK_ASSERT(sc, MA_OWNED);
|
||||
|
||||
@ -829,7 +829,7 @@ rue_init(struct usb_ether *ue)
|
||||
/* Enable RX and TX */
|
||||
rue_csr_write_1(sc, RUE_CR, (RUE_CR_TE | RUE_CR_RE | RUE_CR_EP3CLREN));
|
||||
|
||||
usb2_transfer_set_stall(sc->sc_xfer[RUE_BULK_DT_WR]);
|
||||
usbd_transfer_set_stall(sc->sc_xfer[RUE_BULK_DT_WR]);
|
||||
|
||||
ifp->if_drv_flags |= IFF_DRV_RUNNING;
|
||||
rue_start(ue);
|
||||
@ -876,8 +876,8 @@ rue_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
|
||||
static void
|
||||
rue_stop(struct usb_ether *ue)
|
||||
{
|
||||
struct rue_softc *sc = usb2_ether_getsc(ue);
|
||||
struct ifnet *ifp = usb2_ether_getifp(ue);
|
||||
struct rue_softc *sc = uether_getsc(ue);
|
||||
struct ifnet *ifp = uether_getifp(ue);
|
||||
|
||||
RUE_LOCK_ASSERT(sc, MA_OWNED);
|
||||
|
||||
@ -887,9 +887,9 @@ rue_stop(struct usb_ether *ue)
|
||||
/*
|
||||
* stop all the transfers, if not already stopped:
|
||||
*/
|
||||
usb2_transfer_stop(sc->sc_xfer[RUE_BULK_DT_WR]);
|
||||
usb2_transfer_stop(sc->sc_xfer[RUE_BULK_DT_RD]);
|
||||
usb2_transfer_stop(sc->sc_xfer[RUE_INTR_DT_RD]);
|
||||
usbd_transfer_stop(sc->sc_xfer[RUE_BULK_DT_WR]);
|
||||
usbd_transfer_stop(sc->sc_xfer[RUE_BULK_DT_RD]);
|
||||
usbd_transfer_stop(sc->sc_xfer[RUE_INTR_DT_RD]);
|
||||
|
||||
rue_csr_write_1(sc, RUE_CR, 0x00);
|
||||
|
||||
|
@ -144,7 +144,7 @@
|
||||
#define RUE_RXSTAT_PMATCH (0x04 << 12)
|
||||
#define RUE_RXSTAT_MCAST (0x08 << 12)
|
||||
|
||||
#define GET_MII(sc) usb2_ether_getmii(&(sc)->sc_ue)
|
||||
#define GET_MII(sc) uether_getmii(&(sc)->sc_ue)
|
||||
|
||||
struct rue_intrpkt {
|
||||
uint8_t rue_tsr;
|
||||
|
@ -197,7 +197,7 @@ static const struct usb_device_id udav_devs[] = {
|
||||
static void
|
||||
udav_attach_post(struct usb_ether *ue)
|
||||
{
|
||||
struct udav_softc *sc = usb2_ether_getsc(ue);
|
||||
struct udav_softc *sc = uether_getsc(ue);
|
||||
|
||||
/* reset the adapter */
|
||||
udav_reset(sc);
|
||||
@ -218,7 +218,7 @@ udav_probe(device_t dev)
|
||||
if (uaa->info.bIfaceIndex != UDAV_IFACE_INDEX)
|
||||
return (ENXIO);
|
||||
|
||||
return (usb2_lookup_id_by_uaa(udav_devs, sizeof(udav_devs), uaa));
|
||||
return (usbd_lookup_id_by_uaa(udav_devs, sizeof(udav_devs), uaa));
|
||||
}
|
||||
|
||||
static int
|
||||
@ -232,12 +232,12 @@ udav_attach(device_t dev)
|
||||
|
||||
sc->sc_flags = USB_GET_DRIVER_INFO(uaa);
|
||||
|
||||
device_set_usb2_desc(dev);
|
||||
device_set_usb_desc(dev);
|
||||
|
||||
mtx_init(&sc->sc_mtx, device_get_nameunit(dev), NULL, MTX_DEF);
|
||||
|
||||
iface_index = UDAV_IFACE_INDEX;
|
||||
error = usb2_transfer_setup(uaa->device, &iface_index,
|
||||
error = usbd_transfer_setup(uaa->device, &iface_index,
|
||||
sc->sc_xfer, udav_config, UDAV_N_TRANSFER, sc, &sc->sc_mtx);
|
||||
if (error) {
|
||||
device_printf(dev, "allocating USB transfers failed!\n");
|
||||
@ -250,7 +250,7 @@ udav_attach(device_t dev)
|
||||
ue->ue_mtx = &sc->sc_mtx;
|
||||
ue->ue_methods = &udav_ue_methods;
|
||||
|
||||
error = usb2_ether_ifattach(ue);
|
||||
error = uether_ifattach(ue);
|
||||
if (error) {
|
||||
device_printf(dev, "could not attach interface\n");
|
||||
goto detach;
|
||||
@ -269,8 +269,8 @@ udav_detach(device_t dev)
|
||||
struct udav_softc *sc = device_get_softc(dev);
|
||||
struct usb_ether *ue = &sc->sc_ue;
|
||||
|
||||
usb2_transfer_unsetup(sc->sc_xfer, UDAV_N_TRANSFER);
|
||||
usb2_ether_ifdetach(ue);
|
||||
usbd_transfer_unsetup(sc->sc_xfer, UDAV_N_TRANSFER);
|
||||
uether_ifdetach(ue);
|
||||
mtx_destroy(&sc->sc_mtx);
|
||||
|
||||
return (0);
|
||||
@ -291,7 +291,7 @@ udav_mem_read(struct udav_softc *sc, uint16_t offset, void *buf,
|
||||
USETW(req.wIndex, offset);
|
||||
USETW(req.wLength, len);
|
||||
|
||||
return (usb2_ether_do_request(&sc->sc_ue, &req, buf, 1000));
|
||||
return (uether_do_request(&sc->sc_ue, &req, buf, 1000));
|
||||
}
|
||||
|
||||
static int
|
||||
@ -308,7 +308,7 @@ udav_mem_write(struct udav_softc *sc, uint16_t offset, void *buf,
|
||||
USETW(req.wIndex, offset);
|
||||
USETW(req.wLength, len);
|
||||
|
||||
return (usb2_ether_do_request(&sc->sc_ue, &req, buf, 1000));
|
||||
return (uether_do_request(&sc->sc_ue, &req, buf, 1000));
|
||||
}
|
||||
|
||||
static int
|
||||
@ -323,7 +323,7 @@ udav_mem_write1(struct udav_softc *sc, uint16_t offset,
|
||||
USETW(req.wIndex, offset);
|
||||
USETW(req.wLength, 0x0000);
|
||||
|
||||
return (usb2_ether_do_request(&sc->sc_ue, &req, NULL, 1000));
|
||||
return (uether_do_request(&sc->sc_ue, &req, NULL, 1000));
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -340,7 +340,7 @@ udav_csr_read(struct udav_softc *sc, uint16_t offset, void *buf, int len)
|
||||
USETW(req.wIndex, offset);
|
||||
USETW(req.wLength, len);
|
||||
|
||||
return (usb2_ether_do_request(&sc->sc_ue, &req, buf, 1000));
|
||||
return (uether_do_request(&sc->sc_ue, &req, buf, 1000));
|
||||
}
|
||||
|
||||
static int
|
||||
@ -357,7 +357,7 @@ udav_csr_write(struct udav_softc *sc, uint16_t offset, void *buf, int len)
|
||||
USETW(req.wIndex, offset);
|
||||
USETW(req.wLength, len);
|
||||
|
||||
return (usb2_ether_do_request(&sc->sc_ue, &req, buf, 1000));
|
||||
return (uether_do_request(&sc->sc_ue, &req, buf, 1000));
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
@ -383,14 +383,14 @@ udav_csr_write1(struct udav_softc *sc, uint16_t offset,
|
||||
USETW(req.wIndex, offset);
|
||||
USETW(req.wLength, 0x0000);
|
||||
|
||||
return (usb2_ether_do_request(&sc->sc_ue, &req, NULL, 1000));
|
||||
return (uether_do_request(&sc->sc_ue, &req, NULL, 1000));
|
||||
}
|
||||
|
||||
static void
|
||||
udav_init(struct usb_ether *ue)
|
||||
{
|
||||
struct udav_softc *sc = ue->ue_sc;
|
||||
struct ifnet *ifp = usb2_ether_getifp(&sc->sc_ue);
|
||||
struct ifnet *ifp = uether_getifp(&sc->sc_ue);
|
||||
|
||||
UDAV_LOCK_ASSERT(sc, MA_OWNED);
|
||||
|
||||
@ -420,7 +420,7 @@ udav_init(struct usb_ether *ue)
|
||||
UDAV_SETBIT(sc, UDAV_GPCR, UDAV_GPCR_GEP_CNTL0);
|
||||
UDAV_CLRBIT(sc, UDAV_GPR, UDAV_GPR_GEPIO0);
|
||||
|
||||
usb2_transfer_set_stall(sc->sc_xfer[UDAV_BULK_DT_WR]);
|
||||
usbd_transfer_set_stall(sc->sc_xfer[UDAV_BULK_DT_WR]);
|
||||
|
||||
ifp->if_drv_flags |= IFF_DRV_RUNNING;
|
||||
udav_start(ue);
|
||||
@ -450,11 +450,11 @@ udav_reset(struct udav_softc *sc)
|
||||
for (i = 0; i < UDAV_TX_TIMEOUT; i++) {
|
||||
if (!(udav_csr_read1(sc, UDAV_NCR) & UDAV_NCR_RST))
|
||||
break;
|
||||
if (usb2_ether_pause(&sc->sc_ue, hz / 100))
|
||||
if (uether_pause(&sc->sc_ue, hz / 100))
|
||||
break;
|
||||
}
|
||||
|
||||
usb2_ether_pause(&sc->sc_ue, hz / 100);
|
||||
uether_pause(&sc->sc_ue, hz / 100);
|
||||
}
|
||||
|
||||
#define UDAV_BITS 6
|
||||
@ -462,7 +462,7 @@ static void
|
||||
udav_setmulti(struct usb_ether *ue)
|
||||
{
|
||||
struct udav_softc *sc = ue->ue_sc;
|
||||
struct ifnet *ifp = usb2_ether_getifp(&sc->sc_ue);
|
||||
struct ifnet *ifp = uether_getifp(&sc->sc_ue);
|
||||
struct ifmultiaddr *ifma;
|
||||
uint8_t hashtbl[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
int h = 0;
|
||||
@ -502,7 +502,7 @@ static void
|
||||
udav_setpromisc(struct usb_ether *ue)
|
||||
{
|
||||
struct udav_softc *sc = ue->ue_sc;
|
||||
struct ifnet *ifp = usb2_ether_getifp(&sc->sc_ue);
|
||||
struct ifnet *ifp = uether_getifp(&sc->sc_ue);
|
||||
uint8_t rxmode;
|
||||
|
||||
rxmode = udav_csr_read1(sc, UDAV_RCR);
|
||||
@ -525,16 +525,16 @@ udav_start(struct usb_ether *ue)
|
||||
/*
|
||||
* start the USB transfers, if not already started:
|
||||
*/
|
||||
usb2_transfer_start(sc->sc_xfer[UDAV_INTR_DT_RD]);
|
||||
usb2_transfer_start(sc->sc_xfer[UDAV_BULK_DT_RD]);
|
||||
usb2_transfer_start(sc->sc_xfer[UDAV_BULK_DT_WR]);
|
||||
usbd_transfer_start(sc->sc_xfer[UDAV_INTR_DT_RD]);
|
||||
usbd_transfer_start(sc->sc_xfer[UDAV_BULK_DT_RD]);
|
||||
usbd_transfer_start(sc->sc_xfer[UDAV_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
udav_bulk_write_callback(struct usb_xfer *xfer)
|
||||
{
|
||||
struct udav_softc *sc = xfer->priv_sc;
|
||||
struct ifnet *ifp = usb2_ether_getifp(&sc->sc_ue);
|
||||
struct ifnet *ifp = uether_getifp(&sc->sc_ue);
|
||||
struct mbuf *m;
|
||||
int extra_len;
|
||||
int temp_len;
|
||||
@ -577,13 +577,13 @@ udav_bulk_write_callback(struct usb_xfer *xfer)
|
||||
|
||||
temp_len += 2;
|
||||
|
||||
usb2_copy_in(xfer->frbuffers, 0, buf, 2);
|
||||
usbd_copy_in(xfer->frbuffers, 0, buf, 2);
|
||||
|
||||
usb2_m_copy_in(xfer->frbuffers, 2,
|
||||
usbd_m_copy_in(xfer->frbuffers, 2,
|
||||
m, 0, m->m_pkthdr.len);
|
||||
|
||||
if (extra_len) {
|
||||
usb2_bzero(xfer->frbuffers, temp_len - extra_len,
|
||||
usbd_frame_zero(xfer->frbuffers, temp_len - extra_len,
|
||||
extra_len);
|
||||
}
|
||||
/*
|
||||
@ -595,12 +595,12 @@ udav_bulk_write_callback(struct usb_xfer *xfer)
|
||||
m_freem(m);
|
||||
|
||||
xfer->frlengths[0] = temp_len;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
DPRINTFN(11, "transfer error, %s\n",
|
||||
usb2_errstr(xfer->error));
|
||||
usbd_errstr(xfer->error));
|
||||
|
||||
ifp->if_oerrors++;
|
||||
|
||||
@ -618,7 +618,7 @@ udav_bulk_read_callback(struct usb_xfer *xfer)
|
||||
{
|
||||
struct udav_softc *sc = xfer->priv_sc;
|
||||
struct usb_ether *ue = &sc->sc_ue;
|
||||
struct ifnet *ifp = usb2_ether_getifp(ue);
|
||||
struct ifnet *ifp = uether_getifp(ue);
|
||||
struct udav_rxpkt stat;
|
||||
int len;
|
||||
|
||||
@ -629,7 +629,7 @@ udav_bulk_read_callback(struct usb_xfer *xfer)
|
||||
ifp->if_ierrors++;
|
||||
goto tr_setup;
|
||||
}
|
||||
usb2_copy_out(xfer->frbuffers, 0, &stat, sizeof(stat));
|
||||
usbd_copy_out(xfer->frbuffers, 0, &stat, sizeof(stat));
|
||||
xfer->actlen -= sizeof(stat);
|
||||
len = min(xfer->actlen, le16toh(stat.pktlen));
|
||||
len -= ETHER_CRC_LEN;
|
||||
@ -642,18 +642,18 @@ udav_bulk_read_callback(struct usb_xfer *xfer)
|
||||
ifp->if_ierrors++;
|
||||
goto tr_setup;
|
||||
}
|
||||
usb2_ether_rxbuf(ue, xfer->frbuffers, sizeof(stat), len);
|
||||
uether_rxbuf(ue, xfer->frbuffers, sizeof(stat), len);
|
||||
/* FALLTHROUGH */
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
usb2_ether_rxflush(ue);
|
||||
usbd_transfer_submit(xfer);
|
||||
uether_rxflush(ue);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
DPRINTF("bulk read error, %s\n",
|
||||
usb2_errstr(xfer->error));
|
||||
usbd_errstr(xfer->error));
|
||||
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
/* try to clear stall first */
|
||||
@ -672,7 +672,7 @@ udav_intr_callback(struct usb_xfer *xfer)
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
@ -689,7 +689,7 @@ static void
|
||||
udav_stop(struct usb_ether *ue)
|
||||
{
|
||||
struct udav_softc *sc = ue->ue_sc;
|
||||
struct ifnet *ifp = usb2_ether_getifp(&sc->sc_ue);
|
||||
struct ifnet *ifp = uether_getifp(&sc->sc_ue);
|
||||
|
||||
UDAV_LOCK_ASSERT(sc, MA_OWNED);
|
||||
|
||||
@ -699,9 +699,9 @@ udav_stop(struct usb_ether *ue)
|
||||
/*
|
||||
* stop all the transfers, if not already stopped:
|
||||
*/
|
||||
usb2_transfer_stop(sc->sc_xfer[UDAV_BULK_DT_WR]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UDAV_BULK_DT_RD]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UDAV_INTR_DT_RD]);
|
||||
usbd_transfer_stop(sc->sc_xfer[UDAV_BULK_DT_WR]);
|
||||
usbd_transfer_stop(sc->sc_xfer[UDAV_BULK_DT_RD]);
|
||||
usbd_transfer_stop(sc->sc_xfer[UDAV_INTR_DT_RD]);
|
||||
|
||||
udav_reset(sc);
|
||||
}
|
||||
|
@ -137,7 +137,7 @@
|
||||
#define UDAV_GPR_GEPIO1 (1<<1) /* General purpose 1 */
|
||||
#define UDAV_GPR_GEPIO0 (1<<0) /* General purpose 0 */
|
||||
|
||||
#define GET_MII(sc) usb2_ether_getmii(&(sc)->sc_ue)
|
||||
#define GET_MII(sc) uether_getmii(&(sc)->sc_ue)
|
||||
|
||||
struct udav_rxpkt {
|
||||
uint8_t rxstat;
|
||||
|
@ -67,13 +67,13 @@ static void ue_watchdog(void *);
|
||||
* Else: device has been detached
|
||||
*/
|
||||
uint8_t
|
||||
usb2_ether_pause(struct usb_ether *ue, unsigned int _ticks)
|
||||
uether_pause(struct usb_ether *ue, unsigned int _ticks)
|
||||
{
|
||||
if (usb2_proc_is_gone(&ue->ue_tq)) {
|
||||
if (usb_proc_is_gone(&ue->ue_tq)) {
|
||||
/* nothing to do */
|
||||
return (1);
|
||||
}
|
||||
usb2_pause_mtx(ue->ue_mtx, _ticks);
|
||||
usb_pause_mtx(ue->ue_mtx, _ticks);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -86,7 +86,7 @@ ue_queue_command(struct usb_ether *ue,
|
||||
|
||||
UE_LOCK_ASSERT(ue, MA_OWNED);
|
||||
|
||||
if (usb2_proc_is_gone(&ue->ue_tq)) {
|
||||
if (usb_proc_is_gone(&ue->ue_tq)) {
|
||||
return; /* nothing to do */
|
||||
}
|
||||
/*
|
||||
@ -95,7 +95,7 @@ ue_queue_command(struct usb_ether *ue,
|
||||
* structure after that the message got queued.
|
||||
*/
|
||||
task = (struct usb_ether_cfg_task *)
|
||||
usb2_proc_msignal(&ue->ue_tq, t0, t1);
|
||||
usb_proc_msignal(&ue->ue_tq, t0, t1);
|
||||
|
||||
/* Setup callback and self pointers */
|
||||
task->hdr.pm_callback = fn;
|
||||
@ -105,23 +105,23 @@ ue_queue_command(struct usb_ether *ue,
|
||||
* Start and stop must be synchronous!
|
||||
*/
|
||||
if ((fn == ue_start_task) || (fn == ue_stop_task))
|
||||
usb2_proc_mwait(&ue->ue_tq, t0, t1);
|
||||
usb_proc_mwait(&ue->ue_tq, t0, t1);
|
||||
}
|
||||
|
||||
struct ifnet *
|
||||
usb2_ether_getifp(struct usb_ether *ue)
|
||||
uether_getifp(struct usb_ether *ue)
|
||||
{
|
||||
return (ue->ue_ifp);
|
||||
}
|
||||
|
||||
struct mii_data *
|
||||
usb2_ether_getmii(struct usb_ether *ue)
|
||||
uether_getmii(struct usb_ether *ue)
|
||||
{
|
||||
return (device_get_softc(ue->ue_miibus));
|
||||
}
|
||||
|
||||
void *
|
||||
usb2_ether_getsc(struct usb_ether *ue)
|
||||
uether_getsc(struct usb_ether *ue)
|
||||
{
|
||||
return (ue->ue_sc);
|
||||
}
|
||||
@ -137,7 +137,7 @@ ue_sysctl_parent(SYSCTL_HANDLER_ARGS)
|
||||
}
|
||||
|
||||
int
|
||||
usb2_ether_ifattach(struct usb_ether *ue)
|
||||
uether_ifattach(struct usb_ether *ue)
|
||||
{
|
||||
int error;
|
||||
|
||||
@ -148,7 +148,7 @@ usb2_ether_ifattach(struct usb_ether *ue)
|
||||
(ue->ue_methods == NULL))
|
||||
return (EINVAL);
|
||||
|
||||
error = usb2_proc_create(&ue->ue_tq, ue->ue_mtx,
|
||||
error = usb_proc_create(&ue->ue_tq, ue->ue_mtx,
|
||||
device_get_nameunit(ue->ue_dev), USB_PRI_MED);
|
||||
if (error) {
|
||||
device_printf(ue->ue_dev, "could not setup taskqueue\n");
|
||||
@ -182,7 +182,7 @@ ue_attach_post_task(struct usb_proc_msg *_task)
|
||||
UE_UNLOCK(ue);
|
||||
|
||||
ue->ue_unit = alloc_unr(ueunit);
|
||||
usb2_callout_init_mtx(&ue->ue_watchdog, ue->ue_mtx, 0);
|
||||
usb_callout_init_mtx(&ue->ue_watchdog, ue->ue_mtx, 0);
|
||||
sysctl_ctx_init(&ue->ue_sysctl_ctx);
|
||||
|
||||
ifp = if_alloc(IFT_ETHER);
|
||||
@ -198,7 +198,7 @@ ue_attach_post_task(struct usb_proc_msg *_task)
|
||||
if (ue->ue_methods->ue_ioctl != NULL)
|
||||
ifp->if_ioctl = ue->ue_methods->ue_ioctl;
|
||||
else
|
||||
ifp->if_ioctl = usb2_ether_ioctl;
|
||||
ifp->if_ioctl = uether_ioctl;
|
||||
ifp->if_start = ue_start;
|
||||
ifp->if_init = ue_init;
|
||||
IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN);
|
||||
@ -244,12 +244,12 @@ ue_attach_post_task(struct usb_proc_msg *_task)
|
||||
}
|
||||
|
||||
void
|
||||
usb2_ether_ifdetach(struct usb_ether *ue)
|
||||
uether_ifdetach(struct usb_ether *ue)
|
||||
{
|
||||
struct ifnet *ifp;
|
||||
|
||||
/* wait for any post attach or other command to complete */
|
||||
usb2_proc_drain(&ue->ue_tq);
|
||||
usb_proc_drain(&ue->ue_tq);
|
||||
|
||||
/* read "ifnet" pointer after taskqueue drain */
|
||||
ifp = ue->ue_ifp;
|
||||
@ -262,7 +262,7 @@ usb2_ether_ifdetach(struct usb_ether *ue)
|
||||
UE_UNLOCK(ue);
|
||||
|
||||
/* drain any callouts */
|
||||
usb2_callout_drain(&ue->ue_watchdog);
|
||||
usb_callout_drain(&ue->ue_watchdog);
|
||||
|
||||
/* detach miibus */
|
||||
if (ue->ue_miibus != NULL) {
|
||||
@ -285,13 +285,13 @@ usb2_ether_ifdetach(struct usb_ether *ue)
|
||||
}
|
||||
|
||||
/* free taskqueue, if any */
|
||||
usb2_proc_free(&ue->ue_tq);
|
||||
usb_proc_free(&ue->ue_tq);
|
||||
}
|
||||
|
||||
uint8_t
|
||||
usb2_ether_is_gone(struct usb_ether *ue)
|
||||
uether_is_gone(struct usb_ether *ue)
|
||||
{
|
||||
return (usb2_proc_is_gone(&ue->ue_tq));
|
||||
return (usb_proc_is_gone(&ue->ue_tq));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -322,7 +322,7 @@ ue_start_task(struct usb_proc_msg *_task)
|
||||
return;
|
||||
|
||||
if (ue->ue_methods->ue_tick != NULL)
|
||||
usb2_callout_reset(&ue->ue_watchdog, hz, ue_watchdog, ue);
|
||||
usb_callout_reset(&ue->ue_watchdog, hz, ue_watchdog, ue);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -334,7 +334,7 @@ ue_stop_task(struct usb_proc_msg *_task)
|
||||
|
||||
UE_LOCK_ASSERT(ue, MA_OWNED);
|
||||
|
||||
usb2_callout_stop(&ue->ue_watchdog);
|
||||
usb_callout_stop(&ue->ue_watchdog);
|
||||
|
||||
ue->ue_methods->ue_stop(ue);
|
||||
}
|
||||
@ -411,7 +411,7 @@ ue_watchdog(void *arg)
|
||||
&ue->ue_tick_task[0].hdr,
|
||||
&ue->ue_tick_task[1].hdr);
|
||||
|
||||
usb2_callout_reset(&ue->ue_watchdog, hz, ue_watchdog, ue);
|
||||
usb_callout_reset(&ue->ue_watchdog, hz, ue_watchdog, ue);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -429,7 +429,7 @@ ue_tick_task(struct usb_proc_msg *_task)
|
||||
}
|
||||
|
||||
int
|
||||
usb2_ether_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
|
||||
uether_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
|
||||
{
|
||||
struct usb_ether *ue = ifp->if_softc;
|
||||
struct ifreq *ifr = (struct ifreq *)data;
|
||||
@ -479,7 +479,7 @@ usb2_ether_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
|
||||
}
|
||||
|
||||
static int
|
||||
usb2_ether_modevent(module_t mod, int type, void *data)
|
||||
uether_modevent(module_t mod, int type, void *data)
|
||||
{
|
||||
|
||||
switch (type) {
|
||||
@ -493,14 +493,14 @@ usb2_ether_modevent(module_t mod, int type, void *data)
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
static moduledata_t usb2_ether_mod = {
|
||||
static moduledata_t uether_mod = {
|
||||
"uether",
|
||||
usb2_ether_modevent,
|
||||
uether_modevent,
|
||||
0
|
||||
};
|
||||
|
||||
struct mbuf *
|
||||
usb2_ether_newbuf(void)
|
||||
uether_newbuf(void)
|
||||
{
|
||||
struct mbuf *m_new;
|
||||
|
||||
@ -514,7 +514,7 @@ usb2_ether_newbuf(void)
|
||||
}
|
||||
|
||||
int
|
||||
usb2_ether_rxmbuf(struct usb_ether *ue, struct mbuf *m,
|
||||
uether_rxmbuf(struct usb_ether *ue, struct mbuf *m,
|
||||
unsigned int len)
|
||||
{
|
||||
struct ifnet *ifp = ue->ue_ifp;
|
||||
@ -532,7 +532,7 @@ usb2_ether_rxmbuf(struct usb_ether *ue, struct mbuf *m,
|
||||
}
|
||||
|
||||
int
|
||||
usb2_ether_rxbuf(struct usb_ether *ue, struct usb_page_cache *pc,
|
||||
uether_rxbuf(struct usb_ether *ue, struct usb_page_cache *pc,
|
||||
unsigned int offset, unsigned int len)
|
||||
{
|
||||
struct ifnet *ifp = ue->ue_ifp;
|
||||
@ -543,13 +543,13 @@ usb2_ether_rxbuf(struct usb_ether *ue, struct usb_page_cache *pc,
|
||||
if (len < ETHER_HDR_LEN || len > MCLBYTES - ETHER_ALIGN)
|
||||
return (1);
|
||||
|
||||
m = usb2_ether_newbuf();
|
||||
m = uether_newbuf();
|
||||
if (m == NULL) {
|
||||
ifp->if_ierrors++;
|
||||
return (ENOMEM);
|
||||
}
|
||||
|
||||
usb2_copy_out(pc, offset, mtod(m, uint8_t *), len);
|
||||
usbd_copy_out(pc, offset, mtod(m, uint8_t *), len);
|
||||
|
||||
/* finalize mbuf */
|
||||
ifp->if_ipackets++;
|
||||
@ -562,7 +562,7 @@ usb2_ether_rxbuf(struct usb_ether *ue, struct usb_page_cache *pc,
|
||||
}
|
||||
|
||||
void
|
||||
usb2_ether_rxflush(struct usb_ether *ue)
|
||||
uether_rxflush(struct usb_ether *ue)
|
||||
{
|
||||
struct ifnet *ifp = ue->ue_ifp;
|
||||
struct mbuf *m;
|
||||
@ -583,5 +583,5 @@ usb2_ether_rxflush(struct usb_ether *ue)
|
||||
}
|
||||
}
|
||||
|
||||
DECLARE_MODULE(uether, usb2_ether_mod, SI_SUB_PSEUDO, SI_ORDER_ANY);
|
||||
DECLARE_MODULE(uether, uether_mod, SI_SUB_PSEUDO, SI_ORDER_ANY);
|
||||
MODULE_VERSION(uether, 1);
|
||||
|
@ -81,7 +81,7 @@ struct usb_ether {
|
||||
const struct usb_ether_methods *ue_methods;
|
||||
struct sysctl_oid *ue_sysctl_oid;
|
||||
void *ue_sc;
|
||||
struct usb_device *ue_udev; /* used by usb2_ether_do_request() */
|
||||
struct usb_device *ue_udev; /* used by uether_do_request() */
|
||||
device_t ue_dev;
|
||||
device_t ue_miibus;
|
||||
|
||||
@ -101,22 +101,22 @@ struct usb_ether {
|
||||
uint8_t ue_eaddr[ETHER_ADDR_LEN];
|
||||
};
|
||||
|
||||
#define usb2_ether_do_request(ue,req,data,timo) \
|
||||
usb2_do_request_proc((ue)->ue_udev,&(ue)->ue_tq,req,data,0,NULL,timo)
|
||||
#define uether_do_request(ue,req,data,timo) \
|
||||
usbd_do_request_proc((ue)->ue_udev,&(ue)->ue_tq,req,data,0,NULL,timo)
|
||||
|
||||
uint8_t usb2_ether_pause(struct usb_ether *, unsigned int);
|
||||
struct ifnet *usb2_ether_getifp(struct usb_ether *);
|
||||
struct mii_data *usb2_ether_getmii(struct usb_ether *);
|
||||
void *usb2_ether_getsc(struct usb_ether *);
|
||||
int usb2_ether_ifattach(struct usb_ether *);
|
||||
void usb2_ether_ifdetach(struct usb_ether *);
|
||||
int usb2_ether_ioctl(struct ifnet *, u_long, caddr_t);
|
||||
struct mbuf *usb2_ether_newbuf(void);
|
||||
int usb2_ether_rxmbuf(struct usb_ether *, struct mbuf *,
|
||||
uint8_t uether_pause(struct usb_ether *, unsigned int);
|
||||
struct ifnet *uether_getifp(struct usb_ether *);
|
||||
struct mii_data *uether_getmii(struct usb_ether *);
|
||||
void *uether_getsc(struct usb_ether *);
|
||||
int uether_ifattach(struct usb_ether *);
|
||||
void uether_ifdetach(struct usb_ether *);
|
||||
int uether_ioctl(struct ifnet *, u_long, caddr_t);
|
||||
struct mbuf *uether_newbuf(void);
|
||||
int uether_rxmbuf(struct usb_ether *, struct mbuf *,
|
||||
unsigned int);
|
||||
int usb2_ether_rxbuf(struct usb_ether *,
|
||||
int uether_rxbuf(struct usb_ether *,
|
||||
struct usb_page_cache *,
|
||||
unsigned int, unsigned int);
|
||||
void usb2_ether_rxflush(struct usb_ether *);
|
||||
uint8_t usb2_ether_is_gone(struct usb_ether *);
|
||||
void uether_rxflush(struct usb_ether *);
|
||||
uint8_t uether_is_gone(struct usb_ether *);
|
||||
#endif /* _USB2_ETHERNET_H_ */
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include <dev/usb/usb_mfunc.h>
|
||||
#include "usbdevs.h"
|
||||
|
||||
#define USB_DEBUG_VAR usb2_debug
|
||||
#define USB_DEBUG_VAR usb_debug
|
||||
|
||||
#include <dev/usb/usb_core.h>
|
||||
#include <dev/usb/usb_lookup.h>
|
||||
@ -52,7 +52,7 @@ MODULE_VERSION(usb_quirk, 1);
|
||||
#define USB_DEV_QUIRKS_MAX 128
|
||||
#define USB_SUB_QUIRKS_MAX 8
|
||||
|
||||
struct usb2_quirk_entry {
|
||||
struct usb_quirk_entry {
|
||||
uint16_t vid;
|
||||
uint16_t pid;
|
||||
uint16_t lo_rev;
|
||||
@ -60,9 +60,9 @@ struct usb2_quirk_entry {
|
||||
uint16_t quirks[USB_SUB_QUIRKS_MAX];
|
||||
};
|
||||
|
||||
static struct mtx usb2_quirk_mtx;
|
||||
static struct mtx usb_quirk_mtx;
|
||||
|
||||
static struct usb2_quirk_entry usb2_quirks[USB_DEV_QUIRKS_MAX] = {
|
||||
static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRKS_MAX] = {
|
||||
{USB_QUIRK_ENTRY(USB_VENDOR_ASUS, USB_PRODUCT_ASUS_LCM, 0x0000, 0xFFFF, UQ_HID_IGNORE, UQ_NONE)},
|
||||
{USB_QUIRK_ENTRY(USB_VENDOR_INSIDEOUT, USB_PRODUCT_INSIDEOUT_EDGEPORT4, 0x094, 0x094, UQ_SWAP_UNICODE, UQ_NONE)},
|
||||
{USB_QUIRK_ENTRY(USB_VENDOR_DALLAS, USB_PRODUCT_DALLAS_J6502, 0x0a2, 0x0a2, UQ_BAD_ADC, UQ_NONE)},
|
||||
@ -137,26 +137,26 @@ static const char *usb_quirk_str[USB_QUIRK_MAX] = {
|
||||
};
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_quirkstr
|
||||
* usb_quirkstr
|
||||
*
|
||||
* This function converts an USB quirk code into a string.
|
||||
*------------------------------------------------------------------------*/
|
||||
static const char *
|
||||
usb2_quirkstr(uint16_t quirk)
|
||||
usb_quirkstr(uint16_t quirk)
|
||||
{
|
||||
return ((quirk < USB_QUIRK_MAX) ?
|
||||
usb_quirk_str[quirk] : "USB_QUIRK_UNKNOWN");
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_test_quirk_by_info
|
||||
* usb_test_quirk_by_info
|
||||
*
|
||||
* Returns:
|
||||
* 0: Quirk not found
|
||||
* Else: Quirk found
|
||||
*------------------------------------------------------------------------*/
|
||||
static uint8_t
|
||||
usb2_test_quirk_by_info(const struct usb_lookup_info *info, uint16_t quirk)
|
||||
usb_test_quirk_by_info(const struct usbd_lookup_info *info, uint16_t quirk)
|
||||
{
|
||||
uint16_t x;
|
||||
uint16_t y;
|
||||
@ -164,53 +164,53 @@ usb2_test_quirk_by_info(const struct usb_lookup_info *info, uint16_t quirk)
|
||||
if (quirk == UQ_NONE) {
|
||||
return (0);
|
||||
}
|
||||
mtx_lock(&usb2_quirk_mtx);
|
||||
mtx_lock(&usb_quirk_mtx);
|
||||
|
||||
for (x = 0; x != USB_DEV_QUIRKS_MAX; x++) {
|
||||
/* see if quirk information does not match */
|
||||
if ((usb2_quirks[x].vid != info->idVendor) ||
|
||||
(usb2_quirks[x].pid != info->idProduct) ||
|
||||
(usb2_quirks[x].lo_rev > info->bcdDevice) ||
|
||||
(usb2_quirks[x].hi_rev < info->bcdDevice)) {
|
||||
if ((usb_quirks[x].vid != info->idVendor) ||
|
||||
(usb_quirks[x].pid != info->idProduct) ||
|
||||
(usb_quirks[x].lo_rev > info->bcdDevice) ||
|
||||
(usb_quirks[x].hi_rev < info->bcdDevice)) {
|
||||
continue;
|
||||
}
|
||||
/* lookup quirk */
|
||||
for (y = 0; y != USB_SUB_QUIRKS_MAX; y++) {
|
||||
if (usb2_quirks[x].quirks[y] == quirk) {
|
||||
mtx_unlock(&usb2_quirk_mtx);
|
||||
DPRINTF("Found quirk '%s'.\n", usb2_quirkstr(quirk));
|
||||
if (usb_quirks[x].quirks[y] == quirk) {
|
||||
mtx_unlock(&usb_quirk_mtx);
|
||||
DPRINTF("Found quirk '%s'.\n", usb_quirkstr(quirk));
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
/* no quirk found */
|
||||
break;
|
||||
}
|
||||
mtx_unlock(&usb2_quirk_mtx);
|
||||
mtx_unlock(&usb_quirk_mtx);
|
||||
return (0);
|
||||
}
|
||||
|
||||
static struct usb2_quirk_entry *
|
||||
usb2_quirk_get_entry(uint16_t vid, uint16_t pid,
|
||||
static struct usb_quirk_entry *
|
||||
usb_quirk_get_entry(uint16_t vid, uint16_t pid,
|
||||
uint16_t lo_rev, uint16_t hi_rev, uint8_t do_alloc)
|
||||
{
|
||||
uint16_t x;
|
||||
|
||||
mtx_assert(&usb2_quirk_mtx, MA_OWNED);
|
||||
mtx_assert(&usb_quirk_mtx, MA_OWNED);
|
||||
|
||||
if ((vid | pid | lo_rev | hi_rev) == 0) {
|
||||
/* all zero - special case */
|
||||
return (usb2_quirks + USB_DEV_QUIRKS_MAX - 1);
|
||||
return (usb_quirks + USB_DEV_QUIRKS_MAX - 1);
|
||||
}
|
||||
/* search for an existing entry */
|
||||
for (x = 0; x != USB_DEV_QUIRKS_MAX; x++) {
|
||||
/* see if quirk information does not match */
|
||||
if ((usb2_quirks[x].vid != vid) ||
|
||||
(usb2_quirks[x].pid != pid) ||
|
||||
(usb2_quirks[x].lo_rev != lo_rev) ||
|
||||
(usb2_quirks[x].hi_rev != hi_rev)) {
|
||||
if ((usb_quirks[x].vid != vid) ||
|
||||
(usb_quirks[x].pid != pid) ||
|
||||
(usb_quirks[x].lo_rev != lo_rev) ||
|
||||
(usb_quirks[x].hi_rev != hi_rev)) {
|
||||
continue;
|
||||
}
|
||||
return (usb2_quirks + x);
|
||||
return (usb_quirks + x);
|
||||
}
|
||||
|
||||
if (do_alloc == 0) {
|
||||
@ -220,18 +220,18 @@ usb2_quirk_get_entry(uint16_t vid, uint16_t pid,
|
||||
/* search for a free entry */
|
||||
for (x = 0; x != USB_DEV_QUIRKS_MAX; x++) {
|
||||
/* see if quirk information does not match */
|
||||
if ((usb2_quirks[x].vid |
|
||||
usb2_quirks[x].pid |
|
||||
usb2_quirks[x].lo_rev |
|
||||
usb2_quirks[x].hi_rev) != 0) {
|
||||
if ((usb_quirks[x].vid |
|
||||
usb_quirks[x].pid |
|
||||
usb_quirks[x].lo_rev |
|
||||
usb_quirks[x].hi_rev) != 0) {
|
||||
continue;
|
||||
}
|
||||
usb2_quirks[x].vid = vid;
|
||||
usb2_quirks[x].pid = pid;
|
||||
usb2_quirks[x].lo_rev = lo_rev;
|
||||
usb2_quirks[x].hi_rev = hi_rev;
|
||||
usb_quirks[x].vid = vid;
|
||||
usb_quirks[x].pid = pid;
|
||||
usb_quirks[x].lo_rev = lo_rev;
|
||||
usb_quirks[x].hi_rev = hi_rev;
|
||||
|
||||
return (usb2_quirks + x);
|
||||
return (usb_quirks + x);
|
||||
}
|
||||
|
||||
/* no entry found */
|
||||
@ -239,18 +239,18 @@ usb2_quirk_get_entry(uint16_t vid, uint16_t pid,
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_quirk_ioctl - handle quirk IOCTLs
|
||||
* usb_quirk_ioctl - handle quirk IOCTLs
|
||||
*
|
||||
* Returns:
|
||||
* 0: Success
|
||||
* Else: Failure
|
||||
*------------------------------------------------------------------------*/
|
||||
static int
|
||||
usb2_quirk_ioctl(unsigned long cmd, caddr_t data,
|
||||
usb_quirk_ioctl(unsigned long cmd, caddr_t data,
|
||||
int fflag, struct thread *td)
|
||||
{
|
||||
struct usb_gen_quirk *pgq;
|
||||
struct usb2_quirk_entry *pqe;
|
||||
struct usb_quirk_entry *pqe;
|
||||
uint32_t x;
|
||||
uint32_t y;
|
||||
int err;
|
||||
@ -263,16 +263,16 @@ usb2_quirk_ioctl(unsigned long cmd, caddr_t data,
|
||||
if (y >= USB_DEV_QUIRKS_MAX) {
|
||||
return (EINVAL);
|
||||
}
|
||||
mtx_lock(&usb2_quirk_mtx);
|
||||
mtx_lock(&usb_quirk_mtx);
|
||||
/* copy out data */
|
||||
pgq->vid = usb2_quirks[y].vid;
|
||||
pgq->pid = usb2_quirks[y].pid;
|
||||
pgq->bcdDeviceLow = usb2_quirks[y].lo_rev;
|
||||
pgq->bcdDeviceHigh = usb2_quirks[y].hi_rev;
|
||||
pgq->vid = usb_quirks[y].vid;
|
||||
pgq->pid = usb_quirks[y].pid;
|
||||
pgq->bcdDeviceLow = usb_quirks[y].lo_rev;
|
||||
pgq->bcdDeviceHigh = usb_quirks[y].hi_rev;
|
||||
strlcpy(pgq->quirkname,
|
||||
usb2_quirkstr(usb2_quirks[y].quirks[x]),
|
||||
usb_quirkstr(usb_quirks[y].quirks[x]),
|
||||
sizeof(pgq->quirkname));
|
||||
mtx_unlock(&usb2_quirk_mtx);
|
||||
mtx_unlock(&usb_quirk_mtx);
|
||||
return (0); /* success */
|
||||
|
||||
case USB_QUIRK_NAME_GET:
|
||||
@ -282,7 +282,7 @@ usb2_quirk_ioctl(unsigned long cmd, caddr_t data,
|
||||
return (EINVAL);
|
||||
}
|
||||
strlcpy(pgq->quirkname,
|
||||
usb2_quirkstr(x), sizeof(pgq->quirkname));
|
||||
usb_quirkstr(x), sizeof(pgq->quirkname));
|
||||
return (0); /* success */
|
||||
|
||||
case USB_DEV_QUIRK_ADD:
|
||||
@ -295,7 +295,7 @@ usb2_quirk_ioctl(unsigned long cmd, caddr_t data,
|
||||
}
|
||||
/* convert quirk string into numerical */
|
||||
for (y = 0; y != USB_DEV_QUIRKS_MAX; y++) {
|
||||
if (strcmp(pgq->quirkname, usb2_quirkstr(y)) == 0) {
|
||||
if (strcmp(pgq->quirkname, usb_quirkstr(y)) == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -305,8 +305,8 @@ usb2_quirk_ioctl(unsigned long cmd, caddr_t data,
|
||||
if (y == UQ_NONE) {
|
||||
return (EINVAL);
|
||||
}
|
||||
mtx_lock(&usb2_quirk_mtx);
|
||||
pqe = usb2_quirk_get_entry(pgq->vid, pgq->pid,
|
||||
mtx_lock(&usb_quirk_mtx);
|
||||
pqe = usb_quirk_get_entry(pgq->vid, pgq->pid,
|
||||
pgq->bcdDeviceLow, pgq->bcdDeviceHigh, 1);
|
||||
for (x = 0; x != USB_SUB_QUIRKS_MAX; x++) {
|
||||
if (pqe->quirks[x] == UQ_NONE) {
|
||||
@ -314,7 +314,7 @@ usb2_quirk_ioctl(unsigned long cmd, caddr_t data,
|
||||
break;
|
||||
}
|
||||
}
|
||||
mtx_unlock(&usb2_quirk_mtx);
|
||||
mtx_unlock(&usb_quirk_mtx);
|
||||
if (x == USB_SUB_QUIRKS_MAX) {
|
||||
return (ENOMEM);
|
||||
}
|
||||
@ -329,7 +329,7 @@ usb2_quirk_ioctl(unsigned long cmd, caddr_t data,
|
||||
}
|
||||
/* convert quirk string into numerical */
|
||||
for (y = 0; y != USB_DEV_QUIRKS_MAX; y++) {
|
||||
if (strcmp(pgq->quirkname, usb2_quirkstr(y)) == 0) {
|
||||
if (strcmp(pgq->quirkname, usb_quirkstr(y)) == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -339,8 +339,8 @@ usb2_quirk_ioctl(unsigned long cmd, caddr_t data,
|
||||
if (y == UQ_NONE) {
|
||||
return (EINVAL);
|
||||
}
|
||||
mtx_lock(&usb2_quirk_mtx);
|
||||
pqe = usb2_quirk_get_entry(pgq->vid, pgq->pid,
|
||||
mtx_lock(&usb_quirk_mtx);
|
||||
pqe = usb_quirk_get_entry(pgq->vid, pgq->pid,
|
||||
pgq->bcdDeviceLow, pgq->bcdDeviceHigh, 0);
|
||||
for (x = 0; x != USB_SUB_QUIRKS_MAX; x++) {
|
||||
if (pqe->quirks[x] == y) {
|
||||
@ -349,7 +349,7 @@ usb2_quirk_ioctl(unsigned long cmd, caddr_t data,
|
||||
}
|
||||
}
|
||||
if (x == USB_SUB_QUIRKS_MAX) {
|
||||
mtx_unlock(&usb2_quirk_mtx);
|
||||
mtx_unlock(&usb_quirk_mtx);
|
||||
return (ENOMEM);
|
||||
}
|
||||
for (x = 0; x != USB_SUB_QUIRKS_MAX; x++) {
|
||||
@ -361,7 +361,7 @@ usb2_quirk_ioctl(unsigned long cmd, caddr_t data,
|
||||
/* all quirk entries are unused - release */
|
||||
memset(pqe, 0, sizeof(pqe));
|
||||
}
|
||||
mtx_unlock(&usb2_quirk_mtx);
|
||||
mtx_unlock(&usb_quirk_mtx);
|
||||
return (0); /* success */
|
||||
|
||||
default:
|
||||
@ -371,24 +371,24 @@ usb2_quirk_ioctl(unsigned long cmd, caddr_t data,
|
||||
}
|
||||
|
||||
static void
|
||||
usb2_quirk_init(void *arg)
|
||||
usb_quirk_init(void *arg)
|
||||
{
|
||||
/* initialize mutex */
|
||||
mtx_init(&usb2_quirk_mtx, "USB quirk", NULL, MTX_DEF);
|
||||
mtx_init(&usb_quirk_mtx, "USB quirk", NULL, MTX_DEF);
|
||||
|
||||
/* register our function */
|
||||
usb2_test_quirk_p = &usb2_test_quirk_by_info;
|
||||
usb2_quirk_ioctl_p = &usb2_quirk_ioctl;
|
||||
usb_test_quirk_p = &usb_test_quirk_by_info;
|
||||
usb_quirk_ioctl_p = &usb_quirk_ioctl;
|
||||
}
|
||||
|
||||
static void
|
||||
usb2_quirk_uninit(void *arg)
|
||||
usb_quirk_uninit(void *arg)
|
||||
{
|
||||
usb2_quirk_unload(arg);
|
||||
usb_quirk_unload(arg);
|
||||
|
||||
/* destroy mutex */
|
||||
mtx_destroy(&usb2_quirk_mtx);
|
||||
mtx_destroy(&usb_quirk_mtx);
|
||||
}
|
||||
|
||||
SYSINIT(usb2_quirk_init, SI_SUB_LOCK, SI_ORDER_FIRST, usb2_quirk_init, NULL);
|
||||
SYSUNINIT(usb2_quirk_uninit, SI_SUB_LOCK, SI_ORDER_ANY, usb2_quirk_uninit, NULL);
|
||||
SYSINIT(usb_quirk_init, SI_SUB_LOCK, SI_ORDER_FIRST, usb_quirk_init, NULL);
|
||||
SYSUNINIT(usb_quirk_uninit, SI_SUB_LOCK, SI_ORDER_ANY, usb_quirk_uninit, NULL);
|
||||
|
@ -131,10 +131,10 @@ static const struct usb_config u3g_config[U3G_N_TRANSFER] = {
|
||||
};
|
||||
|
||||
static const struct ucom_callback u3g_callback = {
|
||||
.usb2_com_start_read = &u3g_start_read,
|
||||
.usb2_com_stop_read = &u3g_stop_read,
|
||||
.usb2_com_start_write = &u3g_start_write,
|
||||
.usb2_com_stop_write = &u3g_stop_write,
|
||||
.ucom_start_read = &u3g_start_read,
|
||||
.ucom_stop_read = &u3g_stop_read,
|
||||
.ucom_start_write = &u3g_start_write,
|
||||
.ucom_stop_write = &u3g_stop_write,
|
||||
};
|
||||
|
||||
static device_method_t u3g_methods[] = {
|
||||
@ -238,7 +238,7 @@ u3g_sierra_init(struct usb_device *udev)
|
||||
USETW(req.wIndex, UHF_PORT_CONNECTION);
|
||||
USETW(req.wLength, 0);
|
||||
|
||||
if (usb2_do_request_flags(udev, NULL, &req,
|
||||
if (usbd_do_request_flags(udev, NULL, &req,
|
||||
NULL, 0, NULL, USB_MS_HZ)) {
|
||||
/* ignore any errors */
|
||||
}
|
||||
@ -258,7 +258,7 @@ u3g_huawei_init(struct usb_device *udev)
|
||||
USETW(req.wIndex, UHF_PORT_SUSPEND);
|
||||
USETW(req.wLength, 0);
|
||||
|
||||
if (usb2_do_request_flags(udev, NULL, &req,
|
||||
if (usbd_do_request_flags(udev, NULL, &req,
|
||||
NULL, 0, NULL, USB_MS_HZ)) {
|
||||
/* ignore any errors */
|
||||
}
|
||||
@ -306,7 +306,7 @@ u3g_sael_m460_init(struct usb_device *udev)
|
||||
|
||||
DPRINTFN(1, "\n");
|
||||
|
||||
if (usb2_req_set_alt_interface_no(udev, NULL, 0, 0)) {
|
||||
if (usbd_req_set_alt_interface_no(udev, NULL, 0, 0)) {
|
||||
DPRINTFN(0, "Alt setting 0 failed\n");
|
||||
return;
|
||||
}
|
||||
@ -321,13 +321,13 @@ u3g_sael_m460_init(struct usb_device *udev)
|
||||
DPRINTFN(0, "too small buffer\n");
|
||||
continue;
|
||||
}
|
||||
err = usb2_do_request(udev, NULL, &req, buf);
|
||||
err = usbd_do_request(udev, NULL, &req, buf);
|
||||
} else {
|
||||
if (len > (sizeof(setup[0]) - 8)) {
|
||||
DPRINTFN(0, "too small buffer\n");
|
||||
continue;
|
||||
}
|
||||
err = usb2_do_request(udev, NULL, &req,
|
||||
err = usbd_do_request(udev, NULL, &req,
|
||||
__DECONST(uint8_t *, &setup[n][8]));
|
||||
}
|
||||
if (err) {
|
||||
@ -349,7 +349,7 @@ static int
|
||||
u3g_lookup_huawei(struct usb_attach_arg *uaa)
|
||||
{
|
||||
/* Calling the lookup function will also set the driver info! */
|
||||
return (usb2_lookup_id_by_uaa(u3g_devs, sizeof(u3g_devs), uaa));
|
||||
return (usbd_lookup_id_by_uaa(u3g_devs, sizeof(u3g_devs), uaa));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -369,7 +369,7 @@ u3g_test_huawei_autoinst(struct usb_device *udev,
|
||||
if (udev == NULL) {
|
||||
return (USB_ERR_INVAL);
|
||||
}
|
||||
iface = usb2_get_iface(udev, 0);
|
||||
iface = usbd_get_iface(udev, 0);
|
||||
if (iface == NULL) {
|
||||
return (USB_ERR_INVAL);
|
||||
}
|
||||
@ -389,7 +389,7 @@ u3g_test_huawei_autoinst(struct usb_device *udev,
|
||||
if (flags & U3GFL_HUAWEI_INIT) {
|
||||
u3g_huawei_init(udev);
|
||||
} else if (flags & U3GFL_SCSI_EJECT) {
|
||||
return (usb2_test_autoinstall(udev, 0, 1));
|
||||
return (usb_test_autoinstall(udev, 0, 1));
|
||||
} else if (flags & U3GFL_SIERRA_INIT) {
|
||||
u3g_sierra_init(udev);
|
||||
} else {
|
||||
@ -405,10 +405,10 @@ u3g_driver_loaded(struct module *mod, int what, void *arg)
|
||||
switch (what) {
|
||||
case MOD_LOAD:
|
||||
/* register our autoinstall handler */
|
||||
usb2_test_huawei_autoinst_p = &u3g_test_huawei_autoinst;
|
||||
usb_test_huawei_autoinst_p = &u3g_test_huawei_autoinst;
|
||||
break;
|
||||
case MOD_UNLOAD:
|
||||
usb2_test_huawei_unload(NULL);
|
||||
usb_test_huawei_unload(NULL);
|
||||
break;
|
||||
default:
|
||||
return (EOPNOTSUPP);
|
||||
@ -457,7 +457,7 @@ u3g_attach(device_t dev)
|
||||
for (n = 0; n != U3G_N_TRANSFER; n++)
|
||||
u3g_config_tmp[n] = u3g_config[n];
|
||||
|
||||
device_set_usb2_desc(dev);
|
||||
device_set_usb_desc(dev);
|
||||
mtx_init(&sc->sc_mtx, "u3g", NULL, MTX_DEF);
|
||||
|
||||
sc->sc_udev = uaa->device;
|
||||
@ -465,13 +465,13 @@ u3g_attach(device_t dev)
|
||||
/* Claim all interfaces on the device */
|
||||
iface_valid = 0;
|
||||
for (i = uaa->info.bIfaceIndex; i < USB_IFACE_MAX; i++) {
|
||||
iface = usb2_get_iface(uaa->device, i);
|
||||
iface = usbd_get_iface(uaa->device, i);
|
||||
if (iface == NULL)
|
||||
break;
|
||||
id = usb2_get_interface_descriptor(iface);
|
||||
id = usbd_get_interface_descriptor(iface);
|
||||
if (id == NULL || id->bInterfaceClass != UICLASS_VENDOR)
|
||||
continue;
|
||||
usb2_set_parent_iface(uaa->device, i, uaa->info.bIfaceIndex);
|
||||
usbd_set_parent_iface(uaa->device, i, uaa->info.bIfaceIndex);
|
||||
iface_valid |= (1<<i);
|
||||
}
|
||||
|
||||
@ -489,7 +489,7 @@ u3g_attach(device_t dev)
|
||||
u3g_config_tmp[n].ep_index = ep;
|
||||
|
||||
/* try to allocate a set of BULK endpoints */
|
||||
error = usb2_transfer_setup(uaa->device, &i,
|
||||
error = usbd_transfer_setup(uaa->device, &i,
|
||||
sc->sc_xfer[nports], u3g_config_tmp, U3G_N_TRANSFER,
|
||||
&sc->sc_ucom[nports], &sc->sc_mtx);
|
||||
if (error) {
|
||||
@ -501,8 +501,8 @@ u3g_attach(device_t dev)
|
||||
|
||||
/* set stall by default */
|
||||
mtx_lock(&sc->sc_mtx);
|
||||
usb2_transfer_set_stall(sc->sc_xfer[nports][U3G_BULK_WR]);
|
||||
usb2_transfer_set_stall(sc->sc_xfer[nports][U3G_BULK_RD]);
|
||||
usbd_transfer_set_stall(sc->sc_xfer[nports][U3G_BULK_WR]);
|
||||
usbd_transfer_set_stall(sc->sc_xfer[nports][U3G_BULK_RD]);
|
||||
mtx_unlock(&sc->sc_mtx);
|
||||
|
||||
nports++; /* found one port */
|
||||
@ -516,10 +516,10 @@ u3g_attach(device_t dev)
|
||||
}
|
||||
sc->sc_numports = nports;
|
||||
|
||||
error = usb2_com_attach(&sc->sc_super_ucom, sc->sc_ucom,
|
||||
error = ucom_attach(&sc->sc_super_ucom, sc->sc_ucom,
|
||||
sc->sc_numports, sc, &u3g_callback, &sc->sc_mtx);
|
||||
if (error) {
|
||||
DPRINTF("usb2_com_attach failed\n");
|
||||
DPRINTF("ucom_attach failed\n");
|
||||
goto detach;
|
||||
}
|
||||
if (sc->sc_numports > 1)
|
||||
@ -540,10 +540,10 @@ u3g_detach(device_t dev)
|
||||
DPRINTF("sc=%p\n", sc);
|
||||
|
||||
/* NOTE: It is not dangerous to detach more ports than attached! */
|
||||
usb2_com_detach(&sc->sc_super_ucom, sc->sc_ucom, U3G_MAXPORTS);
|
||||
ucom_detach(&sc->sc_super_ucom, sc->sc_ucom, U3G_MAXPORTS);
|
||||
|
||||
for (m = 0; m != U3G_MAXPORTS; m++)
|
||||
usb2_transfer_unsetup(sc->sc_xfer[m], U3G_N_TRANSFER);
|
||||
usbd_transfer_unsetup(sc->sc_xfer[m], U3G_N_TRANSFER);
|
||||
mtx_destroy(&sc->sc_mtx);
|
||||
|
||||
return (0);
|
||||
@ -555,7 +555,7 @@ u3g_start_read(struct ucom_softc *ucom)
|
||||
struct u3g_softc *sc = ucom->sc_parent;
|
||||
|
||||
/* start read endpoint */
|
||||
usb2_transfer_start(sc->sc_xfer[ucom->sc_local_unit][U3G_BULK_RD]);
|
||||
usbd_transfer_start(sc->sc_xfer[ucom->sc_local_unit][U3G_BULK_RD]);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -565,7 +565,7 @@ u3g_stop_read(struct ucom_softc *ucom)
|
||||
struct u3g_softc *sc = ucom->sc_parent;
|
||||
|
||||
/* stop read endpoint */
|
||||
usb2_transfer_stop(sc->sc_xfer[ucom->sc_local_unit][U3G_BULK_RD]);
|
||||
usbd_transfer_stop(sc->sc_xfer[ucom->sc_local_unit][U3G_BULK_RD]);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -574,7 +574,7 @@ u3g_start_write(struct ucom_softc *ucom)
|
||||
{
|
||||
struct u3g_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[ucom->sc_local_unit][U3G_BULK_WR]);
|
||||
usbd_transfer_start(sc->sc_xfer[ucom->sc_local_unit][U3G_BULK_WR]);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -583,7 +583,7 @@ u3g_stop_write(struct ucom_softc *ucom)
|
||||
{
|
||||
struct u3g_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[ucom->sc_local_unit][U3G_BULK_WR]);
|
||||
usbd_transfer_stop(sc->sc_xfer[ucom->sc_local_unit][U3G_BULK_WR]);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -597,10 +597,10 @@ u3g_write_callback(struct usb_xfer *xfer)
|
||||
case USB_ST_TRANSFERRED:
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
if (usb2_com_get_data(ucom, xfer->frbuffers, 0,
|
||||
if (ucom_get_data(ucom, xfer->frbuffers, 0,
|
||||
U3G_BSIZE, &actlen)) {
|
||||
xfer->frlengths[0] = actlen;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -622,12 +622,12 @@ u3g_read_callback(struct usb_xfer *xfer)
|
||||
|
||||
switch (USB_GET_STATE(xfer)) {
|
||||
case USB_ST_TRANSFERRED:
|
||||
usb2_com_put_data(ucom, xfer->frbuffers, 0, xfer->actlen);
|
||||
ucom_put_data(ucom, xfer->frbuffers, 0, xfer->actlen);
|
||||
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
break;
|
||||
|
||||
default: /* Error */
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include <dev/usb/usb_error.h>
|
||||
#include <dev/usb/usb_cdc.h>
|
||||
|
||||
#define USB_DEBUG_VAR usb2_debug
|
||||
#define USB_DEBUG_VAR usb_debug
|
||||
|
||||
#include <dev/usb/usb_core.h>
|
||||
#include <dev/usb/usb_debug.h>
|
||||
@ -122,14 +122,14 @@ static const struct usb_config
|
||||
};
|
||||
|
||||
static const struct ucom_callback uark_callback = {
|
||||
.usb2_com_cfg_get_status = &uark_cfg_get_status,
|
||||
.usb2_com_cfg_set_break = &uark_cfg_set_break,
|
||||
.usb2_com_cfg_param = &uark_cfg_param,
|
||||
.usb2_com_pre_param = &uark_pre_param,
|
||||
.usb2_com_start_read = &uark_start_read,
|
||||
.usb2_com_stop_read = &uark_stop_read,
|
||||
.usb2_com_start_write = &uark_start_write,
|
||||
.usb2_com_stop_write = &uark_stop_write,
|
||||
.ucom_cfg_get_status = &uark_cfg_get_status,
|
||||
.ucom_cfg_set_break = &uark_cfg_set_break,
|
||||
.ucom_cfg_param = &uark_cfg_param,
|
||||
.ucom_pre_param = &uark_pre_param,
|
||||
.ucom_start_read = &uark_start_read,
|
||||
.ucom_stop_read = &uark_stop_read,
|
||||
.ucom_start_write = &uark_start_write,
|
||||
.ucom_stop_write = &uark_stop_write,
|
||||
};
|
||||
|
||||
static device_method_t uark_methods[] = {
|
||||
@ -170,7 +170,7 @@ uark_probe(device_t dev)
|
||||
if (uaa->info.bIfaceIndex != UARK_IFACE_INDEX) {
|
||||
return (ENXIO);
|
||||
}
|
||||
return (usb2_lookup_id_by_uaa(uark_devs, sizeof(uark_devs), uaa));
|
||||
return (usbd_lookup_id_by_uaa(uark_devs, sizeof(uark_devs), uaa));
|
||||
}
|
||||
|
||||
static int
|
||||
@ -181,13 +181,13 @@ uark_attach(device_t dev)
|
||||
int32_t error;
|
||||
uint8_t iface_index;
|
||||
|
||||
device_set_usb2_desc(dev);
|
||||
device_set_usb_desc(dev);
|
||||
mtx_init(&sc->sc_mtx, "uark", NULL, MTX_DEF);
|
||||
|
||||
sc->sc_udev = uaa->device;
|
||||
|
||||
iface_index = UARK_IFACE_INDEX;
|
||||
error = usb2_transfer_setup
|
||||
error = usbd_transfer_setup
|
||||
(uaa->device, &iface_index, sc->sc_xfer,
|
||||
uark_xfer_config, UARK_N_TRANSFER, sc, &sc->sc_mtx);
|
||||
|
||||
@ -198,14 +198,14 @@ uark_attach(device_t dev)
|
||||
}
|
||||
/* clear stall at first run */
|
||||
mtx_lock(&sc->sc_mtx);
|
||||
usb2_transfer_set_stall(sc->sc_xfer[UARK_BULK_DT_WR]);
|
||||
usb2_transfer_set_stall(sc->sc_xfer[UARK_BULK_DT_RD]);
|
||||
usbd_transfer_set_stall(sc->sc_xfer[UARK_BULK_DT_WR]);
|
||||
usbd_transfer_set_stall(sc->sc_xfer[UARK_BULK_DT_RD]);
|
||||
mtx_unlock(&sc->sc_mtx);
|
||||
|
||||
error = usb2_com_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc,
|
||||
error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc,
|
||||
&uark_callback, &sc->sc_mtx);
|
||||
if (error) {
|
||||
DPRINTF("usb2_com_attach failed\n");
|
||||
DPRINTF("ucom_attach failed\n");
|
||||
goto detach;
|
||||
}
|
||||
return (0); /* success */
|
||||
@ -220,8 +220,8 @@ uark_detach(device_t dev)
|
||||
{
|
||||
struct uark_softc *sc = device_get_softc(dev);
|
||||
|
||||
usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
|
||||
usb2_transfer_unsetup(sc->sc_xfer, UARK_N_TRANSFER);
|
||||
ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
|
||||
usbd_transfer_unsetup(sc->sc_xfer, UARK_N_TRANSFER);
|
||||
mtx_destroy(&sc->sc_mtx);
|
||||
|
||||
return (0);
|
||||
@ -237,10 +237,10 @@ uark_bulk_write_callback(struct usb_xfer *xfer)
|
||||
case USB_ST_SETUP:
|
||||
case USB_ST_TRANSFERRED:
|
||||
tr_setup:
|
||||
if (usb2_com_get_data(&sc->sc_ucom, xfer->frbuffers, 0,
|
||||
if (ucom_get_data(&sc->sc_ucom, xfer->frbuffers, 0,
|
||||
UARK_BUF_SIZE, &actlen)) {
|
||||
xfer->frlengths[0] = actlen;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -262,13 +262,13 @@ uark_bulk_read_callback(struct usb_xfer *xfer)
|
||||
|
||||
switch (USB_GET_STATE(xfer)) {
|
||||
case USB_ST_TRANSFERRED:
|
||||
usb2_com_put_data(&sc->sc_ucom, xfer->frbuffers, 0,
|
||||
ucom_put_data(&sc->sc_ucom, xfer->frbuffers, 0,
|
||||
xfer->actlen);
|
||||
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
@ -286,7 +286,7 @@ uark_start_read(struct ucom_softc *ucom)
|
||||
{
|
||||
struct uark_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[UARK_BULK_DT_RD]);
|
||||
usbd_transfer_start(sc->sc_xfer[UARK_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -294,7 +294,7 @@ uark_stop_read(struct ucom_softc *ucom)
|
||||
{
|
||||
struct uark_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[UARK_BULK_DT_RD]);
|
||||
usbd_transfer_stop(sc->sc_xfer[UARK_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -302,7 +302,7 @@ uark_start_write(struct ucom_softc *ucom)
|
||||
{
|
||||
struct uark_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[UARK_BULK_DT_WR]);
|
||||
usbd_transfer_start(sc->sc_xfer[UARK_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -310,7 +310,7 @@ uark_stop_write(struct ucom_softc *ucom)
|
||||
{
|
||||
struct uark_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[UARK_BULK_DT_WR]);
|
||||
usbd_transfer_stop(sc->sc_xfer[UARK_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static int
|
||||
@ -402,10 +402,10 @@ uark_cfg_write(struct uark_softc *sc, uint16_t index, uint16_t value)
|
||||
USETW(req.wIndex, index);
|
||||
USETW(req.wLength, 0);
|
||||
|
||||
err = usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
err = ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
&req, NULL, 0, 1000);
|
||||
if (err) {
|
||||
DPRINTFN(0, "device request failed, err=%s "
|
||||
"(ignored)\n", usb2_errstr(err));
|
||||
"(ignored)\n", usbd_errstr(err));
|
||||
}
|
||||
}
|
||||
|
@ -213,16 +213,16 @@ static const struct usb_config ubsa_config[UBSA_N_TRANSFER] = {
|
||||
};
|
||||
|
||||
static const struct ucom_callback ubsa_callback = {
|
||||
.usb2_com_cfg_get_status = &ubsa_cfg_get_status,
|
||||
.usb2_com_cfg_set_dtr = &ubsa_cfg_set_dtr,
|
||||
.usb2_com_cfg_set_rts = &ubsa_cfg_set_rts,
|
||||
.usb2_com_cfg_set_break = &ubsa_cfg_set_break,
|
||||
.usb2_com_cfg_param = &ubsa_cfg_param,
|
||||
.usb2_com_pre_param = &ubsa_pre_param,
|
||||
.usb2_com_start_read = &ubsa_start_read,
|
||||
.usb2_com_stop_read = &ubsa_stop_read,
|
||||
.usb2_com_start_write = &ubsa_start_write,
|
||||
.usb2_com_stop_write = &ubsa_stop_write,
|
||||
.ucom_cfg_get_status = &ubsa_cfg_get_status,
|
||||
.ucom_cfg_set_dtr = &ubsa_cfg_set_dtr,
|
||||
.ucom_cfg_set_rts = &ubsa_cfg_set_rts,
|
||||
.ucom_cfg_set_break = &ubsa_cfg_set_break,
|
||||
.ucom_cfg_param = &ubsa_cfg_param,
|
||||
.ucom_pre_param = &ubsa_pre_param,
|
||||
.ucom_start_read = &ubsa_start_read,
|
||||
.ucom_stop_read = &ubsa_stop_read,
|
||||
.ucom_start_write = &ubsa_start_write,
|
||||
.ucom_stop_write = &ubsa_stop_write,
|
||||
};
|
||||
|
||||
static const struct usb_device_id ubsa_devs[] = {
|
||||
@ -277,7 +277,7 @@ ubsa_probe(device_t dev)
|
||||
if (uaa->info.bIfaceIndex != UBSA_IFACE_INDEX) {
|
||||
return (ENXIO);
|
||||
}
|
||||
return (usb2_lookup_id_by_uaa(ubsa_devs, sizeof(ubsa_devs), uaa));
|
||||
return (usbd_lookup_id_by_uaa(ubsa_devs, sizeof(ubsa_devs), uaa));
|
||||
}
|
||||
|
||||
static int
|
||||
@ -289,14 +289,14 @@ ubsa_attach(device_t dev)
|
||||
|
||||
DPRINTF("sc=%p\n", sc);
|
||||
|
||||
device_set_usb2_desc(dev);
|
||||
device_set_usb_desc(dev);
|
||||
mtx_init(&sc->sc_mtx, "ubsa", NULL, MTX_DEF);
|
||||
|
||||
sc->sc_udev = uaa->device;
|
||||
sc->sc_iface_no = uaa->info.bIfaceNum;
|
||||
sc->sc_iface_index = UBSA_IFACE_INDEX;
|
||||
|
||||
error = usb2_transfer_setup(uaa->device, &sc->sc_iface_index,
|
||||
error = usbd_transfer_setup(uaa->device, &sc->sc_iface_index,
|
||||
sc->sc_xfer, ubsa_config, UBSA_N_TRANSFER, sc, &sc->sc_mtx);
|
||||
|
||||
if (error) {
|
||||
@ -305,14 +305,14 @@ ubsa_attach(device_t dev)
|
||||
}
|
||||
/* clear stall at first run */
|
||||
mtx_lock(&sc->sc_mtx);
|
||||
usb2_transfer_set_stall(sc->sc_xfer[UBSA_BULK_DT_WR]);
|
||||
usb2_transfer_set_stall(sc->sc_xfer[UBSA_BULK_DT_RD]);
|
||||
usbd_transfer_set_stall(sc->sc_xfer[UBSA_BULK_DT_WR]);
|
||||
usbd_transfer_set_stall(sc->sc_xfer[UBSA_BULK_DT_RD]);
|
||||
mtx_unlock(&sc->sc_mtx);
|
||||
|
||||
error = usb2_com_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc,
|
||||
error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc,
|
||||
&ubsa_callback, &sc->sc_mtx);
|
||||
if (error) {
|
||||
DPRINTF("usb2_com_attach failed\n");
|
||||
DPRINTF("ucom_attach failed\n");
|
||||
goto detach;
|
||||
}
|
||||
return (0);
|
||||
@ -329,8 +329,8 @@ ubsa_detach(device_t dev)
|
||||
|
||||
DPRINTF("sc=%p\n", sc);
|
||||
|
||||
usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
|
||||
usb2_transfer_unsetup(sc->sc_xfer, UBSA_N_TRANSFER);
|
||||
ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
|
||||
usbd_transfer_unsetup(sc->sc_xfer, UBSA_N_TRANSFER);
|
||||
mtx_destroy(&sc->sc_mtx);
|
||||
|
||||
return (0);
|
||||
@ -349,11 +349,11 @@ ubsa_cfg_request(struct ubsa_softc *sc, uint8_t index, uint16_t value)
|
||||
req.wIndex[1] = 0;
|
||||
USETW(req.wLength, 0);
|
||||
|
||||
err = usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
err = ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
&req, NULL, 0, 1000);
|
||||
if (err) {
|
||||
DPRINTFN(0, "device request failed, err=%s "
|
||||
"(ignored)\n", usb2_errstr(err));
|
||||
"(ignored)\n", usbd_errstr(err));
|
||||
}
|
||||
}
|
||||
|
||||
@ -491,10 +491,10 @@ ubsa_start_read(struct ucom_softc *ucom)
|
||||
struct ubsa_softc *sc = ucom->sc_parent;
|
||||
|
||||
/* start interrupt endpoint */
|
||||
usb2_transfer_start(sc->sc_xfer[UBSA_INTR_DT_RD]);
|
||||
usbd_transfer_start(sc->sc_xfer[UBSA_INTR_DT_RD]);
|
||||
|
||||
/* start read endpoint */
|
||||
usb2_transfer_start(sc->sc_xfer[UBSA_BULK_DT_RD]);
|
||||
usbd_transfer_start(sc->sc_xfer[UBSA_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -503,10 +503,10 @@ ubsa_stop_read(struct ucom_softc *ucom)
|
||||
struct ubsa_softc *sc = ucom->sc_parent;
|
||||
|
||||
/* stop interrupt endpoint */
|
||||
usb2_transfer_stop(sc->sc_xfer[UBSA_INTR_DT_RD]);
|
||||
usbd_transfer_stop(sc->sc_xfer[UBSA_INTR_DT_RD]);
|
||||
|
||||
/* stop read endpoint */
|
||||
usb2_transfer_stop(sc->sc_xfer[UBSA_BULK_DT_RD]);
|
||||
usbd_transfer_stop(sc->sc_xfer[UBSA_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -514,7 +514,7 @@ ubsa_start_write(struct ucom_softc *ucom)
|
||||
{
|
||||
struct ubsa_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[UBSA_BULK_DT_WR]);
|
||||
usbd_transfer_start(sc->sc_xfer[UBSA_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -522,7 +522,7 @@ ubsa_stop_write(struct ucom_softc *ucom)
|
||||
{
|
||||
struct ubsa_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[UBSA_BULK_DT_WR]);
|
||||
usbd_transfer_stop(sc->sc_xfer[UBSA_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -546,11 +546,11 @@ ubsa_write_callback(struct usb_xfer *xfer)
|
||||
case USB_ST_SETUP:
|
||||
case USB_ST_TRANSFERRED:
|
||||
tr_setup:
|
||||
if (usb2_com_get_data(&sc->sc_ucom, xfer->frbuffers, 0,
|
||||
if (ucom_get_data(&sc->sc_ucom, xfer->frbuffers, 0,
|
||||
UBSA_BSIZE, &actlen)) {
|
||||
|
||||
xfer->frlengths[0] = actlen;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -572,12 +572,12 @@ ubsa_read_callback(struct usb_xfer *xfer)
|
||||
|
||||
switch (USB_GET_STATE(xfer)) {
|
||||
case USB_ST_TRANSFERRED:
|
||||
usb2_com_put_data(&sc->sc_ucom, xfer->frbuffers, 0, xfer->actlen);
|
||||
ucom_put_data(&sc->sc_ucom, xfer->frbuffers, 0, xfer->actlen);
|
||||
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
@ -602,7 +602,7 @@ ubsa_intr_callback(struct usb_xfer *xfer)
|
||||
|
||||
if (xfer->actlen >= sizeof(buf)) {
|
||||
|
||||
usb2_copy_out(xfer->frbuffers, 0, buf, sizeof(buf));
|
||||
usbd_copy_out(xfer->frbuffers, 0, buf, sizeof(buf));
|
||||
|
||||
/*
|
||||
* incidentally, Belkin adapter status bits match
|
||||
@ -614,7 +614,7 @@ ubsa_intr_callback(struct usb_xfer *xfer)
|
||||
DPRINTF("lsr = 0x%02x, msr = 0x%02x\n",
|
||||
sc->sc_lsr, sc->sc_msr);
|
||||
|
||||
usb2_com_status_change(&sc->sc_ucom);
|
||||
ucom_status_change(&sc->sc_ucom);
|
||||
} else {
|
||||
DPRINTF("ignoring short packet, %d bytes\n",
|
||||
xfer->actlen);
|
||||
@ -623,7 +623,7 @@ ubsa_intr_callback(struct usb_xfer *xfer)
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
|
@ -172,13 +172,13 @@ static const struct usb_config ubser_config[UBSER_N_TRANSFER] = {
|
||||
};
|
||||
|
||||
static const struct ucom_callback ubser_callback = {
|
||||
.usb2_com_cfg_set_break = &ubser_cfg_set_break,
|
||||
.usb2_com_cfg_get_status = &ubser_cfg_get_status,
|
||||
.usb2_com_pre_param = &ubser_pre_param,
|
||||
.usb2_com_start_read = &ubser_start_read,
|
||||
.usb2_com_stop_read = &ubser_stop_read,
|
||||
.usb2_com_start_write = &ubser_start_write,
|
||||
.usb2_com_stop_write = &ubser_stop_write,
|
||||
.ucom_cfg_set_break = &ubser_cfg_set_break,
|
||||
.ucom_cfg_get_status = &ubser_cfg_get_status,
|
||||
.ucom_pre_param = &ubser_pre_param,
|
||||
.ucom_start_read = &ubser_start_read,
|
||||
.ucom_stop_read = &ubser_stop_read,
|
||||
.ucom_start_write = &ubser_start_write,
|
||||
.ucom_stop_write = &ubser_stop_write,
|
||||
};
|
||||
|
||||
static device_method_t ubser_methods[] = {
|
||||
@ -226,7 +226,7 @@ ubser_attach(device_t dev)
|
||||
uint8_t n;
|
||||
int error;
|
||||
|
||||
device_set_usb2_desc(dev);
|
||||
device_set_usb_desc(dev);
|
||||
mtx_init(&sc->sc_mtx, "ubser", NULL, MTX_DEF);
|
||||
|
||||
snprintf(sc->sc_name, sizeof(sc->sc_name), "%s",
|
||||
@ -243,14 +243,14 @@ ubser_attach(device_t dev)
|
||||
req.wIndex[0] = sc->sc_iface_no;
|
||||
req.wIndex[1] = 0;
|
||||
USETW(req.wLength, 1);
|
||||
error = usb2_do_request_flags(uaa->device, NULL,
|
||||
error = usbd_do_request_flags(uaa->device, NULL,
|
||||
&req, &sc->sc_numser,
|
||||
0, NULL, USB_DEFAULT_TIMEOUT);
|
||||
|
||||
if (error || (sc->sc_numser == 0)) {
|
||||
device_printf(dev, "failed to get number "
|
||||
"of serial ports: %s\n",
|
||||
usb2_errstr(error));
|
||||
usbd_errstr(error));
|
||||
goto detach;
|
||||
}
|
||||
if (sc->sc_numser > UBSER_UNIT_MAX)
|
||||
@ -258,7 +258,7 @@ ubser_attach(device_t dev)
|
||||
|
||||
device_printf(dev, "found %i serials\n", sc->sc_numser);
|
||||
|
||||
error = usb2_transfer_setup(uaa->device, &sc->sc_iface_index,
|
||||
error = usbd_transfer_setup(uaa->device, &sc->sc_iface_index,
|
||||
sc->sc_xfer, ubser_config, UBSER_N_TRANSFER, sc, &sc->sc_mtx);
|
||||
if (error) {
|
||||
goto detach;
|
||||
@ -275,16 +275,16 @@ ubser_attach(device_t dev)
|
||||
sc->sc_ucom[n].sc_portno = n;
|
||||
}
|
||||
|
||||
error = usb2_com_attach(&sc->sc_super_ucom, sc->sc_ucom,
|
||||
error = ucom_attach(&sc->sc_super_ucom, sc->sc_ucom,
|
||||
sc->sc_numser, sc, &ubser_callback, &sc->sc_mtx);
|
||||
if (error) {
|
||||
goto detach;
|
||||
}
|
||||
|
||||
mtx_lock(&sc->sc_mtx);
|
||||
usb2_transfer_set_stall(sc->sc_xfer[UBSER_BULK_DT_WR]);
|
||||
usb2_transfer_set_stall(sc->sc_xfer[UBSER_BULK_DT_RD]);
|
||||
usb2_transfer_start(sc->sc_xfer[UBSER_BULK_DT_RD]);
|
||||
usbd_transfer_set_stall(sc->sc_xfer[UBSER_BULK_DT_WR]);
|
||||
usbd_transfer_set_stall(sc->sc_xfer[UBSER_BULK_DT_RD]);
|
||||
usbd_transfer_start(sc->sc_xfer[UBSER_BULK_DT_RD]);
|
||||
mtx_unlock(&sc->sc_mtx);
|
||||
|
||||
return (0); /* success */
|
||||
@ -301,8 +301,8 @@ ubser_detach(device_t dev)
|
||||
|
||||
DPRINTF("\n");
|
||||
|
||||
usb2_com_detach(&sc->sc_super_ucom, sc->sc_ucom, sc->sc_numser);
|
||||
usb2_transfer_unsetup(sc->sc_xfer, UBSER_N_TRANSFER);
|
||||
ucom_detach(&sc->sc_super_ucom, sc->sc_ucom, sc->sc_numser);
|
||||
usbd_transfer_unsetup(sc->sc_xfer, UBSER_N_TRANSFER);
|
||||
mtx_destroy(&sc->sc_mtx);
|
||||
|
||||
return (0);
|
||||
@ -379,16 +379,16 @@ ubser_write_callback(struct usb_xfer *xfer)
|
||||
case USB_ST_TRANSFERRED:
|
||||
tr_setup:
|
||||
do {
|
||||
if (usb2_com_get_data(sc->sc_ucom + sc->sc_curr_tx_unit,
|
||||
if (ucom_get_data(sc->sc_ucom + sc->sc_curr_tx_unit,
|
||||
xfer->frbuffers, 1, sc->sc_tx_size - 1,
|
||||
&actlen)) {
|
||||
|
||||
buf[0] = sc->sc_curr_tx_unit;
|
||||
|
||||
usb2_copy_in(xfer->frbuffers, 0, buf, 1);
|
||||
usbd_copy_in(xfer->frbuffers, 0, buf, 1);
|
||||
|
||||
xfer->frlengths[0] = actlen + 1;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
|
||||
ubser_inc_tx_unit(sc); /* round robin */
|
||||
|
||||
@ -423,19 +423,19 @@ ubser_read_callback(struct usb_xfer *xfer)
|
||||
DPRINTF("invalid actlen=0!\n");
|
||||
goto tr_setup;
|
||||
}
|
||||
usb2_copy_out(xfer->frbuffers, 0, buf, 1);
|
||||
usbd_copy_out(xfer->frbuffers, 0, buf, 1);
|
||||
|
||||
if (buf[0] >= sc->sc_numser) {
|
||||
DPRINTF("invalid serial number!\n");
|
||||
goto tr_setup;
|
||||
}
|
||||
usb2_com_put_data(sc->sc_ucom + buf[0],
|
||||
ucom_put_data(sc->sc_ucom + buf[0],
|
||||
xfer->frbuffers, 1, xfer->actlen - 1);
|
||||
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
@ -467,11 +467,11 @@ ubser_cfg_set_break(struct ucom_softc *ucom, uint8_t onoff)
|
||||
req.wIndex[1] = 0;
|
||||
USETW(req.wLength, 0);
|
||||
|
||||
err = usb2_com_cfg_do_request(sc->sc_udev, ucom,
|
||||
err = ucom_cfg_do_request(sc->sc_udev, ucom,
|
||||
&req, NULL, 0, 1000);
|
||||
if (err) {
|
||||
DPRINTFN(0, "send break failed, error=%s\n",
|
||||
usb2_errstr(err));
|
||||
usbd_errstr(err));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -489,7 +489,7 @@ ubser_start_read(struct ucom_softc *ucom)
|
||||
{
|
||||
struct ubser_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[UBSER_BULK_DT_RD]);
|
||||
usbd_transfer_start(sc->sc_xfer[UBSER_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -497,7 +497,7 @@ ubser_stop_read(struct ucom_softc *ucom)
|
||||
{
|
||||
struct ubser_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[UBSER_BULK_DT_RD]);
|
||||
usbd_transfer_stop(sc->sc_xfer[UBSER_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -505,7 +505,7 @@ ubser_start_write(struct ucom_softc *ucom)
|
||||
{
|
||||
struct ubser_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[UBSER_BULK_DT_WR]);
|
||||
usbd_transfer_start(sc->sc_xfer[UBSER_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -513,5 +513,5 @@ ubser_stop_write(struct ucom_softc *ucom)
|
||||
{
|
||||
struct ubser_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[UBSER_BULK_DT_WR]);
|
||||
usbd_transfer_stop(sc->sc_xfer[UBSER_BULK_DT_WR]);
|
||||
}
|
||||
|
@ -258,16 +258,16 @@ static const struct usb_config uchcom_config_data[UCHCOM_N_TRANSFER] = {
|
||||
};
|
||||
|
||||
static struct ucom_callback uchcom_callback = {
|
||||
.usb2_com_cfg_get_status = &uchcom_cfg_get_status,
|
||||
.usb2_com_cfg_set_dtr = &uchcom_cfg_set_dtr,
|
||||
.usb2_com_cfg_set_rts = &uchcom_cfg_set_rts,
|
||||
.usb2_com_cfg_set_break = &uchcom_cfg_set_break,
|
||||
.usb2_com_cfg_param = &uchcom_cfg_param,
|
||||
.usb2_com_pre_param = &uchcom_pre_param,
|
||||
.usb2_com_start_read = &uchcom_start_read,
|
||||
.usb2_com_stop_read = &uchcom_stop_read,
|
||||
.usb2_com_start_write = &uchcom_start_write,
|
||||
.usb2_com_stop_write = &uchcom_stop_write,
|
||||
.ucom_cfg_get_status = &uchcom_cfg_get_status,
|
||||
.ucom_cfg_set_dtr = &uchcom_cfg_set_dtr,
|
||||
.ucom_cfg_set_rts = &uchcom_cfg_set_rts,
|
||||
.ucom_cfg_set_break = &uchcom_cfg_set_break,
|
||||
.ucom_cfg_param = &uchcom_cfg_param,
|
||||
.ucom_pre_param = &uchcom_pre_param,
|
||||
.ucom_start_read = &uchcom_start_read,
|
||||
.ucom_stop_read = &uchcom_stop_read,
|
||||
.ucom_start_write = &uchcom_start_write,
|
||||
.ucom_stop_write = &uchcom_stop_write,
|
||||
};
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
@ -290,7 +290,7 @@ uchcom_probe(device_t dev)
|
||||
if (uaa->info.bIfaceIndex != UCHCOM_IFACE_INDEX) {
|
||||
return (ENXIO);
|
||||
}
|
||||
return (usb2_lookup_id_by_uaa(uchcom_devs, sizeof(uchcom_devs), uaa));
|
||||
return (usbd_lookup_id_by_uaa(uchcom_devs, sizeof(uchcom_devs), uaa));
|
||||
}
|
||||
|
||||
static int
|
||||
@ -303,7 +303,7 @@ uchcom_attach(device_t dev)
|
||||
|
||||
DPRINTFN(11, "\n");
|
||||
|
||||
device_set_usb2_desc(dev);
|
||||
device_set_usb_desc(dev);
|
||||
mtx_init(&sc->sc_mtx, "uchcom", NULL, MTX_DEF);
|
||||
|
||||
sc->sc_udev = uaa->device;
|
||||
@ -318,13 +318,13 @@ uchcom_attach(device_t dev)
|
||||
}
|
||||
|
||||
iface_index = UCHCOM_IFACE_INDEX;
|
||||
error = usb2_transfer_setup(uaa->device,
|
||||
error = usbd_transfer_setup(uaa->device,
|
||||
&iface_index, sc->sc_xfer, uchcom_config_data,
|
||||
UCHCOM_N_TRANSFER, sc, &sc->sc_mtx);
|
||||
|
||||
if (error) {
|
||||
DPRINTF("one or more missing USB endpoints, "
|
||||
"error=%s\n", usb2_errstr(error));
|
||||
"error=%s\n", usbd_errstr(error));
|
||||
goto detach;
|
||||
}
|
||||
/*
|
||||
@ -341,11 +341,11 @@ uchcom_attach(device_t dev)
|
||||
|
||||
/* clear stall at first run */
|
||||
mtx_lock(&sc->sc_mtx);
|
||||
usb2_transfer_set_stall(sc->sc_xfer[UCHCOM_BULK_DT_WR]);
|
||||
usb2_transfer_set_stall(sc->sc_xfer[UCHCOM_BULK_DT_RD]);
|
||||
usbd_transfer_set_stall(sc->sc_xfer[UCHCOM_BULK_DT_WR]);
|
||||
usbd_transfer_set_stall(sc->sc_xfer[UCHCOM_BULK_DT_RD]);
|
||||
mtx_unlock(&sc->sc_mtx);
|
||||
|
||||
error = usb2_com_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc,
|
||||
error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc,
|
||||
&uchcom_callback, &sc->sc_mtx);
|
||||
if (error) {
|
||||
goto detach;
|
||||
@ -364,8 +364,8 @@ uchcom_detach(device_t dev)
|
||||
|
||||
DPRINTFN(11, "\n");
|
||||
|
||||
usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
|
||||
usb2_transfer_unsetup(sc->sc_xfer, UCHCOM_N_TRANSFER);
|
||||
ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
|
||||
usbd_transfer_unsetup(sc->sc_xfer, UCHCOM_N_TRANSFER);
|
||||
mtx_destroy(&sc->sc_mtx);
|
||||
|
||||
return (0);
|
||||
@ -387,7 +387,7 @@ uchcom_ctrl_write(struct uchcom_softc *sc, uint8_t reqno,
|
||||
USETW(req.wIndex, index);
|
||||
USETW(req.wLength, 0);
|
||||
|
||||
usb2_com_cfg_do_request(sc->sc_udev,
|
||||
ucom_cfg_do_request(sc->sc_udev,
|
||||
&sc->sc_ucom, &req, NULL, 0, 1000);
|
||||
}
|
||||
|
||||
@ -403,7 +403,7 @@ uchcom_ctrl_read(struct uchcom_softc *sc, uint8_t reqno,
|
||||
USETW(req.wIndex, index);
|
||||
USETW(req.wLength, buflen);
|
||||
|
||||
usb2_com_cfg_do_request(sc->sc_udev,
|
||||
ucom_cfg_do_request(sc->sc_udev,
|
||||
&sc->sc_ucom, &req, buf, USB_SHORT_XFER_OK, 1000);
|
||||
}
|
||||
|
||||
@ -734,10 +734,10 @@ uchcom_start_read(struct ucom_softc *ucom)
|
||||
struct uchcom_softc *sc = ucom->sc_parent;
|
||||
|
||||
/* start interrupt endpoint */
|
||||
usb2_transfer_start(sc->sc_xfer[UCHCOM_INTR_DT_RD]);
|
||||
usbd_transfer_start(sc->sc_xfer[UCHCOM_INTR_DT_RD]);
|
||||
|
||||
/* start read endpoint */
|
||||
usb2_transfer_start(sc->sc_xfer[UCHCOM_BULK_DT_RD]);
|
||||
usbd_transfer_start(sc->sc_xfer[UCHCOM_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -746,10 +746,10 @@ uchcom_stop_read(struct ucom_softc *ucom)
|
||||
struct uchcom_softc *sc = ucom->sc_parent;
|
||||
|
||||
/* stop interrupt endpoint */
|
||||
usb2_transfer_stop(sc->sc_xfer[UCHCOM_INTR_DT_RD]);
|
||||
usbd_transfer_stop(sc->sc_xfer[UCHCOM_INTR_DT_RD]);
|
||||
|
||||
/* stop read endpoint */
|
||||
usb2_transfer_stop(sc->sc_xfer[UCHCOM_BULK_DT_RD]);
|
||||
usbd_transfer_stop(sc->sc_xfer[UCHCOM_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -757,7 +757,7 @@ uchcom_start_write(struct ucom_softc *ucom)
|
||||
{
|
||||
struct uchcom_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[UCHCOM_BULK_DT_WR]);
|
||||
usbd_transfer_start(sc->sc_xfer[UCHCOM_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -765,7 +765,7 @@ uchcom_stop_write(struct ucom_softc *ucom)
|
||||
{
|
||||
struct uchcom_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[UCHCOM_BULK_DT_WR]);
|
||||
usbd_transfer_stop(sc->sc_xfer[UCHCOM_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
@ -783,7 +783,7 @@ uchcom_intr_callback(struct usb_xfer *xfer)
|
||||
DPRINTF("actlen = %u\n", xfer->actlen);
|
||||
|
||||
if (xfer->actlen >= UCHCOM_INTR_LEAST) {
|
||||
usb2_copy_out(xfer->frbuffers, 0, buf,
|
||||
usbd_copy_out(xfer->frbuffers, 0, buf,
|
||||
UCHCOM_INTR_LEAST);
|
||||
|
||||
DPRINTF("data = 0x%02X 0x%02X 0x%02X 0x%02X\n",
|
||||
@ -791,12 +791,12 @@ uchcom_intr_callback(struct usb_xfer *xfer)
|
||||
(unsigned)buf[2], (unsigned)buf[3]);
|
||||
|
||||
uchcom_convert_status(sc, buf[UCHCOM_INTR_STAT1]);
|
||||
usb2_com_status_change(&sc->sc_ucom);
|
||||
ucom_status_change(&sc->sc_ucom);
|
||||
}
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
break;
|
||||
|
||||
default: /* Error */
|
||||
@ -819,13 +819,13 @@ uchcom_write_callback(struct usb_xfer *xfer)
|
||||
case USB_ST_SETUP:
|
||||
case USB_ST_TRANSFERRED:
|
||||
tr_setup:
|
||||
if (usb2_com_get_data(&sc->sc_ucom, xfer->frbuffers, 0,
|
||||
if (ucom_get_data(&sc->sc_ucom, xfer->frbuffers, 0,
|
||||
UCHCOM_BULK_BUF_SIZE, &actlen)) {
|
||||
|
||||
DPRINTF("actlen = %d\n", actlen);
|
||||
|
||||
xfer->frlengths[0] = actlen;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -847,12 +847,12 @@ uchcom_read_callback(struct usb_xfer *xfer)
|
||||
|
||||
switch (USB_GET_STATE(xfer)) {
|
||||
case USB_ST_TRANSFERRED:
|
||||
usb2_com_put_data(&sc->sc_ucom, xfer->frbuffers, 0, xfer->actlen);
|
||||
ucom_put_data(&sc->sc_ucom, xfer->frbuffers, 0, xfer->actlen);
|
||||
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
|
@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <dev/usb/usb_ioctl.h>
|
||||
#include <dev/usb/usbhid.h>
|
||||
|
||||
#define USB_DEBUG_VAR usb2_debug
|
||||
#define USB_DEBUG_VAR usb_debug
|
||||
|
||||
#include <dev/usb/usb_core.h>
|
||||
#include <dev/usb/usb_debug.h>
|
||||
@ -136,13 +136,13 @@ static const struct usb_config ucycom_config[UCYCOM_N_TRANSFER] = {
|
||||
};
|
||||
|
||||
static const struct ucom_callback ucycom_callback = {
|
||||
.usb2_com_cfg_param = &ucycom_cfg_param,
|
||||
.usb2_com_cfg_open = &ucycom_cfg_open,
|
||||
.usb2_com_pre_param = &ucycom_pre_param,
|
||||
.usb2_com_start_read = &ucycom_start_read,
|
||||
.usb2_com_stop_read = &ucycom_stop_read,
|
||||
.usb2_com_start_write = &ucycom_start_write,
|
||||
.usb2_com_stop_write = &ucycom_stop_write,
|
||||
.ucom_cfg_param = &ucycom_cfg_param,
|
||||
.ucom_cfg_open = &ucycom_cfg_open,
|
||||
.ucom_pre_param = &ucycom_pre_param,
|
||||
.ucom_start_read = &ucycom_start_read,
|
||||
.ucom_stop_read = &ucycom_stop_read,
|
||||
.ucom_start_write = &ucycom_start_write,
|
||||
.ucom_stop_write = &ucycom_stop_write,
|
||||
};
|
||||
|
||||
static device_method_t ucycom_methods[] = {
|
||||
@ -188,7 +188,7 @@ ucycom_probe(device_t dev)
|
||||
if (uaa->info.bIfaceIndex != UCYCOM_IFACE_INDEX) {
|
||||
return (ENXIO);
|
||||
}
|
||||
return (usb2_lookup_id_by_uaa(ucycom_devs, sizeof(ucycom_devs), uaa));
|
||||
return (usbd_lookup_id_by_uaa(ucycom_devs, sizeof(ucycom_devs), uaa));
|
||||
}
|
||||
|
||||
static int
|
||||
@ -203,7 +203,7 @@ ucycom_attach(device_t dev)
|
||||
|
||||
sc->sc_udev = uaa->device;
|
||||
|
||||
device_set_usb2_desc(dev);
|
||||
device_set_usb_desc(dev);
|
||||
mtx_init(&sc->sc_mtx, "ucycom", NULL, MTX_DEF);
|
||||
|
||||
snprintf(sc->sc_name, sizeof(sc->sc_name),
|
||||
@ -221,14 +221,14 @@ ucycom_attach(device_t dev)
|
||||
|
||||
/* get report descriptor */
|
||||
|
||||
error = usb2_req_get_hid_desc(uaa->device, NULL,
|
||||
error = usbd_req_get_hid_desc(uaa->device, NULL,
|
||||
&urd_ptr, &urd_len, M_USBDEV,
|
||||
UCYCOM_IFACE_INDEX);
|
||||
|
||||
if (error) {
|
||||
device_printf(dev, "failed to get report "
|
||||
"descriptor: %s\n",
|
||||
usb2_errstr(error));
|
||||
usbd_errstr(error));
|
||||
goto detach;
|
||||
}
|
||||
/* get report sizes */
|
||||
@ -248,7 +248,7 @@ ucycom_attach(device_t dev)
|
||||
sc->sc_iface_no = uaa->info.bIfaceNum;
|
||||
|
||||
iface_index = UCYCOM_IFACE_INDEX;
|
||||
error = usb2_transfer_setup(uaa->device, &iface_index,
|
||||
error = usbd_transfer_setup(uaa->device, &iface_index,
|
||||
sc->sc_xfer, ucycom_config, UCYCOM_N_TRANSFER,
|
||||
sc, &sc->sc_mtx);
|
||||
if (error) {
|
||||
@ -256,7 +256,7 @@ ucycom_attach(device_t dev)
|
||||
"transfers failed!\n");
|
||||
goto detach;
|
||||
}
|
||||
error = usb2_com_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc,
|
||||
error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc,
|
||||
&ucycom_callback, &sc->sc_mtx);
|
||||
|
||||
if (error) {
|
||||
@ -280,8 +280,8 @@ ucycom_detach(device_t dev)
|
||||
{
|
||||
struct ucycom_softc *sc = device_get_softc(dev);
|
||||
|
||||
usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
|
||||
usb2_transfer_unsetup(sc->sc_xfer, UCYCOM_N_TRANSFER);
|
||||
ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
|
||||
usbd_transfer_unsetup(sc->sc_xfer, UCYCOM_N_TRANSFER);
|
||||
mtx_destroy(&sc->sc_mtx);
|
||||
|
||||
return (0);
|
||||
@ -301,7 +301,7 @@ ucycom_start_read(struct ucom_softc *ucom)
|
||||
{
|
||||
struct ucycom_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[UCYCOM_INTR_RD]);
|
||||
usbd_transfer_start(sc->sc_xfer[UCYCOM_INTR_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -309,7 +309,7 @@ ucycom_stop_read(struct ucom_softc *ucom)
|
||||
{
|
||||
struct ucycom_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[UCYCOM_INTR_RD]);
|
||||
usbd_transfer_stop(sc->sc_xfer[UCYCOM_INTR_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -317,7 +317,7 @@ ucycom_start_write(struct ucom_softc *ucom)
|
||||
{
|
||||
struct ucycom_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[UCYCOM_CTRL_RD]);
|
||||
usbd_transfer_start(sc->sc_xfer[UCYCOM_CTRL_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -325,7 +325,7 @@ ucycom_stop_write(struct ucom_softc *ucom)
|
||||
{
|
||||
struct ucycom_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[UCYCOM_CTRL_RD]);
|
||||
usbd_transfer_stop(sc->sc_xfer[UCYCOM_CTRL_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -354,7 +354,7 @@ ucycom_ctrl_write_callback(struct usb_xfer *xfer)
|
||||
break;
|
||||
}
|
||||
|
||||
if (usb2_com_get_data(&sc->sc_ucom, xfer->frbuffers + 1, offset,
|
||||
if (ucom_get_data(&sc->sc_ucom, xfer->frbuffers + 1, offset,
|
||||
sc->sc_olen - offset, &actlen)) {
|
||||
|
||||
req.bmRequestType = UT_WRITE_CLASS_INTERFACE;
|
||||
@ -376,13 +376,13 @@ ucycom_ctrl_write_callback(struct usb_xfer *xfer)
|
||||
break;
|
||||
}
|
||||
|
||||
usb2_copy_in(xfer->frbuffers, 0, &req, sizeof(req));
|
||||
usb2_copy_in(xfer->frbuffers + 1, 0, data, offset);
|
||||
usbd_copy_in(xfer->frbuffers, 0, &req, sizeof(req));
|
||||
usbd_copy_in(xfer->frbuffers + 1, 0, data, offset);
|
||||
|
||||
xfer->frlengths[0] = sizeof(req);
|
||||
xfer->frlengths[1] = sc->sc_olen;
|
||||
xfer->nframes = xfer->frlengths[1] ? 2 : 1;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -391,7 +391,7 @@ ucycom_ctrl_write_callback(struct usb_xfer *xfer)
|
||||
return;
|
||||
}
|
||||
DPRINTF("error=%s\n",
|
||||
usb2_errstr(xfer->error));
|
||||
usbd_errstr(xfer->error));
|
||||
goto tr_transferred;
|
||||
}
|
||||
}
|
||||
@ -422,11 +422,11 @@ ucycom_cfg_write(struct ucycom_softc *sc, uint32_t baud, uint8_t cfg)
|
||||
sc->sc_temp_cfg[3] = (baud >> 24) & 0xff;
|
||||
sc->sc_temp_cfg[4] = cfg;
|
||||
|
||||
err = usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
err = ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
&req, sc->sc_temp_cfg, 0, 1000);
|
||||
if (err) {
|
||||
DPRINTFN(0, "device request failed, err=%s "
|
||||
"(ignored)\n", usb2_errstr(err));
|
||||
"(ignored)\n", usbd_errstr(err));
|
||||
}
|
||||
}
|
||||
|
||||
@ -508,7 +508,7 @@ ucycom_intr_read_callback(struct usb_xfer *xfer)
|
||||
if (xfer->actlen < 1) {
|
||||
goto tr_setup;
|
||||
}
|
||||
usb2_copy_out(xfer->frbuffers, 0, buf, 1);
|
||||
usbd_copy_out(xfer->frbuffers, 0, buf, 1);
|
||||
|
||||
sc->sc_ist = buf[0] & ~0x07;
|
||||
len = buf[0] & 0x07;
|
||||
@ -523,7 +523,7 @@ ucycom_intr_read_callback(struct usb_xfer *xfer)
|
||||
if (xfer->actlen < 2) {
|
||||
goto tr_setup;
|
||||
}
|
||||
usb2_copy_out(xfer->frbuffers, 0, buf, 2);
|
||||
usbd_copy_out(xfer->frbuffers, 0, buf, 2);
|
||||
|
||||
sc->sc_ist = buf[0] & ~0x07;
|
||||
len = buf[1];
|
||||
@ -543,13 +543,13 @@ ucycom_intr_read_callback(struct usb_xfer *xfer)
|
||||
len = xfer->actlen;
|
||||
}
|
||||
if (len) {
|
||||
usb2_com_put_data(&sc->sc_ucom, xfer->frbuffers,
|
||||
ucom_put_data(&sc->sc_ucom, xfer->frbuffers,
|
||||
offset, len);
|
||||
}
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
xfer->frlengths[0] = sc->sc_ilen;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
|
@ -88,7 +88,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <dev/usb/usb_error.h>
|
||||
#include <dev/usb/usb_cdc.h>
|
||||
|
||||
#define USB_DEBUG_VAR usb2_debug
|
||||
#define USB_DEBUG_VAR usb_debug
|
||||
|
||||
#include <dev/usb/usb_core.h>
|
||||
#include <dev/usb/usb_debug.h>
|
||||
@ -109,7 +109,7 @@ typedef struct ufoma_mobile_acm_descriptor {
|
||||
uint8_t bDescriptorSubtype;
|
||||
uint8_t bType;
|
||||
uint8_t bMode[1];
|
||||
} __packed usb2_mcpc_acm_descriptor;
|
||||
} __packed usb_mcpc_acm_descriptor;
|
||||
|
||||
#define UISUBCLASS_MCPC 0x88
|
||||
|
||||
@ -280,18 +280,18 @@ static const struct usb_config
|
||||
};
|
||||
|
||||
static const struct ucom_callback ufoma_callback = {
|
||||
.usb2_com_cfg_get_status = &ufoma_cfg_get_status,
|
||||
.usb2_com_cfg_set_dtr = &ufoma_cfg_set_dtr,
|
||||
.usb2_com_cfg_set_rts = &ufoma_cfg_set_rts,
|
||||
.usb2_com_cfg_set_break = &ufoma_cfg_set_break,
|
||||
.usb2_com_cfg_param = &ufoma_cfg_param,
|
||||
.usb2_com_cfg_open = &ufoma_cfg_open,
|
||||
.usb2_com_cfg_close = &ufoma_cfg_close,
|
||||
.usb2_com_pre_param = &ufoma_pre_param,
|
||||
.usb2_com_start_read = &ufoma_start_read,
|
||||
.usb2_com_stop_read = &ufoma_stop_read,
|
||||
.usb2_com_start_write = &ufoma_start_write,
|
||||
.usb2_com_stop_write = &ufoma_stop_write,
|
||||
.ucom_cfg_get_status = &ufoma_cfg_get_status,
|
||||
.ucom_cfg_set_dtr = &ufoma_cfg_set_dtr,
|
||||
.ucom_cfg_set_rts = &ufoma_cfg_set_rts,
|
||||
.ucom_cfg_set_break = &ufoma_cfg_set_break,
|
||||
.ucom_cfg_param = &ufoma_cfg_param,
|
||||
.ucom_cfg_open = &ufoma_cfg_open,
|
||||
.ucom_cfg_close = &ufoma_cfg_close,
|
||||
.ucom_pre_param = &ufoma_pre_param,
|
||||
.ucom_start_read = &ufoma_start_read,
|
||||
.ucom_stop_read = &ufoma_stop_read,
|
||||
.ucom_start_write = &ufoma_start_write,
|
||||
.ucom_stop_write = &ufoma_stop_write,
|
||||
};
|
||||
|
||||
static device_method_t ufoma_methods[] = {
|
||||
@ -320,13 +320,13 @@ ufoma_probe(device_t dev)
|
||||
struct usb_attach_arg *uaa = device_get_ivars(dev);
|
||||
struct usb_interface_descriptor *id;
|
||||
struct usb_config_descriptor *cd;
|
||||
usb2_mcpc_acm_descriptor *mad;
|
||||
usb_mcpc_acm_descriptor *mad;
|
||||
|
||||
if (uaa->usb_mode != USB_MODE_HOST) {
|
||||
return (ENXIO);
|
||||
}
|
||||
id = usb2_get_interface_descriptor(uaa->iface);
|
||||
cd = usb2_get_config_descriptor(uaa->device);
|
||||
id = usbd_get_interface_descriptor(uaa->iface);
|
||||
cd = usbd_get_config_descriptor(uaa->device);
|
||||
|
||||
if ((id == NULL) ||
|
||||
(cd == NULL) ||
|
||||
@ -357,7 +357,7 @@ ufoma_attach(device_t dev)
|
||||
struct sysctl_ctx_list *sctx;
|
||||
struct sysctl_oid *soid;
|
||||
|
||||
usb2_mcpc_acm_descriptor *mad;
|
||||
usb_mcpc_acm_descriptor *mad;
|
||||
uint8_t elements;
|
||||
int32_t error;
|
||||
|
||||
@ -368,7 +368,7 @@ ufoma_attach(device_t dev)
|
||||
mtx_init(&sc->sc_mtx, "ufoma", NULL, MTX_DEF);
|
||||
cv_init(&sc->sc_cv, "CWAIT");
|
||||
|
||||
device_set_usb2_desc(dev);
|
||||
device_set_usb_desc(dev);
|
||||
|
||||
snprintf(sc->sc_name, sizeof(sc->sc_name),
|
||||
"%s", device_get_nameunit(dev));
|
||||
@ -377,12 +377,12 @@ ufoma_attach(device_t dev)
|
||||
|
||||
/* setup control transfers */
|
||||
|
||||
cd = usb2_get_config_descriptor(uaa->device);
|
||||
id = usb2_get_interface_descriptor(uaa->iface);
|
||||
cd = usbd_get_config_descriptor(uaa->device);
|
||||
id = usbd_get_interface_descriptor(uaa->iface);
|
||||
sc->sc_ctrl_iface_no = id->bInterfaceNumber;
|
||||
sc->sc_ctrl_iface_index = uaa->info.bIfaceIndex;
|
||||
|
||||
error = usb2_transfer_setup(uaa->device,
|
||||
error = usbd_transfer_setup(uaa->device,
|
||||
&sc->sc_ctrl_iface_index, sc->sc_ctrl_xfer,
|
||||
ufoma_ctrl_config, UFOMA_CTRL_ENDPT_MAX, sc, &sc->sc_mtx);
|
||||
|
||||
@ -426,14 +426,14 @@ ufoma_attach(device_t dev)
|
||||
|
||||
/* clear stall at first run, if any */
|
||||
mtx_lock(&sc->sc_mtx);
|
||||
usb2_transfer_set_stall(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_WRITE]);
|
||||
usb2_transfer_set_stall(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_READ]);
|
||||
usbd_transfer_set_stall(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_WRITE]);
|
||||
usbd_transfer_set_stall(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_READ]);
|
||||
mtx_unlock(&sc->sc_mtx);
|
||||
|
||||
error = usb2_com_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc,
|
||||
error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc,
|
||||
&ufoma_callback, &sc->sc_mtx);
|
||||
if (error) {
|
||||
DPRINTF("usb2_com_attach failed\n");
|
||||
DPRINTF("ucom_attach failed\n");
|
||||
goto detach;
|
||||
}
|
||||
/*Sysctls*/
|
||||
@ -467,9 +467,9 @@ ufoma_detach(device_t dev)
|
||||
{
|
||||
struct ufoma_softc *sc = device_get_softc(dev);
|
||||
|
||||
usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
|
||||
usb2_transfer_unsetup(sc->sc_ctrl_xfer, UFOMA_CTRL_ENDPT_MAX);
|
||||
usb2_transfer_unsetup(sc->sc_bulk_xfer, UFOMA_BULK_ENDPT_MAX);
|
||||
ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
|
||||
usbd_transfer_unsetup(sc->sc_ctrl_xfer, UFOMA_CTRL_ENDPT_MAX);
|
||||
usbd_transfer_unsetup(sc->sc_bulk_xfer, UFOMA_BULK_ENDPT_MAX);
|
||||
|
||||
if (sc->sc_modetable) {
|
||||
free(sc->sc_modetable, M_USBDEV);
|
||||
@ -486,7 +486,7 @@ ufoma_get_intconf(struct usb_config_descriptor *cd, struct usb_interface_descrip
|
||||
{
|
||||
struct usb_descriptor *desc = (void *)id;
|
||||
|
||||
while ((desc = usb2_desc_foreach(cd, desc))) {
|
||||
while ((desc = usb_desc_foreach(cd, desc))) {
|
||||
|
||||
if (desc->bDescriptorType == UDESC_INTERFACE) {
|
||||
return (NULL);
|
||||
@ -511,7 +511,7 @@ ufoma_cfg_link_state(struct ufoma_softc *sc)
|
||||
USETW(req.wIndex, sc->sc_ctrl_iface_no);
|
||||
USETW(req.wLength, sc->sc_modetable[0]);
|
||||
|
||||
usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
&req, sc->sc_modetable, 0, 1000);
|
||||
|
||||
error = cv_timedwait(&sc->sc_cv, &sc->sc_mtx, hz);
|
||||
@ -533,7 +533,7 @@ ufoma_cfg_activate_state(struct ufoma_softc *sc, uint16_t state)
|
||||
USETW(req.wIndex, sc->sc_ctrl_iface_no);
|
||||
USETW(req.wLength, 0);
|
||||
|
||||
usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
&req, NULL, 0, 1000);
|
||||
|
||||
error = cv_timedwait(&sc->sc_cv, &sc->sc_mtx,
|
||||
@ -556,7 +556,7 @@ ufoma_ctrl_read_callback(struct usb_xfer *xfer)
|
||||
goto tr_setup;
|
||||
}
|
||||
if (xfer->frlengths[1] > 0) {
|
||||
usb2_com_put_data(&sc->sc_ucom, xfer->frbuffers + 1,
|
||||
ucom_put_data(&sc->sc_ucom, xfer->frbuffers + 1,
|
||||
0, xfer->frlengths[1]);
|
||||
}
|
||||
case USB_ST_SETUP:
|
||||
@ -570,18 +570,18 @@ ufoma_ctrl_read_callback(struct usb_xfer *xfer)
|
||||
USETW(req.wValue, 0);
|
||||
USETW(req.wLength, UFOMA_CMD_BUF_SIZE);
|
||||
|
||||
usb2_copy_in(xfer->frbuffers, 0, &req, sizeof(req));
|
||||
usbd_copy_in(xfer->frbuffers, 0, &req, sizeof(req));
|
||||
|
||||
xfer->frlengths[0] = sizeof(req);
|
||||
xfer->frlengths[1] = UFOMA_CMD_BUF_SIZE;
|
||||
xfer->nframes = 2;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
}
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
DPRINTF("error = %s\n",
|
||||
usb2_errstr(xfer->error));
|
||||
usbd_errstr(xfer->error));
|
||||
|
||||
if (xfer->error == USB_ERR_CANCELLED) {
|
||||
return;
|
||||
@ -605,7 +605,7 @@ ufoma_ctrl_write_callback(struct usb_xfer *xfer)
|
||||
tr_transferred:
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
if (usb2_com_get_data(&sc->sc_ucom, xfer->frbuffers + 1,
|
||||
if (ucom_get_data(&sc->sc_ucom, xfer->frbuffers + 1,
|
||||
0, 1, &actlen)) {
|
||||
|
||||
req.bmRequestType = UT_WRITE_CLASS_INTERFACE;
|
||||
@ -614,19 +614,19 @@ ufoma_ctrl_write_callback(struct usb_xfer *xfer)
|
||||
USETW(req.wValue, 0);
|
||||
USETW(req.wLength, 1);
|
||||
|
||||
usb2_copy_in(xfer->frbuffers, 0, &req, sizeof(req));
|
||||
usbd_copy_in(xfer->frbuffers, 0, &req, sizeof(req));
|
||||
|
||||
xfer->frlengths[0] = sizeof(req);
|
||||
xfer->frlengths[1] = 1;
|
||||
xfer->nframes = 2;
|
||||
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
}
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
DPRINTF("error = %s\n",
|
||||
usb2_errstr(xfer->error));
|
||||
usbd_errstr(xfer->error));
|
||||
|
||||
if (xfer->error == USB_ERR_CANCELLED) {
|
||||
return;
|
||||
@ -657,7 +657,7 @@ ufoma_intr_callback(struct usb_xfer *xfer)
|
||||
DPRINTF("truncating message\n");
|
||||
xfer->actlen = sizeof(pkt);
|
||||
}
|
||||
usb2_copy_out(xfer->frbuffers, 0, &pkt, xfer->actlen);
|
||||
usbd_copy_out(xfer->frbuffers, 0, &pkt, xfer->actlen);
|
||||
|
||||
xfer->actlen -= 8;
|
||||
|
||||
@ -686,7 +686,7 @@ ufoma_intr_callback(struct usb_xfer *xfer)
|
||||
if (sc->sc_num_msg != 0xFF) {
|
||||
sc->sc_num_msg++;
|
||||
}
|
||||
usb2_transfer_start(sc->sc_ctrl_xfer[UFOMA_CTRL_ENDPT_READ]);
|
||||
usbd_transfer_start(sc->sc_ctrl_xfer[UFOMA_CTRL_ENDPT_READ]);
|
||||
break;
|
||||
|
||||
case UCDC_N_SERIAL_STATE:
|
||||
@ -721,7 +721,7 @@ ufoma_intr_callback(struct usb_xfer *xfer)
|
||||
if (mstatus & UCDC_N_SERIAL_DCD) {
|
||||
sc->sc_msr |= SER_DCD;
|
||||
}
|
||||
usb2_com_status_change(&sc->sc_ucom);
|
||||
ucom_status_change(&sc->sc_ucom);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -731,7 +731,7 @@ ufoma_intr_callback(struct usb_xfer *xfer)
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
@ -754,10 +754,10 @@ ufoma_bulk_write_callback(struct usb_xfer *xfer)
|
||||
case USB_ST_SETUP:
|
||||
case USB_ST_TRANSFERRED:
|
||||
tr_setup:
|
||||
if (usb2_com_get_data(&sc->sc_ucom, xfer->frbuffers, 0,
|
||||
if (ucom_get_data(&sc->sc_ucom, xfer->frbuffers, 0,
|
||||
UFOMA_BULK_BUF_SIZE, &actlen)) {
|
||||
xfer->frlengths[0] = actlen;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -778,13 +778,13 @@ ufoma_bulk_read_callback(struct usb_xfer *xfer)
|
||||
|
||||
switch (USB_GET_STATE(xfer)) {
|
||||
case USB_ST_TRANSFERRED:
|
||||
usb2_com_put_data(&sc->sc_ucom, xfer->frbuffers, 0,
|
||||
ucom_put_data(&sc->sc_ucom, xfer->frbuffers, 0,
|
||||
xfer->actlen);
|
||||
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
@ -846,7 +846,7 @@ ufoma_cfg_set_break(struct ucom_softc *ucom, uint8_t onoff)
|
||||
req.wIndex[1] = 0;
|
||||
USETW(req.wLength, 0);
|
||||
|
||||
usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
&req, NULL, 0, 1000);
|
||||
}
|
||||
|
||||
@ -875,7 +875,7 @@ ufoma_cfg_set_line_state(struct ufoma_softc *sc)
|
||||
req.wIndex[1] = 0;
|
||||
USETW(req.wLength, 0);
|
||||
|
||||
usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
&req, NULL, 0, 1000);
|
||||
}
|
||||
|
||||
@ -972,7 +972,7 @@ ufoma_cfg_param(struct ucom_softc *ucom, struct termios *t)
|
||||
req.wIndex[1] = 0;
|
||||
USETW(req.wLength, UCDC_LINE_STATE_LENGTH);
|
||||
|
||||
usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
&req, &ls, 0, 1000);
|
||||
}
|
||||
|
||||
@ -988,8 +988,8 @@ ufoma_modem_setup(device_t dev, struct ufoma_softc *sc,
|
||||
uint8_t i;
|
||||
int32_t error;
|
||||
|
||||
cd = usb2_get_config_descriptor(uaa->device);
|
||||
id = usb2_get_interface_descriptor(uaa->iface);
|
||||
cd = usbd_get_config_descriptor(uaa->device);
|
||||
id = usbd_get_interface_descriptor(uaa->iface);
|
||||
|
||||
cmd = ufoma_get_intconf(cd, id, UDESC_CS_INTERFACE, UDESCSUB_CDC_CM);
|
||||
|
||||
@ -1018,15 +1018,15 @@ ufoma_modem_setup(device_t dev, struct ufoma_softc *sc,
|
||||
|
||||
for (i = 0;; i++) {
|
||||
|
||||
iface = usb2_get_iface(uaa->device, i);
|
||||
iface = usbd_get_iface(uaa->device, i);
|
||||
|
||||
if (iface) {
|
||||
|
||||
id = usb2_get_interface_descriptor(iface);
|
||||
id = usbd_get_interface_descriptor(iface);
|
||||
|
||||
if (id && (id->bInterfaceNumber == sc->sc_data_iface_no)) {
|
||||
sc->sc_data_iface_index = i;
|
||||
usb2_set_parent_iface(uaa->device, i, uaa->info.bIfaceIndex);
|
||||
usbd_set_parent_iface(uaa->device, i, uaa->info.bIfaceIndex);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
@ -1035,7 +1035,7 @@ ufoma_modem_setup(device_t dev, struct ufoma_softc *sc,
|
||||
}
|
||||
}
|
||||
|
||||
error = usb2_transfer_setup(uaa->device,
|
||||
error = usbd_transfer_setup(uaa->device,
|
||||
&sc->sc_data_iface_index, sc->sc_bulk_xfer,
|
||||
ufoma_bulk_config, UFOMA_BULK_ENDPT_MAX, sc, &sc->sc_mtx);
|
||||
|
||||
@ -1053,13 +1053,13 @@ ufoma_start_read(struct ucom_softc *ucom)
|
||||
struct ufoma_softc *sc = ucom->sc_parent;
|
||||
|
||||
/* start interrupt transfer */
|
||||
usb2_transfer_start(sc->sc_ctrl_xfer[UFOMA_CTRL_ENDPT_INTR]);
|
||||
usbd_transfer_start(sc->sc_ctrl_xfer[UFOMA_CTRL_ENDPT_INTR]);
|
||||
|
||||
/* start data transfer */
|
||||
if (sc->sc_nobulk) {
|
||||
usb2_transfer_start(sc->sc_ctrl_xfer[UFOMA_CTRL_ENDPT_READ]);
|
||||
usbd_transfer_start(sc->sc_ctrl_xfer[UFOMA_CTRL_ENDPT_READ]);
|
||||
} else {
|
||||
usb2_transfer_start(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_READ]);
|
||||
usbd_transfer_start(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_READ]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1069,13 +1069,13 @@ ufoma_stop_read(struct ucom_softc *ucom)
|
||||
struct ufoma_softc *sc = ucom->sc_parent;
|
||||
|
||||
/* stop interrupt transfer */
|
||||
usb2_transfer_stop(sc->sc_ctrl_xfer[UFOMA_CTRL_ENDPT_INTR]);
|
||||
usbd_transfer_stop(sc->sc_ctrl_xfer[UFOMA_CTRL_ENDPT_INTR]);
|
||||
|
||||
/* stop data transfer */
|
||||
if (sc->sc_nobulk) {
|
||||
usb2_transfer_stop(sc->sc_ctrl_xfer[UFOMA_CTRL_ENDPT_READ]);
|
||||
usbd_transfer_stop(sc->sc_ctrl_xfer[UFOMA_CTRL_ENDPT_READ]);
|
||||
} else {
|
||||
usb2_transfer_stop(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_READ]);
|
||||
usbd_transfer_stop(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_READ]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1085,9 +1085,9 @@ ufoma_start_write(struct ucom_softc *ucom)
|
||||
struct ufoma_softc *sc = ucom->sc_parent;
|
||||
|
||||
if (sc->sc_nobulk) {
|
||||
usb2_transfer_start(sc->sc_ctrl_xfer[UFOMA_CTRL_ENDPT_WRITE]);
|
||||
usbd_transfer_start(sc->sc_ctrl_xfer[UFOMA_CTRL_ENDPT_WRITE]);
|
||||
} else {
|
||||
usb2_transfer_start(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_WRITE]);
|
||||
usbd_transfer_start(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_WRITE]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1097,9 +1097,9 @@ ufoma_stop_write(struct ucom_softc *ucom)
|
||||
struct ufoma_softc *sc = ucom->sc_parent;
|
||||
|
||||
if (sc->sc_nobulk) {
|
||||
usb2_transfer_stop(sc->sc_ctrl_xfer[UFOMA_CTRL_ENDPT_WRITE]);
|
||||
usbd_transfer_stop(sc->sc_ctrl_xfer[UFOMA_CTRL_ENDPT_WRITE]);
|
||||
} else {
|
||||
usb2_transfer_stop(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_WRITE]);
|
||||
usbd_transfer_stop(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_WRITE]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -166,17 +166,17 @@ static const struct usb_config uftdi_config[UFTDI_N_TRANSFER] = {
|
||||
};
|
||||
|
||||
static const struct ucom_callback uftdi_callback = {
|
||||
.usb2_com_cfg_get_status = &uftdi_cfg_get_status,
|
||||
.usb2_com_cfg_set_dtr = &uftdi_cfg_set_dtr,
|
||||
.usb2_com_cfg_set_rts = &uftdi_cfg_set_rts,
|
||||
.usb2_com_cfg_set_break = &uftdi_cfg_set_break,
|
||||
.usb2_com_cfg_param = &uftdi_cfg_param,
|
||||
.usb2_com_cfg_open = &uftdi_cfg_open,
|
||||
.usb2_com_pre_param = &uftdi_pre_param,
|
||||
.usb2_com_start_read = &uftdi_start_read,
|
||||
.usb2_com_stop_read = &uftdi_stop_read,
|
||||
.usb2_com_start_write = &uftdi_start_write,
|
||||
.usb2_com_stop_write = &uftdi_stop_write,
|
||||
.ucom_cfg_get_status = &uftdi_cfg_get_status,
|
||||
.ucom_cfg_set_dtr = &uftdi_cfg_set_dtr,
|
||||
.ucom_cfg_set_rts = &uftdi_cfg_set_rts,
|
||||
.ucom_cfg_set_break = &uftdi_cfg_set_break,
|
||||
.ucom_cfg_param = &uftdi_cfg_param,
|
||||
.ucom_cfg_open = &uftdi_cfg_open,
|
||||
.ucom_pre_param = &uftdi_pre_param,
|
||||
.ucom_start_read = &uftdi_start_read,
|
||||
.ucom_stop_read = &uftdi_stop_read,
|
||||
.ucom_start_write = &uftdi_start_write,
|
||||
.ucom_stop_write = &uftdi_stop_write,
|
||||
};
|
||||
|
||||
static device_method_t uftdi_methods[] = {
|
||||
@ -248,7 +248,7 @@ uftdi_probe(device_t dev)
|
||||
}
|
||||
/* attach to all present interfaces */
|
||||
|
||||
return (usb2_lookup_id_by_uaa(uftdi_devs, sizeof(uftdi_devs), uaa));
|
||||
return (usbd_lookup_id_by_uaa(uftdi_devs, sizeof(uftdi_devs), uaa));
|
||||
}
|
||||
|
||||
static int
|
||||
@ -262,7 +262,7 @@ uftdi_attach(device_t dev)
|
||||
sc->sc_dev = dev;
|
||||
sc->sc_unit = device_get_unit(dev);
|
||||
|
||||
device_set_usb2_desc(dev);
|
||||
device_set_usb_desc(dev);
|
||||
mtx_init(&sc->sc_mtx, "uftdi", NULL, MTX_DEF);
|
||||
|
||||
snprintf(sc->sc_name, sizeof(sc->sc_name),
|
||||
@ -283,7 +283,7 @@ uftdi_attach(device_t dev)
|
||||
break;
|
||||
}
|
||||
|
||||
error = usb2_transfer_setup(uaa->device,
|
||||
error = usbd_transfer_setup(uaa->device,
|
||||
&sc->sc_iface_index, sc->sc_xfer, uftdi_config,
|
||||
UFTDI_N_TRANSFER, sc, &sc->sc_mtx);
|
||||
|
||||
@ -296,8 +296,8 @@ uftdi_attach(device_t dev)
|
||||
|
||||
/* clear stall at first run */
|
||||
mtx_lock(&sc->sc_mtx);
|
||||
usb2_transfer_set_stall(sc->sc_xfer[UFTDI_BULK_DT_WR]);
|
||||
usb2_transfer_set_stall(sc->sc_xfer[UFTDI_BULK_DT_RD]);
|
||||
usbd_transfer_set_stall(sc->sc_xfer[UFTDI_BULK_DT_WR]);
|
||||
usbd_transfer_set_stall(sc->sc_xfer[UFTDI_BULK_DT_RD]);
|
||||
mtx_unlock(&sc->sc_mtx);
|
||||
|
||||
/* set a valid "lcr" value */
|
||||
@ -307,7 +307,7 @@ uftdi_attach(device_t dev)
|
||||
FTDI_SIO_SET_DATA_PARITY_NONE |
|
||||
FTDI_SIO_SET_DATA_BITS(8));
|
||||
|
||||
error = usb2_com_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc,
|
||||
error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc,
|
||||
&uftdi_callback, &sc->sc_mtx);
|
||||
if (error) {
|
||||
goto detach;
|
||||
@ -324,8 +324,8 @@ uftdi_detach(device_t dev)
|
||||
{
|
||||
struct uftdi_softc *sc = device_get_softc(dev);
|
||||
|
||||
usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
|
||||
usb2_transfer_unsetup(sc->sc_xfer, UFTDI_N_TRANSFER);
|
||||
ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
|
||||
usbd_transfer_unsetup(sc->sc_xfer, UFTDI_N_TRANSFER);
|
||||
mtx_destroy(&sc->sc_mtx);
|
||||
|
||||
return (0);
|
||||
@ -347,7 +347,7 @@ uftdi_cfg_open(struct ucom_softc *ucom)
|
||||
USETW(req.wValue, FTDI_SIO_RESET_SIO);
|
||||
USETW(req.wIndex, wIndex);
|
||||
USETW(req.wLength, 0);
|
||||
usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
&req, NULL, 0, 1000);
|
||||
|
||||
/* turn on RTS/CTS flow control */
|
||||
@ -357,7 +357,7 @@ uftdi_cfg_open(struct ucom_softc *ucom)
|
||||
USETW(req.wValue, 0);
|
||||
USETW2(req.wIndex, FTDI_SIO_RTS_CTS_HS, wIndex);
|
||||
USETW(req.wLength, 0);
|
||||
usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
&req, NULL, 0, 1000);
|
||||
|
||||
/*
|
||||
@ -378,17 +378,17 @@ uftdi_write_callback(struct usb_xfer *xfer)
|
||||
case USB_ST_SETUP:
|
||||
case USB_ST_TRANSFERRED:
|
||||
tr_setup:
|
||||
if (usb2_com_get_data(&sc->sc_ucom, xfer->frbuffers,
|
||||
if (ucom_get_data(&sc->sc_ucom, xfer->frbuffers,
|
||||
sc->sc_hdrlen, UFTDI_OBUFSIZE - sc->sc_hdrlen,
|
||||
&actlen)) {
|
||||
|
||||
if (sc->sc_hdrlen > 0) {
|
||||
buf[0] =
|
||||
FTDI_OUT_TAG(actlen, sc->sc_ucom.sc_portno);
|
||||
usb2_copy_in(xfer->frbuffers, 0, buf, 1);
|
||||
usbd_copy_in(xfer->frbuffers, 0, buf, 1);
|
||||
}
|
||||
xfer->frlengths[0] = actlen + sc->sc_hdrlen;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -417,7 +417,7 @@ uftdi_read_callback(struct usb_xfer *xfer)
|
||||
if (xfer->actlen < 2) {
|
||||
goto tr_setup;
|
||||
}
|
||||
usb2_copy_out(xfer->frbuffers, 0, buf, 2);
|
||||
usbd_copy_out(xfer->frbuffers, 0, buf, 2);
|
||||
|
||||
ftdi_msr = FTDI_GET_MSR(buf);
|
||||
lsr = FTDI_GET_LSR(buf);
|
||||
@ -441,18 +441,18 @@ uftdi_read_callback(struct usb_xfer *xfer)
|
||||
sc->sc_msr = msr;
|
||||
sc->sc_lsr = lsr;
|
||||
|
||||
usb2_com_status_change(&sc->sc_ucom);
|
||||
ucom_status_change(&sc->sc_ucom);
|
||||
}
|
||||
xfer->actlen -= 2;
|
||||
|
||||
if (xfer->actlen > 0) {
|
||||
usb2_com_put_data(&sc->sc_ucom, xfer->frbuffers, 2,
|
||||
ucom_put_data(&sc->sc_ucom, xfer->frbuffers, 2,
|
||||
xfer->actlen);
|
||||
}
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
@ -480,7 +480,7 @@ uftdi_cfg_set_dtr(struct ucom_softc *ucom, uint8_t onoff)
|
||||
USETW(req.wValue, wValue);
|
||||
USETW(req.wIndex, wIndex);
|
||||
USETW(req.wLength, 0);
|
||||
usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
&req, NULL, 0, 1000);
|
||||
}
|
||||
|
||||
@ -499,7 +499,7 @@ uftdi_cfg_set_rts(struct ucom_softc *ucom, uint8_t onoff)
|
||||
USETW(req.wValue, wValue);
|
||||
USETW(req.wIndex, wIndex);
|
||||
USETW(req.wLength, 0);
|
||||
usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
&req, NULL, 0, 1000);
|
||||
}
|
||||
|
||||
@ -524,7 +524,7 @@ uftdi_cfg_set_break(struct ucom_softc *ucom, uint8_t onoff)
|
||||
USETW(req.wValue, wValue);
|
||||
USETW(req.wIndex, wIndex);
|
||||
USETW(req.wLength, 0);
|
||||
usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
&req, NULL, 0, 1000);
|
||||
}
|
||||
|
||||
@ -657,7 +657,7 @@ uftdi_cfg_param(struct ucom_softc *ucom, struct termios *t)
|
||||
USETW(req.wValue, cfg.rate);
|
||||
USETW(req.wIndex, wIndex);
|
||||
USETW(req.wLength, 0);
|
||||
usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
&req, NULL, 0, 1000);
|
||||
|
||||
req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
|
||||
@ -665,7 +665,7 @@ uftdi_cfg_param(struct ucom_softc *ucom, struct termios *t)
|
||||
USETW(req.wValue, cfg.lcr);
|
||||
USETW(req.wIndex, wIndex);
|
||||
USETW(req.wLength, 0);
|
||||
usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
&req, NULL, 0, 1000);
|
||||
|
||||
req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
|
||||
@ -673,7 +673,7 @@ uftdi_cfg_param(struct ucom_softc *ucom, struct termios *t)
|
||||
USETW2(req.wValue, cfg.v_stop, cfg.v_start);
|
||||
USETW2(req.wIndex, cfg.v_flow, wIndex);
|
||||
USETW(req.wLength, 0);
|
||||
usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
&req, NULL, 0, 1000);
|
||||
}
|
||||
|
||||
@ -694,7 +694,7 @@ uftdi_start_read(struct ucom_softc *ucom)
|
||||
{
|
||||
struct uftdi_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[UFTDI_BULK_DT_RD]);
|
||||
usbd_transfer_start(sc->sc_xfer[UFTDI_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -702,7 +702,7 @@ uftdi_stop_read(struct ucom_softc *ucom)
|
||||
{
|
||||
struct uftdi_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[UFTDI_BULK_DT_RD]);
|
||||
usbd_transfer_stop(sc->sc_xfer[UFTDI_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -710,7 +710,7 @@ uftdi_start_write(struct ucom_softc *ucom)
|
||||
{
|
||||
struct uftdi_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[UFTDI_BULK_DT_WR]);
|
||||
usbd_transfer_start(sc->sc_xfer[UFTDI_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -718,7 +718,7 @@ uftdi_stop_write(struct ucom_softc *ucom)
|
||||
{
|
||||
struct uftdi_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[UFTDI_BULK_DT_WR]);
|
||||
usbd_transfer_stop(sc->sc_xfer[UFTDI_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
|
@ -48,7 +48,7 @@
|
||||
#include <dev/usb/usb_error.h>
|
||||
#include <dev/usb/usb_cdc.h>
|
||||
|
||||
#define USB_DEBUG_VAR usb2_debug
|
||||
#define USB_DEBUG_VAR usb_debug
|
||||
|
||||
#include <dev/usb/usb_core.h>
|
||||
#include <dev/usb/usb_debug.h>
|
||||
@ -72,7 +72,7 @@ enum {
|
||||
};
|
||||
|
||||
struct ugensa_sub_softc {
|
||||
struct ucom_softc *sc_usb2_com_ptr;
|
||||
struct ucom_softc *sc_ucom_ptr;
|
||||
struct usb_xfer *sc_xfer[UGENSA_N_TRANSFER];
|
||||
};
|
||||
|
||||
@ -122,10 +122,10 @@ static const struct usb_config
|
||||
};
|
||||
|
||||
static const struct ucom_callback ugensa_callback = {
|
||||
.usb2_com_start_read = &ugensa_start_read,
|
||||
.usb2_com_stop_read = &ugensa_stop_read,
|
||||
.usb2_com_start_write = &ugensa_start_write,
|
||||
.usb2_com_stop_write = &ugensa_stop_write,
|
||||
.ucom_start_read = &ugensa_start_read,
|
||||
.ucom_stop_read = &ugensa_stop_read,
|
||||
.ucom_start_write = &ugensa_start_write,
|
||||
.ucom_stop_write = &ugensa_stop_write,
|
||||
};
|
||||
|
||||
static device_method_t ugensa_methods[] = {
|
||||
@ -170,7 +170,7 @@ ugensa_probe(device_t dev)
|
||||
if (uaa->info.bIfaceIndex != 0) {
|
||||
return (ENXIO);
|
||||
}
|
||||
return (usb2_lookup_id_by_uaa(ugensa_devs, sizeof(ugensa_devs), uaa));
|
||||
return (usbd_lookup_id_by_uaa(ugensa_devs, sizeof(ugensa_devs), uaa));
|
||||
}
|
||||
|
||||
static int
|
||||
@ -184,13 +184,13 @@ ugensa_attach(device_t dev)
|
||||
uint8_t iface_index;
|
||||
int x, cnt;
|
||||
|
||||
device_set_usb2_desc(dev);
|
||||
device_set_usb_desc(dev);
|
||||
mtx_init(&sc->sc_mtx, "ugensa", NULL, MTX_DEF);
|
||||
|
||||
/* Figure out how many interfaces this device has got */
|
||||
for (cnt = 0; cnt < UGENSA_IFACE_MAX; cnt++) {
|
||||
if ((usb2_get_endpoint(uaa->device, cnt, ugensa_xfer_config + 0) == NULL) ||
|
||||
(usb2_get_endpoint(uaa->device, cnt, ugensa_xfer_config + 1) == NULL)) {
|
||||
if ((usbd_get_endpoint(uaa->device, cnt, ugensa_xfer_config + 0) == NULL) ||
|
||||
(usbd_get_endpoint(uaa->device, cnt, ugensa_xfer_config + 1) == NULL)) {
|
||||
/* we have reached the end */
|
||||
break;
|
||||
}
|
||||
@ -201,16 +201,16 @@ ugensa_attach(device_t dev)
|
||||
goto detach;
|
||||
}
|
||||
for (x = 0; x < cnt; x++) {
|
||||
iface = usb2_get_iface(uaa->device, x);
|
||||
iface = usbd_get_iface(uaa->device, x);
|
||||
if (iface->idesc->bInterfaceClass != UICLASS_VENDOR)
|
||||
/* Not a serial port, most likely a SD reader */
|
||||
continue;
|
||||
|
||||
ssc = sc->sc_sub + sc->sc_niface;
|
||||
ssc->sc_usb2_com_ptr = sc->sc_ucom + sc->sc_niface;
|
||||
ssc->sc_ucom_ptr = sc->sc_ucom + sc->sc_niface;
|
||||
|
||||
iface_index = (UGENSA_IFACE_INDEX + x);
|
||||
error = usb2_transfer_setup(uaa->device,
|
||||
error = usbd_transfer_setup(uaa->device,
|
||||
&iface_index, ssc->sc_xfer, ugensa_xfer_config,
|
||||
UGENSA_N_TRANSFER, ssc, &sc->sc_mtx);
|
||||
|
||||
@ -221,20 +221,20 @@ ugensa_attach(device_t dev)
|
||||
}
|
||||
/* clear stall at first run */
|
||||
mtx_lock(&sc->sc_mtx);
|
||||
usb2_transfer_set_stall(ssc->sc_xfer[UGENSA_BULK_DT_WR]);
|
||||
usb2_transfer_set_stall(ssc->sc_xfer[UGENSA_BULK_DT_RD]);
|
||||
usbd_transfer_set_stall(ssc->sc_xfer[UGENSA_BULK_DT_WR]);
|
||||
usbd_transfer_set_stall(ssc->sc_xfer[UGENSA_BULK_DT_RD]);
|
||||
mtx_unlock(&sc->sc_mtx);
|
||||
|
||||
/* initialize port number */
|
||||
ssc->sc_usb2_com_ptr->sc_portno = sc->sc_niface;
|
||||
ssc->sc_ucom_ptr->sc_portno = sc->sc_niface;
|
||||
sc->sc_niface++;
|
||||
if (x != uaa->info.bIfaceIndex)
|
||||
usb2_set_parent_iface(uaa->device, x,
|
||||
usbd_set_parent_iface(uaa->device, x,
|
||||
uaa->info.bIfaceIndex);
|
||||
}
|
||||
device_printf(dev, "Found %d interfaces.\n", sc->sc_niface);
|
||||
|
||||
error = usb2_com_attach(&sc->sc_super_ucom, sc->sc_ucom, sc->sc_niface, sc,
|
||||
error = ucom_attach(&sc->sc_super_ucom, sc->sc_ucom, sc->sc_niface, sc,
|
||||
&ugensa_callback, &sc->sc_mtx);
|
||||
if (error) {
|
||||
DPRINTF("attach failed\n");
|
||||
@ -253,10 +253,10 @@ ugensa_detach(device_t dev)
|
||||
struct ugensa_softc *sc = device_get_softc(dev);
|
||||
uint8_t x;
|
||||
|
||||
usb2_com_detach(&sc->sc_super_ucom, sc->sc_ucom, sc->sc_niface);
|
||||
ucom_detach(&sc->sc_super_ucom, sc->sc_ucom, sc->sc_niface);
|
||||
|
||||
for (x = 0; x < sc->sc_niface; x++) {
|
||||
usb2_transfer_unsetup(sc->sc_sub[x].sc_xfer, UGENSA_N_TRANSFER);
|
||||
usbd_transfer_unsetup(sc->sc_sub[x].sc_xfer, UGENSA_N_TRANSFER);
|
||||
}
|
||||
mtx_destroy(&sc->sc_mtx);
|
||||
|
||||
@ -273,10 +273,10 @@ ugensa_bulk_write_callback(struct usb_xfer *xfer)
|
||||
case USB_ST_SETUP:
|
||||
case USB_ST_TRANSFERRED:
|
||||
tr_setup:
|
||||
if (usb2_com_get_data(ssc->sc_usb2_com_ptr, xfer->frbuffers, 0,
|
||||
if (ucom_get_data(ssc->sc_ucom_ptr, xfer->frbuffers, 0,
|
||||
UGENSA_BUF_SIZE, &actlen)) {
|
||||
xfer->frlengths[0] = actlen;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -297,13 +297,13 @@ ugensa_bulk_read_callback(struct usb_xfer *xfer)
|
||||
|
||||
switch (USB_GET_STATE(xfer)) {
|
||||
case USB_ST_TRANSFERRED:
|
||||
usb2_com_put_data(ssc->sc_usb2_com_ptr, xfer->frbuffers, 0,
|
||||
ucom_put_data(ssc->sc_ucom_ptr, xfer->frbuffers, 0,
|
||||
xfer->actlen);
|
||||
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
@ -322,7 +322,7 @@ ugensa_start_read(struct ucom_softc *ucom)
|
||||
struct ugensa_softc *sc = ucom->sc_parent;
|
||||
struct ugensa_sub_softc *ssc = sc->sc_sub + ucom->sc_portno;
|
||||
|
||||
usb2_transfer_start(ssc->sc_xfer[UGENSA_BULK_DT_RD]);
|
||||
usbd_transfer_start(ssc->sc_xfer[UGENSA_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -331,7 +331,7 @@ ugensa_stop_read(struct ucom_softc *ucom)
|
||||
struct ugensa_softc *sc = ucom->sc_parent;
|
||||
struct ugensa_sub_softc *ssc = sc->sc_sub + ucom->sc_portno;
|
||||
|
||||
usb2_transfer_stop(ssc->sc_xfer[UGENSA_BULK_DT_RD]);
|
||||
usbd_transfer_stop(ssc->sc_xfer[UGENSA_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -340,7 +340,7 @@ ugensa_start_write(struct ucom_softc *ucom)
|
||||
struct ugensa_softc *sc = ucom->sc_parent;
|
||||
struct ugensa_sub_softc *ssc = sc->sc_sub + ucom->sc_portno;
|
||||
|
||||
usb2_transfer_start(ssc->sc_xfer[UGENSA_BULK_DT_WR]);
|
||||
usbd_transfer_start(ssc->sc_xfer[UGENSA_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -349,5 +349,5 @@ ugensa_stop_write(struct ucom_softc *ucom)
|
||||
struct ugensa_softc *sc = ucom->sc_parent;
|
||||
struct ugensa_sub_softc *ssc = sc->sc_sub + ucom->sc_portno;
|
||||
|
||||
usb2_transfer_stop(ssc->sc_xfer[UGENSA_BULK_DT_WR]);
|
||||
usbd_transfer_stop(ssc->sc_xfer[UGENSA_BULK_DT_WR]);
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <dev/usb/usb_error.h>
|
||||
#include <dev/usb/usb_cdc.h>
|
||||
|
||||
#define USB_DEBUG_VAR usb2_debug
|
||||
#define USB_DEBUG_VAR usb_debug
|
||||
|
||||
#include <dev/usb/usb_core.h>
|
||||
#include <dev/usb/usb_debug.h>
|
||||
@ -131,13 +131,13 @@ static const struct usb_config uipaq_config_data[UIPAQ_N_TRANSFER] = {
|
||||
};
|
||||
|
||||
static const struct ucom_callback uipaq_callback = {
|
||||
.usb2_com_cfg_set_dtr = &uipaq_cfg_set_dtr,
|
||||
.usb2_com_cfg_set_rts = &uipaq_cfg_set_rts,
|
||||
.usb2_com_cfg_set_break = &uipaq_cfg_set_break,
|
||||
.usb2_com_start_read = &uipaq_start_read,
|
||||
.usb2_com_stop_read = &uipaq_stop_read,
|
||||
.usb2_com_start_write = &uipaq_start_write,
|
||||
.usb2_com_stop_write = &uipaq_stop_write,
|
||||
.ucom_cfg_set_dtr = &uipaq_cfg_set_dtr,
|
||||
.ucom_cfg_set_rts = &uipaq_cfg_set_rts,
|
||||
.ucom_cfg_set_break = &uipaq_cfg_set_break,
|
||||
.ucom_start_read = &uipaq_start_read,
|
||||
.ucom_stop_read = &uipaq_stop_read,
|
||||
.ucom_start_write = &uipaq_start_write,
|
||||
.ucom_stop_write = &uipaq_stop_write,
|
||||
};
|
||||
|
||||
/*
|
||||
@ -1089,7 +1089,7 @@ uipaq_probe(device_t dev)
|
||||
if (uaa->info.bIfaceIndex != UIPAQ_IFACE_INDEX) {
|
||||
return (ENXIO);
|
||||
}
|
||||
return (usb2_lookup_id_by_uaa(uipaq_devs, sizeof(uipaq_devs), uaa));
|
||||
return (usbd_lookup_id_by_uaa(uipaq_devs, sizeof(uipaq_devs), uaa));
|
||||
}
|
||||
|
||||
static int
|
||||
@ -1104,7 +1104,7 @@ uipaq_attach(device_t dev)
|
||||
|
||||
sc->sc_udev = uaa->device;
|
||||
|
||||
device_set_usb2_desc(dev);
|
||||
device_set_usb_desc(dev);
|
||||
mtx_init(&sc->sc_mtx, "uipaq", NULL, MTX_DEF);
|
||||
|
||||
/*
|
||||
@ -1119,15 +1119,15 @@ uipaq_attach(device_t dev)
|
||||
USETW(req.wLength, 0);
|
||||
for (i = 0; i != 64; i++) {
|
||||
error =
|
||||
usb2_do_request_flags(uaa->device, NULL, &req,
|
||||
usbd_do_request_flags(uaa->device, NULL, &req,
|
||||
NULL, 0, NULL, 100);
|
||||
if (error == 0)
|
||||
break;
|
||||
usb2_pause_mtx(NULL, hz / 10);
|
||||
usb_pause_mtx(NULL, hz / 10);
|
||||
}
|
||||
|
||||
iface_index = UIPAQ_IFACE_INDEX;
|
||||
error = usb2_transfer_setup(uaa->device, &iface_index,
|
||||
error = usbd_transfer_setup(uaa->device, &iface_index,
|
||||
sc->sc_xfer, uipaq_config_data,
|
||||
UIPAQ_N_TRANSFER, sc, &sc->sc_mtx);
|
||||
|
||||
@ -1136,11 +1136,11 @@ uipaq_attach(device_t dev)
|
||||
}
|
||||
/* clear stall at first run */
|
||||
mtx_lock(&sc->sc_mtx);
|
||||
usb2_transfer_set_stall(sc->sc_xfer[UIPAQ_BULK_DT_WR]);
|
||||
usb2_transfer_set_stall(sc->sc_xfer[UIPAQ_BULK_DT_RD]);
|
||||
usbd_transfer_set_stall(sc->sc_xfer[UIPAQ_BULK_DT_WR]);
|
||||
usbd_transfer_set_stall(sc->sc_xfer[UIPAQ_BULK_DT_RD]);
|
||||
mtx_unlock(&sc->sc_mtx);
|
||||
|
||||
error = usb2_com_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc,
|
||||
error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc,
|
||||
&uipaq_callback, &sc->sc_mtx);
|
||||
if (error) {
|
||||
goto detach;
|
||||
@ -1157,8 +1157,8 @@ uipaq_detach(device_t dev)
|
||||
{
|
||||
struct uipaq_softc *sc = device_get_softc(dev);
|
||||
|
||||
usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
|
||||
usb2_transfer_unsetup(sc->sc_xfer, UIPAQ_N_TRANSFER);
|
||||
ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
|
||||
usbd_transfer_unsetup(sc->sc_xfer, UIPAQ_N_TRANSFER);
|
||||
mtx_destroy(&sc->sc_mtx);
|
||||
|
||||
return (0);
|
||||
@ -1170,7 +1170,7 @@ uipaq_start_read(struct ucom_softc *ucom)
|
||||
struct uipaq_softc *sc = ucom->sc_parent;
|
||||
|
||||
/* start read endpoint */
|
||||
usb2_transfer_start(sc->sc_xfer[UIPAQ_BULK_DT_RD]);
|
||||
usbd_transfer_start(sc->sc_xfer[UIPAQ_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1179,7 +1179,7 @@ uipaq_stop_read(struct ucom_softc *ucom)
|
||||
struct uipaq_softc *sc = ucom->sc_parent;
|
||||
|
||||
/* stop read endpoint */
|
||||
usb2_transfer_stop(sc->sc_xfer[UIPAQ_BULK_DT_RD]);
|
||||
usbd_transfer_stop(sc->sc_xfer[UIPAQ_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1187,7 +1187,7 @@ uipaq_start_write(struct ucom_softc *ucom)
|
||||
{
|
||||
struct uipaq_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[UIPAQ_BULK_DT_WR]);
|
||||
usbd_transfer_start(sc->sc_xfer[UIPAQ_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1195,7 +1195,7 @@ uipaq_stop_write(struct ucom_softc *ucom)
|
||||
{
|
||||
struct uipaq_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[UIPAQ_BULK_DT_WR]);
|
||||
usbd_transfer_stop(sc->sc_xfer[UIPAQ_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1218,7 +1218,7 @@ uipaq_cfg_set_dtr(struct ucom_softc *ucom, uint8_t onoff)
|
||||
req.wIndex[1] = 0;
|
||||
USETW(req.wLength, 0);
|
||||
|
||||
usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
&req, NULL, 0, 1000);
|
||||
}
|
||||
|
||||
@ -1242,7 +1242,7 @@ uipaq_cfg_set_rts(struct ucom_softc *ucom, uint8_t onoff)
|
||||
req.wIndex[1] = 0;
|
||||
USETW(req.wLength, 0);
|
||||
|
||||
usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
&req, NULL, 0, 1000);
|
||||
}
|
||||
|
||||
@ -1262,7 +1262,7 @@ uipaq_cfg_set_break(struct ucom_softc *ucom, uint8_t onoff)
|
||||
req.wIndex[1] = 0;
|
||||
USETW(req.wLength, 0);
|
||||
|
||||
usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
&req, NULL, 0, 1000);
|
||||
}
|
||||
|
||||
@ -1276,10 +1276,10 @@ uipaq_write_callback(struct usb_xfer *xfer)
|
||||
case USB_ST_SETUP:
|
||||
case USB_ST_TRANSFERRED:
|
||||
tr_setup:
|
||||
if (usb2_com_get_data(&sc->sc_ucom, xfer->frbuffers, 0,
|
||||
if (ucom_get_data(&sc->sc_ucom, xfer->frbuffers, 0,
|
||||
UIPAQ_BUF_SIZE, &actlen)) {
|
||||
xfer->frlengths[0] = actlen;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -1300,13 +1300,13 @@ uipaq_read_callback(struct usb_xfer *xfer)
|
||||
|
||||
switch (USB_GET_STATE(xfer)) {
|
||||
case USB_ST_TRANSFERRED:
|
||||
usb2_com_put_data(&sc->sc_ucom, xfer->frbuffers, 0,
|
||||
ucom_put_data(&sc->sc_ucom, xfer->frbuffers, 0,
|
||||
xfer->actlen);
|
||||
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
|
@ -177,10 +177,10 @@ ulpt_reset(struct ulpt_softc *sc)
|
||||
|
||||
mtx_lock(&sc->sc_mtx);
|
||||
req.bmRequestType = UT_WRITE_CLASS_OTHER;
|
||||
if (usb2_do_request_flags(sc->sc_udev, &sc->sc_mtx,
|
||||
if (usbd_do_request_flags(sc->sc_udev, &sc->sc_mtx,
|
||||
&req, NULL, 0, NULL, 2 * USB_MS_HZ)) { /* 1.0 */
|
||||
req.bmRequestType = UT_WRITE_CLASS_INTERFACE;
|
||||
if (usb2_do_request_flags(sc->sc_udev, &sc->sc_mtx,
|
||||
if (usbd_do_request_flags(sc->sc_udev, &sc->sc_mtx,
|
||||
&req, NULL, 0, NULL, 2 * USB_MS_HZ)) { /* 1.1 */
|
||||
/* ignore error */
|
||||
}
|
||||
@ -207,10 +207,10 @@ ulpt_write_callback(struct usb_xfer *xfer)
|
||||
case USB_ST_TRANSFERRED:
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
if (usb2_fifo_get_data(f, xfer->frbuffers,
|
||||
if (usb_fifo_get_data(f, xfer->frbuffers,
|
||||
0, xfer->max_data_length, &actlen, 0)) {
|
||||
xfer->frlengths[0] = actlen;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -255,14 +255,14 @@ ulpt_read_callback(struct usb_xfer *xfer)
|
||||
sc->sc_zlps = 0;
|
||||
}
|
||||
|
||||
usb2_fifo_put_data(f, xfer->frbuffers,
|
||||
usb_fifo_put_data(f, xfer->frbuffers,
|
||||
0, xfer->actlen, 1);
|
||||
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
if (usb2_fifo_put_bytes_max(f) != 0) {
|
||||
if (usb_fifo_put_bytes_max(f) != 0) {
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -291,7 +291,7 @@ ulpt_status_callback(struct usb_xfer *xfer)
|
||||
switch (USB_GET_STATE(xfer)) {
|
||||
case USB_ST_TRANSFERRED:
|
||||
|
||||
usb2_copy_out(xfer->frbuffers + 1, 0, &cur_status, 1);
|
||||
usbd_copy_out(xfer->frbuffers + 1, 0, &cur_status, 1);
|
||||
|
||||
cur_status = (cur_status ^ LPS_INVERT) & LPS_MASK;
|
||||
new_status = cur_status & ~sc->sc_last_status;
|
||||
@ -316,16 +316,16 @@ ulpt_status_callback(struct usb_xfer *xfer)
|
||||
req.wIndex[1] = 0;
|
||||
USETW(req.wLength, 1);
|
||||
|
||||
usb2_copy_in(xfer->frbuffers, 0, &req, sizeof(req));
|
||||
usbd_copy_in(xfer->frbuffers, 0, &req, sizeof(req));
|
||||
|
||||
xfer->frlengths[0] = sizeof(req);
|
||||
xfer->frlengths[1] = 1;
|
||||
xfer->nframes = 2;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
break;
|
||||
|
||||
default: /* Error */
|
||||
DPRINTF("error=%s\n", usb2_errstr(xfer->error));
|
||||
DPRINTF("error=%s\n", usbd_errstr(xfer->error));
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
/* wait for next watchdog timeout */
|
||||
}
|
||||
@ -367,7 +367,7 @@ ulpt_start_read(struct usb_fifo *fifo)
|
||||
{
|
||||
struct ulpt_softc *sc = fifo->priv_sc0;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[ULPT_BULK_DT_RD]);
|
||||
usbd_transfer_start(sc->sc_xfer[ULPT_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -375,7 +375,7 @@ ulpt_stop_read(struct usb_fifo *fifo)
|
||||
{
|
||||
struct ulpt_softc *sc = fifo->priv_sc0;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[ULPT_BULK_DT_RD]);
|
||||
usbd_transfer_stop(sc->sc_xfer[ULPT_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -383,7 +383,7 @@ ulpt_start_write(struct usb_fifo *fifo)
|
||||
{
|
||||
struct ulpt_softc *sc = fifo->priv_sc0;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[ULPT_BULK_DT_WR]);
|
||||
usbd_transfer_start(sc->sc_xfer[ULPT_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -391,7 +391,7 @@ ulpt_stop_write(struct usb_fifo *fifo)
|
||||
{
|
||||
struct ulpt_softc *sc = fifo->priv_sc0;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[ULPT_BULK_DT_WR]);
|
||||
usbd_transfer_stop(sc->sc_xfer[ULPT_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static int
|
||||
@ -418,9 +418,9 @@ unlpt_open(struct usb_fifo *fifo, int fflags)
|
||||
if (fflags & FREAD) {
|
||||
/* clear stall first */
|
||||
mtx_lock(&sc->sc_mtx);
|
||||
usb2_transfer_set_stall(sc->sc_xfer[ULPT_BULK_DT_RD]);
|
||||
usbd_transfer_set_stall(sc->sc_xfer[ULPT_BULK_DT_RD]);
|
||||
mtx_unlock(&sc->sc_mtx);
|
||||
if (usb2_fifo_alloc_buffer(fifo,
|
||||
if (usb_fifo_alloc_buffer(fifo,
|
||||
sc->sc_xfer[ULPT_BULK_DT_RD]->max_data_length,
|
||||
ULPT_IFQ_MAXLEN)) {
|
||||
return (ENOMEM);
|
||||
@ -431,9 +431,9 @@ unlpt_open(struct usb_fifo *fifo, int fflags)
|
||||
if (fflags & FWRITE) {
|
||||
/* clear stall first */
|
||||
mtx_lock(&sc->sc_mtx);
|
||||
usb2_transfer_set_stall(sc->sc_xfer[ULPT_BULK_DT_WR]);
|
||||
usbd_transfer_set_stall(sc->sc_xfer[ULPT_BULK_DT_WR]);
|
||||
mtx_unlock(&sc->sc_mtx);
|
||||
if (usb2_fifo_alloc_buffer(fifo,
|
||||
if (usb_fifo_alloc_buffer(fifo,
|
||||
sc->sc_xfer[ULPT_BULK_DT_WR]->max_data_length,
|
||||
ULPT_IFQ_MAXLEN)) {
|
||||
return (ENOMEM);
|
||||
@ -453,7 +453,7 @@ ulpt_close(struct usb_fifo *fifo, int fflags)
|
||||
sc->sc_fflags &= ~(fflags & (FREAD | FWRITE));
|
||||
|
||||
if (fflags & (FREAD | FWRITE)) {
|
||||
usb2_fifo_free_buffer(fifo);
|
||||
usb_fifo_free_buffer(fifo);
|
||||
}
|
||||
}
|
||||
|
||||
@ -500,15 +500,15 @@ ulpt_attach(device_t dev)
|
||||
sc->sc_dev = dev;
|
||||
sc->sc_udev = uaa->device;
|
||||
|
||||
device_set_usb2_desc(dev);
|
||||
device_set_usb_desc(dev);
|
||||
|
||||
mtx_init(&sc->sc_mtx, "ulpt lock", NULL, MTX_DEF | MTX_RECURSE);
|
||||
|
||||
usb2_callout_init_mtx(&sc->sc_watchdog, &sc->sc_mtx, 0);
|
||||
usb_callout_init_mtx(&sc->sc_watchdog, &sc->sc_mtx, 0);
|
||||
|
||||
/* search through all the descriptors looking for bidir mode */
|
||||
|
||||
id = usb2_get_interface_descriptor(uaa->iface);
|
||||
id = usbd_get_interface_descriptor(uaa->iface);
|
||||
alt_index = 0 - 1;
|
||||
while (1) {
|
||||
if (id == NULL) {
|
||||
@ -527,8 +527,8 @@ ulpt_attach(device_t dev)
|
||||
}
|
||||
}
|
||||
}
|
||||
id = (void *)usb2_desc_foreach(
|
||||
usb2_get_config_descriptor(uaa->device), (void *)id);
|
||||
id = (void *)usb_desc_foreach(
|
||||
usbd_get_config_descriptor(uaa->device), (void *)id);
|
||||
}
|
||||
goto detach;
|
||||
|
||||
@ -539,22 +539,22 @@ ulpt_attach(device_t dev)
|
||||
|
||||
if (alt_index) {
|
||||
|
||||
error = usb2_set_alt_interface_index
|
||||
error = usbd_set_alt_interface_index
|
||||
(uaa->device, iface_index, alt_index);
|
||||
|
||||
if (error) {
|
||||
DPRINTF("could not set alternate "
|
||||
"config, error=%s\n", usb2_errstr(error));
|
||||
"config, error=%s\n", usbd_errstr(error));
|
||||
goto detach;
|
||||
}
|
||||
}
|
||||
sc->sc_iface_no = id->bInterfaceNumber;
|
||||
|
||||
error = usb2_transfer_setup(uaa->device, &iface_index,
|
||||
error = usbd_transfer_setup(uaa->device, &iface_index,
|
||||
sc->sc_xfer, ulpt_config, ULPT_N_TRANSFER,
|
||||
sc, &sc->sc_mtx);
|
||||
if (error) {
|
||||
DPRINTF("error=%s\n", usb2_errstr(error));
|
||||
DPRINTF("error=%s\n", usbd_errstr(error));
|
||||
goto detach;
|
||||
}
|
||||
device_printf(sc->sc_dev, "using bi-directional mode\n");
|
||||
@ -566,7 +566,7 @@ ulpt_attach(device_t dev)
|
||||
* UHCI and less often with OHCI. *sigh*
|
||||
*/
|
||||
{
|
||||
struct usb_config_descriptor *cd = usb2_get_config_descriptor(dev);
|
||||
struct usb_config_descriptor *cd = usbd_get_config_descriptor(dev);
|
||||
struct usb_device_request req;
|
||||
int len, alen;
|
||||
|
||||
@ -575,7 +575,7 @@ ulpt_attach(device_t dev)
|
||||
USETW(req.wValue, cd->bConfigurationValue);
|
||||
USETW2(req.wIndex, id->bInterfaceNumber, id->bAlternateSetting);
|
||||
USETW(req.wLength, sizeof devinfo - 1);
|
||||
error = usb2_do_request_flags(dev, &req, devinfo, USB_SHORT_XFER_OK,
|
||||
error = usbd_do_request_flags(dev, &req, devinfo, USB_SHORT_XFER_OK,
|
||||
&alen, USB_DEFAULT_TIMEOUT);
|
||||
if (error) {
|
||||
device_printf(sc->sc_dev, "cannot get device id\n");
|
||||
@ -595,14 +595,14 @@ ulpt_attach(device_t dev)
|
||||
}
|
||||
#endif
|
||||
|
||||
error = usb2_fifo_attach(uaa->device, sc, &sc->sc_mtx,
|
||||
error = usb_fifo_attach(uaa->device, sc, &sc->sc_mtx,
|
||||
&ulpt_fifo_methods, &sc->sc_fifo,
|
||||
unit, 0 - 1, uaa->info.bIfaceIndex,
|
||||
UID_ROOT, GID_OPERATOR, 0644);
|
||||
if (error) {
|
||||
goto detach;
|
||||
}
|
||||
error = usb2_fifo_attach(uaa->device, sc, &sc->sc_mtx,
|
||||
error = usb_fifo_attach(uaa->device, sc, &sc->sc_mtx,
|
||||
&unlpt_fifo_methods, &sc->sc_fifo_noreset,
|
||||
unit, 0 - 1, uaa->info.bIfaceIndex,
|
||||
UID_ROOT, GID_OPERATOR, 0644);
|
||||
@ -628,15 +628,15 @@ ulpt_detach(device_t dev)
|
||||
|
||||
DPRINTF("sc=%p\n", sc);
|
||||
|
||||
usb2_fifo_detach(&sc->sc_fifo);
|
||||
usb2_fifo_detach(&sc->sc_fifo_noreset);
|
||||
usb_fifo_detach(&sc->sc_fifo);
|
||||
usb_fifo_detach(&sc->sc_fifo_noreset);
|
||||
|
||||
mtx_lock(&sc->sc_mtx);
|
||||
usb2_callout_stop(&sc->sc_watchdog);
|
||||
usb_callout_stop(&sc->sc_watchdog);
|
||||
mtx_unlock(&sc->sc_mtx);
|
||||
|
||||
usb2_transfer_unsetup(sc->sc_xfer, ULPT_N_TRANSFER);
|
||||
usb2_callout_drain(&sc->sc_watchdog);
|
||||
usbd_transfer_unsetup(sc->sc_xfer, ULPT_N_TRANSFER);
|
||||
usb_callout_drain(&sc->sc_watchdog);
|
||||
mtx_destroy(&sc->sc_mtx);
|
||||
|
||||
return (0);
|
||||
@ -696,9 +696,9 @@ ulpt_watchdog(void *arg)
|
||||
|
||||
mtx_assert(&sc->sc_mtx, MA_OWNED);
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[ULPT_INTR_DT_RD]);
|
||||
usbd_transfer_start(sc->sc_xfer[ULPT_INTR_DT_RD]);
|
||||
|
||||
usb2_callout_reset(&sc->sc_watchdog,
|
||||
usb_callout_reset(&sc->sc_watchdog,
|
||||
hz, &ulpt_watchdog, sc);
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <dev/usb/usb_error.h>
|
||||
#include <dev/usb/usb_cdc.h>
|
||||
|
||||
#define USB_DEBUG_VAR usb2_debug
|
||||
#define USB_DEBUG_VAR usb_debug
|
||||
|
||||
#include <dev/usb/usb_core.h>
|
||||
#include <dev/usb/usb_debug.h>
|
||||
@ -164,16 +164,16 @@ static const struct usb_config umct_config[UMCT_N_TRANSFER] = {
|
||||
};
|
||||
|
||||
static const struct ucom_callback umct_callback = {
|
||||
.usb2_com_cfg_get_status = &umct_cfg_get_status,
|
||||
.usb2_com_cfg_set_dtr = &umct_cfg_set_dtr,
|
||||
.usb2_com_cfg_set_rts = &umct_cfg_set_rts,
|
||||
.usb2_com_cfg_set_break = &umct_cfg_set_break,
|
||||
.usb2_com_cfg_param = &umct_cfg_param,
|
||||
.usb2_com_pre_param = &umct_pre_param,
|
||||
.usb2_com_start_read = &umct_start_read,
|
||||
.usb2_com_stop_read = &umct_stop_read,
|
||||
.usb2_com_start_write = &umct_start_write,
|
||||
.usb2_com_stop_write = &umct_stop_write,
|
||||
.ucom_cfg_get_status = &umct_cfg_get_status,
|
||||
.ucom_cfg_set_dtr = &umct_cfg_set_dtr,
|
||||
.ucom_cfg_set_rts = &umct_cfg_set_rts,
|
||||
.ucom_cfg_set_break = &umct_cfg_set_break,
|
||||
.ucom_cfg_param = &umct_cfg_param,
|
||||
.ucom_pre_param = &umct_pre_param,
|
||||
.ucom_start_read = &umct_start_read,
|
||||
.ucom_stop_read = &umct_stop_read,
|
||||
.ucom_start_write = &umct_start_write,
|
||||
.ucom_stop_write = &umct_stop_write,
|
||||
};
|
||||
|
||||
static const struct usb_device_id umct_devs[] = {
|
||||
@ -217,7 +217,7 @@ umct_probe(device_t dev)
|
||||
if (uaa->info.bIfaceIndex != UMCT_IFACE_INDEX) {
|
||||
return (ENXIO);
|
||||
}
|
||||
return (usb2_lookup_id_by_uaa(umct_devs, sizeof(umct_devs), uaa));
|
||||
return (usbd_lookup_id_by_uaa(umct_devs, sizeof(umct_devs), uaa));
|
||||
}
|
||||
|
||||
static int
|
||||
@ -232,7 +232,7 @@ umct_attach(device_t dev)
|
||||
sc->sc_udev = uaa->device;
|
||||
sc->sc_unit = device_get_unit(dev);
|
||||
|
||||
device_set_usb2_desc(dev);
|
||||
device_set_usb_desc(dev);
|
||||
mtx_init(&sc->sc_mtx, "umct", NULL, MTX_DEF);
|
||||
|
||||
snprintf(sc->sc_name, sizeof(sc->sc_name),
|
||||
@ -241,7 +241,7 @@ umct_attach(device_t dev)
|
||||
sc->sc_iface_no = uaa->info.bIfaceNum;
|
||||
|
||||
iface_index = UMCT_IFACE_INDEX;
|
||||
error = usb2_transfer_setup(uaa->device, &iface_index,
|
||||
error = usbd_transfer_setup(uaa->device, &iface_index,
|
||||
sc->sc_xfer, umct_config, UMCT_N_TRANSFER, sc, &sc->sc_mtx);
|
||||
|
||||
if (error) {
|
||||
@ -274,7 +274,7 @@ umct_attach(device_t dev)
|
||||
sc->sc_obufsize = 16;
|
||||
}
|
||||
}
|
||||
error = usb2_com_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc,
|
||||
error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc,
|
||||
&umct_callback, &sc->sc_mtx);
|
||||
if (error) {
|
||||
goto detach;
|
||||
@ -291,8 +291,8 @@ umct_detach(device_t dev)
|
||||
{
|
||||
struct umct_softc *sc = device_get_softc(dev);
|
||||
|
||||
usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
|
||||
usb2_transfer_unsetup(sc->sc_xfer, UMCT_N_TRANSFER);
|
||||
ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
|
||||
usbd_transfer_unsetup(sc->sc_xfer, UMCT_N_TRANSFER);
|
||||
mtx_destroy(&sc->sc_mtx);
|
||||
|
||||
return (0);
|
||||
@ -316,11 +316,11 @@ umct_cfg_do_request(struct umct_softc *sc, uint8_t request,
|
||||
USETW(req.wLength, len);
|
||||
USETDW(temp, value);
|
||||
|
||||
err = usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
err = ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
&req, temp, 0, 1000);
|
||||
if (err) {
|
||||
DPRINTFN(0, "device request failed, err=%s "
|
||||
"(ignored)\n", usb2_errstr(err));
|
||||
"(ignored)\n", usbd_errstr(err));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -337,17 +337,17 @@ umct_intr_callback(struct usb_xfer *xfer)
|
||||
DPRINTF("too short message\n");
|
||||
goto tr_setup;
|
||||
}
|
||||
usb2_copy_out(xfer->frbuffers, 0, buf, sizeof(buf));
|
||||
usbd_copy_out(xfer->frbuffers, 0, buf, sizeof(buf));
|
||||
|
||||
sc->sc_msr = buf[0];
|
||||
sc->sc_lsr = buf[1];
|
||||
|
||||
usb2_com_status_change(&sc->sc_ucom);
|
||||
ucom_status_change(&sc->sc_ucom);
|
||||
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
@ -491,10 +491,10 @@ umct_start_read(struct ucom_softc *ucom)
|
||||
struct umct_softc *sc = ucom->sc_parent;
|
||||
|
||||
/* start interrupt endpoint */
|
||||
usb2_transfer_start(sc->sc_xfer[UMCT_INTR_DT_RD]);
|
||||
usbd_transfer_start(sc->sc_xfer[UMCT_INTR_DT_RD]);
|
||||
|
||||
/* start read endpoint */
|
||||
usb2_transfer_start(sc->sc_xfer[UMCT_BULK_DT_RD]);
|
||||
usbd_transfer_start(sc->sc_xfer[UMCT_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -503,10 +503,10 @@ umct_stop_read(struct ucom_softc *ucom)
|
||||
struct umct_softc *sc = ucom->sc_parent;
|
||||
|
||||
/* stop interrupt endpoint */
|
||||
usb2_transfer_stop(sc->sc_xfer[UMCT_INTR_DT_RD]);
|
||||
usbd_transfer_stop(sc->sc_xfer[UMCT_INTR_DT_RD]);
|
||||
|
||||
/* stop read endpoint */
|
||||
usb2_transfer_stop(sc->sc_xfer[UMCT_BULK_DT_RD]);
|
||||
usbd_transfer_stop(sc->sc_xfer[UMCT_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -514,7 +514,7 @@ umct_start_write(struct ucom_softc *ucom)
|
||||
{
|
||||
struct umct_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[UMCT_BULK_DT_WR]);
|
||||
usbd_transfer_start(sc->sc_xfer[UMCT_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -522,7 +522,7 @@ umct_stop_write(struct ucom_softc *ucom)
|
||||
{
|
||||
struct umct_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[UMCT_BULK_DT_WR]);
|
||||
usbd_transfer_stop(sc->sc_xfer[UMCT_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -535,11 +535,11 @@ umct_write_callback(struct usb_xfer *xfer)
|
||||
case USB_ST_SETUP:
|
||||
case USB_ST_TRANSFERRED:
|
||||
tr_setup:
|
||||
if (usb2_com_get_data(&sc->sc_ucom, xfer->frbuffers, 0,
|
||||
if (ucom_get_data(&sc->sc_ucom, xfer->frbuffers, 0,
|
||||
sc->sc_obufsize, &actlen)) {
|
||||
|
||||
xfer->frlengths[0] = actlen;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -560,13 +560,13 @@ umct_read_callback(struct usb_xfer *xfer)
|
||||
|
||||
switch (USB_GET_STATE(xfer)) {
|
||||
case USB_ST_TRANSFERRED:
|
||||
usb2_com_put_data(&sc->sc_ucom, xfer->frbuffers,
|
||||
ucom_put_data(&sc->sc_ucom, xfer->frbuffers,
|
||||
0, xfer->actlen);
|
||||
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
|
@ -216,17 +216,17 @@ static const struct usb_config umodem_config[UMODEM_N_TRANSFER] = {
|
||||
};
|
||||
|
||||
static const struct ucom_callback umodem_callback = {
|
||||
.usb2_com_cfg_get_status = &umodem_cfg_get_status,
|
||||
.usb2_com_cfg_set_dtr = &umodem_cfg_set_dtr,
|
||||
.usb2_com_cfg_set_rts = &umodem_cfg_set_rts,
|
||||
.usb2_com_cfg_set_break = &umodem_cfg_set_break,
|
||||
.usb2_com_cfg_param = &umodem_cfg_param,
|
||||
.usb2_com_pre_param = &umodem_pre_param,
|
||||
.usb2_com_ioctl = &umodem_ioctl,
|
||||
.usb2_com_start_read = &umodem_start_read,
|
||||
.usb2_com_stop_read = &umodem_stop_read,
|
||||
.usb2_com_start_write = &umodem_start_write,
|
||||
.usb2_com_stop_write = &umodem_stop_write,
|
||||
.ucom_cfg_get_status = &umodem_cfg_get_status,
|
||||
.ucom_cfg_set_dtr = &umodem_cfg_set_dtr,
|
||||
.ucom_cfg_set_rts = &umodem_cfg_set_rts,
|
||||
.ucom_cfg_set_break = &umodem_cfg_set_break,
|
||||
.ucom_cfg_param = &umodem_cfg_param,
|
||||
.ucom_pre_param = &umodem_pre_param,
|
||||
.ucom_ioctl = &umodem_ioctl,
|
||||
.ucom_start_read = &umodem_start_read,
|
||||
.ucom_stop_read = &umodem_stop_read,
|
||||
.ucom_start_write = &umodem_start_write,
|
||||
.ucom_stop_write = &umodem_stop_write,
|
||||
};
|
||||
|
||||
static device_method_t umodem_methods[] = {
|
||||
@ -260,7 +260,7 @@ umodem_probe(device_t dev)
|
||||
if (uaa->usb_mode != USB_MODE_HOST) {
|
||||
return (ENXIO);
|
||||
}
|
||||
error = usb2_lookup_id_by_uaa(umodem_devs, sizeof(umodem_devs), uaa);
|
||||
error = usbd_lookup_id_by_uaa(umodem_devs, sizeof(umodem_devs), uaa);
|
||||
return (error);
|
||||
}
|
||||
|
||||
@ -274,7 +274,7 @@ umodem_attach(device_t dev)
|
||||
uint8_t i;
|
||||
int error;
|
||||
|
||||
device_set_usb2_desc(dev);
|
||||
device_set_usb_desc(dev);
|
||||
mtx_init(&sc->sc_mtx, "umodem", NULL, MTX_DEF);
|
||||
|
||||
sc->sc_ctrl_iface_no = uaa->info.bIfaceNum;
|
||||
@ -315,15 +315,15 @@ umodem_attach(device_t dev)
|
||||
struct usb_interface *iface;
|
||||
struct usb_interface_descriptor *id;
|
||||
|
||||
iface = usb2_get_iface(uaa->device, i);
|
||||
iface = usbd_get_iface(uaa->device, i);
|
||||
|
||||
if (iface) {
|
||||
|
||||
id = usb2_get_interface_descriptor(iface);
|
||||
id = usbd_get_interface_descriptor(iface);
|
||||
|
||||
if (id && (id->bInterfaceNumber == sc->sc_data_iface_no)) {
|
||||
sc->sc_iface_index[0] = i;
|
||||
usb2_set_parent_iface(uaa->device, i, uaa->info.bIfaceIndex);
|
||||
usbd_set_parent_iface(uaa->device, i, uaa->info.bIfaceIndex);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
@ -343,7 +343,7 @@ umodem_attach(device_t dev)
|
||||
}
|
||||
sc->sc_cm_over_data = 1;
|
||||
}
|
||||
error = usb2_transfer_setup(uaa->device,
|
||||
error = usbd_transfer_setup(uaa->device,
|
||||
sc->sc_iface_index, sc->sc_xfer,
|
||||
umodem_config, UMODEM_N_TRANSFER,
|
||||
sc, &sc->sc_mtx);
|
||||
@ -353,11 +353,11 @@ umodem_attach(device_t dev)
|
||||
|
||||
/* clear stall at first run */
|
||||
mtx_lock(&sc->sc_mtx);
|
||||
usb2_transfer_set_stall(sc->sc_xfer[UMODEM_BULK_WR]);
|
||||
usb2_transfer_set_stall(sc->sc_xfer[UMODEM_BULK_RD]);
|
||||
usbd_transfer_set_stall(sc->sc_xfer[UMODEM_BULK_WR]);
|
||||
usbd_transfer_set_stall(sc->sc_xfer[UMODEM_BULK_RD]);
|
||||
mtx_unlock(&sc->sc_mtx);
|
||||
|
||||
error = usb2_com_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc,
|
||||
error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc,
|
||||
&umodem_callback, &sc->sc_mtx);
|
||||
if (error) {
|
||||
goto detach;
|
||||
@ -375,10 +375,10 @@ umodem_start_read(struct ucom_softc *ucom)
|
||||
struct umodem_softc *sc = ucom->sc_parent;
|
||||
|
||||
/* start interrupt endpoint, if any */
|
||||
usb2_transfer_start(sc->sc_xfer[UMODEM_INTR_RD]);
|
||||
usbd_transfer_start(sc->sc_xfer[UMODEM_INTR_RD]);
|
||||
|
||||
/* start read endpoint */
|
||||
usb2_transfer_start(sc->sc_xfer[UMODEM_BULK_RD]);
|
||||
usbd_transfer_start(sc->sc_xfer[UMODEM_BULK_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -387,10 +387,10 @@ umodem_stop_read(struct ucom_softc *ucom)
|
||||
struct umodem_softc *sc = ucom->sc_parent;
|
||||
|
||||
/* stop interrupt endpoint, if any */
|
||||
usb2_transfer_stop(sc->sc_xfer[UMODEM_INTR_RD]);
|
||||
usbd_transfer_stop(sc->sc_xfer[UMODEM_INTR_RD]);
|
||||
|
||||
/* stop read endpoint */
|
||||
usb2_transfer_stop(sc->sc_xfer[UMODEM_BULK_RD]);
|
||||
usbd_transfer_stop(sc->sc_xfer[UMODEM_BULK_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -398,7 +398,7 @@ umodem_start_write(struct ucom_softc *ucom)
|
||||
{
|
||||
struct umodem_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[UMODEM_BULK_WR]);
|
||||
usbd_transfer_start(sc->sc_xfer[UMODEM_BULK_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -406,7 +406,7 @@ umodem_stop_write(struct ucom_softc *ucom)
|
||||
{
|
||||
struct umodem_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[UMODEM_BULK_WR]);
|
||||
usbd_transfer_stop(sc->sc_xfer[UMODEM_BULK_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -493,7 +493,7 @@ umodem_cfg_param(struct ucom_softc *ucom, struct termios *t)
|
||||
req.wIndex[1] = 0;
|
||||
USETW(req.wLength, sizeof(ls));
|
||||
|
||||
usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
&req, &ls, 0, 1000);
|
||||
}
|
||||
|
||||
@ -546,7 +546,7 @@ umodem_cfg_set_dtr(struct ucom_softc *ucom, uint8_t onoff)
|
||||
req.wIndex[1] = 0;
|
||||
USETW(req.wLength, 0);
|
||||
|
||||
usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
&req, NULL, 0, 1000);
|
||||
}
|
||||
|
||||
@ -570,7 +570,7 @@ umodem_cfg_set_rts(struct ucom_softc *ucom, uint8_t onoff)
|
||||
req.wIndex[1] = 0;
|
||||
USETW(req.wLength, 0);
|
||||
|
||||
usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
&req, NULL, 0, 1000);
|
||||
}
|
||||
|
||||
@ -594,7 +594,7 @@ umodem_cfg_set_break(struct ucom_softc *ucom, uint8_t onoff)
|
||||
req.wIndex[1] = 0;
|
||||
USETW(req.wLength, 0);
|
||||
|
||||
usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
&req, NULL, 0, 1000);
|
||||
}
|
||||
}
|
||||
@ -618,7 +618,7 @@ umodem_intr_callback(struct usb_xfer *xfer)
|
||||
DPRINTF("truncating message\n");
|
||||
xfer->actlen = sizeof(pkt);
|
||||
}
|
||||
usb2_copy_out(xfer->frbuffers, 0, &pkt, xfer->actlen);
|
||||
usbd_copy_out(xfer->frbuffers, 0, &pkt, xfer->actlen);
|
||||
|
||||
xfer->actlen -= 8;
|
||||
|
||||
@ -660,7 +660,7 @@ umodem_intr_callback(struct usb_xfer *xfer)
|
||||
if (pkt.data[0] & UCDC_N_SERIAL_DCD) {
|
||||
sc->sc_msr |= SER_DCD;
|
||||
}
|
||||
usb2_com_status_change(&sc->sc_ucom);
|
||||
ucom_status_change(&sc->sc_ucom);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -672,7 +672,7 @@ umodem_intr_callback(struct usb_xfer *xfer)
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
@ -696,11 +696,11 @@ umodem_write_callback(struct usb_xfer *xfer)
|
||||
case USB_ST_SETUP:
|
||||
case USB_ST_TRANSFERRED:
|
||||
tr_setup:
|
||||
if (usb2_com_get_data(&sc->sc_ucom, xfer->frbuffers, 0,
|
||||
if (ucom_get_data(&sc->sc_ucom, xfer->frbuffers, 0,
|
||||
UMODEM_BUF_SIZE, &actlen)) {
|
||||
|
||||
xfer->frlengths[0] = actlen;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -724,13 +724,13 @@ umodem_read_callback(struct usb_xfer *xfer)
|
||||
|
||||
DPRINTF("actlen=%d\n", xfer->actlen);
|
||||
|
||||
usb2_com_put_data(&sc->sc_ucom, xfer->frbuffers, 0,
|
||||
ucom_put_data(&sc->sc_ucom, xfer->frbuffers, 0,
|
||||
xfer->actlen);
|
||||
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
@ -768,7 +768,7 @@ umodem_set_comm_feature(struct usb_device *udev, uint8_t iface_no,
|
||||
USETW(req.wLength, UCDC_ABSTRACT_STATE_LENGTH);
|
||||
USETW(ast.wState, state);
|
||||
|
||||
return (usb2_do_request(udev, NULL, &req, &ast));
|
||||
return (usbd_do_request(udev, NULL, &req, &ast));
|
||||
}
|
||||
|
||||
static int
|
||||
@ -778,8 +778,8 @@ umodem_detach(device_t dev)
|
||||
|
||||
DPRINTF("sc=%p\n", sc);
|
||||
|
||||
usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
|
||||
usb2_transfer_unsetup(sc->sc_xfer, UMODEM_N_TRANSFER);
|
||||
ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
|
||||
usbd_transfer_unsetup(sc->sc_xfer, UMODEM_N_TRANSFER);
|
||||
mtx_destroy(&sc->sc_mtx);
|
||||
|
||||
return (0);
|
||||
|
@ -230,20 +230,20 @@ static const struct usb_config umoscom_config_data[UMOSCOM_N_TRANSFER] = {
|
||||
|
||||
static const struct ucom_callback umoscom_callback = {
|
||||
/* configuration callbacks */
|
||||
.usb2_com_cfg_get_status = &umoscom_cfg_get_status,
|
||||
.usb2_com_cfg_set_dtr = &umoscom_cfg_set_dtr,
|
||||
.usb2_com_cfg_set_rts = &umoscom_cfg_set_rts,
|
||||
.usb2_com_cfg_set_break = &umoscom_cfg_set_break,
|
||||
.usb2_com_cfg_param = &umoscom_cfg_param,
|
||||
.usb2_com_cfg_open = &umoscom_cfg_open,
|
||||
.usb2_com_cfg_close = &umoscom_cfg_close,
|
||||
.ucom_cfg_get_status = &umoscom_cfg_get_status,
|
||||
.ucom_cfg_set_dtr = &umoscom_cfg_set_dtr,
|
||||
.ucom_cfg_set_rts = &umoscom_cfg_set_rts,
|
||||
.ucom_cfg_set_break = &umoscom_cfg_set_break,
|
||||
.ucom_cfg_param = &umoscom_cfg_param,
|
||||
.ucom_cfg_open = &umoscom_cfg_open,
|
||||
.ucom_cfg_close = &umoscom_cfg_close,
|
||||
|
||||
/* other callbacks */
|
||||
.usb2_com_pre_param = &umoscom_pre_param,
|
||||
.usb2_com_start_read = &umoscom_start_read,
|
||||
.usb2_com_stop_read = &umoscom_stop_read,
|
||||
.usb2_com_start_write = &umoscom_start_write,
|
||||
.usb2_com_stop_write = &umoscom_stop_write,
|
||||
.ucom_pre_param = &umoscom_pre_param,
|
||||
.ucom_start_read = &umoscom_start_read,
|
||||
.ucom_stop_read = &umoscom_stop_read,
|
||||
.ucom_start_write = &umoscom_start_write,
|
||||
.ucom_stop_write = &umoscom_stop_write,
|
||||
};
|
||||
|
||||
static device_method_t umoscom_methods[] = {
|
||||
@ -283,7 +283,7 @@ umoscom_probe(device_t dev)
|
||||
if (uaa->info.bIfaceIndex != UMOSCOM_IFACE_INDEX) {
|
||||
return (ENXIO);
|
||||
}
|
||||
return (usb2_lookup_id_by_uaa(umoscom_devs, sizeof(umoscom_devs), uaa));
|
||||
return (usbd_lookup_id_by_uaa(umoscom_devs, sizeof(umoscom_devs), uaa));
|
||||
}
|
||||
|
||||
static int
|
||||
@ -304,7 +304,7 @@ umoscom_attach(device_t dev)
|
||||
mtx_init(&sc->sc_mtx, "umoscom", NULL, MTX_DEF);
|
||||
|
||||
iface_index = UMOSCOM_IFACE_INDEX;
|
||||
error = usb2_transfer_setup(uaa->device, &iface_index,
|
||||
error = usbd_transfer_setup(uaa->device, &iface_index,
|
||||
sc->sc_xfer, umoscom_config_data,
|
||||
UMOSCOM_N_TRANSFER, sc, &sc->sc_mtx);
|
||||
|
||||
@ -313,11 +313,11 @@ umoscom_attach(device_t dev)
|
||||
}
|
||||
/* clear stall at first run */
|
||||
mtx_lock(&sc->sc_mtx);
|
||||
usb2_transfer_set_stall(sc->sc_xfer[UMOSCOM_BULK_DT_WR]);
|
||||
usb2_transfer_set_stall(sc->sc_xfer[UMOSCOM_BULK_DT_RD]);
|
||||
usbd_transfer_set_stall(sc->sc_xfer[UMOSCOM_BULK_DT_WR]);
|
||||
usbd_transfer_set_stall(sc->sc_xfer[UMOSCOM_BULK_DT_RD]);
|
||||
mtx_unlock(&sc->sc_mtx);
|
||||
|
||||
error = usb2_com_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc,
|
||||
error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc,
|
||||
&umoscom_callback, &sc->sc_mtx);
|
||||
if (error) {
|
||||
goto detach;
|
||||
@ -325,7 +325,7 @@ umoscom_attach(device_t dev)
|
||||
return (0);
|
||||
|
||||
detach:
|
||||
device_printf(dev, "attach error: %s\n", usb2_errstr(error));
|
||||
device_printf(dev, "attach error: %s\n", usbd_errstr(error));
|
||||
umoscom_detach(dev);
|
||||
return (ENXIO);
|
||||
}
|
||||
@ -335,8 +335,8 @@ umoscom_detach(device_t dev)
|
||||
{
|
||||
struct umoscom_softc *sc = device_get_softc(dev);
|
||||
|
||||
usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
|
||||
usb2_transfer_unsetup(sc->sc_xfer, UMOSCOM_N_TRANSFER);
|
||||
ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
|
||||
usbd_transfer_unsetup(sc->sc_xfer, UMOSCOM_N_TRANSFER);
|
||||
mtx_destroy(&sc->sc_mtx);
|
||||
|
||||
return (0);
|
||||
@ -517,7 +517,7 @@ umoscom_cfg_write(struct umoscom_softc *sc, uint16_t reg, uint16_t val)
|
||||
USETW(req.wIndex, reg);
|
||||
USETW(req.wLength, 0);
|
||||
|
||||
usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
&req, NULL, 0, 1000);
|
||||
}
|
||||
|
||||
@ -533,7 +533,7 @@ umoscom_cfg_read(struct umoscom_softc *sc, uint16_t reg)
|
||||
USETW(req.wIndex, reg);
|
||||
USETW(req.wLength, 1);
|
||||
|
||||
usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
&req, &val, 0, 1000);
|
||||
|
||||
DPRINTF("reg=0x%04x, val=0x%02x\n", reg, val);
|
||||
@ -548,10 +548,10 @@ umoscom_start_read(struct ucom_softc *ucom)
|
||||
|
||||
#if 0
|
||||
/* start interrupt endpoint */
|
||||
usb2_transfer_start(sc->sc_xfer[UMOSCOM_INTR_DT_RD]);
|
||||
usbd_transfer_start(sc->sc_xfer[UMOSCOM_INTR_DT_RD]);
|
||||
#endif
|
||||
/* start read endpoint */
|
||||
usb2_transfer_start(sc->sc_xfer[UMOSCOM_BULK_DT_RD]);
|
||||
usbd_transfer_start(sc->sc_xfer[UMOSCOM_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -560,10 +560,10 @@ umoscom_stop_read(struct ucom_softc *ucom)
|
||||
struct umoscom_softc *sc = ucom->sc_parent;
|
||||
|
||||
/* stop interrupt transfer */
|
||||
usb2_transfer_stop(sc->sc_xfer[UMOSCOM_INTR_DT_RD]);
|
||||
usbd_transfer_stop(sc->sc_xfer[UMOSCOM_INTR_DT_RD]);
|
||||
|
||||
/* stop read endpoint */
|
||||
usb2_transfer_stop(sc->sc_xfer[UMOSCOM_BULK_DT_RD]);
|
||||
usbd_transfer_stop(sc->sc_xfer[UMOSCOM_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -571,7 +571,7 @@ umoscom_start_write(struct ucom_softc *ucom)
|
||||
{
|
||||
struct umoscom_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[UMOSCOM_BULK_DT_WR]);
|
||||
usbd_transfer_start(sc->sc_xfer[UMOSCOM_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -579,7 +579,7 @@ umoscom_stop_write(struct ucom_softc *ucom)
|
||||
{
|
||||
struct umoscom_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[UMOSCOM_BULK_DT_WR]);
|
||||
usbd_transfer_stop(sc->sc_xfer[UMOSCOM_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -594,11 +594,11 @@ umoscom_write_callback(struct usb_xfer *xfer)
|
||||
tr_setup:
|
||||
DPRINTF("\n");
|
||||
|
||||
if (usb2_com_get_data(&sc->sc_ucom, xfer->frbuffers, 0,
|
||||
if (ucom_get_data(&sc->sc_ucom, xfer->frbuffers, 0,
|
||||
UMOSCOM_BUFSIZE, &actlen)) {
|
||||
|
||||
xfer->frlengths[0] = actlen;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -621,14 +621,14 @@ umoscom_read_callback(struct usb_xfer *xfer)
|
||||
switch (USB_GET_STATE(xfer)) {
|
||||
case USB_ST_TRANSFERRED:
|
||||
DPRINTF("got %d bytes\n", xfer->actlen);
|
||||
usb2_com_put_data(&sc->sc_ucom, xfer->frbuffers, 0, xfer->actlen);
|
||||
ucom_put_data(&sc->sc_ucom, xfer->frbuffers, 0, xfer->actlen);
|
||||
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
DPRINTF("\n");
|
||||
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
@ -653,12 +653,12 @@ umoscom_intr_callback(struct usb_xfer *xfer)
|
||||
DPRINTF("too short message\n");
|
||||
goto tr_setup;
|
||||
}
|
||||
usb2_com_status_change(&sc->sc_ucom);
|
||||
ucom_status_change(&sc->sc_ucom);
|
||||
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
|
@ -215,16 +215,16 @@ static const struct usb_config uplcom_config_data[UPLCOM_N_TRANSFER] = {
|
||||
};
|
||||
|
||||
static struct ucom_callback uplcom_callback = {
|
||||
.usb2_com_cfg_get_status = &uplcom_cfg_get_status,
|
||||
.usb2_com_cfg_set_dtr = &uplcom_cfg_set_dtr,
|
||||
.usb2_com_cfg_set_rts = &uplcom_cfg_set_rts,
|
||||
.usb2_com_cfg_set_break = &uplcom_cfg_set_break,
|
||||
.usb2_com_cfg_param = &uplcom_cfg_param,
|
||||
.usb2_com_pre_param = &uplcom_pre_param,
|
||||
.usb2_com_start_read = &uplcom_start_read,
|
||||
.usb2_com_stop_read = &uplcom_stop_read,
|
||||
.usb2_com_start_write = &uplcom_start_write,
|
||||
.usb2_com_stop_write = &uplcom_stop_write,
|
||||
.ucom_cfg_get_status = &uplcom_cfg_get_status,
|
||||
.ucom_cfg_set_dtr = &uplcom_cfg_set_dtr,
|
||||
.ucom_cfg_set_rts = &uplcom_cfg_set_rts,
|
||||
.ucom_cfg_set_break = &uplcom_cfg_set_break,
|
||||
.ucom_cfg_param = &uplcom_cfg_param,
|
||||
.ucom_pre_param = &uplcom_pre_param,
|
||||
.ucom_start_read = &uplcom_start_read,
|
||||
.ucom_stop_read = &uplcom_stop_read,
|
||||
.ucom_start_write = &uplcom_start_write,
|
||||
.ucom_stop_write = &uplcom_stop_write,
|
||||
};
|
||||
|
||||
#define USB_UPL(v,p,rl,rh,t) \
|
||||
@ -315,7 +315,7 @@ uplcom_probe(device_t dev)
|
||||
if (uaa->info.bIfaceIndex != UPLCOM_IFACE_INDEX) {
|
||||
return (ENXIO);
|
||||
}
|
||||
return (usb2_lookup_id_by_uaa(uplcom_devs, sizeof(uplcom_devs), uaa));
|
||||
return (usbd_lookup_id_by_uaa(uplcom_devs, sizeof(uplcom_devs), uaa));
|
||||
}
|
||||
|
||||
static int
|
||||
@ -329,7 +329,7 @@ uplcom_attach(device_t dev)
|
||||
|
||||
DPRINTFN(11, "\n");
|
||||
|
||||
device_set_usb2_desc(dev);
|
||||
device_set_usb_desc(dev);
|
||||
mtx_init(&sc->sc_mtx, "uplcom", NULL, MTX_DEF);
|
||||
|
||||
DPRINTF("sc = %p\n", sc);
|
||||
@ -357,43 +357,43 @@ uplcom_attach(device_t dev)
|
||||
sc->sc_ctrl_iface_no = uaa->info.bIfaceNum;
|
||||
sc->sc_iface_index[1] = UPLCOM_IFACE_INDEX;
|
||||
|
||||
iface = usb2_get_iface(uaa->device, UPLCOM_SECOND_IFACE_INDEX);
|
||||
iface = usbd_get_iface(uaa->device, UPLCOM_SECOND_IFACE_INDEX);
|
||||
if (iface) {
|
||||
id = usb2_get_interface_descriptor(iface);
|
||||
id = usbd_get_interface_descriptor(iface);
|
||||
if (id == NULL) {
|
||||
device_printf(dev, "no interface descriptor (2)!\n");
|
||||
goto detach;
|
||||
}
|
||||
sc->sc_data_iface_no = id->bInterfaceNumber;
|
||||
sc->sc_iface_index[0] = UPLCOM_SECOND_IFACE_INDEX;
|
||||
usb2_set_parent_iface(uaa->device,
|
||||
usbd_set_parent_iface(uaa->device,
|
||||
UPLCOM_SECOND_IFACE_INDEX, uaa->info.bIfaceIndex);
|
||||
} else {
|
||||
sc->sc_data_iface_no = sc->sc_ctrl_iface_no;
|
||||
sc->sc_iface_index[0] = UPLCOM_IFACE_INDEX;
|
||||
}
|
||||
|
||||
error = usb2_transfer_setup(uaa->device,
|
||||
error = usbd_transfer_setup(uaa->device,
|
||||
sc->sc_iface_index, sc->sc_xfer, uplcom_config_data,
|
||||
UPLCOM_N_TRANSFER, sc, &sc->sc_mtx);
|
||||
if (error) {
|
||||
DPRINTF("one or more missing USB endpoints, "
|
||||
"error=%s\n", usb2_errstr(error));
|
||||
"error=%s\n", usbd_errstr(error));
|
||||
goto detach;
|
||||
}
|
||||
error = uplcom_reset(sc, uaa->device);
|
||||
if (error) {
|
||||
device_printf(dev, "reset failed, error=%s\n",
|
||||
usb2_errstr(error));
|
||||
usbd_errstr(error));
|
||||
goto detach;
|
||||
}
|
||||
/* clear stall at first run */
|
||||
mtx_lock(&sc->sc_mtx);
|
||||
usb2_transfer_set_stall(sc->sc_xfer[UPLCOM_BULK_DT_WR]);
|
||||
usb2_transfer_set_stall(sc->sc_xfer[UPLCOM_BULK_DT_RD]);
|
||||
usbd_transfer_set_stall(sc->sc_xfer[UPLCOM_BULK_DT_WR]);
|
||||
usbd_transfer_set_stall(sc->sc_xfer[UPLCOM_BULK_DT_RD]);
|
||||
mtx_unlock(&sc->sc_mtx);
|
||||
|
||||
error = usb2_com_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc,
|
||||
error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc,
|
||||
&uplcom_callback, &sc->sc_mtx);
|
||||
if (error) {
|
||||
goto detach;
|
||||
@ -422,8 +422,8 @@ uplcom_detach(device_t dev)
|
||||
|
||||
DPRINTF("sc=%p\n", sc);
|
||||
|
||||
usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
|
||||
usb2_transfer_unsetup(sc->sc_xfer, UPLCOM_N_TRANSFER);
|
||||
ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
|
||||
usbd_transfer_unsetup(sc->sc_xfer, UPLCOM_N_TRANSFER);
|
||||
mtx_destroy(&sc->sc_mtx);
|
||||
|
||||
return (0);
|
||||
@ -441,7 +441,7 @@ uplcom_reset(struct uplcom_softc *sc, struct usb_device *udev)
|
||||
req.wIndex[1] = 0;
|
||||
USETW(req.wLength, 0);
|
||||
|
||||
return (usb2_do_request(udev, NULL, &req, NULL));
|
||||
return (usbd_do_request(udev, NULL, &req, NULL));
|
||||
}
|
||||
|
||||
struct pl2303x_init {
|
||||
@ -485,9 +485,9 @@ uplcom_pl2303x_init(struct usb_device *udev)
|
||||
USETW(req.wIndex, pl2303x[i].index);
|
||||
USETW(req.wLength, pl2303x[i].length);
|
||||
|
||||
err = usb2_do_request(udev, NULL, &req, buf);
|
||||
err = usbd_do_request(udev, NULL, &req, buf);
|
||||
if (err) {
|
||||
DPRINTF("error=%s\n", usb2_errstr(err));
|
||||
DPRINTF("error=%s\n", usbd_errstr(err));
|
||||
return (EIO);
|
||||
}
|
||||
}
|
||||
@ -514,7 +514,7 @@ uplcom_cfg_set_dtr(struct ucom_softc *ucom, uint8_t onoff)
|
||||
req.wIndex[1] = 0;
|
||||
USETW(req.wLength, 0);
|
||||
|
||||
usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
&req, NULL, 0, 1000);
|
||||
}
|
||||
|
||||
@ -538,7 +538,7 @@ uplcom_cfg_set_rts(struct ucom_softc *ucom, uint8_t onoff)
|
||||
req.wIndex[1] = 0;
|
||||
USETW(req.wLength, 0);
|
||||
|
||||
usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
&req, NULL, 0, 1000);
|
||||
}
|
||||
|
||||
@ -560,7 +560,7 @@ uplcom_cfg_set_break(struct ucom_softc *ucom, uint8_t onoff)
|
||||
req.wIndex[1] = 0;
|
||||
USETW(req.wLength, 0);
|
||||
|
||||
usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
&req, NULL, 0, 1000);
|
||||
}
|
||||
|
||||
@ -655,7 +655,7 @@ uplcom_cfg_param(struct ucom_softc *ucom, struct termios *t)
|
||||
req.wIndex[1] = 0;
|
||||
USETW(req.wLength, UCDC_LINE_STATE_LENGTH);
|
||||
|
||||
usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
&req, &ls, 0, 1000);
|
||||
|
||||
if (t->c_cflag & CRTSCTS) {
|
||||
@ -671,7 +671,7 @@ uplcom_cfg_param(struct ucom_softc *ucom, struct termios *t)
|
||||
USETW(req.wIndex, UPLCOM_SET_CRTSCTS);
|
||||
USETW(req.wLength, 0);
|
||||
|
||||
usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
&req, NULL, 0, 1000);
|
||||
} else {
|
||||
req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
|
||||
@ -679,7 +679,7 @@ uplcom_cfg_param(struct ucom_softc *ucom, struct termios *t)
|
||||
USETW(req.wValue, 0);
|
||||
USETW(req.wIndex, 0);
|
||||
USETW(req.wLength, 0);
|
||||
usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
&req, NULL, 0, 1000);
|
||||
}
|
||||
}
|
||||
@ -690,10 +690,10 @@ uplcom_start_read(struct ucom_softc *ucom)
|
||||
struct uplcom_softc *sc = ucom->sc_parent;
|
||||
|
||||
/* start interrupt endpoint */
|
||||
usb2_transfer_start(sc->sc_xfer[UPLCOM_INTR_DT_RD]);
|
||||
usbd_transfer_start(sc->sc_xfer[UPLCOM_INTR_DT_RD]);
|
||||
|
||||
/* start read endpoint */
|
||||
usb2_transfer_start(sc->sc_xfer[UPLCOM_BULK_DT_RD]);
|
||||
usbd_transfer_start(sc->sc_xfer[UPLCOM_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -702,10 +702,10 @@ uplcom_stop_read(struct ucom_softc *ucom)
|
||||
struct uplcom_softc *sc = ucom->sc_parent;
|
||||
|
||||
/* stop interrupt endpoint */
|
||||
usb2_transfer_stop(sc->sc_xfer[UPLCOM_INTR_DT_RD]);
|
||||
usbd_transfer_stop(sc->sc_xfer[UPLCOM_INTR_DT_RD]);
|
||||
|
||||
/* stop read endpoint */
|
||||
usb2_transfer_stop(sc->sc_xfer[UPLCOM_BULK_DT_RD]);
|
||||
usbd_transfer_stop(sc->sc_xfer[UPLCOM_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -713,7 +713,7 @@ uplcom_start_write(struct ucom_softc *ucom)
|
||||
{
|
||||
struct uplcom_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[UPLCOM_BULK_DT_WR]);
|
||||
usbd_transfer_start(sc->sc_xfer[UPLCOM_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -721,7 +721,7 @@ uplcom_stop_write(struct ucom_softc *ucom)
|
||||
{
|
||||
struct uplcom_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[UPLCOM_BULK_DT_WR]);
|
||||
usbd_transfer_stop(sc->sc_xfer[UPLCOM_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -748,7 +748,7 @@ uplcom_intr_callback(struct usb_xfer *xfer)
|
||||
|
||||
if (xfer->actlen >= 9) {
|
||||
|
||||
usb2_copy_out(xfer->frbuffers, 0, buf, sizeof(buf));
|
||||
usbd_copy_out(xfer->frbuffers, 0, buf, sizeof(buf));
|
||||
|
||||
DPRINTF("status = 0x%02x\n", buf[8]);
|
||||
|
||||
@ -764,12 +764,12 @@ uplcom_intr_callback(struct usb_xfer *xfer)
|
||||
if (buf[8] & RSAQ_STATUS_DCD) {
|
||||
sc->sc_msr |= SER_DCD;
|
||||
}
|
||||
usb2_com_status_change(&sc->sc_ucom);
|
||||
ucom_status_change(&sc->sc_ucom);
|
||||
}
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
@ -792,13 +792,13 @@ uplcom_write_callback(struct usb_xfer *xfer)
|
||||
case USB_ST_SETUP:
|
||||
case USB_ST_TRANSFERRED:
|
||||
tr_setup:
|
||||
if (usb2_com_get_data(&sc->sc_ucom, xfer->frbuffers, 0,
|
||||
if (ucom_get_data(&sc->sc_ucom, xfer->frbuffers, 0,
|
||||
UPLCOM_BULK_BUF_SIZE, &actlen)) {
|
||||
|
||||
DPRINTF("actlen = %d\n", actlen);
|
||||
|
||||
xfer->frlengths[0] = actlen;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -819,12 +819,12 @@ uplcom_read_callback(struct usb_xfer *xfer)
|
||||
|
||||
switch (USB_GET_STATE(xfer)) {
|
||||
case USB_ST_TRANSFERRED:
|
||||
usb2_com_put_data(&sc->sc_ucom, xfer->frbuffers, 0, xfer->actlen);
|
||||
ucom_put_data(&sc->sc_ucom, xfer->frbuffers, 0, xfer->actlen);
|
||||
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
|
@ -73,7 +73,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <dev/usb/usb_cdc.h>
|
||||
#include <dev/usb/usb_ioctl.h>
|
||||
|
||||
#define USB_DEBUG_VAR usb2_com_debug
|
||||
#define USB_DEBUG_VAR ucom_debug
|
||||
|
||||
#include <dev/usb/usb_core.h>
|
||||
#include <dev/usb/usb_debug.h>
|
||||
@ -85,49 +85,49 @@ __FBSDID("$FreeBSD$");
|
||||
#include <dev/usb/serial/usb_serial.h>
|
||||
|
||||
#if USB_DEBUG
|
||||
static int usb2_com_debug = 0;
|
||||
static int ucom_debug = 0;
|
||||
|
||||
SYSCTL_NODE(_hw_usb, OID_AUTO, ucom, CTLFLAG_RW, 0, "USB ucom");
|
||||
SYSCTL_INT(_hw_usb_ucom, OID_AUTO, debug, CTLFLAG_RW,
|
||||
&usb2_com_debug, 0, "ucom debug level");
|
||||
&ucom_debug, 0, "ucom debug level");
|
||||
#endif
|
||||
|
||||
static usb_proc_callback_t usb2_com_cfg_start_transfers;
|
||||
static usb_proc_callback_t usb2_com_cfg_open;
|
||||
static usb_proc_callback_t usb2_com_cfg_close;
|
||||
static usb_proc_callback_t usb2_com_cfg_line_state;
|
||||
static usb_proc_callback_t usb2_com_cfg_status_change;
|
||||
static usb_proc_callback_t usb2_com_cfg_param;
|
||||
static usb_proc_callback_t ucom_cfg_start_transfers;
|
||||
static usb_proc_callback_t ucom_cfg_open;
|
||||
static usb_proc_callback_t ucom_cfg_close;
|
||||
static usb_proc_callback_t ucom_cfg_line_state;
|
||||
static usb_proc_callback_t ucom_cfg_status_change;
|
||||
static usb_proc_callback_t ucom_cfg_param;
|
||||
|
||||
static uint8_t usb2_com_units_alloc(uint32_t, uint32_t *);
|
||||
static void usb2_com_units_free(uint32_t, uint32_t);
|
||||
static int usb2_com_attach_tty(struct ucom_softc *, uint32_t);
|
||||
static void usb2_com_detach_tty(struct ucom_softc *);
|
||||
static void usb2_com_queue_command(struct ucom_softc *,
|
||||
static uint8_t ucom_units_alloc(uint32_t, uint32_t *);
|
||||
static void ucom_units_free(uint32_t, uint32_t);
|
||||
static int ucom_attach_tty(struct ucom_softc *, uint32_t);
|
||||
static void ucom_detach_tty(struct ucom_softc *);
|
||||
static void ucom_queue_command(struct ucom_softc *,
|
||||
usb_proc_callback_t *, struct termios *pt,
|
||||
struct usb_proc_msg *t0, struct usb_proc_msg *t1);
|
||||
static void usb2_com_shutdown(struct ucom_softc *);
|
||||
static void usb2_com_break(struct ucom_softc *, uint8_t);
|
||||
static void usb2_com_dtr(struct ucom_softc *, uint8_t);
|
||||
static void usb2_com_rts(struct ucom_softc *, uint8_t);
|
||||
static void ucom_shutdown(struct ucom_softc *);
|
||||
static void ucom_break(struct ucom_softc *, uint8_t);
|
||||
static void ucom_dtr(struct ucom_softc *, uint8_t);
|
||||
static void ucom_rts(struct ucom_softc *, uint8_t);
|
||||
|
||||
static tsw_open_t usb2_com_open;
|
||||
static tsw_close_t usb2_com_close;
|
||||
static tsw_ioctl_t usb2_com_ioctl;
|
||||
static tsw_modem_t usb2_com_modem;
|
||||
static tsw_param_t usb2_com_param;
|
||||
static tsw_outwakeup_t usb2_com_outwakeup;
|
||||
static tsw_free_t usb2_com_free;
|
||||
static tsw_open_t ucom_open;
|
||||
static tsw_close_t ucom_close;
|
||||
static tsw_ioctl_t ucom_ioctl;
|
||||
static tsw_modem_t ucom_modem;
|
||||
static tsw_param_t ucom_param;
|
||||
static tsw_outwakeup_t ucom_outwakeup;
|
||||
static tsw_free_t ucom_free;
|
||||
|
||||
static struct ttydevsw usb2_com_class = {
|
||||
static struct ttydevsw ucom_class = {
|
||||
.tsw_flags = TF_INITLOCK | TF_CALLOUT,
|
||||
.tsw_open = usb2_com_open,
|
||||
.tsw_close = usb2_com_close,
|
||||
.tsw_outwakeup = usb2_com_outwakeup,
|
||||
.tsw_ioctl = usb2_com_ioctl,
|
||||
.tsw_param = usb2_com_param,
|
||||
.tsw_modem = usb2_com_modem,
|
||||
.tsw_free = usb2_com_free,
|
||||
.tsw_open = ucom_open,
|
||||
.tsw_close = ucom_close,
|
||||
.tsw_outwakeup = ucom_outwakeup,
|
||||
.tsw_ioctl = ucom_ioctl,
|
||||
.tsw_param = ucom_param,
|
||||
.tsw_modem = ucom_modem,
|
||||
.tsw_free = ucom_free,
|
||||
};
|
||||
|
||||
MODULE_DEPEND(ucom, usb, 1, 1, 1);
|
||||
@ -136,10 +136,10 @@ MODULE_VERSION(ucom, 1);
|
||||
#define UCOM_UNIT_MAX 0x1000 /* exclusive */
|
||||
#define UCOM_SUB_UNIT_MAX 0x100 /* exclusive */
|
||||
|
||||
static uint8_t usb2_com_bitmap[(UCOM_UNIT_MAX + 7) / 8];
|
||||
static uint8_t ucom_bitmap[(UCOM_UNIT_MAX + 7) / 8];
|
||||
|
||||
static uint8_t
|
||||
usb2_com_units_alloc(uint32_t sub_units, uint32_t *p_root_unit)
|
||||
ucom_units_alloc(uint32_t sub_units, uint32_t *p_root_unit)
|
||||
{
|
||||
uint32_t n;
|
||||
uint32_t o;
|
||||
@ -157,7 +157,7 @@ usb2_com_units_alloc(uint32_t sub_units, uint32_t *p_root_unit)
|
||||
|
||||
x = n + o;
|
||||
|
||||
if (usb2_com_bitmap[x / 8] & (1 << (x % 8))) {
|
||||
if (ucom_bitmap[x / 8] & (1 << (x % 8))) {
|
||||
goto skip;
|
||||
}
|
||||
}
|
||||
@ -168,7 +168,7 @@ usb2_com_units_alloc(uint32_t sub_units, uint32_t *p_root_unit)
|
||||
|
||||
x = n + o;
|
||||
|
||||
usb2_com_bitmap[x / 8] |= (1 << (x % 8));
|
||||
ucom_bitmap[x / 8] |= (1 << (x % 8));
|
||||
}
|
||||
|
||||
error = 0;
|
||||
@ -190,7 +190,7 @@ skip: ;
|
||||
}
|
||||
|
||||
static void
|
||||
usb2_com_units_free(uint32_t root_unit, uint32_t sub_units)
|
||||
ucom_units_free(uint32_t root_unit, uint32_t sub_units)
|
||||
{
|
||||
uint32_t x;
|
||||
|
||||
@ -198,7 +198,7 @@ usb2_com_units_free(uint32_t root_unit, uint32_t sub_units)
|
||||
|
||||
while (sub_units--) {
|
||||
x = root_unit + sub_units;
|
||||
usb2_com_bitmap[x / 8] &= ~(1 << (x % 8));
|
||||
ucom_bitmap[x / 8] &= ~(1 << (x % 8));
|
||||
}
|
||||
|
||||
mtx_unlock(&Giant);
|
||||
@ -215,7 +215,7 @@ usb2_com_units_free(uint32_t root_unit, uint32_t sub_units)
|
||||
* before calling into the ucom-layer!
|
||||
*/
|
||||
int
|
||||
usb2_com_attach(struct ucom_super_softc *ssc, struct ucom_softc *sc,
|
||||
ucom_attach(struct ucom_super_softc *ssc, struct ucom_softc *sc,
|
||||
uint32_t sub_units, void *parent,
|
||||
const struct ucom_callback *callback, struct mtx *mtx)
|
||||
{
|
||||
@ -231,13 +231,13 @@ usb2_com_attach(struct ucom_super_softc *ssc, struct ucom_softc *sc,
|
||||
}
|
||||
|
||||
/* XXX unit management does not really belong here */
|
||||
if (usb2_com_units_alloc(sub_units, &root_unit)) {
|
||||
if (ucom_units_alloc(sub_units, &root_unit)) {
|
||||
return (ENOMEM);
|
||||
}
|
||||
|
||||
error = usb2_proc_create(&ssc->sc_tq, mtx, "ucom", USB_PRI_MED);
|
||||
error = usb_proc_create(&ssc->sc_tq, mtx, "ucom", USB_PRI_MED);
|
||||
if (error) {
|
||||
usb2_com_units_free(root_unit, sub_units);
|
||||
ucom_units_free(root_unit, sub_units);
|
||||
return (error);
|
||||
}
|
||||
|
||||
@ -249,10 +249,10 @@ usb2_com_attach(struct ucom_super_softc *ssc, struct ucom_softc *sc,
|
||||
sc->sc_parent = parent;
|
||||
sc->sc_callback = callback;
|
||||
|
||||
error = usb2_com_attach_tty(sc, sub_units);
|
||||
error = ucom_attach_tty(sc, sub_units);
|
||||
if (error) {
|
||||
usb2_com_detach(ssc, sc - n, n);
|
||||
usb2_com_units_free(root_unit + n, sub_units - n);
|
||||
ucom_detach(ssc, sc - n, n);
|
||||
ucom_units_free(root_unit + n, sub_units - n);
|
||||
return (error);
|
||||
}
|
||||
sc->sc_flag |= UCOM_FLAG_ATTACHED;
|
||||
@ -265,35 +265,35 @@ usb2_com_attach(struct ucom_super_softc *ssc, struct ucom_softc *sc,
|
||||
* the structure pointed to by "ssc" and "sc" is zero.
|
||||
*/
|
||||
void
|
||||
usb2_com_detach(struct ucom_super_softc *ssc, struct ucom_softc *sc,
|
||||
ucom_detach(struct ucom_super_softc *ssc, struct ucom_softc *sc,
|
||||
uint32_t sub_units)
|
||||
{
|
||||
uint32_t n;
|
||||
|
||||
usb2_proc_drain(&ssc->sc_tq);
|
||||
usb_proc_drain(&ssc->sc_tq);
|
||||
|
||||
for (n = 0; n != sub_units; n++, sc++) {
|
||||
if (sc->sc_flag & UCOM_FLAG_ATTACHED) {
|
||||
|
||||
usb2_com_detach_tty(sc);
|
||||
ucom_detach_tty(sc);
|
||||
|
||||
usb2_com_units_free(sc->sc_unit, 1);
|
||||
ucom_units_free(sc->sc_unit, 1);
|
||||
|
||||
/* avoid duplicate detach: */
|
||||
sc->sc_flag &= ~UCOM_FLAG_ATTACHED;
|
||||
}
|
||||
}
|
||||
usb2_proc_free(&ssc->sc_tq);
|
||||
usb_proc_free(&ssc->sc_tq);
|
||||
}
|
||||
|
||||
static int
|
||||
usb2_com_attach_tty(struct ucom_softc *sc, uint32_t sub_units)
|
||||
ucom_attach_tty(struct ucom_softc *sc, uint32_t sub_units)
|
||||
{
|
||||
struct tty *tp;
|
||||
int error = 0;
|
||||
char buf[32]; /* temporary TTY device name buffer */
|
||||
|
||||
tp = tty_alloc_mutex(&usb2_com_class, sc, sc->sc_mtx);
|
||||
tp = tty_alloc_mutex(&ucom_class, sc, sc->sc_mtx);
|
||||
if (tp == NULL) {
|
||||
error = ENOMEM;
|
||||
goto done;
|
||||
@ -303,8 +303,8 @@ usb2_com_attach_tty(struct ucom_softc *sc, uint32_t sub_units)
|
||||
buf[0] = 0; /* set some default value */
|
||||
|
||||
/* Check if the client has a custom TTY name */
|
||||
if (sc->sc_callback->usb2_com_tty_name) {
|
||||
sc->sc_callback->usb2_com_tty_name(sc, buf,
|
||||
if (sc->sc_callback->ucom_tty_name) {
|
||||
sc->sc_callback->ucom_tty_name(sc, buf,
|
||||
sizeof(buf), sc->sc_local_unit);
|
||||
}
|
||||
if (buf[0] == 0) {
|
||||
@ -328,14 +328,14 @@ usb2_com_attach_tty(struct ucom_softc *sc, uint32_t sub_units)
|
||||
sc->sc_tty = tp;
|
||||
|
||||
DPRINTF("ttycreate: %s\n", buf);
|
||||
cv_init(&sc->sc_cv, "usb2_com");
|
||||
cv_init(&sc->sc_cv, "ucom");
|
||||
|
||||
done:
|
||||
return (error);
|
||||
}
|
||||
|
||||
static void
|
||||
usb2_com_detach_tty(struct ucom_softc *sc)
|
||||
ucom_detach_tty(struct ucom_softc *sc)
|
||||
{
|
||||
struct tty *tp = sc->sc_tty;
|
||||
|
||||
@ -351,7 +351,7 @@ usb2_com_detach_tty(struct ucom_softc *sc)
|
||||
if (tp) {
|
||||
tty_lock(tp);
|
||||
|
||||
usb2_com_close(tp); /* close, if any */
|
||||
ucom_close(tp); /* close, if any */
|
||||
|
||||
tty_rel_gone(tp);
|
||||
|
||||
@ -362,11 +362,11 @@ usb2_com_detach_tty(struct ucom_softc *sc)
|
||||
/*
|
||||
* make sure that read and write transfers are stopped
|
||||
*/
|
||||
if (sc->sc_callback->usb2_com_stop_read) {
|
||||
(sc->sc_callback->usb2_com_stop_read) (sc);
|
||||
if (sc->sc_callback->ucom_stop_read) {
|
||||
(sc->sc_callback->ucom_stop_read) (sc);
|
||||
}
|
||||
if (sc->sc_callback->usb2_com_stop_write) {
|
||||
(sc->sc_callback->usb2_com_stop_write) (sc);
|
||||
if (sc->sc_callback->ucom_stop_write) {
|
||||
(sc->sc_callback->ucom_stop_write) (sc);
|
||||
}
|
||||
mtx_unlock(sc->sc_mtx);
|
||||
}
|
||||
@ -374,7 +374,7 @@ usb2_com_detach_tty(struct ucom_softc *sc)
|
||||
}
|
||||
|
||||
static void
|
||||
usb2_com_queue_command(struct ucom_softc *sc,
|
||||
ucom_queue_command(struct ucom_softc *sc,
|
||||
usb_proc_callback_t *fn, struct termios *pt,
|
||||
struct usb_proc_msg *t0, struct usb_proc_msg *t1)
|
||||
{
|
||||
@ -383,7 +383,7 @@ usb2_com_queue_command(struct ucom_softc *sc,
|
||||
|
||||
mtx_assert(sc->sc_mtx, MA_OWNED);
|
||||
|
||||
if (usb2_proc_is_gone(&ssc->sc_tq)) {
|
||||
if (usb_proc_is_gone(&ssc->sc_tq)) {
|
||||
DPRINTF("proc is gone\n");
|
||||
return; /* nothing to do */
|
||||
}
|
||||
@ -393,7 +393,7 @@ usb2_com_queue_command(struct ucom_softc *sc,
|
||||
* structure after that the message got queued.
|
||||
*/
|
||||
task = (struct ucom_param_task *)
|
||||
usb2_proc_msignal(&ssc->sc_tq, t0, t1);
|
||||
usb_proc_msignal(&ssc->sc_tq, t0, t1);
|
||||
|
||||
/* Setup callback and softc pointers */
|
||||
task->hdr.pm_callback = fn;
|
||||
@ -409,19 +409,19 @@ usb2_com_queue_command(struct ucom_softc *sc,
|
||||
/*
|
||||
* Closing the device should be synchronous.
|
||||
*/
|
||||
if (fn == usb2_com_cfg_close)
|
||||
usb2_proc_mwait(&ssc->sc_tq, t0, t1);
|
||||
if (fn == ucom_cfg_close)
|
||||
usb_proc_mwait(&ssc->sc_tq, t0, t1);
|
||||
|
||||
/*
|
||||
* In case of multiple configure requests,
|
||||
* keep track of the last one!
|
||||
*/
|
||||
if (fn == usb2_com_cfg_start_transfers)
|
||||
if (fn == ucom_cfg_start_transfers)
|
||||
sc->sc_last_start_xfer = &task->hdr;
|
||||
}
|
||||
|
||||
static void
|
||||
usb2_com_shutdown(struct ucom_softc *sc)
|
||||
ucom_shutdown(struct ucom_softc *sc)
|
||||
{
|
||||
struct tty *tp = sc->sc_tty;
|
||||
|
||||
@ -433,7 +433,7 @@ usb2_com_shutdown(struct ucom_softc *sc)
|
||||
* Hang up if necessary:
|
||||
*/
|
||||
if (tp->t_termios.c_cflag & HUPCL) {
|
||||
usb2_com_modem(tp, 0, SER_DTR);
|
||||
ucom_modem(tp, 0, SER_DTR);
|
||||
}
|
||||
}
|
||||
|
||||
@ -443,15 +443,15 @@ usb2_com_shutdown(struct ucom_softc *sc)
|
||||
* else: taskqueue is draining or gone
|
||||
*/
|
||||
uint8_t
|
||||
usb2_com_cfg_is_gone(struct ucom_softc *sc)
|
||||
ucom_cfg_is_gone(struct ucom_softc *sc)
|
||||
{
|
||||
struct ucom_super_softc *ssc = sc->sc_super;
|
||||
|
||||
return (usb2_proc_is_gone(&ssc->sc_tq));
|
||||
return (usb_proc_is_gone(&ssc->sc_tq));
|
||||
}
|
||||
|
||||
static void
|
||||
usb2_com_cfg_start_transfers(struct usb_proc_msg *_task)
|
||||
ucom_cfg_start_transfers(struct usb_proc_msg *_task)
|
||||
{
|
||||
struct ucom_cfg_task *task =
|
||||
(struct ucom_cfg_task *)_task;
|
||||
@ -468,16 +468,16 @@ usb2_com_cfg_start_transfers(struct usb_proc_msg *_task)
|
||||
if (_task == sc->sc_last_start_xfer)
|
||||
sc->sc_flag |= UCOM_FLAG_GP_DATA;
|
||||
|
||||
if (sc->sc_callback->usb2_com_start_read) {
|
||||
(sc->sc_callback->usb2_com_start_read) (sc);
|
||||
if (sc->sc_callback->ucom_start_read) {
|
||||
(sc->sc_callback->ucom_start_read) (sc);
|
||||
}
|
||||
if (sc->sc_callback->usb2_com_start_write) {
|
||||
(sc->sc_callback->usb2_com_start_write) (sc);
|
||||
if (sc->sc_callback->ucom_start_write) {
|
||||
(sc->sc_callback->ucom_start_write) (sc);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
usb2_com_start_transfers(struct ucom_softc *sc)
|
||||
ucom_start_transfers(struct ucom_softc *sc)
|
||||
{
|
||||
if (!(sc->sc_flag & UCOM_FLAG_HL_READY)) {
|
||||
return;
|
||||
@ -486,16 +486,16 @@ usb2_com_start_transfers(struct ucom_softc *sc)
|
||||
* Make sure that data transfers are started in both
|
||||
* directions:
|
||||
*/
|
||||
if (sc->sc_callback->usb2_com_start_read) {
|
||||
(sc->sc_callback->usb2_com_start_read) (sc);
|
||||
if (sc->sc_callback->ucom_start_read) {
|
||||
(sc->sc_callback->ucom_start_read) (sc);
|
||||
}
|
||||
if (sc->sc_callback->usb2_com_start_write) {
|
||||
(sc->sc_callback->usb2_com_start_write) (sc);
|
||||
if (sc->sc_callback->ucom_start_write) {
|
||||
(sc->sc_callback->ucom_start_write) (sc);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
usb2_com_cfg_open(struct usb_proc_msg *_task)
|
||||
ucom_cfg_open(struct usb_proc_msg *_task)
|
||||
{
|
||||
struct ucom_cfg_task *task =
|
||||
(struct ucom_cfg_task *)_task;
|
||||
@ -511,17 +511,17 @@ usb2_com_cfg_open(struct usb_proc_msg *_task)
|
||||
|
||||
sc->sc_flag |= UCOM_FLAG_LL_READY;
|
||||
|
||||
if (sc->sc_callback->usb2_com_cfg_open) {
|
||||
(sc->sc_callback->usb2_com_cfg_open) (sc);
|
||||
if (sc->sc_callback->ucom_cfg_open) {
|
||||
(sc->sc_callback->ucom_cfg_open) (sc);
|
||||
|
||||
/* wait a little */
|
||||
usb2_pause_mtx(sc->sc_mtx, hz / 10);
|
||||
usb_pause_mtx(sc->sc_mtx, hz / 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
usb2_com_open(struct tty *tp)
|
||||
ucom_open(struct tty *tp)
|
||||
{
|
||||
struct ucom_softc *sc = tty_softc(tp);
|
||||
int error;
|
||||
@ -537,12 +537,12 @@ usb2_com_open(struct tty *tp)
|
||||
}
|
||||
DPRINTF("tp = %p\n", tp);
|
||||
|
||||
if (sc->sc_callback->usb2_com_pre_open) {
|
||||
if (sc->sc_callback->ucom_pre_open) {
|
||||
/*
|
||||
* give the lower layer a chance to disallow TTY open, for
|
||||
* example if the device is not present:
|
||||
*/
|
||||
error = (sc->sc_callback->usb2_com_pre_open) (sc);
|
||||
error = (sc->sc_callback->ucom_pre_open) (sc);
|
||||
if (error) {
|
||||
return (error);
|
||||
}
|
||||
@ -561,26 +561,26 @@ usb2_com_open(struct tty *tp)
|
||||
sc->sc_pls_set = 0;
|
||||
sc->sc_pls_clr = 0;
|
||||
|
||||
usb2_com_queue_command(sc, usb2_com_cfg_open, NULL,
|
||||
ucom_queue_command(sc, ucom_cfg_open, NULL,
|
||||
&sc->sc_open_task[0].hdr,
|
||||
&sc->sc_open_task[1].hdr);
|
||||
|
||||
/* Queue transfer enable command last */
|
||||
usb2_com_queue_command(sc, usb2_com_cfg_start_transfers, NULL,
|
||||
ucom_queue_command(sc, ucom_cfg_start_transfers, NULL,
|
||||
&sc->sc_start_task[0].hdr,
|
||||
&sc->sc_start_task[1].hdr);
|
||||
|
||||
usb2_com_modem(tp, SER_DTR | SER_RTS, 0);
|
||||
ucom_modem(tp, SER_DTR | SER_RTS, 0);
|
||||
|
||||
usb2_com_break(sc, 0);
|
||||
ucom_break(sc, 0);
|
||||
|
||||
usb2_com_status_change(sc);
|
||||
ucom_status_change(sc);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void
|
||||
usb2_com_cfg_close(struct usb_proc_msg *_task)
|
||||
ucom_cfg_close(struct usb_proc_msg *_task)
|
||||
{
|
||||
struct ucom_cfg_task *task =
|
||||
(struct ucom_cfg_task *)_task;
|
||||
@ -590,15 +590,15 @@ usb2_com_cfg_close(struct usb_proc_msg *_task)
|
||||
|
||||
if (sc->sc_flag & UCOM_FLAG_LL_READY) {
|
||||
sc->sc_flag &= ~UCOM_FLAG_LL_READY;
|
||||
if (sc->sc_callback->usb2_com_cfg_close)
|
||||
(sc->sc_callback->usb2_com_cfg_close) (sc);
|
||||
if (sc->sc_callback->ucom_cfg_close)
|
||||
(sc->sc_callback->ucom_cfg_close) (sc);
|
||||
} else {
|
||||
/* already closed */
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
usb2_com_close(struct tty *tp)
|
||||
ucom_close(struct tty *tp)
|
||||
{
|
||||
struct ucom_softc *sc = tty_softc(tp);
|
||||
|
||||
@ -610,21 +610,21 @@ usb2_com_close(struct tty *tp)
|
||||
DPRINTF("tp=%p already closed\n", tp);
|
||||
return;
|
||||
}
|
||||
usb2_com_shutdown(sc);
|
||||
ucom_shutdown(sc);
|
||||
|
||||
usb2_com_queue_command(sc, usb2_com_cfg_close, NULL,
|
||||
ucom_queue_command(sc, ucom_cfg_close, NULL,
|
||||
&sc->sc_close_task[0].hdr,
|
||||
&sc->sc_close_task[1].hdr);
|
||||
|
||||
sc->sc_flag &= ~(UCOM_FLAG_HL_READY | UCOM_FLAG_RTS_IFLOW);
|
||||
|
||||
if (sc->sc_callback->usb2_com_stop_read) {
|
||||
(sc->sc_callback->usb2_com_stop_read) (sc);
|
||||
if (sc->sc_callback->ucom_stop_read) {
|
||||
(sc->sc_callback->ucom_stop_read) (sc);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
usb2_com_ioctl(struct tty *tp, u_long cmd, caddr_t data, struct thread *td)
|
||||
ucom_ioctl(struct tty *tp, u_long cmd, caddr_t data, struct thread *td)
|
||||
{
|
||||
struct ucom_softc *sc = tty_softc(tp);
|
||||
int error;
|
||||
@ -638,16 +638,16 @@ usb2_com_ioctl(struct tty *tp, u_long cmd, caddr_t data, struct thread *td)
|
||||
|
||||
switch (cmd) {
|
||||
case TIOCSBRK:
|
||||
usb2_com_break(sc, 1);
|
||||
ucom_break(sc, 1);
|
||||
error = 0;
|
||||
break;
|
||||
case TIOCCBRK:
|
||||
usb2_com_break(sc, 0);
|
||||
ucom_break(sc, 0);
|
||||
error = 0;
|
||||
break;
|
||||
default:
|
||||
if (sc->sc_callback->usb2_com_ioctl) {
|
||||
error = (sc->sc_callback->usb2_com_ioctl)
|
||||
if (sc->sc_callback->ucom_ioctl) {
|
||||
error = (sc->sc_callback->ucom_ioctl)
|
||||
(sc, cmd, data, 0, td);
|
||||
} else {
|
||||
error = ENOIOCTL;
|
||||
@ -658,7 +658,7 @@ usb2_com_ioctl(struct tty *tp, u_long cmd, caddr_t data, struct thread *td)
|
||||
}
|
||||
|
||||
static int
|
||||
usb2_com_modem(struct tty *tp, int sigon, int sigoff)
|
||||
ucom_modem(struct tty *tp, int sigon, int sigoff)
|
||||
{
|
||||
struct ucom_softc *sc = tty_softc(tp);
|
||||
uint8_t onoff;
|
||||
@ -703,16 +703,16 @@ usb2_com_modem(struct tty *tp, int sigon, int sigoff)
|
||||
sc->sc_mcr &= ~SER_RTS;
|
||||
}
|
||||
onoff = (sc->sc_mcr & SER_DTR) ? 1 : 0;
|
||||
usb2_com_dtr(sc, onoff);
|
||||
ucom_dtr(sc, onoff);
|
||||
|
||||
onoff = (sc->sc_mcr & SER_RTS) ? 1 : 0;
|
||||
usb2_com_rts(sc, onoff);
|
||||
ucom_rts(sc, onoff);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void
|
||||
usb2_com_cfg_line_state(struct usb_proc_msg *_task)
|
||||
ucom_cfg_line_state(struct usb_proc_msg *_task)
|
||||
{
|
||||
struct ucom_cfg_task *task =
|
||||
(struct ucom_cfg_task *)_task;
|
||||
@ -729,11 +729,11 @@ usb2_com_cfg_line_state(struct usb_proc_msg *_task)
|
||||
|
||||
mask = 0;
|
||||
/* compute callback mask */
|
||||
if (sc->sc_callback->usb2_com_cfg_set_dtr)
|
||||
if (sc->sc_callback->ucom_cfg_set_dtr)
|
||||
mask |= UCOM_LS_DTR;
|
||||
if (sc->sc_callback->usb2_com_cfg_set_rts)
|
||||
if (sc->sc_callback->ucom_cfg_set_rts)
|
||||
mask |= UCOM_LS_RTS;
|
||||
if (sc->sc_callback->usb2_com_cfg_set_break)
|
||||
if (sc->sc_callback->ucom_cfg_set_break)
|
||||
mask |= UCOM_LS_BREAK;
|
||||
|
||||
/* compute the bits we are to program */
|
||||
@ -749,29 +749,29 @@ usb2_com_cfg_line_state(struct usb_proc_msg *_task)
|
||||
|
||||
/* ensure that we don't loose any levels */
|
||||
if (notch_bits & UCOM_LS_DTR)
|
||||
sc->sc_callback->usb2_com_cfg_set_dtr(sc,
|
||||
sc->sc_callback->ucom_cfg_set_dtr(sc,
|
||||
(prev_value & UCOM_LS_DTR) ? 1 : 0);
|
||||
if (notch_bits & UCOM_LS_RTS)
|
||||
sc->sc_callback->usb2_com_cfg_set_rts(sc,
|
||||
sc->sc_callback->ucom_cfg_set_rts(sc,
|
||||
(prev_value & UCOM_LS_RTS) ? 1 : 0);
|
||||
if (notch_bits & UCOM_LS_BREAK)
|
||||
sc->sc_callback->usb2_com_cfg_set_break(sc,
|
||||
sc->sc_callback->ucom_cfg_set_break(sc,
|
||||
(prev_value & UCOM_LS_BREAK) ? 1 : 0);
|
||||
|
||||
/* set last value */
|
||||
if (any_bits & UCOM_LS_DTR)
|
||||
sc->sc_callback->usb2_com_cfg_set_dtr(sc,
|
||||
sc->sc_callback->ucom_cfg_set_dtr(sc,
|
||||
(last_value & UCOM_LS_DTR) ? 1 : 0);
|
||||
if (any_bits & UCOM_LS_RTS)
|
||||
sc->sc_callback->usb2_com_cfg_set_rts(sc,
|
||||
sc->sc_callback->ucom_cfg_set_rts(sc,
|
||||
(last_value & UCOM_LS_RTS) ? 1 : 0);
|
||||
if (any_bits & UCOM_LS_BREAK)
|
||||
sc->sc_callback->usb2_com_cfg_set_break(sc,
|
||||
sc->sc_callback->ucom_cfg_set_break(sc,
|
||||
(last_value & UCOM_LS_BREAK) ? 1 : 0);
|
||||
}
|
||||
|
||||
static void
|
||||
usb2_com_line_state(struct ucom_softc *sc,
|
||||
ucom_line_state(struct ucom_softc *sc,
|
||||
uint8_t set_bits, uint8_t clear_bits)
|
||||
{
|
||||
mtx_assert(sc->sc_mtx, MA_OWNED);
|
||||
@ -789,46 +789,46 @@ usb2_com_line_state(struct ucom_softc *sc,
|
||||
sc->sc_pls_clr |= clear_bits;
|
||||
|
||||
/* defer driver programming */
|
||||
usb2_com_queue_command(sc, usb2_com_cfg_line_state, NULL,
|
||||
ucom_queue_command(sc, ucom_cfg_line_state, NULL,
|
||||
&sc->sc_line_state_task[0].hdr,
|
||||
&sc->sc_line_state_task[1].hdr);
|
||||
}
|
||||
|
||||
static void
|
||||
usb2_com_break(struct ucom_softc *sc, uint8_t onoff)
|
||||
ucom_break(struct ucom_softc *sc, uint8_t onoff)
|
||||
{
|
||||
DPRINTF("onoff = %d\n", onoff);
|
||||
|
||||
if (onoff)
|
||||
usb2_com_line_state(sc, UCOM_LS_BREAK, 0);
|
||||
ucom_line_state(sc, UCOM_LS_BREAK, 0);
|
||||
else
|
||||
usb2_com_line_state(sc, 0, UCOM_LS_BREAK);
|
||||
ucom_line_state(sc, 0, UCOM_LS_BREAK);
|
||||
}
|
||||
|
||||
static void
|
||||
usb2_com_dtr(struct ucom_softc *sc, uint8_t onoff)
|
||||
ucom_dtr(struct ucom_softc *sc, uint8_t onoff)
|
||||
{
|
||||
DPRINTF("onoff = %d\n", onoff);
|
||||
|
||||
if (onoff)
|
||||
usb2_com_line_state(sc, UCOM_LS_DTR, 0);
|
||||
ucom_line_state(sc, UCOM_LS_DTR, 0);
|
||||
else
|
||||
usb2_com_line_state(sc, 0, UCOM_LS_DTR);
|
||||
ucom_line_state(sc, 0, UCOM_LS_DTR);
|
||||
}
|
||||
|
||||
static void
|
||||
usb2_com_rts(struct ucom_softc *sc, uint8_t onoff)
|
||||
ucom_rts(struct ucom_softc *sc, uint8_t onoff)
|
||||
{
|
||||
DPRINTF("onoff = %d\n", onoff);
|
||||
|
||||
if (onoff)
|
||||
usb2_com_line_state(sc, UCOM_LS_RTS, 0);
|
||||
ucom_line_state(sc, UCOM_LS_RTS, 0);
|
||||
else
|
||||
usb2_com_line_state(sc, 0, UCOM_LS_RTS);
|
||||
ucom_line_state(sc, 0, UCOM_LS_RTS);
|
||||
}
|
||||
|
||||
static void
|
||||
usb2_com_cfg_status_change(struct usb_proc_msg *_task)
|
||||
ucom_cfg_status_change(struct usb_proc_msg *_task)
|
||||
{
|
||||
struct ucom_cfg_task *task =
|
||||
(struct ucom_cfg_task *)_task;
|
||||
@ -845,7 +845,7 @@ usb2_com_cfg_status_change(struct usb_proc_msg *_task)
|
||||
if (!(sc->sc_flag & UCOM_FLAG_LL_READY)) {
|
||||
return;
|
||||
}
|
||||
if (sc->sc_callback->usb2_com_cfg_get_status == NULL) {
|
||||
if (sc->sc_callback->ucom_cfg_get_status == NULL) {
|
||||
return;
|
||||
}
|
||||
/* get status */
|
||||
@ -853,7 +853,7 @@ usb2_com_cfg_status_change(struct usb_proc_msg *_task)
|
||||
new_msr = 0;
|
||||
new_lsr = 0;
|
||||
|
||||
(sc->sc_callback->usb2_com_cfg_get_status) (sc, &new_lsr, &new_msr);
|
||||
(sc->sc_callback->ucom_cfg_get_status) (sc, &new_lsr, &new_msr);
|
||||
|
||||
if (!(sc->sc_flag & UCOM_FLAG_HL_READY)) {
|
||||
/* TTY device closed */
|
||||
@ -875,7 +875,7 @@ usb2_com_cfg_status_change(struct usb_proc_msg *_task)
|
||||
}
|
||||
|
||||
void
|
||||
usb2_com_status_change(struct ucom_softc *sc)
|
||||
ucom_status_change(struct ucom_softc *sc)
|
||||
{
|
||||
mtx_assert(sc->sc_mtx, MA_OWNED);
|
||||
|
||||
@ -884,13 +884,13 @@ usb2_com_status_change(struct ucom_softc *sc)
|
||||
}
|
||||
DPRINTF("\n");
|
||||
|
||||
usb2_com_queue_command(sc, usb2_com_cfg_status_change, NULL,
|
||||
ucom_queue_command(sc, ucom_cfg_status_change, NULL,
|
||||
&sc->sc_status_task[0].hdr,
|
||||
&sc->sc_status_task[1].hdr);
|
||||
}
|
||||
|
||||
static void
|
||||
usb2_com_cfg_param(struct usb_proc_msg *_task)
|
||||
ucom_cfg_param(struct usb_proc_msg *_task)
|
||||
{
|
||||
struct ucom_param_task *task =
|
||||
(struct ucom_param_task *)_task;
|
||||
@ -899,18 +899,18 @@ usb2_com_cfg_param(struct usb_proc_msg *_task)
|
||||
if (!(sc->sc_flag & UCOM_FLAG_LL_READY)) {
|
||||
return;
|
||||
}
|
||||
if (sc->sc_callback->usb2_com_cfg_param == NULL) {
|
||||
if (sc->sc_callback->ucom_cfg_param == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
(sc->sc_callback->usb2_com_cfg_param) (sc, &task->termios_copy);
|
||||
(sc->sc_callback->ucom_cfg_param) (sc, &task->termios_copy);
|
||||
|
||||
/* wait a little */
|
||||
usb2_pause_mtx(sc->sc_mtx, hz / 10);
|
||||
usb_pause_mtx(sc->sc_mtx, hz / 10);
|
||||
}
|
||||
|
||||
static int
|
||||
usb2_com_param(struct tty *tp, struct termios *t)
|
||||
ucom_param(struct tty *tp, struct termios *t)
|
||||
{
|
||||
struct ucom_softc *sc = tty_softc(tp);
|
||||
uint8_t opened;
|
||||
@ -925,7 +925,7 @@ usb2_com_param(struct tty *tp, struct termios *t)
|
||||
|
||||
/* XXX the TTY layer should call "open()" first! */
|
||||
|
||||
error = usb2_com_open(tp);
|
||||
error = ucom_open(tp);
|
||||
if (error) {
|
||||
goto done;
|
||||
}
|
||||
@ -946,9 +946,9 @@ usb2_com_param(struct tty *tp, struct termios *t)
|
||||
}
|
||||
t->c_ispeed = t->c_ospeed;
|
||||
|
||||
if (sc->sc_callback->usb2_com_pre_param) {
|
||||
if (sc->sc_callback->ucom_pre_param) {
|
||||
/* Let the lower layer verify the parameters */
|
||||
error = (sc->sc_callback->usb2_com_pre_param) (sc, t);
|
||||
error = (sc->sc_callback->ucom_pre_param) (sc, t);
|
||||
if (error) {
|
||||
DPRINTF("callback error = %d\n", error);
|
||||
goto done;
|
||||
@ -959,12 +959,12 @@ usb2_com_param(struct tty *tp, struct termios *t)
|
||||
sc->sc_flag &= ~UCOM_FLAG_GP_DATA;
|
||||
|
||||
/* Queue baud rate programming command first */
|
||||
usb2_com_queue_command(sc, usb2_com_cfg_param, t,
|
||||
ucom_queue_command(sc, ucom_cfg_param, t,
|
||||
&sc->sc_param_task[0].hdr,
|
||||
&sc->sc_param_task[1].hdr);
|
||||
|
||||
/* Queue transfer enable command last */
|
||||
usb2_com_queue_command(sc, usb2_com_cfg_start_transfers, NULL,
|
||||
ucom_queue_command(sc, ucom_cfg_start_transfers, NULL,
|
||||
&sc->sc_start_task[0].hdr,
|
||||
&sc->sc_start_task[1].hdr);
|
||||
|
||||
@ -972,19 +972,19 @@ usb2_com_param(struct tty *tp, struct termios *t)
|
||||
sc->sc_flag |= UCOM_FLAG_RTS_IFLOW;
|
||||
} else if (sc->sc_flag & UCOM_FLAG_RTS_IFLOW) {
|
||||
sc->sc_flag &= ~UCOM_FLAG_RTS_IFLOW;
|
||||
usb2_com_modem(tp, SER_RTS, 0);
|
||||
ucom_modem(tp, SER_RTS, 0);
|
||||
}
|
||||
done:
|
||||
if (error) {
|
||||
if (opened) {
|
||||
usb2_com_close(tp);
|
||||
ucom_close(tp);
|
||||
}
|
||||
}
|
||||
return (error);
|
||||
}
|
||||
|
||||
static void
|
||||
usb2_com_outwakeup(struct tty *tp)
|
||||
ucom_outwakeup(struct tty *tp)
|
||||
{
|
||||
struct ucom_softc *sc = tty_softc(tp);
|
||||
|
||||
@ -996,18 +996,18 @@ usb2_com_outwakeup(struct tty *tp)
|
||||
/* The higher layer is not ready */
|
||||
return;
|
||||
}
|
||||
usb2_com_start_transfers(sc);
|
||||
ucom_start_transfers(sc);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_com_get_data
|
||||
* ucom_get_data
|
||||
*
|
||||
* Return values:
|
||||
* 0: No data is available.
|
||||
* Else: Data is available.
|
||||
*------------------------------------------------------------------------*/
|
||||
uint8_t
|
||||
usb2_com_get_data(struct ucom_softc *sc, struct usb_page_cache *pc,
|
||||
ucom_get_data(struct ucom_softc *sc, struct usb_page_cache *pc,
|
||||
uint32_t offset, uint32_t len, uint32_t *actlen)
|
||||
{
|
||||
struct usb_page_search res;
|
||||
@ -1026,7 +1026,7 @@ usb2_com_get_data(struct ucom_softc *sc, struct usb_page_cache *pc,
|
||||
|
||||
while (len != 0) {
|
||||
|
||||
usb2_get_page(pc, offset, &res);
|
||||
usbd_get_page(pc, offset, &res);
|
||||
|
||||
if (res.length > len) {
|
||||
res.length = len;
|
||||
@ -1054,7 +1054,7 @@ usb2_com_get_data(struct ucom_softc *sc, struct usb_page_cache *pc,
|
||||
}
|
||||
|
||||
void
|
||||
usb2_com_put_data(struct ucom_softc *sc, struct usb_page_cache *pc,
|
||||
ucom_put_data(struct ucom_softc *sc, struct usb_page_cache *pc,
|
||||
uint32_t offset, uint32_t len)
|
||||
{
|
||||
struct usb_page_search res;
|
||||
@ -1074,7 +1074,7 @@ usb2_com_put_data(struct ucom_softc *sc, struct usb_page_cache *pc,
|
||||
|
||||
while (len > 0) {
|
||||
|
||||
usb2_get_page(pc, offset, &res);
|
||||
usbd_get_page(pc, offset, &res);
|
||||
|
||||
if (res.length > len) {
|
||||
res.length = len;
|
||||
@ -1111,7 +1111,7 @@ usb2_com_put_data(struct ucom_softc *sc, struct usb_page_cache *pc,
|
||||
}
|
||||
|
||||
static void
|
||||
usb2_com_free(void *xsc)
|
||||
ucom_free(void *xsc)
|
||||
{
|
||||
struct ucom_softc *sc = xsc;
|
||||
|
||||
|
@ -85,26 +85,26 @@ struct usb_device_request;
|
||||
struct thread;
|
||||
|
||||
/*
|
||||
* NOTE: There is no guarantee that "usb2_com_cfg_close()" will
|
||||
* be called after "usb2_com_cfg_open()" if the device is detached
|
||||
* NOTE: There is no guarantee that "ucom_cfg_close()" will
|
||||
* be called after "ucom_cfg_open()" if the device is detached
|
||||
* while it is open!
|
||||
*/
|
||||
struct ucom_callback {
|
||||
void (*usb2_com_cfg_get_status) (struct ucom_softc *, uint8_t *plsr, uint8_t *pmsr);
|
||||
void (*usb2_com_cfg_set_dtr) (struct ucom_softc *, uint8_t);
|
||||
void (*usb2_com_cfg_set_rts) (struct ucom_softc *, uint8_t);
|
||||
void (*usb2_com_cfg_set_break) (struct ucom_softc *, uint8_t);
|
||||
void (*usb2_com_cfg_param) (struct ucom_softc *, struct termios *);
|
||||
void (*usb2_com_cfg_open) (struct ucom_softc *);
|
||||
void (*usb2_com_cfg_close) (struct ucom_softc *);
|
||||
int (*usb2_com_pre_open) (struct ucom_softc *);
|
||||
int (*usb2_com_pre_param) (struct ucom_softc *, struct termios *);
|
||||
int (*usb2_com_ioctl) (struct ucom_softc *, uint32_t, caddr_t, int, struct thread *);
|
||||
void (*usb2_com_start_read) (struct ucom_softc *);
|
||||
void (*usb2_com_stop_read) (struct ucom_softc *);
|
||||
void (*usb2_com_start_write) (struct ucom_softc *);
|
||||
void (*usb2_com_stop_write) (struct ucom_softc *);
|
||||
void (*usb2_com_tty_name) (struct ucom_softc *, char *pbuf, uint16_t buflen, uint16_t local_subunit);
|
||||
void (*ucom_cfg_get_status) (struct ucom_softc *, uint8_t *plsr, uint8_t *pmsr);
|
||||
void (*ucom_cfg_set_dtr) (struct ucom_softc *, uint8_t);
|
||||
void (*ucom_cfg_set_rts) (struct ucom_softc *, uint8_t);
|
||||
void (*ucom_cfg_set_break) (struct ucom_softc *, uint8_t);
|
||||
void (*ucom_cfg_param) (struct ucom_softc *, struct termios *);
|
||||
void (*ucom_cfg_open) (struct ucom_softc *);
|
||||
void (*ucom_cfg_close) (struct ucom_softc *);
|
||||
int (*ucom_pre_open) (struct ucom_softc *);
|
||||
int (*ucom_pre_param) (struct ucom_softc *, struct termios *);
|
||||
int (*ucom_ioctl) (struct ucom_softc *, uint32_t, caddr_t, int, struct thread *);
|
||||
void (*ucom_start_read) (struct ucom_softc *);
|
||||
void (*ucom_stop_read) (struct ucom_softc *);
|
||||
void (*ucom_start_write) (struct ucom_softc *);
|
||||
void (*ucom_stop_write) (struct ucom_softc *);
|
||||
void (*ucom_tty_name) (struct ucom_softc *, char *pbuf, uint16_t buflen, uint16_t local_subunit);
|
||||
};
|
||||
|
||||
/* Line status register */
|
||||
@ -182,18 +182,18 @@ struct ucom_softc {
|
||||
#define UCOM_LS_BREAK 0x04
|
||||
};
|
||||
|
||||
#define usb2_com_cfg_do_request(udev,com,req,ptr,flags,timo) \
|
||||
usb2_do_request_proc(udev,&(com)->sc_super->sc_tq,req,ptr,flags,NULL,timo)
|
||||
#define ucom_cfg_do_request(udev,com,req,ptr,flags,timo) \
|
||||
usbd_do_request_proc(udev,&(com)->sc_super->sc_tq,req,ptr,flags,NULL,timo)
|
||||
|
||||
int usb2_com_attach(struct ucom_super_softc *,
|
||||
int ucom_attach(struct ucom_super_softc *,
|
||||
struct ucom_softc *, uint32_t, void *,
|
||||
const struct ucom_callback *callback, struct mtx *);
|
||||
void usb2_com_detach(struct ucom_super_softc *,
|
||||
void ucom_detach(struct ucom_super_softc *,
|
||||
struct ucom_softc *, uint32_t);
|
||||
void usb2_com_status_change(struct ucom_softc *);
|
||||
uint8_t usb2_com_get_data(struct ucom_softc *, struct usb_page_cache *,
|
||||
void ucom_status_change(struct ucom_softc *);
|
||||
uint8_t ucom_get_data(struct ucom_softc *, struct usb_page_cache *,
|
||||
uint32_t, uint32_t, uint32_t *);
|
||||
void usb2_com_put_data(struct ucom_softc *, struct usb_page_cache *,
|
||||
void ucom_put_data(struct ucom_softc *, struct usb_page_cache *,
|
||||
uint32_t, uint32_t);
|
||||
uint8_t usb2_com_cfg_is_gone(struct ucom_softc *);
|
||||
uint8_t ucom_cfg_is_gone(struct ucom_softc *);
|
||||
#endif /* _USB2_SERIAL_H_ */
|
||||
|
@ -144,18 +144,18 @@ static const struct usb_config uslcom_config[USLCOM_N_TRANSFER] = {
|
||||
};
|
||||
|
||||
static struct ucom_callback uslcom_callback = {
|
||||
.usb2_com_cfg_open = &uslcom_open,
|
||||
.usb2_com_cfg_close = &uslcom_close,
|
||||
.usb2_com_cfg_get_status = &uslcom_get_status,
|
||||
.usb2_com_cfg_set_dtr = &uslcom_set_dtr,
|
||||
.usb2_com_cfg_set_rts = &uslcom_set_rts,
|
||||
.usb2_com_cfg_set_break = &uslcom_set_break,
|
||||
.usb2_com_cfg_param = &uslcom_param,
|
||||
.usb2_com_pre_param = &uslcom_pre_param,
|
||||
.usb2_com_start_read = &uslcom_start_read,
|
||||
.usb2_com_stop_read = &uslcom_stop_read,
|
||||
.usb2_com_start_write = &uslcom_start_write,
|
||||
.usb2_com_stop_write = &uslcom_stop_write,
|
||||
.ucom_cfg_open = &uslcom_open,
|
||||
.ucom_cfg_close = &uslcom_close,
|
||||
.ucom_cfg_get_status = &uslcom_get_status,
|
||||
.ucom_cfg_set_dtr = &uslcom_set_dtr,
|
||||
.ucom_cfg_set_rts = &uslcom_set_rts,
|
||||
.ucom_cfg_set_break = &uslcom_set_break,
|
||||
.ucom_cfg_param = &uslcom_param,
|
||||
.ucom_pre_param = &uslcom_pre_param,
|
||||
.ucom_start_read = &uslcom_start_read,
|
||||
.ucom_stop_read = &uslcom_stop_read,
|
||||
.ucom_start_write = &uslcom_start_write,
|
||||
.ucom_stop_write = &uslcom_stop_write,
|
||||
};
|
||||
|
||||
static const struct usb_device_id uslcom_devs[] = {
|
||||
@ -215,7 +215,7 @@ uslcom_probe(device_t dev)
|
||||
if (uaa->info.bIfaceIndex != USLCOM_IFACE_INDEX) {
|
||||
return (ENXIO);
|
||||
}
|
||||
return (usb2_lookup_id_by_uaa(uslcom_devs, sizeof(uslcom_devs), uaa));
|
||||
return (usbd_lookup_id_by_uaa(uslcom_devs, sizeof(uslcom_devs), uaa));
|
||||
}
|
||||
|
||||
static int
|
||||
@ -227,26 +227,26 @@ uslcom_attach(device_t dev)
|
||||
|
||||
DPRINTFN(11, "\n");
|
||||
|
||||
device_set_usb2_desc(dev);
|
||||
device_set_usb_desc(dev);
|
||||
mtx_init(&sc->sc_mtx, "uslcom", NULL, MTX_DEF);
|
||||
|
||||
sc->sc_udev = uaa->device;
|
||||
|
||||
error = usb2_transfer_setup(uaa->device,
|
||||
error = usbd_transfer_setup(uaa->device,
|
||||
&uaa->info.bIfaceIndex, sc->sc_xfer, uslcom_config,
|
||||
USLCOM_N_TRANSFER, sc, &sc->sc_mtx);
|
||||
if (error) {
|
||||
DPRINTF("one or more missing USB endpoints, "
|
||||
"error=%s\n", usb2_errstr(error));
|
||||
"error=%s\n", usbd_errstr(error));
|
||||
goto detach;
|
||||
}
|
||||
/* clear stall at first run */
|
||||
mtx_lock(&sc->sc_mtx);
|
||||
usb2_transfer_set_stall(sc->sc_xfer[USLCOM_BULK_DT_WR]);
|
||||
usb2_transfer_set_stall(sc->sc_xfer[USLCOM_BULK_DT_RD]);
|
||||
usbd_transfer_set_stall(sc->sc_xfer[USLCOM_BULK_DT_WR]);
|
||||
usbd_transfer_set_stall(sc->sc_xfer[USLCOM_BULK_DT_RD]);
|
||||
mtx_unlock(&sc->sc_mtx);
|
||||
|
||||
error = usb2_com_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc,
|
||||
error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc,
|
||||
&uslcom_callback, &sc->sc_mtx);
|
||||
if (error) {
|
||||
goto detach;
|
||||
@ -265,8 +265,8 @@ uslcom_detach(device_t dev)
|
||||
|
||||
DPRINTF("sc=%p\n", sc);
|
||||
|
||||
usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
|
||||
usb2_transfer_unsetup(sc->sc_xfer, USLCOM_N_TRANSFER);
|
||||
ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
|
||||
usbd_transfer_unsetup(sc->sc_xfer, USLCOM_N_TRANSFER);
|
||||
mtx_destroy(&sc->sc_mtx);
|
||||
|
||||
return (0);
|
||||
@ -284,7 +284,7 @@ uslcom_open(struct ucom_softc *ucom)
|
||||
USETW(req.wIndex, USLCOM_PORT_NO);
|
||||
USETW(req.wLength, 0);
|
||||
|
||||
if (usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
&req, NULL, 0, 1000)) {
|
||||
DPRINTF("UART enable failed (ignored)\n");
|
||||
}
|
||||
@ -302,7 +302,7 @@ uslcom_close(struct ucom_softc *ucom)
|
||||
USETW(req.wIndex, USLCOM_PORT_NO);
|
||||
USETW(req.wLength, 0);
|
||||
|
||||
if (usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
&req, NULL, 0, 1000)) {
|
||||
DPRINTF("UART disable failed (ignored)\n");
|
||||
}
|
||||
@ -326,7 +326,7 @@ uslcom_set_dtr(struct ucom_softc *ucom, uint8_t onoff)
|
||||
USETW(req.wIndex, USLCOM_PORT_NO);
|
||||
USETW(req.wLength, 0);
|
||||
|
||||
if (usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
&req, NULL, 0, 1000)) {
|
||||
DPRINTF("Setting DTR failed (ignored)\n");
|
||||
}
|
||||
@ -350,7 +350,7 @@ uslcom_set_rts(struct ucom_softc *ucom, uint8_t onoff)
|
||||
USETW(req.wIndex, USLCOM_PORT_NO);
|
||||
USETW(req.wLength, 0);
|
||||
|
||||
if (usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
&req, NULL, 0, 1000)) {
|
||||
DPRINTF("Setting DTR failed (ignored)\n");
|
||||
}
|
||||
@ -379,7 +379,7 @@ uslcom_param(struct ucom_softc *ucom, struct termios *t)
|
||||
USETW(req.wIndex, USLCOM_PORT_NO);
|
||||
USETW(req.wLength, 0);
|
||||
|
||||
if (usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
&req, NULL, 0, 1000)) {
|
||||
DPRINTF("Set baudrate failed (ignored)\n");
|
||||
}
|
||||
@ -416,7 +416,7 @@ uslcom_param(struct ucom_softc *ucom, struct termios *t)
|
||||
USETW(req.wIndex, USLCOM_PORT_NO);
|
||||
USETW(req.wLength, 0);
|
||||
|
||||
if (usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
&req, NULL, 0, 1000)) {
|
||||
DPRINTF("Set format failed (ignored)\n");
|
||||
}
|
||||
@ -447,7 +447,7 @@ uslcom_set_break(struct ucom_softc *ucom, uint8_t onoff)
|
||||
USETW(req.wIndex, USLCOM_PORT_NO);
|
||||
USETW(req.wLength, 0);
|
||||
|
||||
if (usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
&req, NULL, 0, 1000)) {
|
||||
DPRINTF("Set BREAK failed (ignored)\n");
|
||||
}
|
||||
@ -463,13 +463,13 @@ uslcom_write_callback(struct usb_xfer *xfer)
|
||||
case USB_ST_SETUP:
|
||||
case USB_ST_TRANSFERRED:
|
||||
tr_setup:
|
||||
if (usb2_com_get_data(&sc->sc_ucom, xfer->frbuffers, 0,
|
||||
if (ucom_get_data(&sc->sc_ucom, xfer->frbuffers, 0,
|
||||
USLCOM_BULK_BUF_SIZE, &actlen)) {
|
||||
|
||||
DPRINTF("actlen = %d\n", actlen);
|
||||
|
||||
xfer->frlengths[0] = actlen;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -490,12 +490,12 @@ uslcom_read_callback(struct usb_xfer *xfer)
|
||||
|
||||
switch (USB_GET_STATE(xfer)) {
|
||||
case USB_ST_TRANSFERRED:
|
||||
usb2_com_put_data(&sc->sc_ucom, xfer->frbuffers, 0, xfer->actlen);
|
||||
ucom_put_data(&sc->sc_ucom, xfer->frbuffers, 0, xfer->actlen);
|
||||
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
@ -514,7 +514,7 @@ uslcom_start_read(struct ucom_softc *ucom)
|
||||
struct uslcom_softc *sc = ucom->sc_parent;
|
||||
|
||||
/* start read endpoint */
|
||||
usb2_transfer_start(sc->sc_xfer[USLCOM_BULK_DT_RD]);
|
||||
usbd_transfer_start(sc->sc_xfer[USLCOM_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -523,7 +523,7 @@ uslcom_stop_read(struct ucom_softc *ucom)
|
||||
struct uslcom_softc *sc = ucom->sc_parent;
|
||||
|
||||
/* stop read endpoint */
|
||||
usb2_transfer_stop(sc->sc_xfer[USLCOM_BULK_DT_RD]);
|
||||
usbd_transfer_stop(sc->sc_xfer[USLCOM_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -531,7 +531,7 @@ uslcom_start_write(struct ucom_softc *ucom)
|
||||
{
|
||||
struct uslcom_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[USLCOM_BULK_DT_WR]);
|
||||
usbd_transfer_start(sc->sc_xfer[USLCOM_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -539,5 +539,5 @@ uslcom_stop_write(struct ucom_softc *ucom)
|
||||
{
|
||||
struct uslcom_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[USLCOM_BULK_DT_WR]);
|
||||
usbd_transfer_stop(sc->sc_xfer[USLCOM_BULK_DT_WR]);
|
||||
}
|
||||
|
@ -212,12 +212,12 @@ static const struct usb_config uvisor_config[UVISOR_N_TRANSFER] = {
|
||||
};
|
||||
|
||||
static const struct ucom_callback uvisor_callback = {
|
||||
.usb2_com_cfg_open = &uvisor_cfg_open,
|
||||
.usb2_com_cfg_close = &uvisor_cfg_close,
|
||||
.usb2_com_start_read = &uvisor_start_read,
|
||||
.usb2_com_stop_read = &uvisor_stop_read,
|
||||
.usb2_com_start_write = &uvisor_start_write,
|
||||
.usb2_com_stop_write = &uvisor_stop_write,
|
||||
.ucom_cfg_open = &uvisor_cfg_open,
|
||||
.ucom_cfg_close = &uvisor_cfg_close,
|
||||
.ucom_start_read = &uvisor_start_read,
|
||||
.ucom_stop_read = &uvisor_stop_read,
|
||||
.ucom_start_write = &uvisor_start_write,
|
||||
.ucom_stop_write = &uvisor_stop_write,
|
||||
};
|
||||
|
||||
static device_method_t uvisor_methods[] = {
|
||||
@ -282,7 +282,7 @@ uvisor_probe(device_t dev)
|
||||
if (uaa->info.bIfaceIndex != UVISOR_IFACE_INDEX) {
|
||||
return (ENXIO);
|
||||
}
|
||||
return (usb2_lookup_id_by_uaa(uvisor_devs, sizeof(uvisor_devs), uaa));
|
||||
return (usbd_lookup_id_by_uaa(uvisor_devs, sizeof(uvisor_devs), uaa));
|
||||
}
|
||||
|
||||
static int
|
||||
@ -296,7 +296,7 @@ uvisor_attach(device_t dev)
|
||||
DPRINTF("sc=%p\n", sc);
|
||||
bcopy(uvisor_config, uvisor_config_copy,
|
||||
sizeof(uvisor_config_copy));
|
||||
device_set_usb2_desc(dev);
|
||||
device_set_usb_desc(dev);
|
||||
|
||||
mtx_init(&sc->sc_mtx, "uvisor", NULL, MTX_DEF);
|
||||
|
||||
@ -312,10 +312,10 @@ uvisor_attach(device_t dev)
|
||||
|
||||
if (error) {
|
||||
DPRINTF("init failed, error=%s\n",
|
||||
usb2_errstr(error));
|
||||
usbd_errstr(error));
|
||||
goto detach;
|
||||
}
|
||||
error = usb2_transfer_setup(uaa->device, &sc->sc_iface_index,
|
||||
error = usbd_transfer_setup(uaa->device, &sc->sc_iface_index,
|
||||
sc->sc_xfer, uvisor_config_copy, UVISOR_N_TRANSFER,
|
||||
sc, &sc->sc_mtx);
|
||||
if (error) {
|
||||
@ -324,14 +324,14 @@ uvisor_attach(device_t dev)
|
||||
}
|
||||
/* clear stall at first run */
|
||||
mtx_lock(&sc->sc_mtx);
|
||||
usb2_transfer_set_stall(sc->sc_xfer[UVISOR_BULK_DT_WR]);
|
||||
usb2_transfer_set_stall(sc->sc_xfer[UVISOR_BULK_DT_RD]);
|
||||
usbd_transfer_set_stall(sc->sc_xfer[UVISOR_BULK_DT_WR]);
|
||||
usbd_transfer_set_stall(sc->sc_xfer[UVISOR_BULK_DT_RD]);
|
||||
mtx_unlock(&sc->sc_mtx);
|
||||
|
||||
error = usb2_com_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc,
|
||||
error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc,
|
||||
&uvisor_callback, &sc->sc_mtx);
|
||||
if (error) {
|
||||
DPRINTF("usb2_com_attach failed\n");
|
||||
DPRINTF("ucom_attach failed\n");
|
||||
goto detach;
|
||||
}
|
||||
return (0);
|
||||
@ -348,8 +348,8 @@ uvisor_detach(device_t dev)
|
||||
|
||||
DPRINTF("sc=%p\n", sc);
|
||||
|
||||
usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
|
||||
usb2_transfer_unsetup(sc->sc_xfer, UVISOR_N_TRANSFER);
|
||||
ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
|
||||
usbd_transfer_unsetup(sc->sc_xfer, UVISOR_N_TRANSFER);
|
||||
mtx_destroy(&sc->sc_mtx);
|
||||
|
||||
return (0);
|
||||
@ -373,7 +373,7 @@ uvisor_init(struct uvisor_softc *sc, struct usb_device *udev, struct usb_config
|
||||
USETW(req.wValue, 0);
|
||||
USETW(req.wIndex, 0);
|
||||
USETW(req.wLength, UVISOR_CONNECTION_INFO_SIZE);
|
||||
err = usb2_do_request_flags(udev, NULL,
|
||||
err = usbd_do_request_flags(udev, NULL,
|
||||
&req, &coninfo, USB_SHORT_XFER_OK,
|
||||
&actlen, USB_DEFAULT_TIMEOUT);
|
||||
|
||||
@ -426,7 +426,7 @@ uvisor_init(struct uvisor_softc *sc, struct usb_device *udev, struct usb_config
|
||||
USETW(req.wIndex, 0);
|
||||
USETW(req.wLength, UVISOR_GET_PALM_INFORMATION_LEN);
|
||||
|
||||
err = usb2_do_request_flags
|
||||
err = usbd_do_request_flags
|
||||
(udev, NULL, &req, &pconinfo, USB_SHORT_XFER_OK,
|
||||
&actlen, USB_DEFAULT_TIMEOUT);
|
||||
|
||||
@ -453,7 +453,7 @@ uvisor_init(struct uvisor_softc *sc, struct usb_device *udev, struct usb_config
|
||||
USETW(req.wValue, 0);
|
||||
USETW(req.wIndex, 0);
|
||||
USETW(req.wLength, UVISOR_GET_PALM_INFORMATION_LEN);
|
||||
err = usb2_do_request(udev, &req, buffer);
|
||||
err = usbd_do_request(udev, &req, buffer);
|
||||
if (err) {
|
||||
goto done;
|
||||
}
|
||||
@ -468,7 +468,7 @@ uvisor_init(struct uvisor_softc *sc, struct usb_device *udev, struct usb_config
|
||||
USETW(req.wIndex, 0);
|
||||
USETW(req.wLength, 1);
|
||||
|
||||
err = usb2_do_request(udev, NULL, &req, buffer);
|
||||
err = usbd_do_request(udev, NULL, &req, buffer);
|
||||
if (err) {
|
||||
goto done;
|
||||
}
|
||||
@ -479,7 +479,7 @@ uvisor_init(struct uvisor_softc *sc, struct usb_device *udev, struct usb_config
|
||||
USETW(req.wValue, 0);
|
||||
USETW(req.wIndex, 0);
|
||||
USETW(req.wLength, 1);
|
||||
err = usb2_do_request(udev, NULL, &req, buffer);
|
||||
err = usbd_do_request(udev, NULL, &req, buffer);
|
||||
if (err) {
|
||||
goto done;
|
||||
}
|
||||
@ -490,7 +490,7 @@ uvisor_init(struct uvisor_softc *sc, struct usb_device *udev, struct usb_config
|
||||
USETW(req.wValue, 0);
|
||||
USETW(req.wIndex, 5);
|
||||
USETW(req.wLength, sizeof(wAvail));
|
||||
err = usb2_do_request(udev, NULL, &req, &wAvail);
|
||||
err = usbd_do_request(udev, NULL, &req, &wAvail);
|
||||
if (err) {
|
||||
goto done;
|
||||
}
|
||||
@ -521,11 +521,11 @@ uvisor_cfg_close(struct ucom_softc *ucom)
|
||||
USETW(req.wIndex, 0);
|
||||
USETW(req.wLength, UVISOR_CONNECTION_INFO_SIZE);
|
||||
|
||||
err = usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
err = ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
&req, buffer, 0, 1000);
|
||||
if (err) {
|
||||
DPRINTFN(0, "close notification failed, error=%s\n",
|
||||
usb2_errstr(err));
|
||||
usbd_errstr(err));
|
||||
}
|
||||
}
|
||||
|
||||
@ -534,7 +534,7 @@ uvisor_start_read(struct ucom_softc *ucom)
|
||||
{
|
||||
struct uvisor_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[UVISOR_BULK_DT_RD]);
|
||||
usbd_transfer_start(sc->sc_xfer[UVISOR_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -542,7 +542,7 @@ uvisor_stop_read(struct ucom_softc *ucom)
|
||||
{
|
||||
struct uvisor_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[UVISOR_BULK_DT_RD]);
|
||||
usbd_transfer_stop(sc->sc_xfer[UVISOR_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -550,7 +550,7 @@ uvisor_start_write(struct ucom_softc *ucom)
|
||||
{
|
||||
struct uvisor_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[UVISOR_BULK_DT_WR]);
|
||||
usbd_transfer_start(sc->sc_xfer[UVISOR_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -558,7 +558,7 @@ uvisor_stop_write(struct ucom_softc *ucom)
|
||||
{
|
||||
struct uvisor_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[UVISOR_BULK_DT_WR]);
|
||||
usbd_transfer_stop(sc->sc_xfer[UVISOR_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -571,11 +571,11 @@ uvisor_write_callback(struct usb_xfer *xfer)
|
||||
case USB_ST_SETUP:
|
||||
case USB_ST_TRANSFERRED:
|
||||
tr_setup:
|
||||
if (usb2_com_get_data(&sc->sc_ucom, xfer->frbuffers, 0,
|
||||
if (ucom_get_data(&sc->sc_ucom, xfer->frbuffers, 0,
|
||||
UVISOR_BUFSIZE, &actlen)) {
|
||||
|
||||
xfer->frlengths[0] = actlen;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -596,12 +596,12 @@ uvisor_read_callback(struct usb_xfer *xfer)
|
||||
|
||||
switch (USB_GET_STATE(xfer)) {
|
||||
case USB_ST_TRANSFERRED:
|
||||
usb2_com_put_data(&sc->sc_ucom, xfer->frbuffers, 0, xfer->actlen);
|
||||
ucom_put_data(&sc->sc_ucom, xfer->frbuffers, 0, xfer->actlen);
|
||||
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
|
@ -204,19 +204,19 @@ static const struct usb_config uvscom_config[UVSCOM_N_TRANSFER] = {
|
||||
};
|
||||
|
||||
static const struct ucom_callback uvscom_callback = {
|
||||
.usb2_com_cfg_get_status = &uvscom_cfg_get_status,
|
||||
.usb2_com_cfg_set_dtr = &uvscom_cfg_set_dtr,
|
||||
.usb2_com_cfg_set_rts = &uvscom_cfg_set_rts,
|
||||
.usb2_com_cfg_set_break = &uvscom_cfg_set_break,
|
||||
.usb2_com_cfg_param = &uvscom_cfg_param,
|
||||
.usb2_com_cfg_open = &uvscom_cfg_open,
|
||||
.usb2_com_cfg_close = &uvscom_cfg_close,
|
||||
.usb2_com_pre_open = &uvscom_pre_open,
|
||||
.usb2_com_pre_param = &uvscom_pre_param,
|
||||
.usb2_com_start_read = &uvscom_start_read,
|
||||
.usb2_com_stop_read = &uvscom_stop_read,
|
||||
.usb2_com_start_write = &uvscom_start_write,
|
||||
.usb2_com_stop_write = &uvscom_stop_write,
|
||||
.ucom_cfg_get_status = &uvscom_cfg_get_status,
|
||||
.ucom_cfg_set_dtr = &uvscom_cfg_set_dtr,
|
||||
.ucom_cfg_set_rts = &uvscom_cfg_set_rts,
|
||||
.ucom_cfg_set_break = &uvscom_cfg_set_break,
|
||||
.ucom_cfg_param = &uvscom_cfg_param,
|
||||
.ucom_cfg_open = &uvscom_cfg_open,
|
||||
.ucom_cfg_close = &uvscom_cfg_close,
|
||||
.ucom_pre_open = &uvscom_pre_open,
|
||||
.ucom_pre_param = &uvscom_pre_param,
|
||||
.ucom_start_read = &uvscom_start_read,
|
||||
.ucom_stop_read = &uvscom_stop_read,
|
||||
.ucom_start_write = &uvscom_start_write,
|
||||
.ucom_stop_write = &uvscom_stop_write,
|
||||
};
|
||||
|
||||
static const struct usb_device_id uvscom_devs[] = {
|
||||
@ -266,7 +266,7 @@ uvscom_probe(device_t dev)
|
||||
if (uaa->info.bIfaceIndex != UVSCOM_IFACE_INDEX) {
|
||||
return (ENXIO);
|
||||
}
|
||||
return (usb2_lookup_id_by_uaa(uvscom_devs, sizeof(uvscom_devs), uaa));
|
||||
return (usbd_lookup_id_by_uaa(uvscom_devs, sizeof(uvscom_devs), uaa));
|
||||
}
|
||||
|
||||
static int
|
||||
@ -276,7 +276,7 @@ uvscom_attach(device_t dev)
|
||||
struct uvscom_softc *sc = device_get_softc(dev);
|
||||
int error;
|
||||
|
||||
device_set_usb2_desc(dev);
|
||||
device_set_usb_desc(dev);
|
||||
mtx_init(&sc->sc_mtx, "uvscom", NULL, MTX_DEF);
|
||||
|
||||
sc->sc_udev = uaa->device;
|
||||
@ -286,7 +286,7 @@ uvscom_attach(device_t dev)
|
||||
sc->sc_iface_no = uaa->info.bIfaceNum;
|
||||
sc->sc_iface_index = UVSCOM_IFACE_INDEX;
|
||||
|
||||
error = usb2_transfer_setup(uaa->device, &sc->sc_iface_index,
|
||||
error = usbd_transfer_setup(uaa->device, &sc->sc_iface_index,
|
||||
sc->sc_xfer, uvscom_config, UVSCOM_N_TRANSFER, sc, &sc->sc_mtx);
|
||||
|
||||
if (error) {
|
||||
@ -297,18 +297,18 @@ uvscom_attach(device_t dev)
|
||||
|
||||
/* clear stall at first run */
|
||||
mtx_lock(&sc->sc_mtx);
|
||||
usb2_transfer_set_stall(sc->sc_xfer[UVSCOM_BULK_DT_WR]);
|
||||
usb2_transfer_set_stall(sc->sc_xfer[UVSCOM_BULK_DT_RD]);
|
||||
usbd_transfer_set_stall(sc->sc_xfer[UVSCOM_BULK_DT_WR]);
|
||||
usbd_transfer_set_stall(sc->sc_xfer[UVSCOM_BULK_DT_RD]);
|
||||
mtx_unlock(&sc->sc_mtx);
|
||||
|
||||
error = usb2_com_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc,
|
||||
error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc,
|
||||
&uvscom_callback, &sc->sc_mtx);
|
||||
if (error) {
|
||||
goto detach;
|
||||
}
|
||||
/* start interrupt pipe */
|
||||
mtx_lock(&sc->sc_mtx);
|
||||
usb2_transfer_start(sc->sc_xfer[UVSCOM_INTR_DT_RD]);
|
||||
usbd_transfer_start(sc->sc_xfer[UVSCOM_INTR_DT_RD]);
|
||||
mtx_unlock(&sc->sc_mtx);
|
||||
|
||||
return (0);
|
||||
@ -328,10 +328,10 @@ uvscom_detach(device_t dev)
|
||||
/* stop interrupt pipe */
|
||||
|
||||
if (sc->sc_xfer[UVSCOM_INTR_DT_RD])
|
||||
usb2_transfer_stop(sc->sc_xfer[UVSCOM_INTR_DT_RD]);
|
||||
usbd_transfer_stop(sc->sc_xfer[UVSCOM_INTR_DT_RD]);
|
||||
|
||||
usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
|
||||
usb2_transfer_unsetup(sc->sc_xfer, UVSCOM_N_TRANSFER);
|
||||
ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
|
||||
usbd_transfer_unsetup(sc->sc_xfer, UVSCOM_N_TRANSFER);
|
||||
mtx_destroy(&sc->sc_mtx);
|
||||
|
||||
return (0);
|
||||
@ -347,11 +347,11 @@ uvscom_write_callback(struct usb_xfer *xfer)
|
||||
case USB_ST_SETUP:
|
||||
case USB_ST_TRANSFERRED:
|
||||
tr_setup:
|
||||
if (usb2_com_get_data(&sc->sc_ucom, xfer->frbuffers, 0,
|
||||
if (ucom_get_data(&sc->sc_ucom, xfer->frbuffers, 0,
|
||||
UVSCOM_BULK_BUF_SIZE, &actlen)) {
|
||||
|
||||
xfer->frlengths[0] = actlen;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -372,12 +372,12 @@ uvscom_read_callback(struct usb_xfer *xfer)
|
||||
|
||||
switch (USB_GET_STATE(xfer)) {
|
||||
case USB_ST_TRANSFERRED:
|
||||
usb2_com_put_data(&sc->sc_ucom, xfer->frbuffers, 0, xfer->actlen);
|
||||
ucom_put_data(&sc->sc_ucom, xfer->frbuffers, 0, xfer->actlen);
|
||||
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
@ -400,7 +400,7 @@ uvscom_intr_callback(struct usb_xfer *xfer)
|
||||
case USB_ST_TRANSFERRED:
|
||||
if (xfer->actlen >= 2) {
|
||||
|
||||
usb2_copy_out(xfer->frbuffers, 0, buf, sizeof(buf));
|
||||
usbd_copy_out(xfer->frbuffers, 0, buf, sizeof(buf));
|
||||
|
||||
sc->sc_lsr = 0;
|
||||
sc->sc_msr = 0;
|
||||
@ -425,12 +425,12 @@ uvscom_intr_callback(struct usb_xfer *xfer)
|
||||
* the UCOM layer will ignore this call if the TTY
|
||||
* device is closed!
|
||||
*/
|
||||
usb2_com_status_change(&sc->sc_ucom);
|
||||
ucom_status_change(&sc->sc_ucom);
|
||||
}
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
@ -632,7 +632,7 @@ uvscom_start_read(struct ucom_softc *ucom)
|
||||
{
|
||||
struct uvscom_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[UVSCOM_BULK_DT_RD]);
|
||||
usbd_transfer_start(sc->sc_xfer[UVSCOM_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -640,7 +640,7 @@ uvscom_stop_read(struct ucom_softc *ucom)
|
||||
{
|
||||
struct uvscom_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[UVSCOM_BULK_DT_RD]);
|
||||
usbd_transfer_stop(sc->sc_xfer[UVSCOM_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -648,7 +648,7 @@ uvscom_start_write(struct ucom_softc *ucom)
|
||||
{
|
||||
struct uvscom_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[UVSCOM_BULK_DT_WR]);
|
||||
usbd_transfer_start(sc->sc_xfer[UVSCOM_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -656,7 +656,7 @@ uvscom_stop_write(struct ucom_softc *ucom)
|
||||
{
|
||||
struct uvscom_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[UVSCOM_BULK_DT_WR]);
|
||||
usbd_transfer_stop(sc->sc_xfer[UVSCOM_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -680,11 +680,11 @@ uvscom_cfg_write(struct uvscom_softc *sc, uint8_t index, uint16_t value)
|
||||
USETW(req.wIndex, 0);
|
||||
USETW(req.wLength, 0);
|
||||
|
||||
err = usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
err = ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
&req, NULL, 0, 1000);
|
||||
if (err) {
|
||||
DPRINTFN(0, "device request failed, err=%s "
|
||||
"(ignored)\n", usb2_errstr(err));
|
||||
"(ignored)\n", usbd_errstr(err));
|
||||
}
|
||||
}
|
||||
|
||||
@ -701,11 +701,11 @@ uvscom_cfg_read_status(struct uvscom_softc *sc)
|
||||
USETW(req.wIndex, 0);
|
||||
USETW(req.wLength, 2);
|
||||
|
||||
err = usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
err = ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
|
||||
&req, data, 0, 1000);
|
||||
if (err) {
|
||||
DPRINTFN(0, "device request failed, err=%s "
|
||||
"(ignored)\n", usb2_errstr(err));
|
||||
"(ignored)\n", usbd_errstr(err));
|
||||
}
|
||||
return (data[0] | (data[1] << 8));
|
||||
}
|
||||
|
@ -1307,7 +1307,7 @@ umass_get_proto(struct usb_interface *iface)
|
||||
retval = 0;
|
||||
|
||||
/* Check for a standards compliant device */
|
||||
id = usb2_get_interface_descriptor(iface);
|
||||
id = usbd_get_interface_descriptor(iface);
|
||||
if ((id == NULL) ||
|
||||
(id->bInterfaceClass != UICLASS_MASS)) {
|
||||
goto done;
|
||||
@ -1468,14 +1468,14 @@ umass_attach(device_t dev)
|
||||
snprintf(sc->sc_name, sizeof(sc->sc_name),
|
||||
"%s", device_get_nameunit(dev));
|
||||
|
||||
device_set_usb2_desc(dev);
|
||||
device_set_usb_desc(dev);
|
||||
|
||||
mtx_init(&sc->sc_mtx, device_get_nameunit(dev),
|
||||
NULL, MTX_DEF | MTX_RECURSE);
|
||||
|
||||
/* get interface index */
|
||||
|
||||
id = usb2_get_interface_descriptor(uaa->iface);
|
||||
id = usbd_get_interface_descriptor(uaa->iface);
|
||||
if (id == NULL) {
|
||||
device_printf(dev, "failed to get "
|
||||
"interface number\n");
|
||||
@ -1526,7 +1526,7 @@ umass_attach(device_t dev)
|
||||
#endif
|
||||
|
||||
if (sc->sc_quirks & ALT_IFACE_1) {
|
||||
err = usb2_set_alt_interface_index
|
||||
err = usbd_set_alt_interface_index
|
||||
(uaa->device, uaa->info.bIfaceIndex, 1);
|
||||
|
||||
if (err) {
|
||||
@ -1539,7 +1539,7 @@ umass_attach(device_t dev)
|
||||
|
||||
if (sc->sc_proto & UMASS_PROTO_BBB) {
|
||||
|
||||
err = usb2_transfer_setup(uaa->device,
|
||||
err = usbd_transfer_setup(uaa->device,
|
||||
&uaa->info.bIfaceIndex, sc->sc_xfer, umass_bbb_config,
|
||||
UMASS_T_BBB_MAX, sc, &sc->sc_mtx);
|
||||
|
||||
@ -1548,7 +1548,7 @@ umass_attach(device_t dev)
|
||||
|
||||
} else if (sc->sc_proto & (UMASS_PROTO_CBI | UMASS_PROTO_CBI_I)) {
|
||||
|
||||
err = usb2_transfer_setup(uaa->device,
|
||||
err = usbd_transfer_setup(uaa->device,
|
||||
&uaa->info.bIfaceIndex, sc->sc_xfer, umass_cbi_config,
|
||||
(sc->sc_proto & UMASS_PROTO_CBI_I) ?
|
||||
UMASS_T_CBI_MAX : (UMASS_T_CBI_MAX - 2), sc,
|
||||
@ -1563,7 +1563,7 @@ umass_attach(device_t dev)
|
||||
|
||||
if (err) {
|
||||
device_printf(dev, "could not setup required "
|
||||
"transfers, %s\n", usb2_errstr(err));
|
||||
"transfers, %s\n", usbd_errstr(err));
|
||||
goto detach;
|
||||
}
|
||||
sc->sc_transform =
|
||||
@ -1594,7 +1594,7 @@ umass_attach(device_t dev)
|
||||
* some devices need a delay after that the configuration value is
|
||||
* set to function properly:
|
||||
*/
|
||||
usb2_pause_mtx(NULL, hz);
|
||||
usb_pause_mtx(NULL, hz);
|
||||
|
||||
/* register the SIM */
|
||||
err = umass_cam_attach_sim(sc);
|
||||
@ -1622,7 +1622,7 @@ umass_detach(device_t dev)
|
||||
|
||||
/* teardown our statemachine */
|
||||
|
||||
usb2_transfer_unsetup(sc->sc_xfer, UMASS_T_MAX);
|
||||
usbd_transfer_unsetup(sc->sc_xfer, UMASS_T_MAX);
|
||||
|
||||
#if (__FreeBSD_version >= 700037)
|
||||
mtx_lock(&sc->sc_mtx);
|
||||
@ -1653,7 +1653,7 @@ umass_init_shuttle(struct umass_softc *sc)
|
||||
req.wIndex[0] = sc->sc_iface_no;
|
||||
req.wIndex[1] = 0;
|
||||
USETW(req.wLength, sizeof(status));
|
||||
err = usb2_do_request(sc->sc_udev, NULL, &req, &status);
|
||||
err = usbd_do_request(sc->sc_udev, NULL, &req, &status);
|
||||
|
||||
DPRINTF(sc, UDMASS_GEN, "Shuttle init returned 0x%02x%02x\n",
|
||||
status[0], status[1]);
|
||||
@ -1671,7 +1671,7 @@ umass_transfer_start(struct umass_softc *sc, uint8_t xfer_index)
|
||||
|
||||
if (sc->sc_xfer[xfer_index]) {
|
||||
sc->sc_last_xfer_index = xfer_index;
|
||||
usb2_transfer_start(sc->sc_xfer[xfer_index]);
|
||||
usbd_transfer_start(sc->sc_xfer[xfer_index]);
|
||||
} else {
|
||||
umass_cancel_ccb(sc);
|
||||
}
|
||||
@ -1685,7 +1685,7 @@ umass_reset(struct umass_softc *sc)
|
||||
/*
|
||||
* stop the last transfer, if not already stopped:
|
||||
*/
|
||||
usb2_transfer_stop(sc->sc_xfer[sc->sc_last_xfer_index]);
|
||||
usbd_transfer_stop(sc->sc_xfer[sc->sc_last_xfer_index]);
|
||||
umass_transfer_start(sc, 0);
|
||||
}
|
||||
|
||||
@ -1715,7 +1715,7 @@ umass_tr_error(struct usb_xfer *xfer)
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
|
||||
DPRINTF(sc, UDMASS_GEN, "transfer error, %s -> "
|
||||
"reset\n", usb2_errstr(xfer->error));
|
||||
"reset\n", usbd_errstr(xfer->error));
|
||||
}
|
||||
umass_cancel_ccb(sc);
|
||||
}
|
||||
@ -1759,11 +1759,11 @@ umass_t_bbb_reset1_callback(struct usb_xfer *xfer)
|
||||
req.wIndex[1] = 0;
|
||||
USETW(req.wLength, 0);
|
||||
|
||||
usb2_copy_in(xfer->frbuffers, 0, &req, sizeof(req));
|
||||
usbd_copy_in(xfer->frbuffers, 0, &req, sizeof(req));
|
||||
|
||||
xfer->frlengths[0] = sizeof(req);
|
||||
xfer->nframes = 1;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
@ -1801,7 +1801,7 @@ umass_t_bbb_data_clear_stall_callback(struct usb_xfer *xfer,
|
||||
return;
|
||||
|
||||
case USB_ST_SETUP:
|
||||
if (usb2_clear_stall_callback(xfer, sc->sc_xfer[stall_xfer])) {
|
||||
if (usbd_clear_stall_callback(xfer, sc->sc_xfer[stall_xfer])) {
|
||||
goto tr_transferred;
|
||||
}
|
||||
return;
|
||||
@ -1881,10 +1881,10 @@ umass_t_bbb_command_callback(struct usb_xfer *xfer)
|
||||
|
||||
DIF(UDMASS_BBB, umass_bbb_dump_cbw(sc, &sc->cbw));
|
||||
|
||||
usb2_copy_in(xfer->frbuffers, 0, &sc->cbw, sizeof(sc->cbw));
|
||||
usbd_copy_in(xfer->frbuffers, 0, &sc->cbw, sizeof(sc->cbw));
|
||||
|
||||
xfer->frlengths[0] = sizeof(sc->cbw);
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -1904,7 +1904,7 @@ umass_t_bbb_data_read_callback(struct usb_xfer *xfer)
|
||||
switch (USB_GET_STATE(xfer)) {
|
||||
case USB_ST_TRANSFERRED:
|
||||
if (!xfer->flags.ext_buffer) {
|
||||
usb2_copy_out(xfer->frbuffers, 0,
|
||||
usbd_copy_out(xfer->frbuffers, 0,
|
||||
sc->sc_transfer.data_ptr, xfer->actlen);
|
||||
}
|
||||
sc->sc_transfer.data_rem -= xfer->actlen;
|
||||
@ -1930,9 +1930,9 @@ umass_t_bbb_data_read_callback(struct usb_xfer *xfer)
|
||||
xfer->frlengths[0] = max_bulk;
|
||||
|
||||
if (xfer->flags.ext_buffer) {
|
||||
usb2_set_frame_data(xfer, sc->sc_transfer.data_ptr, 0);
|
||||
usbd_set_frame_data(xfer, sc->sc_transfer.data_ptr, 0);
|
||||
}
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
@ -1984,13 +1984,13 @@ umass_t_bbb_data_write_callback(struct usb_xfer *xfer)
|
||||
xfer->frlengths[0] = max_bulk;
|
||||
|
||||
if (xfer->flags.ext_buffer) {
|
||||
usb2_set_frame_data(xfer, sc->sc_transfer.data_ptr, 0);
|
||||
usbd_set_frame_data(xfer, sc->sc_transfer.data_ptr, 0);
|
||||
} else {
|
||||
usb2_copy_in(xfer->frbuffers, 0,
|
||||
usbd_copy_in(xfer->frbuffers, 0,
|
||||
sc->sc_transfer.data_ptr, max_bulk);
|
||||
}
|
||||
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
@ -2031,7 +2031,7 @@ umass_t_bbb_status_callback(struct usb_xfer *xfer)
|
||||
if (xfer->actlen < sizeof(sc->csw)) {
|
||||
bzero(&sc->csw, sizeof(sc->csw));
|
||||
}
|
||||
usb2_copy_out(xfer->frbuffers, 0, &sc->csw, xfer->actlen);
|
||||
usbd_copy_out(xfer->frbuffers, 0, &sc->csw, xfer->actlen);
|
||||
|
||||
DIF(UDMASS_BBB, umass_bbb_dump_csw(sc, &sc->csw));
|
||||
|
||||
@ -2105,13 +2105,13 @@ umass_t_bbb_status_callback(struct usb_xfer *xfer)
|
||||
|
||||
case USB_ST_SETUP:
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
|
||||
default:
|
||||
tr_error:
|
||||
DPRINTF(sc, UDMASS_BBB, "Failed to read CSW: %s, try %d\n",
|
||||
usb2_errstr(xfer->error), sc->sc_status_try);
|
||||
usbd_errstr(xfer->error), sc->sc_status_try);
|
||||
|
||||
if ((xfer->error == USB_ERR_CANCELLED) ||
|
||||
(sc->sc_status_try)) {
|
||||
@ -2150,7 +2150,7 @@ umass_command_start(struct umass_softc *sc, uint8_t dir,
|
||||
sc->sc_transfer.ccb = ccb;
|
||||
|
||||
if (sc->sc_xfer[sc->sc_last_xfer_index]) {
|
||||
usb2_transfer_start(sc->sc_xfer[sc->sc_last_xfer_index]);
|
||||
usbd_transfer_start(sc->sc_xfer[sc->sc_last_xfer_index]);
|
||||
} else {
|
||||
ccb->ccb_h.status = CAM_TID_INVALID;
|
||||
xpt_done(ccb);
|
||||
@ -2172,13 +2172,13 @@ umass_bbb_get_max_lun(struct umass_softc *sc)
|
||||
req.wIndex[1] = 0;
|
||||
USETW(req.wLength, 1);
|
||||
|
||||
err = usb2_do_request(sc->sc_udev, NULL, &req, &buf);
|
||||
err = usbd_do_request(sc->sc_udev, NULL, &req, &buf);
|
||||
if (err) {
|
||||
buf = 0;
|
||||
|
||||
/* Device doesn't support Get Max Lun request. */
|
||||
printf("%s: Get Max Lun not supported (%s)\n",
|
||||
sc->sc_name, usb2_errstr(err));
|
||||
sc->sc_name, usbd_errstr(err));
|
||||
}
|
||||
return (buf);
|
||||
}
|
||||
@ -2255,13 +2255,13 @@ umass_t_cbi_reset1_callback(struct usb_xfer *xfer)
|
||||
buf[i] = 0xff;
|
||||
}
|
||||
|
||||
usb2_copy_in(xfer->frbuffers, 0, &req, sizeof(req));
|
||||
usb2_copy_in(xfer->frbuffers + 1, 0, buf, sizeof(buf));
|
||||
usbd_copy_in(xfer->frbuffers, 0, &req, sizeof(req));
|
||||
usbd_copy_in(xfer->frbuffers + 1, 0, buf, sizeof(buf));
|
||||
|
||||
xfer->frlengths[0] = sizeof(req);
|
||||
xfer->frlengths[1] = sizeof(buf);
|
||||
xfer->nframes = 2;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
@ -2315,7 +2315,7 @@ umass_t_cbi_data_clear_stall_callback(struct usb_xfer *xfer,
|
||||
return;
|
||||
|
||||
case USB_ST_SETUP:
|
||||
if (usb2_clear_stall_callback(xfer, sc->sc_xfer[stall_xfer])) {
|
||||
if (usbd_clear_stall_callback(xfer, sc->sc_xfer[stall_xfer])) {
|
||||
goto tr_transferred; /* should not happen */
|
||||
}
|
||||
return;
|
||||
@ -2365,8 +2365,8 @@ umass_t_cbi_command_callback(struct usb_xfer *xfer)
|
||||
req.wLength[0] = sc->sc_transfer.cmd_len;
|
||||
req.wLength[1] = 0;
|
||||
|
||||
usb2_copy_in(xfer->frbuffers, 0, &req, sizeof(req));
|
||||
usb2_copy_in(xfer->frbuffers + 1, 0, sc->sc_transfer.cmd_data,
|
||||
usbd_copy_in(xfer->frbuffers, 0, &req, sizeof(req));
|
||||
usbd_copy_in(xfer->frbuffers + 1, 0, sc->sc_transfer.cmd_data,
|
||||
sc->sc_transfer.cmd_len);
|
||||
|
||||
xfer->frlengths[0] = sizeof(req);
|
||||
@ -2378,7 +2378,7 @@ umass_t_cbi_command_callback(struct usb_xfer *xfer)
|
||||
sc->sc_transfer.cmd_data,
|
||||
sc->sc_transfer.cmd_len));
|
||||
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -2398,7 +2398,7 @@ umass_t_cbi_data_read_callback(struct usb_xfer *xfer)
|
||||
switch (USB_GET_STATE(xfer)) {
|
||||
case USB_ST_TRANSFERRED:
|
||||
if (!xfer->flags.ext_buffer) {
|
||||
usb2_copy_out(xfer->frbuffers, 0,
|
||||
usbd_copy_out(xfer->frbuffers, 0,
|
||||
sc->sc_transfer.data_ptr, xfer->actlen);
|
||||
}
|
||||
sc->sc_transfer.data_rem -= xfer->actlen;
|
||||
@ -2423,10 +2423,10 @@ umass_t_cbi_data_read_callback(struct usb_xfer *xfer)
|
||||
xfer->timeout = sc->sc_transfer.data_timeout;
|
||||
|
||||
if (xfer->flags.ext_buffer) {
|
||||
usb2_set_frame_data(xfer, sc->sc_transfer.data_ptr, 0);
|
||||
usbd_set_frame_data(xfer, sc->sc_transfer.data_ptr, 0);
|
||||
}
|
||||
xfer->frlengths[0] = max_bulk;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
@ -2478,14 +2478,14 @@ umass_t_cbi_data_write_callback(struct usb_xfer *xfer)
|
||||
xfer->timeout = sc->sc_transfer.data_timeout;
|
||||
|
||||
if (xfer->flags.ext_buffer) {
|
||||
usb2_set_frame_data(xfer, sc->sc_transfer.data_ptr, 0);
|
||||
usbd_set_frame_data(xfer, sc->sc_transfer.data_ptr, 0);
|
||||
} else {
|
||||
usb2_copy_in(xfer->frbuffers, 0,
|
||||
usbd_copy_in(xfer->frbuffers, 0,
|
||||
sc->sc_transfer.data_ptr, max_bulk);
|
||||
}
|
||||
|
||||
xfer->frlengths[0] = max_bulk;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
@ -2521,7 +2521,7 @@ umass_t_cbi_status_callback(struct usb_xfer *xfer)
|
||||
if (xfer->actlen < sizeof(sc->sbl)) {
|
||||
goto tr_setup;
|
||||
}
|
||||
usb2_copy_out(xfer->frbuffers, 0, &sc->sbl, sizeof(sc->sbl));
|
||||
usbd_copy_out(xfer->frbuffers, 0, &sc->sbl, sizeof(sc->sbl));
|
||||
|
||||
residue = (sc->sc_transfer.data_len -
|
||||
sc->sc_transfer.actlen);
|
||||
@ -2585,12 +2585,12 @@ umass_t_cbi_status_callback(struct usb_xfer *xfer)
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
DPRINTF(sc, UDMASS_CBI, "Failed to read CSW: %s\n",
|
||||
usb2_errstr(xfer->error));
|
||||
usbd_errstr(xfer->error));
|
||||
umass_tr_error(xfer);
|
||||
return;
|
||||
|
||||
@ -2976,7 +2976,7 @@ umass_cam_action(struct cam_sim *sim, union ccb *ccb)
|
||||
if (sc->sc_quirks & FLOPPY_SPEED) {
|
||||
cpi->base_transfer_speed =
|
||||
UMASS_FLOPPY_TRANSFER_SPEED;
|
||||
} else if (usb2_get_speed(sc->sc_udev) ==
|
||||
} else if (usbd_get_speed(sc->sc_udev) ==
|
||||
USB_SPEED_HIGH) {
|
||||
cpi->base_transfer_speed =
|
||||
UMASS_HIGH_TRANSFER_SPEED;
|
||||
@ -3081,7 +3081,7 @@ umass_cam_poll(struct cam_sim *sim)
|
||||
|
||||
DPRINTF(sc, UDMASS_SCSI, "CAM poll\n");
|
||||
|
||||
usb2_do_poll(sc->sc_xfer, UMASS_T_MAX);
|
||||
usbd_do_poll(sc->sc_xfer, UMASS_T_MAX);
|
||||
}
|
||||
|
||||
|
||||
|
@ -209,7 +209,7 @@ urio_attach(device_t dev)
|
||||
struct urio_softc *sc = device_get_softc(dev);
|
||||
int error;
|
||||
|
||||
device_set_usb2_desc(dev);
|
||||
device_set_usb_desc(dev);
|
||||
|
||||
sc->sc_udev = uaa->device;
|
||||
|
||||
@ -218,16 +218,16 @@ urio_attach(device_t dev)
|
||||
snprintf(sc->sc_name, sizeof(sc->sc_name),
|
||||
"%s", device_get_nameunit(dev));
|
||||
|
||||
error = usb2_transfer_setup(uaa->device,
|
||||
error = usbd_transfer_setup(uaa->device,
|
||||
&uaa->info.bIfaceIndex, sc->sc_xfer,
|
||||
urio_config, URIO_T_MAX, sc, &sc->sc_mtx);
|
||||
|
||||
if (error) {
|
||||
DPRINTF("error=%s\n", usb2_errstr(error));
|
||||
DPRINTF("error=%s\n", usbd_errstr(error));
|
||||
goto detach;
|
||||
}
|
||||
|
||||
error = usb2_fifo_attach(uaa->device, sc, &sc->sc_mtx,
|
||||
error = usb_fifo_attach(uaa->device, sc, &sc->sc_mtx,
|
||||
&urio_fifo_methods, &sc->sc_fifo,
|
||||
device_get_unit(dev), 0 - 1, uaa->info.bIfaceIndex,
|
||||
UID_ROOT, GID_OPERATOR, 0644);
|
||||
@ -252,14 +252,14 @@ urio_write_callback(struct usb_xfer *xfer)
|
||||
case USB_ST_TRANSFERRED:
|
||||
case USB_ST_SETUP:
|
||||
if (sc->sc_flags & URIO_FLAG_WRITE_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer[URIO_T_WR_CS]);
|
||||
usbd_transfer_start(sc->sc_xfer[URIO_T_WR_CS]);
|
||||
return;
|
||||
}
|
||||
if (usb2_fifo_get_data(f, xfer->frbuffers, 0,
|
||||
if (usb_fifo_get_data(f, xfer->frbuffers, 0,
|
||||
xfer->max_data_length, &actlen, 0)) {
|
||||
|
||||
xfer->frlengths[0] = actlen;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -267,7 +267,7 @@ urio_write_callback(struct usb_xfer *xfer)
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
/* try to clear stall first */
|
||||
sc->sc_flags |= URIO_FLAG_WRITE_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer[URIO_T_WR_CS]);
|
||||
usbd_transfer_start(sc->sc_xfer[URIO_T_WR_CS]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -279,10 +279,10 @@ urio_write_clear_stall_callback(struct usb_xfer *xfer)
|
||||
struct urio_softc *sc = xfer->priv_sc;
|
||||
struct usb_xfer *xfer_other = sc->sc_xfer[URIO_T_WR];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
if (usbd_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
sc->sc_flags &= ~URIO_FLAG_WRITE_STALL;
|
||||
usb2_transfer_start(xfer_other);
|
||||
usbd_transfer_start(xfer_other);
|
||||
}
|
||||
}
|
||||
|
||||
@ -294,17 +294,17 @@ urio_read_callback(struct usb_xfer *xfer)
|
||||
|
||||
switch (USB_GET_STATE(xfer)) {
|
||||
case USB_ST_TRANSFERRED:
|
||||
usb2_fifo_put_data(f, xfer->frbuffers, 0,
|
||||
usb_fifo_put_data(f, xfer->frbuffers, 0,
|
||||
xfer->actlen, 1);
|
||||
|
||||
case USB_ST_SETUP:
|
||||
if (sc->sc_flags & URIO_FLAG_READ_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer[URIO_T_RD_CS]);
|
||||
usbd_transfer_start(sc->sc_xfer[URIO_T_RD_CS]);
|
||||
return;
|
||||
}
|
||||
if (usb2_fifo_put_bytes_max(f) != 0) {
|
||||
if (usb_fifo_put_bytes_max(f) != 0) {
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -312,7 +312,7 @@ urio_read_callback(struct usb_xfer *xfer)
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
/* try to clear stall first */
|
||||
sc->sc_flags |= URIO_FLAG_READ_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer[URIO_T_RD_CS]);
|
||||
usbd_transfer_start(sc->sc_xfer[URIO_T_RD_CS]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -324,10 +324,10 @@ urio_read_clear_stall_callback(struct usb_xfer *xfer)
|
||||
struct urio_softc *sc = xfer->priv_sc;
|
||||
struct usb_xfer *xfer_other = sc->sc_xfer[URIO_T_RD];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
if (usbd_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
sc->sc_flags &= ~URIO_FLAG_READ_STALL;
|
||||
usb2_transfer_start(xfer_other);
|
||||
usbd_transfer_start(xfer_other);
|
||||
}
|
||||
}
|
||||
|
||||
@ -336,7 +336,7 @@ urio_start_read(struct usb_fifo *fifo)
|
||||
{
|
||||
struct urio_softc *sc = fifo->priv_sc0;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[URIO_T_RD]);
|
||||
usbd_transfer_start(sc->sc_xfer[URIO_T_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -344,8 +344,8 @@ urio_stop_read(struct usb_fifo *fifo)
|
||||
{
|
||||
struct urio_softc *sc = fifo->priv_sc0;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[URIO_T_RD_CS]);
|
||||
usb2_transfer_stop(sc->sc_xfer[URIO_T_RD]);
|
||||
usbd_transfer_stop(sc->sc_xfer[URIO_T_RD_CS]);
|
||||
usbd_transfer_stop(sc->sc_xfer[URIO_T_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -353,7 +353,7 @@ urio_start_write(struct usb_fifo *fifo)
|
||||
{
|
||||
struct urio_softc *sc = fifo->priv_sc0;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[URIO_T_WR]);
|
||||
usbd_transfer_start(sc->sc_xfer[URIO_T_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -361,8 +361,8 @@ urio_stop_write(struct usb_fifo *fifo)
|
||||
{
|
||||
struct urio_softc *sc = fifo->priv_sc0;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[URIO_T_WR_CS]);
|
||||
usb2_transfer_stop(sc->sc_xfer[URIO_T_WR]);
|
||||
usbd_transfer_stop(sc->sc_xfer[URIO_T_WR_CS]);
|
||||
usbd_transfer_stop(sc->sc_xfer[URIO_T_WR]);
|
||||
}
|
||||
|
||||
static int
|
||||
@ -379,7 +379,7 @@ urio_open(struct usb_fifo *fifo, int fflags)
|
||||
sc->sc_flags |= URIO_FLAG_READ_STALL;
|
||||
mtx_unlock(&sc->sc_mtx);
|
||||
|
||||
if (usb2_fifo_alloc_buffer(fifo,
|
||||
if (usb_fifo_alloc_buffer(fifo,
|
||||
sc->sc_xfer[URIO_T_RD]->max_data_length,
|
||||
URIO_IFQ_MAXLEN)) {
|
||||
return (ENOMEM);
|
||||
@ -389,7 +389,7 @@ urio_open(struct usb_fifo *fifo, int fflags)
|
||||
/* clear stall first */
|
||||
sc->sc_flags |= URIO_FLAG_WRITE_STALL;
|
||||
|
||||
if (usb2_fifo_alloc_buffer(fifo,
|
||||
if (usb_fifo_alloc_buffer(fifo,
|
||||
sc->sc_xfer[URIO_T_WR]->max_data_length,
|
||||
URIO_IFQ_MAXLEN)) {
|
||||
return (ENOMEM);
|
||||
@ -402,7 +402,7 @@ static void
|
||||
urio_close(struct usb_fifo *fifo, int fflags)
|
||||
{
|
||||
if (fflags & (FREAD | FWRITE)) {
|
||||
usb2_fifo_free_buffer(fifo);
|
||||
usb_fifo_free_buffer(fifo);
|
||||
}
|
||||
}
|
||||
|
||||
@ -465,9 +465,9 @@ urio_detach(device_t dev)
|
||||
|
||||
DPRINTF("\n");
|
||||
|
||||
usb2_fifo_detach(&sc->sc_fifo);
|
||||
usb_fifo_detach(&sc->sc_fifo);
|
||||
|
||||
usb2_transfer_unsetup(sc->sc_xfer, URIO_T_MAX);
|
||||
usbd_transfer_unsetup(sc->sc_xfer, URIO_T_MAX);
|
||||
|
||||
mtx_destroy(&sc->sc_mtx);
|
||||
|
||||
|
@ -325,7 +325,7 @@ ustorage_fs_probe(device_t dev)
|
||||
return (ENXIO);
|
||||
}
|
||||
/* Check for a standards compliant device */
|
||||
id = usb2_get_interface_descriptor(uaa->iface);
|
||||
id = usbd_get_interface_descriptor(uaa->iface);
|
||||
if ((id == NULL) ||
|
||||
(id->bInterfaceClass != UICLASS_MASS) ||
|
||||
(id->bInterfaceSubClass != UISUBCLASS_SCSI) ||
|
||||
@ -371,14 +371,14 @@ ustorage_fs_attach(device_t dev)
|
||||
sc->sc_lun[0].removable = 1;
|
||||
}
|
||||
|
||||
device_set_usb2_desc(dev);
|
||||
device_set_usb_desc(dev);
|
||||
|
||||
mtx_init(&sc->sc_mtx, "USTORAGE_FS lock",
|
||||
NULL, (MTX_DEF | MTX_RECURSE));
|
||||
|
||||
/* get interface index */
|
||||
|
||||
id = usb2_get_interface_descriptor(uaa->iface);
|
||||
id = usbd_get_interface_descriptor(uaa->iface);
|
||||
if (id == NULL) {
|
||||
device_printf(dev, "failed to get "
|
||||
"interface number\n");
|
||||
@ -386,12 +386,12 @@ ustorage_fs_attach(device_t dev)
|
||||
}
|
||||
sc->sc_iface_no = id->bInterfaceNumber;
|
||||
|
||||
err = usb2_transfer_setup(uaa->device,
|
||||
err = usbd_transfer_setup(uaa->device,
|
||||
&uaa->info.bIfaceIndex, sc->sc_xfer, ustorage_fs_bbb_config,
|
||||
USTORAGE_FS_T_BBB_MAX, sc, &sc->sc_mtx);
|
||||
if (err) {
|
||||
device_printf(dev, "could not setup required "
|
||||
"transfers, %s\n", usb2_errstr(err));
|
||||
"transfers, %s\n", usbd_errstr(err));
|
||||
goto detach;
|
||||
}
|
||||
/* start Mass Storage State Machine */
|
||||
@ -414,7 +414,7 @@ ustorage_fs_detach(device_t dev)
|
||||
|
||||
/* teardown our statemachine */
|
||||
|
||||
usb2_transfer_unsetup(sc->sc_xfer, USTORAGE_FS_T_BBB_MAX);
|
||||
usbd_transfer_unsetup(sc->sc_xfer, USTORAGE_FS_T_BBB_MAX);
|
||||
|
||||
mtx_destroy(&sc->sc_mtx);
|
||||
|
||||
@ -444,16 +444,16 @@ ustorage_fs_transfer_start(struct ustorage_fs_softc *sc, uint8_t xfer_index)
|
||||
{
|
||||
if (sc->sc_xfer[xfer_index]) {
|
||||
sc->sc_last_xfer_index = xfer_index;
|
||||
usb2_transfer_start(sc->sc_xfer[xfer_index]);
|
||||
usbd_transfer_start(sc->sc_xfer[xfer_index]);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ustorage_fs_transfer_stop(struct ustorage_fs_softc *sc)
|
||||
{
|
||||
usb2_transfer_stop(sc->sc_xfer[sc->sc_last_xfer_index]);
|
||||
usbd_transfer_stop(sc->sc_xfer[sc->sc_last_xfer_index]);
|
||||
mtx_unlock(&sc->sc_mtx);
|
||||
usb2_transfer_drain(sc->sc_xfer[sc->sc_last_xfer_index]);
|
||||
usbd_transfer_drain(sc->sc_xfer[sc->sc_last_xfer_index]);
|
||||
mtx_lock(&sc->sc_mtx);
|
||||
}
|
||||
|
||||
@ -585,8 +585,8 @@ ustorage_fs_t_bbb_command_callback(struct usb_xfer *xfer)
|
||||
}
|
||||
|
||||
xfer->frlengths[0] = sizeof(sc->sc_cbw);
|
||||
usb2_set_frame_data(xfer, &sc->sc_cbw, 0);
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_set_frame_data(xfer, &sc->sc_cbw, 0);
|
||||
usbd_transfer_submit(xfer);
|
||||
break;
|
||||
|
||||
default: /* Error */
|
||||
@ -654,7 +654,7 @@ ustorage_fs_t_bbb_data_dump_callback(struct usb_xfer *xfer)
|
||||
xfer->flags.stall_pipe = 0;
|
||||
}
|
||||
xfer->frlengths[0] = max_bulk;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
break;
|
||||
|
||||
default: /* Error */
|
||||
@ -708,8 +708,8 @@ ustorage_fs_t_bbb_data_read_callback(struct usb_xfer *xfer)
|
||||
}
|
||||
|
||||
xfer->frlengths[0] = max_bulk;
|
||||
usb2_set_frame_data(xfer, sc->sc_transfer.data_ptr, 0);
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_set_frame_data(xfer, sc->sc_transfer.data_ptr, 0);
|
||||
usbd_transfer_submit(xfer);
|
||||
break;
|
||||
|
||||
default: /* Error */
|
||||
@ -767,8 +767,8 @@ ustorage_fs_t_bbb_data_write_callback(struct usb_xfer *xfer)
|
||||
}
|
||||
|
||||
xfer->frlengths[0] = max_bulk;
|
||||
usb2_set_frame_data(xfer, sc->sc_transfer.data_ptr, 0);
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_set_frame_data(xfer, sc->sc_transfer.data_ptr, 0);
|
||||
usbd_transfer_submit(xfer);
|
||||
break;
|
||||
|
||||
default: /* Error */
|
||||
@ -812,8 +812,8 @@ ustorage_fs_t_bbb_status_callback(struct usb_xfer *xfer)
|
||||
}
|
||||
|
||||
xfer->frlengths[0] = sizeof(sc->sc_csw);
|
||||
usb2_set_frame_data(xfer, &sc->sc_csw, 0);
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_set_frame_data(xfer, &sc->sc_csw, 0);
|
||||
usbd_transfer_submit(xfer);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include <dev/usb/usb_mfunc.h>
|
||||
#include <dev/usb/usb_error.h>
|
||||
|
||||
#define USB_DEBUG_VAR usb2_debug
|
||||
#define USB_DEBUG_VAR usb_debug
|
||||
|
||||
#include <dev/usb/usb_core.h>
|
||||
#include <dev/usb/usb_busdma.h>
|
||||
@ -54,50 +54,50 @@ MODULE_VERSION(usb_template, 1);
|
||||
|
||||
/* function prototypes */
|
||||
|
||||
static void usb2_make_raw_desc(struct usb_temp_setup *, const uint8_t *);
|
||||
static void usb2_make_endpoint_desc(struct usb_temp_setup *,
|
||||
static void usb_make_raw_desc(struct usb_temp_setup *, const uint8_t *);
|
||||
static void usb_make_endpoint_desc(struct usb_temp_setup *,
|
||||
const struct usb_temp_endpoint_desc *);
|
||||
static void usb2_make_interface_desc(struct usb_temp_setup *,
|
||||
static void usb_make_interface_desc(struct usb_temp_setup *,
|
||||
const struct usb_temp_interface_desc *);
|
||||
static void usb2_make_config_desc(struct usb_temp_setup *,
|
||||
static void usb_make_config_desc(struct usb_temp_setup *,
|
||||
const struct usb_temp_config_desc *);
|
||||
static void usb2_make_device_desc(struct usb_temp_setup *,
|
||||
static void usb_make_device_desc(struct usb_temp_setup *,
|
||||
const struct usb_temp_device_desc *);
|
||||
static uint8_t usb2_hw_ep_match(const struct usb_hw_ep_profile *, uint8_t,
|
||||
static uint8_t usb_hw_ep_match(const struct usb_hw_ep_profile *, uint8_t,
|
||||
uint8_t);
|
||||
static uint8_t usb2_hw_ep_find_match(struct usb_hw_ep_scratch *,
|
||||
static uint8_t usb_hw_ep_find_match(struct usb_hw_ep_scratch *,
|
||||
struct usb_hw_ep_scratch_sub *, uint8_t);
|
||||
static uint8_t usb2_hw_ep_get_needs(struct usb_hw_ep_scratch *, uint8_t,
|
||||
static uint8_t usb_hw_ep_get_needs(struct usb_hw_ep_scratch *, uint8_t,
|
||||
uint8_t);
|
||||
static usb_error_t usb2_hw_ep_resolve(struct usb_device *,
|
||||
static usb_error_t usb_hw_ep_resolve(struct usb_device *,
|
||||
struct usb_descriptor *);
|
||||
static const struct usb_temp_device_desc *usb2_temp_get_tdd(struct usb_device *);
|
||||
static void *usb2_temp_get_device_desc(struct usb_device *);
|
||||
static void *usb2_temp_get_qualifier_desc(struct usb_device *);
|
||||
static void *usb2_temp_get_config_desc(struct usb_device *, uint16_t *,
|
||||
static const struct usb_temp_device_desc *usb_temp_get_tdd(struct usb_device *);
|
||||
static void *usb_temp_get_device_desc(struct usb_device *);
|
||||
static void *usb_temp_get_qualifier_desc(struct usb_device *);
|
||||
static void *usb_temp_get_config_desc(struct usb_device *, uint16_t *,
|
||||
uint8_t);
|
||||
static const void *usb2_temp_get_string_desc(struct usb_device *, uint16_t,
|
||||
static const void *usb_temp_get_string_desc(struct usb_device *, uint16_t,
|
||||
uint8_t);
|
||||
static const void *usb2_temp_get_vendor_desc(struct usb_device *,
|
||||
static const void *usb_temp_get_vendor_desc(struct usb_device *,
|
||||
const struct usb_device_request *);
|
||||
static const void *usb2_temp_get_hub_desc(struct usb_device *);
|
||||
static usb_error_t usb2_temp_get_desc(struct usb_device *,
|
||||
static const void *usb_temp_get_hub_desc(struct usb_device *);
|
||||
static usb_error_t usb_temp_get_desc(struct usb_device *,
|
||||
struct usb_device_request *, const void **, uint16_t *);
|
||||
static usb_error_t usb_temp_setup(struct usb_device *,
|
||||
const struct usb_temp_device_desc *);
|
||||
static void usb2_temp_unsetup(struct usb_device *);
|
||||
static usb_error_t usb2_temp_setup_by_index(struct usb_device *,
|
||||
static void usb_temp_unsetup(struct usb_device *);
|
||||
static usb_error_t usb_temp_setup_by_index(struct usb_device *,
|
||||
uint16_t index);
|
||||
static void usb2_temp_init(void *);
|
||||
static void usb_temp_init(void *);
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_make_raw_desc
|
||||
* usb_make_raw_desc
|
||||
*
|
||||
* This function will insert a raw USB descriptor into the generated
|
||||
* USB configuration.
|
||||
*------------------------------------------------------------------------*/
|
||||
static void
|
||||
usb2_make_raw_desc(struct usb_temp_setup *temp,
|
||||
usb_make_raw_desc(struct usb_temp_setup *temp,
|
||||
const uint8_t *raw)
|
||||
{
|
||||
void *dst;
|
||||
@ -132,14 +132,14 @@ usb2_make_raw_desc(struct usb_temp_setup *temp,
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_make_endpoint_desc
|
||||
* usb_make_endpoint_desc
|
||||
*
|
||||
* This function will generate an USB endpoint descriptor from the
|
||||
* given USB template endpoint descriptor, which will be inserted into
|
||||
* the USB configuration.
|
||||
*------------------------------------------------------------------------*/
|
||||
static void
|
||||
usb2_make_endpoint_desc(struct usb_temp_setup *temp,
|
||||
usb_make_endpoint_desc(struct usb_temp_setup *temp,
|
||||
const struct usb_temp_endpoint_desc *ted)
|
||||
{
|
||||
struct usb_endpoint_descriptor *ed;
|
||||
@ -158,7 +158,7 @@ usb2_make_endpoint_desc(struct usb_temp_setup *temp,
|
||||
rd = ted->ppRawDesc;
|
||||
if (rd) {
|
||||
while (*rd) {
|
||||
usb2_make_raw_desc(temp, *rd);
|
||||
usb_make_raw_desc(temp, *rd);
|
||||
rd++;
|
||||
}
|
||||
}
|
||||
@ -232,14 +232,14 @@ usb2_make_endpoint_desc(struct usb_temp_setup *temp,
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_make_interface_desc
|
||||
* usb_make_interface_desc
|
||||
*
|
||||
* This function will generate an USB interface descriptor from the
|
||||
* given USB template interface descriptor, which will be inserted
|
||||
* into the USB configuration.
|
||||
*------------------------------------------------------------------------*/
|
||||
static void
|
||||
usb2_make_interface_desc(struct usb_temp_setup *temp,
|
||||
usb_make_interface_desc(struct usb_temp_setup *temp,
|
||||
const struct usb_temp_interface_desc *tid)
|
||||
{
|
||||
struct usb_interface_descriptor *id;
|
||||
@ -267,7 +267,7 @@ usb2_make_interface_desc(struct usb_temp_setup *temp,
|
||||
|
||||
if (rd) {
|
||||
while (*rd) {
|
||||
usb2_make_raw_desc(temp, *rd);
|
||||
usb_make_raw_desc(temp, *rd);
|
||||
rd++;
|
||||
}
|
||||
}
|
||||
@ -280,7 +280,7 @@ usb2_make_interface_desc(struct usb_temp_setup *temp,
|
||||
ted = tid->ppEndpoints;
|
||||
if (ted) {
|
||||
while (*ted) {
|
||||
usb2_make_endpoint_desc(temp, *ted);
|
||||
usb_make_endpoint_desc(temp, *ted);
|
||||
ted++;
|
||||
}
|
||||
}
|
||||
@ -303,14 +303,14 @@ usb2_make_interface_desc(struct usb_temp_setup *temp,
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_make_config_desc
|
||||
* usb_make_config_desc
|
||||
*
|
||||
* This function will generate an USB config descriptor from the given
|
||||
* USB template config descriptor, which will be inserted into the USB
|
||||
* configuration.
|
||||
*------------------------------------------------------------------------*/
|
||||
static void
|
||||
usb2_make_config_desc(struct usb_temp_setup *temp,
|
||||
usb_make_config_desc(struct usb_temp_setup *temp,
|
||||
const struct usb_temp_config_desc *tcd)
|
||||
{
|
||||
struct usb_config_descriptor *cd;
|
||||
@ -332,7 +332,7 @@ usb2_make_config_desc(struct usb_temp_setup *temp,
|
||||
tid = tcd->ppIfaceDesc;
|
||||
if (tid) {
|
||||
while (*tid) {
|
||||
usb2_make_interface_desc(temp, *tid);
|
||||
usb_make_interface_desc(temp, *tid);
|
||||
tid++;
|
||||
}
|
||||
}
|
||||
@ -365,13 +365,13 @@ usb2_make_config_desc(struct usb_temp_setup *temp,
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_make_device_desc
|
||||
* usb_make_device_desc
|
||||
*
|
||||
* This function will generate an USB device descriptor from the
|
||||
* given USB template device descriptor.
|
||||
*------------------------------------------------------------------------*/
|
||||
static void
|
||||
usb2_make_device_desc(struct usb_temp_setup *temp,
|
||||
usb_make_device_desc(struct usb_temp_setup *temp,
|
||||
const struct usb_temp_device_desc *tdd)
|
||||
{
|
||||
struct usb_temp_data *utd;
|
||||
@ -389,7 +389,7 @@ usb2_make_device_desc(struct usb_temp_setup *temp,
|
||||
tcd = tdd->ppConfigDesc;
|
||||
if (tcd) {
|
||||
while (*tcd) {
|
||||
usb2_make_config_desc(temp, *tcd);
|
||||
usb_make_config_desc(temp, *tcd);
|
||||
temp->bConfigurationValue++;
|
||||
tcd++;
|
||||
}
|
||||
@ -460,14 +460,14 @@ usb2_make_device_desc(struct usb_temp_setup *temp,
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_hw_ep_match
|
||||
* usb_hw_ep_match
|
||||
*
|
||||
* Return values:
|
||||
* 0: The endpoint profile does not match the criterias
|
||||
* Else: The endpoint profile matches the criterias
|
||||
*------------------------------------------------------------------------*/
|
||||
static uint8_t
|
||||
usb2_hw_ep_match(const struct usb_hw_ep_profile *pf,
|
||||
usb_hw_ep_match(const struct usb_hw_ep_profile *pf,
|
||||
uint8_t ep_type, uint8_t ep_dir_in)
|
||||
{
|
||||
if (ep_type == UE_CONTROL) {
|
||||
@ -486,7 +486,7 @@ usb2_hw_ep_match(const struct usb_hw_ep_profile *pf,
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_hw_ep_find_match
|
||||
* usb_hw_ep_find_match
|
||||
*
|
||||
* This function is used to find the best matching endpoint profile
|
||||
* for and endpoint belonging to an USB descriptor.
|
||||
@ -496,7 +496,7 @@ usb2_hw_ep_match(const struct usb_hw_ep_profile *pf,
|
||||
* Else: Failure. No match.
|
||||
*------------------------------------------------------------------------*/
|
||||
static uint8_t
|
||||
usb2_hw_ep_find_match(struct usb_hw_ep_scratch *ues,
|
||||
usb_hw_ep_find_match(struct usb_hw_ep_scratch *ues,
|
||||
struct usb_hw_ep_scratch_sub *ep, uint8_t is_simplex)
|
||||
{
|
||||
const struct usb_hw_ep_profile *pf;
|
||||
@ -555,7 +555,7 @@ usb2_hw_ep_find_match(struct usb_hw_ep_scratch *ues,
|
||||
continue;
|
||||
}
|
||||
/* check if HW endpoint matches */
|
||||
if (!usb2_hw_ep_match(pf, ep->needs_ep_type, dir_in)) {
|
||||
if (!usb_hw_ep_match(pf, ep->needs_ep_type, dir_in)) {
|
||||
/* mismatch */
|
||||
continue;
|
||||
}
|
||||
@ -601,7 +601,7 @@ usb2_hw_ep_find_match(struct usb_hw_ep_scratch *ues,
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_hw_ep_get_needs
|
||||
* usb_hw_ep_get_needs
|
||||
*
|
||||
* This function will figure out the type and number of endpoints
|
||||
* which are needed for an USB configuration.
|
||||
@ -611,7 +611,7 @@ usb2_hw_ep_find_match(struct usb_hw_ep_scratch *ues,
|
||||
* Else: Failure.
|
||||
*------------------------------------------------------------------------*/
|
||||
static uint8_t
|
||||
usb2_hw_ep_get_needs(struct usb_hw_ep_scratch *ues,
|
||||
usb_hw_ep_get_needs(struct usb_hw_ep_scratch *ues,
|
||||
uint8_t ep_type, uint8_t is_complete)
|
||||
{
|
||||
const struct usb_hw_ep_profile *pf;
|
||||
@ -632,11 +632,11 @@ usb2_hw_ep_get_needs(struct usb_hw_ep_scratch *ues,
|
||||
ep_end = ues->ep + USB_EP_MAX;
|
||||
ep_max = ues->ep_max;
|
||||
desc = NULL;
|
||||
speed = usb2_get_speed(ues->udev);
|
||||
speed = usbd_get_speed(ues->udev);
|
||||
|
||||
repeat:
|
||||
|
||||
while ((desc = usb2_desc_foreach(ues->cd, desc))) {
|
||||
while ((desc = usb_desc_foreach(ues->cd, desc))) {
|
||||
|
||||
if ((desc->bDescriptorType == UDESC_INTERFACE) &&
|
||||
(desc->bLength >= sizeof(*id))) {
|
||||
@ -771,7 +771,7 @@ usb2_hw_ep_get_needs(struct usb_hw_ep_scratch *ues,
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_hw_ep_resolve
|
||||
* usb_hw_ep_resolve
|
||||
*
|
||||
* This function will try to resolve endpoint requirements by the
|
||||
* given endpoint profiles that the USB hardware reports.
|
||||
@ -781,7 +781,7 @@ usb2_hw_ep_get_needs(struct usb_hw_ep_scratch *ues,
|
||||
* Else: Failure
|
||||
*------------------------------------------------------------------------*/
|
||||
static usb_error_t
|
||||
usb2_hw_ep_resolve(struct usb_device *udev,
|
||||
usb_hw_ep_resolve(struct usb_device *udev,
|
||||
struct usb_descriptor *desc)
|
||||
{
|
||||
struct usb_hw_ep_scratch *ues;
|
||||
@ -812,7 +812,7 @@ usb2_hw_ep_resolve(struct usb_device *udev,
|
||||
if (pf == NULL) {
|
||||
return (USB_ERR_INVAL);
|
||||
}
|
||||
if (!usb2_hw_ep_match(pf, UE_CONTROL, 0)) {
|
||||
if (!usb_hw_ep_match(pf, UE_CONTROL, 0)) {
|
||||
DPRINTFN(0, "Endpoint 0 does not "
|
||||
"support control\n");
|
||||
return (USB_ERR_INVAL);
|
||||
@ -868,10 +868,10 @@ usb2_hw_ep_resolve(struct usb_device *udev,
|
||||
|
||||
/* Get all the endpoints we need */
|
||||
|
||||
if (usb2_hw_ep_get_needs(ues, UE_ISOCHRONOUS, 0) ||
|
||||
usb2_hw_ep_get_needs(ues, UE_INTERRUPT, 0) ||
|
||||
usb2_hw_ep_get_needs(ues, UE_CONTROL, 0) ||
|
||||
usb2_hw_ep_get_needs(ues, UE_BULK, 0)) {
|
||||
if (usb_hw_ep_get_needs(ues, UE_ISOCHRONOUS, 0) ||
|
||||
usb_hw_ep_get_needs(ues, UE_INTERRUPT, 0) ||
|
||||
usb_hw_ep_get_needs(ues, UE_CONTROL, 0) ||
|
||||
usb_hw_ep_get_needs(ues, UE_BULK, 0)) {
|
||||
DPRINTFN(0, "Could not get needs\n");
|
||||
return (USB_ERR_INVAL);
|
||||
}
|
||||
@ -883,8 +883,8 @@ usb2_hw_ep_resolve(struct usb_device *udev,
|
||||
* First try to use a simplex endpoint.
|
||||
* Then try to use a duplex endpoint.
|
||||
*/
|
||||
if (usb2_hw_ep_find_match(ues, ep, 1) &&
|
||||
usb2_hw_ep_find_match(ues, ep, 0)) {
|
||||
if (usb_hw_ep_find_match(ues, ep, 1) &&
|
||||
usb_hw_ep_find_match(ues, ep, 0)) {
|
||||
DPRINTFN(0, "Could not find match\n");
|
||||
return (USB_ERR_INVAL);
|
||||
}
|
||||
@ -895,10 +895,10 @@ usb2_hw_ep_resolve(struct usb_device *udev,
|
||||
|
||||
/* Update all endpoint addresses */
|
||||
|
||||
if (usb2_hw_ep_get_needs(ues, UE_ISOCHRONOUS, 1) ||
|
||||
usb2_hw_ep_get_needs(ues, UE_INTERRUPT, 1) ||
|
||||
usb2_hw_ep_get_needs(ues, UE_CONTROL, 1) ||
|
||||
usb2_hw_ep_get_needs(ues, UE_BULK, 1)) {
|
||||
if (usb_hw_ep_get_needs(ues, UE_ISOCHRONOUS, 1) ||
|
||||
usb_hw_ep_get_needs(ues, UE_INTERRUPT, 1) ||
|
||||
usb_hw_ep_get_needs(ues, UE_CONTROL, 1) ||
|
||||
usb_hw_ep_get_needs(ues, UE_BULK, 1)) {
|
||||
DPRINTFN(0, "Could not update endpoint address\n");
|
||||
return (USB_ERR_INVAL);
|
||||
}
|
||||
@ -906,37 +906,37 @@ usb2_hw_ep_resolve(struct usb_device *udev,
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_temp_get_tdd
|
||||
* usb_temp_get_tdd
|
||||
*
|
||||
* Returns:
|
||||
* NULL: No USB template device descriptor found.
|
||||
* Else: Pointer to the USB template device descriptor.
|
||||
*------------------------------------------------------------------------*/
|
||||
static const struct usb_temp_device_desc *
|
||||
usb2_temp_get_tdd(struct usb_device *udev)
|
||||
usb_temp_get_tdd(struct usb_device *udev)
|
||||
{
|
||||
if (udev->usb2_template_ptr == NULL) {
|
||||
if (udev->usb_template_ptr == NULL) {
|
||||
return (NULL);
|
||||
}
|
||||
return (udev->usb2_template_ptr->tdd);
|
||||
return (udev->usb_template_ptr->tdd);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_temp_get_device_desc
|
||||
* usb_temp_get_device_desc
|
||||
*
|
||||
* Returns:
|
||||
* NULL: No USB device descriptor found.
|
||||
* Else: Pointer to USB device descriptor.
|
||||
*------------------------------------------------------------------------*/
|
||||
static void *
|
||||
usb2_temp_get_device_desc(struct usb_device *udev)
|
||||
usb_temp_get_device_desc(struct usb_device *udev)
|
||||
{
|
||||
struct usb_device_descriptor *dd;
|
||||
|
||||
if (udev->usb2_template_ptr == NULL) {
|
||||
if (udev->usb_template_ptr == NULL) {
|
||||
return (NULL);
|
||||
}
|
||||
dd = &udev->usb2_template_ptr->udd;
|
||||
dd = &udev->usb_template_ptr->udd;
|
||||
if (dd->bDescriptorType != UDESC_DEVICE) {
|
||||
/* sanity check failed */
|
||||
return (NULL);
|
||||
@ -945,21 +945,21 @@ usb2_temp_get_device_desc(struct usb_device *udev)
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_temp_get_qualifier_desc
|
||||
* usb_temp_get_qualifier_desc
|
||||
*
|
||||
* Returns:
|
||||
* NULL: No USB device_qualifier descriptor found.
|
||||
* Else: Pointer to USB device_qualifier descriptor.
|
||||
*------------------------------------------------------------------------*/
|
||||
static void *
|
||||
usb2_temp_get_qualifier_desc(struct usb_device *udev)
|
||||
usb_temp_get_qualifier_desc(struct usb_device *udev)
|
||||
{
|
||||
struct usb_device_qualifier *dq;
|
||||
|
||||
if (udev->usb2_template_ptr == NULL) {
|
||||
if (udev->usb_template_ptr == NULL) {
|
||||
return (NULL);
|
||||
}
|
||||
dq = &udev->usb2_template_ptr->udq;
|
||||
dq = &udev->usb_template_ptr->udq;
|
||||
if (dq->bDescriptorType != UDESC_DEVICE_QUALIFIER) {
|
||||
/* sanity check failed */
|
||||
return (NULL);
|
||||
@ -968,25 +968,25 @@ usb2_temp_get_qualifier_desc(struct usb_device *udev)
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_temp_get_config_desc
|
||||
* usb_temp_get_config_desc
|
||||
*
|
||||
* Returns:
|
||||
* NULL: No USB config descriptor found.
|
||||
* Else: Pointer to USB config descriptor having index "index".
|
||||
*------------------------------------------------------------------------*/
|
||||
static void *
|
||||
usb2_temp_get_config_desc(struct usb_device *udev,
|
||||
usb_temp_get_config_desc(struct usb_device *udev,
|
||||
uint16_t *pLength, uint8_t index)
|
||||
{
|
||||
struct usb_device_descriptor *dd;
|
||||
struct usb_config_descriptor *cd;
|
||||
uint16_t temp;
|
||||
|
||||
if (udev->usb2_template_ptr == NULL) {
|
||||
if (udev->usb_template_ptr == NULL) {
|
||||
return (NULL);
|
||||
}
|
||||
dd = &udev->usb2_template_ptr->udd;
|
||||
cd = (void *)(udev->usb2_template_ptr + 1);
|
||||
dd = &udev->usb_template_ptr->udd;
|
||||
cd = (void *)(udev->usb_template_ptr + 1);
|
||||
|
||||
if (index >= dd->bNumConfigurations) {
|
||||
/* out of range */
|
||||
@ -1008,19 +1008,19 @@ usb2_temp_get_config_desc(struct usb_device *udev,
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_temp_get_vendor_desc
|
||||
* usb_temp_get_vendor_desc
|
||||
*
|
||||
* Returns:
|
||||
* NULL: No vendor descriptor found.
|
||||
* Else: Pointer to a vendor descriptor.
|
||||
*------------------------------------------------------------------------*/
|
||||
static const void *
|
||||
usb2_temp_get_vendor_desc(struct usb_device *udev,
|
||||
usb_temp_get_vendor_desc(struct usb_device *udev,
|
||||
const struct usb_device_request *req)
|
||||
{
|
||||
const struct usb_temp_device_desc *tdd;
|
||||
|
||||
tdd = usb2_temp_get_tdd(udev);
|
||||
tdd = usb_temp_get_tdd(udev);
|
||||
if (tdd == NULL) {
|
||||
return (NULL);
|
||||
}
|
||||
@ -1031,19 +1031,19 @@ usb2_temp_get_vendor_desc(struct usb_device *udev,
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_temp_get_string_desc
|
||||
* usb_temp_get_string_desc
|
||||
*
|
||||
* Returns:
|
||||
* NULL: No string descriptor found.
|
||||
* Else: Pointer to a string descriptor.
|
||||
*------------------------------------------------------------------------*/
|
||||
static const void *
|
||||
usb2_temp_get_string_desc(struct usb_device *udev,
|
||||
usb_temp_get_string_desc(struct usb_device *udev,
|
||||
uint16_t lang_id, uint8_t string_index)
|
||||
{
|
||||
const struct usb_temp_device_desc *tdd;
|
||||
|
||||
tdd = usb2_temp_get_tdd(udev);
|
||||
tdd = usb_temp_get_tdd(udev);
|
||||
if (tdd == NULL) {
|
||||
return (NULL);
|
||||
}
|
||||
@ -1054,26 +1054,26 @@ usb2_temp_get_string_desc(struct usb_device *udev,
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_temp_get_hub_desc
|
||||
* usb_temp_get_hub_desc
|
||||
*
|
||||
* Returns:
|
||||
* NULL: No USB HUB descriptor found.
|
||||
* Else: Pointer to a USB HUB descriptor.
|
||||
*------------------------------------------------------------------------*/
|
||||
static const void *
|
||||
usb2_temp_get_hub_desc(struct usb_device *udev)
|
||||
usb_temp_get_hub_desc(struct usb_device *udev)
|
||||
{
|
||||
return (NULL); /* needs to be implemented */
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_temp_get_desc
|
||||
* usb_temp_get_desc
|
||||
*
|
||||
* This function is a demultiplexer for local USB device side control
|
||||
* endpoint requests.
|
||||
*------------------------------------------------------------------------*/
|
||||
static usb_error_t
|
||||
usb2_temp_get_desc(struct usb_device *udev, struct usb_device_request *req,
|
||||
usb_temp_get_desc(struct usb_device *udev, struct usb_device_request *req,
|
||||
const void **pPtr, uint16_t *pLength)
|
||||
{
|
||||
const uint8_t *buf;
|
||||
@ -1101,7 +1101,7 @@ usb2_temp_get_desc(struct usb_device *udev, struct usb_device_request *req,
|
||||
break;
|
||||
case UT_READ_VENDOR_DEVICE:
|
||||
case UT_READ_VENDOR_OTHER:
|
||||
buf = usb2_temp_get_vendor_desc(udev, req);
|
||||
buf = usb_temp_get_vendor_desc(udev, req);
|
||||
goto tr_valid;
|
||||
default:
|
||||
goto tr_stalled;
|
||||
@ -1113,7 +1113,7 @@ usb2_temp_get_desc(struct usb_device *udev, struct usb_device_request *req,
|
||||
if (req->wValue[0]) {
|
||||
goto tr_stalled;
|
||||
}
|
||||
buf = usb2_temp_get_device_desc(udev);
|
||||
buf = usb_temp_get_device_desc(udev);
|
||||
goto tr_valid;
|
||||
case UDESC_DEVICE_QUALIFIER:
|
||||
if (udev->speed != USB_SPEED_HIGH) {
|
||||
@ -1122,18 +1122,18 @@ usb2_temp_get_desc(struct usb_device *udev, struct usb_device_request *req,
|
||||
if (req->wValue[0]) {
|
||||
goto tr_stalled;
|
||||
}
|
||||
buf = usb2_temp_get_qualifier_desc(udev);
|
||||
buf = usb_temp_get_qualifier_desc(udev);
|
||||
goto tr_valid;
|
||||
case UDESC_OTHER_SPEED_CONFIGURATION:
|
||||
if (udev->speed != USB_SPEED_HIGH) {
|
||||
goto tr_stalled;
|
||||
}
|
||||
case UDESC_CONFIG:
|
||||
buf = usb2_temp_get_config_desc(udev,
|
||||
buf = usb_temp_get_config_desc(udev,
|
||||
&len, req->wValue[0]);
|
||||
goto tr_valid;
|
||||
case UDESC_STRING:
|
||||
buf = usb2_temp_get_string_desc(udev,
|
||||
buf = usb_temp_get_string_desc(udev,
|
||||
UGETW(req->wIndex), req->wValue[0]);
|
||||
goto tr_valid;
|
||||
default:
|
||||
@ -1145,7 +1145,7 @@ usb2_temp_get_desc(struct usb_device *udev, struct usb_device_request *req,
|
||||
if (req->wValue[0]) {
|
||||
goto tr_stalled;
|
||||
}
|
||||
buf = usb2_temp_get_hub_desc(udev);
|
||||
buf = usb_temp_get_hub_desc(udev);
|
||||
goto tr_valid;
|
||||
|
||||
tr_valid:
|
||||
@ -1197,7 +1197,7 @@ usb_temp_setup(struct usb_device *udev,
|
||||
|
||||
/* first pass */
|
||||
|
||||
usb2_make_device_desc(uts, tdd);
|
||||
usb_make_device_desc(uts, tdd);
|
||||
|
||||
if (uts->err) {
|
||||
/* some error happened */
|
||||
@ -1217,12 +1217,12 @@ usb_temp_setup(struct usb_device *udev,
|
||||
|
||||
uts->size = 0;
|
||||
|
||||
usb2_make_device_desc(uts, tdd);
|
||||
usb_make_device_desc(uts, tdd);
|
||||
|
||||
/*
|
||||
* Store a pointer to our descriptors:
|
||||
*/
|
||||
udev->usb2_template_ptr = uts->buf;
|
||||
udev->usb_template_ptr = uts->buf;
|
||||
|
||||
if (uts->err) {
|
||||
/* some error happened during second pass */
|
||||
@ -1231,66 +1231,66 @@ usb_temp_setup(struct usb_device *udev,
|
||||
/*
|
||||
* Resolve all endpoint addresses !
|
||||
*/
|
||||
buf = usb2_temp_get_device_desc(udev);
|
||||
uts->err = usb2_hw_ep_resolve(udev, buf);
|
||||
buf = usb_temp_get_device_desc(udev);
|
||||
uts->err = usb_hw_ep_resolve(udev, buf);
|
||||
if (uts->err) {
|
||||
DPRINTFN(0, "Could not resolve endpoints for "
|
||||
"Device Descriptor, error = %s\n",
|
||||
usb2_errstr(uts->err));
|
||||
usbd_errstr(uts->err));
|
||||
goto error;
|
||||
}
|
||||
for (n = 0;; n++) {
|
||||
|
||||
buf = usb2_temp_get_config_desc(udev, NULL, n);
|
||||
buf = usb_temp_get_config_desc(udev, NULL, n);
|
||||
if (buf == NULL) {
|
||||
break;
|
||||
}
|
||||
uts->err = usb2_hw_ep_resolve(udev, buf);
|
||||
uts->err = usb_hw_ep_resolve(udev, buf);
|
||||
if (uts->err) {
|
||||
DPRINTFN(0, "Could not resolve endpoints for "
|
||||
"Config Descriptor %u, error = %s\n", n,
|
||||
usb2_errstr(uts->err));
|
||||
usbd_errstr(uts->err));
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
return (uts->err);
|
||||
|
||||
error:
|
||||
usb2_temp_unsetup(udev);
|
||||
usb_temp_unsetup(udev);
|
||||
return (uts->err);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_temp_unsetup
|
||||
* usb_temp_unsetup
|
||||
*
|
||||
* This function frees any memory associated with the currently
|
||||
* setup template, if any.
|
||||
*------------------------------------------------------------------------*/
|
||||
static void
|
||||
usb2_temp_unsetup(struct usb_device *udev)
|
||||
usb_temp_unsetup(struct usb_device *udev)
|
||||
{
|
||||
if (udev->usb2_template_ptr) {
|
||||
if (udev->usb_template_ptr) {
|
||||
|
||||
free(udev->usb2_template_ptr, M_USB);
|
||||
free(udev->usb_template_ptr, M_USB);
|
||||
|
||||
udev->usb2_template_ptr = NULL;
|
||||
udev->usb_template_ptr = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static usb_error_t
|
||||
usb2_temp_setup_by_index(struct usb_device *udev, uint16_t index)
|
||||
usb_temp_setup_by_index(struct usb_device *udev, uint16_t index)
|
||||
{
|
||||
usb_error_t err;
|
||||
|
||||
switch (index) {
|
||||
case 0:
|
||||
err = usb_temp_setup(udev, &usb2_template_msc);
|
||||
err = usb_temp_setup(udev, &usb_template_msc);
|
||||
break;
|
||||
case 1:
|
||||
err = usb_temp_setup(udev, &usb2_template_cdce);
|
||||
err = usb_temp_setup(udev, &usb_template_cdce);
|
||||
break;
|
||||
case 2:
|
||||
err = usb_temp_setup(udev, &usb2_template_mtp);
|
||||
err = usb_temp_setup(udev, &usb_template_mtp);
|
||||
break;
|
||||
default:
|
||||
return (USB_ERR_INVAL);
|
||||
@ -1300,13 +1300,13 @@ usb2_temp_setup_by_index(struct usb_device *udev, uint16_t index)
|
||||
}
|
||||
|
||||
static void
|
||||
usb2_temp_init(void *arg)
|
||||
usb_temp_init(void *arg)
|
||||
{
|
||||
/* register our functions */
|
||||
usb2_temp_get_desc_p = &usb2_temp_get_desc;
|
||||
usb2_temp_setup_by_index_p = &usb2_temp_setup_by_index;
|
||||
usb2_temp_unsetup_p = &usb2_temp_unsetup;
|
||||
usb_temp_get_desc_p = &usb_temp_get_desc;
|
||||
usb_temp_setup_by_index_p = &usb_temp_setup_by_index;
|
||||
usb_temp_unsetup_p = &usb_temp_unsetup;
|
||||
}
|
||||
|
||||
SYSINIT(usb2_temp_init, SI_SUB_LOCK, SI_ORDER_FIRST, usb2_temp_init, NULL);
|
||||
SYSUNINIT(usb2_temp_unload, SI_SUB_LOCK, SI_ORDER_ANY, usb2_temp_unload, NULL);
|
||||
SYSINIT(usb_temp_init, SI_SUB_LOCK, SI_ORDER_FIRST, usb_temp_init, NULL);
|
||||
SYSUNINIT(usb_temp_unload, SI_SUB_LOCK, SI_ORDER_ANY, usb_temp_unload, NULL);
|
||||
|
@ -30,8 +30,8 @@
|
||||
#ifndef _USB_TEMPLATE_H_
|
||||
#define _USB_TEMPLATE_H_
|
||||
|
||||
typedef const void *(usb2_temp_get_string_desc_t)(uint16_t lang_id, uint8_t string_index);
|
||||
typedef const void *(usb2_temp_get_vendor_desc_t)(const struct usb_device_request *req);
|
||||
typedef const void *(usb_temp_get_string_desc_t)(uint16_t lang_id, uint8_t string_index);
|
||||
typedef const void *(usb_temp_get_vendor_desc_t)(const struct usb_device_request *req);
|
||||
|
||||
struct usb_temp_packet_size {
|
||||
uint16_t mps[USB_SPEED_MAX];
|
||||
@ -72,8 +72,8 @@ struct usb_temp_config_desc {
|
||||
};
|
||||
|
||||
struct usb_temp_device_desc {
|
||||
usb2_temp_get_string_desc_t *getStringDesc;
|
||||
usb2_temp_get_vendor_desc_t *getVendorDesc;
|
||||
usb_temp_get_string_desc_t *getStringDesc;
|
||||
usb_temp_get_vendor_desc_t *getVendorDesc;
|
||||
const struct usb_temp_config_desc **ppConfigDesc;
|
||||
uint16_t idVendor;
|
||||
uint16_t idProduct;
|
||||
@ -94,9 +94,9 @@ struct usb_temp_data {
|
||||
|
||||
/* prototypes */
|
||||
|
||||
extern const struct usb_temp_device_desc usb2_template_cdce;
|
||||
extern const struct usb_temp_device_desc usb2_template_msc; /* Mass Storage Class */
|
||||
extern const struct usb_temp_device_desc usb2_template_mtp; /* Message Transfer
|
||||
extern const struct usb_temp_device_desc usb_template_cdce;
|
||||
extern const struct usb_temp_device_desc usb_template_msc; /* Mass Storage Class */
|
||||
extern const struct usb_temp_device_desc usb_template_mtp; /* Message Transfer
|
||||
* Protocol */
|
||||
|
||||
#endif /* _USB_TEMPLATE_H_ */
|
||||
|
@ -116,7 +116,7 @@ USB_MAKE_STRING_DESC(STRING_ETH_SERIAL, string_eth_serial);
|
||||
|
||||
/* prototypes */
|
||||
|
||||
static usb2_temp_get_string_desc_t eth_get_string_desc;
|
||||
static usb_temp_get_string_desc_t eth_get_string_desc;
|
||||
|
||||
static const struct usb_cdc_union_descriptor eth_union_desc = {
|
||||
.bLength = sizeof(eth_union_desc),
|
||||
@ -244,7 +244,7 @@ static const struct usb_temp_config_desc *eth_configs[] = {
|
||||
NULL,
|
||||
};
|
||||
|
||||
const struct usb_temp_device_desc usb2_template_cdce = {
|
||||
const struct usb_temp_device_desc usb_template_cdce = {
|
||||
.getStringDesc = ð_get_string_desc,
|
||||
.ppConfigDesc = eth_configs,
|
||||
.idVendor = 0x0001,
|
||||
|
@ -95,7 +95,7 @@ USB_MAKE_STRING_DESC(STRING_MSC_SERIAL, string_msc_serial);
|
||||
|
||||
/* prototypes */
|
||||
|
||||
static usb2_temp_get_string_desc_t msc_get_string_desc;
|
||||
static usb_temp_get_string_desc_t msc_get_string_desc;
|
||||
|
||||
static const struct usb_temp_packet_size bulk_mps = {
|
||||
.mps[USB_SPEED_FULL] = 64,
|
||||
@ -153,7 +153,7 @@ static const struct usb_temp_config_desc *msc_configs[] = {
|
||||
NULL,
|
||||
};
|
||||
|
||||
const struct usb_temp_device_desc usb2_template_msc = {
|
||||
const struct usb_temp_device_desc usb_template_msc = {
|
||||
.getStringDesc = &msc_get_string_desc,
|
||||
.ppConfigDesc = msc_configs,
|
||||
.idVendor = 0x0001,
|
||||
|
@ -100,8 +100,8 @@ USB_MAKE_STRING_DESC(STRING_MTP_SERIAL, string_mtp_serial);
|
||||
|
||||
/* prototypes */
|
||||
|
||||
static usb2_temp_get_string_desc_t mtp_get_string_desc;
|
||||
static usb2_temp_get_vendor_desc_t mtp_get_vendor_desc;
|
||||
static usb_temp_get_string_desc_t mtp_get_string_desc;
|
||||
static usb_temp_get_vendor_desc_t mtp_get_vendor_desc;
|
||||
|
||||
static const struct usb_temp_packet_size bulk_mps = {
|
||||
.mps[USB_SPEED_FULL] = 64,
|
||||
@ -171,7 +171,7 @@ static const struct usb_temp_config_desc *mtp_configs[] = {
|
||||
NULL,
|
||||
};
|
||||
|
||||
const struct usb_temp_device_desc usb2_template_mtp = {
|
||||
const struct usb_temp_device_desc usb_template_mtp = {
|
||||
.getStringDesc = &mtp_get_string_desc,
|
||||
.getVendorDesc = &mtp_get_vendor_desc,
|
||||
.ppConfigDesc = mtp_configs,
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include <dev/usb/usb_error.h>
|
||||
#include <dev/usb/usb.h>
|
||||
|
||||
#define USB_DEBUG_VAR usb2_debug
|
||||
#define USB_DEBUG_VAR usb_debug
|
||||
|
||||
#include <dev/usb/usb_core.h>
|
||||
#include <dev/usb/usb_busdma.h>
|
||||
@ -42,23 +42,23 @@
|
||||
#include <dev/usb/usb_bus.h>
|
||||
|
||||
#if USB_HAVE_BUSDMA
|
||||
static void usb2_dma_tag_create(struct usb_dma_tag *, usb_size_t, usb_size_t);
|
||||
static void usb2_dma_tag_destroy(struct usb_dma_tag *);
|
||||
static void usb2_dma_lock_cb(void *, bus_dma_lock_op_t);
|
||||
static void usb2_pc_alloc_mem_cb(void *, bus_dma_segment_t *, int, int);
|
||||
static void usb2_pc_load_mem_cb(void *, bus_dma_segment_t *, int, int);
|
||||
static void usb2_pc_common_mem_cb(void *, bus_dma_segment_t *, int, int,
|
||||
static void usb_dma_tag_create(struct usb_dma_tag *, usb_size_t, usb_size_t);
|
||||
static void usb_dma_tag_destroy(struct usb_dma_tag *);
|
||||
static void usb_dma_lock_cb(void *, bus_dma_lock_op_t);
|
||||
static void usb_pc_alloc_mem_cb(void *, bus_dma_segment_t *, int, int);
|
||||
static void usb_pc_load_mem_cb(void *, bus_dma_segment_t *, int, int);
|
||||
static void usb_pc_common_mem_cb(void *, bus_dma_segment_t *, int, int,
|
||||
uint8_t);
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_get_page - lookup DMA-able memory for the given offset
|
||||
* usbd_get_page - lookup DMA-able memory for the given offset
|
||||
*
|
||||
* NOTE: Only call this function when the "page_cache" structure has
|
||||
* been properly initialized !
|
||||
*------------------------------------------------------------------------*/
|
||||
void
|
||||
usb2_get_page(struct usb_page_cache *pc, usb_frlength_t offset,
|
||||
usbd_get_page(struct usb_page_cache *pc, usb_frlength_t offset,
|
||||
struct usb_page_search *res)
|
||||
{
|
||||
struct usb_page *page;
|
||||
@ -111,17 +111,17 @@ usb2_get_page(struct usb_page_cache *pc, usb_frlength_t offset,
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_copy_in - copy directly to DMA-able memory
|
||||
* usbd_copy_in - copy directly to DMA-able memory
|
||||
*------------------------------------------------------------------------*/
|
||||
void
|
||||
usb2_copy_in(struct usb_page_cache *cache, usb_frlength_t offset,
|
||||
usbd_copy_in(struct usb_page_cache *cache, usb_frlength_t offset,
|
||||
const void *ptr, usb_frlength_t len)
|
||||
{
|
||||
struct usb_page_search buf_res;
|
||||
|
||||
while (len != 0) {
|
||||
|
||||
usb2_get_page(cache, offset, &buf_res);
|
||||
usbd_get_page(cache, offset, &buf_res);
|
||||
|
||||
if (buf_res.length > len) {
|
||||
buf_res.length = len;
|
||||
@ -135,7 +135,7 @@ usb2_copy_in(struct usb_page_cache *cache, usb_frlength_t offset,
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_copy_in_user - copy directly to DMA-able memory from userland
|
||||
* usbd_copy_in_user - copy directly to DMA-able memory from userland
|
||||
*
|
||||
* Return values:
|
||||
* 0: Success
|
||||
@ -143,7 +143,7 @@ usb2_copy_in(struct usb_page_cache *cache, usb_frlength_t offset,
|
||||
*------------------------------------------------------------------------*/
|
||||
#if USB_HAVE_USER_IO
|
||||
int
|
||||
usb2_copy_in_user(struct usb_page_cache *cache, usb_frlength_t offset,
|
||||
usbd_copy_in_user(struct usb_page_cache *cache, usb_frlength_t offset,
|
||||
const void *ptr, usb_frlength_t len)
|
||||
{
|
||||
struct usb_page_search buf_res;
|
||||
@ -151,7 +151,7 @@ usb2_copy_in_user(struct usb_page_cache *cache, usb_frlength_t offset,
|
||||
|
||||
while (len != 0) {
|
||||
|
||||
usb2_get_page(cache, offset, &buf_res);
|
||||
usbd_get_page(cache, offset, &buf_res);
|
||||
|
||||
if (buf_res.length > len) {
|
||||
buf_res.length = len;
|
||||
@ -169,41 +169,41 @@ usb2_copy_in_user(struct usb_page_cache *cache, usb_frlength_t offset,
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_m_copy_in - copy a mbuf chain directly into DMA-able memory
|
||||
* usbd_m_copy_in - copy a mbuf chain directly into DMA-able memory
|
||||
*------------------------------------------------------------------------*/
|
||||
#if USB_HAVE_MBUF
|
||||
struct usb2_m_copy_in_arg {
|
||||
struct usb_m_copy_in_arg {
|
||||
struct usb_page_cache *cache;
|
||||
usb_frlength_t dst_offset;
|
||||
};
|
||||
|
||||
static int
|
||||
usb2_m_copy_in_cb(void *arg, void *src, uint32_t count)
|
||||
usbd_m_copy_in_cb(void *arg, void *src, uint32_t count)
|
||||
{
|
||||
register struct usb2_m_copy_in_arg *ua = arg;
|
||||
register struct usb_m_copy_in_arg *ua = arg;
|
||||
|
||||
usb2_copy_in(ua->cache, ua->dst_offset, src, count);
|
||||
usbd_copy_in(ua->cache, ua->dst_offset, src, count);
|
||||
ua->dst_offset += count;
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
usb2_m_copy_in(struct usb_page_cache *cache, usb_frlength_t dst_offset,
|
||||
usbd_m_copy_in(struct usb_page_cache *cache, usb_frlength_t dst_offset,
|
||||
struct mbuf *m, usb_size_t src_offset, usb_frlength_t src_len)
|
||||
{
|
||||
struct usb2_m_copy_in_arg arg = {cache, dst_offset};
|
||||
struct usb_m_copy_in_arg arg = {cache, dst_offset};
|
||||
int error;
|
||||
|
||||
error = m_apply(m, src_offset, src_len, &usb2_m_copy_in_cb, &arg);
|
||||
error = m_apply(m, src_offset, src_len, &usbd_m_copy_in_cb, &arg);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_uiomove - factored out code
|
||||
* usb_uiomove - factored out code
|
||||
*------------------------------------------------------------------------*/
|
||||
#if USB_HAVE_USER_IO
|
||||
int
|
||||
usb2_uiomove(struct usb_page_cache *pc, struct uio *uio,
|
||||
usb_uiomove(struct usb_page_cache *pc, struct uio *uio,
|
||||
usb_frlength_t pc_offset, usb_frlength_t len)
|
||||
{
|
||||
struct usb_page_search res;
|
||||
@ -211,7 +211,7 @@ usb2_uiomove(struct usb_page_cache *pc, struct uio *uio,
|
||||
|
||||
while (len != 0) {
|
||||
|
||||
usb2_get_page(pc, pc_offset, &res);
|
||||
usbd_get_page(pc, pc_offset, &res);
|
||||
|
||||
if (res.length > len) {
|
||||
res.length = len;
|
||||
@ -233,17 +233,17 @@ usb2_uiomove(struct usb_page_cache *pc, struct uio *uio,
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_copy_out - copy directly from DMA-able memory
|
||||
* usbd_copy_out - copy directly from DMA-able memory
|
||||
*------------------------------------------------------------------------*/
|
||||
void
|
||||
usb2_copy_out(struct usb_page_cache *cache, usb_frlength_t offset,
|
||||
usbd_copy_out(struct usb_page_cache *cache, usb_frlength_t offset,
|
||||
void *ptr, usb_frlength_t len)
|
||||
{
|
||||
struct usb_page_search res;
|
||||
|
||||
while (len != 0) {
|
||||
|
||||
usb2_get_page(cache, offset, &res);
|
||||
usbd_get_page(cache, offset, &res);
|
||||
|
||||
if (res.length > len) {
|
||||
res.length = len;
|
||||
@ -257,7 +257,7 @@ usb2_copy_out(struct usb_page_cache *cache, usb_frlength_t offset,
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_copy_out_user - copy directly from DMA-able memory to userland
|
||||
* usbd_copy_out_user - copy directly from DMA-able memory to userland
|
||||
*
|
||||
* Return values:
|
||||
* 0: Success
|
||||
@ -265,7 +265,7 @@ usb2_copy_out(struct usb_page_cache *cache, usb_frlength_t offset,
|
||||
*------------------------------------------------------------------------*/
|
||||
#if USB_HAVE_USER_IO
|
||||
int
|
||||
usb2_copy_out_user(struct usb_page_cache *cache, usb_frlength_t offset,
|
||||
usbd_copy_out_user(struct usb_page_cache *cache, usb_frlength_t offset,
|
||||
void *ptr, usb_frlength_t len)
|
||||
{
|
||||
struct usb_page_search res;
|
||||
@ -273,7 +273,7 @@ usb2_copy_out_user(struct usb_page_cache *cache, usb_frlength_t offset,
|
||||
|
||||
while (len != 0) {
|
||||
|
||||
usb2_get_page(cache, offset, &res);
|
||||
usbd_get_page(cache, offset, &res);
|
||||
|
||||
if (res.length > len) {
|
||||
res.length = len;
|
||||
@ -291,17 +291,17 @@ usb2_copy_out_user(struct usb_page_cache *cache, usb_frlength_t offset,
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_bzero - zero DMA-able memory
|
||||
* usbd_frame_zero - zero DMA-able memory
|
||||
*------------------------------------------------------------------------*/
|
||||
void
|
||||
usb2_bzero(struct usb_page_cache *cache, usb_frlength_t offset,
|
||||
usbd_frame_zero(struct usb_page_cache *cache, usb_frlength_t offset,
|
||||
usb_frlength_t len)
|
||||
{
|
||||
struct usb_page_search res;
|
||||
|
||||
while (len != 0) {
|
||||
|
||||
usb2_get_page(cache, offset, &res);
|
||||
usbd_get_page(cache, offset, &res);
|
||||
|
||||
if (res.length > len) {
|
||||
res.length = len;
|
||||
@ -316,22 +316,22 @@ usb2_bzero(struct usb_page_cache *cache, usb_frlength_t offset,
|
||||
#if USB_HAVE_BUSDMA
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_dma_lock_cb - dummy callback
|
||||
* usb_dma_lock_cb - dummy callback
|
||||
*------------------------------------------------------------------------*/
|
||||
static void
|
||||
usb2_dma_lock_cb(void *arg, bus_dma_lock_op_t op)
|
||||
usb_dma_lock_cb(void *arg, bus_dma_lock_op_t op)
|
||||
{
|
||||
/* we use "mtx_owned()" instead of this function */
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_dma_tag_create - allocate a DMA tag
|
||||
* usb_dma_tag_create - allocate a DMA tag
|
||||
*
|
||||
* NOTE: If the "align" parameter has a value of 1 the DMA-tag will
|
||||
* allow multi-segment mappings. Else all mappings are single-segment.
|
||||
*------------------------------------------------------------------------*/
|
||||
static void
|
||||
usb2_dma_tag_create(struct usb_dma_tag *udt,
|
||||
usb_dma_tag_create(struct usb_dma_tag *udt,
|
||||
usb_size_t size, usb_size_t align)
|
||||
{
|
||||
bus_dma_tag_t tag;
|
||||
@ -350,7 +350,7 @@ usb2_dma_tag_create(struct usb_dma_tag *udt,
|
||||
/* maxsegsz */ (align == 1) ?
|
||||
USB_PAGE_SIZE : size,
|
||||
/* flags */ BUS_DMA_KEEP_PG_OFFSET,
|
||||
/* lockfn */ &usb2_dma_lock_cb,
|
||||
/* lockfn */ &usb_dma_lock_cb,
|
||||
/* lockarg */ NULL,
|
||||
&tag)) {
|
||||
tag = NULL;
|
||||
@ -359,39 +359,39 @@ usb2_dma_tag_create(struct usb_dma_tag *udt,
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_dma_tag_free - free a DMA tag
|
||||
* usb_dma_tag_free - free a DMA tag
|
||||
*------------------------------------------------------------------------*/
|
||||
static void
|
||||
usb2_dma_tag_destroy(struct usb_dma_tag *udt)
|
||||
usb_dma_tag_destroy(struct usb_dma_tag *udt)
|
||||
{
|
||||
bus_dma_tag_destroy(udt->tag);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_pc_alloc_mem_cb - BUS-DMA callback function
|
||||
* usb_pc_alloc_mem_cb - BUS-DMA callback function
|
||||
*------------------------------------------------------------------------*/
|
||||
static void
|
||||
usb2_pc_alloc_mem_cb(void *arg, bus_dma_segment_t *segs,
|
||||
usb_pc_alloc_mem_cb(void *arg, bus_dma_segment_t *segs,
|
||||
int nseg, int error)
|
||||
{
|
||||
usb2_pc_common_mem_cb(arg, segs, nseg, error, 0);
|
||||
usb_pc_common_mem_cb(arg, segs, nseg, error, 0);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_pc_load_mem_cb - BUS-DMA callback function
|
||||
* usb_pc_load_mem_cb - BUS-DMA callback function
|
||||
*------------------------------------------------------------------------*/
|
||||
static void
|
||||
usb2_pc_load_mem_cb(void *arg, bus_dma_segment_t *segs,
|
||||
usb_pc_load_mem_cb(void *arg, bus_dma_segment_t *segs,
|
||||
int nseg, int error)
|
||||
{
|
||||
usb2_pc_common_mem_cb(arg, segs, nseg, error, 1);
|
||||
usb_pc_common_mem_cb(arg, segs, nseg, error, 1);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_pc_common_mem_cb - BUS-DMA callback function
|
||||
* usb_pc_common_mem_cb - BUS-DMA callback function
|
||||
*------------------------------------------------------------------------*/
|
||||
static void
|
||||
usb2_pc_common_mem_cb(void *arg, bus_dma_segment_t *segs,
|
||||
usb_pc_common_mem_cb(void *arg, bus_dma_segment_t *segs,
|
||||
int nseg, int error, uint8_t isload)
|
||||
{
|
||||
struct usb_dma_parent_tag *uptag;
|
||||
@ -452,14 +452,14 @@ usb2_pc_common_mem_cb(void *arg, bus_dma_segment_t *segs,
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_pc_alloc_mem - allocate DMA'able memory
|
||||
* usb_pc_alloc_mem - allocate DMA'able memory
|
||||
*
|
||||
* Returns:
|
||||
* 0: Success
|
||||
* Else: Failure
|
||||
*------------------------------------------------------------------------*/
|
||||
uint8_t
|
||||
usb2_pc_alloc_mem(struct usb_page_cache *pc, struct usb_page *pg,
|
||||
usb_pc_alloc_mem(struct usb_page_cache *pc, struct usb_page *pg,
|
||||
usb_size_t size, usb_size_t align)
|
||||
{
|
||||
struct usb_dma_parent_tag *uptag;
|
||||
@ -505,7 +505,7 @@ usb2_pc_alloc_mem(struct usb_page_cache *pc, struct usb_page *pg,
|
||||
#endif
|
||||
}
|
||||
/* get the correct DMA tag */
|
||||
utag = usb2_dma_tag_find(uptag, size, align);
|
||||
utag = usb_dma_tag_find(uptag, size, align);
|
||||
if (utag == NULL) {
|
||||
goto error;
|
||||
}
|
||||
@ -527,7 +527,7 @@ usb2_pc_alloc_mem(struct usb_page_cache *pc, struct usb_page *pg,
|
||||
|
||||
/* load memory into DMA */
|
||||
err = bus_dmamap_load(
|
||||
utag->tag, map, ptr, size, &usb2_pc_alloc_mem_cb,
|
||||
utag->tag, map, ptr, size, &usb_pc_alloc_mem_cb,
|
||||
pc, (BUS_DMA_WAITOK | BUS_DMA_COHERENT));
|
||||
|
||||
if (err == EINPROGRESS) {
|
||||
@ -542,7 +542,7 @@ usb2_pc_alloc_mem(struct usb_page_cache *pc, struct usb_page *pg,
|
||||
}
|
||||
bzero(ptr, size);
|
||||
|
||||
usb2_pc_cpu_flush(pc);
|
||||
usb_pc_cpu_flush(pc);
|
||||
|
||||
return (0);
|
||||
|
||||
@ -558,12 +558,12 @@ usb2_pc_alloc_mem(struct usb_page_cache *pc, struct usb_page *pg,
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_pc_free_mem - free DMA memory
|
||||
* usb_pc_free_mem - free DMA memory
|
||||
*
|
||||
* This function is NULL safe.
|
||||
*------------------------------------------------------------------------*/
|
||||
void
|
||||
usb2_pc_free_mem(struct usb_page_cache *pc)
|
||||
usb_pc_free_mem(struct usb_page_cache *pc)
|
||||
{
|
||||
if (pc && pc->buffer) {
|
||||
|
||||
@ -576,14 +576,14 @@ usb2_pc_free_mem(struct usb_page_cache *pc)
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_pc_load_mem - load virtual memory into DMA
|
||||
* usb_pc_load_mem - load virtual memory into DMA
|
||||
*
|
||||
* Return values:
|
||||
* 0: Success
|
||||
* Else: Error
|
||||
*------------------------------------------------------------------------*/
|
||||
uint8_t
|
||||
usb2_pc_load_mem(struct usb_page_cache *pc, usb_size_t size, uint8_t sync)
|
||||
usb_pc_load_mem(struct usb_page_cache *pc, usb_size_t size, uint8_t sync)
|
||||
{
|
||||
/* setup page cache */
|
||||
pc->page_offset_buf = 0;
|
||||
@ -610,7 +610,7 @@ usb2_pc_load_mem(struct usb_page_cache *pc, usb_size_t size, uint8_t sync)
|
||||
*/
|
||||
err = bus_dmamap_load(
|
||||
pc->tag, pc->map, pc->buffer, size,
|
||||
&usb2_pc_alloc_mem_cb, pc, BUS_DMA_WAITOK);
|
||||
&usb_pc_alloc_mem_cb, pc, BUS_DMA_WAITOK);
|
||||
if (err == EINPROGRESS) {
|
||||
cv_wait(uptag->cv, uptag->mtx);
|
||||
err = 0;
|
||||
@ -632,7 +632,7 @@ usb2_pc_load_mem(struct usb_page_cache *pc, usb_size_t size, uint8_t sync)
|
||||
*/
|
||||
if (bus_dmamap_load(
|
||||
pc->tag, pc->map, pc->buffer, size,
|
||||
&usb2_pc_load_mem_cb, pc, BUS_DMA_WAITOK)) {
|
||||
&usb_pc_load_mem_cb, pc, BUS_DMA_WAITOK)) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -649,10 +649,10 @@ usb2_pc_load_mem(struct usb_page_cache *pc, usb_size_t size, uint8_t sync)
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_pc_cpu_invalidate - invalidate CPU cache
|
||||
* usb_pc_cpu_invalidate - invalidate CPU cache
|
||||
*------------------------------------------------------------------------*/
|
||||
void
|
||||
usb2_pc_cpu_invalidate(struct usb_page_cache *pc)
|
||||
usb_pc_cpu_invalidate(struct usb_page_cache *pc)
|
||||
{
|
||||
if (pc->page_offset_end == pc->page_offset_buf) {
|
||||
/* nothing has been loaded into this page cache! */
|
||||
@ -663,10 +663,10 @@ usb2_pc_cpu_invalidate(struct usb_page_cache *pc)
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_pc_cpu_flush - flush CPU cache
|
||||
* usb_pc_cpu_flush - flush CPU cache
|
||||
*------------------------------------------------------------------------*/
|
||||
void
|
||||
usb2_pc_cpu_flush(struct usb_page_cache *pc)
|
||||
usb_pc_cpu_flush(struct usb_page_cache *pc)
|
||||
{
|
||||
if (pc->page_offset_end == pc->page_offset_buf) {
|
||||
/* nothing has been loaded into this page cache! */
|
||||
@ -677,14 +677,14 @@ usb2_pc_cpu_flush(struct usb_page_cache *pc)
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_pc_dmamap_create - create a DMA map
|
||||
* usb_pc_dmamap_create - create a DMA map
|
||||
*
|
||||
* Returns:
|
||||
* 0: Success
|
||||
* Else: Failure
|
||||
*------------------------------------------------------------------------*/
|
||||
uint8_t
|
||||
usb2_pc_dmamap_create(struct usb_page_cache *pc, usb_size_t size)
|
||||
usb_pc_dmamap_create(struct usb_page_cache *pc, usb_size_t size)
|
||||
{
|
||||
struct usb_xfer_root *info;
|
||||
struct usb_dma_tag *utag;
|
||||
@ -696,7 +696,7 @@ usb2_pc_dmamap_create(struct usb_page_cache *pc, usb_size_t size)
|
||||
if (info == NULL) {
|
||||
goto error;
|
||||
}
|
||||
utag = usb2_dma_tag_find(pc->tag_parent, size, 1);
|
||||
utag = usb_dma_tag_find(pc->tag_parent, size, 1);
|
||||
if (utag == NULL) {
|
||||
goto error;
|
||||
}
|
||||
@ -714,12 +714,12 @@ usb2_pc_dmamap_create(struct usb_page_cache *pc, usb_size_t size)
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_pc_dmamap_destroy
|
||||
* usb_pc_dmamap_destroy
|
||||
*
|
||||
* This function is NULL safe.
|
||||
*------------------------------------------------------------------------*/
|
||||
void
|
||||
usb2_pc_dmamap_destroy(struct usb_page_cache *pc)
|
||||
usb_pc_dmamap_destroy(struct usb_page_cache *pc)
|
||||
{
|
||||
if (pc && pc->tag) {
|
||||
bus_dmamap_destroy(pc->tag, pc->map);
|
||||
@ -729,10 +729,10 @@ usb2_pc_dmamap_destroy(struct usb_page_cache *pc)
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_dma_tag_find - factored out code
|
||||
* usb_dma_tag_find - factored out code
|
||||
*------------------------------------------------------------------------*/
|
||||
struct usb_dma_tag *
|
||||
usb2_dma_tag_find(struct usb_dma_parent_tag *udpt,
|
||||
usb_dma_tag_find(struct usb_dma_parent_tag *udpt,
|
||||
usb_size_t size, usb_size_t align)
|
||||
{
|
||||
struct usb_dma_tag *udt;
|
||||
@ -747,7 +747,7 @@ usb2_dma_tag_find(struct usb_dma_parent_tag *udpt,
|
||||
while (nudt--) {
|
||||
|
||||
if (udt->align == 0) {
|
||||
usb2_dma_tag_create(udt, size, align);
|
||||
usb_dma_tag_create(udt, size, align);
|
||||
if (udt->tag == NULL) {
|
||||
return (NULL);
|
||||
}
|
||||
@ -764,10 +764,10 @@ usb2_dma_tag_find(struct usb_dma_parent_tag *udpt,
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_dma_tag_setup - initialise USB DMA tags
|
||||
* usb_dma_tag_setup - initialise USB DMA tags
|
||||
*------------------------------------------------------------------------*/
|
||||
void
|
||||
usb2_dma_tag_setup(struct usb_dma_parent_tag *udpt,
|
||||
usb_dma_tag_setup(struct usb_dma_parent_tag *udpt,
|
||||
struct usb_dma_tag *udt, bus_dma_tag_t dmat,
|
||||
struct mtx *mtx, usb_dma_callback_t *func,
|
||||
uint8_t ndmabits, uint8_t nudt)
|
||||
@ -800,10 +800,10 @@ usb2_dma_tag_setup(struct usb_dma_parent_tag *udpt,
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_bus_tag_unsetup - factored out code
|
||||
* usb_bus_tag_unsetup - factored out code
|
||||
*------------------------------------------------------------------------*/
|
||||
void
|
||||
usb2_dma_tag_unsetup(struct usb_dma_parent_tag *udpt)
|
||||
usb_dma_tag_unsetup(struct usb_dma_parent_tag *udpt)
|
||||
{
|
||||
struct usb_dma_tag *udt;
|
||||
uint8_t nudt;
|
||||
@ -815,7 +815,7 @@ usb2_dma_tag_unsetup(struct usb_dma_parent_tag *udpt)
|
||||
|
||||
if (udt->align) {
|
||||
/* destroy the USB DMA tag */
|
||||
usb2_dma_tag_destroy(udt);
|
||||
usb_dma_tag_destroy(udt);
|
||||
udt->align = 0;
|
||||
}
|
||||
udt++;
|
||||
@ -828,13 +828,13 @@ usb2_dma_tag_unsetup(struct usb_dma_parent_tag *udpt)
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_bdma_work_loop
|
||||
* usb_bdma_work_loop
|
||||
*
|
||||
* This function handles loading of virtual buffers into DMA and is
|
||||
* only called when "dma_refcount" is zero.
|
||||
*------------------------------------------------------------------------*/
|
||||
void
|
||||
usb2_bdma_work_loop(struct usb_xfer_queue *pq)
|
||||
usb_bdma_work_loop(struct usb_xfer_queue *pq)
|
||||
{
|
||||
struct usb_xfer_root *info;
|
||||
struct usb_xfer *xfer;
|
||||
@ -848,7 +848,7 @@ usb2_bdma_work_loop(struct usb_xfer_queue *pq)
|
||||
if (xfer->error) {
|
||||
/* some error happened */
|
||||
USB_BUS_LOCK(info->bus);
|
||||
usb2_transfer_done(xfer, 0);
|
||||
usbd_transfer_done(xfer, 0);
|
||||
USB_BUS_UNLOCK(info->bus);
|
||||
return;
|
||||
}
|
||||
@ -922,7 +922,7 @@ usb2_bdma_work_loop(struct usb_xfer_queue *pq)
|
||||
}
|
||||
if (info->dma_error) {
|
||||
USB_BUS_LOCK(info->bus);
|
||||
usb2_transfer_done(xfer, USB_ERR_DMA_LOAD_FAILED);
|
||||
usbd_transfer_done(xfer, USB_ERR_DMA_LOAD_FAILED);
|
||||
USB_BUS_UNLOCK(info->bus);
|
||||
return;
|
||||
}
|
||||
@ -930,12 +930,12 @@ usb2_bdma_work_loop(struct usb_xfer_queue *pq)
|
||||
|
||||
if (info->dma_currframe == 0) {
|
||||
/* special case */
|
||||
usb2_pc_load_mem(xfer->frbuffers,
|
||||
usb_pc_load_mem(xfer->frbuffers,
|
||||
info->dma_frlength_0, 0);
|
||||
} else {
|
||||
/* default case */
|
||||
nframes = info->dma_currframe;
|
||||
usb2_pc_load_mem(xfer->frbuffers + nframes,
|
||||
usb_pc_load_mem(xfer->frbuffers + nframes,
|
||||
xfer->frlengths[nframes], 0);
|
||||
}
|
||||
|
||||
@ -945,23 +945,23 @@ usb2_bdma_work_loop(struct usb_xfer_queue *pq)
|
||||
return;
|
||||
}
|
||||
/* go ahead */
|
||||
usb2_bdma_pre_sync(xfer);
|
||||
usb_bdma_pre_sync(xfer);
|
||||
|
||||
/* start loading next USB transfer, if any */
|
||||
usb2_command_wrapper(pq, NULL);
|
||||
usb_command_wrapper(pq, NULL);
|
||||
|
||||
/* finally start the hardware */
|
||||
usb2_pipe_enter(xfer);
|
||||
usbd_pipe_enter(xfer);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_bdma_done_event
|
||||
* usb_bdma_done_event
|
||||
*
|
||||
* This function is called when the BUS-DMA has loaded virtual memory
|
||||
* into DMA, if any.
|
||||
*------------------------------------------------------------------------*/
|
||||
void
|
||||
usb2_bdma_done_event(struct usb_dma_parent_tag *udpt)
|
||||
usb_bdma_done_event(struct usb_dma_parent_tag *udpt)
|
||||
{
|
||||
struct usb_xfer_root *info;
|
||||
|
||||
@ -973,18 +973,18 @@ usb2_bdma_done_event(struct usb_dma_parent_tag *udpt)
|
||||
info->dma_error = udpt->dma_error;
|
||||
|
||||
/* enter workloop again */
|
||||
usb2_command_wrapper(&info->dma_q,
|
||||
usb_command_wrapper(&info->dma_q,
|
||||
info->dma_q.curr);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_bdma_pre_sync
|
||||
* usb_bdma_pre_sync
|
||||
*
|
||||
* This function handles DMA synchronisation that must be done before
|
||||
* an USB transfer is started.
|
||||
*------------------------------------------------------------------------*/
|
||||
void
|
||||
usb2_bdma_pre_sync(struct usb_xfer *xfer)
|
||||
usb_bdma_pre_sync(struct usb_xfer *xfer)
|
||||
{
|
||||
struct usb_page_cache *pc;
|
||||
usb_frcount_t nframes;
|
||||
@ -1002,22 +1002,22 @@ usb2_bdma_pre_sync(struct usb_xfer *xfer)
|
||||
while (nframes--) {
|
||||
|
||||
if (pc->isread) {
|
||||
usb2_pc_cpu_invalidate(pc);
|
||||
usb_pc_cpu_invalidate(pc);
|
||||
} else {
|
||||
usb2_pc_cpu_flush(pc);
|
||||
usb_pc_cpu_flush(pc);
|
||||
}
|
||||
pc++;
|
||||
}
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_bdma_post_sync
|
||||
* usb_bdma_post_sync
|
||||
*
|
||||
* This function handles DMA synchronisation that must be done after
|
||||
* an USB transfer is complete.
|
||||
*------------------------------------------------------------------------*/
|
||||
void
|
||||
usb2_bdma_post_sync(struct usb_xfer *xfer)
|
||||
usb_bdma_post_sync(struct usb_xfer *xfer)
|
||||
{
|
||||
struct usb_page_cache *pc;
|
||||
usb_frcount_t nframes;
|
||||
@ -1034,7 +1034,7 @@ usb2_bdma_post_sync(struct usb_xfer *xfer)
|
||||
|
||||
while (nframes--) {
|
||||
if (pc->isread) {
|
||||
usb2_pc_cpu_invalidate(pc);
|
||||
usb_pc_cpu_invalidate(pc);
|
||||
}
|
||||
pc++;
|
||||
}
|
||||
|
@ -136,40 +136,40 @@ struct usb_dma_tag {}; /* empty struct */
|
||||
|
||||
/* function prototypes */
|
||||
|
||||
int usb2_uiomove(struct usb_page_cache *pc, struct uio *uio,
|
||||
int usb_uiomove(struct usb_page_cache *pc, struct uio *uio,
|
||||
usb_frlength_t pc_offset, usb_frlength_t len);
|
||||
struct usb_dma_tag *usb2_dma_tag_find(struct usb_dma_parent_tag *udpt,
|
||||
struct usb_dma_tag *usb_dma_tag_find(struct usb_dma_parent_tag *udpt,
|
||||
usb_size_t size, usb_size_t align);
|
||||
uint8_t usb2_pc_alloc_mem(struct usb_page_cache *pc, struct usb_page *pg,
|
||||
uint8_t usb_pc_alloc_mem(struct usb_page_cache *pc, struct usb_page *pg,
|
||||
usb_size_t size, usb_size_t align);
|
||||
uint8_t usb2_pc_dmamap_create(struct usb_page_cache *pc, usb_size_t size);
|
||||
uint8_t usb2_pc_load_mem(struct usb_page_cache *pc, usb_size_t size,
|
||||
uint8_t usb_pc_dmamap_create(struct usb_page_cache *pc, usb_size_t size);
|
||||
uint8_t usb_pc_load_mem(struct usb_page_cache *pc, usb_size_t size,
|
||||
uint8_t sync);
|
||||
void usb2_bdma_done_event(struct usb_dma_parent_tag *udpt);
|
||||
void usb2_bdma_post_sync(struct usb_xfer *xfer);
|
||||
void usb2_bdma_pre_sync(struct usb_xfer *xfer);
|
||||
void usb2_bdma_work_loop(struct usb_xfer_queue *pq);
|
||||
void usb2_bzero(struct usb_page_cache *cache, usb_frlength_t offset,
|
||||
void usb_bdma_done_event(struct usb_dma_parent_tag *udpt);
|
||||
void usb_bdma_post_sync(struct usb_xfer *xfer);
|
||||
void usb_bdma_pre_sync(struct usb_xfer *xfer);
|
||||
void usb_bdma_work_loop(struct usb_xfer_queue *pq);
|
||||
void usbd_frame_zero(struct usb_page_cache *cache, usb_frlength_t offset,
|
||||
usb_frlength_t len);
|
||||
void usb2_copy_in(struct usb_page_cache *cache, usb_frlength_t offset,
|
||||
void usbd_copy_in(struct usb_page_cache *cache, usb_frlength_t offset,
|
||||
const void *ptr, usb_frlength_t len);
|
||||
int usb2_copy_in_user(struct usb_page_cache *cache, usb_frlength_t offset,
|
||||
int usbd_copy_in_user(struct usb_page_cache *cache, usb_frlength_t offset,
|
||||
const void *ptr, usb_frlength_t len);
|
||||
void usb2_copy_out(struct usb_page_cache *cache, usb_frlength_t offset,
|
||||
void usbd_copy_out(struct usb_page_cache *cache, usb_frlength_t offset,
|
||||
void *ptr, usb_frlength_t len);
|
||||
int usb2_copy_out_user(struct usb_page_cache *cache, usb_frlength_t offset,
|
||||
int usbd_copy_out_user(struct usb_page_cache *cache, usb_frlength_t offset,
|
||||
void *ptr, usb_frlength_t len);
|
||||
void usb2_dma_tag_setup(struct usb_dma_parent_tag *udpt,
|
||||
void usb_dma_tag_setup(struct usb_dma_parent_tag *udpt,
|
||||
struct usb_dma_tag *udt, bus_dma_tag_t dmat, struct mtx *mtx,
|
||||
usb_dma_callback_t *func, uint8_t ndmabits, uint8_t nudt);
|
||||
void usb2_dma_tag_unsetup(struct usb_dma_parent_tag *udpt);
|
||||
void usb2_get_page(struct usb_page_cache *pc, usb_frlength_t offset,
|
||||
void usb_dma_tag_unsetup(struct usb_dma_parent_tag *udpt);
|
||||
void usbd_get_page(struct usb_page_cache *pc, usb_frlength_t offset,
|
||||
struct usb_page_search *res);
|
||||
void usb2_m_copy_in(struct usb_page_cache *cache, usb_frlength_t dst_offset,
|
||||
void usbd_m_copy_in(struct usb_page_cache *cache, usb_frlength_t dst_offset,
|
||||
struct mbuf *m, usb_size_t src_offset, usb_frlength_t src_len);
|
||||
void usb2_pc_cpu_flush(struct usb_page_cache *pc);
|
||||
void usb2_pc_cpu_invalidate(struct usb_page_cache *pc);
|
||||
void usb2_pc_dmamap_destroy(struct usb_page_cache *pc);
|
||||
void usb2_pc_free_mem(struct usb_page_cache *pc);
|
||||
void usb_pc_cpu_flush(struct usb_page_cache *pc);
|
||||
void usb_pc_cpu_invalidate(struct usb_page_cache *pc);
|
||||
void usb_pc_dmamap_destroy(struct usb_page_cache *pc);
|
||||
void usb_pc_free_mem(struct usb_page_cache *pc);
|
||||
|
||||
#endif /* _USB2_BUSDMA_H_ */
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include <dev/usb/usb_error.h>
|
||||
#include <dev/usb/usb_ioctl.h>
|
||||
|
||||
#define USB_DEBUG_VAR usb2_debug
|
||||
#define USB_DEBUG_VAR usb_debug
|
||||
|
||||
#include <dev/usb/usb_core.h>
|
||||
#include <dev/usb/usb_compat_linux.h>
|
||||
@ -254,7 +254,7 @@ usb_linux_attach(device_t dev)
|
||||
}
|
||||
if (usb_linux_create_usb_device(uaa->device, dev) != 0)
|
||||
return (ENOMEM);
|
||||
device_set_usb2_desc(dev);
|
||||
device_set_usb_desc(dev);
|
||||
|
||||
sc->sc_fbsd_udev = uaa->device;
|
||||
sc->sc_fbsd_dev = dev;
|
||||
@ -359,7 +359,7 @@ static uint16_t
|
||||
usb_max_isoc_frames(struct usb_device *dev)
|
||||
{
|
||||
; /* indent fix */
|
||||
switch (usb2_get_speed(dev)) {
|
||||
switch (usbd_get_speed(dev)) {
|
||||
case USB_SPEED_LOW:
|
||||
case USB_SPEED_FULL:
|
||||
return (USB_MAX_FULL_SPEED_ISOC_FRAMES);
|
||||
@ -403,8 +403,8 @@ usb_submit_urb(struct urb *urb, uint16_t mem_flags)
|
||||
|
||||
urb->status = -EINPROGRESS;
|
||||
|
||||
usb2_transfer_start(uhe->bsd_xfer[0]);
|
||||
usb2_transfer_start(uhe->bsd_xfer[1]);
|
||||
usbd_transfer_start(uhe->bsd_xfer[0]);
|
||||
usbd_transfer_start(uhe->bsd_xfer[1]);
|
||||
} else {
|
||||
/* no pipes have been setup yet! */
|
||||
urb->status = -EINVAL;
|
||||
@ -430,16 +430,16 @@ usb_unlink_bsd(struct usb_xfer *xfer,
|
||||
struct urb *urb, uint8_t drain)
|
||||
{
|
||||
if (xfer &&
|
||||
usb2_transfer_pending(xfer) &&
|
||||
usbd_transfer_pending(xfer) &&
|
||||
(xfer->priv_fifo == (void *)urb)) {
|
||||
if (drain) {
|
||||
mtx_unlock(&Giant);
|
||||
usb2_transfer_drain(xfer);
|
||||
usbd_transfer_drain(xfer);
|
||||
mtx_lock(&Giant);
|
||||
} else {
|
||||
usb2_transfer_stop(xfer);
|
||||
usbd_transfer_stop(xfer);
|
||||
}
|
||||
usb2_transfer_start(xfer);
|
||||
usbd_transfer_start(xfer);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
ep = usb2_get_endpoint(dev, uhe->bsd_iface_index, cfg);
|
||||
ep = usbd_get_endpoint(dev, uhe->bsd_iface_index, cfg);
|
||||
if (ep == NULL)
|
||||
return (-EINVAL);
|
||||
|
||||
usb2_clear_data_toggle(dev, ep);
|
||||
usbd_clear_data_toggle(dev, ep);
|
||||
|
||||
return (usb_control_msg(dev, &dev->ep0,
|
||||
UR_CLEAR_FEATURE, UT_WRITE_ENDPOINT,
|
||||
@ -618,7 +618,7 @@ usb_control_msg(struct usb_device *dev, struct usb_host_endpoint *uhe,
|
||||
* The FreeBSD USB stack supports standard control
|
||||
* transfers on control endpoint zero:
|
||||
*/
|
||||
err = usb2_do_request_flags(dev,
|
||||
err = usbd_do_request_flags(dev,
|
||||
&Giant, &req, data, USB_SHORT_XFER_OK,
|
||||
&actlen, timeout);
|
||||
if (err) {
|
||||
@ -689,7 +689,7 @@ usb_set_interface(struct usb_device *dev, uint8_t iface_no, uint8_t alt_index)
|
||||
if (alt_index >= p_ui->num_altsetting)
|
||||
return (-EINVAL);
|
||||
usb_linux_cleanup_interface(dev, p_ui);
|
||||
err = -usb2_set_alt_interface_index(dev,
|
||||
err = -usbd_set_alt_interface_index(dev,
|
||||
p_ui->bsd_iface_index, alt_index);
|
||||
if (err == 0) {
|
||||
p_ui->cur_altsetting = p_ui->altsetting + alt_index;
|
||||
@ -720,7 +720,7 @@ usb_setup_endpoint(struct usb_device *dev,
|
||||
/* optimize */
|
||||
return (0);
|
||||
}
|
||||
usb2_transfer_unsetup(uhe->bsd_xfer, 2);
|
||||
usbd_transfer_unsetup(uhe->bsd_xfer, 2);
|
||||
|
||||
uhe->fbsd_buf_size = bufsize;
|
||||
|
||||
@ -759,7 +759,7 @@ usb_setup_endpoint(struct usb_device *dev,
|
||||
|
||||
/* Allocate and setup two generic FreeBSD USB transfers */
|
||||
|
||||
if (usb2_transfer_setup(dev, &uhe->bsd_iface_index,
|
||||
if (usbd_transfer_setup(dev, &uhe->bsd_iface_index,
|
||||
uhe->bsd_xfer, cfg, 2, uhe, &Giant)) {
|
||||
return (-EINVAL);
|
||||
}
|
||||
@ -779,7 +779,7 @@ usb_setup_endpoint(struct usb_device *dev,
|
||||
cfg[0].flags.proxy_buffer = 1;
|
||||
cfg[0].flags.short_xfer_ok = 1;
|
||||
|
||||
if (usb2_transfer_setup(dev, &uhe->bsd_iface_index,
|
||||
if (usbd_transfer_setup(dev, &uhe->bsd_iface_index,
|
||||
uhe->bsd_xfer, cfg, 1, uhe, &Giant)) {
|
||||
return (-EINVAL);
|
||||
}
|
||||
@ -797,7 +797,7 @@ usb_setup_endpoint(struct usb_device *dev,
|
||||
static int
|
||||
usb_linux_create_usb_device(struct usb_device *udev, device_t dev)
|
||||
{
|
||||
struct usb_config_descriptor *cd = usb2_get_config_descriptor(udev);
|
||||
struct usb_config_descriptor *cd = usbd_get_config_descriptor(udev);
|
||||
struct usb_descriptor *desc;
|
||||
struct usb_interface_descriptor *id;
|
||||
struct usb_endpoint_descriptor *ed;
|
||||
@ -828,7 +828,7 @@ usb_linux_create_usb_device(struct usb_device *udev, device_t dev)
|
||||
* Iterate over all the USB descriptors. Use the USB config
|
||||
* descriptor pointer provided by the FreeBSD USB stack.
|
||||
*/
|
||||
while ((desc = usb2_desc_foreach(cd, desc))) {
|
||||
while ((desc = usb_desc_foreach(cd, desc))) {
|
||||
|
||||
/*
|
||||
* Build up a tree according to the descriptors we
|
||||
@ -1065,10 +1065,10 @@ usb_buffer_alloc(struct usb_device *dev, usb_size_t size, uint16_t mem_flags, ui
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb_get_intfdata
|
||||
* usbd_get_intfdata
|
||||
*------------------------------------------------------------------------*/
|
||||
void *
|
||||
usb_get_intfdata(struct usb_interface *intf)
|
||||
usbd_get_intfdata(struct usb_interface *intf)
|
||||
{
|
||||
return (intf->bsd_priv_sc);
|
||||
}
|
||||
@ -1091,7 +1091,7 @@ usb_linux_register(void *arg)
|
||||
LIST_INSERT_HEAD(&usb_linux_driver_list, drv, linux_driver_list);
|
||||
mtx_unlock(&Giant);
|
||||
|
||||
usb2_needs_explore_all();
|
||||
usb_needs_explore_all();
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
@ -1306,7 +1306,7 @@ usb_linux_isoc_callback(struct usb_xfer *xfer)
|
||||
uipd->actual_length = xfer->frlengths[x];
|
||||
uipd->status = 0;
|
||||
if (!xfer->flags.ext_buffer) {
|
||||
usb2_copy_out(xfer->frbuffers, offset,
|
||||
usbd_copy_out(xfer->frbuffers, offset,
|
||||
USB_ADD_BYTES(urb->transfer_buffer,
|
||||
uipd->offset), uipd->actual_length);
|
||||
}
|
||||
@ -1377,7 +1377,7 @@ usb_linux_isoc_callback(struct usb_xfer *xfer)
|
||||
uipd = urb->iso_frame_desc + x;
|
||||
xfer->frlengths[x] = uipd->length;
|
||||
if (!xfer->flags.ext_buffer) {
|
||||
usb2_copy_in(xfer->frbuffers, offset,
|
||||
usbd_copy_in(xfer->frbuffers, offset,
|
||||
USB_ADD_BYTES(urb->transfer_buffer,
|
||||
uipd->offset), uipd->length);
|
||||
}
|
||||
@ -1402,14 +1402,14 @@ usb_linux_isoc_callback(struct usb_xfer *xfer)
|
||||
|
||||
if (xfer->flags.ext_buffer) {
|
||||
/* set virtual address to load */
|
||||
usb2_set_frame_data(xfer,
|
||||
usbd_set_frame_data(xfer,
|
||||
urb->transfer_buffer, 0);
|
||||
}
|
||||
xfer->priv_fifo = urb;
|
||||
xfer->flags.force_short_xfer = 0;
|
||||
xfer->timeout = urb->timeout;
|
||||
xfer->nframes = urb->number_of_packets;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
@ -1473,7 +1473,7 @@ usb_linux_non_isoc_callback(struct usb_xfer *xfer)
|
||||
}
|
||||
if (urb->bsd_isread && (!xfer->flags.ext_buffer)) {
|
||||
/* copy in data with regard to the URB */
|
||||
usb2_copy_out(xfer->frbuffers + data_frame, 0,
|
||||
usbd_copy_out(xfer->frbuffers + data_frame, 0,
|
||||
urb->bsd_data_ptr, xfer->frlengths[data_frame]);
|
||||
}
|
||||
urb->bsd_length_rem -= xfer->frlengths[data_frame];
|
||||
@ -1524,11 +1524,11 @@ usb_linux_non_isoc_callback(struct usb_xfer *xfer)
|
||||
* First copy in the header, then copy in data!
|
||||
*/
|
||||
if (!xfer->flags.ext_buffer) {
|
||||
usb2_copy_in(xfer->frbuffers, 0,
|
||||
usbd_copy_in(xfer->frbuffers, 0,
|
||||
urb->setup_packet, REQ_SIZE);
|
||||
} else {
|
||||
/* set virtual address to load */
|
||||
usb2_set_frame_data(xfer,
|
||||
usbd_set_frame_data(xfer,
|
||||
urb->setup_packet, 0);
|
||||
}
|
||||
|
||||
@ -1567,11 +1567,11 @@ usb_linux_non_isoc_callback(struct usb_xfer *xfer)
|
||||
|
||||
if (xfer->flags.ext_buffer) {
|
||||
/* set virtual address to load */
|
||||
usb2_set_frame_data(xfer, urb->bsd_data_ptr,
|
||||
usbd_set_frame_data(xfer, urb->bsd_data_ptr,
|
||||
data_frame);
|
||||
} else if (!urb->bsd_isread) {
|
||||
/* copy out data with regard to the URB */
|
||||
usb2_copy_in(xfer->frbuffers + data_frame, 0,
|
||||
usbd_copy_in(xfer->frbuffers + data_frame, 0,
|
||||
urb->bsd_data_ptr, max_bulk);
|
||||
}
|
||||
xfer->frlengths[data_frame] = max_bulk;
|
||||
@ -1584,7 +1584,7 @@ usb_linux_non_isoc_callback(struct usb_xfer *xfer)
|
||||
} else {
|
||||
xfer->nframes = 1;
|
||||
}
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
|
||||
default:
|
||||
|
@ -328,7 +328,7 @@ struct usb_interface *usb_ifnum_to_if(struct usb_device *dev, uint8_t iface_no);
|
||||
|
||||
void *usb_buffer_alloc(struct usb_device *dev, usb_size_t size,
|
||||
uint16_t mem_flags, uint8_t *dma_addr);
|
||||
void *usb_get_intfdata(struct usb_interface *intf);
|
||||
void *usbd_get_intfdata(struct usb_interface *intf);
|
||||
|
||||
void usb_buffer_free(struct usb_device *dev, usb_size_t size, void *addr, uint8_t dma_addr);
|
||||
void usb_free_urb(struct urb *urb);
|
||||
|
@ -183,11 +183,11 @@ struct usb_temp_setup {
|
||||
|
||||
/* prototypes */
|
||||
|
||||
void usb2_bus_mem_flush_all(struct usb_bus *bus, usb_bus_mem_cb_t *cb);
|
||||
uint8_t usb2_bus_mem_alloc_all(struct usb_bus *bus, bus_dma_tag_t dmat, usb_bus_mem_cb_t *cb);
|
||||
void usb2_bus_mem_free_all(struct usb_bus *bus, usb_bus_mem_cb_t *cb);
|
||||
uint16_t usb2_isoc_time_expand(struct usb_bus *bus, uint16_t isoc_time_curr);
|
||||
uint16_t usb2_fs_isoc_schedule_isoc_time_expand(struct usb_device *udev, struct usb_fs_isoc_schedule **pp_start, struct usb_fs_isoc_schedule **pp_end, uint16_t isoc_time);
|
||||
uint8_t usb2_fs_isoc_schedule_alloc(struct usb_fs_isoc_schedule *fss, uint8_t *pstart, uint16_t len);
|
||||
void usb_bus_mem_flush_all(struct usb_bus *bus, usb_bus_mem_cb_t *cb);
|
||||
uint8_t usb_bus_mem_alloc_all(struct usb_bus *bus, bus_dma_tag_t dmat, usb_bus_mem_cb_t *cb);
|
||||
void usb_bus_mem_free_all(struct usb_bus *bus, usb_bus_mem_cb_t *cb);
|
||||
uint16_t usb_isoc_time_expand(struct usb_bus *bus, uint16_t isoc_time_curr);
|
||||
uint16_t usbd_fs_isoc_schedule_isoc_time_expand(struct usb_device *udev, struct usb_fs_isoc_schedule **pp_start, struct usb_fs_isoc_schedule **pp_end, uint16_t isoc_time);
|
||||
uint8_t usbd_fs_isoc_schedule_alloc(struct usb_fs_isoc_schedule *fss, uint8_t *pstart, uint16_t len);
|
||||
|
||||
#endif /* _USB2_CONTROLLER_H_ */
|
||||
|
@ -216,7 +216,7 @@
|
||||
* The following macro will return the current state of an USB
|
||||
* transfer like defined by the "USB_ST_XXX" enums.
|
||||
*/
|
||||
#define USB_GET_STATE(xfer) ((xfer)->usb2_state)
|
||||
#define USB_GET_STATE(xfer) ((xfer)->usb_state)
|
||||
|
||||
/*
|
||||
* The following macro will tell if an USB transfer is currently
|
||||
@ -238,11 +238,11 @@
|
||||
|
||||
/* macros */
|
||||
|
||||
#define usb2_callout_init_mtx(c,m,f) callout_init_mtx(&(c)->co,m,f)
|
||||
#define usb2_callout_reset(c,t,f,d) callout_reset(&(c)->co,t,f,d)
|
||||
#define usb2_callout_stop(c) callout_stop(&(c)->co)
|
||||
#define usb2_callout_drain(c) callout_drain(&(c)->co)
|
||||
#define usb2_callout_pending(c) callout_pending(&(c)->co)
|
||||
#define usb_callout_init_mtx(c,m,f) callout_init_mtx(&(c)->co,m,f)
|
||||
#define usb_callout_reset(c,t,f,d) callout_reset(&(c)->co,t,f,d)
|
||||
#define usb_callout_stop(c) callout_stop(&(c)->co)
|
||||
#define usb_callout_drain(c) callout_drain(&(c)->co)
|
||||
#define usb_callout_pending(c) callout_pending(&(c)->co)
|
||||
|
||||
#define USB_BUS_LOCK(_b) mtx_lock(&(_b)->bus_mtx)
|
||||
#define USB_BUS_UNLOCK(_b) mtx_unlock(&(_b)->bus_mtx)
|
||||
@ -446,10 +446,10 @@ struct usb_xfer {
|
||||
uint8_t address; /* physical USB address */
|
||||
uint8_t endpointno; /* physical USB endpoint */
|
||||
uint8_t max_packet_count;
|
||||
uint8_t usb2_smask;
|
||||
uint8_t usb2_cmask;
|
||||
uint8_t usb2_uframe;
|
||||
uint8_t usb2_state;
|
||||
uint8_t usb_smask;
|
||||
uint8_t usb_cmask;
|
||||
uint8_t usb_uframe;
|
||||
uint8_t usb_state;
|
||||
|
||||
usb_error_t error;
|
||||
|
||||
@ -461,7 +461,7 @@ struct usb_xfer {
|
||||
* The following structure keeps information that is used to match
|
||||
* against an array of "usb_device_id" elements.
|
||||
*/
|
||||
struct usb_lookup_info {
|
||||
struct usbd_lookup_info {
|
||||
uint16_t idVendor;
|
||||
uint16_t idProduct;
|
||||
uint16_t bcdDevice;
|
||||
@ -480,7 +480,7 @@ struct usb_lookup_info {
|
||||
/* Structure used by probe and attach */
|
||||
|
||||
struct usb_attach_arg {
|
||||
struct usb_lookup_info info;
|
||||
struct usbd_lookup_info info;
|
||||
device_t temp_dev; /* for internal use */
|
||||
unsigned long driver_info; /* for internal use */
|
||||
void *driver_ivar;
|
||||
@ -497,49 +497,49 @@ MALLOC_DECLARE(M_USB);
|
||||
MALLOC_DECLARE(M_USBDEV);
|
||||
MALLOC_DECLARE(M_USBHC);
|
||||
|
||||
extern struct mtx usb2_ref_lock;
|
||||
extern struct mtx usb_ref_lock;
|
||||
|
||||
/* prototypes */
|
||||
|
||||
const char *usb2_errstr(usb_error_t error);
|
||||
const char *usb2_statestr(enum usb_dev_state state);
|
||||
struct usb_config_descriptor *usb2_get_config_descriptor(
|
||||
const char *usbd_errstr(usb_error_t error);
|
||||
const char *usb_statestr(enum usb_dev_state state);
|
||||
struct usb_config_descriptor *usbd_get_config_descriptor(
|
||||
struct usb_device *udev);
|
||||
struct usb_device_descriptor *usb2_get_device_descriptor(
|
||||
struct usb_device_descriptor *usbd_get_device_descriptor(
|
||||
struct usb_device *udev);
|
||||
struct usb_interface *usb2_get_iface(struct usb_device *udev,
|
||||
struct usb_interface *usbd_get_iface(struct usb_device *udev,
|
||||
uint8_t iface_index);
|
||||
struct usb_interface_descriptor *usb2_get_interface_descriptor(
|
||||
struct usb_interface_descriptor *usbd_get_interface_descriptor(
|
||||
struct usb_interface *iface);
|
||||
uint8_t usb2_clear_stall_callback(struct usb_xfer *xfer1,
|
||||
uint8_t usbd_clear_stall_callback(struct usb_xfer *xfer1,
|
||||
struct usb_xfer *xfer2);
|
||||
uint8_t usb2_get_interface_altindex(struct usb_interface *iface);
|
||||
usb_error_t usb2_set_alt_interface_index(struct usb_device *udev,
|
||||
uint8_t usbd_get_interface_altindex(struct usb_interface *iface);
|
||||
usb_error_t usbd_set_alt_interface_index(struct usb_device *udev,
|
||||
uint8_t iface_index, uint8_t alt_index);
|
||||
enum usb_hc_mode usb2_get_mode(struct usb_device *udev);
|
||||
enum usb_dev_speed usb2_get_speed(struct usb_device *udev);
|
||||
uint32_t usb2_get_isoc_fps(struct usb_device *udev);
|
||||
usb_error_t usb2_transfer_setup(struct usb_device *udev,
|
||||
enum usb_hc_mode usbd_get_mode(struct usb_device *udev);
|
||||
enum usb_dev_speed usbd_get_speed(struct usb_device *udev);
|
||||
uint32_t usbd_get_isoc_fps(struct usb_device *udev);
|
||||
usb_error_t usbd_transfer_setup(struct usb_device *udev,
|
||||
const uint8_t *ifaces, struct usb_xfer **pxfer,
|
||||
const struct usb_config *setup_start, uint16_t n_setup,
|
||||
void *priv_sc, struct mtx *priv_mtx);
|
||||
void usb2_set_frame_data(struct usb_xfer *xfer, void *ptr,
|
||||
void usbd_set_frame_data(struct usb_xfer *xfer, void *ptr,
|
||||
usb_frcount_t frindex);
|
||||
void usb2_set_frame_offset(struct usb_xfer *xfer, usb_frlength_t offset,
|
||||
void usbd_set_frame_offset(struct usb_xfer *xfer, usb_frlength_t offset,
|
||||
usb_frcount_t frindex);
|
||||
void usb2_start_hardware(struct usb_xfer *xfer);
|
||||
void usb2_transfer_clear_stall(struct usb_xfer *xfer);
|
||||
void usb2_transfer_drain(struct usb_xfer *xfer);
|
||||
void usb2_transfer_set_stall(struct usb_xfer *xfer);
|
||||
uint8_t usb2_transfer_pending(struct usb_xfer *xfer);
|
||||
void usb2_transfer_start(struct usb_xfer *xfer);
|
||||
void usb2_transfer_stop(struct usb_xfer *xfer);
|
||||
void usb2_transfer_unsetup(struct usb_xfer **pxfer, uint16_t n_setup);
|
||||
void usb2_set_parent_iface(struct usb_device *udev, uint8_t iface_index,
|
||||
void usbd_transfer_submit(struct usb_xfer *xfer);
|
||||
void usbd_transfer_clear_stall(struct usb_xfer *xfer);
|
||||
void usbd_transfer_drain(struct usb_xfer *xfer);
|
||||
void usbd_transfer_set_stall(struct usb_xfer *xfer);
|
||||
uint8_t usbd_transfer_pending(struct usb_xfer *xfer);
|
||||
void usbd_transfer_start(struct usb_xfer *xfer);
|
||||
void usbd_transfer_stop(struct usb_xfer *xfer);
|
||||
void usbd_transfer_unsetup(struct usb_xfer **pxfer, uint16_t n_setup);
|
||||
void usbd_set_parent_iface(struct usb_device *udev, uint8_t iface_index,
|
||||
uint8_t parent_index);
|
||||
uint8_t usb2_get_bus_index(struct usb_device *udev);
|
||||
uint8_t usb2_get_device_index(struct usb_device *udev);
|
||||
void usb2_set_power_mode(struct usb_device *udev, uint8_t power_mode);
|
||||
uint8_t usb2_device_attached(struct usb_device *udev);
|
||||
uint8_t usbd_get_bus_index(struct usb_device *udev);
|
||||
uint8_t usbd_get_device_index(struct usb_device *udev);
|
||||
void usbd_set_power_mode(struct usb_device *udev, uint8_t power_mode);
|
||||
uint8_t usbd_device_attached(struct usb_device *udev);
|
||||
|
||||
#endif /* _USB2_CORE_H_ */
|
||||
|
@ -37,21 +37,21 @@
|
||||
* Define this unconditionally in case a kernel module is loaded that
|
||||
* has been compiled with debugging options.
|
||||
*/
|
||||
int usb2_debug = 0;
|
||||
int usb_debug = 0;
|
||||
|
||||
SYSCTL_NODE(_hw, OID_AUTO, usb, CTLFLAG_RW, 0, "USB debugging");
|
||||
SYSCTL_INT(_hw_usb, OID_AUTO, debug, CTLFLAG_RW,
|
||||
&usb2_debug, 0, "Debug level");
|
||||
&usb_debug, 0, "Debug level");
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_dump_iface
|
||||
* usb_dump_iface
|
||||
*
|
||||
* This function dumps information about an USB interface.
|
||||
*------------------------------------------------------------------------*/
|
||||
void
|
||||
usb2_dump_iface(struct usb_interface *iface)
|
||||
usb_dump_iface(struct usb_interface *iface)
|
||||
{
|
||||
printf("usb2_dump_iface: iface=%p\n", iface);
|
||||
printf("usb_dump_iface: iface=%p\n", iface);
|
||||
if (iface == NULL) {
|
||||
return;
|
||||
}
|
||||
@ -60,14 +60,14 @@ usb2_dump_iface(struct usb_interface *iface)
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_dump_device
|
||||
* usb_dump_device
|
||||
*
|
||||
* This function dumps information about an USB device.
|
||||
*------------------------------------------------------------------------*/
|
||||
void
|
||||
usb2_dump_device(struct usb_device *udev)
|
||||
usb_dump_device(struct usb_device *udev)
|
||||
{
|
||||
printf("usb2_dump_device: dev=%p\n", udev);
|
||||
printf("usb_dump_device: dev=%p\n", udev);
|
||||
if (udev == NULL) {
|
||||
return;
|
||||
}
|
||||
@ -80,16 +80,16 @@ usb2_dump_device(struct usb_device *udev)
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_dump_queue
|
||||
* usb_dump_queue
|
||||
*
|
||||
* This function dumps the USB transfer that are queued up on an USB endpoint.
|
||||
*------------------------------------------------------------------------*/
|
||||
void
|
||||
usb2_dump_queue(struct usb_endpoint *ep)
|
||||
usb_dump_queue(struct usb_endpoint *ep)
|
||||
{
|
||||
struct usb_xfer *xfer;
|
||||
|
||||
printf("usb2_dump_queue: endpoint=%p xfer: ", ep);
|
||||
printf("usb_dump_queue: endpoint=%p xfer: ", ep);
|
||||
TAILQ_FOREACH(xfer, &ep->endpoint_q.head, wait_entry) {
|
||||
printf(" %p", xfer);
|
||||
}
|
||||
@ -97,15 +97,15 @@ usb2_dump_queue(struct usb_endpoint *ep)
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_dump_endpoint
|
||||
* usb_dump_endpoint
|
||||
*
|
||||
* This function dumps information about an USB endpoint.
|
||||
*------------------------------------------------------------------------*/
|
||||
void
|
||||
usb2_dump_endpoint(struct usb_endpoint *ep)
|
||||
usb_dump_endpoint(struct usb_endpoint *ep)
|
||||
{
|
||||
if (ep) {
|
||||
printf("usb2_dump_endpoint: endpoint=%p", ep);
|
||||
printf("usb_dump_endpoint: endpoint=%p", ep);
|
||||
|
||||
printf(" edesc=%p isoc_next=%d toggle_next=%d",
|
||||
ep->edesc, ep->isoc_next, ep->toggle_next);
|
||||
@ -115,22 +115,22 @@ usb2_dump_endpoint(struct usb_endpoint *ep)
|
||||
ep->edesc->bEndpointAddress);
|
||||
}
|
||||
printf("\n");
|
||||
usb2_dump_queue(ep);
|
||||
usb_dump_queue(ep);
|
||||
} else {
|
||||
printf("usb2_dump_endpoint: endpoint=NULL\n");
|
||||
printf("usb_dump_endpoint: endpoint=NULL\n");
|
||||
}
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_dump_xfer
|
||||
* usb_dump_xfer
|
||||
*
|
||||
* This function dumps information about an USB transfer.
|
||||
*------------------------------------------------------------------------*/
|
||||
void
|
||||
usb2_dump_xfer(struct usb_xfer *xfer)
|
||||
usb_dump_xfer(struct usb_xfer *xfer)
|
||||
{
|
||||
struct usb_device *udev;
|
||||
printf("usb2_dump_xfer: xfer=%p\n", xfer);
|
||||
printf("usb_dump_xfer: xfer=%p\n", xfer);
|
||||
if (xfer == NULL) {
|
||||
return;
|
||||
}
|
||||
|
@ -33,7 +33,7 @@
|
||||
SYSCTL_DECL(_hw_usb);
|
||||
|
||||
/* Declare global USB debug variable. */
|
||||
extern int usb2_debug;
|
||||
extern int usb_debug;
|
||||
|
||||
/* Check if USB debugging is enabled. */
|
||||
#ifdef USB_DEBUG_VAR
|
||||
@ -56,10 +56,10 @@ struct usb_device;
|
||||
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_endpoint *ep);
|
||||
void usb2_dump_endpoint(struct usb_endpoint *ep);
|
||||
void usb2_dump_xfer(struct usb_xfer *xfer);
|
||||
void usb_dump_iface(struct usb_interface *iface);
|
||||
void usb_dump_device(struct usb_device *udev);
|
||||
void usb_dump_queue(struct usb_endpoint *ep);
|
||||
void usb_dump_endpoint(struct usb_endpoint *ep);
|
||||
void usb_dump_xfer(struct usb_xfer *xfer);
|
||||
|
||||
#endif /* _USB2_DEBUG_H_ */
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -167,41 +167,41 @@ struct usb_fifo_sc {
|
||||
struct cdev* dev;
|
||||
};
|
||||
|
||||
extern struct cdevsw usb2_devsw;
|
||||
extern struct cdevsw usb_devsw;
|
||||
|
||||
int usb2_fifo_wait(struct usb_fifo *fifo);
|
||||
void usb2_fifo_signal(struct usb_fifo *fifo);
|
||||
int usb2_fifo_alloc_buffer(struct usb_fifo *f, uint32_t bufsize,
|
||||
int usb_fifo_wait(struct usb_fifo *fifo);
|
||||
void usb_fifo_signal(struct usb_fifo *fifo);
|
||||
int usb_fifo_alloc_buffer(struct usb_fifo *f, uint32_t bufsize,
|
||||
uint16_t nbuf);
|
||||
void usb2_fifo_free_buffer(struct usb_fifo *f);
|
||||
int usb2_fifo_attach(struct usb_device *udev, void *priv_sc,
|
||||
void usb_fifo_free_buffer(struct usb_fifo *f);
|
||||
int usb_fifo_attach(struct usb_device *udev, void *priv_sc,
|
||||
struct mtx *priv_mtx, struct usb_fifo_methods *pm,
|
||||
struct usb_fifo_sc *f_sc, uint16_t unit, uint16_t subunit,
|
||||
uint8_t iface_index, uid_t uid, gid_t gid, int mode);
|
||||
void usb2_fifo_detach(struct usb_fifo_sc *f_sc);
|
||||
uint32_t usb2_fifo_put_bytes_max(struct usb_fifo *fifo);
|
||||
void usb2_fifo_put_data(struct usb_fifo *fifo, struct usb_page_cache *pc,
|
||||
void usb_fifo_detach(struct usb_fifo_sc *f_sc);
|
||||
uint32_t usb_fifo_put_bytes_max(struct usb_fifo *fifo);
|
||||
void usb_fifo_put_data(struct usb_fifo *fifo, struct usb_page_cache *pc,
|
||||
usb_frlength_t offset, usb_frlength_t len, uint8_t what);
|
||||
void usb2_fifo_put_data_linear(struct usb_fifo *fifo, void *ptr,
|
||||
void usb_fifo_put_data_linear(struct usb_fifo *fifo, void *ptr,
|
||||
usb_size_t len, uint8_t what);
|
||||
uint8_t usb2_fifo_put_data_buffer(struct usb_fifo *f, void *ptr, usb_size_t len);
|
||||
void usb2_fifo_put_data_error(struct usb_fifo *fifo);
|
||||
uint8_t usb2_fifo_get_data(struct usb_fifo *fifo, struct usb_page_cache *pc,
|
||||
uint8_t usb_fifo_put_data_buffer(struct usb_fifo *f, void *ptr, usb_size_t len);
|
||||
void usb_fifo_put_data_error(struct usb_fifo *fifo);
|
||||
uint8_t usb_fifo_get_data(struct usb_fifo *fifo, struct usb_page_cache *pc,
|
||||
usb_frlength_t offset, usb_frlength_t len, usb_frlength_t *actlen,
|
||||
uint8_t what);
|
||||
uint8_t usb2_fifo_get_data_linear(struct usb_fifo *fifo, void *ptr,
|
||||
uint8_t usb_fifo_get_data_linear(struct usb_fifo *fifo, void *ptr,
|
||||
usb_size_t len, usb_size_t *actlen, uint8_t what);
|
||||
uint8_t usb2_fifo_get_data_buffer(struct usb_fifo *f, void **pptr,
|
||||
uint8_t usb_fifo_get_data_buffer(struct usb_fifo *f, void **pptr,
|
||||
usb_size_t *plen);
|
||||
void usb2_fifo_get_data_error(struct usb_fifo *fifo);
|
||||
uint8_t usb2_fifo_opened(struct usb_fifo *fifo);
|
||||
void usb2_fifo_free(struct usb_fifo *f);
|
||||
void usb2_fifo_reset(struct usb_fifo *f);
|
||||
void usb2_fifo_wakeup(struct usb_fifo *f);
|
||||
struct usb_symlink *usb2_alloc_symlink(const char *target);
|
||||
void usb2_free_symlink(struct usb_symlink *ps);
|
||||
int usb2_read_symlink(uint8_t *user_ptr, uint32_t startentry,
|
||||
void usb_fifo_get_data_error(struct usb_fifo *fifo);
|
||||
uint8_t usb_fifo_opened(struct usb_fifo *fifo);
|
||||
void usb_fifo_free(struct usb_fifo *f);
|
||||
void usb_fifo_reset(struct usb_fifo *f);
|
||||
void usb_fifo_wakeup(struct usb_fifo *f);
|
||||
struct usb_symlink *usb_alloc_symlink(const char *target);
|
||||
void usb_free_symlink(struct usb_symlink *ps);
|
||||
int usb_read_symlink(uint8_t *user_ptr, uint32_t startentry,
|
||||
uint32_t user_len);
|
||||
void usb2_fifo_set_close_zlp(struct usb_fifo *, uint8_t);
|
||||
void usb_fifo_set_close_zlp(struct usb_fifo *, uint8_t);
|
||||
|
||||
#endif /* _USB2_DEV_H_ */
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -32,13 +32,13 @@ struct usb_device; /* linux compat */
|
||||
|
||||
#define USB_DEFAULT_XFER_MAX 2
|
||||
|
||||
/* "usb2_parse_config()" commands */
|
||||
/* "usb_parse_config()" commands */
|
||||
|
||||
#define USB_CFG_ALLOC 0
|
||||
#define USB_CFG_FREE 1
|
||||
#define USB_CFG_INIT 2
|
||||
|
||||
/* "usb2_unconfigure()" flags */
|
||||
/* "usb_unconfigure()" flags */
|
||||
|
||||
#define USB_UNCFG_FLAG_NONE 0x00
|
||||
#define USB_UNCFG_FLAG_FREE_SUBDEV 0x01 /* subdevices are freed */
|
||||
@ -166,7 +166,7 @@ struct usb_device {
|
||||
struct usb_config_descriptor *cdesc; /* full config descr */
|
||||
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_temp_data *usb_template_ptr;
|
||||
struct usb_endpoint *ep_curr; /* current clear stall endpoint */
|
||||
#if USB_HAVE_UGEN
|
||||
struct usb_fifo *fifo[USB_FIFO_MAX];
|
||||
@ -224,36 +224,36 @@ struct usb_device {
|
||||
|
||||
/* globals */
|
||||
|
||||
extern int usb2_template;
|
||||
extern int usb_template;
|
||||
|
||||
/* function prototypes */
|
||||
|
||||
struct usb_device *usb2_alloc_device(device_t parent_dev, struct usb_bus *bus,
|
||||
struct usb_device *usb_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_endpoint *usb2_get_endpoint(struct usb_device *udev, uint8_t iface_index,
|
||||
struct usb_endpoint *usbd_get_endpoint(struct usb_device *udev, uint8_t iface_index,
|
||||
const struct usb_config *setup);
|
||||
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,
|
||||
struct usb_endpoint *usbd_get_ep_by_addr(struct usb_device *udev, uint8_t ea_val);
|
||||
usb_error_t usb_interface_count(struct usb_device *udev, uint8_t *count);
|
||||
usb_error_t usb_probe_and_attach(struct usb_device *udev,
|
||||
uint8_t iface_index);
|
||||
usb_error_t usb2_reset_iface_endpoints(struct usb_device *udev,
|
||||
usb_error_t usb_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,
|
||||
usb_error_t usbd_set_config_index(struct usb_device *udev, uint8_t index);
|
||||
usb_error_t usbd_set_endpoint_stall(struct usb_device *udev,
|
||||
struct usb_endpoint *ep, uint8_t do_stall);
|
||||
usb_error_t usb2_suspend_resume(struct usb_device *udev,
|
||||
usb_error_t usb_suspend_resume(struct usb_device *udev,
|
||||
uint8_t do_suspend);
|
||||
void usb2_devinfo(struct usb_device *udev, char *dst_ptr, uint16_t dst_len);
|
||||
void usb2_free_device(struct usb_device *, uint8_t);
|
||||
void usb_devinfo(struct usb_device *udev, char *dst_ptr, uint16_t dst_len);
|
||||
void usb_free_device(struct usb_device *, uint8_t);
|
||||
void *usb2_find_descriptor(struct usb_device *udev, void *id,
|
||||
uint8_t iface_index, uint8_t type, uint8_t type_mask,
|
||||
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_endpoint *usb2_endpoint_foreach(struct usb_device *udev, struct usb_endpoint *ep);
|
||||
void usb2_set_device_state(struct usb_device *udev,
|
||||
uint8_t usb_peer_can_wakeup(struct usb_device *udev);
|
||||
struct usb_endpoint *usb_endpoint_foreach(struct usb_device *udev, struct usb_endpoint *ep);
|
||||
void usb_set_device_state(struct usb_device *udev,
|
||||
enum usb_dev_state state);
|
||||
|
||||
#endif /* _USB2_DEVICE_H_ */
|
||||
|
@ -34,72 +34,72 @@
|
||||
#include <dev/usb/usb_dynamic.h>
|
||||
|
||||
/* function prototypes */
|
||||
static usb_handle_req_t usb2_temp_get_desc_w;
|
||||
static usb2_temp_setup_by_index_t usb2_temp_setup_by_index_w;
|
||||
static usb2_temp_unsetup_t usb2_temp_unsetup_w;
|
||||
static usb2_test_quirk_t usb2_test_quirk_w;
|
||||
static usb2_test_huawei_autoinst_t usb2_test_huawei_autoinst_w;
|
||||
static usb2_quirk_ioctl_t usb2_quirk_ioctl_w;
|
||||
static usb_handle_req_t usb_temp_get_desc_w;
|
||||
static usb_temp_setup_by_index_t usb_temp_setup_by_index_w;
|
||||
static usb_temp_unsetup_t usb_temp_unsetup_w;
|
||||
static usb_test_quirk_t usb_test_quirk_w;
|
||||
static usb_test_huawei_autoinst_t usb_test_huawei_autoinst_w;
|
||||
static usb_quirk_ioctl_t usb_quirk_ioctl_w;
|
||||
|
||||
/* global variables */
|
||||
usb_handle_req_t *usb2_temp_get_desc_p = &usb2_temp_get_desc_w;
|
||||
usb2_temp_setup_by_index_t *usb2_temp_setup_by_index_p = &usb2_temp_setup_by_index_w;
|
||||
usb2_temp_unsetup_t *usb2_temp_unsetup_p = &usb2_temp_unsetup_w;
|
||||
usb2_test_quirk_t *usb2_test_quirk_p = &usb2_test_quirk_w;
|
||||
usb2_test_huawei_autoinst_t *usb2_test_huawei_autoinst_p = &usb2_test_huawei_autoinst_w;
|
||||
usb2_quirk_ioctl_t *usb2_quirk_ioctl_p = &usb2_quirk_ioctl_w;
|
||||
devclass_t usb2_devclass_ptr = NULL;
|
||||
usb_handle_req_t *usb_temp_get_desc_p = &usb_temp_get_desc_w;
|
||||
usb_temp_setup_by_index_t *usb_temp_setup_by_index_p = &usb_temp_setup_by_index_w;
|
||||
usb_temp_unsetup_t *usb_temp_unsetup_p = &usb_temp_unsetup_w;
|
||||
usb_test_quirk_t *usb_test_quirk_p = &usb_test_quirk_w;
|
||||
usb_test_huawei_autoinst_t *usb_test_huawei_autoinst_p = &usb_test_huawei_autoinst_w;
|
||||
usb_quirk_ioctl_t *usb_quirk_ioctl_p = &usb_quirk_ioctl_w;
|
||||
devclass_t usb_devclass_ptr = NULL;
|
||||
|
||||
static usb_error_t
|
||||
usb2_temp_setup_by_index_w(struct usb_device *udev, uint16_t index)
|
||||
usb_temp_setup_by_index_w(struct usb_device *udev, uint16_t index)
|
||||
{
|
||||
return (USB_ERR_INVAL);
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
usb2_test_quirk_w(const struct usb_lookup_info *info, uint16_t quirk)
|
||||
usb_test_quirk_w(const struct usbd_lookup_info *info, uint16_t quirk)
|
||||
{
|
||||
return (0); /* no match */
|
||||
}
|
||||
|
||||
static int
|
||||
usb2_quirk_ioctl_w(unsigned long cmd, caddr_t data, int fflag, struct thread *td)
|
||||
usb_quirk_ioctl_w(unsigned long cmd, caddr_t data, int fflag, struct thread *td)
|
||||
{
|
||||
return (ENOIOCTL);
|
||||
}
|
||||
|
||||
static usb_error_t
|
||||
usb2_temp_get_desc_w(struct usb_device *udev, struct usb_device_request *req, const void **pPtr, uint16_t *pLength)
|
||||
usb_temp_get_desc_w(struct usb_device *udev, struct usb_device_request *req, const void **pPtr, uint16_t *pLength)
|
||||
{
|
||||
/* stall */
|
||||
return (USB_ERR_STALLED);
|
||||
}
|
||||
|
||||
static void
|
||||
usb2_temp_unsetup_w(struct usb_device *udev)
|
||||
usb_temp_unsetup_w(struct usb_device *udev)
|
||||
{
|
||||
if (udev->usb2_template_ptr) {
|
||||
if (udev->usb_template_ptr) {
|
||||
|
||||
free(udev->usb2_template_ptr, M_USB);
|
||||
free(udev->usb_template_ptr, M_USB);
|
||||
|
||||
udev->usb2_template_ptr = NULL;
|
||||
udev->usb_template_ptr = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
usb2_test_huawei_autoinst_w(struct usb_device *udev,
|
||||
usb_test_huawei_autoinst_w(struct usb_device *udev,
|
||||
struct usb_attach_arg *uaa)
|
||||
{
|
||||
return (USB_ERR_INVAL);
|
||||
}
|
||||
|
||||
void
|
||||
usb2_quirk_unload(void *arg)
|
||||
usb_quirk_unload(void *arg)
|
||||
{
|
||||
/* reset function pointers */
|
||||
|
||||
usb2_test_quirk_p = &usb2_test_quirk_w;
|
||||
usb2_quirk_ioctl_p = &usb2_quirk_ioctl_w;
|
||||
usb_test_quirk_p = &usb_test_quirk_w;
|
||||
usb_quirk_ioctl_p = &usb_quirk_ioctl_w;
|
||||
|
||||
/* wait for CPU to exit the loaded functions, if any */
|
||||
|
||||
@ -109,13 +109,13 @@ usb2_quirk_unload(void *arg)
|
||||
}
|
||||
|
||||
void
|
||||
usb2_temp_unload(void *arg)
|
||||
usb_temp_unload(void *arg)
|
||||
{
|
||||
/* reset function pointers */
|
||||
|
||||
usb2_temp_get_desc_p = &usb2_temp_get_desc_w;
|
||||
usb2_temp_setup_by_index_p = &usb2_temp_setup_by_index_w;
|
||||
usb2_temp_unsetup_p = &usb2_temp_unsetup_w;
|
||||
usb_temp_get_desc_p = &usb_temp_get_desc_w;
|
||||
usb_temp_setup_by_index_p = &usb_temp_setup_by_index_w;
|
||||
usb_temp_unsetup_p = &usb_temp_unsetup_w;
|
||||
|
||||
/* wait for CPU to exit the loaded functions, if any */
|
||||
|
||||
@ -125,11 +125,11 @@ usb2_temp_unload(void *arg)
|
||||
}
|
||||
|
||||
void
|
||||
usb2_bus_unload(void *arg)
|
||||
usb_bus_unload(void *arg)
|
||||
{
|
||||
/* reset function pointers */
|
||||
|
||||
usb2_devclass_ptr = NULL;
|
||||
usb_devclass_ptr = NULL;
|
||||
|
||||
/* wait for CPU to exit the loaded functions, if any */
|
||||
|
||||
@ -139,11 +139,11 @@ usb2_bus_unload(void *arg)
|
||||
}
|
||||
|
||||
void
|
||||
usb2_test_huawei_unload(void *arg)
|
||||
usb_test_huawei_unload(void *arg)
|
||||
{
|
||||
/* reset function pointers */
|
||||
|
||||
usb2_test_huawei_autoinst_p = &usb2_test_huawei_autoinst_w;
|
||||
usb_test_huawei_autoinst_p = &usb_test_huawei_autoinst_w;
|
||||
|
||||
/* wait for CPU to exit the loaded functions, if any */
|
||||
|
||||
|
@ -30,38 +30,38 @@
|
||||
/* prototypes */
|
||||
|
||||
struct usb_device;
|
||||
struct usb_lookup_info;
|
||||
struct usbd_lookup_info;
|
||||
struct usb_device_request;
|
||||
|
||||
/* typedefs */
|
||||
|
||||
typedef usb_error_t (usb2_temp_setup_by_index_t)(struct usb_device *udev,
|
||||
typedef usb_error_t (usb_temp_setup_by_index_t)(struct usb_device *udev,
|
||||
uint16_t index);
|
||||
typedef usb_error_t (usb2_test_huawei_autoinst_t)(struct usb_device *udev,
|
||||
typedef usb_error_t (usb_test_huawei_autoinst_t)(struct usb_device *udev,
|
||||
struct usb_attach_arg *uaa);
|
||||
typedef uint8_t (usb2_test_quirk_t)(const struct usb_lookup_info *info,
|
||||
typedef uint8_t (usb_test_quirk_t)(const struct usbd_lookup_info *info,
|
||||
uint16_t quirk);
|
||||
typedef int (usb2_quirk_ioctl_t)(unsigned long cmd, caddr_t data,
|
||||
typedef int (usb_quirk_ioctl_t)(unsigned long cmd, caddr_t data,
|
||||
int fflag, struct thread *td);
|
||||
typedef void (usb2_temp_unsetup_t)(struct usb_device *udev);
|
||||
typedef void (usb_temp_unsetup_t)(struct usb_device *udev);
|
||||
|
||||
/* global function pointers */
|
||||
|
||||
extern usb_handle_req_t *usb2_temp_get_desc_p;
|
||||
extern usb2_temp_setup_by_index_t *usb2_temp_setup_by_index_p;
|
||||
extern usb2_temp_unsetup_t *usb2_temp_unsetup_p;
|
||||
extern usb2_test_quirk_t *usb2_test_quirk_p;
|
||||
extern usb2_test_huawei_autoinst_t *usb2_test_huawei_autoinst_p;
|
||||
extern usb2_quirk_ioctl_t *usb2_quirk_ioctl_p;
|
||||
extern devclass_t usb2_devclass_ptr;
|
||||
extern usb_handle_req_t *usb_temp_get_desc_p;
|
||||
extern usb_temp_setup_by_index_t *usb_temp_setup_by_index_p;
|
||||
extern usb_temp_unsetup_t *usb_temp_unsetup_p;
|
||||
extern usb_test_quirk_t *usb_test_quirk_p;
|
||||
extern usb_test_huawei_autoinst_t *usb_test_huawei_autoinst_p;
|
||||
extern usb_quirk_ioctl_t *usb_quirk_ioctl_p;
|
||||
extern devclass_t usb_devclass_ptr;
|
||||
|
||||
/* function prototypes */
|
||||
|
||||
void usb2_test_huawei_unload(void *);
|
||||
void usb2_temp_unload(void *);
|
||||
void usb2_quirk_unload(void *);
|
||||
void usb2_bus_unload(void *);
|
||||
void usb_test_huawei_unload(void *);
|
||||
void usb_temp_unload(void *);
|
||||
void usb_quirk_unload(void *);
|
||||
void usb_bus_unload(void *);
|
||||
|
||||
uint8_t usb2_test_quirk(const struct usb_attach_arg *uaa, uint16_t quirk);
|
||||
uint8_t usb_test_quirk(const struct usb_attach_arg *uaa, uint16_t quirk);
|
||||
|
||||
#endif /* _USB2_DYNAMIC_H_ */
|
||||
|
@ -62,12 +62,12 @@ static const char* usb_errstr_table[USB_ERR_MAX] = {
|
||||
};
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_errstr
|
||||
* usbd_errstr
|
||||
*
|
||||
* This function converts an USB error code into a string.
|
||||
*------------------------------------------------------------------------*/
|
||||
const char *
|
||||
usb2_errstr(usb_error_t err)
|
||||
usbd_errstr(usb_error_t err)
|
||||
{
|
||||
return (err < USB_ERR_MAX ? usb_errstr_table[err] : "USB_ERR_UNKNOWN");
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ static int ugen_set_interface(struct usb_fifo *, uint8_t, uint8_t);
|
||||
static int ugen_get_cdesc(struct usb_fifo *, struct usb_gen_descriptor *);
|
||||
static int ugen_get_sdesc(struct usb_fifo *, struct usb_gen_descriptor *);
|
||||
static int ugen_get_iface_driver(struct usb_fifo *f, struct usb_gen_descriptor *ugd);
|
||||
static int usb2_gen_fill_deviceinfo(struct usb_fifo *,
|
||||
static int usb_gen_fill_deviceinfo(struct usb_fifo *,
|
||||
struct usb_device_info *);
|
||||
static int ugen_re_enumerate(struct usb_fifo *);
|
||||
static int ugen_iface_ioctl(struct usb_fifo *, u_long, void *, int);
|
||||
@ -91,7 +91,7 @@ static int ugen_fs_uninit(struct usb_fifo *f);
|
||||
|
||||
/* structures */
|
||||
|
||||
struct usb_fifo_methods usb2_ugen_methods = {
|
||||
struct usb_fifo_methods usb_ugen_methods = {
|
||||
.f_open = &ugen_open,
|
||||
.f_close = &ugen_close,
|
||||
.f_ioctl = &ugen_ioctl,
|
||||
@ -125,23 +125,23 @@ ugen_transfer_setup(struct usb_fifo *f,
|
||||
mtx_unlock(f->priv_mtx);
|
||||
|
||||
/*
|
||||
* "usb2_transfer_setup()" can sleep so one needs to make a wrapper,
|
||||
* "usbd_transfer_setup()" can sleep so one needs to make a wrapper,
|
||||
* exiting the mutex and checking things
|
||||
*/
|
||||
error = usb2_transfer_setup(udev, &iface_index, f->xfer,
|
||||
error = usbd_transfer_setup(udev, &iface_index, f->xfer,
|
||||
setup, n_setup, f, f->priv_mtx);
|
||||
if (error == 0) {
|
||||
|
||||
if (f->xfer[0]->nframes == 1) {
|
||||
error = usb2_fifo_alloc_buffer(f,
|
||||
error = usb_fifo_alloc_buffer(f,
|
||||
f->xfer[0]->max_data_length, 2);
|
||||
} else {
|
||||
error = usb2_fifo_alloc_buffer(f,
|
||||
error = usb_fifo_alloc_buffer(f,
|
||||
f->xfer[0]->max_frame_size,
|
||||
2 * f->xfer[0]->nframes);
|
||||
}
|
||||
if (error) {
|
||||
usb2_transfer_unsetup(f->xfer, n_setup);
|
||||
usbd_transfer_unsetup(f->xfer, n_setup);
|
||||
}
|
||||
}
|
||||
mtx_lock(f->priv_mtx);
|
||||
@ -159,7 +159,7 @@ ugen_open(struct usb_fifo *f, int fflags)
|
||||
DPRINTFN(6, "flag=0x%x\n", fflags);
|
||||
|
||||
mtx_lock(f->priv_mtx);
|
||||
switch (usb2_get_speed(f->udev)) {
|
||||
switch (usbd_get_speed(f->udev)) {
|
||||
case USB_SPEED_LOW:
|
||||
case USB_SPEED_FULL:
|
||||
f->nframes = UGEN_HW_FRAMES;
|
||||
@ -191,12 +191,12 @@ ugen_close(struct usb_fifo *f, int fflags)
|
||||
/* cleanup */
|
||||
|
||||
mtx_lock(f->priv_mtx);
|
||||
usb2_transfer_stop(f->xfer[0]);
|
||||
usb2_transfer_stop(f->xfer[1]);
|
||||
usbd_transfer_stop(f->xfer[0]);
|
||||
usbd_transfer_stop(f->xfer[1]);
|
||||
mtx_unlock(f->priv_mtx);
|
||||
|
||||
usb2_transfer_unsetup(f->xfer, 2);
|
||||
usb2_fifo_free_buffer(f);
|
||||
usbd_transfer_unsetup(f->xfer, 2);
|
||||
usb_fifo_free_buffer(f);
|
||||
|
||||
if (ugen_fs_uninit(f)) {
|
||||
/* ignore any errors - we are closing */
|
||||
@ -348,11 +348,11 @@ ugen_start_read(struct usb_fifo *f)
|
||||
/* check that pipes are open */
|
||||
if (ugen_open_pipe_read(f)) {
|
||||
/* signal error */
|
||||
usb2_fifo_put_data_error(f);
|
||||
usb_fifo_put_data_error(f);
|
||||
}
|
||||
/* start transfers */
|
||||
usb2_transfer_start(f->xfer[0]);
|
||||
usb2_transfer_start(f->xfer[1]);
|
||||
usbd_transfer_start(f->xfer[0]);
|
||||
usbd_transfer_start(f->xfer[1]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -361,19 +361,19 @@ ugen_start_write(struct usb_fifo *f)
|
||||
/* check that pipes are open */
|
||||
if (ugen_open_pipe_write(f)) {
|
||||
/* signal error */
|
||||
usb2_fifo_get_data_error(f);
|
||||
usb_fifo_get_data_error(f);
|
||||
}
|
||||
/* start transfers */
|
||||
usb2_transfer_start(f->xfer[0]);
|
||||
usb2_transfer_start(f->xfer[1]);
|
||||
usbd_transfer_start(f->xfer[0]);
|
||||
usbd_transfer_start(f->xfer[1]);
|
||||
}
|
||||
|
||||
static void
|
||||
ugen_stop_io(struct usb_fifo *f)
|
||||
{
|
||||
/* stop transfers */
|
||||
usb2_transfer_stop(f->xfer[0]);
|
||||
usb2_transfer_stop(f->xfer[1]);
|
||||
usbd_transfer_stop(f->xfer[0]);
|
||||
usbd_transfer_stop(f->xfer[1]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -401,28 +401,28 @@ ugen_default_read_callback(struct usb_xfer *xfer)
|
||||
xfer->interval = 0;
|
||||
f->fifo_zlp = 0;
|
||||
}
|
||||
usb2_fifo_put_data(f, xfer->frbuffers, 0,
|
||||
usb_fifo_put_data(f, xfer->frbuffers, 0,
|
||||
xfer->actlen, 1);
|
||||
|
||||
case USB_ST_SETUP:
|
||||
if (f->flag_stall) {
|
||||
usb2_transfer_start(f->xfer[1]);
|
||||
usbd_transfer_start(f->xfer[1]);
|
||||
break;
|
||||
}
|
||||
USB_IF_POLL(&f->free_q, m);
|
||||
if (m) {
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
}
|
||||
break;
|
||||
|
||||
default: /* Error */
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
/* send a zero length packet to userland */
|
||||
usb2_fifo_put_data(f, xfer->frbuffers, 0, 0, 1);
|
||||
usb_fifo_put_data(f, xfer->frbuffers, 0, 0, 1);
|
||||
f->flag_stall = 1;
|
||||
f->fifo_zlp = 0;
|
||||
usb2_transfer_start(f->xfer[1]);
|
||||
usbd_transfer_start(f->xfer[1]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -444,23 +444,23 @@ ugen_default_write_callback(struct usb_xfer *xfer)
|
||||
* callback and solve the situation.
|
||||
*/
|
||||
if (f->flag_stall) {
|
||||
usb2_transfer_start(f->xfer[1]);
|
||||
usbd_transfer_start(f->xfer[1]);
|
||||
break;
|
||||
}
|
||||
/*
|
||||
* Write data, setup and perform hardware transfer.
|
||||
*/
|
||||
if (usb2_fifo_get_data(f, xfer->frbuffers, 0,
|
||||
if (usb_fifo_get_data(f, xfer->frbuffers, 0,
|
||||
xfer->max_data_length, &actlen, 0)) {
|
||||
xfer->frlengths[0] = actlen;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
}
|
||||
break;
|
||||
|
||||
default: /* Error */
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
f->flag_stall = 1;
|
||||
usb2_transfer_start(f->xfer[1]);
|
||||
usbd_transfer_start(f->xfer[1]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -476,10 +476,10 @@ ugen_read_clear_stall_callback(struct usb_xfer *xfer)
|
||||
/* nothing to do */
|
||||
return;
|
||||
}
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
if (usbd_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTFN(5, "f=%p: stall cleared\n", f);
|
||||
f->flag_stall = 0;
|
||||
usb2_transfer_start(xfer_other);
|
||||
usbd_transfer_start(xfer_other);
|
||||
}
|
||||
}
|
||||
|
||||
@ -493,10 +493,10 @@ ugen_write_clear_stall_callback(struct usb_xfer *xfer)
|
||||
/* nothing to do */
|
||||
return;
|
||||
}
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
if (usbd_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTFN(5, "f=%p: stall cleared\n", f);
|
||||
f->flag_stall = 0;
|
||||
usb2_transfer_start(xfer_other);
|
||||
usbd_transfer_start(xfer_other);
|
||||
}
|
||||
}
|
||||
|
||||
@ -517,7 +517,7 @@ ugen_isoc_read_callback(struct usb_xfer *xfer)
|
||||
offset = 0;
|
||||
|
||||
for (n = 0; n != xfer->aframes; n++) {
|
||||
usb2_fifo_put_data(f, xfer->frbuffers, offset,
|
||||
usb_fifo_put_data(f, xfer->frbuffers, offset,
|
||||
xfer->frlengths[n], 1);
|
||||
offset += xfer->max_frame_size;
|
||||
}
|
||||
@ -528,7 +528,7 @@ ugen_isoc_read_callback(struct usb_xfer *xfer)
|
||||
/* setup size for next transfer */
|
||||
xfer->frlengths[n] = xfer->max_frame_size;
|
||||
}
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
break;
|
||||
|
||||
default: /* Error */
|
||||
@ -555,7 +555,7 @@ ugen_isoc_write_callback(struct usb_xfer *xfer)
|
||||
tr_setup:
|
||||
offset = 0;
|
||||
for (n = 0; n != xfer->nframes; n++) {
|
||||
if (usb2_fifo_get_data(f, xfer->frbuffers, offset,
|
||||
if (usb_fifo_get_data(f, xfer->frbuffers, offset,
|
||||
xfer->max_frame_size, &actlen, 1)) {
|
||||
xfer->frlengths[n] = actlen;
|
||||
offset += actlen;
|
||||
@ -568,7 +568,7 @@ ugen_isoc_write_callback(struct usb_xfer *xfer)
|
||||
/* fill in zero frames */
|
||||
xfer->frlengths[n] = 0;
|
||||
}
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
break;
|
||||
|
||||
default: /* Error */
|
||||
@ -599,11 +599,11 @@ ugen_set_config(struct usb_fifo *f, uint8_t index)
|
||||
DPRINTFN(6, "no FIFOs\n");
|
||||
}
|
||||
/* change setting - will free generic FIFOs, if any */
|
||||
if (usb2_set_config_index(f->udev, index)) {
|
||||
if (usbd_set_config_index(f->udev, index)) {
|
||||
return (EIO);
|
||||
}
|
||||
/* probe and attach */
|
||||
if (usb2_probe_and_attach(f->udev, USB_IFACE_INDEX_ANY)) {
|
||||
if (usb_probe_and_attach(f->udev, USB_IFACE_INDEX_ANY)) {
|
||||
return (EIO);
|
||||
}
|
||||
return (0);
|
||||
@ -626,11 +626,11 @@ ugen_set_interface(struct usb_fifo *f,
|
||||
DPRINTFN(6, "no FIFOs\n");
|
||||
}
|
||||
/* change setting - will free generic FIFOs, if any */
|
||||
if (usb2_set_alt_interface_index(f->udev, iface_index, alt_index)) {
|
||||
if (usbd_set_alt_interface_index(f->udev, iface_index, alt_index)) {
|
||||
return (EIO);
|
||||
}
|
||||
/* probe and attach */
|
||||
if (usb2_probe_and_attach(f->udev, iface_index)) {
|
||||
if (usb_probe_and_attach(f->udev, iface_index)) {
|
||||
return (EIO);
|
||||
}
|
||||
return (0);
|
||||
@ -659,14 +659,14 @@ ugen_get_cdesc(struct usb_fifo *f, struct usb_gen_descriptor *ugd)
|
||||
}
|
||||
if ((ugd->ugd_config_index == USB_UNCONFIG_INDEX) ||
|
||||
(ugd->ugd_config_index == udev->curr_config_index)) {
|
||||
cdesc = usb2_get_config_descriptor(udev);
|
||||
cdesc = usbd_get_config_descriptor(udev);
|
||||
if (cdesc == NULL) {
|
||||
return (ENXIO);
|
||||
}
|
||||
free_data = 0;
|
||||
|
||||
} else {
|
||||
if (usb2_req_get_config_desc_full(udev,
|
||||
if (usbd_req_get_config_desc_full(udev,
|
||||
NULL, &cdesc, M_USBDEV,
|
||||
ugd->ugd_config_index)) {
|
||||
return (ENXIO);
|
||||
@ -698,7 +698,7 @@ ugen_get_sdesc(struct usb_fifo *f, struct usb_gen_descriptor *ugd)
|
||||
uint16_t size = sizeof(f->udev->bus->scratch[0].data);
|
||||
int error;
|
||||
|
||||
if (usb2_req_get_string_desc(f->udev, NULL, ptr,
|
||||
if (usbd_req_get_string_desc(f->udev, NULL, ptr,
|
||||
size, ugd->ugd_lang_id, ugd->ugd_string_index)) {
|
||||
error = EINVAL;
|
||||
} else {
|
||||
@ -745,7 +745,7 @@ ugen_get_iface_driver(struct usb_fifo *f, struct usb_gen_descriptor *ugd)
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
iface = usb2_get_iface(udev, ugd->ugd_iface_index);
|
||||
iface = usbd_get_iface(udev, ugd->ugd_iface_index);
|
||||
if ((iface == NULL) || (iface->idesc == NULL)) {
|
||||
/* invalid interface index */
|
||||
return (EINVAL);
|
||||
@ -779,7 +779,7 @@ ugen_get_iface_driver(struct usb_fifo *f, struct usb_gen_descriptor *ugd)
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_gen_fill_deviceinfo
|
||||
* usb_gen_fill_deviceinfo
|
||||
*
|
||||
* This function dumps information about an USB device to the
|
||||
* structure pointed to by the "di" argument.
|
||||
@ -789,7 +789,7 @@ ugen_get_iface_driver(struct usb_fifo *f, struct usb_gen_descriptor *ugd)
|
||||
* Else: Failure
|
||||
*------------------------------------------------------------------------*/
|
||||
static int
|
||||
usb2_gen_fill_deviceinfo(struct usb_fifo *f, struct usb_device_info *di)
|
||||
usb_gen_fill_deviceinfo(struct usb_fifo *f, struct usb_device_info *di)
|
||||
{
|
||||
struct usb_device *udev;
|
||||
struct usb_device *hub;
|
||||
@ -804,7 +804,7 @@ usb2_gen_fill_deviceinfo(struct usb_fifo *f, struct usb_device_info *di)
|
||||
strlcpy(di->udi_serial, udev->serial, sizeof(di->udi_serial));
|
||||
strlcpy(di->udi_vendor, udev->manufacturer, sizeof(di->udi_vendor));
|
||||
strlcpy(di->udi_product, udev->product, sizeof(di->udi_product));
|
||||
usb2_printBCD(di->udi_release, sizeof(di->udi_release),
|
||||
usb_printbcd(di->udi_release, sizeof(di->udi_release),
|
||||
UGETW(udev->ddesc.bcdDevice));
|
||||
di->udi_vendorNo = UGETW(udev->ddesc.idVendor);
|
||||
di->udi_productNo = UGETW(udev->ddesc.idProduct);
|
||||
@ -864,13 +864,13 @@ ugen_check_request(struct usb_device *udev, struct usb_device_request *req)
|
||||
*/
|
||||
if (req->bmRequestType == UT_WRITE_ENDPOINT) {
|
||||
|
||||
ep = usb2_get_ep_by_addr(udev, req->wIndex[0]);
|
||||
ep = usbd_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, ep);
|
||||
usbd_clear_data_toggle(udev, ep);
|
||||
}
|
||||
}
|
||||
/* TODO: add more checks to verify the interface index */
|
||||
@ -897,7 +897,7 @@ ugen_do_request(struct usb_fifo *f, struct usb_ctl_request *ur)
|
||||
}
|
||||
}
|
||||
/* do the USB request */
|
||||
error = usb2_do_request_flags
|
||||
error = usbd_do_request_flags
|
||||
(f->udev, NULL, &ur->ucr_request, ur->ucr_data,
|
||||
(ur->ucr_flags & USB_SHORT_XFER_OK) |
|
||||
USB_USER_DATA_PTR, &actlen,
|
||||
@ -934,7 +934,7 @@ ugen_re_enumerate(struct usb_fifo *f)
|
||||
}
|
||||
/* do a bus-reset */
|
||||
mtx_lock(f->priv_mtx);
|
||||
error = usb2_req_re_enumerate(udev, f->priv_mtx);
|
||||
error = usbd_req_re_enumerate(udev, f->priv_mtx);
|
||||
mtx_unlock(f->priv_mtx);
|
||||
|
||||
if (error) {
|
||||
@ -954,13 +954,13 @@ ugen_fs_uninit(struct usb_fifo *f)
|
||||
if (f->fs_xfer == NULL) {
|
||||
return (EINVAL);
|
||||
}
|
||||
usb2_transfer_unsetup(f->fs_xfer, f->fs_ep_max);
|
||||
usbd_transfer_unsetup(f->fs_xfer, f->fs_ep_max);
|
||||
free(f->fs_xfer, M_USB);
|
||||
f->fs_xfer = NULL;
|
||||
f->fs_ep_max = 0;
|
||||
f->fs_ep_ptr = NULL;
|
||||
f->flag_iscomplete = 0;
|
||||
usb2_fifo_free_buffer(f);
|
||||
usb_fifo_free_buffer(f);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -1006,7 +1006,7 @@ ugen_fs_set_complete(struct usb_fifo *f, uint8_t index)
|
||||
|
||||
f->flag_iscomplete = 1;
|
||||
|
||||
usb2_fifo_wakeup(f);
|
||||
usb_fifo_wakeup(f);
|
||||
}
|
||||
|
||||
static int
|
||||
@ -1032,7 +1032,7 @@ ugen_fs_copy_in(struct usb_fifo *f, uint8_t ep_index)
|
||||
return (EINVAL);
|
||||
}
|
||||
mtx_lock(f->priv_mtx);
|
||||
if (usb2_transfer_pending(xfer)) {
|
||||
if (usbd_transfer_pending(xfer)) {
|
||||
mtx_unlock(f->priv_mtx);
|
||||
return (EBUSY); /* should not happen */
|
||||
}
|
||||
@ -1059,7 +1059,7 @@ ugen_fs_copy_in(struct usb_fifo *f, uint8_t ep_index)
|
||||
return (error);
|
||||
}
|
||||
/* reset first frame */
|
||||
usb2_set_frame_offset(xfer, 0, 0);
|
||||
usbd_set_frame_offset(xfer, 0, 0);
|
||||
|
||||
if (xfer->flags_int.control_xfr) {
|
||||
|
||||
@ -1162,7 +1162,7 @@ ugen_fs_copy_in(struct usb_fifo *f, uint8_t ep_index)
|
||||
kaddr = USB_ADD_BYTES(kaddr, offset);
|
||||
} else {
|
||||
/* set current frame offset */
|
||||
usb2_set_frame_offset(xfer, offset, n);
|
||||
usbd_set_frame_offset(xfer, offset, n);
|
||||
|
||||
/* get kernel buffer address */
|
||||
kaddr = xfer->frbuffers[n].buffer;
|
||||
@ -1210,7 +1210,7 @@ ugen_fs_copy_out(struct usb_fifo *f, uint8_t ep_index)
|
||||
return (EINVAL);
|
||||
|
||||
mtx_lock(f->priv_mtx);
|
||||
if (usb2_transfer_pending(xfer)) {
|
||||
if (usbd_transfer_pending(xfer)) {
|
||||
mtx_unlock(f->priv_mtx);
|
||||
return (EBUSY); /* should not happen */
|
||||
}
|
||||
@ -1403,7 +1403,7 @@ ugen_ioctl(struct usb_fifo *f, u_long cmd, void *addr, int fflags)
|
||||
break;
|
||||
}
|
||||
mtx_lock(f->priv_mtx);
|
||||
usb2_transfer_start(f->fs_xfer[u.pstart->ep_index]);
|
||||
usbd_transfer_start(f->fs_xfer[u.pstart->ep_index]);
|
||||
mtx_unlock(f->priv_mtx);
|
||||
break;
|
||||
|
||||
@ -1413,7 +1413,7 @@ ugen_ioctl(struct usb_fifo *f, u_long cmd, void *addr, int fflags)
|
||||
break;
|
||||
}
|
||||
mtx_lock(f->priv_mtx);
|
||||
usb2_transfer_stop(f->fs_xfer[u.pstop->ep_index]);
|
||||
usbd_transfer_stop(f->fs_xfer[u.pstop->ep_index]);
|
||||
mtx_unlock(f->priv_mtx);
|
||||
break;
|
||||
|
||||
@ -1437,7 +1437,7 @@ ugen_ioctl(struct usb_fifo *f, u_long cmd, void *addr, int fflags)
|
||||
error = EINVAL;
|
||||
break;
|
||||
}
|
||||
ep = usb2_get_ep_by_addr(f->udev, u.popen->ep_no);
|
||||
ep = usbd_get_ep_by_addr(f->udev, u.popen->ep_no);
|
||||
if (ep == NULL) {
|
||||
error = EINVAL;
|
||||
break;
|
||||
@ -1488,7 +1488,7 @@ ugen_ioctl(struct usb_fifo *f, u_long cmd, void *addr, int fflags)
|
||||
}
|
||||
}
|
||||
}
|
||||
error = usb2_transfer_setup(f->udev, &iface_index,
|
||||
error = usbd_transfer_setup(f->udev, &iface_index,
|
||||
f->fs_xfer + u.popen->ep_index, usb_config, 1,
|
||||
f, f->priv_mtx);
|
||||
if (error == 0) {
|
||||
@ -1513,7 +1513,7 @@ ugen_ioctl(struct usb_fifo *f, u_long cmd, void *addr, int fflags)
|
||||
error = EINVAL;
|
||||
break;
|
||||
}
|
||||
usb2_transfer_unsetup(f->fs_xfer + u.pclose->ep_index, 1);
|
||||
usbd_transfer_unsetup(f->fs_xfer + u.pclose->ep_index, 1);
|
||||
break;
|
||||
|
||||
case USB_FS_CLEAR_STALL_SYNC:
|
||||
@ -1530,7 +1530,7 @@ ugen_ioctl(struct usb_fifo *f, u_long cmd, void *addr, int fflags)
|
||||
break;
|
||||
}
|
||||
mtx_lock(f->priv_mtx);
|
||||
error = usb2_transfer_pending(f->fs_xfer[u.pstall->ep_index]);
|
||||
error = usbd_transfer_pending(f->fs_xfer[u.pstall->ep_index]);
|
||||
mtx_unlock(f->priv_mtx);
|
||||
|
||||
if (error) {
|
||||
@ -1546,9 +1546,9 @@ ugen_ioctl(struct usb_fifo *f, u_long cmd, void *addr, int fflags)
|
||||
req.wIndex[1] = 0;
|
||||
USETW(req.wLength, 0);
|
||||
|
||||
error = usb2_do_request(f->udev, NULL, &req, NULL);
|
||||
error = usbd_do_request(f->udev, NULL, &req, NULL);
|
||||
if (error == 0) {
|
||||
usb2_clear_data_toggle(f->udev, ep);
|
||||
usbd_clear_data_toggle(f->udev, ep);
|
||||
} else {
|
||||
error = ENXIO;
|
||||
}
|
||||
@ -1645,7 +1645,7 @@ ugen_get_iface_desc(struct usb_fifo *f,
|
||||
{
|
||||
struct usb_interface *iface;
|
||||
|
||||
iface = usb2_get_iface(f->udev, f->iface_index);
|
||||
iface = usbd_get_iface(f->udev, f->iface_index);
|
||||
if (iface && iface->idesc) {
|
||||
*idesc = *(iface->idesc);
|
||||
} else {
|
||||
@ -1702,7 +1702,7 @@ ugen_set_power_mode(struct usb_fifo *f, int mode)
|
||||
}
|
||||
|
||||
/* clear port enable */
|
||||
err = usb2_req_clear_port_feature(udev->parent_hub,
|
||||
err = usbd_req_clear_port_feature(udev->parent_hub,
|
||||
NULL, udev->port_no, UHF_PORT_ENABLE);
|
||||
break;
|
||||
|
||||
@ -1711,13 +1711,13 @@ ugen_set_power_mode(struct usb_fifo *f, int mode)
|
||||
break;
|
||||
|
||||
case USB_POWER_MODE_RESUME:
|
||||
err = usb2_req_clear_port_feature(udev->parent_hub,
|
||||
err = usbd_req_clear_port_feature(udev->parent_hub,
|
||||
NULL, udev->port_no, UHF_PORT_SUSPEND);
|
||||
mode = USB_POWER_MODE_SAVE;
|
||||
break;
|
||||
|
||||
case USB_POWER_MODE_SUSPEND:
|
||||
err = usb2_req_set_port_feature(udev->parent_hub,
|
||||
err = usbd_req_set_port_feature(udev->parent_hub,
|
||||
NULL, udev->port_no, UHF_PORT_SUSPEND);
|
||||
mode = USB_POWER_MODE_SAVE;
|
||||
break;
|
||||
@ -1737,7 +1737,7 @@ ugen_set_power_mode(struct usb_fifo *f, int mode)
|
||||
}
|
||||
|
||||
/* set new power mode */
|
||||
usb2_set_power_mode(udev, mode);
|
||||
usbd_set_power_mode(udev, mode);
|
||||
|
||||
return (0); /* success */
|
||||
}
|
||||
@ -1779,10 +1779,10 @@ ugen_do_port_feature(struct usb_fifo *f, uint8_t port_no,
|
||||
return (EINVAL);
|
||||
}
|
||||
if (set)
|
||||
err = usb2_req_set_port_feature(udev,
|
||||
err = usbd_req_set_port_feature(udev,
|
||||
NULL, port_no, feature);
|
||||
else
|
||||
err = usb2_req_clear_port_feature(udev,
|
||||
err = usbd_req_clear_port_feature(udev,
|
||||
NULL, port_no, feature);
|
||||
|
||||
if (err)
|
||||
@ -1960,7 +1960,7 @@ ugen_ioctl_post(struct usb_fifo *f, u_long cmd, void *addr, int fflags)
|
||||
|
||||
switch (cmd) {
|
||||
case USB_DISCOVER:
|
||||
usb2_needs_explore_all();
|
||||
usb_needs_explore_all();
|
||||
break;
|
||||
|
||||
case USB_SETDEBUG:
|
||||
@ -1968,7 +1968,7 @@ ugen_ioctl_post(struct usb_fifo *f, u_long cmd, void *addr, int fflags)
|
||||
error = EPERM;
|
||||
break;
|
||||
}
|
||||
usb2_debug = *(int *)addr;
|
||||
usb_debug = *(int *)addr;
|
||||
break;
|
||||
|
||||
case USB_GET_CONFIG:
|
||||
@ -1984,7 +1984,7 @@ ugen_ioctl_post(struct usb_fifo *f, u_long cmd, void *addr, int fflags)
|
||||
break;
|
||||
|
||||
case USB_GET_ALTINTERFACE:
|
||||
iface = usb2_get_iface(f->udev,
|
||||
iface = usbd_get_iface(f->udev,
|
||||
u.ai->uai_interface_index);
|
||||
if (iface && iface->idesc) {
|
||||
u.ai->uai_alt_index = iface->alt_index;
|
||||
@ -2003,7 +2003,7 @@ ugen_ioctl_post(struct usb_fifo *f, u_long cmd, void *addr, int fflags)
|
||||
break;
|
||||
|
||||
case USB_GET_DEVICE_DESC:
|
||||
dtemp = usb2_get_device_descriptor(f->udev);
|
||||
dtemp = usbd_get_device_descriptor(f->udev);
|
||||
if (!dtemp) {
|
||||
error = EIO;
|
||||
break;
|
||||
@ -2012,7 +2012,7 @@ ugen_ioctl_post(struct usb_fifo *f, u_long cmd, void *addr, int fflags)
|
||||
break;
|
||||
|
||||
case USB_GET_CONFIG_DESC:
|
||||
ctemp = usb2_get_config_descriptor(f->udev);
|
||||
ctemp = usbd_get_config_descriptor(f->udev);
|
||||
if (!ctemp) {
|
||||
error = EIO;
|
||||
break;
|
||||
@ -2043,7 +2043,7 @@ ugen_ioctl_post(struct usb_fifo *f, u_long cmd, void *addr, int fflags)
|
||||
|
||||
case USB_DEVICEINFO:
|
||||
case USB_GET_DEVICEINFO:
|
||||
error = usb2_gen_fill_deviceinfo(f, addr);
|
||||
error = usb_gen_fill_deviceinfo(f, addr);
|
||||
break;
|
||||
|
||||
case USB_DEVICESTATS:
|
||||
@ -2128,14 +2128,14 @@ ugen_ioctl_post(struct usb_fifo *f, u_long cmd, void *addr, int fflags)
|
||||
error = EBUSY;
|
||||
break;
|
||||
}
|
||||
error = usb2_fifo_alloc_buffer(f, 1, u.pinit->ep_index_max);
|
||||
error = usb_fifo_alloc_buffer(f, 1, u.pinit->ep_index_max);
|
||||
if (error) {
|
||||
break;
|
||||
}
|
||||
f->fs_xfer = malloc(sizeof(f->fs_xfer[0]) *
|
||||
u.pinit->ep_index_max, M_USB, M_WAITOK | M_ZERO);
|
||||
if (f->fs_xfer == NULL) {
|
||||
usb2_fifo_free_buffer(f);
|
||||
usb_fifo_free_buffer(f);
|
||||
error = ENOMEM;
|
||||
break;
|
||||
}
|
||||
@ -2171,7 +2171,7 @@ ugen_default_fs_callback(struct usb_xfer *xfer)
|
||||
|
||||
switch (USB_GET_STATE(xfer)) {
|
||||
case USB_ST_SETUP:
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
break;
|
||||
default:
|
||||
ugen_fs_set_complete(xfer->priv_sc, USB_P2U(xfer->priv_fifo));
|
||||
|
@ -27,7 +27,7 @@
|
||||
#ifndef _USB2_GENERIC_H_
|
||||
#define _USB2_GENERIC_H_
|
||||
|
||||
extern struct usb_fifo_methods usb2_ugen_methods;
|
||||
extern struct usb_fifo_methods usb_ugen_methods;
|
||||
int ugen_do_request(struct usb_fifo *f, struct usb_ctl_request *ur);
|
||||
|
||||
#endif /* _USB2_GENERIC_H_ */
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include <dev/usb/usb_error.h>
|
||||
#include <dev/usb/usb.h>
|
||||
|
||||
#define USB_DEBUG_VAR usb2_debug
|
||||
#define USB_DEBUG_VAR usb_debug
|
||||
|
||||
#include <dev/usb/usb_core.h>
|
||||
#include <dev/usb/usb_process.h>
|
||||
@ -44,24 +44,24 @@
|
||||
|
||||
/* function prototypes */
|
||||
|
||||
static uint8_t usb2_handle_get_stall(struct usb_device *, uint8_t);
|
||||
static usb_error_t usb2_handle_remote_wakeup(struct usb_xfer *, uint8_t);
|
||||
static usb_error_t usb2_handle_request(struct usb_xfer *);
|
||||
static usb_error_t usb2_handle_set_config(struct usb_xfer *, uint8_t);
|
||||
static usb_error_t usb2_handle_set_stall(struct usb_xfer *, uint8_t,
|
||||
static uint8_t usb_handle_get_stall(struct usb_device *, uint8_t);
|
||||
static usb_error_t usb_handle_remote_wakeup(struct usb_xfer *, uint8_t);
|
||||
static usb_error_t usb_handle_request(struct usb_xfer *);
|
||||
static usb_error_t usb_handle_set_config(struct usb_xfer *, uint8_t);
|
||||
static usb_error_t usb_handle_set_stall(struct usb_xfer *, uint8_t,
|
||||
uint8_t);
|
||||
static usb_error_t usb2_handle_iface_request(struct usb_xfer *, void **,
|
||||
static usb_error_t usb_handle_iface_request(struct usb_xfer *, void **,
|
||||
uint16_t *, struct usb_device_request, uint16_t,
|
||||
uint8_t);
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_handle_request_callback
|
||||
* usb_handle_request_callback
|
||||
*
|
||||
* This function is the USB callback for generic USB Device control
|
||||
* transfers.
|
||||
*------------------------------------------------------------------------*/
|
||||
void
|
||||
usb2_handle_request_callback(struct usb_xfer *xfer)
|
||||
usb_handle_request_callback(struct usb_xfer *xfer)
|
||||
{
|
||||
usb_error_t err;
|
||||
|
||||
@ -72,25 +72,25 @@ usb2_handle_request_callback(struct usb_xfer *xfer)
|
||||
case USB_ST_TRANSFERRED:
|
||||
|
||||
/* handle the request */
|
||||
err = usb2_handle_request(xfer);
|
||||
err = usb_handle_request(xfer);
|
||||
|
||||
if (err) {
|
||||
|
||||
if (err == USB_ERR_BAD_CONTEXT) {
|
||||
/* we need to re-setup the control transfer */
|
||||
usb2_needs_explore(xfer->xroot->bus, 0);
|
||||
usb_needs_explore(xfer->xroot->bus, 0);
|
||||
break;
|
||||
}
|
||||
goto tr_restart;
|
||||
}
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
break;
|
||||
|
||||
default:
|
||||
/* check if a control transfer is active */
|
||||
if (xfer->flags_int.control_rem != 0xFFFF) {
|
||||
/* handle the request */
|
||||
err = usb2_handle_request(xfer);
|
||||
err = usb_handle_request(xfer);
|
||||
}
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
/* should not happen - try stalling */
|
||||
@ -110,18 +110,18 @@ usb2_handle_request_callback(struct usb_xfer *xfer)
|
||||
xfer->flags.manual_status = 1;
|
||||
xfer->flags.force_short_xfer = 0;
|
||||
xfer->flags.stall_pipe = 1; /* cancel previous transfer, if any */
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_handle_set_config
|
||||
* usb_handle_set_config
|
||||
*
|
||||
* Returns:
|
||||
* 0: Success
|
||||
* Else: Failure
|
||||
*------------------------------------------------------------------------*/
|
||||
static usb_error_t
|
||||
usb2_handle_set_config(struct usb_xfer *xfer, uint8_t conf_no)
|
||||
usb_handle_set_config(struct usb_xfer *xfer, uint8_t conf_no)
|
||||
{
|
||||
struct usb_device *udev = xfer->xroot->udev;
|
||||
usb_error_t err = 0;
|
||||
@ -144,12 +144,12 @@ usb2_handle_set_config(struct usb_xfer *xfer, uint8_t conf_no)
|
||||
conf_no--;
|
||||
}
|
||||
|
||||
if (usb2_set_config_index(udev, conf_no)) {
|
||||
if (usbd_set_config_index(udev, conf_no)) {
|
||||
DPRINTF("set config %d failed\n", conf_no);
|
||||
err = USB_ERR_STALLED;
|
||||
goto done;
|
||||
}
|
||||
if (usb2_probe_and_attach(udev, USB_IFACE_INDEX_ANY)) {
|
||||
if (usb_probe_and_attach(udev, USB_IFACE_INDEX_ANY)) {
|
||||
DPRINTF("probe and attach failed\n");
|
||||
err = USB_ERR_STALLED;
|
||||
goto done;
|
||||
@ -162,14 +162,14 @@ usb2_handle_set_config(struct usb_xfer *xfer, uint8_t conf_no)
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_handle_iface_request
|
||||
* usb_handle_iface_request
|
||||
*
|
||||
* Returns:
|
||||
* 0: Success
|
||||
* Else: Failure
|
||||
*------------------------------------------------------------------------*/
|
||||
static usb_error_t
|
||||
usb2_handle_iface_request(struct usb_xfer *xfer,
|
||||
usb_handle_iface_request(struct usb_xfer *xfer,
|
||||
void **ppdata, uint16_t *plen,
|
||||
struct usb_device_request req, uint16_t off, uint8_t state)
|
||||
{
|
||||
@ -196,7 +196,7 @@ usb2_handle_iface_request(struct usb_xfer *xfer,
|
||||
error = ENXIO;
|
||||
|
||||
tr_repeat:
|
||||
iface = usb2_get_iface(udev, iface_index);
|
||||
iface = usbd_get_iface(udev, iface_index);
|
||||
if ((iface == NULL) ||
|
||||
(iface->idesc == NULL)) {
|
||||
/* end of interfaces non-existing interface */
|
||||
@ -215,7 +215,7 @@ usb2_handle_iface_request(struct usb_xfer *xfer,
|
||||
&req, ppdata, plen,
|
||||
off, state);
|
||||
}
|
||||
iface_parent = usb2_get_iface(udev, iface->parent_iface_index);
|
||||
iface_parent = usbd_get_iface(udev, iface->parent_iface_index);
|
||||
|
||||
if ((iface_parent == NULL) ||
|
||||
(iface_parent->idesc == NULL)) {
|
||||
@ -265,11 +265,11 @@ usb2_handle_iface_request(struct usb_xfer *xfer,
|
||||
*/
|
||||
if ((iface_parent != NULL) ||
|
||||
(iface->alt_index == req.wValue[0])) {
|
||||
error = usb2_reset_iface_endpoints(udev,
|
||||
error = usb_reset_iface_endpoints(udev,
|
||||
iface_index);
|
||||
if (error) {
|
||||
DPRINTF("alt setting failed %s\n",
|
||||
usb2_errstr(error));
|
||||
usbd_errstr(error));
|
||||
goto tr_stalled;
|
||||
}
|
||||
break;
|
||||
@ -278,14 +278,14 @@ usb2_handle_iface_request(struct usb_xfer *xfer,
|
||||
* Doing the alternate setting will detach the
|
||||
* interface aswell:
|
||||
*/
|
||||
error = usb2_set_alt_interface_index(udev,
|
||||
error = usbd_set_alt_interface_index(udev,
|
||||
iface_index, req.wValue[0]);
|
||||
if (error) {
|
||||
DPRINTF("alt setting failed %s\n",
|
||||
usb2_errstr(error));
|
||||
usbd_errstr(error));
|
||||
goto tr_stalled;
|
||||
}
|
||||
error = usb2_probe_and_attach(udev,
|
||||
error = usb_probe_and_attach(udev,
|
||||
iface_index);
|
||||
if (error) {
|
||||
DPRINTF("alt setting probe failed\n");
|
||||
@ -325,39 +325,39 @@ usb2_handle_iface_request(struct usb_xfer *xfer,
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_handle_stall
|
||||
* usb_handle_stall
|
||||
*
|
||||
* Returns:
|
||||
* 0: Success
|
||||
* Else: Failure
|
||||
*------------------------------------------------------------------------*/
|
||||
static usb_error_t
|
||||
usb2_handle_set_stall(struct usb_xfer *xfer, uint8_t ep, uint8_t do_stall)
|
||||
usb_handle_set_stall(struct usb_xfer *xfer, uint8_t ep, uint8_t do_stall)
|
||||
{
|
||||
struct usb_device *udev = xfer->xroot->udev;
|
||||
usb_error_t err;
|
||||
|
||||
USB_XFER_UNLOCK(xfer);
|
||||
err = usb2_set_endpoint_stall(udev,
|
||||
usb2_get_ep_by_addr(udev, ep), do_stall);
|
||||
err = usbd_set_endpoint_stall(udev,
|
||||
usbd_get_ep_by_addr(udev, ep), do_stall);
|
||||
USB_XFER_LOCK(xfer);
|
||||
return (err);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_handle_get_stall
|
||||
* usb_handle_get_stall
|
||||
*
|
||||
* Returns:
|
||||
* 0: Success
|
||||
* Else: Failure
|
||||
*------------------------------------------------------------------------*/
|
||||
static uint8_t
|
||||
usb2_handle_get_stall(struct usb_device *udev, uint8_t ea_val)
|
||||
usb_handle_get_stall(struct usb_device *udev, uint8_t ea_val)
|
||||
{
|
||||
struct usb_endpoint *ep;
|
||||
uint8_t halted;
|
||||
|
||||
ep = usb2_get_ep_by_addr(udev, ea_val);
|
||||
ep = usbd_get_ep_by_addr(udev, ea_val);
|
||||
if (ep == NULL) {
|
||||
/* nothing to do */
|
||||
return (0);
|
||||
@ -370,14 +370,14 @@ usb2_handle_get_stall(struct usb_device *udev, uint8_t ea_val)
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_handle_remote_wakeup
|
||||
* usb_handle_remote_wakeup
|
||||
*
|
||||
* Returns:
|
||||
* 0: Success
|
||||
* Else: Failure
|
||||
*------------------------------------------------------------------------*/
|
||||
static usb_error_t
|
||||
usb2_handle_remote_wakeup(struct usb_xfer *xfer, uint8_t is_on)
|
||||
usb_handle_remote_wakeup(struct usb_xfer *xfer, uint8_t is_on)
|
||||
{
|
||||
struct usb_device *udev;
|
||||
struct usb_bus *bus;
|
||||
@ -396,12 +396,12 @@ usb2_handle_remote_wakeup(struct usb_xfer *xfer, uint8_t is_on)
|
||||
USB_BUS_UNLOCK(bus);
|
||||
|
||||
/* In case we are out of sync, update the power state. */
|
||||
usb2_bus_power_update(udev->bus);
|
||||
usb_bus_power_update(udev->bus);
|
||||
return (0); /* success */
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_handle_request
|
||||
* usb_handle_request
|
||||
*
|
||||
* Internal state sequence:
|
||||
*
|
||||
@ -412,7 +412,7 @@ usb2_handle_remote_wakeup(struct usb_xfer *xfer, uint8_t is_on)
|
||||
* Else: Stall current transfer, if any
|
||||
*------------------------------------------------------------------------*/
|
||||
static usb_error_t
|
||||
usb2_handle_request(struct usb_xfer *xfer)
|
||||
usb_handle_request(struct usb_xfer *xfer)
|
||||
{
|
||||
struct usb_device_request req;
|
||||
struct usb_device *udev;
|
||||
@ -460,12 +460,12 @@ usb2_handle_request(struct usb_xfer *xfer)
|
||||
|
||||
xfer->frlengths[0] = 0;
|
||||
|
||||
usb2_set_frame_offset(xfer, 0, 0);
|
||||
usb2_set_frame_offset(xfer, sizeof(req), 1);
|
||||
usbd_set_frame_offset(xfer, 0, 0);
|
||||
usbd_set_frame_offset(xfer, sizeof(req), 1);
|
||||
|
||||
/* get the current request, if any */
|
||||
|
||||
usb2_copy_out(xfer->frbuffers, 0, &req, sizeof(req));
|
||||
usbd_copy_out(xfer->frbuffers, 0, &req, sizeof(req));
|
||||
|
||||
if (xfer->flags_int.control_rem == 0xFFFF) {
|
||||
/* first time - not initialised */
|
||||
@ -572,7 +572,7 @@ usb2_handle_request(struct usb_xfer *xfer)
|
||||
break;
|
||||
default:
|
||||
/* we use "USB_ADD_BYTES" to de-const the src_zcopy */
|
||||
err = usb2_handle_iface_request(xfer,
|
||||
err = usb_handle_iface_request(xfer,
|
||||
USB_ADD_BYTES(&src_zcopy, 0),
|
||||
&max_len, req, off, state);
|
||||
if (err == 0) {
|
||||
@ -595,7 +595,7 @@ usb2_handle_request(struct usb_xfer *xfer)
|
||||
goto tr_valid;
|
||||
|
||||
tr_handle_get_descriptor:
|
||||
err = (usb2_temp_get_desc_p) (udev, &req, &src_zcopy, &max_len);
|
||||
err = (usb_temp_get_desc_p) (udev, &req, &src_zcopy, &max_len);
|
||||
if (err)
|
||||
goto tr_stalled;
|
||||
if (src_zcopy == NULL)
|
||||
@ -643,7 +643,7 @@ usb2_handle_request(struct usb_xfer *xfer)
|
||||
|
||||
tr_handle_set_config:
|
||||
if (state == USB_HR_NOT_COMPLETE) {
|
||||
if (usb2_handle_set_config(xfer, req.wValue[0])) {
|
||||
if (usb_handle_set_config(xfer, req.wValue[0])) {
|
||||
goto tr_stalled;
|
||||
}
|
||||
}
|
||||
@ -651,7 +651,7 @@ usb2_handle_request(struct usb_xfer *xfer)
|
||||
|
||||
tr_handle_clear_halt:
|
||||
if (state == USB_HR_NOT_COMPLETE) {
|
||||
if (usb2_handle_set_stall(xfer, req.wIndex[0], 0)) {
|
||||
if (usb_handle_set_stall(xfer, req.wIndex[0], 0)) {
|
||||
goto tr_stalled;
|
||||
}
|
||||
}
|
||||
@ -659,7 +659,7 @@ usb2_handle_request(struct usb_xfer *xfer)
|
||||
|
||||
tr_handle_clear_wakeup:
|
||||
if (state == USB_HR_NOT_COMPLETE) {
|
||||
if (usb2_handle_remote_wakeup(xfer, 0)) {
|
||||
if (usb_handle_remote_wakeup(xfer, 0)) {
|
||||
goto tr_stalled;
|
||||
}
|
||||
}
|
||||
@ -667,7 +667,7 @@ usb2_handle_request(struct usb_xfer *xfer)
|
||||
|
||||
tr_handle_set_halt:
|
||||
if (state == USB_HR_NOT_COMPLETE) {
|
||||
if (usb2_handle_set_stall(xfer, req.wIndex[0], 1)) {
|
||||
if (usb_handle_set_stall(xfer, req.wIndex[0], 1)) {
|
||||
goto tr_stalled;
|
||||
}
|
||||
}
|
||||
@ -675,7 +675,7 @@ usb2_handle_request(struct usb_xfer *xfer)
|
||||
|
||||
tr_handle_set_wakeup:
|
||||
if (state == USB_HR_NOT_COMPLETE) {
|
||||
if (usb2_handle_remote_wakeup(xfer, 1)) {
|
||||
if (usb_handle_remote_wakeup(xfer, 1)) {
|
||||
goto tr_stalled;
|
||||
}
|
||||
}
|
||||
@ -684,7 +684,7 @@ usb2_handle_request(struct usb_xfer *xfer)
|
||||
tr_handle_get_ep_status:
|
||||
if (state == USB_HR_NOT_COMPLETE) {
|
||||
temp.wStatus[0] =
|
||||
usb2_handle_get_stall(udev, req.wIndex[0]);
|
||||
usb_handle_get_stall(udev, req.wIndex[0]);
|
||||
temp.wStatus[1] = 0;
|
||||
src_mcopy = temp.wStatus;
|
||||
max_len = sizeof(temp.wStatus);
|
||||
@ -732,10 +732,10 @@ usb2_handle_request(struct usb_xfer *xfer)
|
||||
if (max_len > 0) {
|
||||
if (src_mcopy) {
|
||||
src_mcopy = USB_ADD_BYTES(src_mcopy, off);
|
||||
usb2_copy_in(xfer->frbuffers + 1, 0,
|
||||
usbd_copy_in(xfer->frbuffers + 1, 0,
|
||||
src_mcopy, max_len);
|
||||
} else {
|
||||
usb2_set_frame_data(xfer,
|
||||
usbd_set_frame_data(xfer,
|
||||
USB_ADD_BYTES(src_zcopy, off), 1);
|
||||
}
|
||||
xfer->frlengths[1] = max_len;
|
||||
|
@ -45,7 +45,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <dev/usb/usb_error.h>
|
||||
#include <dev/usb/usbhid.h>
|
||||
|
||||
#define USB_DEBUG_VAR usb2_debug
|
||||
#define USB_DEBUG_VAR usb_debug
|
||||
|
||||
#include <dev/usb/usb_core.h>
|
||||
#include <dev/usb/usb_debug.h>
|
||||
@ -659,7 +659,7 @@ hid_get_descriptor_from_usb(struct usb_config_descriptor *cd,
|
||||
if (desc == NULL) {
|
||||
return (NULL);
|
||||
}
|
||||
while ((desc = usb2_desc_foreach(cd, desc))) {
|
||||
while ((desc = usb_desc_foreach(cd, desc))) {
|
||||
if ((desc->bDescriptorType == UDESC_HID) &&
|
||||
(desc->bLength >= USB_HID_DESCRIPTOR_SIZE(0))) {
|
||||
return (void *)desc;
|
||||
@ -672,7 +672,7 @@ hid_get_descriptor_from_usb(struct usb_config_descriptor *cd,
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_req_get_hid_desc
|
||||
* usbd_req_get_hid_desc
|
||||
*
|
||||
* This function will read out an USB report descriptor from the USB
|
||||
* device.
|
||||
@ -682,11 +682,11 @@ hid_get_descriptor_from_usb(struct usb_config_descriptor *cd,
|
||||
* Else: Success. The pointer should eventually be passed to free().
|
||||
*------------------------------------------------------------------------*/
|
||||
usb_error_t
|
||||
usb2_req_get_hid_desc(struct usb_device *udev, struct mtx *mtx,
|
||||
usbd_req_get_hid_desc(struct usb_device *udev, struct mtx *mtx,
|
||||
void **descp, uint16_t *sizep,
|
||||
struct malloc_type *mem, uint8_t iface_index)
|
||||
{
|
||||
struct usb_interface *iface = usb2_get_iface(udev, iface_index);
|
||||
struct usb_interface *iface = usbd_get_iface(udev, iface_index);
|
||||
struct usb_hid_descriptor *hid;
|
||||
usb_error_t err;
|
||||
|
||||
@ -694,7 +694,7 @@ usb2_req_get_hid_desc(struct usb_device *udev, struct mtx *mtx,
|
||||
return (USB_ERR_INVAL);
|
||||
}
|
||||
hid = hid_get_descriptor_from_usb
|
||||
(usb2_get_config_descriptor(udev), iface->idesc);
|
||||
(usbd_get_config_descriptor(udev), iface->idesc);
|
||||
|
||||
if (hid == NULL) {
|
||||
return (USB_ERR_IOERROR);
|
||||
@ -714,7 +714,7 @@ usb2_req_get_hid_desc(struct usb_device *udev, struct mtx *mtx,
|
||||
if (*descp == NULL) {
|
||||
return (USB_ERR_NOMEM);
|
||||
}
|
||||
err = usb2_req_get_report_descriptor
|
||||
err = usbd_req_get_report_descriptor
|
||||
(udev, mtx, *descp, *sizep, iface_index);
|
||||
|
||||
if (err) {
|
||||
|
@ -72,7 +72,7 @@ struct hid_item {
|
||||
struct hid_location loc;
|
||||
};
|
||||
|
||||
/* prototypes from "usb2_hid.c" */
|
||||
/* prototypes from "usb_hid.c" */
|
||||
|
||||
struct hid_data *hid_start_parse(const void *d, usb_size_t len, int kindset);
|
||||
void hid_end_parse(struct hid_data *s);
|
||||
@ -88,7 +88,7 @@ int hid_is_collection(const void *desc, usb_size_t size, uint32_t usage);
|
||||
struct usb_hid_descriptor *hid_get_descriptor_from_usb(
|
||||
struct usb_config_descriptor *cd,
|
||||
struct usb_interface_descriptor *id);
|
||||
usb_error_t usb2_req_get_hid_desc(struct usb_device *udev, struct mtx *mtx,
|
||||
usb_error_t usbd_req_get_hid_desc(struct usb_device *udev, struct mtx *mtx,
|
||||
void **descp, uint16_t *sizep, struct malloc_type *mem,
|
||||
uint8_t iface_index);
|
||||
|
||||
|
@ -63,10 +63,10 @@ SYSCTL_INT(_hw_usb_uhub, OID_AUTO, debug, CTLFLAG_RW, &uhub_debug, 0,
|
||||
#endif
|
||||
|
||||
#if USB_HAVE_POWERD
|
||||
static int usb2_power_timeout = 30; /* seconds */
|
||||
static int usb_power_timeout = 30; /* seconds */
|
||||
|
||||
SYSCTL_INT(_hw_usb, OID_AUTO, power_timeout, CTLFLAG_RW,
|
||||
&usb2_power_timeout, 0, "USB power timeout");
|
||||
&usb_power_timeout, 0, "USB power timeout");
|
||||
#endif
|
||||
|
||||
struct uhub_current_state {
|
||||
@ -102,8 +102,8 @@ static bus_child_pnpinfo_str_t uhub_child_pnpinfo_string;
|
||||
|
||||
static usb_callback_t uhub_intr_callback;
|
||||
|
||||
static void usb2_dev_resume_peer(struct usb_device *udev);
|
||||
static void usb2_dev_suspend_peer(struct usb_device *udev);
|
||||
static void usb_dev_resume_peer(struct usb_device *udev);
|
||||
static void usb_dev_suspend_peer(struct usb_device *udev);
|
||||
|
||||
static const struct usb_config uhub_config[UHUB_N_TRANSFER] = {
|
||||
|
||||
@ -162,11 +162,11 @@ uhub_intr_callback(struct usb_xfer *xfer)
|
||||
* event handler thread that we need
|
||||
* to be explored again:
|
||||
*/
|
||||
usb2_needs_explore(sc->sc_udev->bus, 0);
|
||||
usb_needs_explore(sc->sc_udev->bus, 0);
|
||||
|
||||
case USB_ST_SETUP:
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
break;
|
||||
|
||||
default: /* Error */
|
||||
@ -178,7 +178,7 @@ uhub_intr_callback(struct usb_xfer *xfer)
|
||||
*/
|
||||
xfer->flags.stall_pipe = 1;
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_transfer_submit(xfer);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -206,7 +206,7 @@ uhub_explore_sub(struct uhub_softc *sc, struct usb_port *up)
|
||||
refcount = bus->driver_added_refcount;
|
||||
|
||||
/* get device assosiated with the given port */
|
||||
child = usb2_bus_port_get_device(bus, up);
|
||||
child = usb_bus_port_get_device(bus, up);
|
||||
if (child == NULL) {
|
||||
/* nothing to do */
|
||||
goto done;
|
||||
@ -215,7 +215,7 @@ uhub_explore_sub(struct uhub_softc *sc, struct usb_port *up)
|
||||
|
||||
if (child->driver_added_refcount != refcount) {
|
||||
child->driver_added_refcount = refcount;
|
||||
err = usb2_probe_and_attach(child,
|
||||
err = usb_probe_and_attach(child,
|
||||
USB_IFACE_INDEX_ANY);
|
||||
if (err) {
|
||||
goto done;
|
||||
@ -224,7 +224,7 @@ uhub_explore_sub(struct uhub_softc *sc, struct usb_port *up)
|
||||
/* start control transfer, if device mode */
|
||||
|
||||
if (child->flags.usb_mode == USB_MODE_DEVICE) {
|
||||
usb2_default_transfer_setup(child);
|
||||
usbd_default_transfer_setup(child);
|
||||
}
|
||||
/* if a HUB becomes present, do a recursive HUB explore */
|
||||
|
||||
@ -244,7 +244,7 @@ uhub_read_port_status(struct uhub_softc *sc, uint8_t portno)
|
||||
struct usb_port_status ps;
|
||||
usb_error_t err;
|
||||
|
||||
err = usb2_req_get_port_status(
|
||||
err = usbd_req_get_port_status(
|
||||
sc->sc_udev, NULL, &ps, portno);
|
||||
|
||||
/* update status regardless of error */
|
||||
@ -257,7 +257,7 @@ uhub_read_port_status(struct uhub_softc *sc, uint8_t portno)
|
||||
DPRINTFN(4, "port %d, wPortStatus=0x%04x, "
|
||||
"wPortChange=0x%04x, err=%s\n",
|
||||
portno, sc->sc_st.port_status,
|
||||
sc->sc_st.port_change, usb2_errstr(err));
|
||||
sc->sc_st.port_change, usbd_errstr(err));
|
||||
return (err);
|
||||
}
|
||||
|
||||
@ -283,14 +283,14 @@ uhub_reattach_port(struct uhub_softc *sc, uint8_t portno)
|
||||
err = 0;
|
||||
timeout = 0;
|
||||
udev = sc->sc_udev;
|
||||
child = usb2_bus_port_get_device(udev->bus,
|
||||
child = usb_bus_port_get_device(udev->bus,
|
||||
udev->hub->ports + portno - 1);
|
||||
|
||||
repeat:
|
||||
|
||||
/* first clear the port connection change bit */
|
||||
|
||||
err = usb2_req_clear_port_feature(udev, NULL,
|
||||
err = usbd_req_clear_port_feature(udev, NULL,
|
||||
portno, UHF_C_PORT_CONNECTION);
|
||||
|
||||
if (err) {
|
||||
@ -299,7 +299,7 @@ uhub_reattach_port(struct uhub_softc *sc, uint8_t portno)
|
||||
/* detach any existing devices */
|
||||
|
||||
if (child) {
|
||||
usb2_free_device(child,
|
||||
usb_free_device(child,
|
||||
USB_UNCFG_FLAG_FREE_SUBDEV |
|
||||
USB_UNCFG_FLAG_FREE_EP0);
|
||||
child = NULL;
|
||||
@ -330,24 +330,24 @@ uhub_reattach_port(struct uhub_softc *sc, uint8_t portno)
|
||||
if (sc->sc_st.port_status & UPS_SUSPEND) {
|
||||
DPRINTF("Port %d was still "
|
||||
"suspended, clearing.\n", portno);
|
||||
err = usb2_req_clear_port_feature(sc->sc_udev,
|
||||
err = usbd_req_clear_port_feature(sc->sc_udev,
|
||||
NULL, portno, UHF_PORT_SUSPEND);
|
||||
}
|
||||
/* USB Host Mode */
|
||||
|
||||
/* wait for maximum device power up time */
|
||||
|
||||
usb2_pause_mtx(NULL,
|
||||
usb_pause_mtx(NULL,
|
||||
USB_MS_TO_TICKS(USB_PORT_POWERUP_DELAY));
|
||||
|
||||
/* reset port, which implies enabling it */
|
||||
|
||||
err = usb2_req_reset_port(udev, NULL, portno);
|
||||
err = usbd_req_reset_port(udev, NULL, portno);
|
||||
|
||||
if (err) {
|
||||
DPRINTFN(0, "port %d reset "
|
||||
"failed, error=%s\n",
|
||||
portno, usb2_errstr(err));
|
||||
portno, usbd_errstr(err));
|
||||
goto error;
|
||||
}
|
||||
/* get port status again, it might have changed during reset */
|
||||
@ -410,7 +410,7 @@ uhub_reattach_port(struct uhub_softc *sc, uint8_t portno)
|
||||
|
||||
/* need to create a new child */
|
||||
|
||||
child = usb2_alloc_device(sc->sc_dev, udev->bus, udev,
|
||||
child = usb_alloc_device(sc->sc_dev, udev->bus, udev,
|
||||
udev->depth + 1, portno - 1, portno, speed, mode);
|
||||
if (child == NULL) {
|
||||
DPRINTFN(0, "could not allocate new device!\n");
|
||||
@ -420,21 +420,21 @@ uhub_reattach_port(struct uhub_softc *sc, uint8_t portno)
|
||||
|
||||
error:
|
||||
if (child) {
|
||||
usb2_free_device(child,
|
||||
usb_free_device(child,
|
||||
USB_UNCFG_FLAG_FREE_SUBDEV |
|
||||
USB_UNCFG_FLAG_FREE_EP0);
|
||||
child = NULL;
|
||||
}
|
||||
if (err == 0) {
|
||||
if (sc->sc_st.port_status & UPS_PORT_ENABLED) {
|
||||
err = usb2_req_clear_port_feature(
|
||||
err = usbd_req_clear_port_feature(
|
||||
sc->sc_udev, NULL,
|
||||
portno, UHF_PORT_ENABLE);
|
||||
}
|
||||
}
|
||||
if (err) {
|
||||
DPRINTFN(0, "device problem (%s), "
|
||||
"disabling port %d\n", usb2_errstr(err), portno);
|
||||
"disabling port %d\n", usbd_errstr(err), portno);
|
||||
}
|
||||
return (err);
|
||||
}
|
||||
@ -457,12 +457,12 @@ uhub_suspend_resume_port(struct uhub_softc *sc, uint8_t portno)
|
||||
DPRINTF("port %d\n", portno);
|
||||
|
||||
udev = sc->sc_udev;
|
||||
child = usb2_bus_port_get_device(udev->bus,
|
||||
child = usb_bus_port_get_device(udev->bus,
|
||||
udev->hub->ports + portno - 1);
|
||||
|
||||
/* first clear the port suspend change bit */
|
||||
|
||||
err = usb2_req_clear_port_feature(udev, NULL,
|
||||
err = usbd_req_clear_port_feature(udev, NULL,
|
||||
portno, UHF_C_PORT_SUSPEND);
|
||||
if (err) {
|
||||
DPRINTF("clearing suspend failed.\n");
|
||||
@ -494,9 +494,9 @@ uhub_suspend_resume_port(struct uhub_softc *sc, uint8_t portno)
|
||||
* suspend and resume here
|
||||
*/
|
||||
if (is_suspend == 0)
|
||||
usb2_dev_resume_peer(child);
|
||||
usb_dev_resume_peer(child);
|
||||
else if (child->flags.usb_mode == USB_MODE_DEVICE)
|
||||
usb2_dev_suspend_peer(child);
|
||||
usb_dev_suspend_peer(child);
|
||||
}
|
||||
done:
|
||||
return (err);
|
||||
@ -514,7 +514,7 @@ uhub_root_intr(struct usb_bus *bus, const uint8_t *ptr, uint8_t len)
|
||||
{
|
||||
USB_BUS_LOCK_ASSERT(bus, MA_OWNED);
|
||||
|
||||
usb2_needs_explore(bus, 0);
|
||||
usb_needs_explore(bus, 0);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
@ -560,7 +560,7 @@ uhub_explore(struct usb_device *udev)
|
||||
}
|
||||
if (sc->sc_st.port_change & UPS_C_OVERCURRENT_INDICATOR) {
|
||||
DPRINTF("Overcurrent on port %u.\n", portno);
|
||||
err = usb2_req_clear_port_feature(
|
||||
err = usbd_req_clear_port_feature(
|
||||
udev, NULL, portno, UHF_C_PORT_OVER_CURRENT);
|
||||
if (err) {
|
||||
/* most likely the HUB is gone */
|
||||
@ -576,7 +576,7 @@ uhub_explore(struct usb_device *udev)
|
||||
UPS_C_CONNECT_STATUS;
|
||||
}
|
||||
if (sc->sc_st.port_change & UPS_C_PORT_ENABLED) {
|
||||
err = usb2_req_clear_port_feature(
|
||||
err = usbd_req_clear_port_feature(
|
||||
udev, NULL, portno, UHF_C_PORT_ENABLE);
|
||||
if (err) {
|
||||
/* most likely the HUB is gone */
|
||||
@ -675,7 +675,7 @@ uhub_attach(device_t dev)
|
||||
snprintf(sc->sc_name, sizeof(sc->sc_name), "%s",
|
||||
device_get_nameunit(dev));
|
||||
|
||||
device_set_usb2_desc(dev);
|
||||
device_set_usb_desc(dev);
|
||||
|
||||
DPRINTFN(2, "depth=%d selfpowered=%d, parent=%p, "
|
||||
"parent->selfpowered=%d\n",
|
||||
@ -701,17 +701,17 @@ uhub_attach(device_t dev)
|
||||
DPRINTFN(2, "getting HUB descriptor\n");
|
||||
|
||||
/* assuming that there is one port */
|
||||
err = usb2_req_get_hub_descriptor(udev, NULL, &hubdesc, 1);
|
||||
err = usbd_req_get_hub_descriptor(udev, NULL, &hubdesc, 1);
|
||||
|
||||
nports = hubdesc.bNbrPorts;
|
||||
|
||||
if (!err && (nports >= 8)) {
|
||||
/* get complete HUB descriptor */
|
||||
err = usb2_req_get_hub_descriptor(udev, NULL, &hubdesc, nports);
|
||||
err = usbd_req_get_hub_descriptor(udev, NULL, &hubdesc, nports);
|
||||
}
|
||||
if (err) {
|
||||
DPRINTFN(0, "getting hub descriptor failed,"
|
||||
"error=%s\n", usb2_errstr(err));
|
||||
"error=%s\n", usbd_errstr(err));
|
||||
goto error;
|
||||
}
|
||||
if (hubdesc.bNbrPorts != nports) {
|
||||
@ -732,7 +732,7 @@ uhub_attach(device_t dev)
|
||||
|
||||
#if USB_HAVE_TT_SUPPORT
|
||||
/* init FULL-speed ISOCHRONOUS schedule */
|
||||
usb2_fs_isoc_schedule_init_all(hub->fs_isoc_schedule);
|
||||
usbd_fs_isoc_schedule_init_all(hub->fs_isoc_schedule);
|
||||
#endif
|
||||
/* initialize HUB structure */
|
||||
hub->hubsoftc = sc;
|
||||
@ -754,16 +754,16 @@ uhub_attach(device_t dev)
|
||||
err = 0;
|
||||
} else {
|
||||
/* normal HUB */
|
||||
err = usb2_transfer_setup(udev, &iface_index, sc->sc_xfer,
|
||||
err = usbd_transfer_setup(udev, &iface_index, sc->sc_xfer,
|
||||
uhub_config, UHUB_N_TRANSFER, sc, &Giant);
|
||||
}
|
||||
if (err) {
|
||||
DPRINTFN(0, "cannot setup interrupt transfer, "
|
||||
"errstr=%s!\n", usb2_errstr(err));
|
||||
"errstr=%s!\n", usbd_errstr(err));
|
||||
goto error;
|
||||
}
|
||||
/* wait with power off for a while */
|
||||
usb2_pause_mtx(NULL, USB_MS_TO_TICKS(USB_POWER_DOWN_TIME));
|
||||
usb_pause_mtx(NULL, USB_MS_TO_TICKS(USB_POWER_DOWN_TIME));
|
||||
|
||||
/*
|
||||
* To have the best chance of success we do things in the exact same
|
||||
@ -810,18 +810,18 @@ uhub_attach(device_t dev)
|
||||
}
|
||||
if (!err) {
|
||||
/* turn the power on */
|
||||
err = usb2_req_set_port_feature(udev, NULL,
|
||||
err = usbd_req_set_port_feature(udev, NULL,
|
||||
portno, UHF_PORT_POWER);
|
||||
}
|
||||
if (err) {
|
||||
DPRINTFN(0, "port %d power on failed, %s\n",
|
||||
portno, usb2_errstr(err));
|
||||
portno, usbd_errstr(err));
|
||||
}
|
||||
DPRINTF("turn on port %d power\n",
|
||||
portno);
|
||||
|
||||
/* wait for stable power */
|
||||
usb2_pause_mtx(NULL, USB_MS_TO_TICKS(pwrdly));
|
||||
usb_pause_mtx(NULL, USB_MS_TO_TICKS(pwrdly));
|
||||
}
|
||||
|
||||
device_printf(dev, "%d port%s with %d "
|
||||
@ -832,18 +832,18 @@ uhub_attach(device_t dev)
|
||||
|
||||
if (sc->sc_xfer[0] != NULL) {
|
||||
USB_XFER_LOCK(sc->sc_xfer[0]);
|
||||
usb2_transfer_start(sc->sc_xfer[0]);
|
||||
usbd_transfer_start(sc->sc_xfer[0]);
|
||||
USB_XFER_UNLOCK(sc->sc_xfer[0]);
|
||||
}
|
||||
|
||||
/* Enable automatic power save on all USB HUBs */
|
||||
|
||||
usb2_set_power_mode(udev, USB_POWER_MODE_SAVE);
|
||||
usbd_set_power_mode(udev, USB_POWER_MODE_SAVE);
|
||||
|
||||
return (0);
|
||||
|
||||
error:
|
||||
usb2_transfer_unsetup(sc->sc_xfer, UHUB_N_TRANSFER);
|
||||
usbd_transfer_unsetup(sc->sc_xfer, UHUB_N_TRANSFER);
|
||||
|
||||
if (udev->hub) {
|
||||
free(udev->hub, M_USBDEV);
|
||||
@ -872,7 +872,7 @@ uhub_detach(device_t dev)
|
||||
}
|
||||
for (x = 0; x != hub->nports; x++) {
|
||||
|
||||
child = usb2_bus_port_get_device(sc->sc_udev->bus, hub->ports + x);
|
||||
child = usb_bus_port_get_device(sc->sc_udev->bus, hub->ports + x);
|
||||
|
||||
if (child == NULL) {
|
||||
continue;
|
||||
@ -881,11 +881,11 @@ uhub_detach(device_t dev)
|
||||
* Subdevices are not freed, because the caller of
|
||||
* uhub_detach() will do that.
|
||||
*/
|
||||
usb2_free_device(child,
|
||||
usb_free_device(child,
|
||||
USB_UNCFG_FLAG_FREE_EP0);
|
||||
}
|
||||
|
||||
usb2_transfer_unsetup(sc->sc_xfer, UHUB_N_TRANSFER);
|
||||
usbd_transfer_unsetup(sc->sc_xfer, UHUB_N_TRANSFER);
|
||||
|
||||
free(hub, M_USBDEV);
|
||||
sc->sc_udev->hub = NULL;
|
||||
@ -911,7 +911,7 @@ uhub_resume(device_t dev)
|
||||
static void
|
||||
uhub_driver_added(device_t dev, driver_t *driver)
|
||||
{
|
||||
usb2_needs_explore_all();
|
||||
usb_needs_explore_all();
|
||||
}
|
||||
|
||||
struct hub_result {
|
||||
@ -932,13 +932,13 @@ uhub_find_iface_index(struct usb_hub *hub, device_t child,
|
||||
|
||||
nports = hub->nports;
|
||||
for (x = 0; x != nports; x++) {
|
||||
udev = usb2_bus_port_get_device(hub->hubudev->bus,
|
||||
udev = usb_bus_port_get_device(hub->hubudev->bus,
|
||||
hub->ports + x);
|
||||
if (!udev) {
|
||||
continue;
|
||||
}
|
||||
for (i = 0; i != USB_IFACE_MAX; i++) {
|
||||
iface = usb2_get_iface(udev, i);
|
||||
iface = usbd_get_iface(udev, i);
|
||||
if (iface &&
|
||||
(iface->subdev == child)) {
|
||||
res->iface_index = i;
|
||||
@ -996,7 +996,7 @@ uhub_child_pnpinfo_string(device_t parent, device_t child,
|
||||
}
|
||||
goto done;
|
||||
}
|
||||
iface = usb2_get_iface(res.udev, res.iface_index);
|
||||
iface = usbd_get_iface(res.udev, res.iface_index);
|
||||
if (iface && iface->idesc) {
|
||||
snprintf(buf, buflen, "vendor=0x%04x product=0x%04x "
|
||||
"devclass=0x%02x devsubclass=0x%02x "
|
||||
@ -1052,13 +1052,13 @@ uhub_child_pnpinfo_string(device_t parent, device_t child,
|
||||
*/
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_intr_find_best_slot
|
||||
* usb_intr_find_best_slot
|
||||
*
|
||||
* Return value:
|
||||
* The best Transaction Translation slot for an interrupt endpoint.
|
||||
*------------------------------------------------------------------------*/
|
||||
static uint8_t
|
||||
usb2_intr_find_best_slot(usb_size_t *ptr, uint8_t start, uint8_t end)
|
||||
usb_intr_find_best_slot(usb_size_t *ptr, uint8_t start, uint8_t end)
|
||||
{
|
||||
usb_size_t max = 0 - 1;
|
||||
uint8_t x;
|
||||
@ -1078,7 +1078,7 @@ usb2_intr_find_best_slot(usb_size_t *ptr, uint8_t start, uint8_t end)
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_intr_schedule_adjust
|
||||
* usb_intr_schedule_adjust
|
||||
*
|
||||
* This function will update the bandwith usage for the microframe
|
||||
* having index "slot" by "len" bytes. "len" can be negative. If the
|
||||
@ -1090,7 +1090,7 @@ usb2_intr_find_best_slot(usb_size_t *ptr, uint8_t start, uint8_t end)
|
||||
* The slot on which the bandwidth update was done.
|
||||
*------------------------------------------------------------------------*/
|
||||
uint8_t
|
||||
usb2_intr_schedule_adjust(struct usb_device *udev, int16_t len, uint8_t slot)
|
||||
usb_intr_schedule_adjust(struct usb_device *udev, int16_t len, uint8_t slot)
|
||||
{
|
||||
struct usb_bus *bus = udev->bus;
|
||||
struct usb_hub *hub;
|
||||
@ -1098,7 +1098,7 @@ usb2_intr_schedule_adjust(struct usb_device *udev, int16_t len, uint8_t slot)
|
||||
|
||||
USB_BUS_LOCK_ASSERT(bus, MA_OWNED);
|
||||
|
||||
speed = usb2_get_speed(udev);
|
||||
speed = usbd_get_speed(udev);
|
||||
|
||||
switch (speed) {
|
||||
case USB_SPEED_LOW:
|
||||
@ -1115,7 +1115,7 @@ usb2_intr_schedule_adjust(struct usb_device *udev, int16_t len, uint8_t slot)
|
||||
|
||||
hub = udev->parent_hs_hub->hub;
|
||||
if (slot >= USB_HS_MICRO_FRAMES_MAX) {
|
||||
slot = usb2_intr_find_best_slot(hub->uframe_usage,
|
||||
slot = usb_intr_find_best_slot(hub->uframe_usage,
|
||||
USB_FS_ISOC_UFRAME_MAX, 6);
|
||||
}
|
||||
hub->uframe_usage[slot] += len;
|
||||
@ -1123,7 +1123,7 @@ usb2_intr_schedule_adjust(struct usb_device *udev, int16_t len, uint8_t slot)
|
||||
break;
|
||||
default:
|
||||
if (slot >= USB_HS_MICRO_FRAMES_MAX) {
|
||||
slot = usb2_intr_find_best_slot(bus->uframe_usage, 0,
|
||||
slot = usb_intr_find_best_slot(bus->uframe_usage, 0,
|
||||
USB_HS_MICRO_FRAMES_MAX);
|
||||
}
|
||||
bus->uframe_usage[slot] += len;
|
||||
@ -1133,14 +1133,14 @@ usb2_intr_schedule_adjust(struct usb_device *udev, int16_t len, uint8_t slot)
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_fs_isoc_schedule_init_sub
|
||||
* usbd_fs_isoc_schedule_init_sub
|
||||
*
|
||||
* This function initialises an USB FULL speed isochronous schedule
|
||||
* entry.
|
||||
*------------------------------------------------------------------------*/
|
||||
#if USB_HAVE_TT_SUPPORT
|
||||
static void
|
||||
usb2_fs_isoc_schedule_init_sub(struct usb_fs_isoc_schedule *fss)
|
||||
usbd_fs_isoc_schedule_init_sub(struct usb_fs_isoc_schedule *fss)
|
||||
{
|
||||
fss->total_bytes = (USB_FS_ISOC_UFRAME_MAX *
|
||||
USB_FS_BYTES_PER_HS_UFRAME);
|
||||
@ -1150,26 +1150,26 @@ usb2_fs_isoc_schedule_init_sub(struct usb_fs_isoc_schedule *fss)
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_fs_isoc_schedule_init_all
|
||||
* usbd_fs_isoc_schedule_init_all
|
||||
*
|
||||
* This function will reset the complete USB FULL speed isochronous
|
||||
* bandwidth schedule.
|
||||
*------------------------------------------------------------------------*/
|
||||
#if USB_HAVE_TT_SUPPORT
|
||||
void
|
||||
usb2_fs_isoc_schedule_init_all(struct usb_fs_isoc_schedule *fss)
|
||||
usbd_fs_isoc_schedule_init_all(struct usb_fs_isoc_schedule *fss)
|
||||
{
|
||||
struct usb_fs_isoc_schedule *fss_end = fss + USB_ISOC_TIME_MAX;
|
||||
|
||||
while (fss != fss_end) {
|
||||
usb2_fs_isoc_schedule_init_sub(fss);
|
||||
usbd_fs_isoc_schedule_init_sub(fss);
|
||||
fss++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_isoc_time_expand
|
||||
* usb_isoc_time_expand
|
||||
*
|
||||
* This function will expand the time counter from 7-bit to 16-bit.
|
||||
*
|
||||
@ -1177,7 +1177,7 @@ usb2_fs_isoc_schedule_init_all(struct usb_fs_isoc_schedule *fss)
|
||||
* 16-bit isochronous time counter.
|
||||
*------------------------------------------------------------------------*/
|
||||
uint16_t
|
||||
usb2_isoc_time_expand(struct usb_bus *bus, uint16_t isoc_time_curr)
|
||||
usb_isoc_time_expand(struct usb_bus *bus, uint16_t isoc_time_curr)
|
||||
{
|
||||
uint16_t rem;
|
||||
|
||||
@ -1200,7 +1200,7 @@ usb2_isoc_time_expand(struct usb_bus *bus, uint16_t isoc_time_curr)
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_fs_isoc_schedule_isoc_time_expand
|
||||
* usbd_fs_isoc_schedule_isoc_time_expand
|
||||
*
|
||||
* This function does multiple things. First of all it will expand the
|
||||
* passed isochronous time, which is the return value. Then it will
|
||||
@ -1216,7 +1216,7 @@ usb2_isoc_time_expand(struct usb_bus *bus, uint16_t isoc_time_curr)
|
||||
*------------------------------------------------------------------------*/
|
||||
#if USB_HAVE_TT_SUPPORT
|
||||
uint16_t
|
||||
usb2_fs_isoc_schedule_isoc_time_expand(struct usb_device *udev,
|
||||
usbd_fs_isoc_schedule_isoc_time_expand(struct usb_device *udev,
|
||||
struct usb_fs_isoc_schedule **pp_start,
|
||||
struct usb_fs_isoc_schedule **pp_end,
|
||||
uint16_t isoc_time)
|
||||
@ -1226,7 +1226,7 @@ usb2_fs_isoc_schedule_isoc_time_expand(struct usb_device *udev,
|
||||
struct usb_fs_isoc_schedule *fss_b;
|
||||
struct usb_hub *hs_hub;
|
||||
|
||||
isoc_time = usb2_isoc_time_expand(udev->bus, isoc_time);
|
||||
isoc_time = usb_isoc_time_expand(udev->bus, isoc_time);
|
||||
|
||||
hs_hub = udev->parent_hs_hub->hub;
|
||||
|
||||
@ -1250,7 +1250,7 @@ usb2_fs_isoc_schedule_isoc_time_expand(struct usb_device *udev,
|
||||
fss_a = hs_hub->fs_isoc_schedule;
|
||||
continue;
|
||||
}
|
||||
usb2_fs_isoc_schedule_init_sub(fss_a);
|
||||
usbd_fs_isoc_schedule_init_sub(fss_a);
|
||||
fss_a++;
|
||||
}
|
||||
|
||||
@ -1264,7 +1264,7 @@ usb2_fs_isoc_schedule_isoc_time_expand(struct usb_device *udev,
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_fs_isoc_schedule_alloc
|
||||
* usbd_fs_isoc_schedule_alloc
|
||||
*
|
||||
* This function will allocate bandwidth for an isochronous FULL speed
|
||||
* transaction in the FULL speed schedule. The microframe slot where
|
||||
@ -1278,7 +1278,7 @@ usb2_fs_isoc_schedule_isoc_time_expand(struct usb_device *udev,
|
||||
*------------------------------------------------------------------------*/
|
||||
#if USB_HAVE_TT_SUPPORT
|
||||
uint8_t
|
||||
usb2_fs_isoc_schedule_alloc(struct usb_fs_isoc_schedule *fss,
|
||||
usbd_fs_isoc_schedule_alloc(struct usb_fs_isoc_schedule *fss,
|
||||
uint8_t *pstart, uint16_t len)
|
||||
{
|
||||
uint8_t slot = fss->frame_slot;
|
||||
@ -1312,12 +1312,12 @@ usb2_fs_isoc_schedule_alloc(struct usb_fs_isoc_schedule *fss,
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_bus_port_get_device
|
||||
* usb_bus_port_get_device
|
||||
*
|
||||
* This function is NULL safe.
|
||||
*------------------------------------------------------------------------*/
|
||||
struct usb_device *
|
||||
usb2_bus_port_get_device(struct usb_bus *bus, struct usb_port *up)
|
||||
usb_bus_port_get_device(struct usb_bus *bus, struct usb_port *up)
|
||||
{
|
||||
if ((bus == NULL) || (up == NULL)) {
|
||||
/* be NULL safe */
|
||||
@ -1331,12 +1331,12 @@ usb2_bus_port_get_device(struct usb_bus *bus, struct usb_port *up)
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_bus_port_set_device
|
||||
* usb_bus_port_set_device
|
||||
*
|
||||
* This function is NULL safe.
|
||||
*------------------------------------------------------------------------*/
|
||||
void
|
||||
usb2_bus_port_set_device(struct usb_bus *bus, struct usb_port *up,
|
||||
usb_bus_port_set_device(struct usb_bus *bus, struct usb_port *up,
|
||||
struct usb_device *udev, uint8_t device_index)
|
||||
{
|
||||
if (bus == NULL) {
|
||||
@ -1360,11 +1360,11 @@ usb2_bus_port_set_device(struct usb_bus *bus, struct usb_port *up,
|
||||
*/
|
||||
if (device_index != 0) {
|
||||
#if USB_HAVE_UGEN
|
||||
mtx_lock(&usb2_ref_lock);
|
||||
mtx_lock(&usb_ref_lock);
|
||||
#endif
|
||||
bus->devices[device_index] = udev;
|
||||
#if USB_HAVE_UGEN
|
||||
mtx_unlock(&usb2_ref_lock);
|
||||
mtx_unlock(&usb_ref_lock);
|
||||
#endif
|
||||
}
|
||||
/*
|
||||
@ -1374,12 +1374,12 @@ usb2_bus_port_set_device(struct usb_bus *bus, struct usb_port *up,
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_needs_explore
|
||||
* usb_needs_explore
|
||||
*
|
||||
* This functions is called when the USB event thread needs to run.
|
||||
*------------------------------------------------------------------------*/
|
||||
void
|
||||
usb2_needs_explore(struct usb_bus *bus, uint8_t do_probe)
|
||||
usb_needs_explore(struct usb_bus *bus, uint8_t do_probe)
|
||||
{
|
||||
uint8_t do_unlock;
|
||||
|
||||
@ -1403,7 +1403,7 @@ usb2_needs_explore(struct usb_bus *bus, uint8_t do_probe)
|
||||
if (do_probe) {
|
||||
bus->do_probe = 1;
|
||||
}
|
||||
if (usb2_proc_msignal(&bus->explore_proc,
|
||||
if (usb_proc_msignal(&bus->explore_proc,
|
||||
&bus->explore_msg[0], &bus->explore_msg[1])) {
|
||||
/* ignore */
|
||||
}
|
||||
@ -1413,13 +1413,13 @@ usb2_needs_explore(struct usb_bus *bus, uint8_t do_probe)
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_needs_explore_all
|
||||
* usb_needs_explore_all
|
||||
*
|
||||
* This function is called whenever a new driver is loaded and will
|
||||
* cause that all USB busses are re-explored.
|
||||
*------------------------------------------------------------------------*/
|
||||
void
|
||||
usb2_needs_explore_all(void)
|
||||
usb_needs_explore_all(void)
|
||||
{
|
||||
struct usb_bus *bus;
|
||||
devclass_t dc;
|
||||
@ -1428,7 +1428,7 @@ usb2_needs_explore_all(void)
|
||||
|
||||
DPRINTFN(3, "\n");
|
||||
|
||||
dc = usb2_devclass_ptr;
|
||||
dc = usb_devclass_ptr;
|
||||
if (dc == NULL) {
|
||||
DPRINTFN(0, "no devclass\n");
|
||||
return;
|
||||
@ -1442,7 +1442,7 @@ usb2_needs_explore_all(void)
|
||||
if (dev) {
|
||||
bus = device_get_softc(dev);
|
||||
if (bus) {
|
||||
usb2_needs_explore(bus, 1);
|
||||
usb_needs_explore(bus, 1);
|
||||
}
|
||||
}
|
||||
max--;
|
||||
@ -1450,7 +1450,7 @@ usb2_needs_explore_all(void)
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_bus_power_update
|
||||
* usb_bus_power_update
|
||||
*
|
||||
* This function will ensure that all USB devices on the given bus are
|
||||
* properly suspended or resumed according to the device transfer
|
||||
@ -1458,14 +1458,14 @@ usb2_needs_explore_all(void)
|
||||
*------------------------------------------------------------------------*/
|
||||
#if USB_HAVE_POWERD
|
||||
void
|
||||
usb2_bus_power_update(struct usb_bus *bus)
|
||||
usb_bus_power_update(struct usb_bus *bus)
|
||||
{
|
||||
usb2_needs_explore(bus, 0 /* no probe */ );
|
||||
usb_needs_explore(bus, 0 /* no probe */ );
|
||||
}
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_transfer_power_ref
|
||||
* usbd_transfer_power_ref
|
||||
*
|
||||
* This function will modify the power save reference counts and
|
||||
* wakeup the USB device associated with the given USB transfer, if
|
||||
@ -1473,7 +1473,7 @@ usb2_bus_power_update(struct usb_bus *bus)
|
||||
*------------------------------------------------------------------------*/
|
||||
#if USB_HAVE_POWERD
|
||||
void
|
||||
usb2_transfer_power_ref(struct usb_xfer *xfer, int val)
|
||||
usbd_transfer_power_ref(struct usb_xfer *xfer, int val)
|
||||
{
|
||||
static const usb_power_mask_t power_mask[4] = {
|
||||
[UE_CONTROL] = USB_HW_POWER_CONTROL,
|
||||
@ -1518,7 +1518,7 @@ usb2_transfer_power_ref(struct usb_xfer *xfer, int val)
|
||||
needs_explore =
|
||||
(udev->pwr_save.write_refs != 0) ||
|
||||
((udev->pwr_save.read_refs != 0) &&
|
||||
(usb2_peer_can_wakeup(udev) == 0));
|
||||
(usb_peer_can_wakeup(udev) == 0));
|
||||
else
|
||||
needs_explore = 0;
|
||||
|
||||
@ -1534,7 +1534,7 @@ usb2_transfer_power_ref(struct usb_xfer *xfer, int val)
|
||||
|
||||
if (needs_explore) {
|
||||
DPRINTF("update\n");
|
||||
usb2_bus_power_update(udev->bus);
|
||||
usb_bus_power_update(udev->bus);
|
||||
} else if (needs_hw_power) {
|
||||
DPRINTF("needs power\n");
|
||||
if (udev->bus->methods->set_hw_power != NULL) {
|
||||
@ -1545,14 +1545,14 @@ usb2_transfer_power_ref(struct usb_xfer *xfer, int val)
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_bus_powerd
|
||||
* usb_bus_powerd
|
||||
*
|
||||
* This function implements the USB power daemon and is called
|
||||
* regularly from the USB explore thread.
|
||||
*------------------------------------------------------------------------*/
|
||||
#if USB_HAVE_POWERD
|
||||
void
|
||||
usb2_bus_powerd(struct usb_bus *bus)
|
||||
usb_bus_powerd(struct usb_bus *bus)
|
||||
{
|
||||
struct usb_device *udev;
|
||||
usb_ticks_t temp;
|
||||
@ -1562,7 +1562,7 @@ usb2_bus_powerd(struct usb_bus *bus)
|
||||
uint8_t x;
|
||||
uint8_t rem_wakeup;
|
||||
|
||||
limit = usb2_power_timeout;
|
||||
limit = usb_power_timeout;
|
||||
if (limit == 0)
|
||||
limit = hz;
|
||||
else if (limit > 255)
|
||||
@ -1585,7 +1585,7 @@ usb2_bus_powerd(struct usb_bus *bus)
|
||||
if (udev == NULL)
|
||||
continue;
|
||||
|
||||
rem_wakeup = usb2_peer_can_wakeup(udev);
|
||||
rem_wakeup = usb_peer_can_wakeup(udev);
|
||||
|
||||
temp = ticks - udev->pwr_save.last_xfer_time;
|
||||
|
||||
@ -1598,7 +1598,7 @@ usb2_bus_powerd(struct usb_bus *bus)
|
||||
/* check if we are suspended */
|
||||
if (udev->flags.self_suspended != 0) {
|
||||
USB_BUS_UNLOCK(bus);
|
||||
usb2_dev_resume_peer(udev);
|
||||
usb_dev_resume_peer(udev);
|
||||
USB_BUS_LOCK(bus);
|
||||
}
|
||||
} else if (temp >= limit) {
|
||||
@ -1606,7 +1606,7 @@ usb2_bus_powerd(struct usb_bus *bus)
|
||||
/* check if we are not suspended */
|
||||
if (udev->flags.self_suspended == 0) {
|
||||
USB_BUS_UNLOCK(bus);
|
||||
usb2_dev_suspend_peer(udev);
|
||||
usb_dev_suspend_peer(udev);
|
||||
USB_BUS_LOCK(bus);
|
||||
}
|
||||
}
|
||||
@ -1677,13 +1677,13 @@ usb2_bus_powerd(struct usb_bus *bus)
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_dev_resume_peer
|
||||
* usb_dev_resume_peer
|
||||
*
|
||||
* This function will resume an USB peer and do the required USB
|
||||
* signalling to get an USB device out of the suspended state.
|
||||
*------------------------------------------------------------------------*/
|
||||
static void
|
||||
usb2_dev_resume_peer(struct usb_device *udev)
|
||||
usb_dev_resume_peer(struct usb_device *udev)
|
||||
{
|
||||
struct usb_bus *bus;
|
||||
int err;
|
||||
@ -1715,17 +1715,17 @@ usb2_dev_resume_peer(struct usb_device *udev)
|
||||
bus = udev->bus;
|
||||
|
||||
/* resume parent hub first */
|
||||
usb2_dev_resume_peer(udev->parent_hub);
|
||||
usb_dev_resume_peer(udev->parent_hub);
|
||||
|
||||
/* resume current port (Valid in Host and Device Mode) */
|
||||
err = usb2_req_clear_port_feature(udev->parent_hub,
|
||||
err = usbd_req_clear_port_feature(udev->parent_hub,
|
||||
NULL, udev->port_no, UHF_PORT_SUSPEND);
|
||||
if (err) {
|
||||
DPRINTFN(0, "Resuming port failed!\n");
|
||||
return;
|
||||
}
|
||||
/* resume settle time */
|
||||
usb2_pause_mtx(NULL, USB_MS_TO_TICKS(USB_PORT_RESUME_DELAY));
|
||||
usb_pause_mtx(NULL, USB_MS_TO_TICKS(USB_PORT_RESUME_DELAY));
|
||||
|
||||
if (bus->methods->device_resume != NULL) {
|
||||
/* resume USB device on the USB controller */
|
||||
@ -1756,31 +1756,31 @@ usb2_dev_resume_peer(struct usb_device *udev)
|
||||
}
|
||||
sx_xlock(udev->default_sx + 1);
|
||||
/* notify all sub-devices about resume */
|
||||
err = usb2_suspend_resume(udev, 0);
|
||||
err = usb_suspend_resume(udev, 0);
|
||||
sx_unlock(udev->default_sx + 1);
|
||||
|
||||
/* check if peer has wakeup capability */
|
||||
if (usb2_peer_can_wakeup(udev)) {
|
||||
if (usb_peer_can_wakeup(udev)) {
|
||||
/* clear remote wakeup */
|
||||
err = usb2_req_clear_device_feature(udev,
|
||||
err = usbd_req_clear_device_feature(udev,
|
||||
NULL, UF_DEVICE_REMOTE_WAKEUP);
|
||||
if (err) {
|
||||
DPRINTFN(0, "Clearing device "
|
||||
"remote wakeup failed: %s!\n",
|
||||
usb2_errstr(err));
|
||||
usbd_errstr(err));
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_dev_suspend_peer
|
||||
* usb_dev_suspend_peer
|
||||
*
|
||||
* This function will suspend an USB peer and do the required USB
|
||||
* signalling to get an USB device into the suspended state.
|
||||
*------------------------------------------------------------------------*/
|
||||
static void
|
||||
usb2_dev_suspend_peer(struct usb_device *udev)
|
||||
usb_dev_suspend_peer(struct usb_device *udev)
|
||||
{
|
||||
struct usb_device *child;
|
||||
int err;
|
||||
@ -1809,7 +1809,7 @@ usb2_dev_suspend_peer(struct usb_device *udev)
|
||||
/* check if all devices on the HUB are suspended */
|
||||
for (x = 0; x != nports; x++) {
|
||||
|
||||
child = usb2_bus_port_get_device(udev->bus,
|
||||
child = usb_bus_port_get_device(udev->bus,
|
||||
udev->hub->ports + x);
|
||||
|
||||
if (child == NULL)
|
||||
@ -1825,12 +1825,12 @@ usb2_dev_suspend_peer(struct usb_device *udev)
|
||||
|
||||
sx_xlock(udev->default_sx + 1);
|
||||
/* notify all sub-devices about suspend */
|
||||
err = usb2_suspend_resume(udev, 1);
|
||||
err = usb_suspend_resume(udev, 1);
|
||||
sx_unlock(udev->default_sx + 1);
|
||||
|
||||
if (usb2_peer_can_wakeup(udev)) {
|
||||
if (usb_peer_can_wakeup(udev)) {
|
||||
/* allow device to do remote wakeup */
|
||||
err = usb2_req_set_device_feature(udev,
|
||||
err = usbd_req_set_device_feature(udev,
|
||||
NULL, UF_DEVICE_REMOTE_WAKEUP);
|
||||
if (err) {
|
||||
DPRINTFN(0, "Setting device "
|
||||
@ -1852,12 +1852,12 @@ usb2_dev_suspend_peer(struct usb_device *udev)
|
||||
(udev->bus->methods->device_suspend) (udev);
|
||||
|
||||
/* do DMA delay */
|
||||
temp = usb2_get_dma_delay(udev->bus);
|
||||
usb2_pause_mtx(NULL, USB_MS_TO_TICKS(temp));
|
||||
temp = usbd_get_dma_delay(udev->bus);
|
||||
usb_pause_mtx(NULL, USB_MS_TO_TICKS(temp));
|
||||
|
||||
}
|
||||
/* suspend current port */
|
||||
err = usb2_req_set_port_feature(udev->parent_hub,
|
||||
err = usbd_req_set_port_feature(udev->parent_hub,
|
||||
NULL, udev->port_no, UHF_PORT_SUSPEND);
|
||||
if (err) {
|
||||
DPRINTFN(0, "Suspending port failed\n");
|
||||
@ -1869,13 +1869,13 @@ usb2_dev_suspend_peer(struct usb_device *udev)
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_set_power_mode
|
||||
* usbd_set_power_mode
|
||||
*
|
||||
* This function will set the power mode, see USB_POWER_MODE_XXX for a
|
||||
* USB device.
|
||||
*------------------------------------------------------------------------*/
|
||||
void
|
||||
usb2_set_power_mode(struct usb_device *udev, uint8_t power_mode)
|
||||
usbd_set_power_mode(struct usb_device *udev, uint8_t power_mode)
|
||||
{
|
||||
/* filter input argument */
|
||||
if ((power_mode != USB_POWER_MODE_ON) &&
|
||||
@ -1885,6 +1885,6 @@ usb2_set_power_mode(struct usb_device *udev, uint8_t power_mode)
|
||||
udev->power_mode = power_mode; /* update copy of power mode */
|
||||
|
||||
#if USB_HAVE_POWERD
|
||||
usb2_bus_power_update(udev->bus);
|
||||
usb_bus_power_update(udev->bus);
|
||||
#endif
|
||||
}
|
||||
|
@ -66,17 +66,17 @@ struct usb_hub {
|
||||
|
||||
/* function prototypes */
|
||||
|
||||
uint8_t usb2_intr_schedule_adjust(struct usb_device *udev, int16_t len,
|
||||
uint8_t usb_intr_schedule_adjust(struct usb_device *udev, int16_t len,
|
||||
uint8_t slot);
|
||||
void usb2_fs_isoc_schedule_init_all(struct usb_fs_isoc_schedule *fss);
|
||||
void usb2_bus_port_set_device(struct usb_bus *bus, struct usb_port *up,
|
||||
void usbd_fs_isoc_schedule_init_all(struct usb_fs_isoc_schedule *fss);
|
||||
void usb_bus_port_set_device(struct usb_bus *bus, struct usb_port *up,
|
||||
struct usb_device *udev, uint8_t device_index);
|
||||
struct usb_device *usb2_bus_port_get_device(struct usb_bus *bus,
|
||||
struct usb_device *usb_bus_port_get_device(struct usb_bus *bus,
|
||||
struct usb_port *up);
|
||||
void usb2_needs_explore(struct usb_bus *bus, uint8_t do_probe);
|
||||
void usb2_needs_explore_all(void);
|
||||
void usb2_bus_power_update(struct usb_bus *bus);
|
||||
void usb2_bus_powerd(struct usb_bus *bus);
|
||||
void usb_needs_explore(struct usb_bus *bus, uint8_t do_probe);
|
||||
void usb_needs_explore_all(void);
|
||||
void usb_bus_power_update(struct usb_bus *bus);
|
||||
void usb_bus_powerd(struct usb_bus *bus);
|
||||
void uhub_root_intr(struct usb_bus *, const uint8_t *, uint8_t);
|
||||
|
||||
#endif /* _USB2_HUB_H_ */
|
||||
|
@ -28,10 +28,10 @@
|
||||
#include <dev/usb/usb_lookup.h>
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_lookup_id_by_info
|
||||
* usbd_lookup_id_by_info
|
||||
*
|
||||
* This functions takes an array of "struct usb_device_id" and tries
|
||||
* to match the entries with the information in "struct usb_lookup_info".
|
||||
* to match the entries with the information in "struct usbd_lookup_info".
|
||||
*
|
||||
* NOTE: The "sizeof_id" parameter must be a multiple of the
|
||||
* usb_device_id structure size. Else the behaviour of this function
|
||||
@ -42,8 +42,8 @@
|
||||
* Else: Pointer to matching entry.
|
||||
*------------------------------------------------------------------------*/
|
||||
const struct usb_device_id *
|
||||
usb2_lookup_id_by_info(const struct usb_device_id *id, usb_size_t sizeof_id,
|
||||
const struct usb_lookup_info *info)
|
||||
usbd_lookup_id_by_info(const struct usb_device_id *id, usb_size_t sizeof_id,
|
||||
const struct usbd_lookup_info *info)
|
||||
{
|
||||
const struct usb_device_id *id_end;
|
||||
|
||||
@ -114,17 +114,17 @@ usb2_lookup_id_by_info(const struct usb_device_id *id, usb_size_t sizeof_id,
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_lookup_id_by_uaa - factored out code
|
||||
* usbd_lookup_id_by_uaa - factored out code
|
||||
*
|
||||
* Return values:
|
||||
* 0: Success
|
||||
* Else: Failure
|
||||
*------------------------------------------------------------------------*/
|
||||
int
|
||||
usb2_lookup_id_by_uaa(const struct usb_device_id *id, usb_size_t sizeof_id,
|
||||
usbd_lookup_id_by_uaa(const struct usb_device_id *id, usb_size_t sizeof_id,
|
||||
struct usb_attach_arg *uaa)
|
||||
{
|
||||
id = usb2_lookup_id_by_info(id, sizeof_id, &uaa->info);
|
||||
id = usbd_lookup_id_by_info(id, sizeof_id, &uaa->info);
|
||||
if (id) {
|
||||
/* copy driver info */
|
||||
uaa->driver_info = id->driver_info;
|
||||
|
@ -113,10 +113,10 @@ struct usb_device_id {
|
||||
#define USB_GET_DRIVER_INFO(did) \
|
||||
(did)->driver_info
|
||||
|
||||
const struct usb_device_id *usb2_lookup_id_by_info(
|
||||
const struct usb_device_id *usbd_lookup_id_by_info(
|
||||
const struct usb_device_id *id, usb_size_t sizeof_id,
|
||||
const struct usb_lookup_info *info);
|
||||
int usb2_lookup_id_by_uaa(const struct usb_device_id *id,
|
||||
const struct usbd_lookup_info *info);
|
||||
int usbd_lookup_id_by_uaa(const struct usb_device_id *id,
|
||||
usb_size_t sizeof_id, struct usb_attach_arg *uaa);
|
||||
|
||||
#endif /* _USB2_LOOKUP_H_ */
|
||||
|
@ -28,14 +28,14 @@
|
||||
#include <dev/usb/usb_mbuf.h>
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_alloc_mbufs - allocate mbufs to an usbd interface queue
|
||||
* usb_alloc_mbufs - allocate mbufs to an usbd interface queue
|
||||
*
|
||||
* Returns:
|
||||
* A pointer that should be passed to "free()" when the buffer(s)
|
||||
* should be released.
|
||||
*------------------------------------------------------------------------*/
|
||||
void *
|
||||
usb2_alloc_mbufs(struct malloc_type *type, struct usb_ifqueue *ifq,
|
||||
usb_alloc_mbufs(struct malloc_type *type, struct usb_ifqueue *ifq,
|
||||
usb_size_t block_size, uint16_t nblocks)
|
||||
{
|
||||
struct usb_mbuf *m_ptr;
|
||||
|
@ -34,8 +34,8 @@
|
||||
struct usb_mbuf {
|
||||
uint8_t *cur_data_ptr;
|
||||
uint8_t *min_data_ptr;
|
||||
struct usb_mbuf *usb2_nextpkt;
|
||||
struct usb_mbuf *usb2_next;
|
||||
struct usb_mbuf *usb_nextpkt;
|
||||
struct usb_mbuf *usb_next;
|
||||
|
||||
usb_size_t cur_data_len;
|
||||
usb_size_t max_data_len;
|
||||
@ -56,11 +56,11 @@ struct usb_ifqueue {
|
||||
};
|
||||
|
||||
#define USB_IF_ENQUEUE(ifq, m) do { \
|
||||
(m)->usb2_nextpkt = NULL; \
|
||||
(m)->usb_nextpkt = NULL; \
|
||||
if ((ifq)->ifq_tail == NULL) \
|
||||
(ifq)->ifq_head = (m); \
|
||||
else \
|
||||
(ifq)->ifq_tail->usb2_nextpkt = (m); \
|
||||
(ifq)->ifq_tail->usb_nextpkt = (m); \
|
||||
(ifq)->ifq_tail = (m); \
|
||||
(ifq)->ifq_len++; \
|
||||
} while (0)
|
||||
@ -68,16 +68,16 @@ struct usb_ifqueue {
|
||||
#define USB_IF_DEQUEUE(ifq, m) do { \
|
||||
(m) = (ifq)->ifq_head; \
|
||||
if (m) { \
|
||||
if (((ifq)->ifq_head = (m)->usb2_nextpkt) == NULL) { \
|
||||
if (((ifq)->ifq_head = (m)->usb_nextpkt) == NULL) { \
|
||||
(ifq)->ifq_tail = NULL; \
|
||||
} \
|
||||
(m)->usb2_nextpkt = NULL; \
|
||||
(m)->usb_nextpkt = NULL; \
|
||||
(ifq)->ifq_len--; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define USB_IF_PREPEND(ifq, m) do { \
|
||||
(m)->usb2_nextpkt = (ifq)->ifq_head; \
|
||||
(m)->usb_nextpkt = (ifq)->ifq_head; \
|
||||
if ((ifq)->ifq_tail == NULL) { \
|
||||
(ifq)->ifq_tail = (m); \
|
||||
} \
|
||||
@ -96,7 +96,7 @@ struct usb_ifqueue {
|
||||
} while (0)
|
||||
|
||||
/* prototypes */
|
||||
void *usb2_alloc_mbufs(struct malloc_type *type, struct usb_ifqueue *ifq,
|
||||
void *usb_alloc_mbufs(struct malloc_type *type, struct usb_ifqueue *ifq,
|
||||
usb_size_t block_size, uint16_t nblocks);
|
||||
|
||||
#endif /* _USB2_MBUF_H_ */
|
||||
|
@ -36,7 +36,7 @@
|
||||
#include <dev/usb/usb_error.h>
|
||||
#include <dev/usb/usb.h>
|
||||
|
||||
#define USB_DEBUG_VAR usb2_debug
|
||||
#define USB_DEBUG_VAR usb_debug
|
||||
|
||||
#include <dev/usb/usb_core.h>
|
||||
#include <dev/usb/usb_busdma.h>
|
||||
@ -221,7 +221,7 @@ static void
|
||||
bbb_transfer_start(struct bbb_transfer *sc, uint8_t xfer_index)
|
||||
{
|
||||
sc->state = xfer_index;
|
||||
usb2_transfer_start(sc->xfer[xfer_index]);
|
||||
usbd_transfer_start(sc->xfer[xfer_index]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -230,7 +230,7 @@ bbb_data_clear_stall_callback(struct usb_xfer *xfer,
|
||||
{
|
||||
struct bbb_transfer *sc = xfer->priv_sc;
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, sc->xfer[stall_xfer])) {
|
||||
if (usbd_clear_stall_callback(xfer, sc->xfer[stall_xfer])) {
|
||||
switch (USB_GET_STATE(xfer)) {
|
||||
case USB_ST_SETUP:
|
||||
case USB_ST_TRANSFERRED:
|
||||
@ -272,8 +272,8 @@ bbb_command_callback(struct usb_xfer *xfer)
|
||||
}
|
||||
xfer->frlengths[0] = sizeof(sc->cbw);
|
||||
|
||||
usb2_set_frame_data(xfer, &sc->cbw, 0);
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_set_frame_data(xfer, &sc->cbw, 0);
|
||||
usbd_transfer_submit(xfer);
|
||||
break;
|
||||
|
||||
default: /* Error */
|
||||
@ -312,8 +312,8 @@ bbb_data_read_callback(struct usb_xfer *xfer)
|
||||
xfer->timeout = sc->data_timeout;
|
||||
xfer->frlengths[0] = max_bulk;
|
||||
|
||||
usb2_set_frame_data(xfer, sc->data_ptr, 0);
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_set_frame_data(xfer, sc->data_ptr, 0);
|
||||
usbd_transfer_submit(xfer);
|
||||
break;
|
||||
|
||||
default: /* Error */
|
||||
@ -363,8 +363,8 @@ bbb_data_write_callback(struct usb_xfer *xfer)
|
||||
xfer->timeout = sc->data_timeout;
|
||||
xfer->frlengths[0] = max_bulk;
|
||||
|
||||
usb2_set_frame_data(xfer, sc->data_ptr, 0);
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_set_frame_data(xfer, sc->data_ptr, 0);
|
||||
usbd_transfer_submit(xfer);
|
||||
return;
|
||||
|
||||
default: /* Error */
|
||||
@ -407,13 +407,13 @@ bbb_status_callback(struct usb_xfer *xfer)
|
||||
case USB_ST_SETUP:
|
||||
xfer->frlengths[0] = sizeof(sc->csw);
|
||||
|
||||
usb2_set_frame_data(xfer, &sc->csw, 0);
|
||||
usb2_start_hardware(xfer);
|
||||
usbd_set_frame_data(xfer, &sc->csw, 0);
|
||||
usbd_transfer_submit(xfer);
|
||||
break;
|
||||
|
||||
default:
|
||||
DPRINTFN(0, "Failed to read CSW: %s, try %d\n",
|
||||
usb2_errstr(xfer->error), sc->status_try);
|
||||
usbd_errstr(xfer->error), sc->status_try);
|
||||
|
||||
if ((xfer->error == USB_ERR_CANCELLED) ||
|
||||
(sc->status_try)) {
|
||||
@ -447,23 +447,23 @@ bbb_command_start(struct bbb_transfer *sc, uint8_t dir, uint8_t lun,
|
||||
sc->actlen = 0;
|
||||
sc->cmd_len = cmd_len;
|
||||
|
||||
usb2_transfer_start(sc->xfer[sc->state]);
|
||||
usbd_transfer_start(sc->xfer[sc->state]);
|
||||
|
||||
while (usb2_transfer_pending(sc->xfer[sc->state])) {
|
||||
while (usbd_transfer_pending(sc->xfer[sc->state])) {
|
||||
cv_wait(&sc->cv, &sc->mtx);
|
||||
}
|
||||
return (sc->error);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_test_autoinstall
|
||||
* usb_test_autoinstall
|
||||
*
|
||||
* Return values:
|
||||
* 0: This interface is an auto install disk (CD-ROM)
|
||||
* Else: Not an auto install disk.
|
||||
*------------------------------------------------------------------------*/
|
||||
usb_error_t
|
||||
usb2_test_autoinstall(struct usb_device *udev, uint8_t iface_index,
|
||||
usb_test_autoinstall(struct usb_device *udev, uint8_t iface_index,
|
||||
uint8_t do_eject)
|
||||
{
|
||||
struct usb_interface *iface;
|
||||
@ -476,7 +476,7 @@ usb2_test_autoinstall(struct usb_device *udev, uint8_t iface_index,
|
||||
if (udev == NULL) {
|
||||
return (USB_ERR_INVAL);
|
||||
}
|
||||
iface = usb2_get_iface(udev, iface_index);
|
||||
iface = usbd_get_iface(udev, iface_index);
|
||||
if (iface == NULL) {
|
||||
return (USB_ERR_INVAL);
|
||||
}
|
||||
@ -510,7 +510,7 @@ usb2_test_autoinstall(struct usb_device *udev, uint8_t iface_index,
|
||||
mtx_init(&sc->mtx, "USB autoinstall", NULL, MTX_DEF);
|
||||
cv_init(&sc->cv, "WBBB");
|
||||
|
||||
err = usb2_transfer_setup(udev,
|
||||
err = usbd_transfer_setup(udev,
|
||||
&iface_index, sc->xfer, bbb_config,
|
||||
ST_MAX, sc, &sc->mtx);
|
||||
|
||||
@ -552,13 +552,13 @@ usb2_test_autoinstall(struct usb_device *udev, uint8_t iface_index,
|
||||
NULL, 0, 6, USB_MS_HZ);
|
||||
|
||||
DPRINTFN(0, "Eject CD command "
|
||||
"status: %s\n", usb2_errstr(err));
|
||||
"status: %s\n", usbd_errstr(err));
|
||||
}
|
||||
err = 0;
|
||||
goto done;
|
||||
}
|
||||
} else if ((err != 2) && --timeout) {
|
||||
usb2_pause_mtx(&sc->mtx, hz);
|
||||
usb_pause_mtx(&sc->mtx, hz);
|
||||
goto repeat_inquiry;
|
||||
}
|
||||
err = USB_ERR_INVAL;
|
||||
@ -566,7 +566,7 @@ usb2_test_autoinstall(struct usb_device *udev, uint8_t iface_index,
|
||||
|
||||
done:
|
||||
mtx_unlock(&sc->mtx);
|
||||
usb2_transfer_unsetup(sc->xfer, ST_MAX);
|
||||
usbd_transfer_unsetup(sc->xfer, ST_MAX);
|
||||
mtx_destroy(&sc->mtx);
|
||||
cv_destroy(&sc->cv);
|
||||
free(sc, M_USB);
|
||||
|
@ -27,7 +27,7 @@
|
||||
#ifndef _USB2_MSCTEST_H_
|
||||
#define _USB2_MSCTEST_H_
|
||||
|
||||
usb_error_t usb2_test_autoinstall(struct usb_device *udev,
|
||||
usb_error_t usb_test_autoinstall(struct usb_device *udev,
|
||||
uint8_t iface_index, uint8_t do_eject);
|
||||
|
||||
#endif /* _USB2_MSCTEST_H_ */
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include <dev/usb/usb_parse.h>
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_desc_foreach
|
||||
* usb_desc_foreach
|
||||
*
|
||||
* This function is the safe way to iterate across the USB config
|
||||
* descriptor. It contains several checks against invalid
|
||||
@ -43,7 +43,7 @@
|
||||
* Else: Next descriptor after "desc"
|
||||
*------------------------------------------------------------------------*/
|
||||
struct usb_descriptor *
|
||||
usb2_desc_foreach(struct usb_config_descriptor *cd,
|
||||
usb_desc_foreach(struct usb_config_descriptor *cd,
|
||||
struct usb_descriptor *_desc)
|
||||
{
|
||||
uint8_t *desc_next;
|
||||
@ -84,7 +84,7 @@ usb2_desc_foreach(struct usb_config_descriptor *cd,
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_idesc_foreach
|
||||
* usb_idesc_foreach
|
||||
*
|
||||
* This function will iterate the interface descriptors in the config
|
||||
* descriptor. The parse state structure should be zeroed before
|
||||
@ -95,7 +95,7 @@ usb2_desc_foreach(struct usb_config_descriptor *cd,
|
||||
* Else: A valid interface descriptor
|
||||
*------------------------------------------------------------------------*/
|
||||
struct usb_interface_descriptor *
|
||||
usb2_idesc_foreach(struct usb_config_descriptor *cd,
|
||||
usb_idesc_foreach(struct usb_config_descriptor *cd,
|
||||
struct usb_idesc_parse_state *ps)
|
||||
{
|
||||
struct usb_interface_descriptor *id;
|
||||
@ -108,7 +108,7 @@ usb2_idesc_foreach(struct usb_config_descriptor *cd,
|
||||
|
||||
while (1) {
|
||||
id = (struct usb_interface_descriptor *)
|
||||
usb2_desc_foreach(cd, (struct usb_descriptor *)id);
|
||||
usb_desc_foreach(cd, (struct usb_descriptor *)id);
|
||||
if (id == NULL)
|
||||
break;
|
||||
if ((id->bDescriptorType == UDESC_INTERFACE) &&
|
||||
@ -137,7 +137,7 @@ usb2_idesc_foreach(struct usb_config_descriptor *cd,
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_edesc_foreach
|
||||
* usb_edesc_foreach
|
||||
*
|
||||
* This function will iterate all the endpoint descriptors within an
|
||||
* interface descriptor. Starting value for the "ped" argument should
|
||||
@ -148,14 +148,14 @@ usb2_idesc_foreach(struct usb_config_descriptor *cd,
|
||||
* Else: A valid endpoint descriptor
|
||||
*------------------------------------------------------------------------*/
|
||||
struct usb_endpoint_descriptor *
|
||||
usb2_edesc_foreach(struct usb_config_descriptor *cd,
|
||||
usb_edesc_foreach(struct usb_config_descriptor *cd,
|
||||
struct usb_endpoint_descriptor *ped)
|
||||
{
|
||||
struct usb_descriptor *desc;
|
||||
|
||||
desc = ((struct usb_descriptor *)ped);
|
||||
|
||||
while ((desc = usb2_desc_foreach(cd, desc))) {
|
||||
while ((desc = usb_desc_foreach(cd, desc))) {
|
||||
if (desc->bDescriptorType == UDESC_INTERFACE) {
|
||||
break;
|
||||
}
|
||||
@ -171,18 +171,18 @@ usb2_edesc_foreach(struct usb_config_descriptor *cd,
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_get_no_descriptors
|
||||
* usbd_get_no_descriptors
|
||||
*
|
||||
* This function will count the total number of descriptors in the
|
||||
* configuration descriptor of type "type".
|
||||
*------------------------------------------------------------------------*/
|
||||
uint8_t
|
||||
usb2_get_no_descriptors(struct usb_config_descriptor *cd, uint8_t type)
|
||||
usbd_get_no_descriptors(struct usb_config_descriptor *cd, uint8_t type)
|
||||
{
|
||||
struct usb_descriptor *desc = NULL;
|
||||
uint8_t count = 0;
|
||||
|
||||
while ((desc = usb2_desc_foreach(cd, desc))) {
|
||||
while ((desc = usb_desc_foreach(cd, desc))) {
|
||||
if (desc->bDescriptorType == type) {
|
||||
count++;
|
||||
if (count == 0xFF)
|
||||
@ -193,13 +193,13 @@ usb2_get_no_descriptors(struct usb_config_descriptor *cd, uint8_t type)
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb2_get_no_alts
|
||||
* usbd_get_no_alts
|
||||
*
|
||||
* Return value:
|
||||
* Number of alternate settings for the given interface descriptor pointer.
|
||||
*------------------------------------------------------------------------*/
|
||||
uint8_t
|
||||
usb2_get_no_alts(struct usb_config_descriptor *cd,
|
||||
usbd_get_no_alts(struct usb_config_descriptor *cd,
|
||||
struct usb_interface_descriptor *id)
|
||||
{
|
||||
struct usb_descriptor *desc;
|
||||
@ -210,7 +210,7 @@ usb2_get_no_alts(struct usb_config_descriptor *cd,
|
||||
|
||||
desc = (struct usb_descriptor *)id;
|
||||
|
||||
while ((desc = usb2_desc_foreach(cd, desc))) {
|
||||
while ((desc = usb_desc_foreach(cd, desc))) {
|
||||
if ((desc->bDescriptorType == UDESC_INTERFACE) &&
|
||||
(desc->bLength >= sizeof(*id))) {
|
||||
id = (struct usb_interface_descriptor *)desc;
|
||||
|
@ -38,17 +38,17 @@ struct usb_idesc_parse_state {
|
||||
|
||||
/* prototypes */
|
||||
|
||||
struct usb_descriptor *usb2_desc_foreach(struct usb_config_descriptor *cd,
|
||||
struct usb_descriptor *usb_desc_foreach(struct usb_config_descriptor *cd,
|
||||
struct usb_descriptor *desc);
|
||||
struct usb_interface_descriptor *usb2_idesc_foreach(
|
||||
struct usb_interface_descriptor *usb_idesc_foreach(
|
||||
struct usb_config_descriptor *cd,
|
||||
struct usb_idesc_parse_state *ps);
|
||||
struct usb_endpoint_descriptor *usb2_edesc_foreach(
|
||||
struct usb_endpoint_descriptor *usb_edesc_foreach(
|
||||
struct usb_config_descriptor *cd,
|
||||
struct usb_endpoint_descriptor *ped);
|
||||
uint8_t usb2_get_no_descriptors(struct usb_config_descriptor *cd,
|
||||
uint8_t usbd_get_no_descriptors(struct usb_config_descriptor *cd,
|
||||
uint8_t type);
|
||||
uint8_t usb2_get_no_alts(struct usb_config_descriptor *cd,
|
||||
uint8_t usbd_get_no_alts(struct usb_config_descriptor *cd,
|
||||
struct usb_interface_descriptor *id);
|
||||
|
||||
#endif /* _USB2_PARSE_H_ */
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user