Blame view

include/linux/tty_driver.h 15.5 KB
b24413180   Greg Kroah-Hartman   License cleanup: ...
1
  /* SPDX-License-Identifier: GPL-2.0 */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2
3
4
5
6
7
8
9
10
  #ifndef _LINUX_TTY_DRIVER_H
  #define _LINUX_TTY_DRIVER_H
  
  /*
   * This structure defines the interface between the low-level tty
   * driver and the tty routines.  The following routines can be
   * defined; unless noted otherwise, they are optional, and can be
   * filled in with a null pointer.
   *
8ead9dd54   Linus Torvalds   devpts: more pty ...
11
   * struct tty_struct * (*lookup)(struct tty_driver *self, struct file *, int idx)
99f1fe189   Alan Cox   tty: Clean up the...
12
13
14
15
16
17
18
   *
   *	Return the tty device corresponding to idx, NULL if there is not
   *	one currently in use and an ERR_PTR value on error. Called under
   *	tty_mutex (for now!)
   *
   *	Optional method. Default behaviour is to use the ttys array
   *
8b0a88d59   Alan Cox   tty: More driver ...
19
20
21
22
23
24
25
26
27
28
29
30
31
32
   * int (*install)(struct tty_driver *self, struct tty_struct *tty)
   *
   *	Install a new tty into the tty driver internal tables. Used in
   *	conjunction with lookup and remove methods.
   *
   *	Optional method. Default behaviour is to use the ttys array
   *
   * void (*remove)(struct tty_driver *self, struct tty_struct *tty)
   *
   *	Remove a closed tty from the tty driver internal tables. Used in
   *	conjunction with lookup and remove methods.
   *
   *	Optional method. Default behaviour is to use the ttys array
   *
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
33
34
35
36
37
   * int  (*open)(struct tty_struct * tty, struct file * filp);
   *
   * 	This routine is called when a particular tty device is opened.
   * 	This routine is mandatory; if this routine is not filled in,
   * 	the attempted open will fail with ENODEV.
f34d7a5b7   Alan Cox   tty: The big oper...
38
   *
ed617e442   Peter Hurley   tty: Document loc...
39
40
   *	Required method. Called with tty lock held.
   *
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
41
42
43
   * void (*close)(struct tty_struct * tty, struct file * filp);
   *
   * 	This routine is called when a particular tty device is closed.
7be88b4cc   Peter Hurley   tty: Document req...
44
   *	Note: called even if the corresponding open() failed.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
45
   *
ed617e442   Peter Hurley   tty: Document loc...
46
   *	Required method. Called with tty lock held.
f34d7a5b7   Alan Cox   tty: The big oper...
47
   *
feebed651   Alan Cox   tty: shutdown method
48
49
   * void (*shutdown)(struct tty_struct * tty);
   *
36b3c070d   Alan Cox   tty: Move the han...
50
51
52
   * 	This routine is called under the tty lock when a particular tty device
   *	is closed for the last time. It executes before the tty resources
   *	are freed so may execute while another function holds a tty kref.
f278a2f7b   Dave Young   tty: Fix regressi...
53
54
55
56
57
58
59
   *
   * void (*cleanup)(struct tty_struct * tty);
   *
   *	This routine is called asynchronously when a particular tty device
   *	is closed for the last time freeing up the resources. This is
   *	actually the second part of shutdown for routines that might sleep.
   *
feebed651   Alan Cox   tty: shutdown method
60
   *
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
61
62
63
64
65
66
   * int (*write)(struct tty_struct * tty,
   * 		 const unsigned char *buf, int count);
   *
   * 	This routine is called by the kernel to write a series of
   * 	characters to the tty device.  The characters may come from
   * 	user space or kernel space.  This routine will return the
36c7343b4   Alan Cox   tty_driver: Updat...
67
   *	number of characters actually accepted for writing.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
68
   *
f34d7a5b7   Alan Cox   tty: The big oper...
69
70
71
   *	Optional: Required for writable devices.
   *
   * int (*put_char)(struct tty_struct *tty, unsigned char ch);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
72
73
74
75
76
77
78
   *
   * 	This routine is called by the kernel to write a single
   * 	character to the tty device.  If the kernel uses this routine,
   * 	it must call the flush_chars() routine (if defined) when it is
   * 	done stuffing characters into the driver.  If there is no room
   * 	in the queue, the character is ignored.
   *
f34d7a5b7   Alan Cox   tty: The big oper...
79
80
81
82
   *	Optional: Kernel will use the write method if not provided.
   *
   *	Note: Do not call this function directly, call tty_put_char
   *
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
83
84
85
86
   * void (*flush_chars)(struct tty_struct *tty);
   *
   * 	This routine is called by the kernel after it has written a
   * 	series of characters to the tty device using put_char().  
f34d7a5b7   Alan Cox   tty: The big oper...
87
88
89
90
   *
   *	Optional:
   *
   *	Note: Do not call this function directly, call tty_driver_flush_chars
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
91
92
93
94
95
96
97
   * 
   * int  (*write_room)(struct tty_struct *tty);
   *
   * 	This routine returns the numbers of characters the tty driver
   * 	will accept for queuing to be written.  This number is subject
   * 	to change as output buffers get emptied, or if the output flow
   *	control is acted.
f34d7a5b7   Alan Cox   tty: The big oper...
98
99
100
101
   *
   *	Required if write method is provided else not needed.
   *
   *	Note: Do not call this function directly, call tty_write_room
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
102
   * 
6caa76b77   Alan Cox   tty: now phase ou...
103
   * int  (*ioctl)(struct tty_struct *tty, unsigned int cmd, unsigned long arg);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
104
105
   *
   * 	This routine allows the tty driver to implement
6ce5b1ce5   Timur Tabi   tty: fix typos/er...
106
   *	device-specific ioctls.  If the ioctl number passed in cmd
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
107
   * 	is not recognized by the driver, it should return ENOIOCTLCMD.
e10cc1df1   Paul Fulghum   tty: add compat_i...
108
   *
f34d7a5b7   Alan Cox   tty: The big oper...
109
110
   *	Optional
   *
6caa76b77   Alan Cox   tty: now phase ou...
111
   * long (*compat_ioctl)(struct tty_struct *tty,,
e10cc1df1   Paul Fulghum   tty: add compat_i...
112
113
114
   * 	                unsigned int cmd, unsigned long arg);
   *
   * 	implement ioctl processing for 32 bit process on 64 bit system
f34d7a5b7   Alan Cox   tty: The big oper...
115
116
   *
   *	Optional
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
117
   * 
edc6afc54   Alan Cox   [PATCH] tty: swit...
118
   * void (*set_termios)(struct tty_struct *tty, struct ktermios * old);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
119
120
   *
   * 	This routine allows the tty driver to be notified when
f34d7a5b7   Alan Cox   tty: The big oper...
121
122
123
124
   * 	device's termios settings have changed.
   *
   *	Optional: Called under the termios lock
   *
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
125
126
127
128
129
   *
   * void (*set_ldisc)(struct tty_struct *tty);
   *
   * 	This routine allows the tty driver to be notified when the
   * 	device's termios settings have changed.
f34d7a5b7   Alan Cox   tty: The big oper...
130
131
   *
   *	Optional: Called under BKL (currently)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
132
133
134
135
136
137
   * 
   * void (*throttle)(struct tty_struct * tty);
   *
   * 	This routine notifies the tty driver that input buffers for
   * 	the line discipline are close to full, and it should somehow
   * 	signal that no more characters should be sent to the tty.
39c2e60f8   Alan Cox   tty: add throttle...
138
   *
38db89799   Alan Cox   tty: throttling r...
139
140
   *	Optional: Always invoke via tty_throttle(), called under the
   *	termios lock.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
141
142
143
144
145
146
147
   * 
   * void (*unthrottle)(struct tty_struct * tty);
   *
   * 	This routine notifies the tty drivers that it should signals
   * 	that characters can now be sent to the tty without fear of
   * 	overrunning the input buffers of the line disciplines.
   * 
38db89799   Alan Cox   tty: throttling r...
148
149
   *	Optional: Always invoke via tty_unthrottle(), called under the
   *	termios lock.
39c2e60f8   Alan Cox   tty: add throttle...
150
   *
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
151
152
153
154
   * void (*stop)(struct tty_struct *tty);
   *
   * 	This routine notifies the tty driver that it should stop
   * 	outputting characters to the tty device.  
f34d7a5b7   Alan Cox   tty: The big oper...
155
   *
f9e053dcf   Peter Hurley   tty: Serialize tt...
156
157
   *	Called with ->flow_lock held. Serialized with start() method.
   *
f34d7a5b7   Alan Cox   tty: The big oper...
158
159
160
   *	Optional:
   *
   *	Note: Call stop_tty not this method.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
161
162
163
164
165
   * 
   * void (*start)(struct tty_struct *tty);
   *
   * 	This routine notifies the tty driver that it resume sending
   *	characters to the tty device.
f34d7a5b7   Alan Cox   tty: The big oper...
166
   *
f9e053dcf   Peter Hurley   tty: Serialize tt...
167
168
   *	Called with ->flow_lock held. Serialized with stop() method.
   *
f34d7a5b7   Alan Cox   tty: The big oper...
169
170
171
   *	Optional:
   *
   *	Note: Call start_tty not this method.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
172
173
174
   * 
   * void (*hangup)(struct tty_struct *tty);
   *
6ce5b1ce5   Timur Tabi   tty: fix typos/er...
175
   * 	This routine notifies the tty driver that it should hang up the
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
176
177
   * 	tty device.
   *
36c7343b4   Alan Cox   tty_driver: Updat...
178
   *	Optional:
f34d7a5b7   Alan Cox   tty: The big oper...
179
   *
ed617e442   Peter Hurley   tty: Document loc...
180
181
   *	Called with tty lock held.
   *
6ce5b1ce5   Timur Tabi   tty: fix typos/er...
182
   * int (*break_ctl)(struct tty_struct *tty, int state);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
183
184
185
186
187
188
189
190
   *
   * 	This optional routine requests the tty driver to turn on or
   * 	off BREAK status on the RS-232 port.  If state is -1,
   * 	then the BREAK status should be turned on; if state is 0, then
   * 	BREAK should be turned off.
   *
   * 	If this routine is implemented, the high-level tty driver will
   * 	handle the following ioctls: TCSBRK, TCSBRKP, TIOCSBRK,
f34d7a5b7   Alan Cox   tty: The big oper...
191
192
   * 	TIOCCBRK.
   *
9e98966c7   Alan Cox   tty: rework break...
193
194
195
196
   *	If the driver sets TTY_DRIVER_HARDWARE_BREAK then the interface
   *	will also be called with actual times and the hardware is expected
   *	to do the delay work itself. 0 and -1 are still used for on/off.
   *
f34d7a5b7   Alan Cox   tty: The big oper...
197
   *	Optional: Required for TCSBRK/BRKP/etc handling.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
198
199
200
201
202
203
   *
   * void (*wait_until_sent)(struct tty_struct *tty, int timeout);
   * 
   * 	This routine waits until the device has written out all of the
   * 	characters in its transmitter FIFO.
   *
f34d7a5b7   Alan Cox   tty: The big oper...
204
205
206
207
   *	Optional: If not provided the device is assumed to have no FIFO
   *
   *	Note: Usually correct to call tty_wait_until_sent
   *
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
208
209
210
211
   * void (*send_xchar)(struct tty_struct *tty, char ch);
   *
   * 	This routine is used to send a high-priority XON/XOFF
   * 	character to the device.
f34d7a5b7   Alan Cox   tty: The big oper...
212
213
214
   *
   *	Optional: If not provided then the write method is called under
   *	the atomic write lock to keep it serialized with the ldisc.
8c9a9dd0f   Alan Cox   tty: remove resiz...
215
   *
fc6f62382   Alan Cox   pty: simplify resize
216
   * int (*resize)(struct tty_struct *tty, struct winsize *ws)
8c9a9dd0f   Alan Cox   tty: remove resiz...
217
218
219
220
221
222
223
224
225
   *
   *	Called when a termios request is issued which changes the
   *	requested terminal geometry.
   *
   *	Optional: the default action is to update the termios structure
   *	without error. This is usually the correct behaviour. Drivers should
   *	not force errors here if they are not resizable objects (eg a serial
   *	line). See tty_do_resize() if you need to wrap the standard method
   *	in your own logic - the usual case.
1d65b4a08   Alan Cox   tty: Add termiox
226
227
228
229
230
231
232
233
   *
   * void (*set_termiox)(struct tty_struct *tty, struct termiox *new);
   *
   *	Called when the device receives a termiox based ioctl. Passes down
   *	the requested data from user space. This method will not be invoked
   *	unless the tty also has a valid tty->termiox pointer.
   *
   *	Optional: Called under the termios lock
d281da7ff   Alan Cox   tty: Make tiocgic...
234
235
236
237
238
239
   *
   * int (*get_icount)(struct tty_struct *tty, struct serial_icounter *icount);
   *
   *	Called when the device receives a TIOCGICOUNT ioctl. Passed a kernel
   *	structure to complete. This method is optional and will only be called
   *	if provided (otherwise EINVAL will be returned).
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
240
   */
