temp revert rk change
[firefly-linux-kernel-4.4.55.git] / drivers / misc / ts27010mux / ts27010_mux.h
1 /*
2  * ts27010_mux.h
3  *
4  * Copyright (C) 2002, 2004, 2009 Motorola, Inc.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19  *
20  */
21
22 /*
23 * This header file should be included by both MUX and other applications
24 * which access MUX device files. It gives the additional macro definitions
25 * shared between MUX and applications.
26 */
27
28 #define NR_MUXS 16
29
30 #define NUM_MUX_CMD_FILES 16
31 #define NUM_MUX_DATA_FILES 0
32 #define NUM_MUX_FILES (NUM_MUX_CMD_FILES  +  NUM_MUX_DATA_FILES)
33
34 #define LDISC_BUFFER_SIZE (4096 - sizeof(struct ts27010_ringbuf))
35
36 /* TODO: should use the IOCTLNUM macros */
37 /* Special ioctl() upon a MUX device file for hanging up a call */
38 #define TS0710MUX_IO_MSC_HANGUP 0x54F0
39
40 /* Special ioctl() upon a MUX device file for MUX loopback test */
41 #define TS0710MUX_IO_TEST_CMD 0x54F1
42
43 /* TODO: get rid of these */
44 /* Special Error code might be return from write() to a MUX device file */
45 #define EDISCONNECTED 900       /* link is disconnected */
46
47 /* Special Error code might be return from open() to a MUX device file  */
48 #define EREJECTED 901           /* link connection request is rejected */
49
50 /* TODO: goes away with clean tty interface */
51 extern struct tty_struct *ts27010mux_tty;
52
53 struct ts27010_ringbuf;
54
55 int ts27010_mux_active(void);
56 int ts27010_mux_line_open(int line);
57 void ts27010_mux_line_close(int line);
58 int ts27010_mux_line_write(int line, const unsigned char *buf, int count);
59 int ts27010_mux_line_chars_in_buffer(int line);
60 int ts27010_mux_line_write_room(int line);
61 void ts27010_mux_recv(struct ts27010_ringbuf *rbuf);
62
63 int ts27010_ldisc_init(void);
64 void ts27010_ldisc_remove(void);
65 int ts27010_ldisc_send(struct tty_struct *tty, u8 *data, int len);
66
67
68 int ts27010_tty_init(void);
69 void ts27010_tty_remove(void);
70 int ts27010_tty_send(int line, u8 *data, int len);
71 int ts27010_tty_send_rbuf(int line, struct ts27010_ringbuf *rbuf,
72                           int data_idx, int len);
73
74