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 
14 #ifndef _GDM_TTY_H_
15 #define _GDM_TTY_H_
16 
17 #include <linux/types.h>
18 #include <linux/tty.h>
19 
20 
21 #define TTY_MAX_COUNT		2
22 
23 #define MAX_ISSUE_NUM 3
24 
25 enum TO_HOST_RESULT {
26 	TO_HOST_BUFFER_REQUEST_FAIL = 1,
27 	TO_HOST_PORT_CLOSE = 2,
28 	TO_HOST_INVALID_PACKET = 3,
29 };
30 
31 enum RECV_PACKET_PROCESS {
32 	RECV_PACKET_PROCESS_COMPLETE = 0,
33 	RECV_PACKET_PROCESS_CONTINUE = 1,
34 };
35 
36 struct gdm {
37 	struct tty_dev *tty_dev;
38 	struct tty_port port;
39 	unsigned int index;
40 	unsigned int minor;
41 };
42 
43 struct tty_dev {
44 	void *priv_dev;
45 	int (*send_func)(void *priv_dev,
46 			 void *data,
47 			 int len,
48 			 int tty_index,
49 			 void (*cb)(void *cb_data),
50 			 void *cb_data);
51 	int (*recv_func)(void *priv_dev,
52 			 int (*cb)(void *data,
53 				   int len,
54 				   int tty_index,
55 				   struct tty_dev *tty_dev,
56 				   int complete));
57 	int (*send_control)(void *priv_dev,
58 			    int request,
59 			    int value,
60 			    void *data,
61 			    int len);
62 	struct gdm *gdm[2];
63 };
64 
65 int register_lte_tty_driver(void);
66 void unregister_lte_tty_driver(void);
67 int register_lte_tty_device(struct tty_dev *tty_dev, struct device *dev);
68 void unregister_lte_tty_device(struct tty_dev *tty_dev);
69 
70 #endif /* _GDM_USB_H_ */
71 
72