blob: 6d81ecc17be5b5ea6240e56477b390507af444e6 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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 "asm/semaphore.h"
14#include "chan_user.h"
15#include "mconsole_kern.h"
16
17struct 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
34struct line {
35 char *init_str;
36 int init_pri;
37 struct list_head chan_list;
38 int valid;
39 int count;
40 struct semaphore sem;
41 char *buffer;
42 char *head;
43 char *tail;
44 int sigio;
45 struct work_struct task;
46 struct line_driver *driver;
47 int have_irq;
48};
49
50#define LINE_INIT(str, d) \
51 { init_str : str, \
52 init_pri : INIT_STATIC, \
53 chan_list : { }, \
54 valid : 1, \
55 sem : { }, \
56 buffer : NULL, \
57 head : NULL, \
58 tail : NULL, \
59 sigio : 0, \
60 driver : d, \
61 have_irq : 0 }
62
63struct lines {
64 int num;
65};
66
67#define LINES_INIT(n) { num : n }
68
69extern void line_close(struct tty_struct *tty, struct file * filp);
70extern int line_open(struct line *lines, struct tty_struct *tty,
71 struct chan_opts *opts);
72extern int line_setup(struct line *lines, int num, char *init,
73 int all_allowed);
74extern int line_write(struct tty_struct *tty, const unsigned char *buf, int len);
75extern void line_put_char(struct tty_struct *tty, unsigned char ch);
76extern void line_set_termios(struct tty_struct *tty, struct termios * old);
77extern int line_chars_in_buffer(struct tty_struct *tty);
78extern int line_write_room(struct tty_struct *tty);
79extern int line_ioctl(struct tty_struct *tty, struct file * file,
80 unsigned int cmd, unsigned long arg);
81extern char *add_xterm_umid(char *base);
82extern int line_setup_irq(int fd, int input, int output, struct tty_struct *tty);
83extern void line_close_chan(struct line *line);
84extern void line_disable(struct tty_struct *tty, int current_irq);
85extern struct tty_driver * line_register_devfs(struct lines *set,
86 struct line_driver *line_driver,
87 struct tty_operations *driver,
88 struct line *lines,
89 int nlines);
90extern void lines_init(struct line *lines, int nlines);
91extern void close_lines(struct line *lines, int nlines);
92extern int line_config(struct line *lines, int num, char *str);
93extern int line_remove(struct line *lines, int num, char *str);
94extern int line_get_config(char *dev, struct line *lines, int num, char *str,
95 int size, char **error_out);
96
97#endif
98
99/*
100 * Overrides for Emacs so that we follow Linus's tabbing style.
101 * Emacs will notice this stuff at the end of the file and automatically
102 * adjust the settings for this buffer only. This must remain at the end
103 * of the file.
104 * ---------------------------------------------------------------------------
105 * Local variables:
106 * c-file-style: "linux"
107 * End:
108 */