Deleted Added
full compact
umoscom.c (187176) umoscom.c (187259)
1/* $FreeBSD: head/sys/dev/usb2/serial/umoscom2.c 187176 2009-01-13 19:03:47Z thompsa $ */
1/* $FreeBSD: head/sys/dev/usb2/serial/umoscom2.c 187259 2009-01-15 02:35:40Z thompsa $ */
2/* $OpenBSD: umoscom.c,v 1.2 2006/10/26 06:02:43 jsg Exp $ */
3
4/*
5 * Copyright (c) 2006 Jonathan Gray <jsg@openbsd.org>
6 *
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.

--- 29 unchanged lines hidden (view full) ---

39static int umoscom_debug = 0;
40
41SYSCTL_NODE(_hw_usb2, OID_AUTO, umoscom, CTLFLAG_RW, 0, "USB umoscom");
42SYSCTL_INT(_hw_usb2_umoscom, OID_AUTO, debug, CTLFLAG_RW,
43 &umoscom_debug, 0, "Debug level");
44#endif
45
46#define UMOSCOM_BUFSIZE 1024 /* bytes */
2/* $OpenBSD: umoscom.c,v 1.2 2006/10/26 06:02:43 jsg Exp $ */
3
4/*
5 * Copyright (c) 2006 Jonathan Gray <jsg@openbsd.org>
6 *
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.

--- 29 unchanged lines hidden (view full) ---

39static int umoscom_debug = 0;
40
41SYSCTL_NODE(_hw_usb2, OID_AUTO, umoscom, CTLFLAG_RW, 0, "USB umoscom");
42SYSCTL_INT(_hw_usb2_umoscom, OID_AUTO, debug, CTLFLAG_RW,
43 &umoscom_debug, 0, "Debug level");
44#endif
45
46#define UMOSCOM_BUFSIZE 1024 /* bytes */
47#define UMOSCOM_N_DATA_TRANSFER 6 /* units */
48
49#define UMOSCOM_CONFIG_INDEX 0
50#define UMOSCOM_IFACE_INDEX 0
51
52/* interrupt packet */
53#define UMOSCOM_IIR_RLS 0x06
54#define UMOSCOM_IIR_RDA 0x04
55#define UMOSCOM_IIR_CTI 0x0c

--- 93 unchanged lines hidden (view full) ---

149#define UMOSCOM_MSR_CD_CHG 0x08
150#define UMOSCOM_MSR_CTS 0x10
151#define UMOSCOM_MSR_RTS 0x20
152#define UMOSCOM_MSR_RI 0x40
153#define UMOSCOM_MSR_CD 0x80
154
155#define UMOSCOM_BAUD_REF 115200
156
47
48#define UMOSCOM_CONFIG_INDEX 0
49#define UMOSCOM_IFACE_INDEX 0
50
51/* interrupt packet */
52#define UMOSCOM_IIR_RLS 0x06
53#define UMOSCOM_IIR_RDA 0x04
54#define UMOSCOM_IIR_CTI 0x0c

--- 93 unchanged lines hidden (view full) ---

