FreeBSD kernel usb device Code
umct.c
Go to the documentation of this file.
1#include <sys/cdefs.h>
2__FBSDID("$FreeBSD$");
3
4/*-
5 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
6 *
7 * Copyright (c) 2003 Scott Long
8 * All rights reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 *
31 */
32
33/*
34 * Driver for the MCT (Magic Control Technology) USB-RS232 Converter.
35 * Based on the superb documentation from the linux mct_u232 driver by
36 * Wolfgang Grandeggar <wolfgang@cec.ch>.
37 * This device smells a lot like the Belkin F5U103, except that it has
38 * suffered some mild brain-damage. This driver is based off of the ubsa.c
39 * driver from Alexander Kabaev <kan@FreeBSD.org>. Merging the two together
40 * might be useful, though the subtle differences might lead to lots of
41 * #ifdef's.
42 */
43
44/*
45 * NOTE: all function names beginning like "umct_cfg_" can only
46 * be called from within the config thread function !
47 */
48
49#include <sys/stdint.h>
50#include <sys/stddef.h>
51#include <sys/param.h>
52#include <sys/queue.h>
53#include <sys/types.h>
54#include <sys/systm.h>
55#include <sys/kernel.h>
56#include <sys/bus.h>
57#include <sys/module.h>
58#include <sys/lock.h>
59#include <sys/mutex.h>
60#include <sys/condvar.h>
61#include <sys/sysctl.h>
62#include <sys/sx.h>
63#include <sys/unistd.h>
64#include <sys/callout.h>
65#include <sys/malloc.h>
66#include <sys/priv.h>
67
68#include <dev/usb/usb.h>
69#include <dev/usb/usbdi.h>
70#include <dev/usb/usbdi_util.h>
71#include "usbdevs.h"
72
73#define USB_DEBUG_VAR usb_debug
74#include <dev/usb/usb_debug.h>
75#include <dev/usb/usb_process.h>
76
78
79/* The UMCT advertises the standard 8250 UART registers */
80#define UMCT_GET_MSR 2 /* Get Modem Status Register */
81#define UMCT_GET_MSR_SIZE 1
82#define UMCT_GET_LCR 6 /* Get Line Control Register */
83#define UMCT_GET_LCR_SIZE 1
84#define UMCT_SET_BAUD 5 /* Set the Baud Rate Divisor */
85#define UMCT_SET_BAUD_SIZE 4
86#define UMCT_SET_LCR 7 /* Set Line Control Register */
87#define UMCT_SET_LCR_SIZE 1
88#define UMCT_SET_MCR 10 /* Set Modem Control Register */
89#define UMCT_SET_MCR_SIZE 1
90
91#define UMCT_MSR_CTS_CHG 0x01
92#define UMCT_MSR_DSR_CHG 0x02
93#define UMCT_MSR_RI_CHG 0x04
94#define UMCT_MSR_CD_CHG 0x08
95#define UMCT_MSR_CTS 0x10
96#define UMCT_MSR_RTS 0x20
97#define UMCT_MSR_RI 0x40
98#define UMCT_MSR_CD 0x80
99
100#define UMCT_INTR_INTERVAL 100
101#define UMCT_IFACE_INDEX 0
102#define UMCT_CONFIG_INDEX 0
103
104enum {
109};
110
114
117 struct mtx sc_mtx;
118
119 uint32_t sc_unit;
120
121 uint16_t sc_obufsize;
122
123 uint8_t sc_lsr;
124 uint8_t sc_msr;
125 uint8_t sc_lcr;
126 uint8_t sc_mcr;
127 uint8_t sc_iface_no;
128 uint8_t sc_swap_cb;
129};
130
131/* prototypes */
132
133static device_probe_t umct_probe;
134static device_attach_t umct_attach;
135static device_detach_t umct_detach;
136static void umct_free_softc(struct umct_softc *);
137
143
144static void umct_cfg_do_request(struct umct_softc *sc, uint8_t request,
145 uint16_t len, uint32_t value);
146static void umct_free(struct ucom_softc *);
147static void umct_cfg_get_status(struct ucom_softc *, uint8_t *,
148 uint8_t *);
149static void umct_cfg_set_break(struct ucom_softc *, uint8_t);
150static void umct_cfg_set_dtr(struct ucom_softc *, uint8_t);
151static void umct_cfg_set_rts(struct ucom_softc *, uint8_t);
152static uint8_t umct_calc_baud(uint32_t);
153static int umct_pre_param(struct ucom_softc *, struct termios *);
154static void umct_cfg_param(struct ucom_softc *, struct termios *);
155static void umct_start_read(struct ucom_softc *);
156static void umct_stop_read(struct ucom_softc *);
157static void umct_start_write(struct ucom_softc *);
158static void umct_stop_write(struct ucom_softc *);
159static void umct_poll(struct ucom_softc *ucom);
160
161static const struct usb_config umct_config[UMCT_N_TRANSFER] = {
162 [UMCT_BULK_DT_WR] = {
163 .type = UE_BULK,
164 .endpoint = UE_ADDR_ANY,
165 .direction = UE_DIR_OUT,
166 .bufsize = 0, /* use wMaxPacketSize */
167 .flags = {.pipe_bof = 1,.force_short_xfer = 1,},
168 .callback = &umct_write_callback,
169 },
170
171 [UMCT_BULK_DT_RD] = {
172 .type = UE_INTERRUPT,
173 .endpoint = UE_ADDR_ANY,
174 .direction = UE_DIR_IN,
175 .flags = {.pipe_bof = 1,.short_xfer_ok = 1,},
176 .bufsize = 0, /* use wMaxPacketSize */
177 .callback = &umct_read_callback,
178 .ep_index = 0, /* first interrupt endpoint */
179 },
180
181 [UMCT_INTR_DT_RD] = {
182 .type = UE_INTERRUPT,
183 .endpoint = UE_ADDR_ANY,
184 .direction = UE_DIR_IN,
185 .flags = {.pipe_bof = 1,.short_xfer_ok = 1,},
186 .bufsize = 0, /* use wMaxPacketSize */
187 .callback = &umct_intr_callback,
188 .ep_index = 1, /* second interrupt endpoint */
189 },
190};
191
192static const struct ucom_callback umct_callback = {
194 .ucom_cfg_set_dtr = &umct_cfg_set_dtr,
195 .ucom_cfg_set_rts = &umct_cfg_set_rts,
196 .ucom_cfg_set_break = &umct_cfg_set_break,
197 .ucom_cfg_param = &umct_cfg_param,
198 .ucom_pre_param = &umct_pre_param,
199 .ucom_start_read = &umct_start_read,
200 .ucom_stop_read = &umct_stop_read,
201 .ucom_start_write = &umct_start_write,
202 .ucom_stop_write = &umct_stop_write,
203 .ucom_poll = &umct_poll,
204 .ucom_free = &umct_free,
205};
206
208 {USB_VPI(USB_VENDOR_MCT, USB_PRODUCT_MCT_USB232, 0)},
209 {USB_VPI(USB_VENDOR_MCT, USB_PRODUCT_MCT_SITECOM_USB232, 0)},
210 {USB_VPI(USB_VENDOR_MCT, USB_PRODUCT_MCT_DU_H3SP_USB232, 0)},
211 {USB_VPI(USB_VENDOR_BELKIN, USB_PRODUCT_BELKIN_F5U109, 0)},
212 {USB_VPI(USB_VENDOR_BELKIN, USB_PRODUCT_BELKIN_F5U409, 0)},
213};
214
215static device_method_t umct_methods[] = {
216 DEVMETHOD(device_probe, umct_probe),
217 DEVMETHOD(device_attach, umct_attach),
218 DEVMETHOD(device_detach, umct_detach),
219 DEVMETHOD_END
220};
221
222static devclass_t umct_devclass;
223
224static driver_t umct_driver = {
225 .name = "umct",
226 .methods = umct_methods,
227 .size = sizeof(struct umct_softc),
228};
229
231MODULE_DEPEND(umct, ucom, 1, 1, 1);
232MODULE_DEPEND(umct, usb, 1, 1, 1);
235
236static int
237umct_probe(device_t dev)
238{
239 struct usb_attach_arg *uaa = device_get_ivars(dev);
240
241 if (uaa->usb_mode != USB_MODE_HOST) {
242 return (ENXIO);
243 }
244 if (uaa->info.bConfigIndex != UMCT_CONFIG_INDEX) {
245 return (ENXIO);
246 }
247 if (uaa->info.bIfaceIndex != UMCT_IFACE_INDEX) {
248 return (ENXIO);
249 }
250 return (usbd_lookup_id_by_uaa(umct_devs, sizeof(umct_devs), uaa));
251}
252
253static int
254umct_attach(device_t dev)
255{
256 struct usb_attach_arg *uaa = device_get_ivars(dev);
257 struct umct_softc *sc = device_get_softc(dev);
258 int32_t error;
259 uint16_t maxp;
260 uint8_t iface_index;
261
262 sc->sc_udev = uaa->device;
263 sc->sc_unit = device_get_unit(dev);
264
266 mtx_init(&sc->sc_mtx, "umct", NULL, MTX_DEF);
268
269 sc->sc_iface_no = uaa->info.bIfaceNum;
270
271 iface_index = UMCT_IFACE_INDEX;
272 error = usbd_transfer_setup(uaa->device, &iface_index,
273 sc->sc_xfer, umct_config, UMCT_N_TRANSFER, sc, &sc->sc_mtx);
274
275 if (error) {
276 device_printf(dev, "allocating USB "
277 "transfers failed\n");
278 goto detach;
279 }
280
281 /*
282 * The real bulk-in endpoint is also marked as an interrupt.
283 * The only way to differentiate it from the real interrupt
284 * endpoint is to look at the wMaxPacketSize field.
285 */
287 if (maxp == 0x2) {
288 /* guessed wrong - switch around endpoints */
289
290 struct usb_xfer *temp = sc->sc_xfer[UMCT_INTR_DT_RD];
291
293 sc->sc_xfer[UMCT_BULK_DT_RD] = temp;
294 sc->sc_swap_cb = 1;
295 }
296
298
299 if (uaa->info.idProduct == USB_PRODUCT_MCT_SITECOM_USB232) {
300 if (sc->sc_obufsize > 16) {
301 sc->sc_obufsize = 16;
302 }
303 }
304 error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc,
305 &umct_callback, &sc->sc_mtx);
306 if (error) {
307 goto detach;
308 }
310
311 return (0); /* success */
312
313detach:
315 return (ENXIO); /* failure */
316}
317
318static int
319umct_detach(device_t dev)
320{
321 struct umct_softc *sc = device_get_softc(dev);
322
325
326 device_claim_softc(dev);
327
328 umct_free_softc(sc);
329
330 return (0);
331}
332
334
335static void
337{
338 if (ucom_unref(&sc->sc_super_ucom)) {
339 mtx_destroy(&sc->sc_mtx);
340 device_free_softc(sc);
341 }
342}
343
344static void
346{
348}
349
350static void
351umct_cfg_do_request(struct umct_softc *sc, uint8_t request,
352 uint16_t len, uint32_t value)
353{
354 struct usb_device_request req;
355 usb_error_t err;
356 uint8_t temp[4];
357
358 if (len > 4)
359 len = 4;
360 req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
361 req.bRequest = request;
362 USETW(req.wValue, 0);
363 req.wIndex[0] = sc->sc_iface_no;
364 req.wIndex[1] = 0;
365 USETW(req.wLength, len);
366 USETDW(temp, value);
367
368 err = ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
369 &req, temp, 0, 1000);
370 if (err) {
371 DPRINTFN(0, "device request failed, err=%s "
372 "(ignored)\n", usbd_errstr(err));
373 }
374 return;
375}
376
377static void
379{
380 struct umct_softc *sc = usbd_xfer_softc(xfer);
381 struct usb_page_cache *pc;
382 uint8_t buf[2];
383 int actlen;
384
385 usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL);
386
387 switch (USB_GET_STATE(xfer)) {
389 if (actlen < 2) {
390 DPRINTF("too short message\n");
391 goto tr_setup;
392 }
393 pc = usbd_xfer_get_frame(xfer, 0);
394 usbd_copy_out(pc, 0, buf, sizeof(buf));
395
396 /*
397 * MSR bits need translation from ns16550 to SER_* values.
398 * LSR bits are ns16550 in hardware and ucom.
399 */
400 sc->sc_msr = 0;
401 if (buf[0] & UMCT_MSR_CTS)
402 sc->sc_msr |= SER_CTS;
403 if (buf[0] & UMCT_MSR_CD)
404 sc->sc_msr |= SER_DCD;
405 if (buf[0] & UMCT_MSR_RI)
406 sc->sc_msr |= SER_RI;
407 if (buf[0] & UMCT_MSR_RTS)
408 sc->sc_msr |= SER_DSR;
409 sc->sc_lsr = buf[1];
410
412 /* FALLTHROUGH */
413 case USB_ST_SETUP:
414tr_setup:
417 return;
418
419 default: /* Error */
420 if (error != USB_ERR_CANCELLED) {
421 /* try to clear stall first */
423 goto tr_setup;
424 }
425 return;
426 }
427}
428
429static void
430umct_cfg_get_status(struct ucom_softc *ucom, uint8_t *lsr, uint8_t *msr)
431{
432 struct umct_softc *sc = ucom->sc_parent;
433
434 *lsr = sc->sc_lsr;
435 *msr = sc->sc_msr;
436}
437
438static void
439umct_cfg_set_break(struct ucom_softc *ucom, uint8_t onoff)
440{
441 struct umct_softc *sc = ucom->sc_parent;
442
443 if (onoff)
444 sc->sc_lcr |= 0x40;
445 else
446 sc->sc_lcr &= ~0x40;
447
449}
450
451static void
452umct_cfg_set_dtr(struct ucom_softc *ucom, uint8_t onoff)
453{
454 struct umct_softc *sc = ucom->sc_parent;
455
456 if (onoff)
457 sc->sc_mcr |= 0x01;
458 else
459 sc->sc_mcr &= ~0x01;
460
462}
463
464static void
465umct_cfg_set_rts(struct ucom_softc *ucom, uint8_t onoff)
466{
467 struct umct_softc *sc = ucom->sc_parent;
468
469 if (onoff)
470 sc->sc_mcr |= 0x02;
471 else
472 sc->sc_mcr &= ~0x02;
473
475}
476
477static uint8_t
478umct_calc_baud(uint32_t baud)
479{
480 switch (baud) {
481 case B300:
482 return (0x1);
483 case B600:
484 return (0x2);
485 case B1200:
486 return (0x3);
487 case B2400:
488 return (0x4);
489 case B4800:
490 return (0x6);
491 case B9600:
492 return (0x8);
493 case B19200:
494 return (0x9);
495 case B38400:
496 return (0xa);
497 case B57600:
498 return (0xb);
499 case 115200:
500 return (0xc);
501 case B0:
502 default:
503 break;
504 }
505 return (0x0);
506}
507
508static int
509umct_pre_param(struct ucom_softc *ucom, struct termios *t)
510{
511 return (0); /* we accept anything */
512}
513
514static void
515umct_cfg_param(struct ucom_softc *ucom, struct termios *t)
516{
517 struct umct_softc *sc = ucom->sc_parent;
518 uint32_t value;
519
520 value = umct_calc_baud(t->c_ospeed);
522
523 value = (sc->sc_lcr & 0x40);
524
525 switch (t->c_cflag & CSIZE) {
526 case CS5:
527 value |= 0x0;
528 break;
529 case CS6:
530 value |= 0x1;
531 break;
532 case CS7:
533 value |= 0x2;
534 break;
535 default:
536 case CS8:
537 value |= 0x3;
538 break;
539 }
540
541 value |= (t->c_cflag & CSTOPB) ? 0x4 : 0;
542 if (t->c_cflag & PARENB) {
543 value |= 0x8;
544 value |= (t->c_cflag & PARODD) ? 0x0 : 0x10;
545 }
546 /*
547 * XXX There doesn't seem to be a way to tell the device
548 * to use flow control.
549 */
550
551 sc->sc_lcr = value;
553}
554
555static void
557{
558 struct umct_softc *sc = ucom->sc_parent;
559
560 /* start interrupt endpoint */
562
563 /* start read endpoint */
565}
566
567static void
569{
570 struct umct_softc *sc = ucom->sc_parent;
571
572 /* stop interrupt endpoint */
574
575 /* stop read endpoint */
577}
578
579static void
581{
582 struct umct_softc *sc = ucom->sc_parent;
583
585}
586
587static void
589{
590 struct umct_softc *sc = ucom->sc_parent;
591
593}
594
595static void
597{
598 struct umct_softc *sc = usbd_xfer_softc(xfer);
599
600 if (sc->sc_swap_cb)
602 else
604}
605
606static void
608{
609 struct umct_softc *sc = usbd_xfer_softc(xfer);
610
611 if (sc->sc_swap_cb)
613 else
615}
616
617static void
619{
620 struct umct_softc *sc = usbd_xfer_softc(xfer);
621 struct usb_page_cache *pc;
622 uint32_t actlen;
623
624 switch (USB_GET_STATE(xfer)) {
625 case USB_ST_SETUP:
627tr_setup:
628 pc = usbd_xfer_get_frame(xfer, 0);
629 if (ucom_get_data(&sc->sc_ucom, pc, 0,
630 sc->sc_obufsize, &actlen)) {
631 usbd_xfer_set_frame_len(xfer, 0, actlen);
633 }
634 return;
635
636 default: /* Error */
637 if (error != USB_ERR_CANCELLED) {
638 /* try to clear stall first */
640 goto tr_setup;
641 }
642 return;
643 }
644}
645
646static void
648{
649 struct umct_softc *sc = usbd_xfer_softc(xfer);
650 struct usb_page_cache *pc;
651 int actlen;
652
653 usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL);
654
655 switch (USB_GET_STATE(xfer)) {
657 pc = usbd_xfer_get_frame(xfer, 0);
658 ucom_put_data(&sc->sc_ucom, pc, 0, actlen);
659
660 case USB_ST_SETUP:
661tr_setup:
664 return;
665
666 default: /* Error */
667 if (error != USB_ERR_CANCELLED) {
668 /* try to clear stall first */
670 goto tr_setup;
671 }
672 return;
673 }
674}
675
676static void
678{
679 struct umct_softc *sc = ucom->sc_parent;
681}
uint16_t len
Definition: ehci.h:41
struct @109 error
uint32_t value
device_t dev
void(* ucom_cfg_get_status)(struct ucom_softc *, uint8_t *plsr, uint8_t *pmsr)
Definition: usb_serial.h:90
void * sc_parent
Definition: usb_serial.h:170
uint8_t sc_lsr
Definition: umct.c:123
struct ucom_softc sc_ucom
Definition: umct.c:113
uint16_t sc_obufsize
Definition: umct.c:121
struct usb_xfer * sc_xfer[UMCT_N_TRANSFER]
Definition: umct.c:116
struct ucom_super_softc sc_super_ucom
Definition: umct.c:112
uint8_t sc_lcr
Definition: umct.c:125
uint8_t sc_swap_cb
Definition: umct.c:128
uint8_t sc_mcr
Definition: umct.c:126
struct mtx sc_mtx
Definition: umct.c:117
uint8_t sc_iface_no
Definition: umct.c:127
uint8_t sc_msr
Definition: umct.c:124
struct usb_device * sc_udev
Definition: umct.c:115
uint32_t sc_unit
Definition: umct.c:119
enum usb_hc_mode usb_mode
Definition: usbdi.h:432
struct usbd_lookup_info info
Definition: usbdi.h:426
struct usb_device * device
Definition: usbdi.h:430
uint8_t type
Definition: usbdi.h:238
uint8_t bIfaceNum
Definition: usbdi.h:418
uint16_t idProduct
Definition: usbdi.h:409
uint8_t bIfaceIndex
Definition: usbdi.h:417
uint8_t bConfigIndex
Definition: usbdi.h:419
#define DPRINTF(...)
Definition: umass.c:179
static int umct_pre_param(struct ucom_softc *, struct termios *)
Definition: umct.c:509
#define UMCT_MSR_RTS
Definition: umct.c:96
static void umct_poll(struct ucom_softc *ucom)
Definition: umct.c:677
static void umct_stop_read(struct ucom_softc *)
Definition: umct.c:568
#define UMCT_SET_LCR
Definition: umct.c:86
static usb_callback_t umct_write_callback
Definition: umct.c:142
MODULE_DEPEND(umct, ucom, 1, 1, 1)
static void umct_free(struct ucom_softc *)
Definition: umct.c:345
#define UMCT_IFACE_INDEX
Definition: umct.c:101
static const struct usb_config umct_config[UMCT_N_TRANSFER]
Definition: umct.c:161
static void umct_cfg_set_break(struct ucom_softc *, uint8_t)
Definition: umct.c:439
static void umct_cfg_set_dtr(struct ucom_softc *, uint8_t)
Definition: umct.c:452
static driver_t umct_driver
Definition: umct.c:224
UCOM_UNLOAD_DRAIN(umct)
#define UMCT_SET_BAUD_SIZE
Definition: umct.c:85
#define UMCT_SET_BAUD
Definition: umct.c:84
static void umct_cfg_param(struct ucom_softc *, struct termios *)
Definition: umct.c:515
static void umct_cfg_set_rts(struct ucom_softc *, uint8_t)
Definition: umct.c:465
#define UMCT_MSR_CD
Definition: umct.c:98
#define UMCT_SET_MCR
Definition: umct.c:88
static void umct_cfg_do_request(struct umct_softc *sc, uint8_t request, uint16_t len, uint32_t value)
Definition: umct.c:351
#define UMCT_SET_MCR_SIZE
Definition: umct.c:89
static usb_callback_t umct_read_callback_sub
Definition: umct.c:141
static void umct_start_write(struct ucom_softc *)
Definition: umct.c:580
__FBSDID("$FreeBSD$")
static device_detach_t umct_detach
Definition: umct.c:135
#define UMCT_MSR_RI
Definition: umct.c:97
static void umct_cfg_get_status(struct ucom_softc *, uint8_t *, uint8_t *)
Definition: umct.c:430
#define UMCT_SET_LCR_SIZE
Definition: umct.c:87
static device_attach_t umct_attach
Definition: umct.c:134
static device_method_t umct_methods[]
Definition: umct.c:215
@ UMCT_BULK_DT_RD
Definition: umct.c:106
@ UMCT_BULK_DT_WR
Definition: umct.c:105
@ UMCT_N_TRANSFER
Definition: umct.c:108
@ UMCT_INTR_DT_RD
Definition: umct.c:107
#define UMCT_CONFIG_INDEX
Definition: umct.c:102
MODULE_VERSION(umct, 1)
static devclass_t umct_devclass
Definition: umct.c:222
static void umct_start_read(struct ucom_softc *)
Definition: umct.c:556
static usb_callback_t umct_intr_callback
Definition: umct.c:138
static usb_callback_t umct_intr_callback_sub
Definition: umct.c:139
USB_PNP_HOST_INFO(umct_devs)
static void umct_free_softc(struct umct_softc *)
Definition: umct.c:336
static const STRUCT_USB_HOST_ID umct_devs[]
Definition: umct.c:207
#define UMCT_MSR_CTS
Definition: umct.c:95
static device_probe_t umct_probe
Definition: umct.c:133
DRIVER_MODULE(umct, uhub, umct_driver, umct_devclass, NULL, 0)
static uint8_t umct_calc_baud(uint32_t)
Definition: umct.c:478
static const struct ucom_callback umct_callback
Definition: umct.c:192
static void umct_stop_write(struct ucom_softc *)
Definition: umct.c:588
static usb_callback_t umct_read_callback
Definition: umct.c:140
#define UE_INTERRUPT
Definition: usb.h:544
#define UE_ADDR_ANY
Definition: usb.h:537
#define UE_BULK
Definition: usb.h:543
#define UT_WRITE_VENDOR_DEVICE
Definition: usb.h:184
#define UE_DIR_IN
Definition: usb.h:531
#define UE_DIR_OUT
Definition: usb.h:532
@ USB_MODE_HOST
Definition: usb.h:778
void usbd_copy_out(struct usb_page_cache *cache, usb_frlength_t offset, void *ptr, usb_frlength_t len)
Definition: usb_busdma.c:283
#define USETW(w, v)
Definition: usb_endian.h:77
#define USETDW(w, v)
Definition: usb_endian.h:82
const char * usbd_errstr(usb_error_t err)
Definition: usb_error.c:93
const void * req
Definition: usb_if.m:51
INTERFACE usb
Definition: usb_if.m:35
int usbd_lookup_id_by_uaa(const struct usb_device_id *id, usb_size_t sizeof_id, struct usb_attach_arg *uaa)
Definition: usb_lookup.c:143
uint8_t ucom_get_data(struct ucom_softc *sc, struct usb_page_cache *pc, uint32_t offset, uint32_t len, uint32_t *actlen)
Definition: usb_serial.c:1384
void ucom_status_change(struct ucom_softc *sc)
Definition: usb_serial.c:1229
int ucom_attach(struct ucom_super_softc *ssc, struct ucom_softc *sc, int subunits, void *parent, const struct ucom_callback *callback, struct mtx *mtx)
Definition: usb_serial.c:267
int ucom_unref(struct ucom_super_softc *ssc)
Definition: usb_serial.c:1730
void ucom_ref(struct ucom_super_softc *ssc)
Definition: usb_serial.c:1695
void ucom_set_pnpinfo_usb(struct ucom_super_softc *ssc, device_t dev)
Definition: usb_serial.c:549
void ucom_detach(struct ucom_super_softc *ssc, struct ucom_softc *sc)
Definition: usb_serial.c:336
void ucom_put_data(struct ucom_softc *sc, struct usb_page_cache *pc, uint32_t offset, uint32_t len)
Definition: usb_serial.c:1462
#define ucom_cfg_do_request(udev, com, req, ptr, flags, timo)
Definition: usb_serial.h:208
void usbd_transfer_submit(struct usb_xfer *xfer)
void usbd_transfer_unsetup(struct usb_xfer **pxfer, uint16_t n_setup)
void usbd_xfer_set_frame_len(struct usb_xfer *xfer, usb_frcount_t frindex, usb_frlength_t len)
usb_frlength_t usbd_xfer_max_framelen(struct usb_xfer *xfer)
struct usb_page_cache * usbd_xfer_get_frame(struct usb_xfer *xfer, usb_frcount_t frindex)
usb_error_t usbd_transfer_setup(struct usb_device *udev, const uint8_t *ifaces, struct usb_xfer **ppxfer, const struct usb_config *setup_start, uint16_t n_setup, void *priv_sc, struct mtx *xfer_mtx)
Definition: usb_transfer.c:987
void usbd_transfer_start(struct usb_xfer *xfer)
void usbd_transfer_poll(struct usb_xfer **ppxfer, uint16_t max)
void * usbd_xfer_softc(struct usb_xfer *xfer)
void usbd_xfer_set_stall(struct usb_xfer *xfer)
void usbd_transfer_stop(struct usb_xfer *xfer)
void usbd_xfer_status(struct usb_xfer *xfer, int *actlen, int *sumlen, int *aframes, int *nframes)
usb_frlength_t usbd_xfer_max_len(struct usb_xfer *xfer)
void device_set_usb_desc(device_t dev)
Definition: usb_util.c:73
#define USB_ST_SETUP
Definition: usbdi.h:502
usb_error_t
Definition: usbdi.h:45
@ USB_ERR_CANCELLED
Definition: usbdi.h:51
#define USB_ST_TRANSFERRED
Definition: usbdi.h:503
void() usb_callback_t(struct usb_xfer *, usb_error_t)
Definition: usbdi.h:94
#define USB_VPI(vend, prod, info)
Definition: usbdi.h:367
#define STRUCT_USB_HOST_ID
Definition: usbdi.h:258
#define USB_GET_STATE(xfer)
Definition: usbdi.h:515