svn commit: r187259 - in head/sys/dev/usb2: bluetooth ethernet
image input serial wlan
Andrew Thompson
thompsa at FreeBSD.org
Wed Jan 14 18:35:42 PST 2009
Author: thompsa
Date: Thu Jan 15 02:35:40 2009
New Revision: 187259
URL: http://svn.freebsd.org/changeset/base/187259
Log:
Name the items in the xfer arrays so they can be identified throughout the
code.
Modified:
head/sys/dev/usb2/bluetooth/ubtbcmfw2.c
head/sys/dev/usb2/ethernet/if_aue2.c
head/sys/dev/usb2/ethernet/if_auereg.h
head/sys/dev/usb2/ethernet/if_axe2.c
head/sys/dev/usb2/ethernet/if_axereg.h
head/sys/dev/usb2/ethernet/if_cdce2.c
head/sys/dev/usb2/ethernet/if_cdcereg.h
head/sys/dev/usb2/ethernet/if_cue2.c
head/sys/dev/usb2/ethernet/if_cuereg.h
head/sys/dev/usb2/ethernet/if_kue2.c
head/sys/dev/usb2/ethernet/if_kuereg.h
head/sys/dev/usb2/ethernet/if_rue2.c
head/sys/dev/usb2/ethernet/if_ruereg.h
head/sys/dev/usb2/ethernet/if_udav2.c
head/sys/dev/usb2/ethernet/if_udavreg.h
head/sys/dev/usb2/image/uscanner2.c
head/sys/dev/usb2/input/uhid2.c
head/sys/dev/usb2/input/ukbd2.c
head/sys/dev/usb2/input/ums2.c
head/sys/dev/usb2/serial/u3g2.c
head/sys/dev/usb2/serial/uark2.c
head/sys/dev/usb2/serial/ubsa2.c
head/sys/dev/usb2/serial/ubser2.c
head/sys/dev/usb2/serial/uchcom2.c
head/sys/dev/usb2/serial/ucycom2.c
head/sys/dev/usb2/serial/uftdi2.c
head/sys/dev/usb2/serial/ugensa2.c
head/sys/dev/usb2/serial/uipaq2.c
head/sys/dev/usb2/serial/ulpt2.c
head/sys/dev/usb2/serial/umct2.c
head/sys/dev/usb2/serial/umoscom2.c
head/sys/dev/usb2/serial/uplcom2.c
head/sys/dev/usb2/serial/uvisor2.c
head/sys/dev/usb2/serial/uvscom2.c
head/sys/dev/usb2/wlan/if_rum2.c
head/sys/dev/usb2/wlan/if_rumvar.h
head/sys/dev/usb2/wlan/if_ural2.c
head/sys/dev/usb2/wlan/if_uralvar.h
head/sys/dev/usb2/wlan/if_zyd2.c
head/sys/dev/usb2/wlan/if_zydreg.h
Modified: head/sys/dev/usb2/bluetooth/ubtbcmfw2.c
==============================================================================
--- head/sys/dev/usb2/bluetooth/ubtbcmfw2.c Thu Jan 15 02:11:43 2009 (r187258)
+++ head/sys/dev/usb2/bluetooth/ubtbcmfw2.c Thu Jan 15 02:35:40 2009 (r187259)
@@ -56,13 +56,21 @@
#define UBTBCMFW_IFACE_IDX 0 /* Control interface */
#define UBTBCMFW_T_MAX 4 /* units */
+enum {
+ UBTBCMFW_BULK_DT_WR,
+ UBTBCMFW_BULK_DT_RD,
+ UBTBCMFW_BULK_CS_WR,
+ UBTBCMFW_BULK_CS_RD,
+ UBTBCMFW_N_TRANSFER = 4,
+};
+
struct ubtbcmfw_softc {
struct usb2_fifo_sc sc_fifo;
struct mtx sc_mtx;
device_t sc_dev;
struct usb2_device *sc_udev;
- struct usb2_xfer *sc_xfer[UBTBCMFW_T_MAX];
+ struct usb2_xfer *sc_xfer[UBTBCMFW_N_TRANSFER];
uint8_t sc_flags;
#define UBTBCMFW_FLAG_WRITE_STALL 0x01
@@ -109,7 +117,7 @@ static struct usb2_fifo_methods ubtbcmfw
static const struct usb2_config ubtbcmfw_config[UBTBCMFW_T_MAX] = {
- [0] = {
+ [UBTBCMFW_BULK_DT_WR] = {
.type = UE_BULK,
.endpoint = 0x02, /* fixed */
.direction = UE_DIR_OUT,
@@ -118,7 +126,7 @@ static const struct usb2_config ubtbcmfw
.mh.callback = &ubtbcmfw_write_callback,
},
- [1] = {
+ [UBTBCMFW_BULK_DT_RD] = {
.type = UE_INTERRUPT,
.endpoint = 0x01, /* fixed */
.direction = UE_DIR_IN,
@@ -127,7 +135,7 @@ static const struct usb2_config ubtbcmfw
.mh.callback = &ubtbcmfw_read_callback,
},
- [2] = {
+ [UBTBCMFW_BULK_CS_WR] = {
.type = UE_CONTROL,
.endpoint = 0x00, /* Control pipe */
.direction = UE_DIR_ANY,
@@ -138,7 +146,7 @@ static const struct usb2_config ubtbcmfw
.mh.interval = 50, /* 50ms */
},
- [3] = {
+ [UBTBCMFW_BULK_CS_RD] = {
.type = UE_CONTROL,
.endpoint = 0x00, /* Control pipe */
.direction = UE_DIR_ANY,
@@ -273,7 +281,7 @@ ubtbcmfw_write_callback(struct usb2_xfer
case USB_ST_TRANSFERRED:
case USB_ST_SETUP:
if (sc->sc_flags & UBTBCMFW_FLAG_WRITE_STALL) {
- usb2_transfer_start(sc->sc_xfer[2]);
+ usb2_transfer_start(sc->sc_xfer[UBTBCMFW_BULK_CS_WR]);
return;
}
if (usb2_fifo_get_data(f, xfer->frbuffers, 0,
@@ -288,7 +296,7 @@ ubtbcmfw_write_callback(struct usb2_xfer
if (xfer->error != USB_ERR_CANCELLED) {
/* try to clear stall first */
sc->sc_flags |= UBTBCMFW_FLAG_WRITE_STALL;
- usb2_transfer_start(sc->sc_xfer[2]);
+ usb2_transfer_start(sc->sc_xfer[UBTBCMFW_BULK_CS_WR]);
}
return;
}
@@ -298,7 +306,7 @@ static void
ubtbcmfw_write_clear_stall_callback(struct usb2_xfer *xfer)
{
struct ubtbcmfw_softc *sc = xfer->priv_sc;
- struct usb2_xfer *xfer_other = sc->sc_xfer[0];
+ struct usb2_xfer *xfer_other = sc->sc_xfer[UBTBCMFW_BULK_DT_WR];
if (usb2_clear_stall_callback(xfer, xfer_other)) {
DPRINTF("stall cleared\n");
@@ -320,7 +328,7 @@ ubtbcmfw_read_callback(struct usb2_xfer
case USB_ST_SETUP:
if (sc->sc_flags & UBTBCMFW_FLAG_READ_STALL) {
- usb2_transfer_start(sc->sc_xfer[3]);
+ usb2_transfer_start(sc->sc_xfer[UBTBCMFW_BULK_CS_RD]);
return;
}
if (usb2_fifo_put_bytes_max(f) != 0) {
@@ -333,7 +341,7 @@ ubtbcmfw_read_callback(struct usb2_xfer
if (xfer->error != USB_ERR_CANCELLED) {
/* try to clear stall first */
sc->sc_flags |= UBTBCMFW_FLAG_READ_STALL;
- usb2_transfer_start(sc->sc_xfer[3]);
+ usb2_transfer_start(sc->sc_xfer[UBTBCMFW_BULK_CS_RD]);
}
return;
}
@@ -343,7 +351,7 @@ static void
ubtbcmfw_read_clear_stall_callback(struct usb2_xfer *xfer)
{
struct ubtbcmfw_softc *sc = xfer->priv_sc;
- struct usb2_xfer *xfer_other = sc->sc_xfer[1];
+ struct usb2_xfer *xfer_other = sc->sc_xfer[UBTBCMFW_BULK_DT_RD];
if (usb2_clear_stall_callback(xfer, xfer_other)) {
DPRINTF("stall cleared\n");
@@ -357,7 +365,7 @@ ubtbcmfw_start_read(struct usb2_fifo *fi
{
struct ubtbcmfw_softc *sc = fifo->priv_sc0;
- usb2_transfer_start(sc->sc_xfer[1]);
+ usb2_transfer_start(sc->sc_xfer[UBTBCMFW_BULK_DT_RD]);
}
static void
@@ -365,8 +373,8 @@ ubtbcmfw_stop_read(struct usb2_fifo *fif
{
struct ubtbcmfw_softc *sc = fifo->priv_sc0;
- usb2_transfer_stop(sc->sc_xfer[3]);
- usb2_transfer_stop(sc->sc_xfer[1]);
+ usb2_transfer_stop(sc->sc_xfer[UBTBCMFW_BULK_CS_RD]);
+ usb2_transfer_stop(sc->sc_xfer[UBTBCMFW_BULK_DT_RD]);
}
static void
@@ -374,7 +382,7 @@ ubtbcmfw_start_write(struct usb2_fifo *f
{
struct ubtbcmfw_softc *sc = fifo->priv_sc0;
- usb2_transfer_start(sc->sc_xfer[0]);
+ usb2_transfer_start(sc->sc_xfer[UBTBCMFW_BULK_DT_WR]);
}
static void
@@ -382,8 +390,8 @@ ubtbcmfw_stop_write(struct usb2_fifo *fi
{
struct ubtbcmfw_softc *sc = fifo->priv_sc0;
- usb2_transfer_stop(sc->sc_xfer[2]);
- usb2_transfer_stop(sc->sc_xfer[0]);
+ usb2_transfer_stop(sc->sc_xfer[UBTBCMFW_BULK_CS_WR]);
+ usb2_transfer_stop(sc->sc_xfer[UBTBCMFW_BULK_DT_WR]);
}
static int
@@ -393,7 +401,7 @@ ubtbcmfw_open(struct usb2_fifo *fifo, in
if (fflags & FREAD) {
if (usb2_fifo_alloc_buffer(fifo,
- sc->sc_xfer[1]->max_data_length,
+ sc->sc_xfer[UBTBCMFW_BULK_DT_RD]->max_data_length,
UBTBCMFW_IFQ_MAXLEN)) {
return (ENOMEM);
}
@@ -404,7 +412,7 @@ ubtbcmfw_open(struct usb2_fifo *fifo, in
sc->sc_flags |= UBTBCMFW_FLAG_WRITE_STALL;
mtx_unlock(&sc->sc_mtx);
if (usb2_fifo_alloc_buffer(fifo,
- sc->sc_xfer[0]->max_data_length,
+ sc->sc_xfer[UBTBCMFW_BULK_DT_WR]->max_data_length,
UBTBCMFW_IFQ_MAXLEN)) {
return (ENOMEM);
}
Modified: head/sys/dev/usb2/ethernet/if_aue2.c
==============================================================================
--- head/sys/dev/usb2/ethernet/if_aue2.c Thu Jan 15 02:11:43 2009 (r187258)
+++ head/sys/dev/usb2/ethernet/if_aue2.c Thu Jan 15 02:35:40 2009 (r187259)
@@ -225,9 +225,9 @@ static void aue_ifmedia_sts_cb(struct if
static int aue_ioctl_cb(struct ifnet *, u_long, caddr_t);
static void aue_watchdog(void *);
-static const struct usb2_config aue_config[AUE_ENDPT_MAX] = {
+static const struct usb2_config aue_config[AUE_N_TRANSFER] = {
- [0] = {
+ [AUE_BULK_DT_WR] = {
.type = UE_BULK,
.endpoint = UE_ADDR_ANY,
.direction = UE_DIR_OUT,
@@ -237,7 +237,7 @@ static const struct usb2_config aue_conf
.mh.timeout = 10000, /* 10 seconds */
},
- [1] = {
+ [AUE_BULK_DT_RD] = {
.type = UE_BULK,
.endpoint = UE_ADDR_ANY,
.direction = UE_DIR_IN,
@@ -246,7 +246,7 @@ static const struct usb2_config aue_conf
.mh.callback = &aue_bulk_read_callback,
},
- [2] = {
+ [AUE_BULK_CS_WR] = {
.type = UE_CONTROL,
.endpoint = 0x00, /* Control pipe */
.direction = UE_DIR_ANY,
@@ -257,7 +257,7 @@ static const struct usb2_config aue_conf
.mh.interval = 50, /* 50ms */
},
- [3] = {
+ [AUE_BULK_CS_RD] = {
.type = UE_CONTROL,
.endpoint = 0x00, /* Control pipe */
.direction = UE_DIR_ANY,
@@ -268,7 +268,7 @@ static const struct usb2_config aue_conf
.mh.interval = 50, /* 50ms */
},
- [4] = {
+ [AUE_INTR_DT_RD] = {
.type = UE_INTERRUPT,
.endpoint = UE_ADDR_ANY,
.direction = UE_DIR_IN,
@@ -277,7 +277,7 @@ static const struct usb2_config aue_conf
.mh.callback = &aue_intr_callback,
},
- [5] = {
+ [AUE_INTR_CS_RD] = {
.type = UE_CONTROL,
.endpoint = 0x00, /* Control pipe */
.direction = UE_DIR_ANY,
@@ -774,7 +774,7 @@ aue_attach(device_t dev)
iface_index = AUE_IFACE_IDX;
error = usb2_transfer_setup(uaa->device, &iface_index,
- sc->sc_xfer, aue_config, AUE_ENDPT_MAX,
+ sc->sc_xfer, aue_config, AUE_N_TRANSFER,
sc, &sc->sc_mtx);
if (error) {
device_printf(dev, "allocating USB "
@@ -917,7 +917,7 @@ aue_detach(device_t dev)
mtx_unlock(&sc->sc_mtx);
/* stop all USB transfers first */
- usb2_transfer_unsetup(sc->sc_xfer, AUE_ENDPT_MAX);
+ usb2_transfer_unsetup(sc->sc_xfer, AUE_N_TRANSFER);
/* get rid of any late children */
bus_generic_detach(dev);
@@ -939,7 +939,7 @@ static void
aue_intr_clear_stall_callback(struct usb2_xfer *xfer)
{
struct aue_softc *sc = xfer->priv_sc;
- struct usb2_xfer *xfer_other = sc->sc_xfer[4];
+ struct usb2_xfer *xfer_other = sc->sc_xfer[AUE_INTR_DT_RD];
if (usb2_clear_stall_callback(xfer, xfer_other)) {
DPRINTF("stall cleared\n");
@@ -973,7 +973,7 @@ aue_intr_callback(struct usb2_xfer *xfer
}
case USB_ST_SETUP:
if (sc->sc_flags & AUE_FLAG_INTR_STALL) {
- usb2_transfer_start(sc->sc_xfer[5]);
+ usb2_transfer_start(sc->sc_xfer[AUE_INTR_CS_RD]);
} else {
xfer->frlengths[0] = xfer->max_data_length;
usb2_start_hardware(xfer);
@@ -984,7 +984,7 @@ aue_intr_callback(struct usb2_xfer *xfer
if (xfer->error != USB_ERR_CANCELLED) {
/* start clear stall */
sc->sc_flags |= AUE_FLAG_INTR_STALL;
- usb2_transfer_start(sc->sc_xfer[5]);
+ usb2_transfer_start(sc->sc_xfer[AUE_INTR_CS_RD]);
}
return;
}
@@ -994,7 +994,7 @@ static void
aue_bulk_read_clear_stall_callback(struct usb2_xfer *xfer)
{
struct aue_softc *sc = xfer->priv_sc;
- struct usb2_xfer *xfer_other = sc->sc_xfer[1];
+ struct usb2_xfer *xfer_other = sc->sc_xfer[AUE_BULK_DT_RD];
if (usb2_clear_stall_callback(xfer, xfer_other)) {
DPRINTF("stall cleared\n");
@@ -1061,7 +1061,7 @@ aue_bulk_read_callback(struct usb2_xfer
tr_setup:
if (sc->sc_flags & AUE_FLAG_READ_STALL) {
- usb2_transfer_start(sc->sc_xfer[3]);
+ usb2_transfer_start(sc->sc_xfer[AUE_BULK_CS_RD]);
} else {
xfer->frlengths[0] = xfer->max_data_length;
usb2_start_hardware(xfer);
@@ -1083,7 +1083,7 @@ tr_setup:
if (xfer->error != USB_ERR_CANCELLED) {
/* try to clear stall first */
sc->sc_flags |= AUE_FLAG_READ_STALL;
- usb2_transfer_start(sc->sc_xfer[3]);
+ usb2_transfer_start(sc->sc_xfer[AUE_BULK_CS_RD]);
}
DPRINTF("bulk read error, %s\n",
usb2_errstr(xfer->error));
@@ -1096,7 +1096,7 @@ static void
aue_bulk_write_clear_stall_callback(struct usb2_xfer *xfer)
{
struct aue_softc *sc = xfer->priv_sc;
- struct usb2_xfer *xfer_other = sc->sc_xfer[0];
+ struct usb2_xfer *xfer_other = sc->sc_xfer[AUE_BULK_DT_WR];
if (usb2_clear_stall_callback(xfer, xfer_other)) {
DPRINTF("stall cleared\n");
@@ -1122,7 +1122,7 @@ aue_bulk_write_callback(struct usb2_xfer
case USB_ST_SETUP:
if (sc->sc_flags & AUE_FLAG_WRITE_STALL) {
- usb2_transfer_start(sc->sc_xfer[2]);
+ usb2_transfer_start(sc->sc_xfer[AUE_BULK_CS_WR]);
goto done;
}
if (sc->sc_flags & AUE_FLAG_WAIT_LINK) {
@@ -1185,7 +1185,7 @@ done:
if (xfer->error != USB_ERR_CANCELLED) {
/* try to clear stall first */
sc->sc_flags |= AUE_FLAG_WRITE_STALL;
- usb2_transfer_start(sc->sc_xfer[2]);
+ usb2_transfer_start(sc->sc_xfer[AUE_BULK_CS_WR]);
}
ifp->if_oerrors++;
return;
@@ -1274,9 +1274,9 @@ aue_start_transfers(struct aue_softc *sc
/*
* start the USB transfers, if not already started:
*/
- usb2_transfer_start(sc->sc_xfer[4]);
- usb2_transfer_start(sc->sc_xfer[1]);
- usb2_transfer_start(sc->sc_xfer[0]);
+ 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]);
}
}
@@ -1504,12 +1504,12 @@ aue_cfg_pre_stop(struct aue_softc *sc,
/*
* stop all the transfers, if not already stopped:
*/
- usb2_transfer_stop(sc->sc_xfer[0]);
- usb2_transfer_stop(sc->sc_xfer[1]);
- usb2_transfer_stop(sc->sc_xfer[2]);
- usb2_transfer_stop(sc->sc_xfer[3]);
- usb2_transfer_stop(sc->sc_xfer[4]);
- usb2_transfer_stop(sc->sc_xfer[5]);
+ 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_BULK_CS_WR]);
+ usb2_transfer_stop(sc->sc_xfer[AUE_BULK_CS_RD]);
+ usb2_transfer_stop(sc->sc_xfer[AUE_INTR_DT_RD]);
+ usb2_transfer_stop(sc->sc_xfer[AUE_INTR_CS_RD]);
}
static void
Modified: head/sys/dev/usb2/ethernet/if_auereg.h
==============================================================================
--- head/sys/dev/usb2/ethernet/if_auereg.h Thu Jan 15 02:11:43 2009 (r187258)
+++ head/sys/dev/usb2/ethernet/if_auereg.h Thu Jan 15 02:35:40 2009 (r187259)
@@ -60,7 +60,15 @@
* don't match those in the ADMtek Pegasus manual: we consider the RX data
* endpoint to be index 0 and work up from there.
*/
-#define AUE_ENDPT_MAX 6
+enum {
+ AUE_BULK_DT_WR,
+ AUE_BULK_DT_RD,
+ AUE_BULK_CS_WR,
+ AUE_BULK_CS_RD,
+ AUE_INTR_DT_RD,
+ AUE_INTR_CS_RD,
+ AUE_N_TRANSFER = 6,
+};
#define AUE_INTR_PKTLEN 0x8
@@ -196,7 +204,6 @@ struct aue_rxpkt {
uint8_t aue_rxstat;
} __packed;
-
struct aue_softc {
void *sc_evilhack; /* XXX this pointer must be first */
@@ -207,7 +214,7 @@ struct aue_softc {
struct ifnet *sc_ifp;
struct usb2_device *sc_udev;
- struct usb2_xfer *sc_xfer[AUE_ENDPT_MAX];
+ struct usb2_xfer *sc_xfer[AUE_N_TRANSFER];
device_t sc_miibus;
device_t sc_dev;
Modified: head/sys/dev/usb2/ethernet/if_axe2.c
==============================================================================
--- head/sys/dev/usb2/ethernet/if_axe2.c Thu Jan 15 02:11:43 2009 (r187258)
+++ head/sys/dev/usb2/ethernet/if_axe2.c Thu Jan 15 02:35:40 2009 (r187259)
@@ -188,9 +188,9 @@ static void axe_cfg_ax88178_init(struct
static void axe_cfg_ax88772_init(struct axe_softc *);
static int axe_get_phyno(struct axe_softc *, int);
-static const struct usb2_config axe_config[AXE_ENDPT_MAX] = {
+static const struct usb2_config axe_config[AXE_N_TRANSFER] = {
- [0] = {
+ [AXE_BULK_DT_WR] = {
.type = UE_BULK,
.endpoint = UE_ADDR_ANY,
.direction = UE_DIR_OUT,
@@ -200,7 +200,7 @@ static const struct usb2_config axe_conf
.mh.timeout = 10000, /* 10 seconds */
},
- [1] = {
+ [AXE_BULK_DT_RD] = {
.type = UE_BULK,
.endpoint = UE_ADDR_ANY,
.direction = UE_DIR_IN,
@@ -213,7 +213,7 @@ static const struct usb2_config axe_conf
.mh.timeout = 0, /* no timeout */
},
- [2] = {
+ [AXE_BULK_CS_WR] = {
.type = UE_CONTROL,
.endpoint = 0x00, /* Control pipe */
.direction = UE_DIR_ANY,
@@ -224,7 +224,7 @@ static const struct usb2_config axe_conf
.mh.interval = 50, /* 50ms */
},
- [3] = {
+ [AXE_BULK_CS_RD] = {
.type = UE_CONTROL,
.endpoint = 0x00, /* Control pipe */
.direction = UE_DIR_ANY,
@@ -235,7 +235,7 @@ static const struct usb2_config axe_conf
.mh.interval = 50, /* 50ms */
},
- [4] = {
+ [AXE_INTR_DT_RD] = {
.type = UE_INTERRUPT,
.endpoint = UE_ADDR_ANY,
.direction = UE_DIR_IN,
@@ -244,7 +244,7 @@ static const struct usb2_config axe_conf
.mh.callback = &axe_intr_callback,
},
- [5] = {
+ [AXE_INTR_CS_RD] = {
.type = UE_CONTROL,
.endpoint = 0x00, /* Control pipe */
.direction = UE_DIR_ANY,
@@ -648,7 +648,7 @@ axe_attach(device_t dev)
iface_index = AXE_IFACE_IDX;
error = usb2_transfer_setup(uaa->device, &iface_index,
- sc->sc_xfer, axe_config, AXE_ENDPT_MAX,
+ sc->sc_xfer, axe_config, AXE_N_TRANSFER,
sc, &sc->sc_mtx);
if (error) {
device_printf(dev, "allocating USB "
@@ -913,7 +913,7 @@ axe_detach(device_t dev)
mtx_unlock(&sc->sc_mtx);
/* stop all USB transfers first */
- usb2_transfer_unsetup(sc->sc_xfer, AXE_ENDPT_MAX);
+ usb2_transfer_unsetup(sc->sc_xfer, AXE_N_TRANSFER);
/* get rid of any late children */
bus_generic_detach(dev);
@@ -935,7 +935,7 @@ static void
axe_intr_clear_stall_callback(struct usb2_xfer *xfer)
{
struct axe_softc *sc = xfer->priv_sc;
- struct usb2_xfer *xfer_other = sc->sc_xfer[4];
+ struct usb2_xfer *xfer_other = sc->sc_xfer[AXE_INTR_DT_RD];
if (usb2_clear_stall_callback(xfer, xfer_other)) {
DPRINTF("stall cleared\n");
@@ -956,7 +956,7 @@ axe_intr_callback(struct usb2_xfer *xfer
case USB_ST_SETUP:
if (sc->sc_flags & AXE_FLAG_INTR_STALL) {
- usb2_transfer_start(sc->sc_xfer[5]);
+ usb2_transfer_start(sc->sc_xfer[AXE_INTR_CS_RD]);
} else {
xfer->frlengths[0] = xfer->max_data_length;
usb2_start_hardware(xfer);
@@ -967,7 +967,7 @@ axe_intr_callback(struct usb2_xfer *xfer
if (xfer->error != USB_ERR_CANCELLED) {
/* start clear stall */
sc->sc_flags |= AXE_FLAG_INTR_STALL;
- usb2_transfer_start(sc->sc_xfer[5]);
+ usb2_transfer_start(sc->sc_xfer[AXE_INTR_CS_RD]);
}
return;
}
@@ -977,7 +977,7 @@ static void
axe_bulk_read_clear_stall_callback(struct usb2_xfer *xfer)
{
struct axe_softc *sc = xfer->priv_sc;
- struct usb2_xfer *xfer_other = sc->sc_xfer[1];
+ struct usb2_xfer *xfer_other = sc->sc_xfer[AXE_BULK_DT_RD];
if (usb2_clear_stall_callback(xfer, xfer_other)) {
DPRINTF("stall cleared\n");
@@ -1083,7 +1083,7 @@ axe_bulk_read_callback(struct usb2_xfer
tr_setup:
if (sc->sc_flags & AXE_FLAG_READ_STALL) {
- usb2_transfer_start(sc->sc_xfer[3]);
+ usb2_transfer_start(sc->sc_xfer[AXE_BULK_CS_RD]);
} else {
xfer->frlengths[0] = xfer->max_data_length;
usb2_start_hardware(xfer);
@@ -1116,7 +1116,7 @@ tr_setup:
if (xfer->error != USB_ERR_CANCELLED) {
/* try to clear stall first */
sc->sc_flags |= AXE_FLAG_READ_STALL;
- usb2_transfer_start(sc->sc_xfer[3]);
+ usb2_transfer_start(sc->sc_xfer[AXE_BULK_CS_RD]);
}
DPRINTF("bulk read error, %s\n",
usb2_errstr(xfer->error));
@@ -1129,7 +1129,7 @@ static void
axe_bulk_write_clear_stall_callback(struct usb2_xfer *xfer)
{
struct axe_softc *sc = xfer->priv_sc;
- struct usb2_xfer *xfer_other = sc->sc_xfer[0];
+ struct usb2_xfer *xfer_other = sc->sc_xfer[AXE_BULK_DT_WR];
if (usb2_clear_stall_callback(xfer, xfer_other)) {
DPRINTF("stall cleared\n");
@@ -1160,7 +1160,7 @@ axe_bulk_write_callback(struct usb2_xfer
case USB_ST_SETUP:
if (sc->sc_flags & AXE_FLAG_WRITE_STALL) {
- usb2_transfer_start(sc->sc_xfer[2]);
+ usb2_transfer_start(sc->sc_xfer[AXE_BULK_CS_WR]);
goto done;
}
if ((sc->sc_flags & AXE_FLAG_LINK) == 0) {
@@ -1238,7 +1238,7 @@ done:
if (xfer->error != USB_ERR_CANCELLED) {
/* try to clear stall first */
sc->sc_flags |= AXE_FLAG_WRITE_STALL;
- usb2_transfer_start(sc->sc_xfer[2]);
+ usb2_transfer_start(sc->sc_xfer[AXE_BULK_CS_WR]);
}
ifp->if_oerrors++;
return;
@@ -1294,9 +1294,9 @@ axe_start_transfers(struct axe_softc *sc
/*
* start the USB transfers, if not already started:
*/
- usb2_transfer_start(sc->sc_xfer[4]);
- usb2_transfer_start(sc->sc_xfer[1]);
- usb2_transfer_start(sc->sc_xfer[0]);
+ 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]);
}
}
@@ -1502,12 +1502,12 @@ axe_cfg_pre_stop(struct axe_softc *sc,
/*
* stop all the transfers, if not already stopped:
*/
- usb2_transfer_stop(sc->sc_xfer[0]);
- usb2_transfer_stop(sc->sc_xfer[1]);
- usb2_transfer_stop(sc->sc_xfer[2]);
- usb2_transfer_stop(sc->sc_xfer[3]);
- usb2_transfer_stop(sc->sc_xfer[4]);
- usb2_transfer_stop(sc->sc_xfer[5]);
+ 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_BULK_CS_WR]);
+ usb2_transfer_stop(sc->sc_xfer[AXE_BULK_CS_RD]);
+ usb2_transfer_stop(sc->sc_xfer[AXE_INTR_DT_RD]);
+ usb2_transfer_stop(sc->sc_xfer[AXE_INTR_CS_RD]);
}
static void
Modified: head/sys/dev/usb2/ethernet/if_axereg.h
==============================================================================
--- head/sys/dev/usb2/ethernet/if_axereg.h Thu Jan 15 02:11:43 2009 (r187258)
+++ head/sys/dev/usb2/ethernet/if_axereg.h Thu Jan 15 02:35:40 2009 (r187259)
@@ -161,9 +161,6 @@
#define AXE_CONFIG_IDX 0 /* config number 1 */
#define AXE_IFACE_IDX 0
-/* The interrupt endpoint is currently unused by the ASIX part. */
-#define AXE_ENDPT_MAX 6
-
struct axe_sframe_hdr {
uint16_t len;
uint16_t ilen;
@@ -172,6 +169,17 @@ struct axe_sframe_hdr {
#define GET_MII(sc) ((sc)->sc_miibus ? \
device_get_softc((sc)->sc_miibus) : NULL)
+/* The interrupt endpoint is currently unused by the ASIX part. */
+enum {
+ AXE_BULK_DT_WR,
+ AXE_BULK_DT_RD,
+ AXE_BULK_CS_WR,
+ AXE_BULK_CS_RD,
+ AXE_INTR_DT_RD,
+ AXE_INTR_CS_RD,
+ AXE_N_TRANSFER = 6,
+};
+
struct axe_softc {
void *sc_evilhack; /* XXX this pointer must be first */
@@ -181,7 +189,7 @@ struct axe_softc {
struct ifnet *sc_ifp;
struct usb2_device *sc_udev;
- struct usb2_xfer *sc_xfer[AXE_ENDPT_MAX];
+ struct usb2_xfer *sc_xfer[AXE_N_TRANSFER];
device_t sc_miibus;
device_t sc_dev;
Modified: head/sys/dev/usb2/ethernet/if_cdce2.c
==============================================================================
--- head/sys/dev/usb2/ethernet/if_cdce2.c Thu Jan 15 02:11:43 2009 (r187258)
+++ head/sys/dev/usb2/ethernet/if_cdce2.c Thu Jan 15 02:35:40 2009 (r187259)
@@ -103,7 +103,7 @@ SYSCTL_INT(_hw_usb2_cdce, OID_AUTO, forc
static const struct usb2_config cdce_config[CDCE_N_TRANSFER] = {
- [0] = {
+ [CDCE_BULK_A] = {
.type = UE_BULK,
.endpoint = UE_ADDR_ANY,
.direction = UE_DIR_OUT,
@@ -122,7 +122,7 @@ static const struct usb2_config cdce_con
.md.timeout = 0, /* no timeout */
},
- [1] = {
+ [CDCE_BULK_B] = {
.type = UE_BULK,
.endpoint = UE_ADDR_ANY,
.direction = UE_DIR_IN,
@@ -141,7 +141,7 @@ static const struct usb2_config cdce_con
.md.timeout = 10000, /* 10 seconds */
},
- [2] = {
+ [CDCE_INTR] = {
.type = UE_INTERRUPT,
.endpoint = UE_ADDR_ANY,
.direction = UE_DIR_IN,
@@ -474,7 +474,7 @@ alloc_transfers:
/* start the interrupt transfer, if any */
mtx_lock(&sc->sc_mtx);
- usb2_transfer_start(sc->sc_xfer[2]);
+ usb2_transfer_start(sc->sc_xfer[CDCE_INTR]);
mtx_unlock(&sc->sc_mtx);
return (0); /* success */
@@ -535,8 +535,8 @@ cdce_start_transfers(struct cdce_softc *
/*
* start the USB transfers, if not already started:
*/
- usb2_transfer_start(sc->sc_xfer[1]);
- usb2_transfer_start(sc->sc_xfer[0]);
+ usb2_transfer_start(sc->sc_xfer[CDCE_BULK_B]);
+ usb2_transfer_start(sc->sc_xfer[CDCE_BULK_A]);
}
}
@@ -853,8 +853,8 @@ cdce_stop(struct cdce_softc *sc)
/*
* stop all the transfers, if not already stopped:
*/
- usb2_transfer_stop(sc->sc_xfer[0]);
- usb2_transfer_stop(sc->sc_xfer[1]);
+ usb2_transfer_stop(sc->sc_xfer[CDCE_BULK_A]);
+ usb2_transfer_stop(sc->sc_xfer[CDCE_BULK_B]);
}
static int
@@ -939,8 +939,8 @@ cdce_init_cb(void *arg)
CDCE_FLAG_LL_READY |
CDCE_FLAG_HL_READY);
- usb2_transfer_set_stall(sc->sc_xfer[0]);
- usb2_transfer_set_stall(sc->sc_xfer[1]);
+ usb2_transfer_set_stall(sc->sc_xfer[CDCE_BULK_A]);
+ usb2_transfer_set_stall(sc->sc_xfer[CDCE_BULK_B]);
cdce_start_transfers(sc);
Modified: head/sys/dev/usb2/ethernet/if_cdcereg.h
==============================================================================
--- head/sys/dev/usb2/ethernet/if_cdcereg.h Thu Jan 15 02:11:43 2009 (r187258)
+++ head/sys/dev/usb2/ethernet/if_cdcereg.h Thu Jan 15 02:35:40 2009 (r187259)
@@ -35,7 +35,6 @@
#ifndef _USB_IF_CDCEREG_H_
#define _USB_IF_CDCEREG_H_
-#define CDCE_N_TRANSFER 3 /* units */
#define CDCE_IND_SIZE_MAX 32 /* bytes */
#define CDCE_512X4_IFQ_MAXLEN MAX((2*CDCE_512X4_FRAMES_MAX), IFQ_MAXLEN)
@@ -54,6 +53,13 @@ struct cdce_mq { /* mini-queue */
uint16_t ifq_len;
};
+enum {
+ CDCE_BULK_A,
+ CDCE_BULK_B,
+ CDCE_INTR,
+ CDCE_N_TRANSFER = 3,
+};
+
struct cdce_softc {
void *sc_evilhack; /* XXX this pointer must be first */
Modified: head/sys/dev/usb2/ethernet/if_cue2.c
==============================================================================
--- head/sys/dev/usb2/ethernet/if_cue2.c Thu Jan 15 02:11:43 2009 (r187258)
+++ head/sys/dev/usb2/ethernet/if_cue2.c Thu Jan 15 02:35:40 2009 (r187259)
@@ -135,9 +135,9 @@ SYSCTL_INT(_hw_usb2_cue, OID_AUTO, debug
"Debug level");
#endif
-static const struct usb2_config cue_config[CUE_ENDPT_MAX] = {
+static const struct usb2_config cue_config[CUE_N_TRANSFER] = {
- [0] = {
+ [CUE_BULK_DT_WR] = {
.type = UE_BULK,
.endpoint = UE_ADDR_ANY,
.direction = UE_DIR_OUT,
@@ -147,7 +147,7 @@ static const struct usb2_config cue_conf
.mh.timeout = 10000, /* 10 seconds */
},
- [1] = {
+ [CUE_BULK_DT_RD] = {
.type = UE_BULK,
.endpoint = UE_ADDR_ANY,
.direction = UE_DIR_IN,
@@ -156,7 +156,7 @@ static const struct usb2_config cue_conf
.mh.callback = &cue_bulk_read_callback,
},
- [2] = {
+ [CUE_BULK_CS_WR] = {
.type = UE_CONTROL,
.endpoint = 0x00, /* Control pipe */
.direction = UE_DIR_ANY,
@@ -167,7 +167,7 @@ static const struct usb2_config cue_conf
.mh.interval = 50, /* 50ms */
},
- [3] = {
+ [CUE_BULK_CS_RD] = {
.type = UE_CONTROL,
.endpoint = 0x00, /* Control pipe */
.direction = UE_DIR_ANY,
@@ -412,7 +412,7 @@ cue_attach(device_t dev)
iface_index = CUE_IFACE_IDX;
error = usb2_transfer_setup(uaa->device, &iface_index,
- sc->sc_xfer, cue_config, CUE_ENDPT_MAX, sc, &sc->sc_mtx);
+ sc->sc_xfer, cue_config, CUE_N_TRANSFER, sc, &sc->sc_mtx);
if (error) {
device_printf(dev, "allocating USB "
"transfers failed!\n");
@@ -514,7 +514,7 @@ cue_detach(device_t dev)
mtx_unlock(&sc->sc_mtx);
/* stop all USB transfers first */
- usb2_transfer_unsetup(sc->sc_xfer, CUE_ENDPT_MAX);
+ usb2_transfer_unsetup(sc->sc_xfer, CUE_N_TRANSFER);
/* get rid of any late children */
bus_generic_detach(dev);
@@ -536,7 +536,7 @@ static void
cue_bulk_read_clear_stall_callback(struct usb2_xfer *xfer)
{
struct cue_softc *sc = xfer->priv_sc;
- struct usb2_xfer *xfer_other = sc->sc_xfer[1];
+ struct usb2_xfer *xfer_other = sc->sc_xfer[CUE_BULK_DT_RD];
if (usb2_clear_stall_callback(xfer, xfer_other)) {
DPRINTF("stall cleared\n");
@@ -586,7 +586,7 @@ cue_bulk_read_callback(struct usb2_xfer
tr_setup:
if (sc->sc_flags & CUE_FLAG_READ_STALL) {
- usb2_transfer_start(sc->sc_xfer[3]);
+ usb2_transfer_start(sc->sc_xfer[CUE_BULK_CS_RD]);
} else {
xfer->frlengths[0] = xfer->max_data_length;
usb2_start_hardware(xfer);
@@ -608,7 +608,7 @@ tr_setup:
if (xfer->error != USB_ERR_CANCELLED) {
/* try to clear stall first */
sc->sc_flags |= CUE_FLAG_READ_STALL;
- usb2_transfer_start(sc->sc_xfer[3]);
+ usb2_transfer_start(sc->sc_xfer[CUE_BULK_CS_RD]);
}
DPRINTF("bulk read error, %s\n",
usb2_errstr(xfer->error));
@@ -660,8 +660,8 @@ cue_start_transfers(struct cue_softc *sc
/*
* start the USB transfers, if not already started:
*/
- usb2_transfer_start(sc->sc_xfer[1]);
- usb2_transfer_start(sc->sc_xfer[0]);
+ usb2_transfer_start(sc->sc_xfer[CUE_BULK_DT_RD]);
+ usb2_transfer_start(sc->sc_xfer[CUE_BULK_DT_WR]);
}
}
@@ -669,7 +669,7 @@ static void
cue_bulk_write_clear_stall_callback(struct usb2_xfer *xfer)
{
struct cue_softc *sc = xfer->priv_sc;
- struct usb2_xfer *xfer_other = sc->sc_xfer[0];
+ struct usb2_xfer *xfer_other = sc->sc_xfer[CUE_BULK_DT_WR];
if (usb2_clear_stall_callback(xfer, xfer_other)) {
DPRINTF("stall cleared\n");
@@ -695,7 +695,7 @@ cue_bulk_write_callback(struct usb2_xfer
case USB_ST_SETUP:
if (sc->sc_flags & CUE_FLAG_WRITE_STALL) {
- usb2_transfer_start(sc->sc_xfer[2]);
+ usb2_transfer_start(sc->sc_xfer[CUE_BULK_CS_WR]);
goto done;
}
IFQ_DRV_DEQUEUE(&ifp->if_snd, m);
@@ -738,7 +738,7 @@ done:
if (xfer->error != USB_ERR_CANCELLED) {
/* try to clear stall first */
sc->sc_flags |= CUE_FLAG_WRITE_STALL;
- usb2_transfer_start(sc->sc_xfer[2]);
+ usb2_transfer_start(sc->sc_xfer[CUE_BULK_CS_WR]);
}
ifp->if_oerrors++;
return;
@@ -904,10 +904,10 @@ cue_cfg_pre_stop(struct cue_softc *sc,
/*
* stop all the transfers, if not already stopped:
*/
- usb2_transfer_stop(sc->sc_xfer[0]);
- usb2_transfer_stop(sc->sc_xfer[1]);
- usb2_transfer_stop(sc->sc_xfer[2]);
- usb2_transfer_stop(sc->sc_xfer[3]);
+ usb2_transfer_stop(sc->sc_xfer[CUE_BULK_DT_WR]);
+ usb2_transfer_stop(sc->sc_xfer[CUE_BULK_DT_RD]);
+ usb2_transfer_stop(sc->sc_xfer[CUE_BULK_CS_WR]);
+ usb2_transfer_stop(sc->sc_xfer[CUE_BULK_CS_RD]);
}
static void
Modified: head/sys/dev/usb2/ethernet/if_cuereg.h
==============================================================================
--- head/sys/dev/usb2/ethernet/if_cuereg.h Thu Jan 15 02:11:43 2009 (r187258)
+++ head/sys/dev/usb2/ethernet/if_cuereg.h Thu Jan 15 02:35:40 2009 (r187259)
@@ -113,7 +113,13 @@
#define CUE_IFACE_IDX 0
/* The interrupt endpoint is currently unused by the KLSI part. */
-#define CUE_ENDPT_MAX 4
+enum {
+ CUE_BULK_DT_WR,
+ CUE_BULK_DT_RD,
+ CUE_BULK_CS_WR,
+ CUE_BULK_CS_RD,
+ CUE_N_TRANSFER = 4,
+};
struct cue_softc {
void *sc_evilhack; /* XXX this pointer must be first */
@@ -125,7 +131,7 @@ struct cue_softc {
struct ifnet *sc_ifp;
device_t sc_dev;
struct usb2_device *sc_udev;
- struct usb2_xfer *sc_xfer[CUE_ENDPT_MAX];
+ struct usb2_xfer *sc_xfer[CUE_N_TRANSFER];
uint32_t sc_unit;
Modified: head/sys/dev/usb2/ethernet/if_kue2.c
==============================================================================
--- head/sys/dev/usb2/ethernet/if_kue2.c Thu Jan 15 02:11:43 2009 (r187258)
+++ head/sys/dev/usb2/ethernet/if_kue2.c Thu Jan 15 02:35:40 2009 (r187259)
@@ -175,9 +175,9 @@ SYSCTL_INT(_hw_usb2_kue, OID_AUTO, debug
"Debug level");
#endif
-static const struct usb2_config kue_config[KUE_ENDPT_MAX] = {
+static const struct usb2_config kue_config[KUE_N_TRANSFER] = {
- [0] = {
+ [KUE_BULK_DT_WR] = {
.type = UE_BULK,
.endpoint = UE_ADDR_ANY,
.direction = UE_DIR_OUT,
@@ -187,7 +187,7 @@ static const struct usb2_config kue_conf
.mh.timeout = 10000, /* 10 seconds */
},
- [1] = {
+ [KUE_BULK_DT_RD] = {
.type = UE_BULK,
.endpoint = UE_ADDR_ANY,
.direction = UE_DIR_IN,
@@ -197,7 +197,7 @@ static const struct usb2_config kue_conf
.mh.timeout = 0, /* no timeout */
},
- [2] = {
+ [KUE_BULK_CS_WR] = {
.type = UE_CONTROL,
.endpoint = 0x00, /* Control pipe */
.direction = UE_DIR_ANY,
@@ -208,7 +208,7 @@ static const struct usb2_config kue_conf
.mh.interval = 50, /* 50ms */
},
- [3] = {
+ [KUE_BULK_CS_RD] = {
.type = UE_CONTROL,
.endpoint = 0x00, /* Control pipe */
.direction = UE_DIR_ANY,
@@ -474,7 +474,7 @@ kue_attach(device_t dev)
iface_index = KUE_IFACE_IDX;
error = usb2_transfer_setup(uaa->device, &iface_index,
- sc->sc_xfer, kue_config, KUE_ENDPT_MAX, sc, &sc->sc_mtx);
+ sc->sc_xfer, kue_config, KUE_N_TRANSFER, sc, &sc->sc_mtx);
if (error) {
device_printf(dev, "allocating USB "
"transfers failed!\n");
@@ -581,7 +581,7 @@ kue_detach(device_t dev)
mtx_unlock(&sc->sc_mtx);
/* stop all USB transfers first */
- usb2_transfer_unsetup(sc->sc_xfer, KUE_ENDPT_MAX);
+ usb2_transfer_unsetup(sc->sc_xfer, KUE_N_TRANSFER);
/* get rid of any late children */
bus_generic_detach(dev);
@@ -607,7 +607,7 @@ static void
kue_bulk_read_clear_stall_callback(struct usb2_xfer *xfer)
{
struct kue_softc *sc = xfer->priv_sc;
- struct usb2_xfer *xfer_other = sc->sc_xfer[1];
+ struct usb2_xfer *xfer_other = sc->sc_xfer[KUE_BULK_DT_RD];
if (usb2_clear_stall_callback(xfer, xfer_other)) {
DPRINTF("stall cleared\n");
@@ -657,7 +657,7 @@ kue_bulk_read_callback(struct usb2_xfer
tr_setup:
if (sc->sc_flags & KUE_FLAG_READ_STALL) {
- usb2_transfer_start(sc->sc_xfer[3]);
+ usb2_transfer_start(sc->sc_xfer[KUE_BULK_CS_RD]);
} else {
xfer->frlengths[0] = xfer->max_data_length;
usb2_start_hardware(xfer);
@@ -679,7 +679,7 @@ tr_setup:
if (xfer->error != USB_ERR_CANCELLED) {
/* try to clear stall first */
sc->sc_flags |= KUE_FLAG_READ_STALL;
- usb2_transfer_start(sc->sc_xfer[3]);
+ usb2_transfer_start(sc->sc_xfer[KUE_BULK_CS_RD]);
}
DPRINTF("bulk read error, %s\n",
usb2_errstr(xfer->error));
@@ -692,7 +692,7 @@ static void
kue_bulk_write_clear_stall_callback(struct usb2_xfer *xfer)
{
struct kue_softc *sc = xfer->priv_sc;
- struct usb2_xfer *xfer_other = sc->sc_xfer[0];
+ struct usb2_xfer *xfer_other = sc->sc_xfer[KUE_BULK_DT_WR];
if (usb2_clear_stall_callback(xfer, xfer_other)) {
DPRINTF("stall cleared\n");
@@ -720,7 +720,7 @@ kue_bulk_write_callback(struct usb2_xfer
case USB_ST_SETUP:
if (sc->sc_flags & KUE_FLAG_WRITE_STALL) {
- usb2_transfer_start(sc->sc_xfer[2]);
+ usb2_transfer_start(sc->sc_xfer[KUE_BULK_CS_WR]);
goto done;
}
IFQ_DRV_DEQUEUE(&ifp->if_snd, m);
@@ -769,7 +769,7 @@ done:
if (xfer->error != USB_ERR_CANCELLED) {
/* try to clear stall first */
sc->sc_flags |= KUE_FLAG_WRITE_STALL;
- usb2_transfer_start(sc->sc_xfer[2]);
+ usb2_transfer_start(sc->sc_xfer[KUE_BULK_CS_WR]);
}
ifp->if_oerrors++;
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-all
mailing list