g_zero.h 1.9 KB

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