g_zero.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. #ifndef __G_ZERO_H
  7. #define __G_ZERO_H
  8. #define GZERO_BULK_BUFLEN 4096
  9. #define GZERO_QLEN 32
  10. #define GZERO_ISOC_INTERVAL 4
  11. #define GZERO_ISOC_MAXPACKET 1024
  12. #define GZERO_SS_BULK_QLEN 1
  13. #define GZERO_SS_ISO_QLEN 8
  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. unsigned ss_bulk_qlen;
  23. unsigned ss_iso_qlen;
  24. };
  25. struct f_ss_opts {
  26. struct usb_function_instance func_inst;
  27. unsigned pattern;
  28. unsigned isoc_interval;
  29. unsigned isoc_maxpacket;
  30. unsigned isoc_mult;
  31. unsigned isoc_maxburst;
  32. unsigned bulk_buflen;
  33. unsigned bulk_qlen;
  34. unsigned iso_qlen;
  35. /*
  36. * Read/write access to configfs attributes is handled by configfs.
  37. *
  38. * This is to protect the data from concurrent access by read/write
  39. * and create symlink/remove symlink.
  40. */
  41. struct mutex lock;
  42. int refcnt;
  43. };
  44. struct f_lb_opts {
  45. struct usb_function_instance func_inst;
  46. unsigned bulk_buflen;
  47. unsigned qlen;
  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;
  56. };
  57. void lb_modexit(void);
  58. int lb_modinit(void);
  59. /* common utilities */
  60. void disable_endpoints(struct usb_composite_dev *cdev,
  61. struct usb_ep *in, struct usb_ep *out,
  62. struct usb_ep *iso_in, struct usb_ep *iso_out);
  63. #endif /* __G_ZERO_H */