| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
#ifndef __U_SERIAL_H |
| 10 |
#define __U_SERIAL_H |
| 11 |
|
| 12 |
#include <linux/usb/composite.h> |
| 13 |
#include <linux/usb/cdc.h> |
| 14 |
|
| 15 |
#define MAX_U_SERIAL_PORTS 8 |
| 16 |
|
| 17 |
struct f_serial_opts { |
| 18 |
struct usb_function_instance func_inst; |
| 19 |
u8 port_num; |
| 20 |
u8 protocol; |
| 21 |
|
| 22 |
struct mutex lock; |
| 23 |
int instances; |
| 24 |
}; |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
struct gserial { |
| 39 |
struct usb_function func; |
| 40 |
|
| 41 |
|
| 42 |
struct gs_port *ioport; |
| 43 |
|
| 44 |
struct usb_ep *in; |
| 45 |
struct usb_ep *out; |
| 46 |
|
| 47 |
|
| 48 |
struct usb_cdc_line_coding port_line_coding; |
| 49 |
|
| 50 |
|
| 51 |
void (*connect)(struct gserial *p); |
| 52 |
void (*disconnect)(struct gserial *p); |
| 53 |
int (*send_break)(struct gserial *p, int duration); |
| 54 |
}; |
| 55 |
|
| 56 |
|
| 57 |
struct usb_request *gs_alloc_req(struct usb_ep *ep, unsigned len, gfp_t flags); |
| 58 |
void gs_free_req(struct usb_ep *, struct usb_request *req); |
| 59 |
|
| 60 |
|
| 61 |
int gserial_alloc_line_no_console(unsigned char *port_line); |
| 62 |
int gserial_alloc_line(unsigned char *port_line); |
| 63 |
void gserial_free_line(unsigned char port_line); |
| 64 |
|
| 65 |
#ifdef CONFIG_U_SERIAL_CONSOLE |
| 66 |
|
| 67 |
ssize_t gserial_set_console(unsigned char port_num, const char *page, size_t count); |
| 68 |
ssize_t gserial_get_console(unsigned char port_num, char *page); |
| 69 |
|
| 70 |
#endif |
| 71 |
|
| 72 |
|
| 73 |
int gserial_connect(struct gserial *, u8 port_num); |
| 74 |
void gserial_disconnect(struct gserial *); |
| 75 |
void gserial_suspend(struct gserial *p); |
| 76 |
void gserial_resume(struct gserial *p); |
| 77 |
|
| 78 |
#endif |