Commit | Line | Data |
---|---|---|
c1dca562 DB |
1 | /* |
2 | * u_serial.h - interface to USB gadget "serial port"/TTY utilities | |
3 | * | |
4 | * Copyright (C) 2008 David Brownell | |
5 | * Copyright (C) 2008 by Nokia Corporation | |
6 | * | |
7 | * This software is distributed under the terms of the GNU General | |
8 | * Public License ("GPL") as published by the Free Software Foundation, | |
9 | * either version 2 of that License or (at your option) any later version. | |
10 | */ | |
11 | ||
12 | #ifndef __U_SERIAL_H | |
13 | #define __U_SERIAL_H | |
14 | ||
15 | /* #include <linux/usb/composite.h> */ | |
16 | #include <linux/usb/ch9.h> | |
17 | #include <linux/usb/gadget.h> | |
18 | ||
19 | #include <linux/usb/cdc.h> | |
20 | ||
21 | /* | |
22 | * One non-multiplexed "serial" I/O port ... there can be several of these | |
23 | * on any given USB peripheral device, if it provides enough endpoints. | |
24 | * | |
25 | * The "u_serial" utility component exists to do one thing: manage TTY | |
26 | * style I/O using the USB peripheral endpoints listed here, including | |
27 | * hookups to sysfs and /dev for each logical "tty" device. | |
28 | * | |
29 | * REVISIT need TTY --> USB event flow too, so ACM can report open/close | |
30 | * as carrier detect events. Model after ECM. There's more ACM state too. | |
31 | * | |
32 | * REVISIT someday, allow multiplexing several TTYs over these endpoints. | |
33 | */ | |
34 | struct gserial { | |
35 | /* struct usb_function func; */ | |
36 | ||
37 | /* port is managed by gserial_{connect,disconnect} */ | |
38 | struct gs_port *ioport; | |
39 | ||
40 | struct usb_ep *in; | |
41 | struct usb_ep *out; | |
42 | struct usb_endpoint_descriptor *in_desc; | |
43 | struct usb_endpoint_descriptor *out_desc; | |
44 | ||
45 | /* REVISIT avoid this CDC-ACM support harder ... */ | |
46 | struct usb_cdc_line_coding port_line_coding; /* 9600-8-N-1 etc */ | |
47 | ||
48 | /* FIXME remove these when we switch to acm_bind_config... */ | |
49 | struct usb_ep *notify; | |
50 | struct usb_endpoint_descriptor *notify_desc; | |
51 | u16 port_handshake_bits; | |
52 | }; | |
53 | ||
54 | /* port setup/teardown is handled by gadget driver */ | |
55 | int gserial_setup(struct usb_gadget *g, unsigned n_ports); | |
56 | void gserial_cleanup(void); | |
57 | ||
58 | /* connect/disconnect is handled by individual functions */ | |
59 | int gserial_connect(struct gserial *, u8 port_num); | |
60 | void gserial_disconnect(struct gserial *); | |
61 | ||
62 | #endif /* __U_SERIAL_H */ |