aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/gdm724x/gdm_tty.h
blob: 297438b4ddcbc39a0694e5dd63c09d2a86be2ccf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
 * Copyright (c) 2012 GCT Semiconductor, Inc. All rights reserved.
 *
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
 * may be copied, distributed, and modified under those terms.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 */

#ifndef _GDM_TTY_H_
#define _GDM_TTY_H_

#include <linux/types.h>
#include <linux/tty.h>


#define TTY_MAX_COUNT		2

#define MAX_ISSUE_NUM 3

enum TO_HOST_RESULT {
	TO_HOST_BUFFER_REQUEST_FAIL = 1,
	TO_HOST_PORT_CLOSE = 2,
	TO_HOST_INVALID_PACKET = 3,
};

enum RECV_PACKET_PROCESS {
	RECV_PACKET_PROCESS_COMPLETE = 0,
	RECV_PACKET_PROCESS_CONTINUE = 1,
};

struct gdm {
	struct tty_dev *tty_dev;
	struct tty_port port;
	unsigned int index;
	unsigned int minor;
};

struct tty_dev {
	void *priv_dev;
	int (*send_func)(void *priv_dev,
			 void *data,
			 int len,
			 int tty_index,
			 void (*cb)(void *cb_data),
			 void *cb_data);
	int (*recv_func)(void *priv_dev,
			 int (*cb)(void *data,
				   int len,
				   int tty_index,
				   struct tty_dev *tty_dev,
				   int complete));
	int (*send_control)(void *priv_dev,
			    int request,
			    int value,
			    void *data,
			    int len);
	struct gdm *gdm[2];
};

int register_lte_tty_driver(void);
void unregister_lte_tty_driver(void);
int register_lte_tty_device(struct tty_dev *tty_dev, struct device *dev);
void unregister_lte_tty_device(struct tty_dev *tty_dev);

#endif /* _GDM_USB_H_ */