aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/usb/serial.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/usb/serial.h')
-rw-r--r--include/linux/usb/serial.h39
1 files changed, 30 insertions, 9 deletions
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 0a458b861933..55675b1efb28 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -35,6 +35,9 @@ enum port_dev_state {
35 PORT_UNREGISTERING, 35 PORT_UNREGISTERING,
36}; 36};
37 37
38/* USB serial flags */
39#define USB_SERIAL_WRITE_BUSY 0
40
38/** 41/**
39 * usb_serial_port: structure for the specific ports of a device. 42 * usb_serial_port: structure for the specific ports of a device.
40 * @serial: pointer back to the struct usb_serial owner of this port. 43 * @serial: pointer back to the struct usb_serial owner of this port.
@@ -49,7 +52,7 @@ enum port_dev_state {
49 * @interrupt_out_size: the size of the interrupt_out_buffer, in bytes. 52 * @interrupt_out_size: the size of the interrupt_out_buffer, in bytes.
50 * @interrupt_out_urb: pointer to the interrupt out struct urb for this port. 53 * @interrupt_out_urb: pointer to the interrupt out struct urb for this port.
51 * @interrupt_out_endpointAddress: endpoint address for the interrupt out pipe 54 * @interrupt_out_endpointAddress: endpoint address for the interrupt out pipe
52 * for this port. 55 * for this port.
53 * @bulk_in_buffer: pointer to the bulk in buffer for this port. 56 * @bulk_in_buffer: pointer to the bulk in buffer for this port.
54 * @bulk_in_size: the size of the bulk_in_buffer, in bytes. 57 * @bulk_in_size: the size of the bulk_in_buffer, in bytes.
55 * @read_urb: pointer to the bulk in struct urb for this port. 58 * @read_urb: pointer to the bulk in struct urb for this port.
@@ -60,13 +63,17 @@ enum port_dev_state {
60 * @write_urb: pointer to the bulk out struct urb for this port. 63 * @write_urb: pointer to the bulk out struct urb for this port.
61 * @write_fifo: kfifo used to buffer outgoing data 64 * @write_fifo: kfifo used to buffer outgoing data
62 * @write_urb_busy: port`s writing status 65 * @write_urb_busy: port`s writing status
66 * @bulk_out_buffers: pointers to the bulk out buffers for this port
67 * @write_urbs: pointers to the bulk out urbs for this port
68 * @write_urbs_free: status bitmap the for bulk out urbs
69 * @tx_bytes: number of bytes currently in host stack queues
63 * @bulk_out_endpointAddress: endpoint address for the bulk out pipe for this 70 * @bulk_out_endpointAddress: endpoint address for the bulk out pipe for this
64 * port. 71 * port.
72 * @flags: usb serial port flags
65 * @write_wait: a wait_queue_head_t used by the port. 73 * @write_wait: a wait_queue_head_t used by the port.
66 * @work: work queue entry for the line discipline waking up. 74 * @work: work queue entry for the line discipline waking up.
67 * @throttled: nonzero if the read urb is inactive to throttle the device 75 * @throttled: nonzero if the read urb is inactive to throttle the device
68 * @throttle_req: nonzero if the tty wants to throttle us 76 * @throttle_req: nonzero if the tty wants to throttle us
69 * @console: attached usb serial console
70 * @dev: pointer to the serial device 77 * @dev: pointer to the serial device
71 * 78 *
72 * This structure is used by the usb-serial core and drivers for the specific 79 * This structure is used by the usb-serial core and drivers for the specific
@@ -97,16 +104,19 @@ struct usb_serial_port {
97 struct urb *write_urb; 104 struct urb *write_urb;
98 struct kfifo write_fifo; 105 struct kfifo write_fifo;
99 int write_urb_busy; 106 int write_urb_busy;
107
108 unsigned char *bulk_out_buffers[2];
109 struct urb *write_urbs[2];
110 unsigned long write_urbs_free;
100 __u8 bulk_out_endpointAddress; 111 __u8 bulk_out_endpointAddress;
101 112
102 int tx_bytes_flight; 113 int tx_bytes;
103 int urbs_in_flight;
104 114
115 unsigned long flags;
105 wait_queue_head_t write_wait; 116 wait_queue_head_t write_wait;
106 struct work_struct work; 117 struct work_struct work;
107 char throttled; 118 char throttled;
108 char throttle_req; 119 char throttle_req;
109 char console;
110 unsigned long sysrq; /* sysrq timeout */ 120 unsigned long sysrq; /* sysrq timeout */
111 struct device dev; 121 struct device dev;
112 enum port_dev_state dev_state; 122 enum port_dev_state dev_state;
@@ -181,6 +191,8 @@ static inline void usb_set_serial_data(struct usb_serial *serial, void *data)
181 * @id_table: pointer to a list of usb_device_id structures that define all 191 * @id_table: pointer to a list of usb_device_id structures that define all
182 * of the devices this structure can support. 192 * of the devices this structure can support.
183 * @num_ports: the number of different ports this device will have. 193 * @num_ports: the number of different ports this device will have.
194 * @bulk_in_size: bytes to allocate for bulk-in buffer (0 = end-point size)
195 * @bulk_out_size: bytes to allocate for bulk-out buffer (0 = end-point size)
184 * @calc_num_ports: pointer to a function to determine how many ports this 196 * @calc_num_ports: pointer to a function to determine how many ports this
185 * device has dynamically. It will be called after the probe() 197 * device has dynamically. It will be called after the probe()
186 * callback is called, but before attach() 198 * callback is called, but before attach()
@@ -223,7 +235,9 @@ struct usb_serial_driver {
223 struct device_driver driver; 235 struct device_driver driver;
224 struct usb_driver *usb_driver; 236 struct usb_driver *usb_driver;
225 struct usb_dynids dynids; 237 struct usb_dynids dynids;
226 int max_in_flight_urbs; 238
239 size_t bulk_in_size;
240 size_t bulk_out_size;
227 241
228 int (*probe)(struct usb_serial *serial, const struct usb_device_id *id); 242 int (*probe)(struct usb_serial *serial, const struct usb_device_id *id);
229 int (*attach)(struct usb_serial *serial); 243 int (*attach)(struct usb_serial *serial);
@@ -269,6 +283,11 @@ struct usb_serial_driver {
269 void (*write_int_callback)(struct urb *urb); 283 void (*write_int_callback)(struct urb *urb);
270 void (*read_bulk_callback)(struct urb *urb); 284 void (*read_bulk_callback)(struct urb *urb);
271 void (*write_bulk_callback)(struct urb *urb); 285 void (*write_bulk_callback)(struct urb *urb);
286 /* Called by the generic read bulk callback */
287 void (*process_read_urb)(struct urb *urb);
288 /* Called by the generic write implementation */
289 int (*prepare_write_buffer)(struct usb_serial_port *port,
290 void *dest, size_t size);
272}; 291};
273#define to_usb_serial_driver(d) \ 292#define to_usb_serial_driver(d) \
274 container_of(d, struct usb_serial_driver, driver) 293 container_of(d, struct usb_serial_driver, driver)
@@ -318,10 +337,12 @@ extern void usb_serial_generic_disconnect(struct usb_serial *serial);
318extern void usb_serial_generic_release(struct usb_serial *serial); 337extern void usb_serial_generic_release(struct usb_serial *serial);
319extern int usb_serial_generic_register(int debug); 338extern int usb_serial_generic_register(int debug);
320extern void usb_serial_generic_deregister(void); 339extern void usb_serial_generic_deregister(void);
321extern void usb_serial_generic_resubmit_read_urb(struct usb_serial_port *port, 340extern int usb_serial_generic_submit_read_urb(struct usb_serial_port *port,
322 gfp_t mem_flags); 341 gfp_t mem_flags);
323extern int usb_serial_handle_sysrq_char(struct tty_struct *tty, 342extern void usb_serial_generic_process_read_urb(struct urb *urb);
324 struct usb_serial_port *port, 343extern int usb_serial_generic_prepare_write_buffer(struct usb_serial_port *port,
344 void *dest, size_t size);
345extern int usb_serial_handle_sysrq_char(struct usb_serial_port *port,
325 unsigned int ch); 346 unsigned int ch);
326extern int usb_serial_handle_break(struct usb_serial_port *port); 347extern int usb_serial_handle_break(struct usb_serial_port *port);
327 348