1a54a76d5   Jiri Slaby   TTY: let alloc_tt...
241
  #include <linux/export.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
242
243
244
  #include <linux/fs.h>
  #include <linux/list.h>
  #include <linux/cdev.h>
3dfbd044d   Jiri Slaby   TTY: include term...
245
  #include <linux/termios.h>
d01c3289e   Masatake YAMATO   pty: show associa...
246
  #include <linux/seq_file.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
247
248
  
  struct tty_struct;
f2d937f3b   Jason Wessel   consoles: polling...
249
  struct tty_driver;
d281da7ff   Alan Cox   tty: Make tiocgic...
250
  struct serial_icounter_struct;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
251
252
  
  struct tty_operations {
15f1a6338   Sukadev Bhattiprolu   Add an instance p...
253
  	struct tty_struct * (*lookup)(struct tty_driver *driver,
8ead9dd54   Linus Torvalds   devpts: more pty ...
254
  			struct file *filp, int idx);
8b0a88d59   Alan Cox   tty: More driver ...
255
256
  	int  (*install)(struct tty_driver *driver, struct tty_struct *tty);
  	void (*remove)(struct tty_driver *driver, struct tty_struct *tty);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
257
258
  	int  (*open)(struct tty_struct * tty, struct file * filp);
  	void (*close)(struct tty_struct * tty, struct file * filp);
feebed651   Alan Cox   tty: shutdown method
259
  	void (*shutdown)(struct tty_struct *tty);
f278a2f7b   Dave Young   tty: Fix regressi...
260
  	void (*cleanup)(struct tty_struct *tty);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
261
262
  	int  (*write)(struct tty_struct * tty,
  		      const unsigned char *buf, int count);
f34d7a5b7   Alan Cox   tty: The big oper...
263
  	int  (*put_char)(struct tty_struct *tty, unsigned char ch);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
264
265
266
  	void (*flush_chars)(struct tty_struct *tty);
  	int  (*write_room)(struct tty_struct *tty);
  	int  (*chars_in_buffer)(struct tty_struct *tty);
6caa76b77   Alan Cox   tty: now phase ou...
267
  	int  (*ioctl)(struct tty_struct *tty,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
268
  		    unsigned int cmd, unsigned long arg);
6caa76b77   Alan Cox   tty: now phase ou...
269
  	long (*compat_ioctl)(struct tty_struct *tty,
e10cc1df1   Paul Fulghum   tty: add compat_i...
270
  			     unsigned int cmd, unsigned long arg);
edc6afc54   Alan Cox   [PATCH] tty: swit...
271
  	void (*set_termios)(struct tty_struct *tty, struct ktermios * old);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
272
273
274
275
276
  	void (*throttle)(struct tty_struct * tty);
  	void (*unthrottle)(struct tty_struct * tty);
  	void (*stop)(struct tty_struct *tty);
  	void (*start)(struct tty_struct *tty);
  	void (*hangup)(struct tty_struct *tty);
9e98966c7   Alan Cox   tty: rework break...
277
  	int (*break_ctl)(struct tty_struct *tty, int state);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
278
279
280
281
  	void (*flush_buffer)(struct tty_struct *tty);
  	void (*set_ldisc)(struct tty_struct *tty);
  	void (*wait_until_sent)(struct tty_struct *tty, int timeout);
  	void (*send_xchar)(struct tty_struct *tty, char ch);
60b33c133   Alan Cox   tiocmget: kill of...
282
  	int (*tiocmget)(struct tty_struct *tty);
20b9d1771   Alan Cox   tiocmset: kill th...
283
  	int (*tiocmset)(struct tty_struct *tty,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
284
  			unsigned int set, unsigned int clear);
fc6f62382   Alan Cox   pty: simplify resize
285
  	int (*resize)(struct tty_struct *tty, struct winsize *ws);
1d65b4a08   Alan Cox   tty: Add termiox
286
  	int (*set_termiox)(struct tty_struct *tty, struct termiox *tnew);
d281da7ff   Alan Cox   tty: Make tiocgic...
287
288
  	int (*get_icount)(struct tty_struct *tty,
  				struct serial_icounter_struct *icount);
d01c3289e   Masatake YAMATO   pty: show associa...
289
  	void (*show_fdinfo)(struct tty_struct *tty, struct seq_file *m);
f2d937f3b   Jason Wessel   consoles: polling...
290
291
292
293
294
  #ifdef CONFIG_CONSOLE_POLL
  	int (*poll_init)(struct tty_driver *driver, int line, char *options);
  	int (*poll_get_char)(struct tty_driver *driver, int line);
  	void (*poll_put_char)(struct tty_driver *driver, int line, char ch);
  #endif
ae149b6be   Alexey Dobriyan   proc tty: add str...
295
  	const struct file_operations *proc_fops;
3859a271a   Kees Cook   randstruct: Mark ...
296
  } __randomize_layout;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
