1
2
3
4
5
6
7
8
9
10
11
12
13
14 #ifndef CMSPAR
15 #define CMSPAR 0
16 #endif
17
18
19
20
21
22 #define ACM_TTY_MAJOR 166
23 #define ACM_TTY_MINORS 256
24
25
26
27
28
29 #define USB_RT_ACM (USB_TYPE_CLASS | USB_RECIP_INTERFACE)
30
31
32
33
34
35 #define ACM_CTRL_DTR 0x01
36 #define ACM_CTRL_RTS 0x02
37
38
39
40
41
42 #define ACM_CTRL_DCD 0x01
43 #define ACM_CTRL_DSR 0x02
44 #define ACM_CTRL_BRK 0x04
45 #define ACM_CTRL_RI 0x08
46
47 #define ACM_CTRL_FRAMING 0x10
48 #define ACM_CTRL_PARITY 0x20
49 #define ACM_CTRL_OVERRUN 0x40
50
51
52
53
54
55
56
57
58
59
60
61
62
63 #define ACM_NW 16
64 #define ACM_NR 16
65
66 struct acm_wb {
67 unsigned char *buf;
68 dma_addr_t dmah;
69 int len;
70 int use;
71 struct urb *urb;
72 struct acm *instance;
73 };
74
75 struct acm_rb {
76 int size;
77 unsigned char *base;
78 dma_addr_t dma;
79 int index;
80 struct acm *instance;
81 };
82
83 struct acm {
84 struct usb_device *dev;
85 struct usb_interface *control;
86 struct usb_interface *data;
87 unsigned in, out;
88 struct tty_port port;
89 struct urb *ctrlurb;
90 u8 *ctrl_buffer;
91 dma_addr_t ctrl_dma;
92 u8 *country_codes;
93 unsigned int country_code_size;
94 unsigned int country_rel_date;
95 struct acm_wb wb[ACM_NW];
96 unsigned long read_urbs_free;
97 struct urb *read_urbs[ACM_NR];
98 struct acm_rb read_buffers[ACM_NR];
99 int rx_buflimit;
100 spinlock_t read_lock;
101 u8 *notification_buffer;
102 unsigned int nb_index;
103 unsigned int nb_size;
104 int transmitting;
105 spinlock_t write_lock;
106 struct mutex mutex;
107 bool disconnected;
108 unsigned long flags;
109 # define EVENT_TTY_WAKEUP 0
110 # define EVENT_RX_STALL 1
111 # define ACM_THROTTLED 2
112 # define ACM_ERROR_DELAY 3
113 unsigned long urbs_in_error_delay;
114 struct usb_cdc_line_coding line;
115 struct work_struct work;
116 struct delayed_work dwork;
117 unsigned int ctrlin;
118 unsigned int ctrlout;
119 struct async_icount iocount;
120 struct async_icount oldcount;
121 wait_queue_head_t wioctl;
122 unsigned int writesize;
123 unsigned int readsize,ctrlsize;
124 unsigned int minor;
125 unsigned char clocal;
126 unsigned int ctrl_caps;
127 unsigned int susp_count;
128 unsigned int combined_interfaces:1;
129 u8 bInterval;
130 struct usb_anchor delayed;
131 unsigned long quirks;
132 };
133
134 #define CDC_DATA_INTERFACE_TYPE 0x0a
135
136
137 #define NO_UNION_NORMAL BIT(0)
138 #define SINGLE_RX_URB BIT(1)
139 #define NO_CAP_LINE BIT(2)
140 #define NO_DATA_INTERFACE BIT(4)
141 #define IGNORE_DEVICE BIT(5)
142 #define QUIRK_CONTROL_LINE_STATE BIT(6)
143 #define CLEAR_HALT_CONDITIONS BIT(7)
144 #define SEND_ZERO_PACKET BIT(8)
145 #define DISABLE_ECHO BIT(9)