blob: c512b0306dd41beff8039787d1eca7b90546ed40 [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
Al Viro510c72a32011-08-18 20:08:29 +01009#include <linux/tty.h>
10#include <linux/list.h>
11#include <linux/console.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070012#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
Jiri Slaby2e124b42013-01-03 15:53:06 +010030extern void chan_interrupt(struct line *line, int irq);
Jeff Dike165dc592006-01-06 00:18:57 -080031extern int parse_chan_pair(char *str, struct line *line, int device,
Jeff Dikef28169d2007-02-10 01:43:53 -080032 const struct chan_opts *opts, char **error_out);
Al Virobed5e392011-09-08 10:49:34 -040033extern int write_chan(struct chan *chan, const char *buf, int len,
Linus Torvalds1da177e2005-04-16 15:20:36 -070034 int write_irq);
Al Virobed5e392011-09-08 10:49:34 -040035extern int console_write_chan(struct chan *chan, const char *buf,
Linus Torvalds1da177e2005-04-16 15:20:36 -070036 int len);
Jeff Dikea52f3622007-02-10 01:44:06 -080037extern int console_open_chan(struct line *line, struct console *co);
Al Virobed5e392011-09-08 10:49:34 -040038extern void deactivate_chan(struct chan *chan, int irq);
39extern void reactivate_chan(struct chan *chan, int irq);
Richard Weinberger2116bda2013-03-11 10:05:45 +010040extern void chan_enable_winch(struct chan *chan, struct tty_port *port);
Jeff Diked14ad812007-07-15 23:38:54 -070041extern int enable_chan(struct line *line);
Al Viro10c890c02011-09-10 08:39:18 -040042extern void close_chan(struct line *line);
Al Virobed5e392011-09-08 10:49:34 -040043extern int chan_window_size(struct line *line,
Linus Torvalds1da177e2005-04-16 15:20:36 -070044 unsigned short *rows_out,
45 unsigned short *cols_out);
Al Virobed5e392011-09-08 10:49:34 -040046extern int chan_config_string(struct line *line, char *str, int size,
Linus Torvalds1da177e2005-04-16 15:20:36 -070047 char **error_out);
48
49#endif