297
298
299
  
  struct tty_driver {
  	int	magic;		/* magic number for this structure */
7d7b93c14   Alan Cox   tty: kref the tty...
300
  	struct kref kref;	/* Reference management */
a3a10ce34   Richard Watts   Avoid usb reset c...
301
  	struct cdev **cdevs;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
302
303
  	struct module	*owner;
  	const char	*driver_name;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
304
305
306
307
  	const char	*name;
  	int	name_base;	/* offset of printed name */
  	int	major;		/* major device number */
  	int	minor_start;	/* start of minor device number */
7f0bc6a68   Jiri Slaby   TTY: pass flags t...
308
  	unsigned int	num;	/* number of devices allocated */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
309
310
  	short	type;		/* type of tty driver */
  	short	subtype;	/* subtype of tty driver */
edc6afc54   Alan Cox   [PATCH] tty: swit...
311
  	struct ktermios init_termios; /* Initial termios */
7f0bc6a68   Jiri Slaby   TTY: pass flags t...
312
  	unsigned long	flags;		/* tty driver flags */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
313
314
315
316
317
318
319
  	struct proc_dir_entry *proc_entry; /* /proc fs entry */
  	struct tty_driver *other; /* only used for the PTY driver */
  
  	/*
  	 * Pointer to the tty data structures
  	 */
  	struct tty_struct **ttys;
04831dc15   Jiri Slaby   TTY: add ports ar...
320
  	struct tty_port **ports;
edc6afc54   Alan Cox   [PATCH] tty: swit...
321
  	struct ktermios **termios;
f34d7a5b7   Alan Cox   tty: The big oper...
322
  	void *driver_state;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
323
  	/*
f34d7a5b7   Alan Cox   tty: The big oper...
324
  	 * Driver methods
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
325
  	 */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
326

f34d7a5b7   Alan Cox   tty: The big oper...
327
  	const struct tty_operations *ops;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
328
  	struct list_head tty_drivers;
3859a271a   Kees Cook   randstruct: Mark ...
329
  } __randomize_layout;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
