gdm_tty.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * Copyright (c) 2012 GCT Semiconductor, Inc. All rights reserved.
  3. *
  4. * This software is licensed under the terms of the GNU General Public
  5. * License version 2, as published by the Free Software Foundation, and
  6. * may be copied, distributed, and modified under those terms.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. */
  13. #ifndef _GDM_TTY_H_
  14. #define _GDM_TTY_H_
  15. #include <linux/types.h>
  16. #include <linux/tty.h>
  17. #define TTY_MAX_COUNT 2
  18. #define MAX_ISSUE_NUM 3
  19. enum TO_HOST_RESULT {
  20. TO_HOST_BUFFER_REQUEST_FAIL = 1,
  21. TO_HOST_PORT_CLOSE = 2,
  22. TO_HOST_INVALID_PACKET = 3,
  23. };
  24. enum RECV_PACKET_PROCESS {
  25. RECV_PACKET_PROCESS_COMPLETE = 0,
  26. RECV_PACKET_PROCESS_CONTINUE = 1,
  27. };
  28. struct gdm {
  29. struct tty_dev *tty_dev;
  30. struct tty_port port;
  31. unsigned int index;
  32. unsigned int minor;
  33. };
  34. struct tty_dev {
  35. void *priv_dev;
  36. int (*send_func)(void *priv_dev,
  37. void *data,
  38. int len,
  39. int tty_index,
  40. void (*cb)(void *cb_data),
  41. void *cb_data);
  42. int (*recv_func)(void *priv_dev,
  43. int (*cb)(void *data,
  44. int len,
  45. int tty_index,
  46. struct tty_dev *tty_dev,
  47. int complete));
  48. int (*send_control)(void *priv_dev,
  49. int request,
  50. int value,
  51. void *data,
  52. int len);
  53. struct gdm *gdm[2];
  54. };
  55. int register_lte_tty_driver(void);
  56. void unregister_lte_tty_driver(void);
  57. int register_lte_tty_device(struct tty_dev *tty_dev, struct device *dev);
  58. void unregister_lte_tty_device(struct tty_dev *tty_dev);
  59. #endif /* _GDM_USB_H_ */