| 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 |
| Amit Virdi | ef11982 | 2014-08-22 14:36:36 +0530 | [diff] [blame^] | 13 | #define GZERO_INT_INTERVAL 1 /* Default interrupt interval = 1 ms */ |
| 14 | #define GZERO_INT_MAXPACKET 1024 |
| Andrzej Pietrasiewicz | c0501f4 | 2013-11-07 08:41:27 +0100 | [diff] [blame] | 15 | |
| Sebastian Andrzej Siewior | cf9a08a | 2012-12-23 21:10:01 +0100 | [diff] [blame] | 16 | struct usb_zero_options { |
| 17 | unsigned pattern; |
| 18 | unsigned isoc_interval; |
| 19 | unsigned isoc_maxpacket; |
| 20 | unsigned isoc_mult; |
| 21 | unsigned isoc_maxburst; |
| Amit Virdi | ef11982 | 2014-08-22 14:36:36 +0530 | [diff] [blame^] | 22 | unsigned int_interval; /* In ms */ |
| 23 | unsigned int_maxpacket; |
| 24 | unsigned int_mult; |
| 25 | unsigned int_maxburst; |
| Sebastian Andrzej Siewior | cf9a08a | 2012-12-23 21:10:01 +0100 | [diff] [blame] | 26 | unsigned bulk_buflen; |
| 27 | unsigned qlen; |
| 28 | }; |
| David Brownell | a400cad | 2008-06-19 17:55:23 -0700 | [diff] [blame] | 29 | |
| Sebastian Andrzej Siewior | cf9a08a | 2012-12-23 21:10:01 +0100 | [diff] [blame] | 30 | struct 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 Virdi | ef11982 | 2014-08-22 14:36:36 +0530 | [diff] [blame^] | 37 | unsigned int_interval; /* In ms */ |
| 38 | unsigned int_maxpacket; |
| 39 | unsigned int_mult; |
| 40 | unsigned int_maxburst; |
| Sebastian Andrzej Siewior | cf9a08a | 2012-12-23 21:10:01 +0100 | [diff] [blame] | 41 | unsigned bulk_buflen; |
| Andrzej Pietrasiewicz | 25d8015 | 2013-11-07 08:41:28 +0100 | [diff] [blame] | 42 | |
| 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 Siewior | cf9a08a | 2012-12-23 21:10:01 +0100 | [diff] [blame] | 51 | }; |
| 52 | |
| 53 | struct f_lb_opts { |
| 54 | struct usb_function_instance func_inst; |
| 55 | unsigned bulk_buflen; |
| 56 | unsigned qlen; |
| Andrzej Pietrasiewicz | c0501f4 | 2013-11-07 08:41:27 +0100 | [diff] [blame] | 57 | |
| 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 Siewior | cf9a08a | 2012-12-23 21:10:01 +0100 | [diff] [blame] | 66 | }; |
| 67 | |
| 68 | void lb_modexit(void); |
| 69 | int lb_modinit(void); |
| David Brownell | a400cad | 2008-06-19 17:55:23 -0700 | [diff] [blame] | 70 | |
| 71 | /* common utilities */ |
| David Brownell | a400cad | 2008-06-19 17:55:23 -0700 | [diff] [blame] | 72 | void free_ep_req(struct usb_ep *ep, struct usb_request *req); |
| 73 | void disable_endpoints(struct usb_composite_dev *cdev, |
| Paul Zimmerman | b4036cc | 2012-04-16 14:19:06 -0700 | [diff] [blame] | 74 | struct usb_ep *in, struct usb_ep *out, |
| Amit Virdi | ef11982 | 2014-08-22 14:36:36 +0530 | [diff] [blame^] | 75 | struct usb_ep *iso_in, struct usb_ep *iso_out, |
| 76 | struct usb_ep *int_in, struct usb_ep *int_out); |
| David Brownell | a400cad | 2008-06-19 17:55:23 -0700 | [diff] [blame] | 77 | |
| David Brownell | a400cad | 2008-06-19 17:55:23 -0700 | [diff] [blame] | 78 | #endif /* __G_ZERO_H */ |