PERFORCE change 131322 for review
Hans Petter Selasky
hselasky at FreeBSD.org
Thu Dec 20 12:06:43 PST 2007
http://perforce.freebsd.org/chv.cgi?CH=131322
Change 131322 by hselasky at hselasky_laptop001 on 2007/12/20 20:06:16
Minor USB API change.
Many USB devices have endpoints in different interfaces.
Allow fetching endpoints from multiple endopints by
passing an "ifaces" array to "usbd_transfer_setup" so
that we can do all in one go !
Affected files ...
.. //depot/projects/usb/src/sys/dev/ata/ata-usb.c#30 edit
.. //depot/projects/usb/src/sys/dev/sound/usb/uaudio.c#29 edit
.. //depot/projects/usb/src/sys/dev/usb/README#29 edit
.. //depot/projects/usb/src/sys/dev/usb/if_aue.c#41 edit
.. //depot/projects/usb/src/sys/dev/usb/if_axe.c#43 edit
.. //depot/projects/usb/src/sys/dev/usb/if_cdce.c#33 edit
.. //depot/projects/usb/src/sys/dev/usb/if_cue.c#37 edit
.. //depot/projects/usb/src/sys/dev/usb/if_kue.c#39 edit
.. //depot/projects/usb/src/sys/dev/usb/if_rue.c#37 edit
.. //depot/projects/usb/src/sys/dev/usb/if_rum.c#24 edit
.. //depot/projects/usb/src/sys/dev/usb/if_udav.c#39 edit
.. //depot/projects/usb/src/sys/dev/usb/if_ural.c#48 edit
.. //depot/projects/usb/src/sys/dev/usb/if_zyd.c#28 edit
.. //depot/projects/usb/src/sys/dev/usb/uark.c#17 edit
.. //depot/projects/usb/src/sys/dev/usb/ubsa.c#34 edit
.. //depot/projects/usb/src/sys/dev/usb/ubser.c#26 edit
.. //depot/projects/usb/src/sys/dev/usb/ucycom.c#29 edit
.. //depot/projects/usb/src/sys/dev/usb/udbp.c#22 edit
.. //depot/projects/usb/src/sys/dev/usb/ufoma.c#36 edit
.. //depot/projects/usb/src/sys/dev/usb/uftdi.c#31 edit
.. //depot/projects/usb/src/sys/dev/usb/ugen.c#33 edit
.. //depot/projects/usb/src/sys/dev/usb/ugensa.c#18 edit
.. //depot/projects/usb/src/sys/dev/usb/uhid.c#28 edit
.. //depot/projects/usb/src/sys/dev/usb/uhub.c#29 edit
.. //depot/projects/usb/src/sys/dev/usb/uipaq.c#19 edit
.. //depot/projects/usb/src/sys/dev/usb/ukbd.c#37 edit
.. //depot/projects/usb/src/sys/dev/usb/ulpt.c#37 edit
.. //depot/projects/usb/src/sys/dev/usb/umass.c#40 edit
.. //depot/projects/usb/src/sys/dev/usb/umct.c#28 edit
.. //depot/projects/usb/src/sys/dev/usb/umodem.c#38 edit
.. //depot/projects/usb/src/sys/dev/usb/umoscom.c#14 edit
.. //depot/projects/usb/src/sys/dev/usb/ums.c#36 edit
.. //depot/projects/usb/src/sys/dev/usb/uplcom.c#35 edit
.. //depot/projects/usb/src/sys/dev/usb/urio.c#22 edit
.. //depot/projects/usb/src/sys/dev/usb/usb.c#28 edit
.. //depot/projects/usb/src/sys/dev/usb/usb_compat_linux.c#19 edit
.. //depot/projects/usb/src/sys/dev/usb/usb_subr.h#83 edit
.. //depot/projects/usb/src/sys/dev/usb/usb_transfer.c#81 edit
.. //depot/projects/usb/src/sys/dev/usb/uscanner.c#21 edit
.. //depot/projects/usb/src/sys/dev/usb/uvisor.c#31 edit
.. //depot/projects/usb/src/sys/dev/usb/uvscom.c#34 edit
.. //depot/projects/usb/src/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c#23 edit
.. //depot/projects/usb/src/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c#18 edit
Differences ...
==== //depot/projects/usb/src/sys/dev/ata/ata-usb.c#30 (text) ====
@@ -386,10 +386,9 @@
(strcmp(subclass, "ATAPI") && strcmp(subclass, "SCSI"))) {
goto detach;
}
- err = usbd_transfer_setup(uaa->device, uaa->iface_index, sc->xfer,
- atausb_config,
- ATAUSB_T_BBB_MAX, sc,
- &(sc->locked_mtx));
+ err = usbd_transfer_setup(uaa->device, &(uaa->iface_index), sc->xfer,
+ atausb_config, ATAUSB_T_BBB_MAX, sc, &(sc->locked_mtx));
+
/* skip reset first time */
sc->last_xfer_no = ATAUSB_T_BBB_COMMAND;
==== //depot/projects/usb/src/sys/dev/sound/usb/uaudio.c#29 (text+ko) ====
@@ -1427,9 +1427,8 @@
DPRINTF(0, "setting of sample rate failed! (continuing anyway)\n");
}
}
- if (usbd_transfer_setup(sc->sc_udev, iface_index, ch->xfer,
- ch->usb_cfg, UAUDIO_NCHANBUFS, ch,
- ch->pcm_mtx)) {
+ if (usbd_transfer_setup(sc->sc_udev, &iface_index, ch->xfer,
+ ch->usb_cfg, UAUDIO_NCHANBUFS, ch, ch->pcm_mtx)) {
DPRINTF(0, "could not allocate USB transfers!\n");
goto error;
}
@@ -3169,7 +3168,7 @@
sc->sc_mixer_lock = mixer_get_lock(m);
- if (usbd_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,
sc->sc_mixer_lock)) {
DPRINTF(0, "could not allocate USB transfer for audio mixer!\n");
@@ -3705,7 +3704,7 @@
}
USBD_SET_IFACE_NO_PROBE(sc->sc_udev, chan->iface_index);
- error = usbd_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) {
==== //depot/projects/usb/src/sys/dev/usb/README#29 (text+ko) ====
@@ -171,13 +171,13 @@
/*------------------------------------------------------------------------*
* usbd_status_t
- * usbd_transfer_setup(udev, iface_index, pxfer, setup_start,
+ * usbd_transfer_setup(udev, ifaces, pxfer, setup_start,
* n_setup, priv_sc, priv_mtx)
*------------------------------------------------------------------------*/
- "udev" is a pointer to "struct usbd_device".
-- "iface_index" is the interface index number.
+- "ifaces" array of interface index numbers to use. See "if_index".
- "pxfer" is a pointer to an array of USB transfer pointers that are
initialized to NULL, and then pointed to allocated USB transfers.
@@ -292,9 +292,13 @@
UE_ISOCHRONOUS)
Not allowed. Will cause an error.
-- The "index" field allows one to give a number, in case more
+- The "ep_index" field allows you to give a number, in case more
endpoints match the description, that selects which matching
- "index" should be used.
+ "ep_index" should be used.
+
+- The "if_index" field allows you to select which of the interface
+ numbers in the "ifaces" array parameter passed to "usbd_transfer_setup"
+ that should be used when setting up the given USB transfer.
- The "flags" field has type "struct usbd_xfer_flags" and allows one
to set initial flags an USB transfer. Valid flags are:
==== //depot/projects/usb/src/sys/dev/usb/if_aue.c#41 (text+ko) ====
@@ -781,6 +781,7 @@
struct usb_attach_arg *uaa = device_get_ivars(dev);
struct aue_softc *sc = device_get_softc(dev);
int32_t error;
+ uint8_t iface_index;
if (sc == NULL) {
return (ENOMEM);
@@ -812,7 +813,8 @@
"number failed!\n");
goto detach;
}
- error = usbd_transfer_setup(uaa->device, AUE_IFACE_IDX,
+ iface_index = AUE_IFACE_IDX;
+ error = usbd_transfer_setup(uaa->device, &iface_index,
sc->sc_xfer, aue_config, AUE_ENDPT_MAX,
sc, &(sc->sc_mtx));
if (error) {
==== //depot/projects/usb/src/sys/dev/usb/if_axe.c#43 (text+ko) ====
@@ -640,6 +640,7 @@
struct axe_type *t = axe_find_product(uaa);
struct axe_softc *sc = device_get_softc(dev);
int32_t error;
+ uint8_t iface_index;
if (sc == NULL) {
return (ENOMEM);
@@ -666,7 +667,8 @@
"number failed!\n");
goto detach;
}
- error = usbd_transfer_setup(uaa->device, AXE_IFACE_IDX,
+ iface_index = AXE_IFACE_IDX;
+ error = usbd_transfer_setup(uaa->device, &iface_index,
sc->sc_xfer, axe_config, AXE_ENDPT_MAX,
sc, &(sc->sc_mtx));
if (error) {
==== //depot/projects/usb/src/sys/dev/usb/if_cdce.c#33 (text+ko) ====
@@ -316,7 +316,7 @@
goto detach;
}
error = usbd_transfer_setup
- (uaa->device, sc->sc_data_iface_index,
+ (uaa->device, &(sc->sc_data_iface_index),
sc->sc_xfer, cdce_config, CDCE_ENDPT_MAX,
sc, &(sc->sc_mtx));
==== //depot/projects/usb/src/sys/dev/usb/if_cue.c#37 (text+ko) ====
@@ -474,6 +474,7 @@
{
struct usb_attach_arg *uaa = device_get_ivars(dev);
struct cue_softc *sc = device_get_softc(dev);
+ uint8_t iface_index;
int32_t error;
if (sc == NULL) {
@@ -497,9 +498,9 @@
"number failed!\n");
goto detach;
}
- error = usbd_transfer_setup(uaa->device, CUE_IFACE_IDX,
- sc->sc_xfer, cue_config, CUE_ENDPT_MAX,
- sc, &(sc->sc_mtx));
+ iface_index = CUE_IFACE_IDX;
+ error = usbd_transfer_setup(uaa->device, &iface_index,
+ sc->sc_xfer, cue_config, CUE_ENDPT_MAX, sc, &(sc->sc_mtx));
if (error) {
device_printf(dev, "allocating USB "
"transfers failed!\n");
==== //depot/projects/usb/src/sys/dev/usb/if_kue.c#39 (text+ko) ====
@@ -504,6 +504,7 @@
struct usb_attach_arg *uaa = device_get_ivars(dev);
struct kue_softc *sc = device_get_softc(dev);
int32_t error;
+ uint8_t iface_index;
if (sc == NULL) {
return (ENOMEM);
@@ -526,9 +527,9 @@
"number failed!\n");
goto detach;
}
- error = usbd_transfer_setup(uaa->device, KUE_IFACE_IDX,
- sc->sc_xfer, kue_config, KUE_ENDPT_MAX,
- sc, &(sc->sc_mtx));
+ iface_index = KUE_IFACE_IDX;
+ error = usbd_transfer_setup(uaa->device, &iface_index,
+ sc->sc_xfer, kue_config, KUE_ENDPT_MAX, sc, &(sc->sc_mtx));
if (error) {
device_printf(dev, "allocating USB "
"transfers failed!\n");
==== //depot/projects/usb/src/sys/dev/usb/if_rue.c#37 (text+ko) ====
@@ -697,6 +697,7 @@
struct usb_attach_arg *uaa = device_get_ivars(dev);
struct rue_softc *sc = device_get_softc(dev);
int32_t error;
+ uint8_t iface_index;
if (sc == NULL) {
return (ENOMEM);
@@ -722,7 +723,8 @@
"number failed!\n");
goto detach;
}
- error = usbd_transfer_setup(uaa->device, RUE_IFACE_IDX,
+ iface_index = RUE_IFACE_IDX;
+ error = usbd_transfer_setup(uaa->device, &iface_index,
sc->sc_xfer, rue_config, RUE_ENDPT_MAX,
sc, &(sc->sc_mtx));
if (error) {
==== //depot/projects/usb/src/sys/dev/usb/if_rum.c#24 (text+ko) ====
@@ -453,6 +453,7 @@
struct usb_attach_arg *uaa = device_get_ivars(dev);
struct rum_softc *sc = device_get_softc(dev);
int error;
+ uint8_t iface_index;
if (sc == NULL) {
return (ENOMEM);
@@ -478,9 +479,9 @@
"number, err=%s!\n", usbd_errstr(error));
goto detach;
}
- error = usbd_transfer_setup(uaa->device, RT2573_IFACE_INDEX,
- sc->sc_xfer, rum_config, RUM_N_TRANSFER,
- sc, &(sc->sc_mtx));
+ iface_index = RT2573_IFACE_INDEX;
+ error = usbd_transfer_setup(uaa->device, &iface_index,
+ sc->sc_xfer, rum_config, RUM_N_TRANSFER, sc, &(sc->sc_mtx));
if (error) {
device_printf(dev, "could not allocate USB transfers, "
"err=%s\n", usbd_errstr(error));
==== //depot/projects/usb/src/sys/dev/usb/if_udav.c#39 (text+ko) ====
@@ -314,6 +314,7 @@
struct usb_attach_arg *uaa = device_get_ivars(dev);
struct udav_softc *sc = device_get_softc(dev);
int32_t error;
+ uint8_t iface_index;
if (sc == NULL) {
return (ENOMEM);
@@ -340,9 +341,9 @@
"number failed!\n");
goto detach;
}
- error = usbd_transfer_setup(uaa->device, UDAV_IFACE_INDEX,
- sc->sc_xfer, udav_config, UDAV_ENDPT_MAX,
- sc, &(sc->sc_mtx));
+ iface_index = UDAV_IFACE_INDEX;
+ error = usbd_transfer_setup(uaa->device, &iface_index,
+ sc->sc_xfer, udav_config, UDAV_ENDPT_MAX, sc, &(sc->sc_mtx));
if (error) {
device_printf(dev, "allocating USB "
"transfers failed!\n");
==== //depot/projects/usb/src/sys/dev/usb/if_ural.c#48 (text+ko) ====
@@ -512,6 +512,7 @@
struct usb_attach_arg *uaa = device_get_ivars(dev);
struct ural_softc *sc = device_get_softc(dev);
int error;
+ uint8_t iface_index;
if (sc == NULL) {
return (ENOMEM);
@@ -537,9 +538,11 @@
"number, err=%s!\n", usbd_errstr(error));
goto detach;
}
- error = usbd_transfer_setup(uaa->device, RAL_IFACE_INDEX,
- sc->sc_xfer, ural_config, URAL_N_TRANSFER,
- sc, &(sc->sc_mtx));
+ iface_index = RAL_IFACE_INDEX;
+ error = usbd_transfer_setup(uaa->device,
+ &iface_index, sc->sc_xfer, ural_config,
+ URAL_N_TRANSFER, sc, &(sc->sc_mtx));
+
if (error) {
device_printf(dev, "could not allocate USB transfers, "
"err=%s\n", usbd_errstr(error));
==== //depot/projects/usb/src/sys/dev/usb/if_zyd.c#28 (text+ko) ====
@@ -1247,6 +1247,7 @@
struct usb_attach_arg *uaa = device_get_ivars(dev);
struct zyd_softc *sc = device_get_softc(dev);
int error;
+ uint8_t iface_index;
if (sc == NULL) {
return (ENOMEM);
@@ -1287,10 +1288,9 @@
* Endpoint 3 = Intr in (64b)
* Endpoint 4 = Intr out @ high speed / bulk out @ full speed (64b)
*/
-
- error = usbd_transfer_setup(uaa->device, ZYD_IFACE_IDX,
- sc->sc_xfer, zyd_config, ZYD_TR_MAX,
- sc, &(sc->sc_mtx));
+ iface_index = ZYD_IFACE_IDX;
+ error = usbd_transfer_setup(uaa->device, &iface_index,
+ sc->sc_xfer, zyd_config, ZYD_TR_MAX, sc, &(sc->sc_mtx));
if (error) {
device_printf(dev, "could not allocate USB "
"transfers: %s\n", usbd_errstr(error));
==== //depot/projects/usb/src/sys/dev/usb/uark.c#17 (text+ko) ====
@@ -201,6 +201,7 @@
struct usb_attach_arg *uaa = device_get_ivars(dev);
struct uark_softc *sc = device_get_softc(dev);
int32_t error;
+ uint8_t iface_index;
if (sc == NULL) {
return (ENOMEM);
@@ -216,10 +217,10 @@
usbd_errstr(error));
goto detach;
}
+ iface_index = UARK_IFACE_INDEX;
error = usbd_transfer_setup
- (uaa->device, UARK_IFACE_INDEX,
- sc->sc_xfer, uark_xfer_config, UARK_N_TRANSFER,
- sc, &Giant);
+ (uaa->device, &iface_index, sc->sc_xfer,
+ uark_xfer_config, UARK_N_TRANSFER, sc, &Giant);
if (error) {
device_printf(dev, "allocating control USB "
==== //depot/projects/usb/src/sys/dev/usb/ubsa.c#34 (text+ko) ====
@@ -376,9 +376,9 @@
sc->sc_iface_no = id->bInterfaceNumber;
sc->sc_iface_index = UBSA_IFACE_INDEX;
- error = usbd_transfer_setup(uaa->device, sc->sc_iface_index,
- sc->sc_xfer, ubsa_config, UBSA_N_TRANSFER,
- sc, &Giant);
+ error = usbd_transfer_setup(uaa->device, &(sc->sc_iface_index),
+ sc->sc_xfer, ubsa_config, UBSA_N_TRANSFER, sc, &Giant);
+
if (error) {
DPRINTF(0, "could not allocate all pipes\n");
goto detach;
==== //depot/projects/usb/src/sys/dev/usb/ubser.c#26 (text+ko) ====
@@ -299,9 +299,8 @@
device_printf(dev, "found %i serials\n", sc->sc_numser);
- error = usbd_transfer_setup(uaa->device, sc->sc_iface_index,
- sc->sc_xfer, ubser_config,
- UBSER_TR_MAX, sc, &Giant);
+ error = usbd_transfer_setup(uaa->device, &(sc->sc_iface_index),
+ sc->sc_xfer, ubser_config, UBSER_TR_MAX, sc, &Giant);
if (error) {
goto detach;
}
==== //depot/projects/usb/src/sys/dev/usb/ucycom.c#29 (text+ko) ====
@@ -220,6 +220,7 @@
void *urd_ptr = NULL;
int32_t error;
uint16_t urd_len;
+ uint8_t iface_index;
if (sc == NULL) {
return (ENOMEM);
@@ -297,7 +298,8 @@
}
sc->sc_iface_no = iface->idesc->bInterfaceNumber;
- error = usbd_transfer_setup(uaa->device, UCYCOM_IFACE_INDEX,
+ iface_index = UCYCOM_IFACE_INDEX;
+ error = usbd_transfer_setup(uaa->device, &iface_index,
sc->sc_xfer, ucycom_config, UCYCOM_ENDPT_MAX,
sc, &Giant);
if (error) {
==== //depot/projects/usb/src/sys/dev/usb/udbp.c#22 (text+ko) ====
@@ -338,9 +338,8 @@
mtx_init(&(sc->sc_mtx), "udbp lock", NULL, MTX_DEF | MTX_RECURSE);
- error = usbd_transfer_setup(uaa->device, uaa->iface_index,
- sc->sc_xfer, udbp_config, UDBP_T_MAX,
- sc, &(sc->sc_mtx));
+ error = usbd_transfer_setup(uaa->device, &(uaa->iface_index),
+ sc->sc_xfer, udbp_config, UDBP_T_MAX, sc, &(sc->sc_mtx));
if (error) {
DPRINTF(sc, 0, "error=%s\n", usbd_errstr(error));
goto detach;
==== //depot/projects/usb/src/sys/dev/usb/ufoma.c#36 (text+ko) ====
@@ -401,10 +401,9 @@
sc->sc_ctrl_iface_no = id->bInterfaceNumber;
sc->sc_ctrl_iface_index = uaa->iface_index;
- error = usbd_transfer_setup
- (uaa->device, sc->sc_ctrl_iface_index,
- sc->sc_ctrl_xfer, ufoma_ctrl_config, UFOMA_CTRL_ENDPT_MAX,
- sc, &Giant);
+ error = usbd_transfer_setup(uaa->device,
+ &(sc->sc_ctrl_iface_index), sc->sc_ctrl_xfer,
+ ufoma_ctrl_config, UFOMA_CTRL_ENDPT_MAX, sc, &Giant);
if (error) {
device_printf(dev, "allocating control USB "
@@ -1113,10 +1112,9 @@
}
}
- error = usbd_transfer_setup
- (uaa->device, sc->sc_data_iface_index,
- sc->sc_bulk_xfer, ufoma_bulk_config, UFOMA_BULK_ENDPT_MAX,
- sc, &Giant);
+ error = usbd_transfer_setup(uaa->device,
+ &(sc->sc_data_iface_index), sc->sc_bulk_xfer,
+ ufoma_bulk_config, UFOMA_BULK_ENDPT_MAX, sc, &Giant);
if (error) {
device_printf(dev, "allocating BULK USB "
==== //depot/projects/usb/src/sys/dev/usb/uftdi.c#31 (text+ko) ====
@@ -413,9 +413,10 @@
goto detach;
}
- error = usbd_transfer_setup(uaa->device, sc->sc_iface_index,
- sc->sc_xfer, uftdi_config, UFTDI_ENDPT_MAX,
- sc, &Giant);
+ error = usbd_transfer_setup(uaa->device,
+ &(sc->sc_iface_index), sc->sc_xfer, uftdi_config,
+ UFTDI_ENDPT_MAX, sc, &Giant);
+
if (error) {
device_printf(dev, "allocating USB "
"transfers failed!\n");
==== //depot/projects/usb/src/sys/dev/usb/ugen.c#33 (text+ko) ====
@@ -363,7 +363,7 @@
}
static usbd_status_t
-__usbd_transfer_setup(struct ugen_softc *sc,
+ugen_transfer_setup(struct ugen_softc *sc,
struct ugen_endpoint *sce,
uint16_t context_bit,
struct usbd_device *udev,
@@ -390,9 +390,8 @@
* "usbd_transfer_setup()" can sleep so one needs to make a wrapper,
* exiting the mutex and checking things
*/
- error = usbd_transfer_setup(udev, iface_index, &temp[0],
- setup, n_setup,
- sce, &(sc->sc_mtx));
+ error = usbd_transfer_setup(udev, &iface_index, &temp[0],
+ setup, n_setup, sce, &(sc->sc_mtx));
if (error == 0) {
if (n_in_frames > 0) {
error = ugen_allocate_blocks
@@ -619,7 +618,7 @@
case UE_BULK:
usbd_config[0].bufsize = UGEN_BULK_BUFFER_SIZE;
- if (__usbd_transfer_setup
+ if (ugen_transfer_setup
(sc, sce, UGEN_WR_CFG,
sc->sc_udev, sce->pipe_out->iface_index,
&sce->xfer_out[0], &usbd_config[0], 2, 0, 0)) {
@@ -646,7 +645,7 @@
/* clone configuration */
usbd_config[1] = usbd_config[0];
- err = __usbd_transfer_setup
+ err = ugen_transfer_setup
(sc, sce, UGEN_WR_CFG,
sc->sc_udev, sce->pipe_out->iface_index,
sce->xfer_out, usbd_config, 2,
@@ -705,7 +704,7 @@
usbd_config[0].interval = USBD_DEFAULT_INTERVAL;
usbd_config[0].timeout = 0;
- if (__usbd_transfer_setup
+ if (ugen_transfer_setup
(sc, sce, UGEN_RD_CFG,
sc->sc_udev, sce->pipe_in->iface_index,
&sce->xfer_in[0], &usbd_config[0], 2, 1, 0)) {
@@ -725,7 +724,7 @@
usbd_config[0].cb[USB_MODE_HOST] = &ugen_default_read_callback;
usbd_config[0].bufsize = UGEN_BULK_BUFFER_SIZE;
- if (__usbd_transfer_setup
+ if (ugen_transfer_setup
(sc, sce, UGEN_RD_CFG,
sc->sc_udev, sce->pipe_in->iface_index,
&sce->xfer_in[0], &usbd_config[0], 2, 0, 0)) {
@@ -758,7 +757,7 @@
/* clone configuration */
usbd_config[1] = usbd_config[0];
- err = __usbd_transfer_setup
+ err = ugen_transfer_setup
(sc, sce, UGEN_RD_CFG,
sc->sc_udev, sce->pipe_in->iface_index,
sce->xfer_in, usbd_config, 2,
==== //depot/projects/usb/src/sys/dev/usb/ugensa.c#18 (text+ko) ====
@@ -203,6 +203,7 @@
struct ugensa_sub_softc *ssc;
int32_t error;
uint8_t x;
+ uint8_t iface_index;
if (sc == NULL) {
return (ENOMEM);
@@ -239,10 +240,10 @@
ssc->sc_ucom_ptr = sc->sc_ucom + x;
- error = usbd_transfer_setup
- (uaa->device, UGENSA_IFACE_INDEX + x,
- ssc->sc_xfer, ugensa_xfer_config, UGENSA_N_TRANSFER,
- ssc, &Giant);
+ iface_index = (UGENSA_IFACE_INDEX + x);
+ error = usbd_transfer_setup(uaa->device,
+ &iface_index, ssc->sc_xfer, ugensa_xfer_config,
+ UGENSA_N_TRANSFER, ssc, &Giant);
if (error) {
device_printf(dev, "allocating USB "
==== //depot/projects/usb/src/sys/dev/usb/uhid.c#28 (text+ko) ====
@@ -608,9 +608,10 @@
sc->sc_iface_no = uaa->iface->idesc->bInterfaceNumber;
- error = usbd_transfer_setup(uaa->device, uaa->iface_index,
- sc->sc_xfer, uhid_config, UHID_N_TRANSFER,
- sc, &(sc->sc_mtx));
+ error = usbd_transfer_setup(uaa->device,
+ &(uaa->iface_index), sc->sc_xfer, uhid_config,
+ UHID_N_TRANSFER, sc, &(sc->sc_mtx));
+
if (error) {
DPRINTF(0, "error=%s\n", usbd_errstr(error));
goto detach;
==== //depot/projects/usb/src/sys/dev/usb/uhub.c#29 (text+ko) ====
@@ -548,6 +548,7 @@
uint8_t nports;
uint8_t portno;
uint8_t removable;
+ uint8_t iface_index;
usbd_status_t err;
if (sc == NULL) {
@@ -647,7 +648,8 @@
}
/* set up interrupt pipe */
- err = usbd_transfer_setup(udev, 0, sc->sc_xfer,
+ iface_index = 0;
+ err = usbd_transfer_setup(udev, &iface_index, sc->sc_xfer,
uhub_config, 2, sc, &usb_global_lock);
if (err) {
DPRINTF(sc, -1, "cannot setup interrupt transfer, "
==== //depot/projects/usb/src/sys/dev/usb/uipaq.c#19 (text+ko) ====
@@ -214,6 +214,7 @@
struct usb_attach_arg *uaa = device_get_ivars(dev);
struct uipaq_softc *sc = device_get_softc(dev);
int error;
+ uint8_t iface_index;
if (sc == NULL) {
return (ENOMEM);
@@ -229,10 +230,11 @@
"number failed!\n");
goto detach;
}
- error = usbd_transfer_setup(uaa->device, UIPAQ_IFACE_INDEX,
+ iface_index = UIPAQ_IFACE_INDEX;
+ error = usbd_transfer_setup(uaa->device, &iface_index,
sc->sc_xfer_data, uipaq_config_data,
- UIPAQ_N_DATA_TRANSFER,
- sc, &Giant);
+ UIPAQ_N_DATA_TRANSFER, sc, &Giant);
+
if (error) {
goto detach;
}
==== //depot/projects/usb/src/sys/dev/usb/ukbd.c#37 (text+ko) ====
@@ -649,9 +649,10 @@
usb_callout_init_mtx(&(sc->sc_callout), &Giant,
CALLOUT_RETURNUNLOCKED);
- err = usbd_transfer_setup(uaa->device, uaa->iface_index, sc->sc_xfer,
- ukbd_config, UKBD_N_TRANSFER, sc,
- &Giant);
+ err = usbd_transfer_setup(uaa->device,
+ &(uaa->iface_index), sc->sc_xfer, ukbd_config,
+ UKBD_N_TRANSFER, sc, &Giant);
+
if (err) {
DPRINTF(0, "error=%s\n", usbd_errstr(err));
goto detach;
==== //depot/projects/usb/src/sys/dev/usb/ulpt.c#37 (text+ko) ====
@@ -510,12 +510,12 @@
struct usbd_interface *iface_ptr = uaa->iface;
usb_interface_descriptor_t *id;
const char *p_buf[3];
- int32_t iface_index = uaa->iface_index;
int32_t iface_alt_index = 0;
int32_t unit = device_get_unit(dev);
int32_t error;
char buf_1[16];
char buf_2[16];
+ uint8_t iface_index = uaa->iface_index;
DPRINTF(10, "sc=%p\n", sc);
@@ -566,7 +566,7 @@
}
sc->sc_iface_no = id->bInterfaceNumber;
- error = usbd_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) {
==== //depot/projects/usb/src/sys/dev/usb/umass.c#40 (text+ko) ====
@@ -1528,19 +1528,17 @@
if (sc->sc_proto & UMASS_PROTO_BBB) {
- err = usbd_transfer_setup
- (uaa->device, uaa->iface_index, sc->sc_xfer,
- umass_bbb_config, UMASS_T_BBB_MAX, sc,
- &(sc->sc_mtx));
+ err = usbd_transfer_setup(uaa->device,
+ &(uaa->iface_index), sc->sc_xfer, umass_bbb_config,
+ UMASS_T_BBB_MAX, sc, &(sc->sc_mtx));
/* skip reset first time */
sc->sc_last_xfer_index = UMASS_T_BBB_COMMAND;
} else if (sc->sc_proto & (UMASS_PROTO_CBI | UMASS_PROTO_CBI_I)) {
- err = usbd_transfer_setup
- (uaa->device, uaa->iface_index, sc->sc_xfer,
- umass_cbi_config,
+ err = usbd_transfer_setup(uaa->device,
+ &(uaa->iface_index), sc->sc_xfer, umass_cbi_config,
(sc->sc_proto & UMASS_PROTO_CBI_I) ?
UMASS_T_CBI_MAX : (UMASS_T_CBI_MAX - 2), sc,
&(sc->sc_mtx));
==== //depot/projects/usb/src/sys/dev/usb/umct.c#28 (text+ko) ====
@@ -145,7 +145,7 @@
.flags = {.pipe_bof = 1,.short_xfer_ok = 1,},
.bufsize = 0, /* use wMaxPacketSize */
.cb[USB_MODE_HOST] = &umct_read_callback,
- .index = 0, /* first interrupt endpoint */
+ .ep_index = 0, /* first interrupt endpoint */
},
[2] = {
@@ -177,7 +177,7 @@
.flags = {.pipe_bof = 1,.short_xfer_ok = 1,},
.bufsize = 0, /* use wMaxPacketSize */
.cb[USB_MODE_HOST] = &umct_intr_callback,
- .index = 1, /* second interrupt endpoint */
+ .ep_index = 1, /* second interrupt endpoint */
},
[5] = {
@@ -268,6 +268,7 @@
usb_interface_descriptor_t *id;
int32_t error;
uint16_t maxp;
+ uint8_t iface_index;
if (sc == NULL) {
return (ENOMEM);
@@ -298,9 +299,10 @@
}
sc->sc_iface_no = id->bInterfaceNumber;
- error = usbd_transfer_setup(uaa->device, UMCT_IFACE_INDEX,
- sc->sc_xfer, umct_config, UMCT_ENDPT_MAX,
- sc, &Giant);
+ iface_index = UMCT_IFACE_INDEX;
+ error = usbd_transfer_setup(uaa->device, &iface_index,
+ sc->sc_xfer, umct_config, UMCT_ENDPT_MAX, sc, &Giant);
+
if (error) {
device_printf(dev, "allocating USB "
"transfers failed!\n");
==== //depot/projects/usb/src/sys/dev/usb/umodem.c#38 (text+ko) ====
@@ -405,17 +405,18 @@
}
sc->sc_cm_over_data = 1;
}
- error = usbd_transfer_setup(uaa->device, sc->sc_data_iface_index,
- sc->sc_xfer_data, umodem_config_data,
- UMODEM_N_DATA_TRANSFER,
+ error = usbd_transfer_setup(uaa->device,
+ &(sc->sc_data_iface_index), sc->sc_xfer_data,
+ umodem_config_data, UMODEM_N_DATA_TRANSFER,
sc, &Giant);
if (error) {
goto detach;
}
- error = usbd_transfer_setup(uaa->device, sc->sc_ctrl_iface_index,
- sc->sc_xfer_intr, umodem_config_intr,
- UMODEM_N_INTR_TRANSFER,
+ error = usbd_transfer_setup(uaa->device,
+ &(sc->sc_ctrl_iface_index), sc->sc_xfer_intr,
+ umodem_config_intr, UMODEM_N_INTR_TRANSFER,
sc, &Giant);
+
if (error == 0) {
device_printf(dev, "status change "
"notification available\n");
==== //depot/projects/usb/src/sys/dev/usb/umoscom.c#14 (text+ko) ====
@@ -321,6 +321,7 @@
struct usb_attach_arg *uaa = device_get_ivars(dev);
struct umoscom_softc *sc = device_get_softc(dev);
int error;
+ uint8_t iface_index;
if (sc == NULL) {
return (ENOMEM);
@@ -336,10 +337,11 @@
if (error) {
goto detach;
}
- error = usbd_transfer_setup(uaa->device, UMOSCOM_IFACE_NO,
+ iface_index = UMOSCOM_IFACE_NO;
+ error = usbd_transfer_setup(uaa->device, &iface_index,
sc->sc_xfer_data, umoscom_config_data,
- UMOSCOM_N_DATA_TRANSFER,
- sc, &Giant);
+ UMOSCOM_N_DATA_TRANSFER, sc, &Giant);
+
if (error) {
goto detach;
}
==== //depot/projects/usb/src/sys/dev/usb/ums.c#36 (text+ko) ====
@@ -410,9 +410,10 @@
*/
err = usbreq_set_protocol(uaa->device, NULL, uaa->iface_index, 1);
- err = usbd_transfer_setup(uaa->device, uaa->iface_index, sc->sc_xfer,
- ums_config, UMS_N_TRANSFER, sc,
- &(sc->sc_mtx));
+ err = usbd_transfer_setup(uaa->device,
+ &(uaa->iface_index), sc->sc_xfer, ums_config,
+ UMS_N_TRANSFER, sc, &(sc->sc_mtx));
+
if (err) {
DPRINTF(0, "error=%s\n", usbd_errstr(err));
goto detach;
==== //depot/projects/usb/src/sys/dev/usb/uplcom.c#35 (text+ko) ====
@@ -452,19 +452,20 @@
sc->sc_data_iface_index = sc->sc_ctrl_iface_index;
}
- error = usbd_transfer_setup(uaa->device, sc->sc_data_iface_index,
- sc->sc_xfer_data, uplcom_config_data,
- UPLCOM_N_DATA_TRANSFER,
+ error = usbd_transfer_setup(uaa->device,
+ &(sc->sc_data_iface_index), sc->sc_xfer_data,
+ uplcom_config_data, UPLCOM_N_DATA_TRANSFER,
sc, &Giant);
+
if (error) {
DPRINTF(0, "one or more missing data "
"pipes, error=%s\n", usbd_errstr(error));
goto detach;
}
- error = usbd_transfer_setup(uaa->device, sc->sc_ctrl_iface_index,
- sc->sc_xfer_intr, uplcom_config_intr,
- UPLCOM_N_INTR_TRANSFER,
- sc, &Giant);
+ error = usbd_transfer_setup(uaa->device,
+ &(sc->sc_ctrl_iface_index), sc->sc_xfer_intr,
+ uplcom_config_intr, UPLCOM_N_INTR_TRANSFER, sc, &Giant);
+
if (error) {
DPRINTF(0, "no interrupt pipe, error=%s\n",
usbd_errstr(error));
==== //depot/projects/usb/src/sys/dev/usb/urio.c#22 (text+ko) ====
@@ -237,9 +237,10 @@
snprintf(sc->sc_name, sizeof(sc->sc_name),
"%s", device_get_nameunit(dev));
- error = usbd_transfer_setup(uaa->device, uaa->iface_index,
- sc->sc_xfer, urio_config, URIO_T_MAX,
- sc, &(sc->sc_mtx));
+ error = usbd_transfer_setup(uaa->device,
+ &(uaa->iface_index), sc->sc_xfer,
+ urio_config, URIO_T_MAX, sc, &(sc->sc_mtx));
+
if (error) {
DPRINTF(sc, 0, "error=%s\n", usbd_errstr(error));
goto detach;
==== //depot/projects/usb/src/sys/dev/usb/usb.c#28 (text+ko) ====
@@ -435,7 +435,6 @@
}
}
}
-
usb_post_init_called = 1;
/* explore all USB busses in parallell */
==== //depot/projects/usb/src/sys/dev/usb/usb_compat_linux.c#19 (text+ko) ====
@@ -780,7 +780,7 @@
/* Allocate and setup two generic FreeBSD USB transfers */
- if (usbd_transfer_setup(dev->bsd_udev, uhe->bsd_iface_index,
+ if (usbd_transfer_setup(dev->bsd_udev, &(uhe->bsd_iface_index),
uhe->bsd_xfer, cfg, 2, uhe, &usb_global_lock)) {
return -EINVAL;
}
@@ -800,7 +800,7 @@
cfg[0].flags.proxy_buffer = 1;
cfg[0].flags.short_xfer_ok = 1;
- if (usbd_transfer_setup(dev->bsd_udev, uhe->bsd_iface_index,
+ if (usbd_transfer_setup(dev->bsd_udev, &(uhe->bsd_iface_index),
uhe->bsd_xfer, cfg, 1, uhe, &usb_global_lock)) {
return -EINVAL;
}
==== //depot/projects/usb/src/sys/dev/usb/usb_subr.h#83 (text+ko) ====
@@ -552,7 +552,8 @@
uint8_t type; /* pipe type */
uint8_t endpoint; /* pipe number */
uint8_t direction; /* pipe direction */
- uint8_t index; /* pipe index match to use */
+ uint8_t ep_index; /* pipe index match to use */
+ uint8_t if_index; /* "ifaces" index to use */
};
struct usbd_xfer {
@@ -919,7 +920,7 @@
struct usbd_pipe *usbd_get_pipe(struct usbd_device *udev, uint8_t iface_index, const struct usbd_config *setup);
usbd_status_t usbd_interface_count(struct usbd_device *udev, uint8_t *count);
void usbd_transfer_setup_sub(struct usbd_setup_params *parm);
-usbd_status_t usbd_transfer_setup(struct usbd_device *udev, uint8_t iface_index, struct usbd_xfer **pxfer, const struct usbd_config *setup_start, uint16_t n_setup, void *priv_sc, struct mtx *priv_mtx);
+usbd_status_t usbd_transfer_setup(struct usbd_device *udev, const uint8_t *ifaces, struct usbd_xfer **pxfer, const struct usbd_config *setup_start, uint16_t n_setup, void *priv_sc, struct mtx *priv_mtx);
void usbd_transfer_unsetup(struct usbd_xfer **pxfer, uint16_t n_setup);
void usbd_std_root_transfer(struct usbd_std_root_transfer *std, usbd_std_root_transfer_func_t *func);
void usbd_start_hardware(struct usbd_xfer *xfer);
==== //depot/projects/usb/src/sys/dev/usb/usb_transfer.c#81 (text+ko) ====
@@ -206,7 +206,7 @@
{
struct usbd_pipe *pipe = udev->pipes;
struct usbd_pipe *pipe_end = udev->pipes_end;
- uint8_t index = setup->index;
+ uint8_t index = setup->ep_index;
uint8_t ea_mask;
uint8_t ea_val;
uint8_t type_mask;
@@ -215,7 +215,7 @@
PRINTFN(8, ("udev=%p iface_index=%d address=0x%x "
"type=0x%x dir=0x%x index=%d\n",
udev, iface_index, setup->endpoint,
- setup->type, setup->direction, setup->index));
+ setup->type, setup->direction, setup->ep_index));
/* setup expected endpoint direction mask and value */
@@ -746,15 +746,13 @@
* usbd_transfer_setup - setup an array of USB transfers
*
* NOTE: must always call unsetup after setup
- * NOTE: the parameter "iface_index" is ignored in
- * case of control pipes
*
* The idea is that the USB device driver should pre-allocate all
* its transfers by one call to this function.
*------------------------------------------------------------------------*/
usbd_status_t
usbd_transfer_setup(struct usbd_device *udev,
- uint8_t iface_index, struct usbd_xfer **ppxfer,
+ const uint8_t *ifaces, struct usbd_xfer **ppxfer,
const struct usbd_config *setup_start, uint16_t n_setup,
void *priv_sc, struct mtx *priv_mtx)
{
@@ -781,6 +779,10 @@
PRINTFN(5, ("setup array has zero length!\n"));
return (USBD_INVAL);
}
+ if (ifaces == 0) {
+ PRINTFN(5, ("ifaces array is NULL!\n"));
+ return (USBD_INVAL);
+ }
if (priv_mtx == NULL) {
PRINTFN(5, ("using global lock\n"));
priv_mtx = &usb_global_lock;
@@ -864,7 +866,9 @@
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list