David Brownell | a400cad | 2008-06-19 17:55:23 -0700 | [diff] [blame] | 1 | /* |
| 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 Pietrasiewicz | c0501f4 | 2013-11-07 08:41:27 +0100 | [diff] [blame] | 9 | #define GZERO_BULK_BUFLEN 4096 |
| 10 | #define GZERO_QLEN 32 |
Andrzej Pietrasiewicz | 25d8015 | 2013-11-07 08:41:28 +0100 | [diff] [blame] | 11 | #define GZERO_ISOC_INTERVAL 4 |
| 12 | #define GZERO_ISOC_MAXPACKET 1024 |
Andrzej Pietrasiewicz | c0501f4 | 2013-11-07 08:41:27 +0100 | [diff] [blame] | 13 | |
Sebastian Andrzej Siewior | cf9a08a | 2012-12-23 21:10:01 +0100 | [diff] [blame] | 14 | struct usb_zero_options { |
| 15 | unsigned pattern; |
| 16 | unsigned isoc_interval; |
| 17 | unsigned isoc_maxpacket; |
| 18 | unsigned isoc_mult; |
| 19 | unsigned isoc_maxburst; |
| 20 | unsigned bulk_buflen; |
| 21 | unsigned qlen; |
| 22 | }; |
David Brownell | a400cad | 2008-06-19 17:55:23 -0700 | [diff] [blame] | 23 | |
Sebastian Andrzej Siewior | cf9a08a | 2012-12-23 21:10:01 +0100 | [diff] [blame] | 24 | struct f_ss_opts { |
| 25 | struct usb_function_instance func_inst; |
| 26 | unsigned pattern; |
| 27 | unsigned isoc_interval; |
| 28 | unsigned isoc_maxpacket; |
| 29 | unsigned isoc_mult; |
| 30 | unsigned isoc_maxburst; |
| 31 | unsigned bulk_buflen; |
Andrzej Pietrasiewicz | 25d8015 | 2013-11-07 08:41:28 +0100 | [diff] [blame] | 32 | |
| 33 | /* |
| 34 | * Read/write access to configfs attributes is handled by configfs. |
| 35 | * |
| 36 | * This is to protect the data from concurrent access by read/write |
| 37 | * and create symlink/remove symlink. |
| 38 | */ |
| 39 | struct mutex lock; |
| 40 | int refcnt; |
Sebastian Andrzej Siewior | cf9a08a | 2012-12-23 21:10:01 +0100 | [diff] [blame] | 41 | }; |
| 42 | |
| 43 | struct f_lb_opts { |
| 44 | struct usb_function_instance func_inst; |
| 45 | unsigned bulk_buflen; |
| 46 | unsigned qlen; |
Andrzej Pietrasiewicz | c0501f4 | 2013-11-07 08:41:27 +0100 | [diff] [blame] | 47 | |
| 48 | /* |
| 49 | * Read/write access to configfs attributes is handled by configfs. |
| 50 | * |
| 51 | * This is to protect the data from concurrent access by read/write |
| 52 | * and create symlink/remove symlink. |
| 53 | */ |
| 54 | struct mutex lock; |
| 55 | int refcnt; |
Sebastian Andrzej Siewior | cf9a08a | 2012-12-23 21:10:01 +0100 | [diff] [blame] | 56 | }; |
| 57 | |
| 58 | void lb_modexit(void); |
| 59 | int lb_modinit(void); |
David Brownell | a400cad | 2008-06-19 17:55:23 -0700 | [diff] [blame] | 60 | |
| 61 | /* common utilities */ |
David Brownell | a400cad | 2008-06-19 17:55:23 -0700 | [diff] [blame] | 62 | void free_ep_req(struct usb_ep *ep, struct usb_request *req); |
| 63 | void disable_endpoints(struct usb_composite_dev *cdev, |
Paul Zimmerman | b4036cc | 2012-04-16 14:19:06 -0700 | [diff] [blame] | 64 | struct usb_ep *in, struct usb_ep *out, |
| 65 | struct usb_ep *iso_in, struct usb_ep *iso_out); |
David Brownell | a400cad | 2008-06-19 17:55:23 -0700 | [diff] [blame] | 66 | |
David Brownell | a400cad | 2008-06-19 17:55:23 -0700 | [diff] [blame] | 67 | #endif /* __G_ZERO_H */ |