blob: 492924d0d599baa18c4fd0c8d5f3d1d93aa2c8c7 [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
Peter Chen0d6c3d92015-11-19 15:02:16 +080013#define GZERO_SS_BULK_QLEN 1
14#define GZERO_SS_ISO_QLEN 8
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;
22 unsigned bulk_buflen;
23 unsigned qlen;
Peter Chen0d6c3d92015-11-19 15:02:16 +080024 unsigned ss_bulk_qlen;
25 unsigned ss_iso_qlen;
Sebastian Andrzej Siewiorcf9a08a2012-12-23 21:10:01 +010026};
David Brownella400cad2008-06-19 17:55:23 -070027
Sebastian Andrzej Siewiorcf9a08a2012-12-23 21:10:01 +010028struct f_ss_opts {
29 struct usb_function_instance func_inst;
30 unsigned pattern;
31 unsigned isoc_interval;
32 unsigned isoc_maxpacket;
33 unsigned isoc_mult;
34 unsigned isoc_maxburst;
35 unsigned bulk_buflen;
Peter Chen0d6c3d92015-11-19 15:02:16 +080036 unsigned bulk_qlen;
37 unsigned iso_qlen;
Andrzej Pietrasiewicz25d80152013-11-07 08:41:28 +010038
39 /*
40 * Read/write access to configfs attributes is handled by configfs.
41 *
42 * This is to protect the data from concurrent access by read/write
43 * and create symlink/remove symlink.
44 */
45 struct mutex lock;
46 int refcnt;
Sebastian Andrzej Siewiorcf9a08a2012-12-23 21:10:01 +010047};
48
49struct f_lb_opts {
50 struct usb_function_instance func_inst;
51 unsigned bulk_buflen;
52 unsigned qlen;
Andrzej Pietrasiewiczc0501f42013-11-07 08:41:27 +010053
54 /*
55 * Read/write access to configfs attributes is handled by configfs.
56 *
57 * This is to protect the data from concurrent access by read/write
58 * and create symlink/remove symlink.
59 */
60 struct mutex lock;
61 int refcnt;
Sebastian Andrzej Siewiorcf9a08a2012-12-23 21:10:01 +010062};
63
64void lb_modexit(void);
65int lb_modinit(void);
David Brownella400cad2008-06-19 17:55:23 -070066
67/* common utilities */
David Brownella400cad2008-06-19 17:55:23 -070068void disable_endpoints(struct usb_composite_dev *cdev,
Paul Zimmermanb4036cc2012-04-16 14:19:06 -070069 struct usb_ep *in, struct usb_ep *out,
Felipe Balbi2c247802015-03-11 10:00:05 -050070 struct usb_ep *iso_in, struct usb_ep *iso_out);
David Brownella400cad2008-06-19 17:55:23 -070071
David Brownella400cad2008-06-19 17:55:23 -070072#endif /* __G_ZERO_H */