]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * Copyright (C) 2001, 2002 Jeff Dike (jdike@karaya.com) | |
3 | * Licensed under the GPL | |
4 | */ | |
5 | ||
6 | #ifndef __LINE_H__ | |
7 | #define __LINE_H__ | |
8 | ||
37185b33 AV |
9 | #include <linux/list.h> |
10 | #include <linux/workqueue.h> | |
11 | #include <linux/tty.h> | |
12 | #include <linux/interrupt.h> | |
13 | #include <linux/spinlock.h> | |
14 | #include <linux/mutex.h> | |
1da177e4 LT |
15 | #include "chan_user.h" |
16 | #include "mconsole_kern.h" | |
17 | ||
cfe6b7c7 | 18 | /* There's only two modifiable fields in this - .mc.list and .driver */ |
1da177e4 | 19 | struct line_driver { |
d5c9ffc6 JD |
20 | const char *name; |
21 | const char *device_name; | |
22 | const short major; | |
23 | const short minor_start; | |
24 | const short type; | |
25 | const short subtype; | |
26 | const int read_irq; | |
27 | const char *read_irq_name; | |
28 | const int write_irq; | |
29 | const char *write_irq_name; | |
1da177e4 | 30 | struct mc_device mc; |
cfe6b7c7 | 31 | struct tty_driver *driver; |
1da177e4 LT |
32 | }; |
33 | ||
34 | struct line { | |
060ed31d | 35 | struct tty_port port; |
d79a5809 JD |
36 | int valid; |
37 | ||
1da177e4 | 38 | char *init_str; |
1da177e4 | 39 | struct list_head chan_list; |
ee485070 | 40 | struct chan *chan_in, *chan_out; |
d79a5809 | 41 | |
b97b77cc PBG |
42 | /*This lock is actually, mostly, local to*/ |
43 | spinlock_t lock; | |
d79a5809 | 44 | int throttled; |
b97b77cc PBG |
45 | /* Yes, this is a real circular buffer. |
46 | * XXX: And this should become a struct kfifo! | |
47 | * | |
48 | * buffer points to a buffer allocated on demand, of length | |
49 | * LINE_BUFSIZE, head to the start of the ring, tail to the end.*/ | |
1da177e4 LT |
50 | char *buffer; |
51 | char *head; | |
52 | char *tail; | |
b97b77cc | 53 | |
1da177e4 | 54 | int sigio; |
a2ce7740 | 55 | struct delayed_work task; |
5e7672ec | 56 | const struct line_driver *driver; |
1da177e4 LT |
57 | }; |
58 | ||
1da177e4 | 59 | extern void line_close(struct tty_struct *tty, struct file * filp); |
79e0273d RW |
60 | extern int line_open(struct tty_struct *tty, struct file *filp); |
61 | extern int line_install(struct tty_driver *driver, struct tty_struct *tty, | |
62 | struct line *line); | |
63 | extern void line_cleanup(struct tty_struct *tty); | |
64 | extern void line_hangup(struct tty_struct *tty); | |
43574c1a AV |
65 | extern int line_setup(char **conf, unsigned nlines, char **def, |
66 | char *init, char *name); | |
d50084a2 JD |
67 | extern int line_write(struct tty_struct *tty, const unsigned char *buf, |
68 | int len); | |
3168cb98 | 69 | extern int line_put_char(struct tty_struct *tty, unsigned char ch); |
606d099c | 70 | extern void line_set_termios(struct tty_struct *tty, struct ktermios * old); |
1da177e4 | 71 | extern int line_chars_in_buffer(struct tty_struct *tty); |
b97b77cc PBG |
72 | extern void line_flush_buffer(struct tty_struct *tty); |
73 | extern void line_flush_chars(struct tty_struct *tty); | |
1da177e4 | 74 | extern int line_write_room(struct tty_struct *tty); |
e4dcee80 JD |
75 | extern void line_throttle(struct tty_struct *tty); |
76 | extern void line_unthrottle(struct tty_struct *tty); | |
b97b77cc | 77 | |
1da177e4 | 78 | extern char *add_xterm_umid(char *base); |
165dc591 JD |
79 | extern int line_setup_irq(int fd, int input, int output, struct line *line, |
80 | void *data); | |
1da177e4 | 81 | extern void line_close_chan(struct line *line); |
cfe6b7c7 AV |
82 | extern int register_lines(struct line_driver *line_driver, |
83 | const struct tty_operations *driver, | |
84 | struct line *lines, int nlines); | |
04292b2c AV |
85 | extern int setup_one_line(struct line *lines, int n, char *init, |
86 | const struct chan_opts *opts, char **error_out); | |
1da177e4 | 87 | extern void close_lines(struct line *lines, int nlines); |
b97b77cc | 88 | |
d50084a2 | 89 | extern int line_config(struct line *lines, unsigned int sizeof_lines, |
f28169d2 JD |
90 | char *str, const struct chan_opts *opts, |
91 | char **error_out); | |
29d56cfe | 92 | extern int line_id(char **str, int *start_out, int *end_out); |
f28169d2 JD |
93 | extern int line_remove(struct line *lines, unsigned int sizeof_lines, int n, |
94 | char **error_out); | |
d50084a2 JD |
95 | extern int line_get_config(char *dev, struct line *lines, |
96 | unsigned int sizeof_lines, char *str, | |
1da177e4 LT |
97 | int size, char **error_out); |
98 | ||
99 | #endif |