330
331
  
  extern struct list_head tty_drivers;
7f0bc6a68   Jiri Slaby   TTY: pass flags t...
332
333
  extern struct tty_driver *__tty_alloc_driver(unsigned int lines,
  		struct module *owner, unsigned long flags);
7d7b93c14   Alan Cox   tty: kref the tty...
334
335
  extern void put_tty_driver(struct tty_driver *driver);
  extern void tty_set_operations(struct tty_driver *driver,
b68e31d0e   Jeff Dike   [PATCH] const str...
336
  			const struct tty_operations *op);
f2d937f3b   Jason Wessel   consoles: polling...
337
  extern struct tty_driver *tty_find_polling_driver(char *name, int *line);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
338

7d7b93c14   Alan Cox   tty: kref the tty...
339
  extern void tty_driver_kref_put(struct tty_driver *driver);
f786ddd28   Adrian Bunk   tty: Correct inli...
340

7f0bc6a68   Jiri Slaby   TTY: pass flags t...
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
  /* Use TTY_DRIVER_* flags below */
  #define tty_alloc_driver(lines, flags) \
  		__tty_alloc_driver(lines, THIS_MODULE, flags)
  
  /*
   * DEPRECATED Do not use this in new code, use tty_alloc_driver instead.
   * (And change the return value checks.)
   */
  static inline struct tty_driver *alloc_tty_driver(unsigned int lines)
  {
  	struct tty_driver *ret = tty_alloc_driver(lines, 0);
  	if (IS_ERR(ret))
  		return NULL;
  	return ret;
  }
