blob: 2d9aa7ef4c27d5db7eb40a759848e9cc9a42129e [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Copyright (C) 2000, 2001 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __CHAN_KERN_H__
7#define __CHAN_KERN_H__
8
9#include "linux/tty.h"
10#include "linux/list.h"
11#include "linux/console.h"
12#include "chan_user.h"
13#include "line.h"
14
15struct chan {
16 struct list_head list;
Jeff Dike165dc592006-01-06 00:18:57 -080017 struct list_head free_list;
18 struct line *line;
Linus Torvalds1da177e2005-04-16 15:20:36 -070019 char *dev;
20 unsigned int primary:1;
21 unsigned int input:1;
22 unsigned int output:1;
23 unsigned int opened:1;
Jeff Dike165dc592006-01-06 00:18:57 -080024 unsigned int enabled:1;
Linus Torvalds1da177e2005-04-16 15:20:36 -070025 int fd;
Jeff Dike5e7672e2006-09-27 01:50:33 -070026 const struct chan_ops *ops;
Linus Torvalds1da177e2005-04-16 15:20:36 -070027 void *data;
28};
29
Andrew Mortona2ce7742006-12-06 20:31:36 -080030extern void chan_interrupt(struct list_head *chans, struct delayed_work *task,
Linus Torvalds1da177e2005-04-16 15:20:36 -070031 struct tty_struct *tty, int irq);
Jeff Dike165dc592006-01-06 00:18:57 -080032extern int parse_chan_pair(char *str, struct line *line, int device,
Jeff Dikef28169d2007-02-10 01:43:53 -080033 const struct chan_opts *opts, char **error_out);
Linus Torvalds1da177e2005-04-16 15:20:36 -070034extern int open_chan(struct list_head *chans);
35extern int write_chan(struct list_head *chans, const char *buf, int len,
36 int write_irq);
37extern int console_write_chan(struct list_head *chans, const char *buf,
38 int len);
39extern int console_open_chan(struct line *line, struct console *co,
Jeff Dike5e7672e2006-09-27 01:50:33 -070040 const struct chan_opts *opts);
Jeff Dikee4dcee82006-01-06 00:18:58 -080041extern void deactivate_chan(struct list_head *chans, int irq);
42extern void reactivate_chan(struct list_head *chans, int irq);
Linus Torvalds1da177e2005-04-16 15:20:36 -070043extern void chan_enable_winch(struct list_head *chans, struct tty_struct *tty);
Jeff Dike165dc592006-01-06 00:18:57 -080044extern void enable_chan(struct line *line);
45extern void close_chan(struct list_head *chans, int delay_free_irq);
Linus Torvalds1da177e2005-04-16 15:20:36 -070046extern int chan_window_size(struct list_head *chans,
47 unsigned short *rows_out,
48 unsigned short *cols_out);
49extern int chan_out_fd(struct list_head *chans);
50extern int chan_config_string(struct list_head *chans, char *str, int size,
51 char **error_out);
52
53#endif