blob: 2ce28b9d97cc81a519cff3adb6e07fa89aeb9e2a [file] [log] [blame]
David Brownella400cad2008-06-19 17:55:23 -07001/*
2 * This header declares the utility functions used by "Gadget Zero", plus
3 * interfaces to its two single-configuration function drivers.
4 */
5
6#ifndef __G_ZERO_H
7#define __G_ZERO_H
8
Andrzej Pietrasiewiczc0501f42013-11-07 08:41:27 +01009#define GZERO_BULK_BUFLEN 4096
10#define GZERO_QLEN 32
Andrzej Pietrasiewicz25d80152013-11-07 08:41:28 +010011#define GZERO_ISOC_INTERVAL 4
12#define GZERO_ISOC_MAXPACKET 1024
Amit Virdief119822014-08-22 14:36:36 +053013#define GZERO_INT_INTERVAL 1 /* Default interrupt interval = 1 ms */
14#define GZERO_INT_MAXPACKET 1024
Andrzej Pietrasiewiczc0501f42013-11-07 08:41:27 +010015
Sebastian Andrzej Siewiorcf9a08a2012-12-23 21:10:01 +010016struct usb_zero_options {
17 unsigned pattern;
18 unsigned isoc_interval;
19 unsigned isoc_maxpacket;
20 unsigned isoc_mult;
21 unsigned isoc_maxburst;
Amit Virdief119822014-08-22 14:36:36 +053022 unsigned int_interval; /* In ms */
23 unsigned int_maxpacket;
24 unsigned int_mult;
25 unsigned int_maxburst;
Sebastian Andrzej Siewiorcf9a08a2012-12-23 21:10:01 +010026 unsigned bulk_buflen;
27 unsigned qlen;
28};
David Brownella400cad2008-06-19 17:55:23 -070029
Sebastian Andrzej Siewiorcf9a08a2012-12-23 21:10:01 +010030struct f_ss_opts {
31 struct usb_function_instance func_inst;
32 unsigned pattern;
33 unsigned isoc_interval;
34 unsigned isoc_maxpacket;
35 unsigned isoc_mult;
36 unsigned isoc_maxburst;
Amit Virdief119822014-08-22 14:36:36 +053037 unsigned int_interval; /* In ms */
38 unsigned int_maxpacket;
39 unsigned int_mult;
40 unsigned int_maxburst;
Sebastian Andrzej Siewiorcf9a08a2012-12-23 21:10:01 +010041 unsigned bulk_buflen;
Andrzej Pietrasiewicz25d80152013-11-07 08:41:28 +010042
43 /*
44 * Read/write access to configfs attributes is handled by configfs.
45 *
46 * This is to protect the data from concurrent access by read/write
47 * and create symlink/remove symlink.
48 */
49 struct mutex lock;
50 int refcnt;
Sebastian Andrzej Siewiorcf9a08a2012-12-23 21:10:01 +010051};
52
53struct f_lb_opts {
54 struct usb_function_instance func_inst;
55 unsigned bulk_buflen;
56 unsigned qlen;
Andrzej Pietrasiewiczc0501f42013-11-07 08:41:27 +010057
58 /*
59 * Read/write access to configfs attributes is handled by configfs.
60 *
61 * This is to protect the data from concurrent access by read/write
62 * and create symlink/remove symlink.
63 */
64 struct mutex lock;
65 int refcnt;
Sebastian Andrzej Siewiorcf9a08a2012-12-23 21:10:01 +010066};
67
68void lb_modexit(void);
69int lb_modinit(void);
David Brownella400cad2008-06-19 17:55:23 -070070
71/* common utilities */
David Brownella400cad2008-06-19 17:55:23 -070072void free_ep_req(struct usb_ep *ep, struct usb_request *req);
73void disable_endpoints(struct usb_composite_dev *cdev,
Paul Zimmermanb4036cc2012-04-16 14:19:06 -070074 struct usb_ep *in, struct usb_ep *out,
Amit Virdief119822014-08-22 14:36:36 +053075 struct usb_ep *iso_in, struct usb_ep *iso_out,
76 struct usb_ep *int_in, struct usb_ep *int_out);
David Brownella400cad2008-06-19 17:55:23 -070077
David Brownella400cad2008-06-19 17:55:23 -070078#endif /* __G_ZERO_H */