Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[wrt350n-kernel.git] / include / net / irda / ircomm_tty.h
blobeea2e615238903340082f7189d2195757246e1e5
1 /*********************************************************************
2 *
3 * Filename: ircomm_tty.h
4 * Version:
5 * Description:
6 * Status: Experimental.
7 * Author: Dag Brattli <dagb@cs.uit.no>
8 * Created at: Sun Jun 6 23:24:22 1999
9 * Modified at: Fri Jan 28 13:16:57 2000
10 * Modified by: Dag Brattli <dagb@cs.uit.no>
12 * Copyright (c) 1999-2000 Dag Brattli, All Rights Reserved.
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License as
16 * published by the Free Software Foundation; either version 2 of
17 * the License, or (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
27 * MA 02111-1307 USA
29 ********************************************************************/
31 #ifndef IRCOMM_TTY_H
32 #define IRCOMM_TTY_H
34 #include <linux/serial.h>
35 #include <linux/termios.h>
36 #include <linux/timer.h>
37 #include <linux/tty.h> /* struct tty_struct */
39 #include <net/irda/irias_object.h>
40 #include <net/irda/ircomm_core.h>
41 #include <net/irda/ircomm_param.h>
43 #define IRCOMM_TTY_PORTS 32
44 #define IRCOMM_TTY_MAGIC 0x3432
45 #define IRCOMM_TTY_MAJOR 161
46 #define IRCOMM_TTY_MINOR 0
48 /* This is used as an initial value to max_header_size before the proper
49 * value is filled in (5 for ttp, 4 for lmp). This allow us to detect
50 * the state of the underlying connection. - Jean II */
51 #define IRCOMM_TTY_HDR_UNINITIALISED 16
52 /* Same for payload size. See qos.c for the smallest max data size */
53 #define IRCOMM_TTY_DATA_UNINITIALISED (64 - IRCOMM_TTY_HDR_UNINITIALISED)
55 /* Those are really defined in include/linux/serial.h - Jean II */
56 #define ASYNC_B_INITIALIZED 31 /* Serial port was initialized */
57 #define ASYNC_B_NORMAL_ACTIVE 29 /* Normal device is active */
58 #define ASYNC_B_CLOSING 27 /* Serial port is closing */
61 * IrCOMM TTY driver state
63 struct ircomm_tty_cb {
64 irda_queue_t queue; /* Must be first */
65 magic_t magic;
67 int state; /* Connect state */
69 struct tty_struct *tty;
70 struct ircomm_cb *ircomm; /* IrCOMM layer instance */
72 struct sk_buff *tx_skb; /* Transmit buffer */
73 struct sk_buff *ctrl_skb; /* Control data buffer */
75 /* Parameters */
76 struct ircomm_params settings;
78 __u8 service_type; /* The service that we support */
79 int client; /* True if we are a client */
80 LOCAL_FLOW flow; /* IrTTP flow status */
82 int line;
83 unsigned long flags;
85 __u8 dlsap_sel;
86 __u8 slsap_sel;
88 __u32 saddr;
89 __u32 daddr;
91 __u32 max_data_size; /* Max data we can transmit in one packet */
92 __u32 max_header_size; /* The amount of header space we must reserve */
93 __u32 tx_data_size; /* Max data size of current tx_skb */
95 struct iriap_cb *iriap; /* Instance used for querying remote IAS */
96 struct ias_object* obj;
97 void *skey;
98 void *ckey;
100 wait_queue_head_t open_wait;
101 wait_queue_head_t close_wait;
102 struct timer_list watchdog_timer;
103 struct work_struct tqueue;
105 unsigned short close_delay;
106 unsigned short closing_wait; /* time to wait before closing */
108 int open_count;
109 int blocked_open; /* # of blocked opens */
111 /* Protect concurent access to :
112 * o self->open_count
113 * o self->ctrl_skb
114 * o self->tx_skb
115 * Maybe other things may gain to be protected as well...
116 * Jean II */
117 spinlock_t spinlock;
120 void ircomm_tty_start(struct tty_struct *tty);
121 void ircomm_tty_check_modem_status(struct ircomm_tty_cb *self);
123 extern int ircomm_tty_tiocmget(struct tty_struct *tty, struct file *file);
124 extern int ircomm_tty_tiocmset(struct tty_struct *tty, struct file *file,
125 unsigned int set, unsigned int clear);
126 extern int ircomm_tty_ioctl(struct tty_struct *tty, struct file *file,
127 unsigned int cmd, unsigned long arg);
128 extern void ircomm_tty_set_termios(struct tty_struct *tty,
129 struct ktermios *old_termios);
131 #endif