projects/linux·blob master · refs

74 lines · 1.7 KiB

1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * This header declares the utility functions used by "Gadget Zero", plus
4 * interfaces to its two single-configuration function drivers.
5 */
6
7#ifndef __G_ZERO_H
8#define __G_ZERO_H
9
10#define GZERO_BULK_BUFLEN 4096
11#define GZERO_QLEN 32
12#define GZERO_ISOC_INTERVAL 4
13#define GZERO_ISOC_MAXPACKET 1024
14#define GZERO_SS_BULK_QLEN 1
15#define GZERO_SS_ISO_QLEN 8
16
17struct usb_zero_options {
18 unsigned pattern;
19 unsigned isoc_interval;
20 unsigned isoc_maxpacket;
21 unsigned isoc_mult;
22 unsigned isoc_maxburst;
23 unsigned bulk_buflen;
24 unsigned qlen;
25 unsigned ss_bulk_qlen;
26 unsigned ss_iso_qlen;
27};
28
29struct f_ss_opts {
30 struct usb_function_instance func_inst;
31 unsigned pattern;
32 unsigned isoc_interval;
33 unsigned isoc_maxpacket;
34 unsigned isoc_mult;
35 unsigned isoc_maxburst;
36 unsigned bulk_buflen;
37 unsigned bulk_maxburst;
38 unsigned bulk_qlen;
39 unsigned iso_qlen;
40
41 /*
42 * Read/write access to configfs attributes is handled by configfs.
43 *
44 * This is to protect the data from concurrent access by read/write
45 * and create symlink/remove symlink.
46 */
47 struct mutex lock;
48 int refcnt;
49};
50
51struct f_lb_opts {
52 struct usb_function_instance func_inst;
53 unsigned bulk_buflen;
54 unsigned qlen;
55
56 /*
57 * Read/write access to configfs attributes is handled by configfs.
58 *
59 * This is to protect the data from concurrent access by read/write
60 * and create symlink/remove symlink.
61 */
62 struct mutex lock;
63 int refcnt;
64};
65
66void lb_modexit(void);
67int lb_modinit(void);
68
69/* common utilities */
70void disable_endpoints(struct usb_composite_dev *cdev,
71 struct usb_ep *in, struct usb_ep *out,
72 struct usb_ep *iso_in, struct usb_ep *iso_out);
73
74#endif /* __G_ZERO_H */