148#define UMOSCOM_MSR_CD_CHG 0x08
149#define UMOSCOM_MSR_CTS 0x10
150#define UMOSCOM_MSR_RTS 0x20
151#define UMOSCOM_MSR_RI 0x40
152#define UMOSCOM_MSR_CD 0x80
153
154#define UMOSCOM_BAUD_REF 115200
155
156enum {
157 UMOSCOM_BULK_DT_WR,
158 UMOSCOM_BULK_DT_RD,
159 UMOSCOM_BULK_CS_WR,
160 UMOSCOM_BULK_CS_RD,
161 UMOSCOM_INTR_DT_RD,
162 UMOSCOM_INTR_CS_RD,
163 UMOSCOM_N_TRANSFER = 6,
164};
165
157struct umoscom_softc {
158 struct usb2_com_super_softc sc_super_ucom;
159 struct usb2_com_softc sc_ucom;
160
166struct umoscom_softc {
167 struct usb2_com_super_softc sc_super_ucom;
168 struct usb2_com_softc sc_ucom;
169
161 struct usb2_xfer *sc_xfer_data[UMOSCOM_N_DATA_TRANSFER];
170 struct usb2_xfer *sc_xfer[UMOSCOM_N_TRANSFER];
162 struct usb2_device *sc_udev;
163
164 uint8_t sc_mcr;
165 uint8_t sc_lcr;
166 uint8_t sc_flags;
167#define UMOSCOM_FLAG_READ_STALL 0x01
168#define UMOSCOM_FLAG_WRITE_STALL 0x02
169#define UMOSCOM_FLAG_INTR_STALL 0x04

--- 25 unchanged lines hidden (view full) ---

195static uint8_t umoscom_cfg_read(struct umoscom_softc *, uint16_t);
196static void umoscom_cfg_do_request(struct umoscom_softc *,
197 struct usb2_device_request *, void *);
198static void umoscom_start_read(struct usb2_com_softc *);
199static void umoscom_stop_read(struct usb2_com_softc *);
200static void umoscom_start_write(struct usb2_com_softc *);
201static void umoscom_stop_write(struct usb2_com_softc *);
202
171 struct usb2_device *sc_udev;
172
173 uint8_t sc_mcr;
174 uint8_t sc_lcr;
175 uint8_t sc_flags;
176#define UMOSCOM_FLAG_READ_STALL 0x01
177#define UMOSCOM_FLAG_WRITE_STALL 0x02
178#define UMOSCOM_FLAG_INTR_STALL 0x04

--- 25 unchanged lines hidden (view full) ---

204static uint8_t umoscom_cfg_read(struct umoscom_softc *, uint16_t);
205static void umoscom_cfg_do_request(struct umoscom_softc *,
206 struct usb2_device_request *, void *);
207static void umoscom_start_read(struct usb2_com_softc *);
208static void umoscom_stop_read(struct usb2_com_softc *);
209static void umoscom_start_write(struct usb2_com_softc *);
210static void umoscom_stop_write(struct usb2_com_softc *);
211
203static const struct usb2_config umoscom_config_data[UMOSCOM_N_DATA_TRANSFER] = {
212static const struct usb2_config umoscom_config_data[UMOSCOM_N_TRANSFER] = {
204
213
205 [0] = {
214 [UMOSCOM_BULK_DT_WR] = {
206 .type = UE_BULK,
207 .endpoint = UE_ADDR_ANY,
208 .direction = UE_DIR_OUT,
209 .mh.bufsize = UMOSCOM_BUFSIZE,
210 .mh.flags = {.pipe_bof = 1,.force_short_xfer = 1,},
211 .mh.callback = &umoscom_write_callback,
212 },
213
215 .type = UE_BULK,
216 .endpoint = UE_ADDR_ANY,
217 .direction = UE_DIR_OUT,
218 .mh.bufsize = UMOSCOM_BUFSIZE,
219 .mh.flags = {.pipe_bof = 1,.force_short_xfer = 1,},
220 .mh.callback = &umoscom_write_callback,
221 },
222
214 [1] = {
223 [UMOSCOM_BULK_DT_RD] = {
215 .type = UE_BULK,
216 .endpoint = UE_ADDR_ANY,
217 .direction = UE_DIR_IN,
218 .mh.bufsize = UMOSCOM_BUFSIZE,
219 .mh.flags = {.pipe_bof = 1,.short_xfer_ok = 1,},
220 .mh.callback = &umoscom_read_callback,
221 },
222
224 .type = UE_BULK,
225 .endpoint = UE_ADDR_ANY,
226 .direction = UE_DIR_IN,
227 .mh.bufsize = UMOSCOM_BUFSIZE,
228 .mh.flags = {.pipe_bof = 1,.short_xfer_ok = 1,},
229 .mh.callback = &umoscom_read_callback,
230 },
231
223 [2] = {
232 [UMOSCOM_BULK_CS_WR] = {
224 .type = UE_CONTROL,
225 .endpoint = 0x00, /* Control pipe */
226 .direction = UE_DIR_ANY,
227 .mh.bufsize = sizeof(struct usb2_device_request),
228 .mh.callback = &umoscom_write_clear_stall_callback,
229 .mh.timeout = 1000, /* 1 second */
230 .mh.interval = 50, /* 50ms */
231 },
232
233 .type = UE_CONTROL,
234 .endpoint = 0x00, /* Control pipe */
235 .direction = UE_DIR_ANY,
236 .mh.bufsize = sizeof(struct usb2_device_request),
237 .mh.callback = &umoscom_write_clear_stall_callback,
238 .mh.timeout = 1000, /* 1 second */
239 .mh.interval = 50, /* 50ms */
240 },
241
233 [3] = {
242 [UMOSCOM_BULK_CS_RD] = {
234 .type = UE_CONTROL,
235 .endpoint = 0x00, /* Control pipe */
236 .direction = UE_DIR_ANY,
237 .mh.bufsize = sizeof(struct usb2_device_request),
238 .mh.callback = &umoscom_read_clear_stall_callback,
239 .mh.timeout = 1000, /* 1 second */
240 .mh.interval = 50, /* 50ms */
241 },
242
243 .type = UE_CONTROL,
244 .endpoint = 0x00, /* Control pipe */
245 .direction = UE_DIR_ANY,
246 .mh.bufsize = sizeof(struct usb2_device_request),
247 .mh.callback = &umoscom_read_clear_stall_callback,
248 .mh.timeout = 1000, /* 1 second */
249 .mh.interval = 50, /* 50ms */
250 },
251
243 [4] = {
252 [UMOSCOM_INTR_DT_RD] = {
244 .type = UE_INTERRUPT,
245 .endpoint = UE_ADDR_ANY,
246 .direction = UE_DIR_IN,
247 .mh.flags = {.pipe_bof = 1,.short_xfer_ok = 1,},
248 .mh.bufsize = 0, /* use wMaxPacketSize */
249 .mh.callback = &umoscom_intr_callback,
250 },
251
253 .type = UE_INTERRUPT,
254 .endpoint = UE_ADDR_ANY,
255 .direction = UE_DIR_IN,
256 .mh.flags = {.pipe_bof = 1,.short_xfer_ok = 1,},
257 .mh.bufsize = 0, /* use wMaxPacketSize */
258 .mh.callback = &umoscom_intr_callback,
259 },
260
252 [5] = {
261 [UMOSCOM_INTR_CS_RD] = {
253 .type = UE_CONTROL,
254 .endpoint = 0x00, /* Control pipe */
255 .direction = UE_DIR_ANY,
256 .mh.bufsize = sizeof(struct usb2_device_request),
257 .mh.callback = &umoscom_intr_clear_stall_callback,
258 .mh.timeout = 1000, /* 1 second */
259 .mh.interval = 50, /* 50ms */
260 },

--- 72 unchanged lines hidden (view full) ---

333 sc->sc_mcr = 0x08; /* enable interrupts */
334
335 /* XXX the device doesn't provide any ID string, so set a static one */
336 device_set_desc(dev, "MOSCHIP USB Serial Port Adapter");
337 device_printf(dev, "<MOSCHIP USB Serial Port Adapter>\n");
338
339 iface_index = UMOSCOM_IFACE_INDEX;
340 error = usb2_transfer_setup(uaa->device, &iface_index,
262 .type = UE_CONTROL,
263 .endpoint = 0x00, /* Control pipe */
264 .direction = UE_DIR_ANY,
265 .mh.bufsize = sizeof(struct usb2_device_request),
266 .mh.callback = &umoscom_intr_clear_stall_callback,
267 .mh.timeout = 1000, /* 1 second */
268 .mh.interval = 50, /* 50ms */
269 },

--- 72 unchanged lines hidden (view full) ---

342 sc->sc_mcr = 0x08; /* enable interrupts */
343
344 /* XXX the device doesn't provide any ID string, so set a static one */
345 device_set_desc(dev, "MOSCHIP USB Serial Port Adapter");
346 device_printf(dev, "<MOSCHIP USB Serial Port Adapter>\n");
347
348 iface_index = UMOSCOM_IFACE_INDEX;
349 error = usb2_transfer_setup(uaa->device, &iface_index,
341 sc->sc_xfer_data, umoscom_config_data,
342 UMOSCOM_N_DATA_TRANSFER, sc, &Giant);
350 sc->sc_xfer, umoscom_config_data,
351 UMOSCOM_N_TRANSFER, sc, &Giant);
343
344 if (error) {
345 goto detach;
346 }
347 /* clear stall at first run */
348 sc->sc_flags |= (UMOSCOM_FLAG_READ_STALL |
349 UMOSCOM_FLAG_WRITE_STALL);
350

--- 16 unchanged lines hidden (view full) ---

367 struct umoscom_softc *sc = device_get_softc(dev);
368
369 mtx_lock(&Giant);
370
371 mtx_unlock(&Giant);
372
373 usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
374
352
353 if (error) {
354 goto detach;
355 }
356 /* clear stall at first run */
357 sc->sc_flags |= (UMOSCOM_FLAG_READ_STALL |
358 UMOSCOM_FLAG_WRITE_STALL);
359

--- 16 unchanged lines hidden (view full) ---

376 struct umoscom_softc *sc = device_get_softc(dev);
377
378 mtx_lock(&Giant);
379
380 mtx_unlock(&Giant);
381
382 usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1);
383
375 usb2_transfer_unsetup(sc->sc_xfer_data, UMOSCOM_N_DATA_TRANSFER);
384 usb2_transfer_unsetup(sc->sc_xfer, UMOSCOM_N_TRANSFER);
376
377 return (0);
378}
379
380static void
381umoscom_cfg_open(struct usb2_com_softc *ucom)
382{
383 struct umoscom_softc *sc = ucom->sc_parent;

--- 217 unchanged lines hidden (view full) ---

601
602static void
603umoscom_start_read(struct usb2_com_softc *ucom)
604{
605 struct umoscom_softc *sc = ucom->sc_parent;
606
607#if 0
608 /* start interrupt endpoint */
385
386 return (0);
387}
388
389static void
390umoscom_cfg_open(struct usb2_com_softc *ucom)
391{
392 struct umoscom_softc *sc = ucom->sc_parent;

--- 217 unchanged lines hidden (view full) ---

610
611static void
612umoscom_start_read(struct usb2_com_softc *ucom)
613{
614 struct umoscom_softc *sc = ucom->sc_parent;
615
616#if 0
617 /* start interrupt endpoint */
609 usb2_transfer_start(sc->sc_xfer_data[4]);
618 usb2_transfer_start(sc->sc_xfer[UMOSCOM_INTR_DT_RD]);
610#endif
611 /* start read endpoint */
619#endif
620 /* start read endpoint */
612 usb2_transfer_start(sc->sc_xfer_data[1]);
621 usb2_transfer_start(sc->sc_xfer[UMOSCOM_BULK_DT_RD]);
613}
614
615static void
616umoscom_stop_read(struct usb2_com_softc *ucom)
617{
618 struct umoscom_softc *sc = ucom->sc_parent;
619
620 /* stop interrupt transfer */
622}
623
624static void
625umoscom_stop_read(struct usb2_com_softc *ucom)
626{
627 struct umoscom_softc *sc = ucom->sc_parent;
628
629 /* stop interrupt transfer */
621 usb2_transfer_stop(sc->sc_xfer_data[5]);
622 usb2_transfer_stop(sc->sc_xfer_data[4]);
630 usb2_transfer_stop(sc->sc_xfer[UMOSCOM_INTR_CS_RD]);
631 usb2_transfer_stop(sc->sc_xfer[UMOSCOM_INTR_DT_RD]);
623
624 /* stop read endpoint */
632
633 /* stop read endpoint */
625 usb2_transfer_stop(sc->sc_xfer_data[3]);
626 usb2_transfer_stop(sc->sc_xfer_data[1]);
634 usb2_transfer_stop(sc->sc_xfer[UMOSCOM_BULK_CS_RD]);
635 usb2_transfer_stop(sc->sc_xfer[UMOSCOM_BULK_DT_RD]);
627}
628
629static void
630umoscom_start_write(struct usb2_com_softc *ucom)
631{
632 struct umoscom_softc *sc = ucom->sc_parent;
633
636}
637
638static void
639umoscom_start_write(struct usb2_com_softc *ucom)
640{
641 struct umoscom_softc *sc = ucom->sc_parent;
642
634 usb2_transfer_start(sc->sc_xfer_data[0]);
643 usb2_transfer_start(sc->sc_xfer[UMOSCOM_BULK_DT_WR]);
635}
636
637static void
638umoscom_stop_write(struct usb2_com_softc *ucom)
639{
640 struct umoscom_softc *sc = ucom->sc_parent;
641
644}
645
646static void
647umoscom_stop_write(struct usb2_com_softc *ucom)
648{
649 struct umoscom_softc *sc = ucom->sc_parent;
650
642 usb2_transfer_stop(sc->sc_xfer_data[2]);
643 usb2_transfer_stop(sc->sc_xfer_data[0]);
651 usb2_transfer_stop(sc->sc_xfer[UMOSCOM_BULK_CS_WR]);
652 usb2_transfer_stop(sc->sc_xfer[UMOSCOM_BULK_DT_WR]);
644}
645
646static void
647umoscom_write_callback(struct usb2_xfer *xfer)
648{
649 struct umoscom_softc *sc = xfer->priv_sc;
650 uint32_t actlen;
651
652 switch (USB_GET_STATE(xfer)) {
653 case USB_ST_SETUP:
654 case USB_ST_TRANSFERRED:
655 DPRINTF("\n");
656
657 if (sc->sc_flags & UMOSCOM_FLAG_WRITE_STALL) {
653}
654
655static void
656umoscom_write_callback(struct usb2_xfer *xfer)
657{
658 struct umoscom_softc *sc = xfer->priv_sc;
659 uint32_t actlen;
660
661 switch (USB_GET_STATE(xfer)) {
662 case USB_ST_SETUP:
663 case USB_ST_TRANSFERRED:
664 DPRINTF("\n");
665
666 if (sc->sc_flags & UMOSCOM_FLAG_WRITE_STALL) {
658 usb2_transfer_start(sc->sc_xfer_data[2]);
667 usb2_transfer_start(sc->sc_xfer[UMOSCOM_BULK_CS_WR]);
659 return;
660 }
661 if (usb2_com_get_data(&sc->sc_ucom, xfer->frbuffers, 0,
662 UMOSCOM_BUFSIZE, &actlen)) {
663
664 xfer->frlengths[0] = actlen;
665 usb2_start_hardware(xfer);
666 }
667 return;
668
669 default: /* Error */
670 if (xfer->error != USB_ERR_CANCELLED) {
671 DPRINTFN(0, "transfer failed\n");
672 sc->sc_flags |= UMOSCOM_FLAG_WRITE_STALL;
668 return;
669 }
670 if (usb2_com_get_data(&sc->sc_ucom, xfer->frbuffers, 0,
671 UMOSCOM_BUFSIZE, &actlen)) {
672
673 xfer->frlengths[0] = actlen;
674 usb2_start_hardware(xfer);
675 }
676 return;
677
678 default: /* Error */
679 if (xfer->error != USB_ERR_CANCELLED) {
680 DPRINTFN(0, "transfer failed\n");
681 sc->sc_flags |= UMOSCOM_FLAG_WRITE_STALL;
673 usb2_transfer_start(sc->sc_xfer_data[2]);
682 usb2_transfer_start(sc->sc_xfer[UMOSCOM_BULK_CS_WR]);
674 }
675 return;
676 }
677}
678
679static void
680umoscom_write_clear_stall_callback(struct usb2_xfer *xfer)
681{
682 struct umoscom_softc *sc = xfer->priv_sc;
683 }
684 return;
685 }
686}
687
688static void
689umoscom_write_clear_stall_callback(struct usb2_xfer *xfer)
690{
691 struct umoscom_softc *sc = xfer->priv_sc;
683 struct usb2_xfer *xfer_other = sc->sc_xfer_data[0];
692 struct usb2_xfer *xfer_other = sc->sc_xfer[UMOSCOM_BULK_DT_WR];
684
685 if (usb2_clear_stall_callback(xfer, xfer_other)) {
686 DPRINTF("stall cleared\n");
687 sc->sc_flags &= ~UMOSCOM_FLAG_WRITE_STALL;
688 usb2_transfer_start(xfer_other);
689 }
690}
691

--- 6 unchanged lines hidden (view full) ---

698 case USB_ST_TRANSFERRED:
699 DPRINTF("got %d bytes\n", xfer->actlen);
700 usb2_com_put_data(&sc->sc_ucom, xfer->frbuffers, 0, xfer->actlen);
701
702 case USB_ST_SETUP:
703 DPRINTF("\n");
704
705 if (sc->sc_flags & UMOSCOM_FLAG_READ_STALL) {
693
694 if (usb2_clear_stall_callback(xfer, xfer_other)) {
695 DPRINTF("stall cleared\n");
696 sc->sc_flags &= ~UMOSCOM_FLAG_WRITE_STALL;
697 usb2_transfer_start(xfer_other);
698 }
699}
700

--- 6 unchanged lines hidden (view full) ---

707 case USB_ST_TRANSFERRED:
708 DPRINTF("got %d bytes\n", xfer->actlen);
709 usb2_com_put_data(&sc->sc_ucom, xfer->frbuffers, 0, xfer->actlen);
710
711 case USB_ST_SETUP:
712 DPRINTF("\n");
713
714 if (sc->sc_flags & UMOSCOM_FLAG_READ_STALL) {
706 usb2_transfer_start(sc->sc_xfer_data[3]);
715 usb2_transfer_start(sc->sc_xfer[UMOSCOM_BULK_CS_RD]);
707 } else {
708 xfer->frlengths[0] = xfer->max_data_length;
709 usb2_start_hardware(xfer);
710 }
711 return;
712
713 default: /* Error */
714 if (xfer->error != USB_ERR_CANCELLED) {
715 DPRINTFN(0, "transfer failed\n");
716 sc->sc_flags |= UMOSCOM_FLAG_READ_STALL;
716 } else {
717 xfer->frlengths[0] = xfer->max_data_length;
718 usb2_start_hardware(xfer);
719 }
720 return;
721
722 default: /* Error */
723 if (xfer->error != USB_ERR_CANCELLED) {
724 DPRINTFN(0, "transfer failed\n");
725 sc->sc_flags |= UMOSCOM_FLAG_READ_STALL;
717 usb2_transfer_start(sc->sc_xfer_data[3]);
726 usb2_transfer_start(sc->sc_xfer[UMOSCOM_BULK_CS_RD]);
718 }
719 return;
720
721 }
722}
723
724static void
725umoscom_read_clear_stall_callback(struct usb2_xfer *xfer)
726{
727 struct umoscom_softc *sc = xfer->priv_sc;
727 }
728 return;
729
730 }
731}
732
733static void
734umoscom_read_clear_stall_callback(struct usb2_xfer *xfer)
735{
736 struct umoscom_softc *sc = xfer->priv_sc;
728 struct usb2_xfer *xfer_other = sc->sc_xfer_data[1];
737 struct usb2_xfer *xfer_other = sc->sc_xfer[UMOSCOM_BULK_DT_RD];
729
730 if (usb2_clear_stall_callback(xfer, xfer_other)) {
731 DPRINTF("stall cleared\n");
732 sc->sc_flags &= ~UMOSCOM_FLAG_READ_STALL;
733 usb2_transfer_start(xfer_other);
734 }
735}
736