1a54a76d5   Jiri Slaby   TTY: let alloc_tt...
356

f786ddd28   Adrian Bunk   tty: Correct inli...
357
  static inline struct tty_driver *tty_driver_kref_get(struct tty_driver *d)
7d7b93c14   Alan Cox   tty: kref the tty...
358
359
360
361
  {
  	kref_get(&d->kref);
  	return d;
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
  /* tty driver magic number */
  #define TTY_DRIVER_MAGIC		0x5402
  
  /*
   * tty driver flags
   * 
   * TTY_DRIVER_RESET_TERMIOS --- requests the tty layer to reset the
   * 	termios setting when the last process has closed the device.
   * 	Used for PTY's, in particular.
   * 
   * TTY_DRIVER_REAL_RAW --- if set, indicates that the driver will
   * 	guarantee never not to set any special character handling
   * 	flags if ((IGNBRK || (!BRKINT && !PARMRK)) && (IGNPAR ||
   * 	!INPCK)).  That is, if there is no reason for the driver to
   * 	send notifications of parity and break characters up to the
   * 	line driver, it won't do so.  This allows the line driver to
   *	optimize for this case if this flag is set.  (Note that there
   * 	is also a promise, if the above case is true, not to signal
   * 	overruns, either.)
   *
331b83198   Greg Kroah-Hartman   [PATCH] devfs: Re...
382
   * TTY_DRIVER_DYNAMIC_DEV --- if set, the individual tty devices need
6ce5b1ce5   Timur Tabi   tty: fix typos/er...
383
   *	to be registered with a call to tty_register_device() when the
331b83198   Greg Kroah-Hartman   [PATCH] devfs: Re...
384
385
386
387
388
389
390
   *	device is found in the system and unregistered with a call to
   *	tty_unregister_device() so the devices will be show up
   *	properly in sysfs.  If not set, driver->num entries will be
   *	created by the tty core in sysfs when tty_register_driver() is
   *	called.  This is to be used by drivers that have tty devices
   *	that can appear and disappear while the main tty driver is
   *	registered with the tty core.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
391
392
393
394
   *
   * TTY_DRIVER_DEVPTS_MEM -- don't use the standard arrays, instead
   *	use dynamic memory keyed through the devpts filesystem.  This
   *	is only applicable to the pty driver.
9e98966c7   Alan Cox   tty: rework break...
395
396
397
398
399
   *
   * TTY_DRIVER_HARDWARE_BREAK -- hardware handles break signals. Pass
   *	the requested timeout to the caller instead of using a simple
   *	on/off interface.
   *
21aca2fa0   Jiri Slaby   TTY: pty, switch ...
400
401
402
   * TTY_DRIVER_DYNAMIC_ALLOC -- do not allocate structures which are
   *	needed per line for this driver as it would waste memory.
   *	The driver will take care.
0019b4089   Jiri Slaby   TTY: add support ...
403
404
405
406
407
   *
   * TTY_DRIVER_UNNUMBERED_NODE -- do not create numbered /dev nodes. In
   *	other words create /dev/ttyprintk and not /dev/ttyprintk0.
   *	Applicable only when a driver for a single tty device is
   *	being allocated.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
408
409
410
411
   */
  #define TTY_DRIVER_INSTALLED		0x0001
  #define TTY_DRIVER_RESET_TERMIOS	0x0002
  #define TTY_DRIVER_REAL_RAW		0x0004
331b83198   Greg Kroah-Hartman   [PATCH] devfs: Re...
412
  #define TTY_DRIVER_DYNAMIC_DEV		0x0008
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
413
  #define TTY_DRIVER_DEVPTS_MEM		0x0010
9e98966c7   Alan Cox   tty: rework break...
414
  #define TTY_DRIVER_HARDWARE_BREAK	0x0020
21aca2fa0   Jiri Slaby   TTY: pty, switch ...
415
  #define TTY_DRIVER_DYNAMIC_ALLOC	0x0040
0019b4089   Jiri Slaby   TTY: add support ...
416
  #define TTY_DRIVER_UNNUMBERED_NODE	0x0080
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
  
  /* tty driver types */
  #define TTY_DRIVER_TYPE_SYSTEM		0x0001
  #define TTY_DRIVER_TYPE_CONSOLE		0x0002
  #define TTY_DRIVER_TYPE_SERIAL		0x0003
  #define TTY_DRIVER_TYPE_PTY		0x0004
  #define TTY_DRIVER_TYPE_SCC		0x0005	/* scc driver */
  #define TTY_DRIVER_TYPE_SYSCONS		0x0006
  
  /* system subtypes (magic, used by tty_io.c) */
  #define SYSTEM_TYPE_TTY			0x0001
  #define SYSTEM_TYPE_CONSOLE		0x0002
  #define SYSTEM_TYPE_SYSCONS		0x0003
  #define SYSTEM_TYPE_SYSPTMX		0x0004
  
  /* pty subtypes (magic, used by tty_io.c) */
  #define PTY_TYPE_MASTER			0x0001
  #define PTY_TYPE_SLAVE			0x0002
  
  /* serial subtype definitions */
  #define SERIAL_TYPE_NORMAL	1
  
  #endif /* #ifdef _LINUX_TTY_DRIVER_H */