aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/drivers/line.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um/drivers/line.h')
-rw-r--r--arch/um/drivers/line.h106
1 files changed, 106 insertions, 0 deletions
diff --git a/arch/um/drivers/line.h b/arch/um/drivers/line.h
new file mode 100644
index 00000000000..63df3ca02ac
--- /dev/null
+++ b/arch/um/drivers/line.h
@@ -0,0 +1,106 @@
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"
13#include "linux/spinlock.h"
14#include "linux/mutex.h"
15#include "chan_user.h"
16#include "mconsole_kern.h"
17
18/* There's only one modifiable field in this - .mc.list */
19struct line_driver {
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;
30 struct mc_device mc;
31};
32
33struct line {
34 struct tty_struct *tty;
35 spinlock_t count_lock;
36 unsigned long count;
37 int valid;
38
39 char *init_str;
40 int init_pri;
41 struct list_head chan_list;
42
43 /*This lock is actually, mostly, local to*/
44 spinlock_t lock;
45 int throttled;
46 /* Yes, this is a real circular buffer.
47 * XXX: And this should become a struct kfifo!
48 *
49 * buffer points to a buffer allocated on demand, of length
50 * LINE_BUFSIZE, head to the start of the ring, tail to the end.*/
51 char *buffer;
52 char *head;
53 char *tail;
54
55 int sigio;
56 struct delayed_work task;
57 const struct line_driver *driver;
58 int have_irq;
59};
60
61#define LINE_INIT(str, d) \
62 { .count_lock = __SPIN_LOCK_UNLOCKED((str).count_lock), \
63 .init_str = str, \
64 .init_pri = INIT_STATIC, \
65 .valid = 1, \
66 .lock = __SPIN_LOCK_UNLOCKED((str).lock), \
67 .driver = d }
68
69extern void line_close(struct tty_struct *tty, struct file * filp);
70extern int line_open(struct line *lines, struct tty_struct *tty);
71extern int line_setup(struct line *lines, unsigned int sizeof_lines,
72 char *init, char **error_out);
73extern int line_write(struct tty_struct *tty, const unsigned char *buf,
74 int len);
75extern int line_put_char(struct tty_struct *tty, unsigned char ch);
76extern void line_set_termios(struct tty_struct *tty, struct ktermios * old);
77extern int line_chars_in_buffer(struct tty_struct *tty);
78extern void line_flush_buffer(struct tty_struct *tty);
79extern void line_flush_chars(struct tty_struct *tty);
80extern int line_write_room(struct tty_struct *tty);
81extern int line_ioctl(struct tty_struct *tty, unsigned int cmd,
82 unsigned long arg);
83extern void line_throttle(struct tty_struct *tty);
84extern void line_unthrottle(struct tty_struct *tty);
85
86extern char *add_xterm_umid(char *base);
87extern int line_setup_irq(int fd, int input, int output, struct line *line,
88 void *data);
89extern void line_close_chan(struct line *line);
90extern struct tty_driver *register_lines(struct line_driver *line_driver,
91 const struct tty_operations *driver,
92 struct line *lines, int nlines);
93extern void lines_init(struct line *lines, int nlines, struct chan_opts *opts);
94extern void close_lines(struct line *lines, int nlines);
95
96extern int line_config(struct line *lines, unsigned int sizeof_lines,
97 char *str, const struct chan_opts *opts,
98 char **error_out);
99extern int line_id(char **str, int *start_out, int *end_out);
100extern int line_remove(struct line *lines, unsigned int sizeof_lines, int n,
101 char **error_out);
102extern int line_get_config(char *dev, struct line *lines,
103 unsigned int sizeof_lines, char *str,
104 int size, char **error_out);
105
106#endif