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 | ||
9 | #include "linux/list.h" | |
10 | #include "linux/workqueue.h" | |
11 | #include "linux/tty.h" | |
12 | #include "linux/interrupt.h" | |
b97b77cc | 13 | #include "linux/spinlock.h" |
1da177e4 LT |
14 | #include "chan_user.h" |
15 | #include "mconsole_kern.h" | |
16 | ||
17 | struct line_driver { | |
18 | char *name; | |
19 | char *device_name; | |
20 | char *devfs_name; | |
21 | short major; | |
22 | short minor_start; | |
23 | short type; | |
24 | short subtype; | |
25 | int read_irq; | |
26 | char *read_irq_name; | |
27 | int write_irq; | |
28 | char *write_irq_name; | |
29 | char *symlink_from; | |
30 | char *symlink_to; | |
31 | struct mc_device mc; | |
32 | }; | |
33 | ||
34 | struct line { | |
35 | char *init_str; | |
36 | int init_pri; | |
37 | struct list_head chan_list; | |
38 | int valid; | |
39 | int count; | |
b97b77cc PBG |
40 | /*This lock is actually, mostly, local to*/ |
41 | spinlock_t lock; | |
42 | ||
43 | /* Yes, this is a real circular buffer. | |
44 | * XXX: And this should become a struct kfifo! | |
45 | * | |
46 | * buffer points to a buffer allocated on demand, of length | |
47 | * LINE_BUFSIZE, head to the start of the ring, tail to the end.*/ | |
1da177e4 LT |
48 | char *buffer; |
49 | char *head; | |
50 | char *tail; | |
b97b77cc | 51 | |
1da177e4 LT |
52 | int sigio; |
53 | struct work_struct task; | |
54 | struct line_driver *driver; | |
55 | int have_irq; | |
56 | }; | |
57 | ||
58 | #define LINE_INIT(str, d) \ | |
59 | { init_str : str, \ | |
60 | init_pri : INIT_STATIC, \ | |
61 | chan_list : { }, \ | |
62 | valid : 1, \ | |
1da177e4 LT |
63 | buffer : NULL, \ |
64 | head : NULL, \ | |
65 | tail : NULL, \ | |
66 | sigio : 0, \ | |
d50084a2 JD |
67 | driver : d, \ |
68 | have_irq : 0 } | |
1da177e4 LT |
69 | |
70 | struct lines { | |
71 | int num; | |
72 | }; | |
73 | ||
74 | #define LINES_INIT(n) { num : n } | |
75 | ||
76 | extern void line_close(struct tty_struct *tty, struct file * filp); | |
d50084a2 | 77 | extern int line_open(struct line *lines, struct tty_struct *tty, |
1da177e4 | 78 | struct chan_opts *opts); |
b97b77cc | 79 | extern int line_setup(struct line *lines, unsigned int sizeof_lines, char *init, |
1da177e4 | 80 | int all_allowed); |
d50084a2 JD |
81 | extern int line_write(struct tty_struct *tty, const unsigned char *buf, |
82 | int len); | |
1da177e4 LT |
83 | extern void line_put_char(struct tty_struct *tty, unsigned char ch); |
84 | extern void line_set_termios(struct tty_struct *tty, struct termios * old); | |
85 | extern int line_chars_in_buffer(struct tty_struct *tty); | |
b97b77cc PBG |
86 | extern void line_flush_buffer(struct tty_struct *tty); |
87 | extern void line_flush_chars(struct tty_struct *tty); | |
1da177e4 LT |
88 | extern int line_write_room(struct tty_struct *tty); |
89 | extern int line_ioctl(struct tty_struct *tty, struct file * file, | |
90 | unsigned int cmd, unsigned long arg); | |
b97b77cc | 91 | |
1da177e4 | 92 | extern char *add_xterm_umid(char *base); |
d50084a2 JD |
93 | extern int line_setup_irq(int fd, int input, int output, |
94 | struct tty_struct *tty); | |
1da177e4 LT |
95 | extern void line_close_chan(struct line *line); |
96 | extern void line_disable(struct tty_struct *tty, int current_irq); | |
d50084a2 JD |
97 | extern struct tty_driver * line_register_devfs(struct lines *set, |
98 | struct line_driver *line_driver, | |
1da177e4 LT |
99 | struct tty_operations *driver, |
100 | struct line *lines, | |
101 | int nlines); | |
102 | extern void lines_init(struct line *lines, int nlines); | |
103 | extern void close_lines(struct line *lines, int nlines); | |
b97b77cc | 104 | |
d50084a2 JD |
105 | extern int line_config(struct line *lines, unsigned int sizeof_lines, |
106 | char *str); | |
29d56cfe JD |
107 | extern int line_id(char **str, int *start_out, int *end_out); |
108 | extern int line_remove(struct line *lines, unsigned int sizeof_lines, int n); | |
d50084a2 JD |
109 | extern int line_get_config(char *dev, struct line *lines, |
110 | unsigned int sizeof_lines, char *str, | |
1da177e4 LT |
111 | int size, char **error_out); |
112 | ||
113 | #endif |