u_rmnet.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. */
  12. #ifndef __U_RMNET_H
  13. #define __U_RMNET_H
  14. #include <linux/usb/composite.h>
  15. #include <linux/usb/cdc.h>
  16. #include <linux/wait.h>
  17. #include <linux/workqueue.h>
  18. struct rmnet_ctrl_pkt {
  19. void *buf;
  20. int len;
  21. struct list_head list;
  22. };
  23. struct grmnet {
  24. struct usb_function func;
  25. struct usb_ep *in;
  26. struct usb_ep *out;
  27. /* to usb host, aka laptop, windows pc etc. Will
  28. * be filled by usb driver of rmnet functionality
  29. */
  30. int (*send_cpkt_response)(void *g, void *buf, size_t len);
  31. /* to modem, and to be filled by driver implementing
  32. * control function
  33. */
  34. int (*send_encap_cmd)(u8 port_num, void *buf, size_t len);
  35. void (*notify_modem)(void *g, u8 port_num, int cbits);
  36. void (*disconnect)(struct grmnet *g);
  37. void (*connect)(struct grmnet *g);
  38. };
  39. enum ctrl_client {
  40. FRMNET_CTRL_CLIENT,
  41. GPS_CTRL_CLIENT,
  42. NR_CTRL_CLIENTS
  43. };
  44. int gbam_setup(unsigned int no_bam_port, unsigned int no_bam2bam_port);
  45. void gbam_cleanup(void);
  46. int gbam_connect(struct grmnet *gr, u8 port_num,
  47. enum transport_type trans, u8 src_connection_idx,
  48. u8 dst_connection_idx);
  49. void gbam_disconnect(struct grmnet *gr, u8 port_num,
  50. enum transport_type trans);
  51. void gbam_suspend(struct grmnet *gr, u8 port_num, enum transport_type trans);
  52. void gbam_resume(struct grmnet *gr, u8 port_num, enum transport_type trans);
  53. int gsmd_ctrl_connect(struct grmnet *gr, int port_num);
  54. void gsmd_ctrl_disconnect(struct grmnet *gr, u8 port_num);
  55. int gsmd_ctrl_setup(enum ctrl_client client_num, unsigned int count,
  56. u8 *first_port_idx);
  57. int gqti_ctrl_connect(struct grmnet *gr);
  58. void gqti_ctrl_disconnect(struct grmnet *gr);
  59. #endif /* __U_RMNET_H*/