ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / arch / um / include / line.h
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 "asm/semaphore.h"
13 #include "chan_user.h"
14 #include "mconsole_kern.h"
15
16 struct line_driver {
17         char *name;
18         char *devfs_name;
19         short major;
20         short minor_start;
21         short type;
22         short subtype;
23         int read_irq;
24         char *read_irq_name;
25         int write_irq;
26         char *write_irq_name;
27         char *symlink_from;
28         char *symlink_to;
29         struct mc_device mc;
30 };
31
32 struct line {
33         char *init_str;
34         int init_pri;
35         struct list_head chan_list;
36         int valid;
37         int count;
38         struct tty_struct *tty;
39         struct semaphore sem;
40         char *buffer;
41         char *head;
42         char *tail;
43         int sigio;
44         struct work_struct task;
45         struct line_driver *driver;
46         int have_irq;
47 };
48
49 #define LINE_INIT(str, d) \
50         { init_str :    str, \
51           init_pri :    INIT_STATIC, \
52           chan_list :   { }, \
53           valid :       1, \
54           count :       0, \
55           tty :         NULL, \
56           sem :         { }, \
57           buffer :      NULL, \
58           head :        NULL, \
59           tail :        NULL, \
60           sigio :       0, \
61           driver :      d, \
62           have_irq :    0 }
63
64 struct lines {
65         int num;
66 };
67
68 #define LINES_INIT(n) {  num :          n }
69
70 extern void line_interrupt(int irq, void *data, struct pt_regs *unused);
71 extern void line_write_interrupt(int irq, void *data, struct pt_regs *unused);
72 extern void line_close(struct line *lines, struct tty_struct *tty);
73 extern int line_open(struct line *lines, struct tty_struct *tty, 
74                      struct chan_opts *opts);
75 extern int line_setup(struct line *lines, int num, char *init, 
76                       int all_allowed);
77 extern int line_write(struct line *line, struct tty_struct *tty, int from_user,
78                       const char *buf, int len);
79 extern int line_write_room(struct tty_struct *tty);
80 extern char *add_xterm_umid(char *base);
81 extern int line_setup_irq(int fd, int input, int output, void *data);
82 extern void line_close_chan(struct line *line);
83 extern void line_disable(struct line *line, int current_irq);
84 extern struct tty_driver * line_register_devfs(struct lines *set, 
85                                 struct line_driver *line_driver, 
86                                 struct tty_operations *driver,
87                                 struct line *lines,
88                                 int nlines);
89 extern void lines_init(struct line *lines, int nlines);
90 extern void close_lines(struct line *lines, int nlines);
91 extern int line_config(struct line *lines, int num, char *str);
92 extern int line_remove(struct line *lines, int num, char *str);
93 extern int line_get_config(char *dev, struct line *lines, int num, char *str, 
94                            int size, char **error_out);
95
96 #endif
97
98 /*
99  * Overrides for Emacs so that we follow Linus's tabbing style.
100  * Emacs will notice this stuff at the end of the file and automatically
101  * adjust the settings for this buffer only.  This must remain at the end
102  * of the file.
103  * ---------------------------------------------------------------------------
104  * Local variables:
105  * c-file-style: "linux"
106  * End:
107  */