Name the items in the xfer arrays so they can be identified throughout the
code.
This commit is contained in:
parent
19af62e535
commit
c352721890
@ -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_fifo_methods = {
|
||||
|
||||
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_config[UBTBCMFW_T_MAX] = {
|
||||
.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_config[UBTBCMFW_T_MAX] = {
|
||||
.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_config[UBTBCMFW_T_MAX] = {
|
||||
.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 *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 *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 *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 *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 *fifo)
|
||||
{
|
||||
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 *fifo)
|
||||
{
|
||||
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 *fifo)
|
||||
{
|
||||
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 *fifo)
|
||||
{
|
||||
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, int fflags, struct thread *td)
|
||||
|
||||
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, int fflags, struct thread *td)
|
||||
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);
|
||||
}
|
||||
|
@ -225,9 +225,9 @@ static void aue_ifmedia_sts_cb(struct ifnet *, struct ifmediareq *);
|
||||
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_config[AUE_ENDPT_MAX] = {
|
||||
.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_config[AUE_ENDPT_MAX] = {
|
||||
.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_config[AUE_ENDPT_MAX] = {
|
||||
.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_config[AUE_ENDPT_MAX] = {
|
||||
.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_config[AUE_ENDPT_MAX] = {
|
||||
.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 *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 @@ aue_bulk_read_callback(struct usb2_xfer *xfer)
|
||||
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 *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 @@ aue_bulk_write_callback(struct usb2_xfer *xfer)
|
||||
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
|
||||
|
@ -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;
|
||||
|
||||
|
@ -188,9 +188,9 @@ static void axe_cfg_ax88178_init(struct axe_softc *);
|
||||
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_config[AXE_ENDPT_MAX] = {
|
||||
.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_config[AXE_ENDPT_MAX] = {
|
||||
.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_config[AXE_ENDPT_MAX] = {
|
||||
.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_config[AXE_ENDPT_MAX] = {
|
||||
.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_config[AXE_ENDPT_MAX] = {
|
||||
.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 *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 @@ axe_bulk_read_callback(struct usb2_xfer *xfer)
|
||||
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 *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 @@ axe_bulk_write_callback(struct usb2_xfer *xfer)
|
||||
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
|
||||
|
@ -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;
|
||||
|
||||
|
@ -103,7 +103,7 @@ SYSCTL_INT(_hw_usb2_cdce, OID_AUTO, force_512x4, CTLFLAG_RW,
|
||||
|
||||
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_config[CDCE_N_TRANSFER] = {
|
||||
.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_config[CDCE_N_TRANSFER] = {
|
||||
.md.timeout = 10000, /* 10 seconds */
|
||||
},
|
||||
|
||||
[2] = {
|
||||
[CDCE_INTR] = {
|
||||
.type = UE_INTERRUPT,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_IN,
|
||||
@ -474,7 +474,7 @@ cdce_attach(device_t dev)
|
||||
|
||||
/* 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 *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[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);
|
||||
|
||||
|
@ -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 */
|
||||
|
||||
|
@ -135,9 +135,9 @@ SYSCTL_INT(_hw_usb2_cue, OID_AUTO, debug, CTLFLAG_RW, &cue_debug, 0,
|
||||
"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_config[CUE_ENDPT_MAX] = {
|
||||
.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_config[CUE_ENDPT_MAX] = {
|
||||
.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_config[CUE_ENDPT_MAX] = {
|
||||
.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 *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 @@ cue_bulk_read_callback(struct usb2_xfer *xfer)
|
||||
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 *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 @@ cue_bulk_write_callback(struct usb2_xfer *xfer)
|
||||
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
|
||||
|
@ -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;
|
||||
|
||||
|
@ -175,9 +175,9 @@ SYSCTL_INT(_hw_usb2_kue, OID_AUTO, debug, CTLFLAG_RW, &kue_debug, 0,
|
||||
"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_config[KUE_ENDPT_MAX] = {
|
||||
.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_config[KUE_ENDPT_MAX] = {
|
||||
.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_config[KUE_ENDPT_MAX] = {
|
||||
.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 *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 @@ kue_bulk_read_callback(struct usb2_xfer *xfer)
|
||||
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 *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 @@ kue_bulk_write_callback(struct usb2_xfer *xfer)
|
||||
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++;
|
||||
return;
|
||||
@ -798,8 +798,8 @@ kue_start_transfers(struct kue_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[KUE_BULK_DT_RD]);
|
||||
usb2_transfer_start(sc->sc_xfer[KUE_BULK_DT_WR]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -956,10 +956,10 @@ kue_cfg_pre_stop(struct kue_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[KUE_BULK_DT_WR]);
|
||||
usb2_transfer_stop(sc->sc_xfer[KUE_BULK_DT_RD]);
|
||||
usb2_transfer_stop(sc->sc_xfer[KUE_BULK_CS_WR]);
|
||||
usb2_transfer_stop(sc->sc_xfer[KUE_BULK_CS_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -116,6 +116,13 @@ struct kue_ether_desc {
|
||||
|
||||
/* The interrupt endpoint is currently unused by the KLSI part. */
|
||||
#define KUE_ENDPT_MAX 4
|
||||
enum {
|
||||
KUE_BULK_DT_WR,
|
||||
KUE_BULK_DT_RD,
|
||||
KUE_BULK_CS_WR,
|
||||
KUE_BULK_CS_RD,
|
||||
KUE_N_TRANSFER = 4,
|
||||
};
|
||||
|
||||
struct kue_softc {
|
||||
void *sc_evilhack; /* XXX this pointer must be first */
|
||||
@ -128,7 +135,7 @@ struct kue_softc {
|
||||
struct ifnet *sc_ifp;
|
||||
device_t sc_dev;
|
||||
struct usb2_device *sc_udev;
|
||||
struct usb2_xfer *sc_xfer[KUE_ENDPT_MAX];
|
||||
struct usb2_xfer *sc_xfer[KUE_N_TRANSFER];
|
||||
|
||||
uint32_t sc_unit;
|
||||
|
||||
|
@ -155,9 +155,9 @@ static void rue_ifmedia_sts_cb(struct ifnet *ifp, struct ifmediareq *ifmr);
|
||||
static int rue_ioctl_cb(struct ifnet *ifp, u_long command, caddr_t data);
|
||||
static void rue_watchdog(void *arg);
|
||||
|
||||
static const struct usb2_config rue_config[RUE_ENDPT_MAX] = {
|
||||
static const struct usb2_config rue_config[RUE_N_TRANSFER] = {
|
||||
|
||||
[0] = {
|
||||
[RUE_BULK_DT_WR] = {
|
||||
.type = UE_BULK,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_OUT,
|
||||
@ -167,7 +167,7 @@ static const struct usb2_config rue_config[RUE_ENDPT_MAX] = {
|
||||
.mh.timeout = 10000, /* 10 seconds */
|
||||
},
|
||||
|
||||
[1] = {
|
||||
[RUE_BULK_DT_RD] = {
|
||||
.type = UE_BULK,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_IN,
|
||||
@ -177,7 +177,7 @@ static const struct usb2_config rue_config[RUE_ENDPT_MAX] = {
|
||||
.mh.timeout = 0, /* no timeout */
|
||||
},
|
||||
|
||||
[2] = {
|
||||
[RUE_BULK_CS_WR] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -188,7 +188,7 @@ static const struct usb2_config rue_config[RUE_ENDPT_MAX] = {
|
||||
.mh.interval = 50, /* 50ms */
|
||||
},
|
||||
|
||||
[3] = {
|
||||
[RUE_BULK_CS_RD] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -199,7 +199,7 @@ static const struct usb2_config rue_config[RUE_ENDPT_MAX] = {
|
||||
.mh.interval = 50, /* 50ms */
|
||||
},
|
||||
|
||||
[4] = {
|
||||
[RUE_INTR_DT_RD] = {
|
||||
.type = UE_INTERRUPT,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_IN,
|
||||
@ -208,7 +208,7 @@ static const struct usb2_config rue_config[RUE_ENDPT_MAX] = {
|
||||
.mh.callback = &rue_intr_callback,
|
||||
},
|
||||
|
||||
[5] = {
|
||||
[RUE_INTR_CS_RD] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -655,7 +655,7 @@ rue_attach(device_t dev)
|
||||
|
||||
iface_index = RUE_IFACE_IDX;
|
||||
error = usb2_transfer_setup(uaa->device, &iface_index,
|
||||
sc->sc_xfer, rue_config, RUE_ENDPT_MAX,
|
||||
sc->sc_xfer, rue_config, RUE_N_TRANSFER,
|
||||
sc, &sc->sc_mtx);
|
||||
if (error) {
|
||||
device_printf(dev, "allocating USB "
|
||||
@ -784,7 +784,7 @@ rue_detach(device_t dev)
|
||||
mtx_unlock(&sc->sc_mtx);
|
||||
|
||||
/* stop all USB transfers first */
|
||||
usb2_transfer_unsetup(sc->sc_xfer, RUE_ENDPT_MAX);
|
||||
usb2_transfer_unsetup(sc->sc_xfer, RUE_N_TRANSFER);
|
||||
|
||||
/* get rid of any late children */
|
||||
bus_generic_detach(dev);
|
||||
@ -806,7 +806,7 @@ static void
|
||||
rue_intr_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct rue_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[4];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[RUE_INTR_DT_RD];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
@ -836,7 +836,7 @@ rue_intr_callback(struct usb2_xfer *xfer)
|
||||
}
|
||||
case USB_ST_SETUP:
|
||||
if (sc->sc_flags & RUE_FLAG_INTR_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer[5]);
|
||||
usb2_transfer_start(sc->sc_xfer[RUE_INTR_CS_RD]);
|
||||
} else {
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
@ -847,7 +847,7 @@ rue_intr_callback(struct usb2_xfer *xfer)
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
/* start clear stall */
|
||||
sc->sc_flags |= RUE_FLAG_INTR_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer[5]);
|
||||
usb2_transfer_start(sc->sc_xfer[RUE_INTR_CS_RD]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -857,7 +857,7 @@ static void
|
||||
rue_bulk_read_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct rue_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[1];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[RUE_BULK_DT_RD];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
@ -916,7 +916,7 @@ rue_bulk_read_callback(struct usb2_xfer *xfer)
|
||||
tr_setup:
|
||||
|
||||
if (sc->sc_flags & RUE_FLAG_READ_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer[3]);
|
||||
usb2_transfer_start(sc->sc_xfer[RUE_BULK_CS_RD]);
|
||||
} else {
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
@ -938,7 +938,7 @@ rue_bulk_read_callback(struct usb2_xfer *xfer)
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
/* try to clear stall first */
|
||||
sc->sc_flags |= RUE_FLAG_READ_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer[3]);
|
||||
usb2_transfer_start(sc->sc_xfer[RUE_BULK_CS_RD]);
|
||||
}
|
||||
DPRINTF("bulk read error, %s\n",
|
||||
usb2_errstr(xfer->error));
|
||||
@ -951,7 +951,7 @@ static void
|
||||
rue_bulk_write_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct rue_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[0];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[RUE_BULK_DT_WR];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
@ -977,7 +977,7 @@ rue_bulk_write_callback(struct usb2_xfer *xfer)
|
||||
case USB_ST_SETUP:
|
||||
|
||||
if (sc->sc_flags & RUE_FLAG_WRITE_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer[2]);
|
||||
usb2_transfer_start(sc->sc_xfer[RUE_BULK_CS_WR]);
|
||||
goto done;
|
||||
}
|
||||
if (sc->sc_flags & RUE_FLAG_WAIT_LINK) {
|
||||
@ -1031,7 +1031,7 @@ rue_bulk_write_callback(struct usb2_xfer *xfer)
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
/* try to clear stall first */
|
||||
sc->sc_flags |= RUE_FLAG_WRITE_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer[2]);
|
||||
usb2_transfer_start(sc->sc_xfer[RUE_BULK_CS_WR]);
|
||||
}
|
||||
ifp->if_oerrors++;
|
||||
return;
|
||||
@ -1089,9 +1089,9 @@ rue_start_transfers(struct rue_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[RUE_INTR_DT_RD]);
|
||||
usb2_transfer_start(sc->sc_xfer[RUE_BULK_DT_RD]);
|
||||
usb2_transfer_start(sc->sc_xfer[RUE_BULK_DT_WR]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1325,12 +1325,12 @@ rue_cfg_pre_stop(struct rue_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[RUE_BULK_DT_WR]);
|
||||
usb2_transfer_stop(sc->sc_xfer[RUE_BULK_DT_RD]);
|
||||
usb2_transfer_stop(sc->sc_xfer[RUE_BULK_CS_WR]);
|
||||
usb2_transfer_stop(sc->sc_xfer[RUE_BULK_CS_RD]);
|
||||
usb2_transfer_stop(sc->sc_xfer[RUE_INTR_DT_RD]);
|
||||
usb2_transfer_stop(sc->sc_xfer[RUE_INTR_CS_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -29,8 +29,6 @@
|
||||
#define RUE_CONFIG_IDX 0 /* config number 1 */
|
||||
#define RUE_IFACE_IDX 0
|
||||
|
||||
#define RUE_ENDPT_MAX 6
|
||||
|
||||
#define RUE_INTR_PKTLEN 0x8
|
||||
|
||||
#define RUE_TIMEOUT 50
|
||||
@ -165,6 +163,16 @@ struct rue_type {
|
||||
uint16_t rue_did;
|
||||
};
|
||||
|
||||
enum {
|
||||
RUE_BULK_DT_WR,
|
||||
RUE_BULK_DT_RD,
|
||||
RUE_BULK_CS_WR,
|
||||
RUE_BULK_CS_RD,
|
||||
RUE_INTR_DT_RD,
|
||||
RUE_INTR_CS_RD,
|
||||
RUE_N_TRANSFER = 6,
|
||||
};
|
||||
|
||||
struct rue_softc {
|
||||
void *sc_evilhack; /* XXX this pointer must be first */
|
||||
|
||||
@ -174,7 +182,7 @@ struct rue_softc {
|
||||
|
||||
struct ifnet *sc_ifp;
|
||||
struct usb2_device *sc_udev;
|
||||
struct usb2_xfer *sc_xfer[RUE_ENDPT_MAX];
|
||||
struct usb2_xfer *sc_xfer[RUE_N_TRANSFER];
|
||||
device_t sc_miibus;
|
||||
device_t sc_dev;
|
||||
|
||||
|
@ -118,9 +118,9 @@ static miibus_readreg_t udav_cfg_miibus_readreg;
|
||||
static miibus_writereg_t udav_cfg_miibus_writereg;
|
||||
static miibus_statchg_t udav_cfg_miibus_statchg;
|
||||
|
||||
static const struct usb2_config udav_config[UDAV_ENDPT_MAX] = {
|
||||
static const struct usb2_config udav_config[UDAV_N_TRANSFER] = {
|
||||
|
||||
[0] = {
|
||||
[UDAV_BULK_DT_WR] = {
|
||||
.type = UE_BULK,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_OUT,
|
||||
@ -130,7 +130,7 @@ static const struct usb2_config udav_config[UDAV_ENDPT_MAX] = {
|
||||
.mh.timeout = 10000, /* 10 seconds */
|
||||
},
|
||||
|
||||
[1] = {
|
||||
[UDAV_BULK_DT_RD] = {
|
||||
.type = UE_BULK,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_IN,
|
||||
@ -140,7 +140,7 @@ static const struct usb2_config udav_config[UDAV_ENDPT_MAX] = {
|
||||
.mh.timeout = 0, /* no timeout */
|
||||
},
|
||||
|
||||
[2] = {
|
||||
[UDAV_BULK_CS_WR] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -151,7 +151,7 @@ static const struct usb2_config udav_config[UDAV_ENDPT_MAX] = {
|
||||
.mh.interval = 50, /* 50ms */
|
||||
},
|
||||
|
||||
[3] = {
|
||||
[UDAV_BULK_CS_RD] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -162,7 +162,7 @@ static const struct usb2_config udav_config[UDAV_ENDPT_MAX] = {
|
||||
.mh.interval = 50, /* 50ms */
|
||||
},
|
||||
|
||||
[4] = {
|
||||
[UDAV_INTR_DT_RD] = {
|
||||
.type = UE_INTERRUPT,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_IN,
|
||||
@ -171,7 +171,7 @@ static const struct usb2_config udav_config[UDAV_ENDPT_MAX] = {
|
||||
.mh.callback = &udav_intr_callback,
|
||||
},
|
||||
|
||||
[5] = {
|
||||
[UDAV_INTR_CS_RD] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -286,7 +286,7 @@ udav_attach(device_t dev)
|
||||
|
||||
iface_index = UDAV_IFACE_INDEX;
|
||||
error = usb2_transfer_setup(uaa->device, &iface_index,
|
||||
sc->sc_xfer, udav_config, UDAV_ENDPT_MAX, sc, &sc->sc_mtx);
|
||||
sc->sc_xfer, udav_config, UDAV_N_TRANSFER, sc, &sc->sc_mtx);
|
||||
if (error) {
|
||||
device_printf(dev, "allocating USB "
|
||||
"transfers failed!\n");
|
||||
@ -414,7 +414,7 @@ udav_detach(device_t dev)
|
||||
mtx_unlock(&sc->sc_mtx);
|
||||
|
||||
/* stop all USB transfers first */
|
||||
usb2_transfer_unsetup(sc->sc_xfer, UDAV_ENDPT_MAX);
|
||||
usb2_transfer_unsetup(sc->sc_xfer, UDAV_N_TRANSFER);
|
||||
|
||||
/* get rid of any late children */
|
||||
bus_generic_detach(dev);
|
||||
@ -754,9 +754,9 @@ udav_start_transfers(struct udav_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[UDAV_INTR_DT_RD]);
|
||||
usb2_transfer_start(sc->sc_xfer[UDAV_BULK_DT_RD]);
|
||||
usb2_transfer_start(sc->sc_xfer[UDAV_BULK_DT_WR]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -764,7 +764,7 @@ static void
|
||||
udav_bulk_write_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct udav_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[0];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[UDAV_BULK_DT_WR];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
@ -792,7 +792,7 @@ udav_bulk_write_callback(struct usb2_xfer *xfer)
|
||||
case USB_ST_SETUP:
|
||||
|
||||
if (sc->sc_flags & UDAV_FLAG_WRITE_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer[2]);
|
||||
usb2_transfer_start(sc->sc_xfer[UDAV_BULK_CS_WR]);
|
||||
goto done;
|
||||
}
|
||||
if (sc->sc_flags & UDAV_FLAG_WAIT_LINK) {
|
||||
@ -856,7 +856,7 @@ udav_bulk_write_callback(struct usb2_xfer *xfer)
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
/* try to clear stall first */
|
||||
sc->sc_flags |= UDAV_FLAG_WRITE_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer[2]);
|
||||
usb2_transfer_start(sc->sc_xfer[UDAV_BULK_CS_WR]);
|
||||
}
|
||||
ifp->if_oerrors++;
|
||||
return;
|
||||
@ -868,7 +868,7 @@ static void
|
||||
udav_bulk_read_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct udav_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[1];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[UDAV_BULK_DT_RD];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
@ -937,7 +937,7 @@ udav_bulk_read_callback(struct usb2_xfer *xfer)
|
||||
tr_setup:
|
||||
|
||||
if (sc->sc_flags & UDAV_FLAG_READ_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer[3]);
|
||||
usb2_transfer_start(sc->sc_xfer[UDAV_BULK_CS_RD]);
|
||||
} else {
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
@ -959,7 +959,7 @@ udav_bulk_read_callback(struct usb2_xfer *xfer)
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
/* try to clear stall first */
|
||||
sc->sc_flags |= UDAV_FLAG_READ_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer[3]);
|
||||
usb2_transfer_start(sc->sc_xfer[UDAV_BULK_CS_RD]);
|
||||
}
|
||||
DPRINTF("bulk read error, %s\n",
|
||||
usb2_errstr(xfer->error));
|
||||
@ -972,7 +972,7 @@ static void
|
||||
udav_intr_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct udav_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[4];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[UDAV_INTR_DT_RD];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
@ -991,7 +991,7 @@ udav_intr_callback(struct usb2_xfer *xfer)
|
||||
|
||||
case USB_ST_SETUP:
|
||||
if (sc->sc_flags & UDAV_FLAG_INTR_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer[5]);
|
||||
usb2_transfer_start(sc->sc_xfer[UDAV_INTR_CS_RD]);
|
||||
} else {
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
@ -1002,7 +1002,7 @@ udav_intr_callback(struct usb2_xfer *xfer)
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
/* start clear stall */
|
||||
sc->sc_flags |= UDAV_FLAG_INTR_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer[5]);
|
||||
usb2_transfer_start(sc->sc_xfer[UDAV_INTR_CS_RD]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -1106,12 +1106,12 @@ udav_cfg_pre_stop(struct udav_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[UDAV_BULK_DT_WR]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UDAV_BULK_DT_RD]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UDAV_BULK_CS_WR]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UDAV_BULK_CS_RD]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UDAV_INTR_DT_RD]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UDAV_INTR_CS_RD]);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -34,8 +34,6 @@
|
||||
#define UDAV_IFACE_INDEX 0
|
||||
#define UDAV_CONFIG_INDEX 0 /* config number 1 */
|
||||
|
||||
#define UDAV_ENDPT_MAX 6 /* units */
|
||||
|
||||
/* Packet length */
|
||||
#define UDAV_MIN_FRAME_LEN 60
|
||||
|
||||
@ -136,6 +134,16 @@
|
||||
#define GET_MII(sc) ((sc)->sc_miibus ? \
|
||||
device_get_softc((sc)->sc_miibus) : NULL)
|
||||
|
||||
enum {
|
||||
UDAV_BULK_DT_WR,
|
||||
UDAV_BULK_DT_RD,
|
||||
UDAV_BULK_CS_WR,
|
||||
UDAV_BULK_CS_RD,
|
||||
UDAV_INTR_DT_RD,
|
||||
UDAV_INTR_CS_RD,
|
||||
UDAV_N_TRANSFER = 6,
|
||||
};
|
||||
|
||||
struct udav_softc {
|
||||
void *sc_evilhack; /* XXX this pointer must be first */
|
||||
|
||||
@ -145,7 +153,7 @@ struct udav_softc {
|
||||
|
||||
struct ifnet *sc_ifp;
|
||||
struct usb2_device *sc_udev;
|
||||
struct usb2_xfer *sc_xfer[UDAV_ENDPT_MAX];
|
||||
struct usb2_xfer *sc_xfer[UDAV_N_TRANSFER];
|
||||
device_t sc_miibus;
|
||||
device_t sc_dev;
|
||||
|
||||
|
@ -75,7 +75,6 @@ SYSCTL_INT(_hw_usb2_uscanner, OID_AUTO, debug, CTLFLAG_RW, &uscanner_debug,
|
||||
*/
|
||||
#define USCANNER_BSIZE (1 << 15)
|
||||
#define USCANNER_IFQ_MAXLEN 2
|
||||
#define USCANNER_N_TRANSFER 4
|
||||
|
||||
/*
|
||||
* Transfers stallings handling flags definition.
|
||||
@ -88,6 +87,14 @@ SYSCTL_INT(_hw_usb2_uscanner, OID_AUTO, debug, CTLFLAG_RW, &uscanner_debug,
|
||||
*/
|
||||
#define USCANNER_FLAG_KEEP_OPEN 0x04
|
||||
|
||||
enum {
|
||||
USCANNER_BULK_DT_WR,
|
||||
USCANNER_BULK_DT_RD,
|
||||
USCANNER_BULK_CS_WR,
|
||||
USCANNER_BULK_CS_RD,
|
||||
USCANNER_N_TRANSFER = 4,
|
||||
};
|
||||
|
||||
struct uscanner_softc {
|
||||
struct usb2_fifo_sc sc_fifo;
|
||||
struct mtx sc_mtx;
|
||||
@ -137,7 +144,7 @@ static struct usb2_fifo_methods uscanner_fifo_methods = {
|
||||
* transfers.
|
||||
*/
|
||||
static const struct usb2_config uscanner_config[USCANNER_N_TRANSFER] = {
|
||||
[0] = {
|
||||
[USCANNER_BULK_DT_WR] = {
|
||||
.type = UE_BULK,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_OUT,
|
||||
@ -146,7 +153,7 @@ static const struct usb2_config uscanner_config[USCANNER_N_TRANSFER] = {
|
||||
.mh.callback = &uscanner_write_callback,
|
||||
},
|
||||
|
||||
[1] = {
|
||||
[USCANNER_BULK_DT_RD] = {
|
||||
.type = UE_BULK,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_IN,
|
||||
@ -155,7 +162,7 @@ static const struct usb2_config uscanner_config[USCANNER_N_TRANSFER] = {
|
||||
.mh.callback = &uscanner_read_callback,
|
||||
},
|
||||
|
||||
[2] = {
|
||||
[USCANNER_BULK_CS_WR] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -166,7 +173,7 @@ static const struct usb2_config uscanner_config[USCANNER_N_TRANSFER] = {
|
||||
.mh.interval = 50, /* 50ms */
|
||||
},
|
||||
|
||||
[3] = {
|
||||
[USCANNER_BULK_CS_RD] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00,
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -450,7 +457,7 @@ uscanner_read_callback(struct usb2_xfer *xfer)
|
||||
* solve the situation.
|
||||
*/
|
||||
if (sc->sc_flags & USCANNER_FLAG_READ_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer[3]);
|
||||
usb2_transfer_start(sc->sc_xfer[USCANNER_BULK_CS_RD]);
|
||||
break;
|
||||
}
|
||||
if (usb2_fifo_put_bytes_max(f) != 0) {
|
||||
@ -462,7 +469,7 @@ uscanner_read_callback(struct usb2_xfer *xfer)
|
||||
default: /* Error */
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
sc->sc_flags |= USCANNER_FLAG_READ_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer[3]);
|
||||
usb2_transfer_start(sc->sc_xfer[USCANNER_BULK_CS_RD]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -475,7 +482,7 @@ static void
|
||||
uscanner_read_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct uscanner_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[1];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[USCANNER_BULK_DT_RD];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
@ -505,7 +512,7 @@ uscanner_write_callback(struct usb2_xfer *xfer)
|
||||
* solve the situation.
|
||||
*/
|
||||
if (sc->sc_flags & USCANNER_FLAG_WRITE_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer[2]);
|
||||
usb2_transfer_start(sc->sc_xfer[USCANNER_BULK_CS_WR]);
|
||||
break;
|
||||
}
|
||||
/*
|
||||
@ -521,7 +528,7 @@ uscanner_write_callback(struct usb2_xfer *xfer)
|
||||
default: /* Error */
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
sc->sc_flags |= USCANNER_FLAG_WRITE_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer[2]);
|
||||
usb2_transfer_start(sc->sc_xfer[USCANNER_BULK_CS_WR]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -534,7 +541,7 @@ static void
|
||||
uscanner_write_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct uscanner_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[0];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[USCANNER_BULK_DT_WR];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
@ -563,14 +570,14 @@ uscanner_open(struct usb2_fifo *fifo, int fflags, struct thread *td)
|
||||
}
|
||||
if (fflags & FREAD) {
|
||||
if (usb2_fifo_alloc_buffer(fifo,
|
||||
sc->sc_xfer[1]->max_data_length,
|
||||
sc->sc_xfer[USCANNER_BULK_DT_RD]->max_data_length,
|
||||
USCANNER_IFQ_MAXLEN)) {
|
||||
return (ENOMEM);
|
||||
}
|
||||
}
|
||||
if (fflags & FWRITE) {
|
||||
if (usb2_fifo_alloc_buffer(fifo,
|
||||
sc->sc_xfer[0]->max_data_length,
|
||||
sc->sc_xfer[USCANNER_BULK_DT_WR]->max_data_length,
|
||||
USCANNER_IFQ_MAXLEN)) {
|
||||
return (ENOMEM);
|
||||
}
|
||||
@ -595,7 +602,7 @@ uscanner_start_read(struct usb2_fifo *fifo)
|
||||
struct uscanner_softc *sc;
|
||||
|
||||
sc = fifo->priv_sc0;
|
||||
usb2_transfer_start(sc->sc_xfer[1]);
|
||||
usb2_transfer_start(sc->sc_xfer[USCANNER_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -607,7 +614,7 @@ uscanner_start_write(struct usb2_fifo *fifo)
|
||||
struct uscanner_softc *sc;
|
||||
|
||||
sc = fifo->priv_sc0;
|
||||
usb2_transfer_start(sc->sc_xfer[0]);
|
||||
usb2_transfer_start(sc->sc_xfer[USCANNER_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -619,8 +626,8 @@ uscanner_stop_read(struct usb2_fifo *fifo)
|
||||
struct uscanner_softc *sc;
|
||||
|
||||
sc = fifo->priv_sc0;
|
||||
usb2_transfer_stop(sc->sc_xfer[3]);
|
||||
usb2_transfer_stop(sc->sc_xfer[1]);
|
||||
usb2_transfer_stop(sc->sc_xfer[USCANNER_BULK_CS_RD]);
|
||||
usb2_transfer_stop(sc->sc_xfer[USCANNER_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -632,6 +639,6 @@ uscanner_stop_write(struct usb2_fifo *fifo)
|
||||
struct uscanner_softc *sc;
|
||||
|
||||
sc = fifo->priv_sc0;
|
||||
usb2_transfer_stop(sc->sc_xfer[2]);
|
||||
usb2_transfer_stop(sc->sc_xfer[0]);
|
||||
usb2_transfer_stop(sc->sc_xfer[USCANNER_BULK_CS_WR]);
|
||||
usb2_transfer_stop(sc->sc_xfer[USCANNER_BULK_DT_WR]);
|
||||
}
|
||||
|
@ -82,10 +82,17 @@ SYSCTL_INT(_hw_usb2_uhid, OID_AUTO, debug, CTLFLAG_RW,
|
||||
&uhid_debug, 0, "Debug level");
|
||||
#endif
|
||||
|
||||
#define UHID_N_TRANSFER 4 /* units */
|
||||
#define UHID_BSIZE 1024 /* bytes, buffer size */
|
||||
#define UHID_FRAME_NUM 50 /* bytes, frame number */
|
||||
|
||||
enum {
|
||||
UHID_INTR_DT_RD,
|
||||
UHID_INTR_CS_RD,
|
||||
UHID_CTRL_DT_WR,
|
||||
UHID_CTRL_DT_RD,
|
||||
UHID_N_TRANSFER = 4,
|
||||
};
|
||||
|
||||
struct uhid_softc {
|
||||
struct usb2_fifo_sc sc_fifo;
|
||||
struct mtx sc_mtx;
|
||||
@ -168,7 +175,7 @@ uhid_intr_callback(struct usb2_xfer *xfer)
|
||||
|
||||
case USB_ST_SETUP:
|
||||
if (sc->sc_flags & UHID_FLAG_INTR_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer[1]);
|
||||
usb2_transfer_start(sc->sc_xfer[UHID_INTR_CS_RD]);
|
||||
} else {
|
||||
if (usb2_fifo_put_bytes_max(
|
||||
sc->sc_fifo.fp[USB_FIFO_RX]) != 0) {
|
||||
@ -182,7 +189,7 @@ uhid_intr_callback(struct usb2_xfer *xfer)
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
/* try to clear stall first */
|
||||
sc->sc_flags |= UHID_FLAG_INTR_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer[1]);
|
||||
usb2_transfer_start(sc->sc_xfer[UHID_INTR_CS_RD]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -192,7 +199,7 @@ static void
|
||||
uhid_intr_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct uhid_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[0];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[UHID_INTR_DT_RD];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
@ -325,7 +332,7 @@ uhid_read_callback(struct usb2_xfer *xfer)
|
||||
|
||||
static const struct usb2_config uhid_config[UHID_N_TRANSFER] = {
|
||||
|
||||
[0] = {
|
||||
[UHID_INTR_DT_RD] = {
|
||||
.type = UE_INTERRUPT,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_IN,
|
||||
@ -334,7 +341,7 @@ static const struct usb2_config uhid_config[UHID_N_TRANSFER] = {
|
||||
.mh.callback = &uhid_intr_callback,
|
||||
},
|
||||
|
||||
[1] = {
|
||||
[UHID_INTR_CS_RD] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -344,7 +351,7 @@ static const struct usb2_config uhid_config[UHID_N_TRANSFER] = {
|
||||
.mh.interval = 50, /* 50ms */
|
||||
},
|
||||
|
||||
[2] = {
|
||||
[UHID_CTRL_DT_WR] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -353,7 +360,7 @@ static const struct usb2_config uhid_config[UHID_N_TRANSFER] = {
|
||||
.mh.timeout = 1000, /* 1 second */
|
||||
},
|
||||
|
||||
[3] = {
|
||||
[UHID_CTRL_DT_RD] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -369,9 +376,9 @@ uhid_start_read(struct usb2_fifo *fifo)
|
||||
struct uhid_softc *sc = fifo->priv_sc0;
|
||||
|
||||
if (sc->sc_flags & UHID_FLAG_IMMED) {
|
||||
usb2_transfer_start(sc->sc_xfer[3]);
|
||||
usb2_transfer_start(sc->sc_xfer[UHID_CTRL_DT_RD]);
|
||||
} else {
|
||||
usb2_transfer_start(sc->sc_xfer[0]);
|
||||
usb2_transfer_start(sc->sc_xfer[UHID_INTR_DT_RD]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -380,8 +387,8 @@ uhid_stop_read(struct usb2_fifo *fifo)
|
||||
{
|
||||
struct uhid_softc *sc = fifo->priv_sc0;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[3]);
|
||||
usb2_transfer_stop(sc->sc_xfer[0]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UHID_CTRL_DT_RD]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UHID_INTR_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -389,7 +396,7 @@ uhid_start_write(struct usb2_fifo *fifo)
|
||||
{
|
||||
struct uhid_softc *sc = fifo->priv_sc0;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[2]);
|
||||
usb2_transfer_start(sc->sc_xfer[UHID_CTRL_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -397,7 +404,7 @@ uhid_stop_write(struct usb2_fifo *fifo)
|
||||
{
|
||||
struct uhid_softc *sc = fifo->priv_sc0;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[2]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UHID_CTRL_DT_WR]);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -99,7 +99,6 @@ SYSCTL_INT(_hw_usb2_ukbd, OID_AUTO, debug, CTLFLAG_RW,
|
||||
#define UKBD_DRIVER_NAME "ukbd"
|
||||
#define UKBD_NMOD 8 /* units */
|
||||
#define UKBD_NKEYCODE 6 /* units */
|
||||
#define UKBD_N_TRANSFER 3 /* units */
|
||||
#define UKBD_IN_BUF_SIZE (2*(UKBD_NMOD + (2*UKBD_NKEYCODE))) /* bytes */
|
||||
#define UKBD_IN_BUF_FULL (UKBD_IN_BUF_SIZE / 2) /* bytes */
|
||||
#define UKBD_NFKEY (sizeof(fkey_tab)/sizeof(fkey_tab[0])) /* units */
|
||||
@ -118,6 +117,13 @@ struct ukbd_data {
|
||||
uint8_t keycode[UKBD_NKEYCODE];
|
||||
} __packed;
|
||||
|
||||
enum {
|
||||
UKBD_INTR_DT,
|
||||
UKBD_INTR_CS,
|
||||
UKBD_CTRL_LED,
|
||||
UKBD_N_TRANSFER = 3,
|
||||
};
|
||||
|
||||
struct ukbd_softc {
|
||||
keyboard_t sc_kbd;
|
||||
keymap_t sc_keymap;
|
||||
@ -287,7 +293,7 @@ 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[0]);
|
||||
usb2_transfer_start(sc->sc_xfer[UKBD_INTR_DT]);
|
||||
}
|
||||
if (sc->sc_flags & UKBD_FLAG_POLLING) {
|
||||
DPRINTFN(2, "polling\n");
|
||||
@ -451,7 +457,7 @@ static void
|
||||
ukbd_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct ukbd_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[0];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[UKBD_INTR_DT];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
@ -491,7 +497,7 @@ ukbd_intr_callback(struct usb2_xfer *xfer)
|
||||
}
|
||||
case USB_ST_SETUP:
|
||||
if (sc->sc_flags & UKBD_FLAG_INTR_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer[1]);
|
||||
usb2_transfer_start(sc->sc_xfer[UKBD_INTR_CS]);
|
||||
return;
|
||||
}
|
||||
if (sc->sc_inputs < UKBD_IN_BUF_FULL) {
|
||||
@ -508,7 +514,7 @@ ukbd_intr_callback(struct usb2_xfer *xfer)
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
/* try to clear stall first */
|
||||
sc->sc_flags |= UKBD_FLAG_INTR_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer[1]);
|
||||
usb2_transfer_start(sc->sc_xfer[UKBD_INTR_CS]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -554,7 +560,7 @@ ukbd_set_leds_callback(struct usb2_xfer *xfer)
|
||||
|
||||
static const struct usb2_config ukbd_config[UKBD_N_TRANSFER] = {
|
||||
|
||||
[0] = {
|
||||
[UKBD_INTR_DT] = {
|
||||
.type = UE_INTERRUPT,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_IN,
|
||||
@ -563,7 +569,7 @@ static const struct usb2_config ukbd_config[UKBD_N_TRANSFER] = {
|
||||
.mh.callback = &ukbd_intr_callback,
|
||||
},
|
||||
|
||||
[1] = {
|
||||
[UKBD_INTR_CS] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -573,7 +579,7 @@ static const struct usb2_config ukbd_config[UKBD_N_TRANSFER] = {
|
||||
.mh.interval = 50, /* 50ms */
|
||||
},
|
||||
|
||||
[2] = {
|
||||
[UKBD_CTRL_LED] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -698,7 +704,7 @@ ukbd_attach(device_t dev)
|
||||
|
||||
/* start the keyboard */
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[0]);
|
||||
usb2_transfer_start(sc->sc_xfer[UKBD_INTR_DT]);
|
||||
|
||||
/* start the timer */
|
||||
|
||||
@ -1360,7 +1366,7 @@ ukbd_set_leds(struct ukbd_softc *sc, uint8_t leds)
|
||||
|
||||
/* start transfer, if not already started */
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[2]);
|
||||
usb2_transfer_start(sc->sc_xfer[UKBD_CTRL_LED]);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -84,10 +84,15 @@ SYSCTL_INT(_hw_usb2_ums, OID_AUTO, debug, CTLFLAG_RW,
|
||||
|
||||
#define UMS_BUF_SIZE 8 /* bytes */
|
||||
#define UMS_IFQ_MAXLEN 50 /* units */
|
||||
#define UMS_N_TRANSFER 2 /* units */
|
||||
#define UMS_BUTTON_MAX 31 /* exclusive, must be less than 32 */
|
||||
#define UMS_BUT(i) ((i) < 3 ? (((i) + 2) % 3) : (i))
|
||||
|
||||
enum {
|
||||
UMS_INTR_DT,
|
||||
UMS_INTR_CS,
|
||||
UMS_N_TRANSFER = 2,
|
||||
};
|
||||
|
||||
struct ums_softc {
|
||||
struct usb2_fifo_sc sc_fifo;
|
||||
struct mtx sc_mtx;
|
||||
@ -159,7 +164,7 @@ static void
|
||||
ums_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct ums_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[0];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[UMS_INTR_DT];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
@ -307,7 +312,7 @@ ums_intr_callback(struct usb2_xfer *xfer)
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
if (sc->sc_flags & UMS_FLAG_INTR_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer[1]);
|
||||
usb2_transfer_start(sc->sc_xfer[UMS_INTR_CS]);
|
||||
} else {
|
||||
/* check if we can put more data into the FIFO */
|
||||
if (usb2_fifo_put_bytes_max(
|
||||
@ -322,7 +327,7 @@ ums_intr_callback(struct usb2_xfer *xfer)
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
/* start clear stall */
|
||||
sc->sc_flags |= UMS_FLAG_INTR_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer[1]);
|
||||
usb2_transfer_start(sc->sc_xfer[UMS_INTR_CS]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -330,7 +335,7 @@ ums_intr_callback(struct usb2_xfer *xfer)
|
||||
|
||||
static const struct usb2_config ums_config[UMS_N_TRANSFER] = {
|
||||
|
||||
[0] = {
|
||||
[UMS_INTR_DT] = {
|
||||
.type = UE_INTERRUPT,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_IN,
|
||||
@ -339,7 +344,7 @@ static const struct usb2_config ums_config[UMS_N_TRANSFER] = {
|
||||
.mh.callback = &ums_intr_callback,
|
||||
},
|
||||
|
||||
[1] = {
|
||||
[UMS_INTR_CS] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -555,10 +560,10 @@ ums_attach(device_t dev)
|
||||
/* Some wheels need the Z axis reversed. */
|
||||
sc->sc_flags |= UMS_FLAG_REVZ;
|
||||
}
|
||||
if (isize > sc->sc_xfer[0]->max_frame_size) {
|
||||
if (isize > sc->sc_xfer[UMS_INTR_DT]->max_frame_size) {
|
||||
DPRINTF("WARNING: report size, %d bytes, is larger "
|
||||
"than interrupt size, %d bytes!\n",
|
||||
isize, sc->sc_xfer[0]->max_frame_size);
|
||||
isize, sc->sc_xfer[UMS_INTR_DT]->max_frame_size);
|
||||
}
|
||||
/* announce information about the mouse */
|
||||
|
||||
@ -657,7 +662,7 @@ ums_start_read(struct usb2_fifo *fifo)
|
||||
{
|
||||
struct ums_softc *sc = fifo->priv_sc0;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[0]);
|
||||
usb2_transfer_start(sc->sc_xfer[UMS_INTR_DT]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -665,8 +670,8 @@ ums_stop_read(struct usb2_fifo *fifo)
|
||||
{
|
||||
struct ums_softc *sc = fifo->priv_sc0;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[1]);
|
||||
usb2_transfer_stop(sc->sc_xfer[0]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UMS_INTR_CS]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UMS_INTR_DT]);
|
||||
usb2_callout_stop(&sc->sc_callout);
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,6 @@ SYSCTL_INT(_hw_usb2_u3g, OID_AUTO, debug, CTLFLAG_RW,
|
||||
&u3g_debug, 0, "u3g debug level");
|
||||
#endif
|
||||
|
||||
#define U3G_N_TRANSFER 2
|
||||
#define U3G_MAXPORTS 4
|
||||
#define U3G_CONFIG_INDEX 0
|
||||
#define U3G_BSIZE 2048
|
||||
@ -86,6 +85,12 @@ struct u3g_speeds_s {
|
||||
uint32_t ospeed;
|
||||
};
|
||||
|
||||
enum {
|
||||
U3G_BULK_WR,
|
||||
U3G_BULK_RD,
|
||||
U3G_N_TRANSFER = 2,
|
||||
};
|
||||
|
||||
struct u3g_softc {
|
||||
struct usb2_com_super_softc sc_super_ucom;
|
||||
struct usb2_com_softc sc_ucom;
|
||||
@ -117,7 +122,7 @@ static int u3g_driver_loaded(struct module *mod, int what, void *arg);
|
||||
|
||||
static const struct usb2_config u3g_config[U3G_N_TRANSFER] = {
|
||||
|
||||
[0] = {
|
||||
[U3G_BULK_WR] = {
|
||||
.type = UE_BULK,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_OUT,
|
||||
@ -126,7 +131,7 @@ static const struct usb2_config u3g_config[U3G_N_TRANSFER] = {
|
||||
.mh.callback = &u3g_write_callback,
|
||||
},
|
||||
|
||||
[1] = {
|
||||
[U3G_BULK_RD] = {
|
||||
.type = UE_BULK,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_IN,
|
||||
@ -401,8 +406,8 @@ u3g_attach(device_t dev)
|
||||
goto detach;
|
||||
}
|
||||
/* set stall by default */
|
||||
usb2_transfer_set_stall(sc->sc_xfer[0]);
|
||||
usb2_transfer_set_stall(sc->sc_xfer[1]);
|
||||
usb2_transfer_set_stall(sc->sc_xfer[U3G_BULK_WR]);
|
||||
usb2_transfer_set_stall(sc->sc_xfer[U3G_BULK_RD]);
|
||||
|
||||
error = usb2_com_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc,
|
||||
&u3g_callback, &Giant);
|
||||
@ -437,7 +442,7 @@ u3g_start_read(struct usb2_com_softc *ucom)
|
||||
struct u3g_softc *sc = ucom->sc_parent;
|
||||
|
||||
/* start read endpoint */
|
||||
usb2_transfer_start(sc->sc_xfer[1]);
|
||||
usb2_transfer_start(sc->sc_xfer[U3G_BULK_RD]);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -447,7 +452,7 @@ u3g_stop_read(struct usb2_com_softc *ucom)
|
||||
struct u3g_softc *sc = ucom->sc_parent;
|
||||
|
||||
/* stop read endpoint */
|
||||
usb2_transfer_stop(sc->sc_xfer[1]);
|
||||
usb2_transfer_stop(sc->sc_xfer[U3G_BULK_RD]);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -456,7 +461,7 @@ u3g_start_write(struct usb2_com_softc *ucom)
|
||||
{
|
||||
struct u3g_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[0]);
|
||||
usb2_transfer_start(sc->sc_xfer[U3G_BULK_WR]);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -465,7 +470,7 @@ u3g_stop_write(struct usb2_com_softc *ucom)
|
||||
{
|
||||
struct u3g_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[0]);
|
||||
usb2_transfer_stop(sc->sc_xfer[U3G_BULK_WR]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -42,8 +42,6 @@
|
||||
|
||||
#define UARK_BUF_SIZE 1024 /* bytes */
|
||||
|
||||
#define UARK_N_TRANSFER 4 /* units */
|
||||
|
||||
#define UARK_SET_DATA_BITS(x) ((x) - 5)
|
||||
|
||||
#define UARK_PARITY_NONE 0x00
|
||||
@ -63,6 +61,14 @@
|
||||
#define UARK_CONFIG_INDEX 0
|
||||
#define UARK_IFACE_INDEX 0
|
||||
|
||||
enum {
|
||||
UARK_BULK_DT_WR,
|
||||
UARK_BULK_DT_RD,
|
||||
UARK_BULK_CS_WR,
|
||||
UARK_BULK_CS_RD,
|
||||
UARK_N_TRANSFER = 4,
|
||||
};
|
||||
|
||||
struct uark_softc {
|
||||
struct usb2_com_super_softc sc_super_ucom;
|
||||
struct usb2_com_softc sc_ucom;
|
||||
@ -102,7 +108,7 @@ static void uark_cfg_write(struct uark_softc *, uint16_t, uint16_t);
|
||||
static const struct usb2_config
|
||||
uark_xfer_config[UARK_N_TRANSFER] = {
|
||||
|
||||
[0] = {
|
||||
[UARK_BULK_DT_WR] = {
|
||||
.type = UE_BULK,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_OUT,
|
||||
@ -111,7 +117,7 @@ static const struct usb2_config
|
||||
.mh.callback = &uark_bulk_write_callback,
|
||||
},
|
||||
|
||||
[1] = {
|
||||
[UARK_BULK_DT_RD] = {
|
||||
.type = UE_BULK,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_IN,
|
||||
@ -120,7 +126,7 @@ static const struct usb2_config
|
||||
.mh.callback = &uark_bulk_read_callback,
|
||||
},
|
||||
|
||||
[2] = {
|
||||
[UARK_BULK_CS_WR] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -131,7 +137,7 @@ static const struct usb2_config
|
||||
.mh.interval = 50, /* 50ms */
|
||||
},
|
||||
|
||||
[3] = {
|
||||
[UARK_BULK_CS_RD] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -259,7 +265,7 @@ uark_bulk_write_callback(struct usb2_xfer *xfer)
|
||||
case USB_ST_SETUP:
|
||||
case USB_ST_TRANSFERRED:
|
||||
if (sc->sc_flags & UARK_FLAG_BULK_WRITE_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer[2]);
|
||||
usb2_transfer_start(sc->sc_xfer[UARK_BULK_CS_WR]);
|
||||
return;
|
||||
}
|
||||
if (usb2_com_get_data(&sc->sc_ucom, xfer->frbuffers, 0,
|
||||
@ -272,7 +278,7 @@ uark_bulk_write_callback(struct usb2_xfer *xfer)
|
||||
default: /* Error */
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
sc->sc_flags |= UARK_FLAG_BULK_WRITE_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer[2]);
|
||||
usb2_transfer_start(sc->sc_xfer[UARK_BULK_CS_WR]);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -283,7 +289,7 @@ static void
|
||||
uark_bulk_write_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct uark_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[0];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[UARK_BULK_DT_WR];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
@ -304,7 +310,7 @@ uark_bulk_read_callback(struct usb2_xfer *xfer)
|
||||
|
||||
case USB_ST_SETUP:
|
||||
if (sc->sc_flags & UARK_FLAG_BULK_READ_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer[3]);
|
||||
usb2_transfer_start(sc->sc_xfer[UARK_BULK_CS_RD]);
|
||||
} else {
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
@ -314,7 +320,7 @@ uark_bulk_read_callback(struct usb2_xfer *xfer)
|
||||
default: /* Error */
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
sc->sc_flags |= UARK_FLAG_BULK_READ_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer[3]);
|
||||
usb2_transfer_start(sc->sc_xfer[UARK_BULK_CS_RD]);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -325,7 +331,7 @@ static void
|
||||
uark_bulk_read_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct uark_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[1];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[UARK_BULK_DT_RD];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
@ -339,7 +345,7 @@ uark_start_read(struct usb2_com_softc *ucom)
|
||||
{
|
||||
struct uark_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[1]);
|
||||
usb2_transfer_start(sc->sc_xfer[UARK_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -347,8 +353,8 @@ uark_stop_read(struct usb2_com_softc *ucom)
|
||||
{
|
||||
struct uark_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[3]);
|
||||
usb2_transfer_stop(sc->sc_xfer[1]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UARK_BULK_CS_RD]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UARK_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -356,7 +362,7 @@ uark_start_write(struct usb2_com_softc *ucom)
|
||||
{
|
||||
struct uark_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[0]);
|
||||
usb2_transfer_start(sc->sc_xfer[UARK_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -364,8 +370,8 @@ uark_stop_write(struct usb2_com_softc *ucom)
|
||||
{
|
||||
struct uark_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[2]);
|
||||
usb2_transfer_stop(sc->sc_xfer[0]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UARK_BULK_CS_WR]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UARK_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -88,7 +88,6 @@ SYSCTL_INT(_hw_usb2_ubsa, OID_AUTO, debug, CTLFLAG_RW,
|
||||
&ubsa_debug, 0, "ubsa debug level");
|
||||
#endif
|
||||
|
||||
#define UBSA_N_TRANSFER 6 /* units */
|
||||
#define UBSA_BSIZE 1024 /* bytes */
|
||||
|
||||
#define UBSA_CONFIG_INDEX 0
|
||||
@ -141,6 +140,16 @@ SYSCTL_INT(_hw_usb2_ubsa, OID_AUTO, debug, CTLFLAG_RW,
|
||||
#define UBSA_MSR_DDSR 0x02 /* DSR has changed state */
|
||||
#define UBSA_MSR_DCTS 0x01 /* CTS has changed state */
|
||||
|
||||
enum {
|
||||
UBSA_BULK_DT_WR,
|
||||
UBSA_BULK_DT_RD,
|
||||
UBSA_BULK_CS_WR,
|
||||
UBSA_BULK_CS_RD,
|
||||
UBSA_INTR_DT_RD,
|
||||
UBSA_INTR_CS_RD,
|
||||
UBSA_N_TRANSFER = 6,
|
||||
};
|
||||
|
||||
struct ubsa_softc {
|
||||
struct usb2_com_super_softc sc_super_ucom;
|
||||
struct usb2_com_softc sc_ucom;
|
||||
@ -185,7 +194,7 @@ static void ubsa_cfg_get_status(struct usb2_com_softc *, uint8_t *,
|
||||
|
||||
static const struct usb2_config ubsa_config[UBSA_N_TRANSFER] = {
|
||||
|
||||
[0] = {
|
||||
[UBSA_BULK_DT_WR] = {
|
||||
.type = UE_BULK,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_OUT,
|
||||
@ -194,7 +203,7 @@ static const struct usb2_config ubsa_config[UBSA_N_TRANSFER] = {
|
||||
.mh.callback = &ubsa_write_callback,
|
||||
},
|
||||
|
||||
[1] = {
|
||||
[UBSA_BULK_DT_RD] = {
|
||||
.type = UE_BULK,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_IN,
|
||||
@ -203,7 +212,7 @@ static const struct usb2_config ubsa_config[UBSA_N_TRANSFER] = {
|
||||
.mh.callback = &ubsa_read_callback,
|
||||
},
|
||||
|
||||
[2] = {
|
||||
[UBSA_BULK_CS_WR] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -213,7 +222,7 @@ static const struct usb2_config ubsa_config[UBSA_N_TRANSFER] = {
|
||||
.mh.interval = 50, /* 50ms */
|
||||
},
|
||||
|
||||
[3] = {
|
||||
[UBSA_BULK_CS_RD] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -223,7 +232,7 @@ static const struct usb2_config ubsa_config[UBSA_N_TRANSFER] = {
|
||||
.mh.interval = 50, /* 50ms */
|
||||
},
|
||||
|
||||
[4] = {
|
||||
[UBSA_INTR_DT_RD] = {
|
||||
.type = UE_INTERRUPT,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_IN,
|
||||
@ -232,7 +241,7 @@ static const struct usb2_config ubsa_config[UBSA_N_TRANSFER] = {
|
||||
.mh.callback = &ubsa_intr_callback,
|
||||
},
|
||||
|
||||
[5] = {
|
||||
[UBSA_INTR_CS_RD] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -526,10 +535,10 @@ ubsa_start_read(struct usb2_com_softc *ucom)
|
||||
struct ubsa_softc *sc = ucom->sc_parent;
|
||||
|
||||
/* start interrupt endpoint */
|
||||
usb2_transfer_start(sc->sc_xfer[4]);
|
||||
usb2_transfer_start(sc->sc_xfer[UBSA_INTR_DT_RD]);
|
||||
|
||||
/* start read endpoint */
|
||||
usb2_transfer_start(sc->sc_xfer[1]);
|
||||
usb2_transfer_start(sc->sc_xfer[UBSA_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -538,12 +547,12 @@ ubsa_stop_read(struct usb2_com_softc *ucom)
|
||||
struct ubsa_softc *sc = ucom->sc_parent;
|
||||
|
||||
/* stop interrupt endpoint */
|
||||
usb2_transfer_stop(sc->sc_xfer[5]);
|
||||
usb2_transfer_stop(sc->sc_xfer[4]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UBSA_INTR_CS_RD]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UBSA_INTR_DT_RD]);
|
||||
|
||||
/* stop read endpoint */
|
||||
usb2_transfer_stop(sc->sc_xfer[3]);
|
||||
usb2_transfer_stop(sc->sc_xfer[1]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UBSA_BULK_CS_RD]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UBSA_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -551,7 +560,7 @@ ubsa_start_write(struct usb2_com_softc *ucom)
|
||||
{
|
||||
struct ubsa_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[0]);
|
||||
usb2_transfer_start(sc->sc_xfer[UBSA_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -559,8 +568,8 @@ ubsa_stop_write(struct usb2_com_softc *ucom)
|
||||
{
|
||||
struct ubsa_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[2]);
|
||||
usb2_transfer_stop(sc->sc_xfer[0]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UBSA_BULK_CS_WR]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UBSA_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -584,7 +593,7 @@ ubsa_write_callback(struct usb2_xfer *xfer)
|
||||
case USB_ST_SETUP:
|
||||
case USB_ST_TRANSFERRED:
|
||||
if (sc->sc_flag & UBSA_FLAG_WRITE_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer[2]);
|
||||
usb2_transfer_start(sc->sc_xfer[UBSA_BULK_CS_WR]);
|
||||
return;
|
||||
}
|
||||
if (usb2_com_get_data(&sc->sc_ucom, xfer->frbuffers, 0,
|
||||
@ -598,7 +607,7 @@ ubsa_write_callback(struct usb2_xfer *xfer)
|
||||
default: /* Error */
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
sc->sc_flag |= UBSA_FLAG_WRITE_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer[2]);
|
||||
usb2_transfer_start(sc->sc_xfer[UBSA_BULK_CS_WR]);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -609,7 +618,7 @@ static void
|
||||
ubsa_write_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct ubsa_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[0];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[UBSA_BULK_DT_WR];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
@ -629,7 +638,7 @@ ubsa_read_callback(struct usb2_xfer *xfer)
|
||||
|
||||
case USB_ST_SETUP:
|
||||
if (sc->sc_flag & UBSA_FLAG_READ_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer[3]);
|
||||
usb2_transfer_start(sc->sc_xfer[UBSA_BULK_CS_RD]);
|
||||
} else {
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
@ -639,7 +648,7 @@ ubsa_read_callback(struct usb2_xfer *xfer)
|
||||
default: /* Error */
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
sc->sc_flag |= UBSA_FLAG_READ_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer[3]);
|
||||
usb2_transfer_start(sc->sc_xfer[UBSA_BULK_CS_RD]);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -650,7 +659,7 @@ static void
|
||||
ubsa_read_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct ubsa_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[1];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[UBSA_BULK_DT_RD];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
@ -690,7 +699,7 @@ ubsa_intr_callback(struct usb2_xfer *xfer)
|
||||
|
||||
case USB_ST_SETUP:
|
||||
if (sc->sc_flag & UBSA_FLAG_INTR_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer[5]);
|
||||
usb2_transfer_start(sc->sc_xfer[UBSA_INTR_CS_RD]);
|
||||
} else {
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
@ -700,7 +709,7 @@ ubsa_intr_callback(struct usb2_xfer *xfer)
|
||||
default: /* Error */
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
sc->sc_flag |= UBSA_FLAG_INTR_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer[5]);
|
||||
usb2_transfer_start(sc->sc_xfer[UBSA_INTR_CS_RD]);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -711,7 +720,7 @@ static void
|
||||
ubsa_intr_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct ubsa_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[4];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[UBSA_INTR_DT_RD];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
|
@ -110,17 +110,19 @@ SYSCTL_INT(_hw_usb2_ubser, OID_AUTO, debug, CTLFLAG_RW,
|
||||
&ubser_debug, 0, "ubser debug level");
|
||||
#endif
|
||||
|
||||
#define UBSER_TR_DT_WRITE 0
|
||||
#define UBSER_TR_DT_READ 1
|
||||
#define UBSER_TR_CS_WRITE 2
|
||||
#define UBSER_TR_CS_READ 3
|
||||
#define UBSER_TR_MAX 4
|
||||
enum {
|
||||
UBSER_BULK_DT_WR,
|
||||
UBSER_BULK_DT_RD,
|
||||
UBSER_BULK_CS_WR,
|
||||
UBSER_BULK_CS_RD,
|
||||
UBSER_N_TRANSFER = 4,
|
||||
};
|
||||
|
||||
struct ubser_softc {
|
||||
struct usb2_com_super_softc sc_super_ucom;
|
||||
struct usb2_com_softc sc_ucom[UBSER_UNIT_MAX];
|
||||
|
||||
struct usb2_xfer *sc_xfer[UBSER_TR_MAX];
|
||||
struct usb2_xfer *sc_xfer[UBSER_N_TRANSFER];
|
||||
struct usb2_device *sc_udev;
|
||||
|
||||
uint16_t sc_tx_size;
|
||||
@ -156,9 +158,9 @@ static void ubser_stop_read(struct usb2_com_softc *);
|
||||
static void ubser_start_write(struct usb2_com_softc *);
|
||||
static void ubser_stop_write(struct usb2_com_softc *);
|
||||
|
||||
static const struct usb2_config ubser_config[UBSER_TR_MAX] = {
|
||||
static const struct usb2_config ubser_config[UBSER_N_TRANSFER] = {
|
||||
|
||||
[UBSER_TR_DT_WRITE] = {
|
||||
[UBSER_BULK_DT_WR] = {
|
||||
.type = UE_BULK,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_OUT,
|
||||
@ -167,7 +169,7 @@ static const struct usb2_config ubser_config[UBSER_TR_MAX] = {
|
||||
.mh.callback = &ubser_write_callback,
|
||||
},
|
||||
|
||||
[UBSER_TR_DT_READ] = {
|
||||
[UBSER_BULK_DT_RD] = {
|
||||
.type = UE_BULK,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_IN,
|
||||
@ -176,7 +178,7 @@ static const struct usb2_config ubser_config[UBSER_TR_MAX] = {
|
||||
.mh.callback = &ubser_read_callback,
|
||||
},
|
||||
|
||||
[UBSER_TR_CS_WRITE] = {
|
||||
[UBSER_BULK_CS_WR] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -187,7 +189,7 @@ static const struct usb2_config ubser_config[UBSER_TR_MAX] = {
|
||||
.mh.interval = 50, /* 50ms */
|
||||
},
|
||||
|
||||
[UBSER_TR_CS_READ] = {
|
||||
[UBSER_BULK_CS_RD] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -289,11 +291,11 @@ 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,
|
||||
sc->sc_xfer, ubser_config, UBSER_TR_MAX, sc, &Giant);
|
||||
sc->sc_xfer, ubser_config, UBSER_N_TRANSFER, sc, &Giant);
|
||||
if (error) {
|
||||
goto detach;
|
||||
}
|
||||
sc->sc_tx_size = sc->sc_xfer[UBSER_TR_DT_WRITE]->max_data_length;
|
||||
sc->sc_tx_size = sc->sc_xfer[UBSER_BULK_DT_WR]->max_data_length;
|
||||
|
||||
if (sc->sc_tx_size == 0) {
|
||||
DPRINTFN(0, "invalid tx_size!\n");
|
||||
@ -315,7 +317,7 @@ ubser_attach(device_t dev)
|
||||
sc->sc_flags |= (UBSER_FLAG_READ_STALL |
|
||||
UBSER_FLAG_WRITE_STALL);
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[UBSER_TR_DT_READ]);
|
||||
usb2_transfer_start(sc->sc_xfer[UBSER_BULK_DT_RD]);
|
||||
|
||||
mtx_unlock(&Giant);
|
||||
|
||||
@ -341,12 +343,12 @@ ubser_detach(device_t dev)
|
||||
* completes, it might start other transfers !
|
||||
*/
|
||||
mtx_lock(&Giant);
|
||||
for (n = 0; n < UBSER_TR_MAX; n++) {
|
||||
for (n = 0; n < UBSER_N_TRANSFER; n++) {
|
||||
usb2_transfer_stop(sc->sc_xfer[n]);
|
||||
}
|
||||
mtx_unlock(&Giant);
|
||||
|
||||
usb2_transfer_unsetup(sc->sc_xfer, UBSER_TR_MAX);
|
||||
usb2_transfer_unsetup(sc->sc_xfer, UBSER_N_TRANSFER);
|
||||
|
||||
return (0);
|
||||
}
|
||||
@ -413,7 +415,7 @@ static void
|
||||
ubser_write_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct ubser_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[UBSER_TR_DT_WRITE];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[UBSER_BULK_DT_WR];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
@ -434,7 +436,7 @@ ubser_write_callback(struct usb2_xfer *xfer)
|
||||
case USB_ST_SETUP:
|
||||
case USB_ST_TRANSFERRED:
|
||||
if (sc->sc_flags & UBSER_FLAG_WRITE_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer[UBSER_TR_CS_WRITE]);
|
||||
usb2_transfer_start(sc->sc_xfer[UBSER_BULK_CS_WR]);
|
||||
return;
|
||||
}
|
||||
do {
|
||||
@ -462,7 +464,7 @@ ubser_write_callback(struct usb2_xfer *xfer)
|
||||
default: /* Error */
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
sc->sc_flags |= UBSER_FLAG_WRITE_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer[UBSER_TR_CS_WRITE]);
|
||||
usb2_transfer_start(sc->sc_xfer[UBSER_BULK_CS_WR]);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -473,7 +475,7 @@ static void
|
||||
ubser_read_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct ubser_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[UBSER_TR_DT_READ];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[UBSER_BULK_DT_RD];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
@ -506,7 +508,7 @@ ubser_read_callback(struct usb2_xfer *xfer)
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
if (sc->sc_flags & UBSER_FLAG_READ_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer[UBSER_TR_CS_READ]);
|
||||
usb2_transfer_start(sc->sc_xfer[UBSER_BULK_CS_RD]);
|
||||
} else {
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
@ -516,7 +518,7 @@ ubser_read_callback(struct usb2_xfer *xfer)
|
||||
default: /* Error */
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
sc->sc_flags |= UBSER_FLAG_READ_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer[UBSER_TR_CS_READ]);
|
||||
usb2_transfer_start(sc->sc_xfer[UBSER_BULK_CS_RD]);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -564,7 +566,7 @@ ubser_start_read(struct usb2_com_softc *ucom)
|
||||
{
|
||||
struct ubser_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[UBSER_TR_DT_READ]);
|
||||
usb2_transfer_start(sc->sc_xfer[UBSER_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -572,8 +574,8 @@ ubser_stop_read(struct usb2_com_softc *ucom)
|
||||
{
|
||||
struct ubser_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[UBSER_TR_CS_READ]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UBSER_TR_DT_READ]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UBSER_BULK_CS_RD]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UBSER_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -581,7 +583,7 @@ ubser_start_write(struct usb2_com_softc *ucom)
|
||||
{
|
||||
struct ubser_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[UBSER_TR_DT_WRITE]);
|
||||
usb2_transfer_start(sc->sc_xfer[UBSER_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -589,6 +591,6 @@ ubser_stop_write(struct usb2_com_softc *ucom)
|
||||
{
|
||||
struct ubser_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[UBSER_TR_CS_WRITE]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UBSER_TR_DT_WRITE]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UBSER_BULK_CS_WR]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UBSER_BULK_DT_WR]);
|
||||
}
|
||||
|
@ -144,7 +144,16 @@ SYSCTL_INT(_hw_usb2_uchcom, OID_AUTO, debug, CTLFLAG_RW,
|
||||
#define UCHCOM_INTR_LEAST 4
|
||||
|
||||
#define UCHCOM_BULK_BUF_SIZE 1024 /* bytes */
|
||||
#define UCHCOM_N_TRANSFER 6 /* units */
|
||||
|
||||
enum {
|
||||
UCHCOM_BULK_DT_WR,
|
||||
UCHCOM_BULK_DT_RD,
|
||||
UCHCOM_BULK_CS_WR,
|
||||
UCHCOM_BULK_CS_RD,
|
||||
UCHCOM_INTR_DT_RD,
|
||||
UCHCOM_INTR_CS_RD,
|
||||
UCHCOM_N_TRANSFER = 6,
|
||||
};
|
||||
|
||||
struct uchcom_softc {
|
||||
struct usb2_com_super_softc sc_super_ucom;
|
||||
@ -229,7 +238,7 @@ static usb2_callback_t uchcom_read_clear_stall_callback;
|
||||
|
||||
static const struct usb2_config uchcom_config_data[UCHCOM_N_TRANSFER] = {
|
||||
|
||||
[0] = {
|
||||
[UCHCOM_BULK_DT_WR] = {
|
||||
.type = UE_BULK,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_OUT,
|
||||
@ -238,7 +247,7 @@ static const struct usb2_config uchcom_config_data[UCHCOM_N_TRANSFER] = {
|
||||
.mh.callback = &uchcom_write_callback,
|
||||
},
|
||||
|
||||
[1] = {
|
||||
[UCHCOM_BULK_DT_RD] = {
|
||||
.type = UE_BULK,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_IN,
|
||||
@ -247,7 +256,7 @@ static const struct usb2_config uchcom_config_data[UCHCOM_N_TRANSFER] = {
|
||||
.mh.callback = &uchcom_read_callback,
|
||||
},
|
||||
|
||||
[2] = {
|
||||
[UCHCOM_BULK_CS_WR] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -257,7 +266,7 @@ static const struct usb2_config uchcom_config_data[UCHCOM_N_TRANSFER] = {
|
||||
.mh.interval = 50, /* 50ms */
|
||||
},
|
||||
|
||||
[3] = {
|
||||
[UCHCOM_BULK_CS_RD] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -267,7 +276,7 @@ static const struct usb2_config uchcom_config_data[UCHCOM_N_TRANSFER] = {
|
||||
.mh.interval = 50, /* 50ms */
|
||||
},
|
||||
|
||||
[4] = {
|
||||
[UCHCOM_INTR_DT_RD] = {
|
||||
.type = UE_INTERRUPT,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_IN,
|
||||
@ -276,7 +285,7 @@ static const struct usb2_config uchcom_config_data[UCHCOM_N_TRANSFER] = {
|
||||
.mh.callback = &uchcom_intr_callback,
|
||||
},
|
||||
|
||||
[5] = {
|
||||
[UCHCOM_INTR_CS_RD] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -791,10 +800,10 @@ uchcom_start_read(struct usb2_com_softc *ucom)
|
||||
struct uchcom_softc *sc = ucom->sc_parent;
|
||||
|
||||
/* start interrupt endpoint */
|
||||
usb2_transfer_start(sc->sc_xfer[4]);
|
||||
usb2_transfer_start(sc->sc_xfer[UCHCOM_INTR_DT_RD]);
|
||||
|
||||
/* start read endpoint */
|
||||
usb2_transfer_start(sc->sc_xfer[1]);
|
||||
usb2_transfer_start(sc->sc_xfer[UCHCOM_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -803,11 +812,11 @@ uchcom_stop_read(struct usb2_com_softc *ucom)
|
||||
struct uchcom_softc *sc = ucom->sc_parent;
|
||||
|
||||
/* stop interrupt endpoint */
|
||||
usb2_transfer_stop(sc->sc_xfer[4]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UCHCOM_INTR_DT_RD]);
|
||||
|
||||
/* stop read endpoint */
|
||||
usb2_transfer_stop(sc->sc_xfer[3]);
|
||||
usb2_transfer_stop(sc->sc_xfer[1]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UCHCOM_BULK_CS_RD]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UCHCOM_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -815,7 +824,7 @@ uchcom_start_write(struct usb2_com_softc *ucom)
|
||||
{
|
||||
struct uchcom_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[0]);
|
||||
usb2_transfer_start(sc->sc_xfer[UCHCOM_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -823,8 +832,8 @@ uchcom_stop_write(struct usb2_com_softc *ucom)
|
||||
{
|
||||
struct uchcom_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[2]);
|
||||
usb2_transfer_stop(sc->sc_xfer[0]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UCHCOM_BULK_CS_WR]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UCHCOM_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
@ -854,7 +863,7 @@ uchcom_intr_callback(struct usb2_xfer *xfer)
|
||||
}
|
||||
case USB_ST_SETUP:
|
||||
if (sc->sc_flag & UCHCOM_FLAG_INTR_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer[5]);
|
||||
usb2_transfer_start(sc->sc_xfer[UCHCOM_INTR_CS_RD]);
|
||||
} else {
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
@ -864,7 +873,7 @@ uchcom_intr_callback(struct usb2_xfer *xfer)
|
||||
default: /* Error */
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
sc->sc_flag |= UCHCOM_FLAG_INTR_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer[5]);
|
||||
usb2_transfer_start(sc->sc_xfer[UCHCOM_INTR_CS_RD]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -874,7 +883,7 @@ static void
|
||||
uchcom_intr_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct uchcom_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[4];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[UCHCOM_INTR_DT_RD];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
@ -893,7 +902,7 @@ uchcom_write_callback(struct usb2_xfer *xfer)
|
||||
case USB_ST_SETUP:
|
||||
case USB_ST_TRANSFERRED:
|
||||
if (sc->sc_flag & UCHCOM_FLAG_WRITE_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer[2]);
|
||||
usb2_transfer_start(sc->sc_xfer[UCHCOM_BULK_CS_WR]);
|
||||
return;
|
||||
}
|
||||
if (usb2_com_get_data(&sc->sc_ucom, xfer->frbuffers, 0,
|
||||
@ -909,7 +918,7 @@ uchcom_write_callback(struct usb2_xfer *xfer)
|
||||
default: /* Error */
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
sc->sc_flag |= UCHCOM_FLAG_WRITE_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer[2]);
|
||||
usb2_transfer_start(sc->sc_xfer[UCHCOM_BULK_CS_WR]);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -920,7 +929,7 @@ static void
|
||||
uchcom_write_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct uchcom_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[0];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[UCHCOM_BULK_DT_WR];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
@ -940,7 +949,7 @@ uchcom_read_callback(struct usb2_xfer *xfer)
|
||||
|
||||
case USB_ST_SETUP:
|
||||
if (sc->sc_flag & UCHCOM_FLAG_READ_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer[3]);
|
||||
usb2_transfer_start(sc->sc_xfer[UCHCOM_BULK_CS_RD]);
|
||||
} else {
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
@ -950,7 +959,7 @@ uchcom_read_callback(struct usb2_xfer *xfer)
|
||||
default: /* Error */
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
sc->sc_flag |= UCHCOM_FLAG_READ_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer[3]);
|
||||
usb2_transfer_start(sc->sc_xfer[UCHCOM_BULK_CS_RD]);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -961,7 +970,7 @@ static void
|
||||
uchcom_read_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct uchcom_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[1];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[UCHCOM_BULK_DT_RD];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
|
@ -57,15 +57,21 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#define UCYCOM_MAX_IOLEN (1024 + 2) /* bytes */
|
||||
|
||||
#define UCYCOM_ENDPT_MAX 3 /* units */
|
||||
#define UCYCOM_IFACE_INDEX 0
|
||||
|
||||
enum {
|
||||
UCYCOM_CTRL_RD,
|
||||
UCYCOM_INTR_RD,
|
||||
UCYCOM_INTR_CS,
|
||||
UCYCOM_N_TRANSFER = 3,
|
||||
};
|
||||
|
||||
struct ucycom_softc {
|
||||
struct usb2_com_super_softc sc_super_ucom;
|
||||
struct usb2_com_softc sc_ucom;
|
||||
|
||||
struct usb2_device *sc_udev;
|
||||
struct usb2_xfer *sc_xfer[UCYCOM_ENDPT_MAX];
|
||||
struct usb2_xfer *sc_xfer[UCYCOM_N_TRANSFER];
|
||||
|
||||
uint32_t sc_model;
|
||||
#define MODEL_CY7C63743 0x63743
|
||||
@ -111,9 +117,9 @@ static void ucycom_cfg_write(struct ucycom_softc *, uint32_t, uint8_t);
|
||||
static int ucycom_pre_param(struct usb2_com_softc *, struct termios *);
|
||||
static void ucycom_cfg_param(struct usb2_com_softc *, struct termios *);
|
||||
|
||||
static const struct usb2_config ucycom_config[UCYCOM_ENDPT_MAX] = {
|
||||
static const struct usb2_config ucycom_config[UCYCOM_N_TRANSFER] = {
|
||||
|
||||
[0] = {
|
||||
[UCYCOM_CTRL_RD] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -123,7 +129,7 @@ static const struct usb2_config ucycom_config[UCYCOM_ENDPT_MAX] = {
|
||||
.mh.timeout = 1000, /* 1 second */
|
||||
},
|
||||
|
||||
[1] = {
|
||||
[UCYCOM_INTR_RD] = {
|
||||
.type = UE_INTERRUPT,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_IN,
|
||||
@ -132,7 +138,7 @@ static const struct usb2_config ucycom_config[UCYCOM_ENDPT_MAX] = {
|
||||
.mh.callback = &ucycom_intr_read_callback,
|
||||
},
|
||||
|
||||
[2] = {
|
||||
[UCYCOM_INTR_CS] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -261,7 +267,7 @@ ucycom_attach(device_t dev)
|
||||
|
||||
iface_index = UCYCOM_IFACE_INDEX;
|
||||
error = usb2_transfer_setup(uaa->device, &iface_index,
|
||||
sc->sc_xfer, ucycom_config, UCYCOM_ENDPT_MAX,
|
||||
sc->sc_xfer, ucycom_config, UCYCOM_N_TRANSFER,
|
||||
sc, &Giant);
|
||||
if (error) {
|
||||
device_printf(dev, "allocating USB "
|
||||
@ -294,7 +300,7 @@ ucycom_detach(device_t dev)
|
||||
|
||||
usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
|
||||
|
||||
usb2_transfer_unsetup(sc->sc_xfer, UCYCOM_ENDPT_MAX);
|
||||
usb2_transfer_unsetup(sc->sc_xfer, UCYCOM_N_TRANSFER);
|
||||
|
||||
return (0);
|
||||
}
|
||||
@ -313,7 +319,7 @@ ucycom_start_read(struct usb2_com_softc *ucom)
|
||||
{
|
||||
struct ucycom_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[1]);
|
||||
usb2_transfer_start(sc->sc_xfer[UCYCOM_INTR_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -321,8 +327,8 @@ ucycom_stop_read(struct usb2_com_softc *ucom)
|
||||
{
|
||||
struct ucycom_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[2]);
|
||||
usb2_transfer_stop(sc->sc_xfer[1]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UCYCOM_INTR_CS]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UCYCOM_INTR_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -330,7 +336,7 @@ ucycom_start_write(struct usb2_com_softc *ucom)
|
||||
{
|
||||
struct ucycom_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[0]);
|
||||
usb2_transfer_start(sc->sc_xfer[UCYCOM_CTRL_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -338,7 +344,7 @@ ucycom_stop_write(struct usb2_com_softc *ucom)
|
||||
{
|
||||
struct ucycom_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[0]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UCYCOM_CTRL_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -514,7 +520,7 @@ static void
|
||||
ucycom_intr_read_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct ucycom_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[1];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[UCYCOM_INTR_RD];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
@ -579,7 +585,7 @@ ucycom_intr_read_callback(struct usb2_xfer *xfer)
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
if (sc->sc_flags & UCYCOM_FLAG_INTR_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer[2]);
|
||||
usb2_transfer_start(sc->sc_xfer[UCYCOM_INTR_CS]);
|
||||
} else {
|
||||
xfer->frlengths[0] = sc->sc_ilen;
|
||||
usb2_start_hardware(xfer);
|
||||
@ -589,7 +595,7 @@ ucycom_intr_read_callback(struct usb2_xfer *xfer)
|
||||
default: /* Error */
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
sc->sc_flags |= UCYCOM_FLAG_INTR_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer[2]);
|
||||
usb2_transfer_start(sc->sc_xfer[UCYCOM_INTR_CS]);
|
||||
}
|
||||
return;
|
||||
|
||||
|
@ -77,19 +77,26 @@ SYSCTL_INT(_hw_usb2_uftdi, OID_AUTO, debug, CTLFLAG_RW,
|
||||
|
||||
#define UFTDI_CONFIG_INDEX 0
|
||||
#define UFTDI_IFACE_INDEX 0
|
||||
#define UFTDI_ENDPT_MAX 4
|
||||
|
||||
#define UFTDI_IBUFSIZE 64 /* bytes, maximum number of bytes per
|
||||
* frame */
|
||||
#define UFTDI_OBUFSIZE 64 /* bytes, cannot be increased due to
|
||||
* do size encoding */
|
||||
|
||||
enum {
|
||||
UFTDI_BULK_DT_WR,
|
||||
UFTDI_BULK_DT_RD,
|
||||
UFTDI_BULK_CS_WR,
|
||||
UFTDI_BULK_CS_RD,
|
||||
UFTDI_N_TRANSFER = 4,
|
||||
};
|
||||
|
||||
struct uftdi_softc {
|
||||
struct usb2_com_super_softc sc_super_ucom;
|
||||
struct usb2_com_softc sc_ucom;
|
||||
|
||||
struct usb2_device *sc_udev;
|
||||
struct usb2_xfer *sc_xfer[UFTDI_ENDPT_MAX];
|
||||
struct usb2_xfer *sc_xfer[UFTDI_N_TRANSFER];
|
||||
device_t sc_dev;
|
||||
|
||||
uint32_t sc_unit;
|
||||
@ -147,9 +154,9 @@ static void uftdi_start_write(struct usb2_com_softc *);
|
||||
static void uftdi_stop_write(struct usb2_com_softc *);
|
||||
static uint8_t uftdi_8u232am_getrate(uint32_t, uint16_t *);
|
||||
|
||||
static const struct usb2_config uftdi_config[UFTDI_ENDPT_MAX] = {
|
||||
static const struct usb2_config uftdi_config[UFTDI_N_TRANSFER] = {
|
||||
|
||||
[0] = {
|
||||
[UFTDI_BULK_DT_WR] = {
|
||||
.type = UE_BULK,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_OUT,
|
||||
@ -158,7 +165,7 @@ static const struct usb2_config uftdi_config[UFTDI_ENDPT_MAX] = {
|
||||
.mh.callback = &uftdi_write_callback,
|
||||
},
|
||||
|
||||
[1] = {
|
||||
[UFTDI_BULK_DT_RD] = {
|
||||
.type = UE_BULK,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_IN,
|
||||
@ -167,7 +174,7 @@ static const struct usb2_config uftdi_config[UFTDI_ENDPT_MAX] = {
|
||||
.mh.callback = &uftdi_read_callback,
|
||||
},
|
||||
|
||||
[2] = {
|
||||
[UFTDI_BULK_CS_WR] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -178,7 +185,7 @@ static const struct usb2_config uftdi_config[UFTDI_ENDPT_MAX] = {
|
||||
.mh.interval = 50, /* 50ms */
|
||||
},
|
||||
|
||||
[3] = {
|
||||
[UFTDI_BULK_CS_RD] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -308,7 +315,7 @@ uftdi_attach(device_t dev)
|
||||
|
||||
error = usb2_transfer_setup(uaa->device,
|
||||
&sc->sc_iface_index, sc->sc_xfer, uftdi_config,
|
||||
UFTDI_ENDPT_MAX, sc, &Giant);
|
||||
UFTDI_N_TRANSFER, sc, &Giant);
|
||||
|
||||
if (error) {
|
||||
device_printf(dev, "allocating USB "
|
||||
@ -348,7 +355,7 @@ uftdi_detach(device_t dev)
|
||||
|
||||
usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
|
||||
|
||||
usb2_transfer_unsetup(sc->sc_xfer, UFTDI_ENDPT_MAX);
|
||||
usb2_transfer_unsetup(sc->sc_xfer, UFTDI_N_TRANSFER);
|
||||
|
||||
return (0);
|
||||
}
|
||||
@ -425,7 +432,7 @@ uftdi_write_callback(struct usb2_xfer *xfer)
|
||||
case USB_ST_SETUP:
|
||||
case USB_ST_TRANSFERRED:
|
||||
if (sc->sc_flag & UFTDI_FLAG_WRITE_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer[2]);
|
||||
usb2_transfer_start(sc->sc_xfer[UFTDI_BULK_CS_WR]);
|
||||
return;
|
||||
}
|
||||
if (usb2_com_get_data(&sc->sc_ucom, xfer->frbuffers,
|
||||
@ -445,7 +452,7 @@ uftdi_write_callback(struct usb2_xfer *xfer)
|
||||
default: /* Error */
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
sc->sc_flag |= UFTDI_FLAG_WRITE_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer[2]);
|
||||
usb2_transfer_start(sc->sc_xfer[UFTDI_BULK_CS_WR]);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -456,7 +463,7 @@ static void
|
||||
uftdi_write_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct uftdi_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[0];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[UFTDI_BULK_DT_WR];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
@ -515,7 +522,7 @@ uftdi_read_callback(struct usb2_xfer *xfer)
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
if (sc->sc_flag & UFTDI_FLAG_READ_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer[3]);
|
||||
usb2_transfer_start(sc->sc_xfer[UFTDI_BULK_CS_RD]);
|
||||
} else {
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
@ -525,7 +532,7 @@ uftdi_read_callback(struct usb2_xfer *xfer)
|
||||
default: /* Error */
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
sc->sc_flag |= UFTDI_FLAG_READ_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer[3]);
|
||||
usb2_transfer_start(sc->sc_xfer[UFTDI_BULK_CS_RD]);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -536,7 +543,7 @@ static void
|
||||
uftdi_read_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct uftdi_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[1];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[UFTDI_BULK_DT_RD];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
@ -768,7 +775,7 @@ uftdi_start_read(struct usb2_com_softc *ucom)
|
||||
{
|
||||
struct uftdi_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[1]);
|
||||
usb2_transfer_start(sc->sc_xfer[UFTDI_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -776,8 +783,8 @@ uftdi_stop_read(struct usb2_com_softc *ucom)
|
||||
{
|
||||
struct uftdi_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[3]);
|
||||
usb2_transfer_stop(sc->sc_xfer[1]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UFTDI_BULK_CS_RD]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UFTDI_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -785,7 +792,7 @@ uftdi_start_write(struct usb2_com_softc *ucom)
|
||||
{
|
||||
struct uftdi_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[0]);
|
||||
usb2_transfer_start(sc->sc_xfer[UFTDI_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -793,8 +800,8 @@ uftdi_stop_write(struct usb2_com_softc *ucom)
|
||||
{
|
||||
struct uftdi_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[2]);
|
||||
usb2_transfer_stop(sc->sc_xfer[0]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UFTDI_BULK_CS_WR]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UFTDI_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
|
@ -62,11 +62,18 @@
|
||||
#include <dev/usb2/serial/usb2_serial.h>
|
||||
|
||||
#define UGENSA_BUF_SIZE 2048 /* bytes */
|
||||
#define UGENSA_N_TRANSFER 4 /* units */
|
||||
#define UGENSA_CONFIG_INDEX 0
|
||||
#define UGENSA_IFACE_INDEX 0
|
||||
#define UGENSA_IFACE_MAX 8 /* exclusivly */
|
||||
|
||||
enum {
|
||||
UGENSA_BULK_DT_WR,
|
||||
UGENSA_BULK_DT_RD,
|
||||
UGENSA_BULK_CS_WR,
|
||||
UGENSA_BULK_CS_RD,
|
||||
UGENSA_N_TRANSFER = 4,
|
||||
};
|
||||
|
||||
struct ugensa_sub_softc {
|
||||
struct usb2_com_softc *sc_usb2_com_ptr;
|
||||
struct usb2_xfer *sc_xfer[UGENSA_N_TRANSFER];
|
||||
@ -104,7 +111,7 @@ static void ugensa_stop_write(struct usb2_com_softc *);
|
||||
static const struct usb2_config
|
||||
ugensa_xfer_config[UGENSA_N_TRANSFER] = {
|
||||
|
||||
[0] = {
|
||||
[UGENSA_BULK_DT_WR] = {
|
||||
.type = UE_BULK,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_OUT,
|
||||
@ -113,7 +120,7 @@ static const struct usb2_config
|
||||
.mh.callback = &ugensa_bulk_write_callback,
|
||||
},
|
||||
|
||||
[1] = {
|
||||
[UGENSA_BULK_DT_RD] = {
|
||||
.type = UE_BULK,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_IN,
|
||||
@ -122,7 +129,7 @@ static const struct usb2_config
|
||||
.mh.callback = &ugensa_bulk_read_callback,
|
||||
},
|
||||
|
||||
[2] = {
|
||||
[UGENSA_BULK_CS_WR] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -133,7 +140,7 @@ static const struct usb2_config
|
||||
.mh.interval = 50, /* 50ms */
|
||||
},
|
||||
|
||||
[3] = {
|
||||
[UGENSA_BULK_CS_RD] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -298,7 +305,7 @@ ugensa_bulk_write_callback(struct usb2_xfer *xfer)
|
||||
case USB_ST_SETUP:
|
||||
case USB_ST_TRANSFERRED:
|
||||
if (ssc->sc_flags & UGENSA_FLAG_BULK_WRITE_STALL) {
|
||||
usb2_transfer_start(ssc->sc_xfer[2]);
|
||||
usb2_transfer_start(ssc->sc_xfer[UGENSA_BULK_CS_WR]);
|
||||
return;
|
||||
}
|
||||
if (usb2_com_get_data(ssc->sc_usb2_com_ptr, xfer->frbuffers, 0,
|
||||
@ -311,7 +318,7 @@ ugensa_bulk_write_callback(struct usb2_xfer *xfer)
|
||||
default: /* Error */
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
ssc->sc_flags |= UGENSA_FLAG_BULK_WRITE_STALL;
|
||||
usb2_transfer_start(ssc->sc_xfer[2]);
|
||||
usb2_transfer_start(ssc->sc_xfer[UGENSA_BULK_CS_WR]);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -322,7 +329,7 @@ static void
|
||||
ugensa_bulk_write_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct ugensa_sub_softc *ssc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = ssc->sc_xfer[0];
|
||||
struct usb2_xfer *xfer_other = ssc->sc_xfer[UGENSA_BULK_DT_WR];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
@ -343,7 +350,7 @@ ugensa_bulk_read_callback(struct usb2_xfer *xfer)
|
||||
|
||||
case USB_ST_SETUP:
|
||||
if (ssc->sc_flags & UGENSA_FLAG_BULK_READ_STALL) {
|
||||
usb2_transfer_start(ssc->sc_xfer[3]);
|
||||
usb2_transfer_start(ssc->sc_xfer[UGENSA_BULK_CS_RD]);
|
||||
} else {
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
@ -353,7 +360,7 @@ ugensa_bulk_read_callback(struct usb2_xfer *xfer)
|
||||
default: /* Error */
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
ssc->sc_flags |= UGENSA_FLAG_BULK_READ_STALL;
|
||||
usb2_transfer_start(ssc->sc_xfer[3]);
|
||||
usb2_transfer_start(ssc->sc_xfer[UGENSA_BULK_CS_RD]);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -364,7 +371,7 @@ static void
|
||||
ugensa_bulk_read_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct ugensa_sub_softc *ssc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = ssc->sc_xfer[1];
|
||||
struct usb2_xfer *xfer_other = ssc->sc_xfer[UGENSA_BULK_DT_RD];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
@ -379,7 +386,7 @@ ugensa_start_read(struct usb2_com_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[1]);
|
||||
usb2_transfer_start(ssc->sc_xfer[UGENSA_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -388,8 +395,8 @@ ugensa_stop_read(struct usb2_com_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[3]);
|
||||
usb2_transfer_stop(ssc->sc_xfer[1]);
|
||||
usb2_transfer_stop(ssc->sc_xfer[UGENSA_BULK_CS_RD]);
|
||||
usb2_transfer_stop(ssc->sc_xfer[UGENSA_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -398,7 +405,7 @@ ugensa_start_write(struct usb2_com_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[0]);
|
||||
usb2_transfer_start(ssc->sc_xfer[UGENSA_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -407,6 +414,6 @@ ugensa_stop_write(struct usb2_com_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[2]);
|
||||
usb2_transfer_stop(ssc->sc_xfer[0]);
|
||||
usb2_transfer_stop(ssc->sc_xfer[UGENSA_BULK_CS_WR]);
|
||||
usb2_transfer_stop(ssc->sc_xfer[UGENSA_BULK_DT_WR]);
|
||||
}
|
||||
|
@ -73,13 +73,20 @@ __FBSDID("$FreeBSD$");
|
||||
#define UIPAQ_IFACE_INDEX 0
|
||||
|
||||
#define UIPAQ_BUF_SIZE 1024
|
||||
#define UIPAQ_N_DATA_TRANSFER 4
|
||||
|
||||
enum {
|
||||
UIPAQ_BULK_DT_WR,
|
||||
UIPAQ_BULK_DT_RD,
|
||||
UIPAQ_BULK_CS_WR,
|
||||
UIPAQ_BULK_CS_RD,
|
||||
UIPAQ_N_TRANSFER = 4,
|
||||
};
|
||||
|
||||
struct uipaq_softc {
|
||||
struct usb2_com_super_softc sc_super_ucom;
|
||||
struct usb2_com_softc sc_ucom;
|
||||
|
||||
struct usb2_xfer *sc_xfer_data[UIPAQ_N_DATA_TRANSFER];
|
||||
struct usb2_xfer *sc_xfer[UIPAQ_N_TRANSFER];
|
||||
struct usb2_device *sc_udev;
|
||||
|
||||
uint16_t sc_line;
|
||||
@ -111,9 +118,9 @@ static void uipaq_cfg_set_dtr(struct usb2_com_softc *, uint8_t);
|
||||
static void uipaq_cfg_set_rts(struct usb2_com_softc *, uint8_t);
|
||||
static void uipaq_cfg_set_break(struct usb2_com_softc *, uint8_t);
|
||||
|
||||
static const struct usb2_config uipaq_config_data[UIPAQ_N_DATA_TRANSFER] = {
|
||||
static const struct usb2_config uipaq_config_data[UIPAQ_N_TRANSFER] = {
|
||||
|
||||
[0] = {
|
||||
[UIPAQ_BULK_DT_WR] = {
|
||||
.type = UE_BULK,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_OUT,
|
||||
@ -122,7 +129,7 @@ static const struct usb2_config uipaq_config_data[UIPAQ_N_DATA_TRANSFER] = {
|
||||
.mh.callback = &uipaq_write_callback,
|
||||
},
|
||||
|
||||
[1] = {
|
||||
[UIPAQ_BULK_DT_RD] = {
|
||||
.type = UE_BULK,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_IN,
|
||||
@ -131,7 +138,7 @@ static const struct usb2_config uipaq_config_data[UIPAQ_N_DATA_TRANSFER] = {
|
||||
.mh.callback = &uipaq_read_callback,
|
||||
},
|
||||
|
||||
[2] = {
|
||||
[UIPAQ_BULK_CS_WR] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -141,7 +148,7 @@ static const struct usb2_config uipaq_config_data[UIPAQ_N_DATA_TRANSFER] = {
|
||||
.mh.interval = 50, /* 50ms */
|
||||
},
|
||||
|
||||
[3] = {
|
||||
[UIPAQ_BULK_CS_RD] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -1150,8 +1157,8 @@ uipaq_attach(device_t dev)
|
||||
|
||||
iface_index = UIPAQ_IFACE_INDEX;
|
||||
error = usb2_transfer_setup(uaa->device, &iface_index,
|
||||
sc->sc_xfer_data, uipaq_config_data,
|
||||
UIPAQ_N_DATA_TRANSFER, sc, &Giant);
|
||||
sc->sc_xfer, uipaq_config_data,
|
||||
UIPAQ_N_TRANSFER, sc, &Giant);
|
||||
|
||||
if (error) {
|
||||
goto detach;
|
||||
@ -1179,7 +1186,7 @@ uipaq_detach(device_t dev)
|
||||
|
||||
usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
|
||||
|
||||
usb2_transfer_unsetup(sc->sc_xfer_data, UIPAQ_N_DATA_TRANSFER);
|
||||
usb2_transfer_unsetup(sc->sc_xfer, UIPAQ_N_TRANSFER);
|
||||
|
||||
return (0);
|
||||
}
|
||||
@ -1190,7 +1197,7 @@ uipaq_start_read(struct usb2_com_softc *ucom)
|
||||
struct uipaq_softc *sc = ucom->sc_parent;
|
||||
|
||||
/* start read endpoint */
|
||||
usb2_transfer_start(sc->sc_xfer_data[1]);
|
||||
usb2_transfer_start(sc->sc_xfer[UIPAQ_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1199,8 +1206,8 @@ uipaq_stop_read(struct usb2_com_softc *ucom)
|
||||
struct uipaq_softc *sc = ucom->sc_parent;
|
||||
|
||||
/* stop read endpoint */
|
||||
usb2_transfer_stop(sc->sc_xfer_data[3]);
|
||||
usb2_transfer_stop(sc->sc_xfer_data[1]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UIPAQ_BULK_CS_RD]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UIPAQ_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1208,7 +1215,7 @@ uipaq_start_write(struct usb2_com_softc *ucom)
|
||||
{
|
||||
struct uipaq_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer_data[0]);
|
||||
usb2_transfer_start(sc->sc_xfer[UIPAQ_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1216,8 +1223,8 @@ uipaq_stop_write(struct usb2_com_softc *ucom)
|
||||
{
|
||||
struct uipaq_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer_data[2]);
|
||||
usb2_transfer_stop(sc->sc_xfer_data[0]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UIPAQ_BULK_CS_WR]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UIPAQ_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1321,7 +1328,7 @@ uipaq_write_callback(struct usb2_xfer *xfer)
|
||||
case USB_ST_SETUP:
|
||||
case USB_ST_TRANSFERRED:
|
||||
if (sc->sc_flag & UIPAQ_FLAG_WRITE_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer_data[2]);
|
||||
usb2_transfer_start(sc->sc_xfer[UIPAQ_BULK_CS_WR]);
|
||||
return;
|
||||
}
|
||||
if (usb2_com_get_data(&sc->sc_ucom, xfer->frbuffers, 0,
|
||||
@ -1335,7 +1342,7 @@ uipaq_write_callback(struct usb2_xfer *xfer)
|
||||
default: /* Error */
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
sc->sc_flag |= UIPAQ_FLAG_WRITE_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer_data[2]);
|
||||
usb2_transfer_start(sc->sc_xfer[UIPAQ_BULK_CS_WR]);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -1346,7 +1353,7 @@ static void
|
||||
uipaq_write_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct uipaq_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer_data[0];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[UIPAQ_BULK_DT_WR];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
@ -1367,7 +1374,7 @@ uipaq_read_callback(struct usb2_xfer *xfer)
|
||||
|
||||
case USB_ST_SETUP:
|
||||
if (sc->sc_flag & UIPAQ_FLAG_READ_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer_data[3]);
|
||||
usb2_transfer_start(sc->sc_xfer[UIPAQ_BULK_CS_RD]);
|
||||
} else {
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
@ -1377,7 +1384,7 @@ uipaq_read_callback(struct usb2_xfer *xfer)
|
||||
default: /* Error */
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
sc->sc_flag |= UIPAQ_FLAG_READ_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer_data[3]);
|
||||
usb2_transfer_start(sc->sc_xfer[UIPAQ_BULK_CS_RD]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -1387,7 +1394,7 @@ static void
|
||||
uipaq_read_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct uipaq_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer_data[1];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[UIPAQ_BULK_DT_RD];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
|
@ -75,7 +75,6 @@ SYSCTL_INT(_hw_usb2_ulpt, OID_AUTO, debug, CTLFLAG_RW,
|
||||
|
||||
#define ULPT_BSIZE (1<<15) /* bytes */
|
||||
#define ULPT_IFQ_MAXLEN 2 /* units */
|
||||
#define ULPT_N_TRANSFER 5 /* units */
|
||||
|
||||
#define UR_GET_DEVICE_ID 0x00
|
||||
#define UR_GET_PORT_STATUS 0x01
|
||||
@ -87,6 +86,15 @@ SYSCTL_INT(_hw_usb2_ulpt, OID_AUTO, debug, CTLFLAG_RW,
|
||||
#define LPS_INVERT (LPS_SELECT|LPS_NERR)
|
||||
#define LPS_MASK (LPS_SELECT|LPS_NERR|LPS_NOPAPER)
|
||||
|
||||
enum {
|
||||
ULPT_BULK_DT_WR,
|
||||
ULPT_BULK_DT_RD,
|
||||
ULPT_INTR_DT_RD,
|
||||
ULPT_BULK_CS_WR,
|
||||
ULPT_BULK_CS_RD,
|
||||
ULPT_N_TRANSFER = 5,
|
||||
};
|
||||
|
||||
struct ulpt_softc {
|
||||
struct usb2_fifo_sc sc_fifo;
|
||||
struct usb2_fifo_sc sc_fifo_noreset;
|
||||
@ -207,7 +215,7 @@ ulpt_write_callback(struct usb2_xfer *xfer)
|
||||
case USB_ST_TRANSFERRED:
|
||||
case USB_ST_SETUP:
|
||||
if (sc->sc_flags & ULPT_FLAG_WRITE_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer[3]);
|
||||
usb2_transfer_start(sc->sc_xfer[ULPT_BULK_CS_WR]);
|
||||
break;
|
||||
}
|
||||
if (usb2_fifo_get_data(f, xfer->frbuffers,
|
||||
@ -222,7 +230,7 @@ ulpt_write_callback(struct usb2_xfer *xfer)
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
/* try to clear stall first */
|
||||
sc->sc_flags |= ULPT_FLAG_WRITE_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer[3]);
|
||||
usb2_transfer_start(sc->sc_xfer[ULPT_BULK_CS_WR]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -232,7 +240,7 @@ static void
|
||||
ulpt_write_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct ulpt_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[0];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[ULPT_BULK_DT_WR];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
@ -277,7 +285,7 @@ ulpt_read_callback(struct usb2_xfer *xfer)
|
||||
|
||||
case USB_ST_SETUP:
|
||||
if (sc->sc_flags & ULPT_FLAG_READ_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer[4]);
|
||||
usb2_transfer_start(sc->sc_xfer[ULPT_BULK_CS_RD]);
|
||||
break;
|
||||
}
|
||||
if (usb2_fifo_put_bytes_max(f) != 0) {
|
||||
@ -294,7 +302,7 @@ ulpt_read_callback(struct usb2_xfer *xfer)
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
/* try to clear stall first */
|
||||
sc->sc_flags |= ULPT_FLAG_READ_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer[4]);
|
||||
usb2_transfer_start(sc->sc_xfer[ULPT_BULK_CS_RD]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -304,7 +312,7 @@ static void
|
||||
ulpt_read_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct ulpt_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[1];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[ULPT_BULK_DT_RD];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
@ -367,7 +375,7 @@ ulpt_status_callback(struct usb2_xfer *xfer)
|
||||
}
|
||||
|
||||
static const struct usb2_config ulpt_config[ULPT_N_TRANSFER] = {
|
||||
[0] = {
|
||||
[ULPT_BULK_DT_WR] = {
|
||||
.type = UE_BULK,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_OUT,
|
||||
@ -376,7 +384,7 @@ static const struct usb2_config ulpt_config[ULPT_N_TRANSFER] = {
|
||||
.mh.callback = &ulpt_write_callback,
|
||||
},
|
||||
|
||||
[1] = {
|
||||
[ULPT_BULK_DT_RD] = {
|
||||
.type = UE_BULK,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_IN,
|
||||
@ -385,7 +393,7 @@ static const struct usb2_config ulpt_config[ULPT_N_TRANSFER] = {
|
||||
.mh.callback = &ulpt_read_callback,
|
||||
},
|
||||
|
||||
[2] = {
|
||||
[ULPT_INTR_DT_RD] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -394,7 +402,7 @@ static const struct usb2_config ulpt_config[ULPT_N_TRANSFER] = {
|
||||
.mh.timeout = 1000, /* 1 second */
|
||||
},
|
||||
|
||||
[3] = {
|
||||
[ULPT_BULK_CS_WR] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -404,7 +412,7 @@ static const struct usb2_config ulpt_config[ULPT_N_TRANSFER] = {
|
||||
.mh.interval = 50, /* 50ms */
|
||||
},
|
||||
|
||||
[4] = {
|
||||
[ULPT_BULK_CS_RD] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -420,7 +428,7 @@ ulpt_start_read(struct usb2_fifo *fifo)
|
||||
{
|
||||
struct ulpt_softc *sc = fifo->priv_sc0;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[1]);
|
||||
usb2_transfer_start(sc->sc_xfer[ULPT_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -428,8 +436,8 @@ ulpt_stop_read(struct usb2_fifo *fifo)
|
||||
{
|
||||
struct ulpt_softc *sc = fifo->priv_sc0;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[4]);
|
||||
usb2_transfer_stop(sc->sc_xfer[1]);
|
||||
usb2_transfer_stop(sc->sc_xfer[ULPT_BULK_CS_RD]);
|
||||
usb2_transfer_stop(sc->sc_xfer[ULPT_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -437,7 +445,7 @@ ulpt_start_write(struct usb2_fifo *fifo)
|
||||
{
|
||||
struct ulpt_softc *sc = fifo->priv_sc0;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[0]);
|
||||
usb2_transfer_start(sc->sc_xfer[ULPT_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -445,8 +453,8 @@ ulpt_stop_write(struct usb2_fifo *fifo)
|
||||
{
|
||||
struct ulpt_softc *sc = fifo->priv_sc0;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[3]);
|
||||
usb2_transfer_stop(sc->sc_xfer[0]);
|
||||
usb2_transfer_stop(sc->sc_xfer[ULPT_BULK_CS_WR]);
|
||||
usb2_transfer_stop(sc->sc_xfer[ULPT_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static int
|
||||
@ -476,7 +484,7 @@ unlpt_open(struct usb2_fifo *fifo, int fflags, struct thread *td)
|
||||
sc->sc_flags |= ULPT_FLAG_READ_STALL;
|
||||
mtx_unlock(&sc->sc_mtx);
|
||||
if (usb2_fifo_alloc_buffer(fifo,
|
||||
sc->sc_xfer[1]->max_data_length,
|
||||
sc->sc_xfer[ULPT_BULK_DT_RD]->max_data_length,
|
||||
ULPT_IFQ_MAXLEN)) {
|
||||
return (ENOMEM);
|
||||
}
|
||||
@ -489,7 +497,7 @@ unlpt_open(struct usb2_fifo *fifo, int fflags, struct thread *td)
|
||||
sc->sc_flags |= ULPT_FLAG_WRITE_STALL;
|
||||
mtx_unlock(&sc->sc_mtx);
|
||||
if (usb2_fifo_alloc_buffer(fifo,
|
||||
sc->sc_xfer[0]->max_data_length,
|
||||
sc->sc_xfer[ULPT_BULK_DT_WR]->max_data_length,
|
||||
ULPT_IFQ_MAXLEN)) {
|
||||
return (ENOMEM);
|
||||
}
|
||||
@ -755,7 +763,7 @@ ulpt_watchdog(void *arg)
|
||||
|
||||
mtx_assert(&sc->sc_mtx, MA_OWNED);
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[2]);
|
||||
usb2_transfer_start(sc->sc_xfer[ULPT_INTR_DT_RD]);
|
||||
|
||||
usb2_callout_reset(&sc->sc_watchdog,
|
||||
hz, &ulpt_watchdog, sc);
|
||||
|
@ -80,14 +80,22 @@ __FBSDID("$FreeBSD$");
|
||||
#define UMCT_IFACE_INDEX 0
|
||||
#define UMCT_CONFIG_INDEX 1
|
||||
|
||||
#define UMCT_ENDPT_MAX 6 /* units */
|
||||
enum {
|
||||
UMCT_BULK_DT_WR,
|
||||
UMCT_BULK_DT_RD,
|
||||
UMCT_BULK_CS_WR,
|
||||
UMCT_BULK_CS_RD,
|
||||
UMCT_INTR_DT_RD,
|
||||
UMCT_INTR_CS_RD,
|
||||
UMCT_N_TRANSFER = 6,
|
||||
};
|
||||
|
||||
struct umct_softc {
|
||||
struct usb2_com_super_softc sc_super_ucom;
|
||||
struct usb2_com_softc sc_ucom;
|
||||
|
||||
struct usb2_device *sc_udev;
|
||||
struct usb2_xfer *sc_xfer[UMCT_ENDPT_MAX];
|
||||
struct usb2_xfer *sc_xfer[UMCT_N_TRANSFER];
|
||||
|
||||
uint32_t sc_unit;
|
||||
|
||||
@ -134,9 +142,9 @@ static void umct_stop_read(struct usb2_com_softc *);
|
||||
static void umct_start_write(struct usb2_com_softc *);
|
||||
static void umct_stop_write(struct usb2_com_softc *);
|
||||
|
||||
static const struct usb2_config umct_config[UMCT_ENDPT_MAX] = {
|
||||
static const struct usb2_config umct_config[UMCT_N_TRANSFER] = {
|
||||
|
||||
[0] = {
|
||||
[UMCT_BULK_DT_WR] = {
|
||||
.type = UE_BULK,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_OUT,
|
||||
@ -145,7 +153,7 @@ static const struct usb2_config umct_config[UMCT_ENDPT_MAX] = {
|
||||
.mh.callback = &umct_write_callback,
|
||||
},
|
||||
|
||||
[1] = {
|
||||
[UMCT_BULK_DT_RD] = {
|
||||
.type = UE_INTERRUPT,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_IN,
|
||||
@ -155,7 +163,7 @@ static const struct usb2_config umct_config[UMCT_ENDPT_MAX] = {
|
||||
.ep_index = 0, /* first interrupt endpoint */
|
||||
},
|
||||
|
||||
[2] = {
|
||||
[UMCT_BULK_CS_WR] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -166,7 +174,7 @@ static const struct usb2_config umct_config[UMCT_ENDPT_MAX] = {
|
||||
.mh.interval = 50, /* 50ms */
|
||||
},
|
||||
|
||||
[3] = {
|
||||
[UMCT_BULK_CS_RD] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -177,7 +185,7 @@ static const struct usb2_config umct_config[UMCT_ENDPT_MAX] = {
|
||||
.mh.interval = 50, /* 50ms */
|
||||
},
|
||||
|
||||
[4] = {
|
||||
[UMCT_INTR_DT_RD] = {
|
||||
.type = UE_INTERRUPT,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_IN,
|
||||
@ -187,7 +195,7 @@ static const struct usb2_config umct_config[UMCT_ENDPT_MAX] = {
|
||||
.ep_index = 1, /* second interrupt endpoint */
|
||||
},
|
||||
|
||||
[5] = {
|
||||
[UMCT_INTR_CS_RD] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -280,7 +288,7 @@ umct_attach(device_t dev)
|
||||
|
||||
iface_index = UMCT_IFACE_INDEX;
|
||||
error = usb2_transfer_setup(uaa->device, &iface_index,
|
||||
sc->sc_xfer, umct_config, UMCT_ENDPT_MAX, sc, &Giant);
|
||||
sc->sc_xfer, umct_config, UMCT_N_TRANSFER, sc, &Giant);
|
||||
|
||||
if (error) {
|
||||
device_printf(dev, "allocating USB "
|
||||
@ -292,20 +300,20 @@ umct_attach(device_t dev)
|
||||
* The only way to differentiate it from the real interrupt
|
||||
* endpoint is to look at the wMaxPacketSize field.
|
||||
*/
|
||||
maxp = UGETW(sc->sc_xfer[1]->pipe->edesc->wMaxPacketSize);
|
||||
maxp = UGETW(sc->sc_xfer[UMCT_BULK_DT_RD]->pipe->edesc->wMaxPacketSize);
|
||||
if (maxp == 0x2) {
|
||||
|
||||
/* guessed wrong - switch around endpoints */
|
||||
|
||||
struct usb2_xfer *temp = sc->sc_xfer[4];
|
||||
struct usb2_xfer *temp = sc->sc_xfer[UMCT_INTR_DT_RD];
|
||||
|
||||
sc->sc_xfer[4] = sc->sc_xfer[1];
|
||||
sc->sc_xfer[1] = temp;
|
||||
sc->sc_xfer[UMCT_INTR_DT_RD] = sc->sc_xfer[UMCT_BULK_DT_RD];
|
||||
sc->sc_xfer[UMCT_BULK_DT_RD] = temp;
|
||||
|
||||
sc->sc_xfer[1]->callback = &umct_read_callback;
|
||||
sc->sc_xfer[4]->callback = &umct_intr_callback;
|
||||
sc->sc_xfer[UMCT_BULK_DT_RD]->callback = &umct_read_callback;
|
||||
sc->sc_xfer[UMCT_INTR_DT_RD]->callback = &umct_intr_callback;
|
||||
}
|
||||
sc->sc_obufsize = sc->sc_xfer[0]->max_data_length;
|
||||
sc->sc_obufsize = sc->sc_xfer[UMCT_BULK_DT_WR]->max_data_length;
|
||||
|
||||
if (uaa->info.idProduct == USB_PRODUCT_MCT_SITECOM_USB232) {
|
||||
if (sc->sc_obufsize > 16) {
|
||||
@ -331,7 +339,7 @@ umct_detach(device_t dev)
|
||||
|
||||
usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
|
||||
|
||||
usb2_transfer_unsetup(sc->sc_xfer, UMCT_ENDPT_MAX);
|
||||
usb2_transfer_unsetup(sc->sc_xfer, UMCT_N_TRANSFER);
|
||||
|
||||
return (0);
|
||||
}
|
||||
@ -373,7 +381,7 @@ static void
|
||||
umct_intr_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct umct_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[4];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[UMCT_INTR_DT_RD];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
@ -404,7 +412,7 @@ umct_intr_callback(struct usb2_xfer *xfer)
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
if (sc->sc_flags & UMCT_FLAG_INTR_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer[5]);
|
||||
usb2_transfer_start(sc->sc_xfer[UMCT_INTR_CS_RD]);
|
||||
} else {
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
@ -415,7 +423,7 @@ umct_intr_callback(struct usb2_xfer *xfer)
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
/* start clear stall */
|
||||
sc->sc_flags |= UMCT_FLAG_INTR_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer[5]);
|
||||
usb2_transfer_start(sc->sc_xfer[UMCT_INTR_CS_RD]);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -553,10 +561,10 @@ umct_start_read(struct usb2_com_softc *ucom)
|
||||
struct umct_softc *sc = ucom->sc_parent;
|
||||
|
||||
/* start interrupt endpoint */
|
||||
usb2_transfer_start(sc->sc_xfer[4]);
|
||||
usb2_transfer_start(sc->sc_xfer[UMCT_INTR_DT_RD]);
|
||||
|
||||
/* start read endpoint */
|
||||
usb2_transfer_start(sc->sc_xfer[1]);
|
||||
usb2_transfer_start(sc->sc_xfer[UMCT_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -565,12 +573,12 @@ umct_stop_read(struct usb2_com_softc *ucom)
|
||||
struct umct_softc *sc = ucom->sc_parent;
|
||||
|
||||
/* stop interrupt endpoint */
|
||||
usb2_transfer_stop(sc->sc_xfer[5]);
|
||||
usb2_transfer_stop(sc->sc_xfer[4]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UMCT_INTR_CS_RD]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UMCT_INTR_DT_RD]);
|
||||
|
||||
/* stop read endpoint */
|
||||
usb2_transfer_stop(sc->sc_xfer[3]);
|
||||
usb2_transfer_stop(sc->sc_xfer[1]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UMCT_BULK_CS_RD]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UMCT_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -578,7 +586,7 @@ umct_start_write(struct usb2_com_softc *ucom)
|
||||
{
|
||||
struct umct_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[0]);
|
||||
usb2_transfer_start(sc->sc_xfer[UMCT_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -586,8 +594,8 @@ umct_stop_write(struct usb2_com_softc *ucom)
|
||||
{
|
||||
struct umct_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[2]);
|
||||
usb2_transfer_stop(sc->sc_xfer[0]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UMCT_BULK_CS_WR]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UMCT_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -600,7 +608,7 @@ umct_write_callback(struct usb2_xfer *xfer)
|
||||
case USB_ST_SETUP:
|
||||
case USB_ST_TRANSFERRED:
|
||||
if (sc->sc_flags & UMCT_FLAG_WRITE_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer[2]);
|
||||
usb2_transfer_start(sc->sc_xfer[UMCT_BULK_CS_WR]);
|
||||
return;
|
||||
}
|
||||
if (usb2_com_get_data(&sc->sc_ucom, xfer->frbuffers, 0,
|
||||
@ -614,7 +622,7 @@ umct_write_callback(struct usb2_xfer *xfer)
|
||||
default: /* Error */
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
sc->sc_flags |= UMCT_FLAG_WRITE_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer[2]);
|
||||
usb2_transfer_start(sc->sc_xfer[UMCT_BULK_CS_WR]);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -625,7 +633,7 @@ static void
|
||||
umct_write_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct umct_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[0];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[UMCT_BULK_DT_WR];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
@ -646,7 +654,7 @@ umct_read_callback(struct usb2_xfer *xfer)
|
||||
|
||||
case USB_ST_SETUP:
|
||||
if (sc->sc_flags & UMCT_FLAG_READ_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer[3]);
|
||||
usb2_transfer_start(sc->sc_xfer[UMCT_BULK_CS_RD]);
|
||||
} else {
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
@ -656,7 +664,7 @@ umct_read_callback(struct usb2_xfer *xfer)
|
||||
default: /* Error */
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
sc->sc_flags |= UMCT_FLAG_READ_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer[3]);
|
||||
usb2_transfer_start(sc->sc_xfer[UMCT_BULK_CS_RD]);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -667,7 +675,7 @@ static void
|
||||
umct_read_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct umct_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[1];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[UMCT_BULK_DT_RD];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
|
@ -44,7 +44,6 @@ SYSCTL_INT(_hw_usb2_umoscom, OID_AUTO, debug, CTLFLAG_RW,
|
||||
#endif
|
||||
|
||||
#define UMOSCOM_BUFSIZE 1024 /* bytes */
|
||||
#define UMOSCOM_N_DATA_TRANSFER 6 /* units */
|
||||
|
||||
#define UMOSCOM_CONFIG_INDEX 0
|
||||
#define UMOSCOM_IFACE_INDEX 0
|
||||
@ -154,11 +153,21 @@ SYSCTL_INT(_hw_usb2_umoscom, OID_AUTO, debug, CTLFLAG_RW,
|
||||
|
||||
#define UMOSCOM_BAUD_REF 115200
|
||||
|
||||
enum {
|
||||
UMOSCOM_BULK_DT_WR,
|
||||
UMOSCOM_BULK_DT_RD,
|
||||
UMOSCOM_BULK_CS_WR,
|
||||
UMOSCOM_BULK_CS_RD,
|
||||
UMOSCOM_INTR_DT_RD,
|
||||
UMOSCOM_INTR_CS_RD,
|
||||
UMOSCOM_N_TRANSFER = 6,
|
||||
};
|
||||
|
||||
struct umoscom_softc {
|
||||
struct usb2_com_super_softc sc_super_ucom;
|
||||
struct usb2_com_softc sc_ucom;
|
||||
|
||||
struct usb2_xfer *sc_xfer_data[UMOSCOM_N_DATA_TRANSFER];
|
||||
struct usb2_xfer *sc_xfer[UMOSCOM_N_TRANSFER];
|
||||
struct usb2_device *sc_udev;
|
||||
|
||||
uint8_t sc_mcr;
|
||||
@ -200,9 +209,9 @@ static void umoscom_stop_read(struct usb2_com_softc *);
|
||||
static void umoscom_start_write(struct usb2_com_softc *);
|
||||
static void umoscom_stop_write(struct usb2_com_softc *);
|
||||
|
||||
static const struct usb2_config umoscom_config_data[UMOSCOM_N_DATA_TRANSFER] = {
|
||||
static const struct usb2_config umoscom_config_data[UMOSCOM_N_TRANSFER] = {
|
||||
|
||||
[0] = {
|
||||
[UMOSCOM_BULK_DT_WR] = {
|
||||
.type = UE_BULK,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_OUT,
|
||||
@ -211,7 +220,7 @@ static const struct usb2_config umoscom_config_data[UMOSCOM_N_DATA_TRANSFER] = {
|
||||
.mh.callback = &umoscom_write_callback,
|
||||
},
|
||||
|
||||
[1] = {
|
||||
[UMOSCOM_BULK_DT_RD] = {
|
||||
.type = UE_BULK,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_IN,
|
||||
@ -220,7 +229,7 @@ static const struct usb2_config umoscom_config_data[UMOSCOM_N_DATA_TRANSFER] = {
|
||||
.mh.callback = &umoscom_read_callback,
|
||||
},
|
||||
|
||||
[2] = {
|
||||
[UMOSCOM_BULK_CS_WR] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -230,7 +239,7 @@ static const struct usb2_config umoscom_config_data[UMOSCOM_N_DATA_TRANSFER] = {
|
||||
.mh.interval = 50, /* 50ms */
|
||||
},
|
||||
|
||||
[3] = {
|
||||
[UMOSCOM_BULK_CS_RD] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -240,7 +249,7 @@ static const struct usb2_config umoscom_config_data[UMOSCOM_N_DATA_TRANSFER] = {
|
||||
.mh.interval = 50, /* 50ms */
|
||||
},
|
||||
|
||||
[4] = {
|
||||
[UMOSCOM_INTR_DT_RD] = {
|
||||
.type = UE_INTERRUPT,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_IN,
|
||||
@ -249,7 +258,7 @@ static const struct usb2_config umoscom_config_data[UMOSCOM_N_DATA_TRANSFER] = {
|
||||
.mh.callback = &umoscom_intr_callback,
|
||||
},
|
||||
|
||||
[5] = {
|
||||
[UMOSCOM_INTR_CS_RD] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -338,8 +347,8 @@ umoscom_attach(device_t dev)
|
||||
|
||||
iface_index = UMOSCOM_IFACE_INDEX;
|
||||
error = usb2_transfer_setup(uaa->device, &iface_index,
|
||||
sc->sc_xfer_data, umoscom_config_data,
|
||||
UMOSCOM_N_DATA_TRANSFER, sc, &Giant);
|
||||
sc->sc_xfer, umoscom_config_data,
|
||||
UMOSCOM_N_TRANSFER, sc, &Giant);
|
||||
|
||||
if (error) {
|
||||
goto detach;
|
||||
@ -372,7 +381,7 @@ umoscom_detach(device_t dev)
|
||||
|
||||
usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
|
||||
|
||||
usb2_transfer_unsetup(sc->sc_xfer_data, UMOSCOM_N_DATA_TRANSFER);
|
||||
usb2_transfer_unsetup(sc->sc_xfer, UMOSCOM_N_TRANSFER);
|
||||
|
||||
return (0);
|
||||
}
|
||||
@ -606,10 +615,10 @@ umoscom_start_read(struct usb2_com_softc *ucom)
|
||||
|
||||
#if 0
|
||||
/* start interrupt endpoint */
|
||||
usb2_transfer_start(sc->sc_xfer_data[4]);
|
||||
usb2_transfer_start(sc->sc_xfer[UMOSCOM_INTR_DT_RD]);
|
||||
#endif
|
||||
/* start read endpoint */
|
||||
usb2_transfer_start(sc->sc_xfer_data[1]);
|
||||
usb2_transfer_start(sc->sc_xfer[UMOSCOM_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -618,12 +627,12 @@ umoscom_stop_read(struct usb2_com_softc *ucom)
|
||||
struct umoscom_softc *sc = ucom->sc_parent;
|
||||
|
||||
/* stop interrupt transfer */
|
||||
usb2_transfer_stop(sc->sc_xfer_data[5]);
|
||||
usb2_transfer_stop(sc->sc_xfer_data[4]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UMOSCOM_INTR_CS_RD]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UMOSCOM_INTR_DT_RD]);
|
||||
|
||||
/* stop read endpoint */
|
||||
usb2_transfer_stop(sc->sc_xfer_data[3]);
|
||||
usb2_transfer_stop(sc->sc_xfer_data[1]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UMOSCOM_BULK_CS_RD]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UMOSCOM_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -631,7 +640,7 @@ umoscom_start_write(struct usb2_com_softc *ucom)
|
||||
{
|
||||
struct umoscom_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer_data[0]);
|
||||
usb2_transfer_start(sc->sc_xfer[UMOSCOM_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -639,8 +648,8 @@ umoscom_stop_write(struct usb2_com_softc *ucom)
|
||||
{
|
||||
struct umoscom_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer_data[2]);
|
||||
usb2_transfer_stop(sc->sc_xfer_data[0]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UMOSCOM_BULK_CS_WR]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UMOSCOM_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -655,7 +664,7 @@ umoscom_write_callback(struct usb2_xfer *xfer)
|
||||
DPRINTF("\n");
|
||||
|
||||
if (sc->sc_flags & UMOSCOM_FLAG_WRITE_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer_data[2]);
|
||||
usb2_transfer_start(sc->sc_xfer[UMOSCOM_BULK_CS_WR]);
|
||||
return;
|
||||
}
|
||||
if (usb2_com_get_data(&sc->sc_ucom, xfer->frbuffers, 0,
|
||||
@ -670,7 +679,7 @@ umoscom_write_callback(struct usb2_xfer *xfer)
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
DPRINTFN(0, "transfer failed\n");
|
||||
sc->sc_flags |= UMOSCOM_FLAG_WRITE_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer_data[2]);
|
||||
usb2_transfer_start(sc->sc_xfer[UMOSCOM_BULK_CS_WR]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -680,7 +689,7 @@ static void
|
||||
umoscom_write_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct umoscom_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer_data[0];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[UMOSCOM_BULK_DT_WR];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
@ -703,7 +712,7 @@ umoscom_read_callback(struct usb2_xfer *xfer)
|
||||
DPRINTF("\n");
|
||||
|
||||
if (sc->sc_flags & UMOSCOM_FLAG_READ_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer_data[3]);
|
||||
usb2_transfer_start(sc->sc_xfer[UMOSCOM_BULK_CS_RD]);
|
||||
} else {
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
@ -714,7 +723,7 @@ umoscom_read_callback(struct usb2_xfer *xfer)
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
DPRINTFN(0, "transfer failed\n");
|
||||
sc->sc_flags |= UMOSCOM_FLAG_READ_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer_data[3]);
|
||||
usb2_transfer_start(sc->sc_xfer[UMOSCOM_BULK_CS_RD]);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -725,7 +734,7 @@ static void
|
||||
umoscom_read_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct umoscom_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer_data[1];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[UMOSCOM_BULK_DT_RD];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
@ -750,7 +759,7 @@ umoscom_intr_callback(struct usb2_xfer *xfer)
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
if (sc->sc_flags & UMOSCOM_FLAG_INTR_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer_data[5]);
|
||||
usb2_transfer_start(sc->sc_xfer[UMOSCOM_INTR_CS_RD]);
|
||||
} else {
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
@ -761,7 +770,7 @@ umoscom_intr_callback(struct usb2_xfer *xfer)
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
DPRINTFN(0, "transfer failed\n");
|
||||
sc->sc_flags |= UMOSCOM_FLAG_INTR_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer_data[5]);
|
||||
usb2_transfer_start(sc->sc_xfer[UMOSCOM_INTR_CS_RD]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -771,7 +780,7 @@ static void
|
||||
umoscom_intr_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct umoscom_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer_data[4];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[UMOSCOM_INTR_DT_RD];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
|
@ -121,7 +121,6 @@ SYSCTL_INT(_hw_usb2_uplcom, OID_AUTO, debug, CTLFLAG_RW,
|
||||
#endif
|
||||
|
||||
#define UPLCOM_BULK_BUF_SIZE 1024 /* bytes */
|
||||
#define UPLCOM_N_TRANSFER 6
|
||||
|
||||
#define UPLCOM_SET_REQUEST 0x01
|
||||
#define UPLCOM_SET_CRTSCTS 0x41
|
||||
@ -133,6 +132,16 @@ SYSCTL_INT(_hw_usb2_uplcom, OID_AUTO, debug, CTLFLAG_RW,
|
||||
#define TYPE_PL2303 0
|
||||
#define TYPE_PL2303X 1
|
||||
|
||||
enum {
|
||||
UPLCOM_BULK_DT_WR,
|
||||
UPLCOM_BULK_DT_RD,
|
||||
UPLCOM_BULK_CS_WR,
|
||||
UPLCOM_BULK_CS_RD,
|
||||
UPLCOM_INTR_DT_RD,
|
||||
UPLCOM_INTR_CS_RD,
|
||||
UPLCOM_N_TRANSFER = 6,
|
||||
};
|
||||
|
||||
struct uplcom_softc {
|
||||
struct usb2_com_super_softc sc_super_ucom;
|
||||
struct usb2_com_softc sc_ucom;
|
||||
@ -186,7 +195,7 @@ static usb2_callback_t uplcom_read_clear_stall_callback;
|
||||
|
||||
static const struct usb2_config uplcom_config_data[UPLCOM_N_TRANSFER] = {
|
||||
|
||||
[0] = {
|
||||
[UPLCOM_BULK_DT_WR] = {
|
||||
.type = UE_BULK,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_OUT,
|
||||
@ -196,7 +205,7 @@ static const struct usb2_config uplcom_config_data[UPLCOM_N_TRANSFER] = {
|
||||
.if_index = 0,
|
||||
},
|
||||
|
||||
[1] = {
|
||||
[UPLCOM_BULK_DT_RD] = {
|
||||
.type = UE_BULK,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_IN,
|
||||
@ -206,7 +215,7 @@ static const struct usb2_config uplcom_config_data[UPLCOM_N_TRANSFER] = {
|
||||
.if_index = 0,
|
||||
},
|
||||
|
||||
[2] = {
|
||||
[UPLCOM_BULK_CS_WR] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -217,7 +226,7 @@ static const struct usb2_config uplcom_config_data[UPLCOM_N_TRANSFER] = {
|
||||
.if_index = 0,
|
||||
},
|
||||
|
||||
[3] = {
|
||||
[UPLCOM_BULK_CS_RD] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -228,7 +237,7 @@ static const struct usb2_config uplcom_config_data[UPLCOM_N_TRANSFER] = {
|
||||
.if_index = 0,
|
||||
},
|
||||
|
||||
[4] = {
|
||||
[UPLCOM_INTR_DT_RD] = {
|
||||
.type = UE_INTERRUPT,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_IN,
|
||||
@ -238,7 +247,7 @@ static const struct usb2_config uplcom_config_data[UPLCOM_N_TRANSFER] = {
|
||||
.if_index = 1,
|
||||
},
|
||||
|
||||
[5] = {
|
||||
[UPLCOM_INTR_CS_RD] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -717,10 +726,10 @@ uplcom_start_read(struct usb2_com_softc *ucom)
|
||||
struct uplcom_softc *sc = ucom->sc_parent;
|
||||
|
||||
/* start interrupt endpoint */
|
||||
usb2_transfer_start(sc->sc_xfer[4]);
|
||||
usb2_transfer_start(sc->sc_xfer[UPLCOM_INTR_DT_RD]);
|
||||
|
||||
/* start read endpoint */
|
||||
usb2_transfer_start(sc->sc_xfer[1]);
|
||||
usb2_transfer_start(sc->sc_xfer[UPLCOM_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -729,11 +738,11 @@ uplcom_stop_read(struct usb2_com_softc *ucom)
|
||||
struct uplcom_softc *sc = ucom->sc_parent;
|
||||
|
||||
/* stop interrupt endpoint */
|
||||
usb2_transfer_stop(sc->sc_xfer[4]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UPLCOM_INTR_DT_RD]);
|
||||
|
||||
/* stop read endpoint */
|
||||
usb2_transfer_stop(sc->sc_xfer[3]);
|
||||
usb2_transfer_stop(sc->sc_xfer[1]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UPLCOM_BULK_CS_RD]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UPLCOM_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -741,7 +750,7 @@ uplcom_start_write(struct usb2_com_softc *ucom)
|
||||
{
|
||||
struct uplcom_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[0]);
|
||||
usb2_transfer_start(sc->sc_xfer[UPLCOM_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -749,8 +758,8 @@ uplcom_stop_write(struct usb2_com_softc *ucom)
|
||||
{
|
||||
struct uplcom_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[2]);
|
||||
usb2_transfer_stop(sc->sc_xfer[0]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UPLCOM_BULK_CS_WR]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UPLCOM_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -797,7 +806,7 @@ uplcom_intr_callback(struct usb2_xfer *xfer)
|
||||
}
|
||||
case USB_ST_SETUP:
|
||||
if (sc->sc_flag & UPLCOM_FLAG_INTR_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer[5]);
|
||||
usb2_transfer_start(sc->sc_xfer[UPLCOM_INTR_CS_RD]);
|
||||
} else {
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
@ -807,7 +816,7 @@ uplcom_intr_callback(struct usb2_xfer *xfer)
|
||||
default: /* Error */
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
sc->sc_flag |= UPLCOM_FLAG_INTR_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer[5]);
|
||||
usb2_transfer_start(sc->sc_xfer[UPLCOM_INTR_CS_RD]);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -818,7 +827,7 @@ static void
|
||||
uplcom_intr_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct uplcom_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[4];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[UPLCOM_INTR_DT_RD];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
@ -837,7 +846,7 @@ uplcom_write_callback(struct usb2_xfer *xfer)
|
||||
case USB_ST_SETUP:
|
||||
case USB_ST_TRANSFERRED:
|
||||
if (sc->sc_flag & UPLCOM_FLAG_WRITE_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer[2]);
|
||||
usb2_transfer_start(sc->sc_xfer[UPLCOM_BULK_CS_WR]);
|
||||
return;
|
||||
}
|
||||
if (usb2_com_get_data(&sc->sc_ucom, xfer->frbuffers, 0,
|
||||
@ -853,7 +862,7 @@ uplcom_write_callback(struct usb2_xfer *xfer)
|
||||
default: /* Error */
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
sc->sc_flag |= UPLCOM_FLAG_WRITE_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer[2]);
|
||||
usb2_transfer_start(sc->sc_xfer[UPLCOM_BULK_CS_WR]);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -864,7 +873,7 @@ static void
|
||||
uplcom_write_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct uplcom_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[0];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[UPLCOM_BULK_DT_WR];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
@ -884,7 +893,7 @@ uplcom_read_callback(struct usb2_xfer *xfer)
|
||||
|
||||
case USB_ST_SETUP:
|
||||
if (sc->sc_flag & UPLCOM_FLAG_READ_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer[3]);
|
||||
usb2_transfer_start(sc->sc_xfer[UPLCOM_BULK_CS_RD]);
|
||||
} else {
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
@ -894,7 +903,7 @@ uplcom_read_callback(struct usb2_xfer *xfer)
|
||||
default: /* Error */
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
sc->sc_flag |= UPLCOM_FLAG_READ_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer[3]);
|
||||
usb2_transfer_start(sc->sc_xfer[UPLCOM_BULK_CS_RD]);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -905,7 +914,7 @@ static void
|
||||
uplcom_read_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct uplcom_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[1];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[UPLCOM_BULK_DT_RD];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
|
@ -83,7 +83,6 @@ SYSCTL_INT(_hw_usb2_uvisor, OID_AUTO, debug, CTLFLAG_RW,
|
||||
|
||||
#define UVISOR_CONFIG_INDEX 0
|
||||
#define UVISOR_IFACE_INDEX 0
|
||||
#define UVISOR_N_TRANSFER 4 /* units */
|
||||
#define UVISOR_BUFSIZE 1024 /* bytes */
|
||||
|
||||
/* From the Linux driver */
|
||||
@ -149,6 +148,14 @@ struct uvisor_palm_connection_info {
|
||||
} __packed connections[UVISOR_MAX_CONN];
|
||||
} __packed;
|
||||
|
||||
enum {
|
||||
UVISOR_BULK_DT_WR,
|
||||
UVISOR_BULK_DT_RD,
|
||||
UVISOR_BULK_CS_WR,
|
||||
UVISOR_BULK_CS_RD,
|
||||
UVISOR_N_TRANSFER = 4,
|
||||
};
|
||||
|
||||
struct uvisor_softc {
|
||||
struct usb2_com_super_softc sc_super_ucom;
|
||||
struct usb2_com_softc sc_ucom;
|
||||
@ -190,7 +197,7 @@ static void uvisor_stop_write(struct usb2_com_softc *);
|
||||
|
||||
static const struct usb2_config uvisor_config[UVISOR_N_TRANSFER] = {
|
||||
|
||||
[0] = {
|
||||
[UVISOR_BULK_DT_WR] = {
|
||||
.type = UE_BULK,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_OUT,
|
||||
@ -199,7 +206,7 @@ static const struct usb2_config uvisor_config[UVISOR_N_TRANSFER] = {
|
||||
.mh.callback = &uvisor_write_callback,
|
||||
},
|
||||
|
||||
[1] = {
|
||||
[UVISOR_BULK_DT_RD] = {
|
||||
.type = UE_BULK,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_IN,
|
||||
@ -208,7 +215,7 @@ static const struct usb2_config uvisor_config[UVISOR_N_TRANSFER] = {
|
||||
.mh.callback = &uvisor_read_callback,
|
||||
},
|
||||
|
||||
[2] = {
|
||||
[UVISOR_BULK_CS_WR] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -218,7 +225,7 @@ static const struct usb2_config uvisor_config[UVISOR_N_TRANSFER] = {
|
||||
.mh.interval = 50, /* 50ms */
|
||||
},
|
||||
|
||||
[3] = {
|
||||
[UVISOR_BULK_CS_RD] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -552,7 +559,7 @@ uvisor_start_read(struct usb2_com_softc *ucom)
|
||||
{
|
||||
struct uvisor_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[1]);
|
||||
usb2_transfer_start(sc->sc_xfer[UVISOR_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -560,8 +567,8 @@ uvisor_stop_read(struct usb2_com_softc *ucom)
|
||||
{
|
||||
struct uvisor_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[3]);
|
||||
usb2_transfer_stop(sc->sc_xfer[1]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UVISOR_BULK_CS_RD]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UVISOR_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -569,7 +576,7 @@ uvisor_start_write(struct usb2_com_softc *ucom)
|
||||
{
|
||||
struct uvisor_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[0]);
|
||||
usb2_transfer_start(sc->sc_xfer[UVISOR_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -577,8 +584,8 @@ uvisor_stop_write(struct usb2_com_softc *ucom)
|
||||
{
|
||||
struct uvisor_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[2]);
|
||||
usb2_transfer_stop(sc->sc_xfer[0]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UVISOR_BULK_CS_WR]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UVISOR_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -591,7 +598,7 @@ uvisor_write_callback(struct usb2_xfer *xfer)
|
||||
case USB_ST_SETUP:
|
||||
case USB_ST_TRANSFERRED:
|
||||
if (sc->sc_flag & UVISOR_FLAG_WRITE_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer[2]);
|
||||
usb2_transfer_start(sc->sc_xfer[UVISOR_BULK_CS_WR]);
|
||||
return;
|
||||
}
|
||||
if (usb2_com_get_data(&sc->sc_ucom, xfer->frbuffers, 0,
|
||||
@ -605,7 +612,7 @@ uvisor_write_callback(struct usb2_xfer *xfer)
|
||||
default: /* Error */
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
sc->sc_flag |= UVISOR_FLAG_WRITE_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer[2]);
|
||||
usb2_transfer_start(sc->sc_xfer[UVISOR_BULK_CS_WR]);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -616,7 +623,7 @@ static void
|
||||
uvisor_write_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct uvisor_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[0];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[UVISOR_BULK_DT_WR];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
@ -636,7 +643,7 @@ uvisor_read_callback(struct usb2_xfer *xfer)
|
||||
|
||||
case USB_ST_SETUP:
|
||||
if (sc->sc_flag & UVISOR_FLAG_READ_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer[3]);
|
||||
usb2_transfer_start(sc->sc_xfer[UVISOR_BULK_CS_RD]);
|
||||
} else {
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
@ -646,7 +653,7 @@ uvisor_read_callback(struct usb2_xfer *xfer)
|
||||
default: /* Error */
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
sc->sc_flag |= UVISOR_FLAG_READ_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer[3]);
|
||||
usb2_transfer_start(sc->sc_xfer[UVISOR_BULK_CS_RD]);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -657,7 +664,7 @@ static void
|
||||
uvisor_read_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct uvisor_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[1];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[UVISOR_BULK_DT_RD];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
|
@ -122,7 +122,15 @@ SYSCTL_INT(_hw_usb2_uvscom, OID_AUTO, debug, CTLFLAG_RW,
|
||||
|
||||
#define UVSCOM_BULK_BUF_SIZE 1024 /* bytes */
|
||||
|
||||
#define UVSCOM_N_TRANSFER 6 /* units */
|
||||
enum {
|
||||
UVSCOM_BULK_DT_WR,
|
||||
UVSCOM_BULK_DT_RD,
|
||||
UVSCOM_BULK_CS_WR,
|
||||
UVSCOM_BULK_CS_RD,
|
||||
UVSCOM_INTR_DT_RD,
|
||||
UVSCOM_INTR_CS_RD,
|
||||
UVSCOM_N_TRANSFER = 6,
|
||||
};
|
||||
|
||||
struct uvscom_softc {
|
||||
struct usb2_com_super_softc sc_super_ucom;
|
||||
@ -176,7 +184,7 @@ static uint16_t uvscom_cfg_read_status(struct uvscom_softc *);
|
||||
|
||||
static const struct usb2_config uvscom_config[UVSCOM_N_TRANSFER] = {
|
||||
|
||||
[0] = {
|
||||
[UVSCOM_BULK_DT_WR] = {
|
||||
.type = UE_BULK,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_OUT,
|
||||
@ -185,7 +193,7 @@ static const struct usb2_config uvscom_config[UVSCOM_N_TRANSFER] = {
|
||||
.mh.callback = &uvscom_write_callback,
|
||||
},
|
||||
|
||||
[1] = {
|
||||
[UVSCOM_BULK_DT_RD] = {
|
||||
.type = UE_BULK,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_IN,
|
||||
@ -194,7 +202,7 @@ static const struct usb2_config uvscom_config[UVSCOM_N_TRANSFER] = {
|
||||
.mh.callback = &uvscom_read_callback,
|
||||
},
|
||||
|
||||
[2] = {
|
||||
[UVSCOM_BULK_CS_WR] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -204,7 +212,7 @@ static const struct usb2_config uvscom_config[UVSCOM_N_TRANSFER] = {
|
||||
.mh.interval = 50, /* 50ms */
|
||||
},
|
||||
|
||||
[3] = {
|
||||
[UVSCOM_BULK_CS_RD] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -214,7 +222,7 @@ static const struct usb2_config uvscom_config[UVSCOM_N_TRANSFER] = {
|
||||
.mh.interval = 50, /* 50ms */
|
||||
},
|
||||
|
||||
[4] = {
|
||||
[UVSCOM_INTR_DT_RD] = {
|
||||
.type = UE_INTERRUPT,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_IN,
|
||||
@ -223,7 +231,7 @@ static const struct usb2_config uvscom_config[UVSCOM_N_TRANSFER] = {
|
||||
.mh.callback = &uvscom_intr_callback,
|
||||
},
|
||||
|
||||
[5] = {
|
||||
[UVSCOM_INTR_CS_RD] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -339,7 +347,7 @@ uvscom_attach(device_t dev)
|
||||
}
|
||||
/* start interrupt pipe */
|
||||
mtx_lock(&Giant);
|
||||
usb2_transfer_start(sc->sc_xfer[4]);
|
||||
usb2_transfer_start(sc->sc_xfer[UVSCOM_INTR_DT_RD]);
|
||||
mtx_unlock(&Giant);
|
||||
|
||||
return (0);
|
||||
@ -358,8 +366,8 @@ uvscom_detach(device_t dev)
|
||||
|
||||
/* stop interrupt pipe */
|
||||
|
||||
if (sc->sc_xfer[4]) {
|
||||
usb2_transfer_stop(sc->sc_xfer[4]);
|
||||
if (sc->sc_xfer[UVSCOM_INTR_DT_RD]) {
|
||||
usb2_transfer_stop(sc->sc_xfer[UVSCOM_INTR_DT_RD]);
|
||||
}
|
||||
usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
|
||||
|
||||
@ -378,7 +386,7 @@ uvscom_write_callback(struct usb2_xfer *xfer)
|
||||
case USB_ST_SETUP:
|
||||
case USB_ST_TRANSFERRED:
|
||||
if (sc->sc_flag & UVSCOM_FLAG_WRITE_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer[2]);
|
||||
usb2_transfer_start(sc->sc_xfer[UVSCOM_BULK_CS_WR]);
|
||||
return;
|
||||
}
|
||||
if (usb2_com_get_data(&sc->sc_ucom, xfer->frbuffers, 0,
|
||||
@ -392,7 +400,7 @@ uvscom_write_callback(struct usb2_xfer *xfer)
|
||||
default: /* Error */
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
sc->sc_flag |= UVSCOM_FLAG_WRITE_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer[2]);
|
||||
usb2_transfer_start(sc->sc_xfer[UVSCOM_BULK_CS_WR]);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -403,7 +411,7 @@ static void
|
||||
uvscom_write_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct uvscom_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[0];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[UVSCOM_BULK_DT_WR];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
@ -423,7 +431,7 @@ uvscom_read_callback(struct usb2_xfer *xfer)
|
||||
|
||||
case USB_ST_SETUP:
|
||||
if (sc->sc_flag & UVSCOM_FLAG_READ_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer[3]);
|
||||
usb2_transfer_start(sc->sc_xfer[UVSCOM_BULK_CS_RD]);
|
||||
} else {
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
@ -433,7 +441,7 @@ uvscom_read_callback(struct usb2_xfer *xfer)
|
||||
default: /* Error */
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
sc->sc_flag |= UVSCOM_FLAG_READ_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer[3]);
|
||||
usb2_transfer_start(sc->sc_xfer[UVSCOM_BULK_CS_RD]);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -444,7 +452,7 @@ static void
|
||||
uvscom_read_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct uvscom_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[1];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[UVSCOM_BULK_DT_RD];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
@ -492,7 +500,7 @@ uvscom_intr_callback(struct usb2_xfer *xfer)
|
||||
}
|
||||
case USB_ST_SETUP:
|
||||
if (sc->sc_flag & UVSCOM_FLAG_INTR_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer[5]);
|
||||
usb2_transfer_start(sc->sc_xfer[UVSCOM_INTR_CS_RD]);
|
||||
} else {
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
@ -502,7 +510,7 @@ uvscom_intr_callback(struct usb2_xfer *xfer)
|
||||
default: /* Error */
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
sc->sc_flag |= UVSCOM_FLAG_INTR_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer[5]);
|
||||
usb2_transfer_start(sc->sc_xfer[UVSCOM_INTR_CS_RD]);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -513,7 +521,7 @@ static void
|
||||
uvscom_intr_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct uvscom_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[4];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[UVSCOM_INTR_DT_RD];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
@ -711,7 +719,7 @@ uvscom_start_read(struct usb2_com_softc *ucom)
|
||||
{
|
||||
struct uvscom_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[1]);
|
||||
usb2_transfer_start(sc->sc_xfer[UVSCOM_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -719,8 +727,8 @@ uvscom_stop_read(struct usb2_com_softc *ucom)
|
||||
{
|
||||
struct uvscom_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[3]);
|
||||
usb2_transfer_stop(sc->sc_xfer[1]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UVSCOM_BULK_CS_RD]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UVSCOM_BULK_DT_RD]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -728,7 +736,7 @@ uvscom_start_write(struct usb2_com_softc *ucom)
|
||||
{
|
||||
struct uvscom_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[0]);
|
||||
usb2_transfer_start(sc->sc_xfer[UVSCOM_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -736,8 +744,8 @@ uvscom_stop_write(struct usb2_com_softc *ucom)
|
||||
{
|
||||
struct uvscom_softc *sc = ucom->sc_parent;
|
||||
|
||||
usb2_transfer_stop(sc->sc_xfer[2]);
|
||||
usb2_transfer_stop(sc->sc_xfer[0]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UVSCOM_BULK_CS_WR]);
|
||||
usb2_transfer_stop(sc->sc_xfer[UVSCOM_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -375,7 +375,7 @@ static const struct rfprog rum_rf5225[] = {
|
||||
};
|
||||
|
||||
static const struct usb2_config rum_config[RUM_N_TRANSFER] = {
|
||||
[0] = {
|
||||
[RUM_BULK_DT_WR] = {
|
||||
.type = UE_BULK,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_OUT,
|
||||
@ -385,7 +385,7 @@ static const struct usb2_config rum_config[RUM_N_TRANSFER] = {
|
||||
.mh.timeout = 5000, /* ms */
|
||||
},
|
||||
|
||||
[1] = {
|
||||
[RUM_BULK_DT_RD] = {
|
||||
.type = UE_BULK,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_IN,
|
||||
@ -394,7 +394,7 @@ static const struct usb2_config rum_config[RUM_N_TRANSFER] = {
|
||||
.mh.callback = &rum_bulk_read_callback,
|
||||
},
|
||||
|
||||
[2] = {
|
||||
[RUM_BULK_CS_WR] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -404,7 +404,7 @@ static const struct usb2_config rum_config[RUM_N_TRANSFER] = {
|
||||
.mh.interval = 50, /* 50ms */
|
||||
},
|
||||
|
||||
[3] = {
|
||||
[RUM_BULK_CS_RD] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -897,7 +897,7 @@ rum_end_of_commands(struct rum_softc *sc)
|
||||
sc->sc_flags &= ~RUM_FLAG_WAIT_COMMAND;
|
||||
|
||||
/* start write transfer, if not started */
|
||||
usb2_transfer_start(sc->sc_xfer[0]);
|
||||
usb2_transfer_start(sc->sc_xfer[RUM_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1075,7 +1075,7 @@ rum_bulk_read_callback(struct usb2_xfer *xfer)
|
||||
tr_setup:
|
||||
|
||||
if (sc->sc_flags & RUM_FLAG_READ_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer[3]);
|
||||
usb2_transfer_start(sc->sc_xfer[RUM_BULK_CS_RD]);
|
||||
} else {
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
@ -1110,7 +1110,7 @@ rum_bulk_read_callback(struct usb2_xfer *xfer)
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
/* try to clear stall first */
|
||||
sc->sc_flags |= RUM_FLAG_READ_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer[3]);
|
||||
usb2_transfer_start(sc->sc_xfer[RUM_BULK_CS_RD]);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -1121,7 +1121,7 @@ static void
|
||||
rum_bulk_read_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct rum_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[1];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[RUM_BULK_DT_RD];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
@ -1302,7 +1302,7 @@ rum_setup_desc_and_tx(struct rum_softc *sc, struct mbuf *m, uint32_t flags,
|
||||
/* start write transfer, if not started */
|
||||
_IF_ENQUEUE(&sc->sc_tx_queue, mm);
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[0]);
|
||||
usb2_transfer_start(sc->sc_xfer[RUM_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1322,7 +1322,7 @@ rum_bulk_write_callback(struct usb2_xfer *xfer)
|
||||
|
||||
case USB_ST_SETUP:
|
||||
if (sc->sc_flags & RUM_FLAG_WRITE_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer[2]);
|
||||
usb2_transfer_start(sc->sc_xfer[RUM_BULK_CS_WR]);
|
||||
break;
|
||||
}
|
||||
if (sc->sc_flags & RUM_FLAG_WAIT_COMMAND) {
|
||||
@ -1380,7 +1380,7 @@ rum_bulk_write_callback(struct usb2_xfer *xfer)
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
/* try to clear stall first */
|
||||
sc->sc_flags |= RUM_FLAG_WRITE_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer[2]);
|
||||
usb2_transfer_start(sc->sc_xfer[RUM_BULK_CS_WR]);
|
||||
}
|
||||
ifp->if_oerrors++;
|
||||
break;
|
||||
@ -1391,7 +1391,7 @@ static void
|
||||
rum_bulk_write_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct rum_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[0];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[RUM_BULK_DT_WR];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
@ -1473,7 +1473,7 @@ rum_start_cb(struct ifnet *ifp)
|
||||
|
||||
mtx_lock(&sc->sc_mtx);
|
||||
/* start write transfer, if not started */
|
||||
usb2_transfer_start(sc->sc_xfer[0]);
|
||||
usb2_transfer_start(sc->sc_xfer[RUM_BULK_DT_WR]);
|
||||
mtx_unlock(&sc->sc_mtx);
|
||||
}
|
||||
|
||||
@ -2234,8 +2234,8 @@ rum_cfg_init(struct rum_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[RUM_BULK_DT_RD]);
|
||||
usb2_transfer_start(sc->sc_xfer[RUM_BULK_DT_WR]);
|
||||
|
||||
/*
|
||||
* start IEEE802.11 layer
|
||||
@ -2293,10 +2293,10 @@ rum_cfg_pre_stop(struct rum_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[RUM_BULK_DT_WR]);
|
||||
usb2_transfer_stop(sc->sc_xfer[RUM_BULK_DT_RD]);
|
||||
usb2_transfer_stop(sc->sc_xfer[RUM_BULK_CS_WR]);
|
||||
usb2_transfer_stop(sc->sc_xfer[RUM_BULK_CS_RD]);
|
||||
|
||||
/* clean up transmission */
|
||||
rum_tx_clean_queue(sc);
|
||||
|
@ -17,8 +17,6 @@
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#define RUM_N_TRANSFER 4
|
||||
|
||||
struct rum_node {
|
||||
struct ieee80211_node ni;
|
||||
struct ieee80211_amrr_node amn;
|
||||
@ -113,6 +111,14 @@ struct rum_ifq {
|
||||
uint16_t ifq_len;
|
||||
};
|
||||
|
||||
enum {
|
||||
RUM_BULK_DT_WR,
|
||||
RUM_BULK_DT_RD,
|
||||
RUM_BULK_CS_WR,
|
||||
RUM_BULK_CS_RD,
|
||||
RUM_N_TRANSFER = 4,
|
||||
};
|
||||
|
||||
struct rum_softc {
|
||||
void *sc_evilhack; /* XXX this pointer must be first */
|
||||
|
||||
|
@ -367,7 +367,7 @@ static const struct ural_rf5222 ural_rf5222[] = {
|
||||
};
|
||||
|
||||
static const struct usb2_config ural_config[URAL_N_TRANSFER] = {
|
||||
[0] = {
|
||||
[URAL_BULK_DT_WR] = {
|
||||
.type = UE_BULK,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_OUT,
|
||||
@ -377,7 +377,7 @@ static const struct usb2_config ural_config[URAL_N_TRANSFER] = {
|
||||
.mh.timeout = 5000, /* ms */
|
||||
},
|
||||
|
||||
[1] = {
|
||||
[URAL_BULK_DT_RD] = {
|
||||
.type = UE_BULK,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_IN,
|
||||
@ -386,7 +386,7 @@ static const struct usb2_config ural_config[URAL_N_TRANSFER] = {
|
||||
.mh.callback = &ural_bulk_read_callback,
|
||||
},
|
||||
|
||||
[2] = {
|
||||
[URAL_BULK_CS_WR] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -396,7 +396,7 @@ static const struct usb2_config ural_config[URAL_N_TRANSFER] = {
|
||||
.mh.interval = 50, /* 50ms */
|
||||
},
|
||||
|
||||
[3] = {
|
||||
[URAL_BULK_CS_RD] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -881,7 +881,7 @@ ural_end_of_commands(struct ural_softc *sc)
|
||||
sc->sc_flags &= ~URAL_FLAG_WAIT_COMMAND;
|
||||
|
||||
/* start write transfer, if not started */
|
||||
usb2_transfer_start(sc->sc_xfer[0]);
|
||||
usb2_transfer_start(sc->sc_xfer[URAL_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1077,7 +1077,7 @@ ural_bulk_read_callback(struct usb2_xfer *xfer)
|
||||
tr_setup:
|
||||
|
||||
if (sc->sc_flags & URAL_FLAG_READ_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer[3]);
|
||||
usb2_transfer_start(sc->sc_xfer[URAL_BULK_CS_RD]);
|
||||
} else {
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
@ -1115,7 +1115,7 @@ ural_bulk_read_callback(struct usb2_xfer *xfer)
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
/* try to clear stall first */
|
||||
sc->sc_flags |= URAL_FLAG_READ_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer[3]);
|
||||
usb2_transfer_start(sc->sc_xfer[URAL_BULK_CS_RD]);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -1126,7 +1126,7 @@ static void
|
||||
ural_bulk_read_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct ural_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[1];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[URAL_BULK_DT_RD];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
@ -1293,7 +1293,7 @@ ural_setup_desc_and_tx(struct ural_softc *sc, struct mbuf *m,
|
||||
/* start write transfer, if not started */
|
||||
_IF_ENQUEUE(&sc->sc_tx_queue, mm);
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[0]);
|
||||
usb2_transfer_start(sc->sc_xfer[URAL_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1313,7 +1313,7 @@ ural_bulk_write_callback(struct usb2_xfer *xfer)
|
||||
|
||||
case USB_ST_SETUP:
|
||||
if (sc->sc_flags & URAL_FLAG_WRITE_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer[2]);
|
||||
usb2_transfer_start(sc->sc_xfer[URAL_BULK_CS_WR]);
|
||||
break;
|
||||
}
|
||||
if (sc->sc_flags & URAL_FLAG_WAIT_COMMAND) {
|
||||
@ -1371,7 +1371,7 @@ ural_bulk_write_callback(struct usb2_xfer *xfer)
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
/* try to clear stall first */
|
||||
sc->sc_flags |= URAL_FLAG_WRITE_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer[2]);
|
||||
usb2_transfer_start(sc->sc_xfer[URAL_BULK_CS_WR]);
|
||||
}
|
||||
ifp->if_oerrors++;
|
||||
break;
|
||||
@ -1382,7 +1382,7 @@ static void
|
||||
ural_bulk_write_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct ural_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[0];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[URAL_BULK_DT_WR];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
@ -1468,7 +1468,7 @@ ural_start_cb(struct ifnet *ifp)
|
||||
|
||||
mtx_lock(&sc->sc_mtx);
|
||||
/* start write transfer, if not started */
|
||||
usb2_transfer_start(sc->sc_xfer[0]);
|
||||
usb2_transfer_start(sc->sc_xfer[URAL_BULK_DT_WR]);
|
||||
mtx_unlock(&sc->sc_mtx);
|
||||
}
|
||||
|
||||
@ -2160,8 +2160,8 @@ ural_cfg_init(struct ural_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[URAL_BULK_DT_RD]);
|
||||
usb2_transfer_start(sc->sc_xfer[URAL_BULK_DT_WR]);
|
||||
|
||||
/*
|
||||
* start IEEE802.11 layer
|
||||
@ -2219,10 +2219,10 @@ ural_cfg_pre_stop(struct ural_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[URAL_BULK_DT_WR]);
|
||||
usb2_transfer_stop(sc->sc_xfer[URAL_BULK_DT_RD]);
|
||||
usb2_transfer_stop(sc->sc_xfer[URAL_BULK_CS_WR]);
|
||||
usb2_transfer_stop(sc->sc_xfer[URAL_BULK_CS_RD]);
|
||||
|
||||
/* clean up transmission */
|
||||
ural_tx_clean_queue(sc);
|
||||
|
@ -17,8 +17,6 @@
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#define URAL_N_TRANSFER 4
|
||||
|
||||
struct ural_node {
|
||||
struct ieee80211_node ni;
|
||||
struct ieee80211_amrr_node amn;
|
||||
@ -113,6 +111,14 @@ struct ural_ifq {
|
||||
uint16_t ifq_len;
|
||||
};
|
||||
|
||||
enum {
|
||||
URAL_BULK_DT_WR,
|
||||
URAL_BULK_DT_RD,
|
||||
URAL_BULK_CS_WR,
|
||||
URAL_BULK_CS_RD,
|
||||
URAL_N_TRANSFER = 4,
|
||||
};
|
||||
|
||||
struct ural_softc {
|
||||
void *sc_evilhack; /* XXX this pointer must be first */
|
||||
|
||||
|
@ -216,7 +216,7 @@ static const struct usb2_device_id zyd_devs[] = {
|
||||
};
|
||||
|
||||
static const struct usb2_config zyd_config[ZYD_N_TRANSFER] = {
|
||||
[ZYD_TR_BULK_DT_WR] = {
|
||||
[ZYD_BULK_DT_WR] = {
|
||||
.type = UE_BULK,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_OUT,
|
||||
@ -227,7 +227,7 @@ static const struct usb2_config zyd_config[ZYD_N_TRANSFER] = {
|
||||
.mh.timeout = 10000, /* 10 seconds */
|
||||
},
|
||||
|
||||
[ZYD_TR_BULK_DT_RD] = {
|
||||
[ZYD_BULK_DT_RD] = {
|
||||
.type = UE_BULK,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_IN,
|
||||
@ -237,7 +237,7 @@ static const struct usb2_config zyd_config[ZYD_N_TRANSFER] = {
|
||||
.ep_index = 0,
|
||||
},
|
||||
|
||||
[ZYD_TR_BULK_CS_WR] = {
|
||||
[ZYD_BULK_CS_WR] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -248,7 +248,7 @@ static const struct usb2_config zyd_config[ZYD_N_TRANSFER] = {
|
||||
.mh.interval = 50, /* 50ms */
|
||||
},
|
||||
|
||||
[ZYD_TR_BULK_CS_RD] = {
|
||||
[ZYD_BULK_CS_RD] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -259,7 +259,7 @@ static const struct usb2_config zyd_config[ZYD_N_TRANSFER] = {
|
||||
.mh.interval = 50, /* 50ms */
|
||||
},
|
||||
|
||||
[ZYD_TR_INTR_DT_WR] = {
|
||||
[ZYD_INTR_DT_WR] = {
|
||||
.type = UE_BULK_INTR,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_OUT,
|
||||
@ -270,7 +270,7 @@ static const struct usb2_config zyd_config[ZYD_N_TRANSFER] = {
|
||||
.ep_index = 1,
|
||||
},
|
||||
|
||||
[ZYD_TR_INTR_DT_RD] = {
|
||||
[ZYD_INTR_DT_RD] = {
|
||||
.type = UE_BULK_INTR,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_IN,
|
||||
@ -280,7 +280,7 @@ static const struct usb2_config zyd_config[ZYD_N_TRANSFER] = {
|
||||
.ep_index = 1,
|
||||
},
|
||||
|
||||
[ZYD_TR_INTR_CS_WR] = {
|
||||
[ZYD_INTR_CS_WR] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -291,7 +291,7 @@ static const struct usb2_config zyd_config[ZYD_N_TRANSFER] = {
|
||||
.mh.interval = 50, /* 50ms */
|
||||
},
|
||||
|
||||
[ZYD_TR_INTR_CS_RD] = {
|
||||
[ZYD_INTR_CS_RD] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -373,7 +373,7 @@ static void
|
||||
zyd_intr_read_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct zyd_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[ZYD_TR_INTR_DT_RD];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[ZYD_INTR_DT_RD];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
@ -420,7 +420,7 @@ zyd_intr_read_callback(struct usb2_xfer *xfer)
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
if (sc->sc_flags & ZYD_FLAG_INTR_READ_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer[ZYD_TR_INTR_CS_RD]);
|
||||
usb2_transfer_start(sc->sc_xfer[ZYD_INTR_CS_RD]);
|
||||
break;
|
||||
}
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
@ -434,7 +434,7 @@ zyd_intr_read_callback(struct usb2_xfer *xfer)
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
/* try to clear stall first */
|
||||
sc->sc_flags |= ZYD_FLAG_INTR_READ_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer[ZYD_TR_INTR_CS_RD]);
|
||||
usb2_transfer_start(sc->sc_xfer[ZYD_INTR_CS_RD]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -529,7 +529,7 @@ zyd_cfg_usb2_intr_read(struct zyd_softc *sc, void *data, uint32_t size)
|
||||
|
||||
/* wait for data */
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[ZYD_TR_INTR_DT_RD]);
|
||||
usb2_transfer_start(sc->sc_xfer[ZYD_INTR_DT_RD]);
|
||||
|
||||
if (usb2_cv_timedwait(&sc->sc_intr_cv,
|
||||
&sc->sc_mtx, hz / 2)) {
|
||||
@ -571,7 +571,7 @@ zyd_cfg_usb2_intr_read(struct zyd_softc *sc, void *data, uint32_t size)
|
||||
* We have fetched the data from the shared buffer and it is
|
||||
* safe to restart the interrupt transfer!
|
||||
*/
|
||||
usb2_transfer_start(sc->sc_xfer[ZYD_TR_INTR_DT_RD]);
|
||||
usb2_transfer_start(sc->sc_xfer[ZYD_INTR_DT_RD]);
|
||||
done:
|
||||
return;
|
||||
}
|
||||
@ -580,7 +580,7 @@ static void
|
||||
zyd_intr_write_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct zyd_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[ZYD_TR_INTR_DT_WR];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[ZYD_INTR_DT_WR];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
@ -602,7 +602,7 @@ zyd_intr_write_callback(struct usb2_xfer *xfer)
|
||||
case USB_ST_SETUP:
|
||||
|
||||
if (sc->sc_flags & ZYD_FLAG_INTR_WRITE_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer[ZYD_TR_INTR_CS_WR]);
|
||||
usb2_transfer_start(sc->sc_xfer[ZYD_INTR_CS_WR]);
|
||||
goto wakeup;
|
||||
}
|
||||
if (sc->sc_intr_owakeup) {
|
||||
@ -621,7 +621,7 @@ zyd_intr_write_callback(struct usb2_xfer *xfer)
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
/* try to clear stall first */
|
||||
sc->sc_flags |= ZYD_FLAG_INTR_WRITE_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer[ZYD_TR_INTR_CS_WR]);
|
||||
usb2_transfer_start(sc->sc_xfer[ZYD_INTR_CS_WR]);
|
||||
}
|
||||
goto wakeup;
|
||||
}
|
||||
@ -657,7 +657,7 @@ zyd_cfg_usb2_intr_write(struct zyd_softc *sc, const void *data,
|
||||
sc->sc_intr_obuf.code = htole16(code);
|
||||
bcopy(data, sc->sc_intr_obuf.data, size);
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[ZYD_TR_INTR_DT_WR]);
|
||||
usb2_transfer_start(sc->sc_xfer[ZYD_INTR_DT_WR]);
|
||||
|
||||
while (sc->sc_intr_owakeup) {
|
||||
if (usb2_cv_timedwait(&sc->sc_intr_cv,
|
||||
@ -774,7 +774,7 @@ static void
|
||||
zyd_bulk_read_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct zyd_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[ZYD_TR_BULK_DT_RD];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[ZYD_BULK_DT_RD];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
@ -923,7 +923,7 @@ zyd_bulk_read_callback(struct usb2_xfer *xfer)
|
||||
DPRINTF("setup\n");
|
||||
|
||||
if (sc->sc_flags & ZYD_FLAG_BULK_READ_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer[ZYD_TR_BULK_CS_RD]);
|
||||
usb2_transfer_start(sc->sc_xfer[ZYD_BULK_CS_RD]);
|
||||
} else {
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
@ -973,7 +973,7 @@ zyd_bulk_read_callback(struct usb2_xfer *xfer)
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
/* try to clear stall first */
|
||||
sc->sc_flags |= ZYD_FLAG_BULK_READ_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer[ZYD_TR_BULK_CS_RD]);
|
||||
usb2_transfer_start(sc->sc_xfer[ZYD_BULK_CS_RD]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -2145,7 +2145,7 @@ zyd_cfg_first_time_setup(struct zyd_softc *sc,
|
||||
if (bootverbose) {
|
||||
ieee80211_announce(ic);
|
||||
}
|
||||
usb2_transfer_start(sc->sc_xfer[ZYD_TR_INTR_DT_RD]);
|
||||
usb2_transfer_start(sc->sc_xfer[ZYD_INTR_DT_RD]);
|
||||
done:
|
||||
return;
|
||||
}
|
||||
@ -2542,8 +2542,8 @@ zyd_cfg_init(struct zyd_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[ZYD_BULK_DT_RD]);
|
||||
usb2_transfer_start(sc->sc_xfer[ZYD_BULK_DT_WR]);
|
||||
|
||||
/*
|
||||
* start IEEE802.11 layer
|
||||
@ -2576,10 +2576,10 @@ zyd_cfg_pre_stop(struct zyd_softc *sc,
|
||||
/*
|
||||
* stop all the transfers, if not already stopped:
|
||||
*/
|
||||
usb2_transfer_stop(sc->sc_xfer[ZYD_TR_BULK_DT_WR]);
|
||||
usb2_transfer_stop(sc->sc_xfer[ZYD_TR_BULK_DT_RD]);
|
||||
usb2_transfer_stop(sc->sc_xfer[ZYD_TR_BULK_CS_WR]);
|
||||
usb2_transfer_stop(sc->sc_xfer[ZYD_TR_BULK_CS_RD]);
|
||||
usb2_transfer_stop(sc->sc_xfer[ZYD_BULK_DT_WR]);
|
||||
usb2_transfer_stop(sc->sc_xfer[ZYD_BULK_DT_RD]);
|
||||
usb2_transfer_stop(sc->sc_xfer[ZYD_BULK_CS_WR]);
|
||||
usb2_transfer_stop(sc->sc_xfer[ZYD_BULK_CS_RD]);
|
||||
|
||||
/* clean up transmission */
|
||||
zyd_tx_clean_queue(sc);
|
||||
@ -2669,7 +2669,7 @@ zyd_start_cb(struct ifnet *ifp)
|
||||
struct zyd_softc *sc = ifp->if_softc;
|
||||
|
||||
mtx_lock(&sc->sc_mtx);
|
||||
usb2_transfer_start(sc->sc_xfer[ZYD_TR_BULK_DT_WR]);
|
||||
usb2_transfer_start(sc->sc_xfer[ZYD_BULK_DT_WR]);
|
||||
mtx_unlock(&sc->sc_mtx);
|
||||
}
|
||||
|
||||
@ -2677,7 +2677,7 @@ static void
|
||||
zyd_bulk_write_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct zyd_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[ZYD_TR_BULK_DT_WR];
|
||||
struct usb2_xfer *xfer_other = sc->sc_xfer[ZYD_BULK_DT_WR];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
@ -2781,7 +2781,7 @@ zyd_setup_desc_and_tx(struct zyd_softc *sc, struct mbuf *m,
|
||||
/* start write transfer, if not started */
|
||||
_IF_ENQUEUE(&sc->sc_tx_queue, mm);
|
||||
|
||||
usb2_transfer_start(sc->sc_xfer[0]);
|
||||
usb2_transfer_start(sc->sc_xfer[ZYD_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2802,7 +2802,7 @@ zyd_bulk_write_callback(struct usb2_xfer *xfer)
|
||||
|
||||
case USB_ST_SETUP:
|
||||
if (sc->sc_flags & ZYD_FLAG_BULK_WRITE_STALL) {
|
||||
usb2_transfer_start(sc->sc_xfer[ZYD_TR_BULK_CS_WR]);
|
||||
usb2_transfer_start(sc->sc_xfer[ZYD_BULK_CS_WR]);
|
||||
DPRINTFN(11, "write stalled\n");
|
||||
break;
|
||||
}
|
||||
@ -2848,7 +2848,7 @@ zyd_bulk_write_callback(struct usb2_xfer *xfer)
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
/* try to clear stall first */
|
||||
sc->sc_flags |= ZYD_FLAG_BULK_WRITE_STALL;
|
||||
usb2_transfer_start(sc->sc_xfer[ZYD_TR_BULK_CS_WR]);
|
||||
usb2_transfer_start(sc->sc_xfer[ZYD_BULK_CS_WR]);
|
||||
}
|
||||
ifp->if_oerrors++;
|
||||
break;
|
||||
@ -3020,7 +3020,7 @@ zyd_end_of_commands(struct zyd_softc *sc)
|
||||
sc->sc_flags &= ~ZYD_FLAG_WAIT_COMMAND;
|
||||
|
||||
/* start write transfer, if not started */
|
||||
usb2_transfer_start(sc->sc_xfer[0]);
|
||||
usb2_transfer_start(sc->sc_xfer[ZYD_BULK_DT_WR]);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1210,18 +1210,6 @@ struct zyd_rf {
|
||||
uint8_t width;
|
||||
};
|
||||
|
||||
enum {
|
||||
ZYD_TR_BULK_DT_WR,
|
||||
ZYD_TR_BULK_DT_RD,
|
||||
ZYD_TR_BULK_CS_WR,
|
||||
ZYD_TR_BULK_CS_RD,
|
||||
ZYD_TR_INTR_DT_WR,
|
||||
ZYD_TR_INTR_DT_RD,
|
||||
ZYD_TR_INTR_CS_WR,
|
||||
ZYD_TR_INTR_CS_RD,
|
||||
ZYD_N_TRANSFER,
|
||||
};
|
||||
|
||||
struct zyd_ifq {
|
||||
struct mbuf *ifq_head;
|
||||
struct mbuf *ifq_tail;
|
||||
@ -1284,6 +1272,18 @@ struct zyd_config_copy {
|
||||
uint8_t if_broadcastaddr[IEEE80211_ADDR_LEN];
|
||||
};
|
||||
|
||||
enum {
|
||||
ZYD_BULK_DT_WR,
|
||||
ZYD_BULK_DT_RD,
|
||||
ZYD_BULK_CS_WR,
|
||||
ZYD_BULK_CS_RD,
|
||||
ZYD_INTR_DT_WR,
|
||||
ZYD_INTR_DT_RD,
|
||||
ZYD_INTR_CS_WR,
|
||||
ZYD_INTR_CS_RD,
|
||||
ZYD_N_TRANSFER = 8,
|
||||
};
|
||||
|
||||
struct zyd_softc {
|
||||
void *sc_evilhack; /* XXX this pointer must be first */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user