Name the items of xfer array.
This commit is contained in:
parent
137cf3b682
commit
3302fb4839
@ -143,8 +143,21 @@ typedef struct ufoma_mobile_acm_descriptor {
|
||||
|
||||
#define UFOMA_BULK_BUF_SIZE 1024 /* bytes */
|
||||
|
||||
#define UFOMA_CTRL_ENDPT_MAX 4 /* units */
|
||||
#define UFOMA_BULK_ENDPT_MAX 4 /* units */
|
||||
enum {
|
||||
UFOMA_CTRL_ENDPT_INTR,
|
||||
UFOMA_CTRL_ENDPT_INTR_CLEAR,
|
||||
UFOMA_CTRL_ENDPT_READ,
|
||||
UFOMA_CTRL_ENDPT_WRITE,
|
||||
UFOMA_CTRL_ENDPT_MAX = 4,
|
||||
};
|
||||
|
||||
enum {
|
||||
UFOMA_BULK_ENDPT_WRITE,
|
||||
UFOMA_BULK_ENDPT_READ,
|
||||
UFOMA_BULK_ENDPT_WRITE_CLEAR,
|
||||
UFOMA_BULK_ENDPT_READ_CLEAR,
|
||||
UFOMA_BULK_ENDPT_MAX = 4,
|
||||
};
|
||||
|
||||
struct ufoma_softc {
|
||||
struct usb2_com_super_softc sc_super_ucom;
|
||||
@ -227,7 +240,7 @@ static int ufoma_sysctl_open(SYSCTL_HANDLER_ARGS);
|
||||
static const struct usb2_config
|
||||
ufoma_ctrl_config[UFOMA_CTRL_ENDPT_MAX] = {
|
||||
|
||||
[0] = {
|
||||
[UFOMA_CTRL_ENDPT_INTR] = {
|
||||
.type = UE_INTERRUPT,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_IN,
|
||||
@ -236,7 +249,7 @@ static const struct usb2_config
|
||||
.mh.callback = &ufoma_intr_callback,
|
||||
},
|
||||
|
||||
[1] = {
|
||||
[UFOMA_CTRL_ENDPT_INTR_CLEAR] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -247,7 +260,7 @@ static const struct usb2_config
|
||||
.mh.interval = 50, /* 50ms */
|
||||
},
|
||||
|
||||
[2] = {
|
||||
[UFOMA_CTRL_ENDPT_READ] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -257,7 +270,7 @@ static const struct usb2_config
|
||||
.mh.timeout = 1000, /* 1 second */
|
||||
},
|
||||
|
||||
[3] = {
|
||||
[UFOMA_CTRL_ENDPT_WRITE] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -271,7 +284,7 @@ static const struct usb2_config
|
||||
static const struct usb2_config
|
||||
ufoma_bulk_config[UFOMA_BULK_ENDPT_MAX] = {
|
||||
|
||||
[0] = {
|
||||
[UFOMA_BULK_ENDPT_WRITE] = {
|
||||
.type = UE_BULK,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_OUT,
|
||||
@ -280,7 +293,7 @@ static const struct usb2_config
|
||||
.mh.callback = &ufoma_bulk_write_callback,
|
||||
},
|
||||
|
||||
[1] = {
|
||||
[UFOMA_BULK_ENDPT_READ] = {
|
||||
.type = UE_BULK,
|
||||
.endpoint = UE_ADDR_ANY,
|
||||
.direction = UE_DIR_IN,
|
||||
@ -289,7 +302,7 @@ static const struct usb2_config
|
||||
.mh.callback = &ufoma_bulk_read_callback,
|
||||
},
|
||||
|
||||
[2] = {
|
||||
[UFOMA_BULK_ENDPT_WRITE_CLEAR] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -300,7 +313,7 @@ static const struct usb2_config
|
||||
.mh.interval = 50, /* 50ms */
|
||||
},
|
||||
|
||||
[3] = {
|
||||
[UFOMA_BULK_ENDPT_READ_CLEAR] = {
|
||||
.type = UE_CONTROL,
|
||||
.endpoint = 0x00, /* Control pipe */
|
||||
.direction = UE_DIR_ANY,
|
||||
@ -701,7 +714,7 @@ static void
|
||||
ufoma_intr_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct ufoma_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_ctrl_xfer[0];
|
||||
struct usb2_xfer *xfer_other = sc->sc_ctrl_xfer[UFOMA_CTRL_ENDPT_INTR];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
@ -758,7 +771,7 @@ ufoma_intr_callback(struct usb2_xfer *xfer)
|
||||
if (sc->sc_num_msg != 0xFF) {
|
||||
sc->sc_num_msg++;
|
||||
}
|
||||
usb2_transfer_start(sc->sc_ctrl_xfer[2]);
|
||||
usb2_transfer_start(sc->sc_ctrl_xfer[UFOMA_CTRL_ENDPT_READ]);
|
||||
break;
|
||||
|
||||
case UCDC_N_SERIAL_STATE:
|
||||
@ -803,7 +816,7 @@ ufoma_intr_callback(struct usb2_xfer *xfer)
|
||||
case USB_ST_SETUP:
|
||||
tr_setup:
|
||||
if (sc->sc_flags & UFOMA_FLAG_INTR_STALL) {
|
||||
usb2_transfer_start(sc->sc_ctrl_xfer[1]);
|
||||
usb2_transfer_start(sc->sc_ctrl_xfer[UFOMA_CTRL_ENDPT_INTR_CLEAR]);
|
||||
} else {
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
@ -814,7 +827,7 @@ ufoma_intr_callback(struct usb2_xfer *xfer)
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
/* start clear stall */
|
||||
sc->sc_flags |= UFOMA_FLAG_INTR_STALL;
|
||||
usb2_transfer_start(sc->sc_ctrl_xfer[1]);
|
||||
usb2_transfer_start(sc->sc_ctrl_xfer[UFOMA_CTRL_ENDPT_INTR_CLEAR]);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -831,7 +844,7 @@ ufoma_bulk_write_callback(struct usb2_xfer *xfer)
|
||||
case USB_ST_SETUP:
|
||||
case USB_ST_TRANSFERRED:
|
||||
if (sc->sc_flags & UFOMA_FLAG_BULK_WRITE_STALL) {
|
||||
usb2_transfer_start(sc->sc_bulk_xfer[2]);
|
||||
usb2_transfer_start(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_WRITE_CLEAR]);
|
||||
return;
|
||||
}
|
||||
if (usb2_com_get_data(&sc->sc_ucom, xfer->frbuffers, 0,
|
||||
@ -844,7 +857,7 @@ ufoma_bulk_write_callback(struct usb2_xfer *xfer)
|
||||
default: /* Error */
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
sc->sc_flags |= UFOMA_FLAG_BULK_WRITE_STALL;
|
||||
usb2_transfer_start(sc->sc_bulk_xfer[2]);
|
||||
usb2_transfer_start(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_WRITE_CLEAR]);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -855,7 +868,7 @@ static void
|
||||
ufoma_bulk_write_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct ufoma_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_bulk_xfer[0];
|
||||
struct usb2_xfer *xfer_other = sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_WRITE];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
@ -876,7 +889,7 @@ ufoma_bulk_read_callback(struct usb2_xfer *xfer)
|
||||
|
||||
case USB_ST_SETUP:
|
||||
if (sc->sc_flags & UFOMA_FLAG_BULK_READ_STALL) {
|
||||
usb2_transfer_start(sc->sc_bulk_xfer[3]);
|
||||
usb2_transfer_start(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_READ_CLEAR]);
|
||||
} else {
|
||||
xfer->frlengths[0] = xfer->max_data_length;
|
||||
usb2_start_hardware(xfer);
|
||||
@ -886,7 +899,7 @@ ufoma_bulk_read_callback(struct usb2_xfer *xfer)
|
||||
default: /* Error */
|
||||
if (xfer->error != USB_ERR_CANCELLED) {
|
||||
sc->sc_flags |= UFOMA_FLAG_BULK_READ_STALL;
|
||||
usb2_transfer_start(sc->sc_bulk_xfer[3]);
|
||||
usb2_transfer_start(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_READ_CLEAR]);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -897,7 +910,7 @@ static void
|
||||
ufoma_bulk_read_clear_stall_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
struct ufoma_softc *sc = xfer->priv_sc;
|
||||
struct usb2_xfer *xfer_other = sc->sc_bulk_xfer[1];
|
||||
struct usb2_xfer *xfer_other = sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_READ];
|
||||
|
||||
if (usb2_clear_stall_callback(xfer, xfer_other)) {
|
||||
DPRINTF("stall cleared\n");
|
||||
@ -1159,13 +1172,13 @@ ufoma_start_read(struct usb2_com_softc *ucom)
|
||||
struct ufoma_softc *sc = ucom->sc_parent;
|
||||
|
||||
/* start interrupt transfer */
|
||||
usb2_transfer_start(sc->sc_ctrl_xfer[0]);
|
||||
usb2_transfer_start(sc->sc_ctrl_xfer[UFOMA_CTRL_ENDPT_INTR]);
|
||||
|
||||
/* start data transfer */
|
||||
if (sc->sc_is_pseudo) {
|
||||
usb2_transfer_start(sc->sc_ctrl_xfer[2]);
|
||||
usb2_transfer_start(sc->sc_ctrl_xfer[UFOMA_CTRL_ENDPT_READ]);
|
||||
} else {
|
||||
usb2_transfer_start(sc->sc_bulk_xfer[1]);
|
||||
usb2_transfer_start(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_READ]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1175,15 +1188,15 @@ ufoma_stop_read(struct usb2_com_softc *ucom)
|
||||
struct ufoma_softc *sc = ucom->sc_parent;
|
||||
|
||||
/* stop interrupt transfer */
|
||||
usb2_transfer_stop(sc->sc_ctrl_xfer[1]);
|
||||
usb2_transfer_stop(sc->sc_ctrl_xfer[0]);
|
||||
usb2_transfer_stop(sc->sc_ctrl_xfer[UFOMA_CTRL_ENDPT_INTR]);
|
||||
usb2_transfer_stop(sc->sc_ctrl_xfer[UFOMA_CTRL_ENDPT_INTR_CLEAR]);
|
||||
|
||||
/* stop data transfer */
|
||||
if (sc->sc_is_pseudo) {
|
||||
usb2_transfer_stop(sc->sc_ctrl_xfer[2]);
|
||||
usb2_transfer_stop(sc->sc_ctrl_xfer[UFOMA_CTRL_ENDPT_READ]);
|
||||
} else {
|
||||
usb2_transfer_stop(sc->sc_bulk_xfer[3]);
|
||||
usb2_transfer_stop(sc->sc_bulk_xfer[1]);
|
||||
usb2_transfer_stop(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_READ_CLEAR]);
|
||||
usb2_transfer_stop(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_READ]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1193,9 +1206,9 @@ ufoma_start_write(struct usb2_com_softc *ucom)
|
||||
struct ufoma_softc *sc = ucom->sc_parent;
|
||||
|
||||
if (sc->sc_is_pseudo) {
|
||||
usb2_transfer_start(sc->sc_ctrl_xfer[3]);
|
||||
usb2_transfer_start(sc->sc_ctrl_xfer[UFOMA_CTRL_ENDPT_WRITE]);
|
||||
} else {
|
||||
usb2_transfer_start(sc->sc_bulk_xfer[0]);
|
||||
usb2_transfer_start(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_WRITE]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1205,10 +1218,10 @@ ufoma_stop_write(struct usb2_com_softc *ucom)
|
||||
struct ufoma_softc *sc = ucom->sc_parent;
|
||||
|
||||
if (sc->sc_is_pseudo) {
|
||||
usb2_transfer_stop(sc->sc_ctrl_xfer[3]);
|
||||
usb2_transfer_stop(sc->sc_ctrl_xfer[UFOMA_CTRL_ENDPT_WRITE]);
|
||||
} else {
|
||||
usb2_transfer_stop(sc->sc_bulk_xfer[2]);
|
||||
usb2_transfer_stop(sc->sc_bulk_xfer[0]);
|
||||
usb2_transfer_stop(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_WRITE_CLEAR]);
|
||||
usb2_transfer_stop(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_WRITE]);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user