--- 8 unchanged lines hidden (view full) ---

745 DPRINTF("too short message\n");
746 goto tr_setup;
747 }
748 usb2_com_status_change(&sc->sc_ucom);
749
750 case USB_ST_SETUP:
751tr_setup:
752 if (sc->sc_flags & UMOSCOM_FLAG_INTR_STALL) {
738
739 if (usb2_clear_stall_callback(xfer, xfer_other)) {
740 DPRINTF("stall cleared\n");
741 sc->sc_flags &= ~UMOSCOM_FLAG_READ_STALL;
742 usb2_transfer_start(xfer_other);
743 }
744}
745

--- 8 unchanged lines hidden (view full) ---

754 DPRINTF("too short message\n");
755 goto tr_setup;
756 }
757 usb2_com_status_change(&sc->sc_ucom);
758
759 case USB_ST_SETUP:
760tr_setup:
761 if (sc->sc_flags & UMOSCOM_FLAG_INTR_STALL) {
753 usb2_transfer_start(sc->sc_xfer_data[5]);
762 usb2_transfer_start(sc->sc_xfer[UMOSCOM_INTR_CS_RD]);
754 } else {
755 xfer->frlengths[0] = xfer->max_data_length;
756 usb2_start_hardware(xfer);
757 }
758 return;
759
760 default: /* Error */
761 if (xfer->error != USB_ERR_CANCELLED) {
762 DPRINTFN(0, "transfer failed\n");
763 sc->sc_flags |= UMOSCOM_FLAG_INTR_STALL;
763 } else {
764 xfer->frlengths[0] = xfer->max_data_length;
765 usb2_start_hardware(xfer);
766 }
767 return;
768
769 default: /* Error */
770 if (xfer->error != USB_ERR_CANCELLED) {
771 DPRINTFN(0, "transfer failed\n");
772 sc->sc_flags |= UMOSCOM_FLAG_INTR_STALL;
764 usb2_transfer_start(sc->sc_xfer_data[5]);
773 usb2_transfer_start(sc->sc_xfer[UMOSCOM_INTR_CS_RD]);
765 }
766 return;
767 }
768}
769
770static void
771umoscom_intr_clear_stall_callback(struct usb2_xfer *xfer)
772{
773 struct umoscom_softc *sc = xfer->priv_sc;
774 }
775 return;
776 }
777}
778
779static void
780umoscom_intr_clear_stall_callback(struct usb2_xfer *xfer)
781{
782 struct umoscom_softc *sc = xfer->priv_sc;
774 struct usb2_xfer *xfer_other = sc->sc_xfer_data[4];
783 struct usb2_xfer *xfer_other = sc->sc_xfer[UMOSCOM_INTR_DT_RD];
775
776 if (usb2_clear_stall_callback(xfer, xfer_other)) {
777 DPRINTF("stall cleared\n");
778 sc->sc_flags &= ~UMOSCOM_FLAG_INTR_STALL;
779 usb2_transfer_start(xfer_other);
780 }
781}
784
785 if (usb2_clear_stall_callback(xfer, xfer_other)) {
786 DPRINTF("stall cleared\n");
787 sc->sc_flags &= ~UMOSCOM_FLAG_INTR_STALL;
788 usb2_transfer_start(xfer_other);
789 }
790}