LibXenon
Bare-metal Xbox 360 homebrew library
Loading...
Searching...
No Matches
usbserial.c
Go to the documentation of this file.
1/* *********************************************************************
2 * Broadcom Common Firmware Environment (CFE)
3 *
4 * USB Serial Port Driver File: usbserial.c
5 *
6 * This device can talk to a few of those usb->serial converters
7 * out there.
8 *
9 * Author: Mitch Lichtenberg
10 *
11 *********************************************************************
12 *
13 * Copyright 2000,2001,2002,2003,2005
14 * Broadcom Corporation. All rights reserved.
15 *
16 * This software is furnished under license and may be used and
17 * copied only in accordance with the following terms and
18 * conditions. Subject to these conditions, you may download,
19 * copy, install, use, modify and distribute modified or unmodified
20 * copies of this software in source and/or binary form. No title
21 * or ownership is transferred hereby.
22 *
23 * 1) Any source code used, modified or distributed must reproduce
24 * and retain this copyright notice and list of conditions
25 * as they appear in the source file.
26 *
27 * 2) No right is granted to use any trade name, trademark, or
28 * logo of Broadcom Corporation. The "Broadcom Corporation"
29 * name may not be used to endorse or promote products derived
30 * from this software without the prior written permission of
31 * Broadcom Corporation.
32 *
33 * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR
34 * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED
35 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
36 * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT
37 * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN
38 * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT,
39 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
40 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
41 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
42 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
43 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
44 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF
45 * THE POSSIBILITY OF SUCH DAMAGE.
46 ********************************************************************* */
47
48
49#ifndef _CFE_
50#include <stdio.h>
51#include <time.h>
52#include <memory.h>
53#include <stdint.h>
54#include "usbhack.h"
55#include "lib_malloc.h"
56#include "lib_queue.h"
57#else
58#include "cfe.h"
59#endif
60
61#include "usbchap9.h"
62#include "usbd.h"
63
64/* This driver supports USB serial devices based on the Prolific
65 PL-2303 and the MCT USB-232 chips. Such devices have been marketed
66 by a large number of vendors, and a specific device will not be
67 recognized until the vendor and model number have been entered in
68 tables of known devices here and in usbdevs.c. */
69
70/* For systems with non-coherent DMA, allocate all buffers to be
71 cache-aligned and multiples of a cache line in size, so that they
72 can be safely flushed or invalidated. */
73
74#define CACHE_ALIGN 32 /* XXX place holder, big enough to now. */
75#define BUFF_ALIGN 16
76#define ALIGN(n,align) (((n)+((align)-1)) & ~((align)-1))
77
78#define usb_dma_alloc(n) (KMALLOC(ALIGN((n),CACHE_ALIGN),BUFF_ALIGN))
79#define usb_dma_free(p) (KFREE(p))
80
81/* *********************************************************************
82 * Constants
83 ********************************************************************* */
84
85#define USER_FIFOSIZE 256
86
87/* *********************************************************************
88 * Structures
89 ********************************************************************* */
90
91/* For Prolific-style devices. The value of LineDataBaud is the
92 desired bit ("baud") rate. */
93
94typedef struct usbser_linedata_s {
96 uint8_t bLineDataStopBits; /* 0=1, 1=1.5, 2=2 */
97 uint8_t bLineDataParity; /* 0=none, 1=odd, 2=even, 3=mark, 4=space */
98 uint8_t bLineDataBits; /* 5,6,7,8 */
100
101#define PL_SET_REQ 0x21
102#define PL_GET_REQ 0xA1
103
104#define PL_REQ_SET_LINE_CODING 0x20
105#define PL_REQ_GET_LINE_CODING 0x21
106
107
108/* For MCT-style devices. The value of BaudData is either an index
109 into a list of supported baud rates or (115200/baud) depending on
110 the particular device. */
111
112typedef struct usbser_bauddata_s {
115
116#define MCT_SET_REQ 0x40
117#define MCT_GET_REQ 0xC0
118
119#define MCT_REQ_SET_BAUD 0x05
120
121
122/* *********************************************************************
123 * Macros
124 ********************************************************************* */
125
126#define GETDWFIELD(s,f) ((uint32_t)((s)->f##0) | ((uint32_t)((s)->f##1) << 8) | \
127 ((uint32_t)((s)->f##2) << 16) | ((uint32_t)((s)->f##3) << 24))
128#define PUTDWFIELD(s,f,v) (s)->f##0 = (v & 0xFF); \
129 (s)->f##1 = ((v)>>8 & 0xFF); \
130 (s)->f##2 = ((v)>>16 & 0xFF); \
131 (s)->f##3 = ((v)>>24 & 0xFF);
132
133
134
135/* *********************************************************************
136 * Forward Definitions
137 ********************************************************************* */
138
139static int usbserial_attach(usbdev_t *dev,usb_driver_t *drv);
140static int usbserial_detach(usbdev_t *dev);
141
142#ifdef _CFE_
143static void usb_uart_probe(cfe_driver_t *drv,
144 unsigned long probe_a, unsigned long probe_b,
145 void *probe_ptr);
146
147static int usb_uart_open(cfe_devctx_t *ctx);
148static int usb_uart_read(cfe_devctx_t *ctx,iocb_buffer_t *buffer);
149static int usb_uart_inpstat(cfe_devctx_t *ctx,iocb_inpstat_t *inpstat);
150static int usb_uart_write(cfe_devctx_t *ctx,iocb_buffer_t *buffer);
151static int usb_uart_ioctl(cfe_devctx_t *ctx,iocb_buffer_t *buffer);
152static int usb_uart_close(cfe_devctx_t *ctx);
153
154const static cfe_devdisp_t usb_uart_dispatch = {
155 usb_uart_open,
156 usb_uart_read,
157 usb_uart_inpstat,
158 usb_uart_write,
159 usb_uart_ioctl,
160 usb_uart_close,
161 NULL,
162 NULL
163};
164
165const cfe_driver_t usb_uart = {
166 "USB UART",
167 "uart",
168 CFE_DEV_SERIAL,
169 &usb_uart_dispatch,
170 usb_uart_probe
171};
172
173typedef struct usb_uart_s {
174 int uart_unit;
175 int uart_speed;
176 int uart_flowcontrol;
177} usb_uart_t;
178
179#define USBUART_MAXUNITS 4
180static usbdev_t *usbuart_units[USBUART_MAXUNITS];
181#endif
182
183
184/* *********************************************************************
185 * Structures
186 ********************************************************************* */
187
188typedef struct usbserial_softc_s {
206
208 "USB Serial Port",
209 usbserial_attach,
210 usbserial_detach
211};
212
213
214#if 0
215/* *********************************************************************
216 * usbserial_get_linedata(dev,linedata)
217 *
218 * Request line data from the device (Prolific-style devices only).
219 *
220 * Input parameters:
221 * dev - USB device
222 * linedata - pointer to structure
223 *
224 * Return value:
225 * # of bytes returned
226 * <0 if error
227 ********************************************************************* */
228
229static int usbserial_get_linedata(usbdev_t *dev,usbser_linedata_t *ldata)
230{
231 uint8_t *respbuf;
232 int res;
233
234 respbuf = usb_dma_alloc(32);
236 respbuf, sizeof(usbser_linedata_t));
237 if ((res >= 0) && ldata) memcpy(ldata,respbuf,sizeof(usbser_linedata_t));
238 usb_dma_free(respbuf);
239
240 return res;
241}
242#endif
243
244/* *********************************************************************
245 * usbserial_set_linedata(dev,linedata)
246 *
247 * Set line data to the device (Prolific-style devices only).
248 *
249 * Input parameters:
250 * dev - USB device
251 * linedata - pointer to structure
252 *
253 * Return value:
254 * # of bytes returned
255 * <0 if error
256 ********************************************************************* */
257
258static int usbserial_set_linedata(usbdev_t *dev,usbser_linedata_t *ldata)
259{
260 /* Send request to device. */
261
263 (uint8_t *)ldata, sizeof(usbser_linedata_t));
264}
265
266/* *********************************************************************
267 * usbserial_tx_data(dev,buffer,len)
268 *
269 * Synchronously transmit data via the USB.
270 *
271 * Input parameters:
272 * dev - device pointer
273 * buffer,len - data we want to send
274 *
275 * Return value:
276 * number of bytes sent.
277 ********************************************************************* */
278
279static int usbserial_tx_data(usbdev_t *dev,hsaddr_t buffer,int len)
280{
281 uint8_t *bptr;
282 usbreq_t *ur;
283 usbserial_softc_t *softc = dev->ud_private;
284 int res;
285
286 bptr = usb_dma_alloc(len);
287 hs_memcpy_from_hs(bptr,buffer,len);
288
289 ur = usb_make_request(dev,softc->user_outpipe,bptr,len,UR_FLAG_OUT);
290 res = usb_sync_request(ur);
291
292// printf("Data sent, status=%d, xferred=%d\n",res,ur->ur_xferred);
293
294 res = ur->ur_xferred;
296 usb_dma_free(bptr);
297
298 return res;
299}
300
301/* *********************************************************************
302 * usbserial_int_callback(ur)
303 *
304 * Callback routine for the interrupt request, for devices
305 * that have an interrupt pipe. We ignore this.
306 *
307 * Input parameters:
308 * ur - usb request
309 *
310 * Return value:
311 * nothing
312 ********************************************************************* */
313
314static int usbserial_int_callback(usbreq_t *ur)
315{
316 /*
317 * Check to see if the request was cancelled by someone
318 * deleting our endpoint. We also check for
319 * "device not responding", which typically happens
320 * when the device is removed.
321 */
322
323 if ((ur->ur_status == UR_ERR_CANCELLED) ||
326 return 0;
327 }
328
329 /* Just requeue the request */
331
332 return 0;
333}
334
335
336/* *********************************************************************
337 * usbserial_rx_callback(ur)
338 *
339 * Callback routine for the regular data pipe.
340 *
341 * Input parameters:
342 * ur - usb request
343 *
344 * Return value:
345 * nothing
346 ********************************************************************* */
347
348static int usbserial_rx_callback(usbreq_t *ur)
349{
350 int idx;
351 int iptr;
352 usbserial_softc_t *user = (ur->ur_dev->ud_private);
353
354 /*
355 * Check to see if the request was cancelled by someone
356 * deleting our endpoint. We also check for "device not
357 * responding", which happens when a device is removed
358 * while the request was pending.
359 */
360
361 if ((ur->ur_status == UR_ERR_CANCELLED) ||
364 return 0;
365 }
366
367 /* Add characters to the receive fifo */
368 for (idx = 0; idx < ur->ur_xferred; idx++) {
369 iptr = (user->user_inbuf_in + 1) & (USER_FIFOSIZE-1);
370 if (iptr == user->user_inbuf_out) break; /* overflow */
371 user->user_inbuf[user->user_inbuf_in] = ur->ur_buffer[idx];
372 user->user_inbuf_in = iptr;
373 }
374
375 /* Requeue the request */
377
378 return 0;
379}
380
381
382/* *********************************************************************
383 * usbserial_attach(dev,drv)
384 *
385 * This routine is called when the bus scan stuff finds a serial
386 * device. We finish up the initialization by configuring the
387 * device and allocating our softc here.
388 *
389 * Input parameters:
390 * dev - usb device, in the "addressed" state.
391 * drv - the driver table entry that matched
392 *
393 * Return value:
394 * 0
395 ********************************************************************* */
396
397static int usbserial_attach(usbdev_t *dev,usb_driver_t *drv)
398{
399 usb_device_descr_t *devdscr = &dev->ud_devdescr;
400 usb_config_descr_t *cfgdscr = dev->ud_cfgdescr;
401 usb_endpoint_descr_t *epdscr;
402 usb_endpoint_descr_t *indscr = NULL;
403 usb_endpoint_descr_t *outdscr = NULL;
404 usb_endpoint_descr_t *intdscr = NULL;
405 usb_interface_descr_t *ifdscr;
406 usbserial_softc_t *softc;
407 int idx;
408 usbreq_t *ur;
409
410 dev->ud_drv = drv;
411
412 softc = KMALLOC(sizeof(usbserial_softc_t),0);
413 memset(softc,0,sizeof(usbserial_softc_t));
414 dev->ud_private = softc;
415
416 softc->vendor_id = (devdscr->idVendorHigh << 8) + devdscr->idVendorLow;
417 softc->dev_id = (devdscr->idProductHigh << 8) + devdscr->idProductLow;
418
419 /* Make this table driven eventually. */
420 if (softc->vendor_id == 0x050D && softc->dev_id == 0x0109) {
421 /* This is the Belkin "USB PDA Adapter" (MCT-style). */
422 softc->dev_type = DEV_MCT;
423 }
424 else {
425 /* Other currently supported devices are based on variations of
426 the Prolific PL-2303 chip, which implements a subset of the
427 USB Communications class. */
428 if (devdscr->bMaxPacketSize0 == 0x40) {
429 /* Linux thinks this distinguishes the HX variant. */
430 softc->dev_type = DEV_PL_HX;
431 }
432 else
433 softc->dev_type = DEV_PL;
434 }
435
437 if (ifdscr == NULL) {
438 printf("Could not get interface descriptor\n");
439 return -1;
440 }
441
442 if (softc->dev_type == DEV_MCT) {
443 /* In MCT-based devices, the bulk input endpoint descriptor is
444 incorrectly tagged as an interrupt endpoint descriptor.
445 For now, we assume known indices; an alternative approach
446 would be to choose based on wMaxPacketSize. */
450 }
451 else {
452 for (idx = 0; idx < ifdscr->bNumEndpoints; idx++) {
454
455 if ((epdscr->bmAttributes & USB_ENDPOINT_TYPE_MASK) ==
457 intdscr = epdscr;
458 }
459 else if (USB_ENDPOINT_DIR_OUT(epdscr->bEndpointAddress)) {
460 outdscr = epdscr;
461 }
462 else {
463 indscr = epdscr;
464 }
465 }
466 }
467
468 if (!indscr || !outdscr) {
469 printf("IN or OUT endpoint descriptors are missing\n");
470 /*
471 * Could not get descriptors, something is very wrong.
472 * Leave device addressed but not configured.
473 */
474 return 0;
475 }
476
477 /* Choose the standard configuration. */
479
480 /* Open the pipes. */
481
482 softc->user_inpipe = usb_open_pipe(dev,indscr);
483 softc->user_devinbufsize = GETUSBFIELD(indscr,wMaxPacketSize);
484 softc->user_outpipe = usb_open_pipe(dev,outdscr);
485 softc->user_outmps = GETUSBFIELD(outdscr,wMaxPacketSize);
486 if (intdscr) {
487 softc->user_intpipe = usb_open_pipe(dev,intdscr);
488 softc->user_intmps = GETUSBFIELD(intdscr,wMaxPacketSize);
489 }
490 else {
491 softc->user_intpipe = -1;
492 softc->user_intmps = 0;
493 }
494
495#ifdef _CFE_
496 softc->user_unit = -1;
497 for (idx = 0; idx < USBUART_MAXUNITS; idx++) {
498 if (usbuart_units[idx] == NULL) {
499 softc->user_unit = idx;
500 usbuart_units[idx] = dev;
501 break;
502 }
503 }
504
505 console_log("USBSERIAL: Unit %d connected",softc->user_unit);
506 console_log(" vendor %04x, product %04x", softc->vendor_id, softc->dev_id);
507#endif
508
509 /* UART status and control operations are not standardized. */
510 if (softc->dev_type == DEV_MCT) {
511 usbser_bauddata_t *bdata;
512
513 bdata = usb_dma_alloc(sizeof(usbser_bauddata_t));
514 PUTDWFIELD(bdata,dBaudData,0xC); /* encoding of 115200 */
516 0, ifdscr->bInterfaceNumber,
517 (uint8_t *)bdata, sizeof(usbser_bauddata_t));
518 usb_dma_free(bdata);
519 }
520 else {
521 usbser_linedata_t *ldata;
522
523 ldata = usb_dma_alloc(sizeof(usbser_linedata_t));
524 PUTDWFIELD(ldata,dLineDataBaud,115200);
525 ldata->bLineDataStopBits = 0;
526 ldata->bLineDataParity = 0; /* none */
527 ldata->bLineDataBits = 8;
528
529 softc->user_linedata = *ldata; /* XXX needed? */
530
531 usbserial_set_linedata(dev,ldata);
532 usb_dma_free(ldata);
533// usbserial_get_linedata(dev,NULL);
534
535 /* The following code follows NetBSD in providing some magic
536 "Undocumented (vendor unresponsive)" setup for the HX
537 variant of the Prolific part. */
538 if (softc->dev_type == DEV_PL_HX) {
539 usb_simple_request(dev, 0x40, 0x1, 2, 0x44);
540 usb_simple_request(dev, 0x40, 0x1, 8, 0);
541 usb_simple_request(dev, 0x40, 0x1, 9, 0);
542 }
543 }
544
545
547 ur = usb_make_request(dev,softc->user_inpipe,softc->user_devinbuf,
548 softc->user_devinbufsize,
550 ur->ur_callback = usbserial_rx_callback;
552
553 if (softc->user_intpipe != -1) {
554 softc->user_intbuf = usb_dma_alloc(softc->user_intmps);
555 ur = usb_make_request(dev,softc->user_intpipe,softc->user_intbuf,
556 softc->user_intmps,
558 ur->ur_callback = usbserial_int_callback;
560 }
561
562 return 0;
563}
564
565/* *********************************************************************
566 * usbserial_detach(dev)
567 *
568 * This routine is called when the bus scanner notices that
569 * this device has been removed from the system. We should
570 * do any cleanup that is required. The pending requests
571 * will be cancelled automagically.
572 *
573 * Input parameters:
574 * dev - usb device
575 *
576 * Return value:
577 * 0
578 ********************************************************************* */
579
580static int usbserial_detach(usbdev_t *dev)
581{
582 usbserial_softc_t *softc;
583
584 softc = dev->ud_private;
585
586#ifdef _CFE_
587 console_log("USBSERIAL: USB unit %d disconnected",softc->user_unit);
588 if (softc->user_unit >= 0) usbuart_units[softc->user_unit] = NULL;
589#endif
590
591 if (softc) {
592 if (softc->user_devinbuf) usb_dma_free(softc->user_devinbuf);
593 if (softc->user_intbuf) usb_dma_free(softc->user_intbuf);
594 dev->ud_private = NULL;
595 KFREE(softc);
596 }
597
598 return 0;
599}
600
601
602#ifdef _CFE_
603
604static void usb_uart_probe(cfe_driver_t *drv,
605 unsigned long probe_a, unsigned long probe_b,
606 void *probe_ptr)
607{
608 usb_uart_t *softc;
609 char descr[80];
610
611 softc = (usb_uart_t *) KMALLOC(sizeof(usb_uart_t),0);
612 memset(softc,0,sizeof(usb_uart_t));
613 softc->uart_unit = (int)probe_a;
614
615 xsprintf(descr,"USB UART unit %d",(int)probe_a);
616 cfe_attach(drv,softc,NULL,descr);
617}
618
619
620static int usb_uart_open(cfe_devctx_t *ctx)
621{
622 return 0;
623}
624
625static int usb_uart_read(cfe_devctx_t *ctx, iocb_buffer_t *buffer)
626{
627 usb_uart_t *softc = ctx->dev_softc;
628 usbdev_t *dev = usbuart_units[softc->uart_unit];
629 usbserial_softc_t *user;
630 hsaddr_t bptr;
631 int blen;
632
633 if (!dev) {
634 buffer->buf_retlen = 0;
635 return 0;
636 }
637 user = dev->ud_private;
638
639 bptr = buffer->buf_ptr;
640 blen = buffer->buf_length;
641
642 while ((blen > 0) && (user->user_inbuf_out != user->user_inbuf_in)) {
643 hs_write8(bptr,user->user_inbuf[user->user_inbuf_out]);
644 bptr++;
645 user->user_inbuf_out = (user->user_inbuf_out + 1) & (USER_FIFOSIZE-1);
646 blen--;
647 }
648
649 buffer->buf_retlen = buffer->buf_length - blen;
650 return 0;
651}
652
653static int usb_uart_inpstat(cfe_devctx_t *ctx, iocb_inpstat_t *inpstat)
654{
655 usb_uart_t *softc = ctx->dev_softc;
656 usbdev_t *dev = usbuart_units[softc->uart_unit];
657 usbserial_softc_t *user;
658
659 inpstat->inp_status = 0;
660
661 if (!dev) return 0;
662 user = dev->ud_private;
663
664 inpstat->inp_status = (user->user_inbuf_in != user->user_inbuf_out);
665
666 return 0;
667}
668
669static int usb_uart_write(cfe_devctx_t *ctx, iocb_buffer_t *buffer)
670{
671 usb_uart_t *softc = ctx->dev_softc;
672 hsaddr_t bptr;
673 int blen;
674 usbdev_t *dev = usbuart_units[softc->uart_unit];
675 usbserial_softc_t *user;
676
677 bptr = buffer->buf_ptr;
678 blen = buffer->buf_length;
679
680 if (!dev) {
681 buffer->buf_retlen = blen;
682 return 0;
683 }
684 user = dev->ud_private;
685
686 if (blen > user->user_outmps) blen = user->user_outmps;
687
688 usbserial_tx_data(dev,bptr,blen);
689
690 buffer->buf_retlen = blen;
691 return 0;
692}
693
694static int usb_uart_ioctl(cfe_devctx_t *ctx, iocb_buffer_t *buffer)
695{
696 usb_uart_t *softc = ctx->dev_softc;
697 usbdev_t *dev = usbuart_units[softc->uart_unit];
698 unsigned int info;
699
700 if (!dev) return -1;
701
702 switch ((int)buffer->buf_ioctlcmd) {
703 case IOCTL_SERIAL_GETSPEED:
704 info = softc->uart_speed;
705 hs_memcpy_to_hs(buffer->buf_ptr,&info,sizeof(info));
706 break;
707 case IOCTL_SERIAL_SETSPEED:
708 hs_memcpy_from_hs(&info,buffer->buf_ptr,sizeof(info));
709 softc->uart_speed = info;
710 /* NYI */
711 break;
712 case IOCTL_SERIAL_GETFLOW:
713 info = softc->uart_flowcontrol;
714 hs_memcpy_to_hs(buffer->buf_ptr,&info,sizeof(info));
715 break;
716 case IOCTL_SERIAL_SETFLOW:
717 hs_memcpy_from_hs(&info,buffer->buf_ptr,sizeof(info));
718 softc->uart_flowcontrol = info;
719 /* NYI */
720 break;
721 default:
722 return -1;
723 }
724
725 return 0;
726}
727
728static int usb_uart_close(cfe_devctx_t *ctx)
729{
730 return 0;
731}
732#endif
733
#define console_log(fmt, x...)
Definition: cfe.h:18
void * hsaddr_t
Definition: cfe.h:11
#define NULL
Definition: def.h:47
#define KMALLOC(size, align)
Definition: lib_malloc.h:92
#define KFREE(ptr)
Definition: lib_malloc.h:93
u16 uint16_t
Definition: libfdt_env.h:10
u8 uint8_t
Definition: libfdt_env.h:9
uint8_t bConfigurationValue
Definition: usbchap9.h:216
uint8_t idVendorLow
Definition: usbchap9.h:184
uint8_t idProductLow
Definition: usbchap9.h:185
uint8_t idProductHigh
Definition: usbchap9.h:185
uint8_t bMaxPacketSize0
Definition: usbchap9.h:183
uint8_t idVendorHigh
Definition: usbchap9.h:184
uint8_t bmAttributes
Definition: usbchap9.h:197
uint8_t bEndpointAddress
Definition: usbchap9.h:196
uint8_t bInterfaceNumber
Definition: usbchap9.h:227
Definition: usbd.h:141
usb_config_descr_t * ud_cfgdescr
Definition: usbd.h:150
void * ud_private
Definition: usbd.h:148
usb_device_descr_t ud_devdescr
Definition: usbd.h:149
usb_driver_t * ud_drv
Definition: usbd.h:142
Definition: usbd.h:171
int(* ur_callback)(struct usbreq_s *req)
Definition: usbd.h:196
int ur_status
Definition: usbd.h:188
uint8_t * ur_buffer
Definition: usbd.h:185
int ur_xferred
Definition: usbd.h:187
usbdev_t * ur_dev
Definition: usbd.h:178
uint8_t dBaudData1
Definition: usbserial.c:113
uint8_t dBaudData3
Definition: usbserial.c:113
uint8_t dBaudData2
Definition: usbserial.c:113
uint8_t dBaudData0
Definition: usbserial.c:113
uint8_t dLineDataBaud2
Definition: usbserial.c:95
uint8_t dLineDataBaud0
Definition: usbserial.c:95
uint8_t bLineDataBits
Definition: usbserial.c:98
uint8_t dLineDataBaud1
Definition: usbserial.c:95
uint8_t bLineDataStopBits
Definition: usbserial.c:96
uint8_t bLineDataParity
Definition: usbserial.c:97
uint8_t dLineDataBaud3
Definition: usbserial.c:95
uint16_t dev_id
Definition: usbserial.c:202
uint8_t user_inbuf[USER_FIFOSIZE]
Definition: usbserial.c:194
enum usbserial_softc_s::@13 dev_type
uint8_t * user_intbuf
Definition: usbserial.c:200
uint16_t vendor_id
Definition: usbserial.c:203
uint8_t * user_devinbuf
Definition: usbserial.c:197
usbser_linedata_t user_linedata
Definition: usbserial.c:201
#define GETUSBFIELD(s, f)
Definition: usbchap9.h:347
#define USB_ENDPOINT_TYPE_INTERRUPT
Definition: usbchap9.h:83
#define USB_ENDPOINT_DESCRIPTOR_TYPE
Definition: usbchap9.h:66
#define USB_ENDPOINT_DIR_OUT(addr)
Definition: usbchap9.h:107
#define USB_ENDPOINT_TYPE_MASK
Definition: usbchap9.h:78
#define USB_INTERFACE_DESCRIPTOR_TYPE
Definition: usbchap9.h:65
void * usb_find_cfg_descr(usbdev_t *dev, int dtype, int idx)
Definition: usbd.c:1237
int usb_simple_request(usbdev_t *dev, uint8_t reqtype, int bRequest, int wValue, int wIndex)
Definition: usbd.c:600
int usb_std_request(usbdev_t *dev, uint8_t bmRequestType, uint8_t bRequest, uint16_t wValue, uint16_t wIndex, uint8_t *buffer, int length)
Definition: usbd.c:796
int usb_sync_request(usbreq_t *ur)
Definition: usbd.c:550
usbreq_t * usb_make_request(usbdev_t *dev, int epaddr, uint8_t *buf, int length, int flags)
Definition: usbd.c:353
void usb_free_request(usbreq_t *ur)
Definition: usbd.c:457
int usb_queue_request(usbreq_t *ur)
Definition: usbd.c:502
int usb_set_configuration(usbdev_t *dev, int config)
Definition: usbd.c:619
int usb_open_pipe(usbdev_t *dev, usb_endpoint_descr_t *epdesc)
Definition: usbd.c:165
#define UR_ERR_CANCELLED
Definition: usbd.h:84
#define UR_FLAG_OUT
Definition: usbd.h:165
#define UR_FLAG_IN
Definition: usbd.h:164
#define UR_FLAG_SHORTOK
Definition: usbd.h:168
#define UR_ERR_DEVICENOTRESPONDING
Definition: usbd.h:76
#define PL_SET_REQ
Definition: usbserial.c:101
#define PL_REQ_GET_LINE_CODING
Definition: usbserial.c:105
struct usbserial_softc_s usbserial_softc_t
#define PUTDWFIELD(s, f, v)
Definition: usbserial.c:128
#define usb_dma_free(p)
Definition: usbserial.c:79
#define USER_FIFOSIZE
Definition: usbserial.c:85
#define usb_dma_alloc(n)
Definition: usbserial.c:78
struct usbser_bauddata_s usbser_bauddata_t
#define MCT_SET_REQ
Definition: usbserial.c:116
struct usbser_linedata_s usbser_linedata_t
#define PL_GET_REQ
Definition: usbserial.c:102
usb_driver_t usbserial_driver
Definition: usbserial.c:207
#define MCT_REQ_SET_BAUD
Definition: usbserial.c:119
#define PL_REQ_SET_LINE_CODING
Definition: usbserial.c:104